From owner-svn-src-all@FreeBSD.ORG Sun Oct 19 03:17:04 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1EF68A56; Sun, 19 Oct 2014 03:17:04 +0000 (UTC) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.59.238]) by mx1.freebsd.org (Postfix) with ESMTP id 85DF4DAA; Sun, 19 Oct 2014 03:17:03 +0000 (UTC) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id 9D27E7300A; Sun, 19 Oct 2014 05:20:38 +0200 (CEST) Date: Sun, 19 Oct 2014 05:20:38 +0200 From: Luigi Rizzo To: Adrian Chadd Subject: Re: svn commit: r273266 - in head: lib/libkvm sys/compat/freebsd32 sys/kern sys/sys Message-ID: <20141019032038.GA41067@onelab2.iet.unipi.it> References: <201410181936.s9IJaCwu018930@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201410181936.s9IJaCwu018930@svn.freebsd.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 03:17:04 -0000 On Sat, Oct 18, 2014 at 07:36:12PM +0000, Adrian Chadd wrote: > Author: adrian > Date: Sat Oct 18 19:36:11 2014 > New Revision: 273266 > URL: https://svnweb.freebsd.org/changeset/base/273266 > > Log: > Update the ULE scheduler + thread and kinfo structs to use int for cpuid > rather than u_char. > > To try and play nice with the ABI, the u_char CPU ID values are clamped > at 254. The new fields now contain the full CPU ID, or -1 for no cpu. This causes the following error with gcc: cc1: warnings being treated as errors /usr/home/luigi/FreeBSD/head/sys/kern/kern_intr.c: In function 'intr_setaffinity': /usr/home/luigi/FreeBSD/head/sys/kern/kern_intr.c:378: warning: comparison is always true due to limited range of data type *** Error code 1 I suppose we can use NOCPU_OLD, or cast. cheers luigi > Differential Revision: D955 > Reviewed by: jhb, kib > Sponsored by: Norse Corp, Inc. > > Modified: > head/lib/libkvm/kvm_proc.c > head/sys/compat/freebsd32/freebsd32.h > head/sys/kern/kern_proc.c > head/sys/kern/sched_ule.c > head/sys/sys/proc.h > head/sys/sys/user.h > > Modified: head/lib/libkvm/kvm_proc.c > ============================================================================== > --- head/lib/libkvm/kvm_proc.c Sat Oct 18 19:22:59 2014 (r273265) > +++ head/lib/libkvm/kvm_proc.c Sat Oct 18 19:36:11 2014 (r273266) > @@ -431,6 +431,24 @@ nopgrp: > strlcpy(kp->ki_tdname, mtd.td_name, sizeof(kp->ki_tdname)); > kp->ki_pctcpu = 0; > kp->ki_rqindex = 0; > + > + /* > + * Note: legacy fields; wraps at NO_CPU_OLD or the > + * old max CPU value as appropriate > + */ > + if (mtd.td_lastcpu == NOCPU) > + kp->ki_lastcpu_old = NOCPU_OLD; > + else if (mtd.td_lastcpu > MAXCPU_OLD) > + kp->ki_lastcpu_old = MAXCPU_OLD; > + else > + kp->ki_lastcpu_old = mtd.td_lastcpu; > + > + if (mtd.td_oncpu == NOCPU) > + kp->ki_oncpu_old = NOCPU_OLD; > + else if (mtd.td_oncpu > MAXCPU_OLD) > + kp->ki_oncpu_old = MAXCPU_OLD; > + else > + kp->ki_oncpu_old = mtd.td_oncpu; > } else { > kp->ki_stat = SZOMB; > } > > Modified: head/sys/compat/freebsd32/freebsd32.h > ============================================================================== > --- head/sys/compat/freebsd32/freebsd32.h Sat Oct 18 19:22:59 2014 (r273265) > +++ head/sys/compat/freebsd32/freebsd32.h Sat Oct 18 19:36:11 2014 (r273266) > @@ -332,8 +332,8 @@ struct kinfo_proc32 { > signed char ki_nice; > char ki_lock; > char ki_rqindex; > - u_char ki_oncpu; > - u_char ki_lastcpu; > + u_char ki_oncpu_old; > + u_char ki_lastcpu_old; > char ki_tdname[TDNAMLEN+1]; > char ki_wmesg[WMESGLEN+1]; > char ki_login[LOGNAMELEN+1]; > @@ -343,6 +343,8 @@ struct kinfo_proc32 { > char ki_loginclass[LOGINCLASSLEN+1]; > char ki_sparestrings[50]; > int ki_spareints[KI_NSPARE_INT]; > + int ki_oncpu; > + int ki_lastcpu; > int ki_tracer; > int ki_flag2; > int ki_fibnum; > > Modified: head/sys/kern/kern_proc.c > ============================================================================== > --- head/sys/kern/kern_proc.c Sat Oct 18 19:22:59 2014 (r273265) > +++ head/sys/kern/kern_proc.c Sat Oct 18 19:36:11 2014 (r273266) > @@ -984,6 +984,25 @@ fill_kinfo_thread(struct thread *td, str > kp->ki_wchan = td->td_wchan; > kp->ki_pri.pri_level = td->td_priority; > kp->ki_pri.pri_native = td->td_base_pri; > + > + /* > + * Note: legacy fields; clamp at the old NOCPU value and/or > + * the maximum u_char CPU value. > + */ > + if (td->td_lastcpu == NOCPU) > + kp->ki_lastcpu_old = NOCPU_OLD; > + else if (td->td_lastcpu > MAXCPU_OLD) > + kp->ki_lastcpu_old = MAXCPU_OLD; > + else > + kp->ki_lastcpu_old = td->td_lastcpu; > + > + if (td->td_oncpu == NOCPU) > + kp->ki_oncpu_old = NOCPU_OLD; > + else if (td->td_oncpu > MAXCPU_OLD) > + kp->ki_oncpu_old = MAXCPU_OLD; > + else > + kp->ki_oncpu_old = td->td_oncpu; > + > kp->ki_lastcpu = td->td_lastcpu; > kp->ki_oncpu = td->td_oncpu; > kp->ki_tdflags = td->td_flags; > @@ -1164,6 +1183,11 @@ freebsd32_kinfo_proc_out(const struct ki > CP(*ki, *ki32, ki_rqindex); > CP(*ki, *ki32, ki_oncpu); > CP(*ki, *ki32, ki_lastcpu); > + > + /* XXX TODO: wrap cpu value as appropriate */ > + CP(*ki, *ki32, ki_oncpu_old); > + CP(*ki, *ki32, ki_lastcpu_old); > + > bcopy(ki->ki_tdname, ki32->ki_tdname, TDNAMLEN + 1); > bcopy(ki->ki_wmesg, ki32->ki_wmesg, WMESGLEN + 1); > bcopy(ki->ki_login, ki32->ki_login, LOGNAMELEN + 1); > > Modified: head/sys/kern/sched_ule.c > ============================================================================== > --- head/sys/kern/sched_ule.c Sat Oct 18 19:22:59 2014 (r273265) > +++ head/sys/kern/sched_ule.c Sat Oct 18 19:36:11 2014 (r273266) > @@ -90,7 +90,7 @@ dtrace_vtime_switch_func_t dtrace_vtime_ > struct td_sched { > struct runq *ts_runq; /* Run-queue we're queued on. */ > short ts_flags; /* TSF_* flags. */ > - u_char ts_cpu; /* CPU that we have affinity for. */ > + int ts_cpu; /* CPU that we have affinity for. */ > int ts_rltick; /* Real last tick, for affinity. */ > int ts_slice; /* Ticks of slice remaining. */ > u_int ts_slptime; /* Number of ticks we vol. slept */ > > Modified: head/sys/sys/proc.h > ============================================================================== > --- head/sys/sys/proc.h Sat Oct 18 19:22:59 2014 (r273265) > +++ head/sys/sys/proc.h Sat Oct 18 19:36:11 2014 (r273266) > @@ -229,8 +229,8 @@ struct thread { > int td_sqqueue; /* (t) Sleepqueue queue blocked on. */ > void *td_wchan; /* (t) Sleep address. */ > const char *td_wmesg; /* (t) Reason for sleep. */ > - u_char td_lastcpu; /* (t) Last cpu we were on. */ > - u_char td_oncpu; /* (t) Which cpu we are on. */ > + int td_lastcpu; /* (t) Last cpu we were on. */ > + int td_oncpu; /* (t) Which cpu we are on. */ > volatile u_char td_owepreempt; /* (k*) Preempt on last critical_exit */ > u_char td_tsqueue; /* (t) Turnstile queue blocked on. */ > short td_locks; /* (k) Count of non-spin locks. */ > @@ -601,7 +601,9 @@ struct proc { > #define p_session p_pgrp->pg_session > #define p_pgid p_pgrp->pg_id > > -#define NOCPU 0xff /* For when we aren't on a CPU. */ > +#define NOCPU (-1) /* For when we aren't on a CPU. */ > +#define NOCPU_OLD (255) > +#define MAXCPU_OLD (254) > > #define PROC_SLOCK(p) mtx_lock_spin(&(p)->p_slock) > #define PROC_SUNLOCK(p) mtx_unlock_spin(&(p)->p_slock) > > Modified: head/sys/sys/user.h > ============================================================================== > --- head/sys/sys/user.h Sat Oct 18 19:22:59 2014 (r273265) > +++ head/sys/sys/user.h Sat Oct 18 19:36:11 2014 (r273266) > @@ -84,7 +84,7 @@ > * it in two places: function fill_kinfo_proc in sys/kern/kern_proc.c and > * function kvm_proclist in lib/libkvm/kvm_proc.c . > */ > -#define KI_NSPARE_INT 6 > +#define KI_NSPARE_INT 4 > #define KI_NSPARE_LONG 12 > #define KI_NSPARE_PTR 6 > > @@ -171,8 +171,8 @@ struct kinfo_proc { > signed char ki_nice; /* Process "nice" value */ > char ki_lock; /* Process lock (prevent swap) count */ > char ki_rqindex; /* Run queue index */ > - u_char ki_oncpu; /* Which cpu we are on */ > - u_char ki_lastcpu; /* Last cpu we were on */ > + u_char ki_oncpu_old; /* Which cpu we are on (legacy) */ > + u_char ki_lastcpu_old; /* Last cpu we were on (legacy) */ > char ki_tdname[TDNAMLEN+1]; /* thread name */ > char ki_wmesg[WMESGLEN+1]; /* wchan message */ > char ki_login[LOGNAMELEN+1]; /* setlogin name */ > @@ -187,6 +187,8 @@ struct kinfo_proc { > */ > char ki_sparestrings[50]; /* spare string space */ > int ki_spareints[KI_NSPARE_INT]; /* spare room for growth */ > + int ki_oncpu; /* Which cpu we are on */ > + int ki_lastcpu; /* Last cpu we were on */ > int ki_tracer; /* Pid of tracing process */ > int ki_flag2; /* P2_* flags */ > int ki_fibnum; /* Default FIB number */ > From owner-svn-src-all@FreeBSD.ORG Sun Oct 19 03:49:41 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3D44CD8A; Sun, 19 Oct 2014 03:49:41 +0000 (UTC) Received: from mail-wi0-x230.google.com (mail-wi0-x230.google.com [IPv6:2a00:1450:400c:c05::230]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 817CDFE0; Sun, 19 Oct 2014 03:49:40 +0000 (UTC) Received: by mail-wi0-f176.google.com with SMTP id hi2so4674447wib.3 for ; Sat, 18 Oct 2014 20:49:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=kkFdCSuFxh4yXQqI0QtfdwGVFn1JxN16fidWhkY2d+A=; b=o4Bh4DDUEIkM5uS6D+C1fg2ULOnMfIfuY3gmgt8rPz5GOPyoIKVkPjBxUdvQEs7cFv ji3lhPhUzhzOpgzsFvzNorfnFDoW1Z3v5/e0zr74dqKW91e79iTCQIXBOq+CNgOawc1z NvdF6SPRw2XSfM5lUrJlLiyt+r3TSkHNmVQyjuu/nv1Mf4SuUvXxj11Bwm/l931IXvX4 bcYKDddml+cJW1uyEiXn12T/vIX3f40gv5GX/BxlvqxUs4bBSGJc09gx7xbJv+indiJZ EYLtcsLJjw08lPcokH070FNr54bi74EobesY7NdL102GFtJxKjNmmWNQLisRb0icmRj4 lfhA== MIME-Version: 1.0 X-Received: by 10.180.74.4 with SMTP id p4mr9980394wiv.20.1413690578706; Sat, 18 Oct 2014 20:49:38 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.216.106.136 with HTTP; Sat, 18 Oct 2014 20:49:38 -0700 (PDT) In-Reply-To: <20141019032038.GA41067@onelab2.iet.unipi.it> References: <201410181936.s9IJaCwu018930@svn.freebsd.org> <20141019032038.GA41067@onelab2.iet.unipi.it> Date: Sat, 18 Oct 2014 20:49:38 -0700 X-Google-Sender-Auth: QxpruMivWBLyjwhLdlZkNaxz0Uk Message-ID: Subject: Re: svn commit: r273266 - in head: lib/libkvm sys/compat/freebsd32 sys/kern sys/sys From: Adrian Chadd To: Luigi Rizzo Content-Type: text/plain; charset=UTF-8 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 03:49:41 -0000 On 18 October 2014 20:20, Luigi Rizzo wrote: > On Sat, Oct 18, 2014 at 07:36:12PM +0000, Adrian Chadd wrote: >> Author: adrian >> Date: Sat Oct 18 19:36:11 2014 >> New Revision: 273266 >> URL: https://svnweb.freebsd.org/changeset/base/273266 >> >> Log: >> Update the ULE scheduler + thread and kinfo structs to use int for cpuid >> rather than u_char. >> >> To try and play nice with the ABI, the u_char CPU ID values are clamped >> at 254. The new fields now contain the full CPU ID, or -1 for no cpu. > > This causes the following error with gcc: > > cc1: warnings being treated as errors > /usr/home/luigi/FreeBSD/head/sys/kern/kern_intr.c: In function 'intr_setaffinity': > /usr/home/luigi/FreeBSD/head/sys/kern/kern_intr.c:378: warning: comparison is always true due to limited range of data type > *** Error code 1 > > I suppose we can use NOCPU_OLD, or cast. Hah, good catch! No, we need to convert that use of u_char to int. I'll do it when I get home. Thanks! -a From owner-svn-src-all@FreeBSD.ORG Sun Oct 19 03:51:55 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 65112EDE; Sun, 19 Oct 2014 03:51:55 +0000 (UTC) Received: from mail-wi0-x233.google.com (mail-wi0-x233.google.com [IPv6:2a00:1450:400c:c05::233]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A685E100; Sun, 19 Oct 2014 03:51:54 +0000 (UTC) Received: by mail-wi0-f179.google.com with SMTP id d1so3863715wiv.6 for ; Sat, 18 Oct 2014 20:51:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=wdV0UVTWZ/32p2aWPJpaedb3lW8yOVOw5S1+8TuN2Rc=; b=p/jxTd3iy3udHfUcJOin0lfgBjUhg2cfJSc1hjwBPzd3s62XPztPf3JAqt4a35gS6L qc1/a96PH/h1SNaRduX3RlM7cQlD4+FDhZbjnm11VPEj/9WP+T6Ur0oY2P1gmyjJPXff nrGow8SB9fus3JX7HbJrSnuG/QUOCv8+9oK8BOEaQHnL5TS+kD6kszbvY6QI7pOrPDMf ozIwFqg90eTet5g3bptS5ZYa6eBcO1QyS3vcW9hcj72J7l2OZeE8WhmsObU1Nm2YmqyQ A0xz9Uq3l00V31XuGqMIguQmGGjicdmlFxe/9GeSboo8CthcKlcnRHX+wDKeWTpqnuca 7GEQ== MIME-Version: 1.0 X-Received: by 10.180.85.201 with SMTP id j9mr10014964wiz.26.1413690712893; Sat, 18 Oct 2014 20:51:52 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.216.106.136 with HTTP; Sat, 18 Oct 2014 20:51:52 -0700 (PDT) In-Reply-To: References: <201410181936.s9IJaCwu018930@svn.freebsd.org> <20141019032038.GA41067@onelab2.iet.unipi.it> Date: Sat, 18 Oct 2014 20:51:52 -0700 X-Google-Sender-Auth: hQzyHvxEdOEgfE9vZLhhw9B2jf4 Message-ID: Subject: Re: svn commit: r273266 - in head: lib/libkvm sys/compat/freebsd32 sys/kern sys/sys From: Adrian Chadd To: Luigi Rizzo Content-Type: text/plain; charset=UTF-8 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 03:51:55 -0000 .. actually, try this: adrian@testbox1:~/work/freebsd/head/src % svn diff sys/kern/ Index: sys/kern/kern_intr.c =================================================================== --- sys/kern/kern_intr.c (revision 272839) +++ sys/kern/kern_intr.c (working copy) @@ -362,8 +362,7 @@ { struct intr_event *ie; cpuset_t *mask; - u_char cpu; - int n; + int cpu, n; mask = m; cpu = NOCPU; @@ -377,7 +376,7 @@ continue; if (cpu != NOCPU) return (EINVAL); - cpu = (u_char)n; + cpu = n; } } ie = intr_lookup(irq); -a From owner-svn-src-all@FreeBSD.ORG Sun Oct 19 04:38:03 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D6E7B21C; Sun, 19 Oct 2014 04:38:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B8120400; Sun, 19 Oct 2014 04:38:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9J4c3J8070362; Sun, 19 Oct 2014 04:38:03 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9J4c3pZ070361; Sun, 19 Oct 2014 04:38:03 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201410190438.s9J4c3pZ070361@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 19 Oct 2014 04:38:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273270 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 04:38:03 -0000 Author: adrian Date: Sun Oct 19 04:38:02 2014 New Revision: 273270 URL: https://svnweb.freebsd.org/changeset/base/273270 Log: Convert a missed u_char cpu -> int cpu. This was caught by a gcc build. Reported by: luigi Sponsored by: Norse Corp, Inc. Modified: head/sys/kern/kern_intr.c Modified: head/sys/kern/kern_intr.c ============================================================================== --- head/sys/kern/kern_intr.c Sat Oct 18 22:49:18 2014 (r273269) +++ head/sys/kern/kern_intr.c Sun Oct 19 04:38:02 2014 (r273270) @@ -362,8 +362,7 @@ intr_setaffinity(int irq, void *m) { struct intr_event *ie; cpuset_t *mask; - u_char cpu; - int n; + int cpu, n; mask = m; cpu = NOCPU; @@ -377,7 +376,7 @@ intr_setaffinity(int irq, void *m) continue; if (cpu != NOCPU) return (EINVAL); - cpu = (u_char)n; + cpu = n; } } ie = intr_lookup(irq); From owner-svn-src-all@FreeBSD.ORG Sun Oct 19 04:38:37 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A99EE361; Sun, 19 Oct 2014 04:38:37 +0000 (UTC) Received: from mail-wi0-x235.google.com (mail-wi0-x235.google.com [IPv6:2a00:1450:400c:c05::235]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EB00A5E3; Sun, 19 Oct 2014 04:38:36 +0000 (UTC) Received: by mail-wi0-f181.google.com with SMTP id hi2so3885145wib.8 for ; Sat, 18 Oct 2014 21:38:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=5q1hVFyoU0zYqNjhfLq9xup+wRw1clGnYna6FQ87aQI=; b=xsXP3HmH0jzF4vg6bEfPTzCsS+hRyGWFfPyz9Wdk8KxI69b8rksJ2JVVyxyDI8mKby +pVDhsUm2c87at8eUlHoahboVXdUGILvE5IjtCGXoaX36pZjc+GBUVJV6GkTV7pOQ6iV 1OxvnrRs19khR1blrnRNXKqXzaB7+G7Z1q/Rc/c5GXE+1w0QbK8rhFvoeGZth1H4+Ywr H7fD5IEnj8J22X/7a1WEUrztwF9qqUBxAihbMj2fE18Iqgiwkjb8r97Us18F4/z7dwcX qQSKm5lS/DtgxDNpzT12mkZgrGoZYEb+ikYq7eh8RoNRNy8quYm7wgCbPjPktINRW392 bZlA== MIME-Version: 1.0 X-Received: by 10.180.188.41 with SMTP id fx9mr9936328wic.59.1413693514446; Sat, 18 Oct 2014 21:38:34 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.216.106.136 with HTTP; Sat, 18 Oct 2014 21:38:34 -0700 (PDT) In-Reply-To: References: <201410181936.s9IJaCwu018930@svn.freebsd.org> <20141019032038.GA41067@onelab2.iet.unipi.it> Date: Sat, 18 Oct 2014 21:38:34 -0700 X-Google-Sender-Auth: fSGx6Ce1UTcL9IodKTin37i2vVU Message-ID: Subject: Re: svn commit: r273266 - in head: lib/libkvm sys/compat/freebsd32 sys/kern sys/sys From: Adrian Chadd To: Luigi Rizzo Content-Type: text/plain; charset=UTF-8 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 04:38:37 -0000 Rebuilt, tested, committed to -HEAD. Thanks! -a On 18 October 2014 20:51, Adrian Chadd wrote: > .. actually, try this: > > adrian@testbox1:~/work/freebsd/head/src % svn diff sys/kern/ > Index: sys/kern/kern_intr.c > =================================================================== > --- sys/kern/kern_intr.c (revision 272839) > +++ sys/kern/kern_intr.c (working copy) > @@ -362,8 +362,7 @@ > { > struct intr_event *ie; > cpuset_t *mask; > - u_char cpu; > - int n; > + int cpu, n; > > mask = m; > cpu = NOCPU; > @@ -377,7 +376,7 @@ > continue; > if (cpu != NOCPU) > return (EINVAL); > - cpu = (u_char)n; > + cpu = n; > } > } > ie = intr_lookup(irq); > > > > > -a From owner-svn-src-all@FreeBSD.ORG Sun Oct 19 06:59:34 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A4CF4CCC; Sun, 19 Oct 2014 06:59:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8F5E8BA; Sun, 19 Oct 2014 06:59:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9J6xYlf034749; Sun, 19 Oct 2014 06:59:34 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9J6xXQE034746; Sun, 19 Oct 2014 06:59:33 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410190659.s9J6xXQE034746@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 19 Oct 2014 06:59:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273271 - in head/sys: fs/tmpfs kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 06:59:34 -0000 Author: mjg Date: Sun Oct 19 06:59:33 2014 New Revision: 273271 URL: https://svnweb.freebsd.org/changeset/base/273271 Log: Provide vfs suspension support only for filesystems which need it. Need is expressed by providing vfs_susp_clean function in vfsops. Differential Revision: D952 Reviewed by: kib (previous version) MFC after: 2 weeks Modified: head/sys/fs/tmpfs/tmpfs_vfsops.c head/sys/kern/vfs_vnops.c head/sys/sys/mount.h Modified: head/sys/fs/tmpfs/tmpfs_vfsops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vfsops.c Sun Oct 19 04:38:02 2014 (r273270) +++ head/sys/fs/tmpfs/tmpfs_vfsops.c Sun Oct 19 06:59:33 2014 (r273271) @@ -427,6 +427,14 @@ tmpfs_sync(struct mount *mp, int waitfor } /* + * A stub created so that vfs does vn_start_write for this filesystem + */ +static void +tmpfs_susp_clean(struct mount *mp) +{ +} + +/* * tmpfs vfs operations. */ @@ -437,5 +445,6 @@ struct vfsops tmpfs_vfsops = { .vfs_statfs = tmpfs_statfs, .vfs_fhtovp = tmpfs_fhtovp, .vfs_sync = tmpfs_sync, + .vfs_susp_clean = tmpfs_susp_clean, }; VFS_SET(tmpfs_vfsops, tmpfs, VFCF_JAIL); Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Sun Oct 19 04:38:02 2014 (r273270) +++ head/sys/kern/vfs_vnops.c Sun Oct 19 06:59:33 2014 (r273271) @@ -1572,6 +1572,25 @@ vn_closefile(fp, td) return (error); } +static bool +vn_suspendable_mp(struct mount *mp) +{ + + return (mp->mnt_op->vfs_susp_clean != NULL); +} + +static bool +vn_suspendable(struct vnode *vp, struct mount **mpp) +{ + + if (vp != NULL) + *mpp = vp->v_mount; + if (*mpp == NULL) + return (false); + + return (vn_suspendable_mp(*mpp)); +} + /* * Preparing to start a filesystem write operation. If the operation is * permitted, then we bump the count of operations in progress and @@ -1621,6 +1640,9 @@ vn_start_write(vp, mpp, flags) struct mount *mp; int error; + if (!vn_suspendable(vp, mpp)) + return (0); + error = 0; /* * If a vnode is provided, get and return the mount point that @@ -1667,6 +1689,9 @@ vn_start_secondary_write(vp, mpp, flags) struct mount *mp; int error; + if (!vn_suspendable(vp, mpp)) + return (0); + retry: if (vp != NULL) { if ((error = VOP_GETWRITEMOUNT(vp, mpp)) != 0) { @@ -1724,7 +1749,7 @@ void vn_finished_write(mp) struct mount *mp; { - if (mp == NULL) + if (mp == NULL || !vn_suspendable_mp(mp)) return; MNT_ILOCK(mp); MNT_REL(mp); @@ -1747,7 +1772,7 @@ void vn_finished_secondary_write(mp) struct mount *mp; { - if (mp == NULL) + if (mp == NULL || !vn_suspendable_mp(mp)) return; MNT_ILOCK(mp); MNT_REL(mp); @@ -1770,6 +1795,8 @@ vfs_write_suspend(struct mount *mp, int { int error; + MPASS(vn_suspendable_mp(mp)); + MNT_ILOCK(mp); if (mp->mnt_susp_owner == curthread) { MNT_IUNLOCK(mp); @@ -1811,6 +1838,8 @@ void vfs_write_resume(struct mount *mp, int flags) { + MPASS(vn_suspendable_mp(mp)); + MNT_ILOCK(mp); if ((mp->mnt_kern_flag & MNTK_SUSPEND) != 0) { KASSERT(mp->mnt_susp_owner == curthread, ("mnt_susp_owner")); @@ -1844,6 +1873,7 @@ vfs_write_suspend_umnt(struct mount *mp) { int error; + MPASS(vn_suspendable_mp(mp)); KASSERT((curthread->td_pflags & TDP_IGNSUSP) == 0, ("vfs_write_suspend_umnt: recursed")); Modified: head/sys/sys/mount.h ============================================================================== --- head/sys/sys/mount.h Sun Oct 19 04:38:02 2014 (r273270) +++ head/sys/sys/mount.h Sun Oct 19 06:59:33 2014 (r273271) @@ -754,11 +754,10 @@ vfs_statfs_t __vfs_statfs; _rc; }) #define VFS_SUSP_CLEAN(MP) do { \ - if (*(MP)->mnt_op->vfs_susp_clean != NULL) { \ - VFS_PROLOGUE(MP); \ - (*(MP)->mnt_op->vfs_susp_clean)(MP); \ - VFS_EPILOGUE(MP); \ - } \ + MPASS(*(MP)->mnt_op->vfs_susp_clean != NULL); \ + VFS_PROLOGUE(MP); \ + (*(MP)->mnt_op->vfs_susp_clean)(MP); \ + VFS_EPILOGUE(MP); \ } while (0) #define VFS_RECLAIM_LOWERVP(MP, VP) do { \ From owner-svn-src-all@FreeBSD.ORG Sun Oct 19 07:34:47 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 478112FB; Sun, 19 Oct 2014 07:34:47 +0000 (UTC) Received: from h2.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "funkthat.com", Issuer "funkthat.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 0ADA43E8; Sun, 19 Oct 2014 07:34:46 +0000 (UTC) Received: from h2.funkthat.com (localhost [127.0.0.1]) by h2.funkthat.com (8.14.3/8.14.3) with ESMTP id s9J7YiSE000534 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 19 Oct 2014 00:34:45 -0700 (PDT) (envelope-from jmg@h2.funkthat.com) Received: (from jmg@localhost) by h2.funkthat.com (8.14.3/8.14.3/Submit) id s9J7YiE9000533; Sun, 19 Oct 2014 00:34:44 -0700 (PDT) (envelope-from jmg) Date: Sun, 19 Oct 2014 00:34:44 -0700 From: John-Mark Gurney To: Andrew Turner Subject: Re: svn commit: r273251 - in head/sys: arm/arm arm/include conf Message-ID: <20141019073444.GC82214@funkthat.com> References: <201410181338.s9IDc5NE047022@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201410181338.s9IDc5NE047022@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Operating-System: FreeBSD 7.2-RELEASE i386 X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88 9322 9CB1 8F74 6D3F A396 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-TipJar: bitcoin:13Qmb6AeTgQecazTWph4XasEsP7nGRbAPE X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.2 (h2.funkthat.com [127.0.0.1]); Sun, 19 Oct 2014 00:34:45 -0700 (PDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 07:34:47 -0000 Andrew Turner wrote this message on Sat, Oct 18, 2014 at 13:38 +0000: > Author: andrew > Date: Sat Oct 18 13:38:04 2014 > New Revision: 273251 > URL: https://svnweb.freebsd.org/changeset/base/273251 > > Log: > Add an elf not so kgdb detects the kernel as a FreeBSD elf file. The > ELFNOTE macro is based on one from the FreeBSD/ARM Xen tree [1]. > > Obtained from: Julien Grall [1] Thanks for committing! -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not." From owner-svn-src-all@FreeBSD.ORG Sun Oct 19 08:47:28 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 97687ACD; Sun, 19 Oct 2014 08:47:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 823D3B55; Sun, 19 Oct 2014 08:47:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9J8lSBq086984; Sun, 19 Oct 2014 08:47:28 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9J8lSks086983; Sun, 19 Oct 2014 08:47:28 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410190847.s9J8lSks086983@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 19 Oct 2014 08:47:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273272 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 08:47:28 -0000 Author: mav Date: Sun Oct 19 08:47:27 2014 New Revision: 273272 URL: https://svnweb.freebsd.org/changeset/base/273272 Log: MFC r273143: Remove setting BIO_DONE flag for BIOs that have done() method. This fixes use-after-free, caused by geom_disk, completing same BIO twice to save extra allocation, and getting BIO_DONE set after the first. Modified: stable/10/sys/kern/vfs_bio.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/vfs_bio.c ============================================================================== --- stable/10/sys/kern/vfs_bio.c Sun Oct 19 06:59:33 2014 (r273271) +++ stable/10/sys/kern/vfs_bio.c Sun Oct 19 08:47:27 2014 (r273272) @@ -3585,10 +3585,8 @@ biodone(struct bio *bp) bp->bio_flags |= BIO_DONE; wakeup(bp); mtx_unlock(mtxp); - } else { - bp->bio_flags |= BIO_DONE; + } else done(bp); - } } /* From owner-svn-src-all@FreeBSD.ORG Sun Oct 19 11:06:55 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B8C28D5E; Sun, 19 Oct 2014 11:06:55 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8AFB1958; Sun, 19 Oct 2014 11:06:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9JB6tln053762; Sun, 19 Oct 2014 11:06:55 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9JB6toW053761; Sun, 19 Oct 2014 11:06:55 GMT (envelope-from des@FreeBSD.org) Message-Id: <201410191106.s9JB6toW053761@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: des set sender to des@FreeBSD.org using -f From: Dag-Erling Smørgrav Date: Sun, 19 Oct 2014 11:06:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273273 - head/contrib/openpam/lib/libpam X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 11:06:55 -0000 Author: des Date: Sun Oct 19 11:06:54 2014 New Revision: 273273 URL: https://svnweb.freebsd.org/changeset/base/273273 Log: Merge upstream r825: fix line continuation in whitespace Modified: head/contrib/openpam/lib/libpam/openpam_readword.c Directory Properties: head/contrib/openpam/ (props changed) Modified: head/contrib/openpam/lib/libpam/openpam_readword.c ============================================================================== --- head/contrib/openpam/lib/libpam/openpam_readword.c Sun Oct 19 08:47:27 2014 (r273272) +++ head/contrib/openpam/lib/libpam/openpam_readword.c Sun Oct 19 11:06:54 2014 (r273273) @@ -55,18 +55,35 @@ openpam_readword(FILE *f, int *lineno, s { char *word; size_t size, len; - int ch, comment, escape, quote; + int ch, escape, quote; int serrno; errno = 0; /* skip initial whitespace */ - comment = 0; - while ((ch = getc(f)) != EOF && ch != '\n') { - if (ch == '#') - comment = 1; - if (!is_lws(ch) && !comment) + escape = quote = 0; + while ((ch = getc(f)) != EOF) { + if (ch == '\n') { + /* either EOL or line continuation */ + if (!escape) + break; + if (lineno != NULL) + ++*lineno; + escape = 0; + } else if (escape) { + /* escaped something else */ + break; + } else if (ch == '#') { + /* comment: until EOL, no continuation */ + while ((ch = getc(f)) != EOF) + if (ch == '\n') + break; break; + } else if (ch == '\\') { + escape = 1; + } else if (!is_ws(ch)) { + break; + } } if (ch == EOF) return (NULL); @@ -76,7 +93,6 @@ openpam_readword(FILE *f, int *lineno, s word = NULL; size = len = 0; - escape = quote = 0; while ((ch = fgetc(f)) != EOF && (!is_ws(ch) || quote || escape)) { if (ch == '\\' && !escape && quote != '\'') { /* escape next character */ @@ -90,7 +106,7 @@ openpam_readword(FILE *f, int *lineno, s } else if (ch == quote && !escape) { /* end quote */ quote = 0; - } else if (ch == '\n' && escape && quote != '\'') { + } else if (ch == '\n' && escape) { /* line continuation */ escape = 0; } else { From owner-svn-src-all@FreeBSD.ORG Sun Oct 19 11:15:20 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 05350F27; Sun, 19 Oct 2014 11:15:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E5496A2E; Sun, 19 Oct 2014 11:15:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9JBFJfJ058371; Sun, 19 Oct 2014 11:15:19 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9JBFJxA058370; Sun, 19 Oct 2014 11:15:19 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201410191115.s9JBFJxA058370@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Sun, 19 Oct 2014 11:15:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273274 - head/sys/netpfil/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 11:15:20 -0000 Author: melifaro Date: Sun Oct 19 11:15:19 2014 New Revision: 273274 URL: https://svnweb.freebsd.org/changeset/base/273274 Log: Perform more checks on the number of tables supplied by user. Modified: head/sys/netpfil/ipfw/ip_fw_table.c Modified: head/sys/netpfil/ipfw/ip_fw_table.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_table.c Sun Oct 19 11:06:54 2014 (r273273) +++ head/sys/netpfil/ipfw/ip_fw_table.c Sun Oct 19 11:15:19 2014 (r273274) @@ -1489,6 +1489,21 @@ destroy_table(struct ip_fw_chain *ch, st return (0); } +static uint32_t +roundup2p(uint32_t v) +{ + + v--; + v |= v >> 1; + v |= v >> 2; + v |= v >> 4; + v |= v >> 8; + v |= v >> 16; + v++; + + return (v); +} + /* * Grow tables index. * @@ -1505,8 +1520,12 @@ ipfw_resize_tables(struct ip_fw_chain *c int i, new_blocks; /* Check new value for validity */ + if (ntables == 0) + return (EINVAL); if (ntables > IPFW_TABLES_MAX) ntables = IPFW_TABLES_MAX; + /* Alight to nearest power of 2 */ + ntables = (unsigned int)roundup2p(ntables); /* Allocate new pointers */ tablestate = malloc(ntables * sizeof(struct table_info), From owner-svn-src-all@FreeBSD.ORG Sun Oct 19 11:31:24 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C397D3AA; Sun, 19 Oct 2014 11:31:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AF27BBCA; Sun, 19 Oct 2014 11:31:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9JBVO7S066209; Sun, 19 Oct 2014 11:31:24 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9JBVOEg066205; Sun, 19 Oct 2014 11:31:24 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201410191131.s9JBVOEg066205@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 19 Oct 2014 11:31:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273275 - stable/10/sys/netinet X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 11:31:25 -0000 Author: tuexen Date: Sun Oct 19 11:31:23 2014 New Revision: 273275 URL: https://svnweb.freebsd.org/changeset/base/273275 Log: MFC 273168: Fix the reported streams in a SCTP_STREAM_RESET_EVENT, if a sent incoming stream reset request was responded with failed or denied. Thanks to Peter Bostroem from Google for reporting the issue. Modified: stable/10/sys/netinet/sctp_header.h stable/10/sys/netinet/sctp_input.c stable/10/sys/netinet/sctp_input.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/sctp_header.h ============================================================================== --- stable/10/sys/netinet/sctp_header.h Sun Oct 19 11:15:19 2014 (r273274) +++ stable/10/sys/netinet/sctp_header.h Sun Oct 19 11:31:23 2014 (r273275) @@ -450,6 +450,11 @@ struct sctp_pktdrop_chunk { /**********STREAM RESET STUFF ******************/ +struct sctp_stream_reset_request { + struct sctp_paramhdr ph; + uint32_t request_seq; +} SCTP_PACKED; + struct sctp_stream_reset_out_request { struct sctp_paramhdr ph; uint32_t request_seq; /* monotonically increasing seq no */ @@ -464,7 +469,6 @@ struct sctp_stream_reset_in_request { uint16_t list_of_streams[]; /* if not all list of streams */ } SCTP_PACKED; - struct sctp_stream_reset_tsn_request { struct sctp_paramhdr ph; uint32_t request_seq; Modified: stable/10/sys/netinet/sctp_input.c ============================================================================== --- stable/10/sys/netinet/sctp_input.c Sun Oct 19 11:15:19 2014 (r273274) +++ stable/10/sys/netinet/sctp_input.c Sun Oct 19 11:31:23 2014 (r273275) @@ -3496,12 +3496,12 @@ sctp_reset_out_streams(struct sctp_tcb * } -struct sctp_stream_reset_out_request * +struct sctp_stream_reset_request * sctp_find_stream_reset(struct sctp_tcb *stcb, uint32_t seq, struct sctp_tmit_chunk **bchk) { struct sctp_association *asoc; struct sctp_chunkhdr *ch; - struct sctp_stream_reset_out_request *r; + struct sctp_stream_reset_request *r; struct sctp_tmit_chunk *chk; int len, clen; @@ -3524,7 +3524,7 @@ sctp_find_stream_reset(struct sctp_tcb * } clen = chk->send_size; ch = mtod(chk->data, struct sctp_chunkhdr *); - r = (struct sctp_stream_reset_out_request *)(ch + 1); + r = (struct sctp_stream_reset_request *)(ch + 1); if (ntohl(r->request_seq) == seq) { /* found it */ return (r); @@ -3532,7 +3532,7 @@ sctp_find_stream_reset(struct sctp_tcb * len = SCTP_SIZE32(ntohs(r->ph.param_length)); if (clen > (len + (int)sizeof(struct sctp_chunkhdr))) { /* move to the next one, there can only be a max of two */ - r = (struct sctp_stream_reset_out_request *)((caddr_t)r + len); + r = (struct sctp_stream_reset_request *)((caddr_t)r + len); if (ntohl(r->request_seq) == seq) { return (r); } @@ -3576,7 +3576,9 @@ sctp_handle_stream_reset_response(struct int lparm_len; struct sctp_association *asoc = &stcb->asoc; struct sctp_tmit_chunk *chk; - struct sctp_stream_reset_out_request *srparam; + struct sctp_stream_reset_request *req_param; + struct sctp_stream_reset_out_request *req_out_param; + struct sctp_stream_reset_in_request *req_in_param; uint32_t number_entries; if (asoc->stream_reset_outstanding == 0) { @@ -3584,35 +3586,36 @@ sctp_handle_stream_reset_response(struct return (0); } if (seq == stcb->asoc.str_reset_seq_out) { - srparam = sctp_find_stream_reset(stcb, seq, &chk); - if (srparam) { + req_param = sctp_find_stream_reset(stcb, seq, &chk); + if (req_param != NULL) { stcb->asoc.str_reset_seq_out++; - type = ntohs(srparam->ph.param_type); - lparm_len = ntohs(srparam->ph.param_length); + type = ntohs(req_param->ph.param_type); + lparm_len = ntohs(req_param->ph.param_length); if (type == SCTP_STR_RESET_OUT_REQUEST) { + req_out_param = (struct sctp_stream_reset_out_request *)req_param; number_entries = (lparm_len - sizeof(struct sctp_stream_reset_out_request)) / sizeof(uint16_t); asoc->stream_reset_out_is_outstanding = 0; if (asoc->stream_reset_outstanding) asoc->stream_reset_outstanding--; if (action == SCTP_STREAM_RESET_RESULT_PERFORMED) { /* do it */ - sctp_reset_out_streams(stcb, number_entries, srparam->list_of_streams); + sctp_reset_out_streams(stcb, number_entries, req_out_param->list_of_streams); } else if (action == SCTP_STREAM_RESET_RESULT_DENIED) { - sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_DENIED_OUT, stcb, number_entries, srparam->list_of_streams, SCTP_SO_NOT_LOCKED); + sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_DENIED_OUT, stcb, number_entries, req_out_param->list_of_streams, SCTP_SO_NOT_LOCKED); } else { - sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_FAILED_OUT, stcb, number_entries, srparam->list_of_streams, SCTP_SO_NOT_LOCKED); + sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_FAILED_OUT, stcb, number_entries, req_out_param->list_of_streams, SCTP_SO_NOT_LOCKED); } } else if (type == SCTP_STR_RESET_IN_REQUEST) { - /* Answered my request */ + req_in_param = (struct sctp_stream_reset_in_request *)req_param; number_entries = (lparm_len - sizeof(struct sctp_stream_reset_in_request)) / sizeof(uint16_t); if (asoc->stream_reset_outstanding) asoc->stream_reset_outstanding--; if (action == SCTP_STREAM_RESET_RESULT_DENIED) { sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_DENIED_IN, stcb, - number_entries, srparam->list_of_streams, SCTP_SO_NOT_LOCKED); + number_entries, req_in_param->list_of_streams, SCTP_SO_NOT_LOCKED); } else if (action != SCTP_STREAM_RESET_RESULT_PERFORMED) { sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_FAILED_IN, stcb, - number_entries, srparam->list_of_streams, SCTP_SO_NOT_LOCKED); + number_entries, req_in_param->list_of_streams, SCTP_SO_NOT_LOCKED); } } else if (type == SCTP_STR_RESET_ADD_OUT_STREAMS) { /* Ok we now may have more streams */ Modified: stable/10/sys/netinet/sctp_input.h ============================================================================== --- stable/10/sys/netinet/sctp_input.h Sun Oct 19 11:15:19 2014 (r273274) +++ stable/10/sys/netinet/sctp_input.h Sun Oct 19 11:31:23 2014 (r273275) @@ -48,7 +48,7 @@ sctp_common_input_processing(struct mbuf uint8_t, uint32_t, uint32_t, uint16_t); -struct sctp_stream_reset_out_request * +struct sctp_stream_reset_request * sctp_find_stream_reset(struct sctp_tcb *stcb, uint32_t seq, struct sctp_tmit_chunk **bchk); From owner-svn-src-all@FreeBSD.ORG Sun Oct 19 11:59:18 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5AB307C2; Sun, 19 Oct 2014 11:59:18 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4660DD65; Sun, 19 Oct 2014 11:59:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9JBxIrV077543; Sun, 19 Oct 2014 11:59:18 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9JBxFZh077525; Sun, 19 Oct 2014 11:59:15 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201410191159.s9JBxFZh077525@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sun, 19 Oct 2014 11:59:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273276 - in head/bin/sh: . tests/parser X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 11:59:18 -0000 Author: jilles Date: Sun Oct 19 11:59:15 2014 New Revision: 273276 URL: https://svnweb.freebsd.org/changeset/base/273276 Log: sh: Allow backslash-newline continuation in more places: * directly after a $ * directly after ${ * between the characters of a multi-character operator token * within a parameter name Added: head/bin/sh/tests/parser/line-cont10.0 (contents, props changed) head/bin/sh/tests/parser/line-cont11.0 (contents, props changed) head/bin/sh/tests/parser/line-cont4.0 (contents, props changed) head/bin/sh/tests/parser/line-cont5.0 (contents, props changed) head/bin/sh/tests/parser/line-cont6.0 (contents, props changed) head/bin/sh/tests/parser/line-cont7.0 (contents, props changed) head/bin/sh/tests/parser/line-cont8.0 (contents, props changed) head/bin/sh/tests/parser/line-cont9.0 (contents, props changed) Modified: head/bin/sh/parser.c head/bin/sh/tests/parser/Makefile Modified: head/bin/sh/parser.c ============================================================================== --- head/bin/sh/parser.c Sun Oct 19 11:31:23 2014 (r273275) +++ head/bin/sh/parser.c Sun Oct 19 11:59:15 2014 (r273276) @@ -125,6 +125,7 @@ static void consumetoken(int); static void synexpect(int) __dead2; static void synerror(const char *) __dead2; static void setprompt(int); +static int pgetc_linecont(void); static void * @@ -899,17 +900,17 @@ xxreadtoken(void) case PEOF: RETURN(TEOF); case '&': - if (pgetc() == '&') + if (pgetc_linecont() == '&') RETURN(TAND); pungetc(); RETURN(TBACKGND); case '|': - if (pgetc() == '|') + if (pgetc_linecont() == '|') RETURN(TOR); pungetc(); RETURN(TPIPE); case ';': - c = pgetc(); + c = pgetc_linecont(); if (c == ';') RETURN(TENDCASE); else if (c == '&') @@ -991,7 +992,7 @@ parseredir(char *out, int c) np = (union node *)stalloc(sizeof (struct nfile)); if (c == '>') { np->nfile.fd = 1; - c = pgetc(); + c = pgetc_linecont(); if (c == '>') np->type = NAPPEND; else if (c == '&') @@ -1004,7 +1005,7 @@ parseredir(char *out, int c) } } else { /* c == '<' */ np->nfile.fd = 0; - c = pgetc(); + c = pgetc_linecont(); if (c == '<') { if (sizeof (struct nfile) != sizeof (struct nhere)) { np = (union node *)stalloc(sizeof (struct nhere)); @@ -1013,7 +1014,7 @@ parseredir(char *out, int c) np->type = NHERE; heredoc = (struct heredoc *)stalloc(sizeof (struct heredoc)); heredoc->here = np; - if ((c = pgetc()) == '-') { + if ((c = pgetc_linecont()) == '-') { heredoc->striptabs = 1; } else { heredoc->striptabs = 0; @@ -1094,25 +1095,12 @@ parsebackq(char *out, struct nodelist ** needprompt = 0; } CHECKSTRSPACE(2, oout); - c = pgetc(); + c = pgetc_linecont(); if (c == '`') break; switch (c) { case '\\': - if ((c = pgetc()) == '\n') { - plinno++; - if (doprompt) - setprompt(2); - else - setprompt(0); - /* - * If eating a newline, avoid putting - * the newline into the new character - * stream (via the USTPUTC after the - * switch). - */ - continue; - } + c = pgetc(); if (c != '\\' && c != '`' && c != '$' && (!dblquote || c != '"')) USTPUTC('\\', oout); @@ -1507,7 +1495,7 @@ readtoken1(int firstc, char const *initi USTPUTC(c, out); --state[level].parenlevel; } else { - if (pgetc() == ')') { + if (pgetc_linecont() == ')') { if (level > 0 && state[level].category == TSTATE_ARITH) { level--; @@ -1593,9 +1581,9 @@ parsesub: { int length; int c1; - c = pgetc(); + c = pgetc_linecont(); if (c == '(') { /* $(command) or $((arith)) */ - if (pgetc() == '(') { + if (pgetc_linecont() == '(') { PARSEARITH(); } else { pungetc(); @@ -1613,7 +1601,7 @@ parsesub: { flags = 0; if (c == '{') { bracketed_name = 1; - c = pgetc(); + c = pgetc_linecont(); subtype = 0; } varname: @@ -1621,7 +1609,7 @@ varname: length = 0; do { STPUTC(c, out); - c = pgetc(); + c = pgetc_linecont(); length++; } while (!is_eof(c) && is_in_name(c)); if (length == 6 && @@ -1640,22 +1628,22 @@ varname: if (bracketed_name) { do { STPUTC(c, out); - c = pgetc(); + c = pgetc_linecont(); } while (is_digit(c)); } else { STPUTC(c, out); - c = pgetc(); + c = pgetc_linecont(); } } else if (is_special(c)) { c1 = c; - c = pgetc(); + c = pgetc_linecont(); if (subtype == 0 && c1 == '#') { subtype = VSLENGTH; if (strchr(types, c) == NULL && c != ':' && c != '#' && c != '%') goto varname; c1 = c; - c = pgetc(); + c = pgetc_linecont(); if (c1 != '}' && c == '}') { pungetc(); c = c1; @@ -1680,7 +1668,7 @@ varname: switch (c) { case ':': flags |= VSNUL; - c = pgetc(); + c = pgetc_linecont(); /*FALLTHROUGH*/ default: p = strchr(types, c); @@ -1700,7 +1688,7 @@ varname: int cc = c; subtype = c == '#' ? VSTRIMLEFT : VSTRIMRIGHT; - c = pgetc(); + c = pgetc_linecont(); if (c == cc) subtype++; else @@ -1909,6 +1897,29 @@ setprompt(int which) } } +static int +pgetc_linecont(void) +{ + int c; + + while ((c = pgetc_macro()) == '\\') { + c = pgetc(); + if (c == '\n') { + plinno++; + if (doprompt) + setprompt(2); + else + setprompt(0); + } else { + pungetc(); + /* Allow the backslash to be pushed back. */ + pushstring("\\", 1, NULL); + return (pgetc()); + } + } + return (c); +} + /* * called by editline -- any expansions to the prompt * should be added here. Modified: head/bin/sh/tests/parser/Makefile ============================================================================== --- head/bin/sh/tests/parser/Makefile Sun Oct 19 11:31:23 2014 (r273275) +++ head/bin/sh/tests/parser/Makefile Sun Oct 19 11:59:15 2014 (r273276) @@ -58,6 +58,14 @@ FILES+= heredoc12.0 FILES+= line-cont1.0 FILES+= line-cont2.0 FILES+= line-cont3.0 +FILES+= line-cont4.0 +FILES+= line-cont5.0 +FILES+= line-cont6.0 +FILES+= line-cont7.0 +FILES+= line-cont8.0 +FILES+= line-cont9.0 +FILES+= line-cont10.0 +FILES+= line-cont11.0 FILES+= no-space1.0 FILES+= no-space2.0 FILES+= only-redir1.0 Added: head/bin/sh/tests/parser/line-cont10.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/parser/line-cont10.0 Sun Oct 19 11:59:15 2014 (r273276) @@ -0,0 +1,18 @@ +# $FreeBSD$ + +v=XaaaXbbbX +[ "${v\ +#\ +*\ +a}.${v\ +#\ +#\ +*\ +a}.${v\ +%\ +b\ +*}.${v\ +%\ +%\ +b\ +*}" = aaXbbbX.XbbbX.XaaaXbb.XaaaX ] Added: head/bin/sh/tests/parser/line-cont11.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/parser/line-cont11.0 Sun Oct 19 11:59:15 2014 (r273276) @@ -0,0 +1,23 @@ +# $FreeBSD$ + +T=$(mktemp "${TMPDIR:-/tmp}/sh-test.XXXXXXXX") || exit +trap 'rm -f -- "$T"' 0 +w='#A' +# A naive pgetc_linecont() would push back two characters here, which +# fails if a new buffer is read between the two characters. +c='${w#\#}' +c=$c$c$c$c +c=$c$c$c$c +c=$c$c$c$c +c=$c$c$c$c +c=$c$c$c$c +c=$c$c$c$c +printf 'v=%s\n' "$c" >"$T" +. "$T" +if [ "${#v}" != 4096 ]; then + echo "Length is bad (${#v})" + exit 3 +fi +case $v in +*[!A]*) echo "Content is bad"; exit 3 ;; +esac Added: head/bin/sh/tests/parser/line-cont4.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/parser/line-cont4.0 Sun Oct 19 11:59:15 2014 (r273276) @@ -0,0 +1,8 @@ +# $FreeBSD$ + +v=abcd +[ "$\ +v.$\ +{v}.${\ +v}.${v\ +}" = abcd.abcd.abcd.abcd ] Added: head/bin/sh/tests/parser/line-cont5.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/parser/line-cont5.0 Sun Oct 19 11:59:15 2014 (r273276) @@ -0,0 +1,14 @@ +# $FreeBSD$ + +bad=1 +case x in +x\ +) ;\ +; *) exit 7 +esac &\ +& bad= &\ +& : >\ +>/dev/null + +false |\ +| [ -z "$bad" ] Added: head/bin/sh/tests/parser/line-cont6.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/parser/line-cont6.0 Sun Oct 19 11:59:15 2014 (r273276) @@ -0,0 +1,23 @@ +# $FreeBSD$ + +v0\ +=abc + +v=$(cat <\ +<\ +E\ +O\ +F +${v0}d +EOF +) + +w=$(cat <\ +<\ +-\ +EOF + efgh +EOF +) + +[ "$v.$w" = "abcd.efgh" ] Added: head/bin/sh/tests/parser/line-cont7.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/parser/line-cont7.0 Sun Oct 19 11:59:15 2014 (r273276) @@ -0,0 +1,7 @@ +# $FreeBSD$ + +[ "$(\ +( +1\ ++ 1)\ +)" = 2 ] Added: head/bin/sh/tests/parser/line-cont8.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/parser/line-cont8.0 Sun Oct 19 11:59:15 2014 (r273276) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +set -- a b c d e f g h i j +[ "${1\ +0\ +}" = j ] Added: head/bin/sh/tests/parser/line-cont9.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/parser/line-cont9.0 Sun Oct 19 11:59:15 2014 (r273276) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +[ "${$\ +:\ ++\ +xyz}" = xyz ] From owner-svn-src-all@FreeBSD.ORG Sun Oct 19 12:03:13 2014 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9B188A8E; Sun, 19 Oct 2014 12:03:13 +0000 (UTC) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 426A7E16; Sun, 19 Oct 2014 12:03:11 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id PAA06395; Sun, 19 Oct 2014 15:03:04 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1XfpCR-000P9z-QS; Sun, 19 Oct 2014 15:03:03 +0300 Message-ID: <5443A83F.5090807@FreeBSD.org> Date: Sun, 19 Oct 2014 15:02:07 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.1.2 MIME-Version: 1.0 To: "Alexander V. Chernikov" , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r273274 - head/sys/netpfil/ipfw References: <201410191115.s9JBFJxA058370@svn.freebsd.org> In-Reply-To: <201410191115.s9JBFJxA058370@svn.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 12:03:13 -0000 On 19/10/2014 14:15, Alexander V. Chernikov wrote: > +static uint32_t > +roundup2p(uint32_t v) > +{ > + > + v--; > + v |= v >> 1; > + v |= v >> 2; > + v |= v >> 4; > + v |= v >> 8; > + v |= v >> 16; > + v++; > + > + return (v); > +} I think that on platforms where an optimized version of fls() is available that would work faster than this cool piece of bit magic. -- Andriy Gapon From owner-svn-src-all@FreeBSD.ORG Sun Oct 19 12:11:27 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0B79FD5B; Sun, 19 Oct 2014 12:11:27 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D1C47ED9; Sun, 19 Oct 2014 12:11:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9JCBQ9o083164; Sun, 19 Oct 2014 12:11:26 GMT (envelope-from antoine@FreeBSD.org) Received: (from antoine@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9JCBQ0E083161; Sun, 19 Oct 2014 12:11:26 GMT (envelope-from antoine@FreeBSD.org) Message-Id: <201410191211.s9JCBQ0E083161@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: antoine set sender to antoine@FreeBSD.org using -f From: Antoine Brodin Date: Sun, 19 Oct 2014 12:11:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273277 - in stable/10: . contrib/opie lib/libopie X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 12:11:27 -0000 Author: antoine Date: Sun Oct 19 12:11:25 2014 New Revision: 273277 URL: https://svnweb.freebsd.org/changeset/base/273277 Log: Restore ABI compatibility with 10.0-RELEASE, so that stable/10 users can use official freebsd packages Modified: stable/10/ObsoleteFiles.inc stable/10/contrib/opie/opie.h stable/10/lib/libopie/Makefile Modified: stable/10/ObsoleteFiles.inc ============================================================================== --- stable/10/ObsoleteFiles.inc Sun Oct 19 11:59:15 2014 (r273276) +++ stable/10/ObsoleteFiles.inc Sun Oct 19 12:11:25 2014 (r273277) @@ -43,8 +43,8 @@ OLD_FILES+=usr/share/openssl/man/man3/CM # 20140917: hv_kvpd rc.d script removed in favor of devd configuration OLD_FILES+=etc/rc.d/hv_kvpd # 20140814: libopie version bump -OLD_LIBS+=usr/lib/libopie.so.7 -OLD_LIBS+=usr/lib32/libopie.so.7 +OLD_LIBS+=usr/lib/libopie.so.8 +OLD_LIBS+=usr/lib32/libopie.so.8 # 20140811: otp-sha renamed to otp-sha1 OLD_FILES+=usr/bin/otp-sha OLD_FILES+=usr/share/man/man1/otp-sha.1.gz Modified: stable/10/contrib/opie/opie.h ============================================================================== --- stable/10/contrib/opie/opie.h Sun Oct 19 11:59:15 2014 (r273276) +++ stable/10/contrib/opie/opie.h Sun Oct 19 12:11:25 2014 (r273277) @@ -69,11 +69,11 @@ struct opie { /* Maximum length of a seed */ #define OPIE_SEED_MAX 16 -/* Max length of hash algorithm name (md4/md5/sha1) */ -#define OPIE_HASHNAME_MAX 4 +/* Max length of hash algorithm name (md4/md5) */ +#define OPIE_HASHNAME_MAX 3 -/* Maximum length of a challenge (otp-md? 9999 seed ext) */ -#define OPIE_CHALLENGE_MAX (4+OPIE_HASHNAME_MAX+1+4+1+OPIE_SEED_MAX+1+3) +/* Maximum length of a challenge (otp-md? 9999 seed) */ +#define OPIE_CHALLENGE_MAX (4+OPIE_HASHNAME_MAX+1+4+1+OPIE_SEED_MAX) /* Maximum length of a response that we allow */ #define OPIE_RESPONSE_MAX (9+1+19+1+9+OPIE_SEED_MAX+1+19+1+19+1+19) Modified: stable/10/lib/libopie/Makefile ============================================================================== --- stable/10/lib/libopie/Makefile Sun Oct 19 11:59:15 2014 (r273276) +++ stable/10/lib/libopie/Makefile Sun Oct 19 12:11:25 2014 (r273277) @@ -4,7 +4,7 @@ # OPIE_DIST?= ${.CURDIR}/../../contrib/opie DIST_DIR= ${OPIE_DIST}/${.CURDIR:T} -SHLIB_MAJOR= 8 +SHLIB_MAJOR= 7 KEYFILE?= \"/etc/opiekeys\" From owner-svn-src-all@FreeBSD.ORG Sun Oct 19 16:26:51 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 01DCDB93; Sun, 19 Oct 2014 16:26:51 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DFEE0913; Sun, 19 Oct 2014 16:26:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9JGQoL7030676; Sun, 19 Oct 2014 16:26:50 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9JGQoul030672; Sun, 19 Oct 2014 16:26:50 GMT (envelope-from br@FreeBSD.org) Message-Id: <201410191626.s9JGQoul030672@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Sun, 19 Oct 2014 16:26:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273278 - in head/sys: arm/altera/socfpga arm/conf boot/fdt/dts/arm dev/beri X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 16:26:51 -0000 Author: br Date: Sun Oct 19 16:26:49 2014 New Revision: 273278 URL: https://svnweb.freebsd.org/changeset/base/273278 Log: Add driver for BERI soft processor 'ring buffer' device. Ring device provides a way for communicate to BERI peripherals such as BERI debug unit and console. Sponsored by: DARPA, AFRL Added: head/sys/arm/conf/SOCKIT-BERI (contents, props changed) head/sys/boot/fdt/dts/arm/socfpga-sockit-beri.dts (contents, props changed) head/sys/dev/beri/ head/sys/dev/beri/beri_ring.c (contents, props changed) Modified: head/sys/arm/altera/socfpga/files.socfpga Modified: head/sys/arm/altera/socfpga/files.socfpga ============================================================================== --- head/sys/arm/altera/socfpga/files.socfpga Sun Oct 19 12:11:25 2014 (r273277) +++ head/sys/arm/altera/socfpga/files.socfpga Sun Oct 19 16:26:49 2014 (r273278) @@ -21,3 +21,4 @@ arm/altera/socfpga/socfpga_mp.c option dev/dwc/if_dwc.c optional dwc dev/mmc/host/dwmmc.c optional dwmmc +dev/beri/beri_ring.c optional beri_ring Added: head/sys/arm/conf/SOCKIT-BERI ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/conf/SOCKIT-BERI Sun Oct 19 16:26:49 2014 (r273278) @@ -0,0 +1,140 @@ +# Kernel configuration for Terasic SoCKit (Altera Cyclone V SoC). +# +# For more information on this file, please read the config(5) manual page, +# and/or the handbook section on Kernel Configuration Files: +# +# http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# +# The handbook is also available locally in /usr/share/doc/handbook +# if you've installed the doc distribution, otherwise always see the +# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the +# latest information. +# +# An exhaustive list of options and more detailed explanations of the +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first +# in NOTES. +# +# $FreeBSD$ + +ident SOCKIT-BERI +include "../altera/socfpga/std.socfpga" + +makeoptions MODULES_OVERRIDE="" + +makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols +makeoptions WERROR="-Werror" + +options HZ=100 +options SCHED_4BSD # 4BSD scheduler +options INET # InterNETworking +options INET6 # IPv6 communications protocols +options GEOM_PART_BSD # BSD partition scheme +options GEOM_PART_MBR # MBR partition scheme +options GEOM_PART_GPT # GUID partition tables +options TMPFS # Efficient memory filesystem +options FFS # Berkeley Fast Filesystem +options SOFTUPDATES +options UFS_ACL # Support for access control lists +options UFS_DIRHASH # Improve performance on big directories +options MSDOSFS # MSDOS Filesystem +options CD9660 # ISO 9660 Filesystem +options PROCFS # Process filesystem (requires PSEUDOFS) +options PSEUDOFS # Pseudo-filesystem framework +options COMPAT_43 # Compatible with BSD 4.3 [KEEP THIS!] +options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI +options KTRACE +options SYSVSHM # SYSV-style shared memory +options SYSVMSG # SYSV-style message queues +options SYSVSEM # SYSV-style semaphores +options _KPOSIX_PRIORITY_SCHEDULING # Posix P1003_1B real-time extensions +options KBD_INSTALL_CDEV +options PREEMPTION +options FREEBSD_BOOT_LOADER +options VFP # vfp/neon + +options SMP + +# Debugging +makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols +options BREAK_TO_DEBUGGER +#options VERBOSE_SYSINIT # Enable verbose sysinit messages +options KDB +options DDB # Enable the kernel debugger +options INVARIANTS # Enable calls of extra sanity checking +options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS +#options WITNESS # Enable checks to detect deadlocks and cycles +#options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed +#options DIAGNOSTIC + +# NFS support +options NFSCL # Network Filesystem Client +options NFSLOCKD # Network Lock Manager +options NFS_ROOT # NFS usable as /, requires NFSCLIENT + +# Uncomment this for NFS root +#options NFS_ROOT # NFS usable as /, requires NFSCL +#options BOOTP_NFSROOT +#options BOOTP_COMPAT +#options BOOTP +#options BOOTP_NFSV3 +#options BOOTP_WIRED_TO=ue0 + +device mmc # mmc/sd bus +device mmcsd # mmc/sd flash cards +device dwmmc + +options ROOTDEVNAME=\"ufs:/dev/mmcsd0s4\" + +# Pseudo devices + +device loop +device random +device pty +device md +device gpio + +# USB support +options USB_HOST_ALIGN=64 # Align usb buffers to cache line size. +device usb +options USB_DEBUG +#options USB_REQ_DEBUG +#options USB_VERBOSE +#device musb +device dwcotg + +device umass +device scbus # SCSI bus (required for ATA/SCSI) +device da # Direct Access (disks) +device pass + +# Serial ports +device uart +device uart_ns8250 + +# I2C (TWSI) +device iic +device iicbus + +# SPI +device spibus + +# BERI specific +device beri_ring + +# Ethernet +device ether +device mii +device smsc +device smscphy +device dwc + +# USB ethernet support, requires miibus +device miibus +device axe # ASIX Electronics USB Ethernet +device bpf # Berkeley packet filter + +#FDT +options FDT +options FDT_DTB_STATIC +makeoptions FDT_DTS_FILE=socfpga-sockit-beri.dts Added: head/sys/boot/fdt/dts/arm/socfpga-sockit-beri.dts ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/boot/fdt/dts/arm/socfpga-sockit-beri.dts Sun Oct 19 16:26:49 2014 (r273278) @@ -0,0 +1,109 @@ +/*- + * Copyright (c) 2014 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$ + */ + +/dts-v1/; + +/include/ "socfpga.dtsi" + +/ { + model = "Terasic SoCKit"; + compatible = "altr,socfpga-cyclone5", "altr,socfpga"; + + /* Reserve first page for secondary CPU trampoline code */ + memreserve = < 0x00000000 0x1000 >; + + memory { + device_type = "memory"; + reg = < 0x00000000 0x40000000 >; /* 1G RAM */ + }; + + SOC: socfpga { + serial0: serial@ffc02000 { + status = "okay"; + }; + + usb1: usb@ffb40000 { + status = "okay"; + }; + + gmac1: ethernet@ff702000 { + status = "okay"; + }; + + mmc: dwmmc@ff704000 { + status = "okay"; + num-slots = <1>; + supports-highspeed; + broken-cd; + bus-frequency = <25000000>; + + slot@0 { + reg = <0>; + bus-width = <4>; + }; + }; + + beri_debug: ring@c0000000 { + compatible = "sri-cambridge,beri-ring"; + reg = <0xc0000000 0x3000>; + interrupts = < 72 73 >; + interrupt-parent = <&GIC>; + device_name = "beri_debug"; + data_size = <0x1000>; + data_read = <0x0>; + data_write = <0x1000>; + control_read = <0x2000>; + control_write = <0x2010>; + status = "okay"; + }; + + beri_console: ring@c0004000 { + compatible = "sri-cambridge,beri-ring"; + reg = <0xc0004000 0x3000>; + interrupts = < 74 75 >; + interrupt-parent = <&GIC>; + device_name = "beri_console"; + data_size = <0x1000>; + data_read = <0x0>; + data_write = <0x1000>; + control_read = <0x2000>; + control_write = <0x2010>; + status = "okay"; + }; + }; + + chosen { + bootargs = "-v"; + stdin = "serial0"; + stdout = "serial0"; + }; +}; Added: head/sys/dev/beri/beri_ring.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/beri/beri_ring.c Sun Oct 19 16:26:49 2014 (r273278) @@ -0,0 +1,529 @@ +/*- + * Copyright (c) 2014 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. + */ + +/* + * SRI-Cambridge BERI soft processor <-> ARM core ring buffer. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +#define READ4(_sc, _reg) \ + bus_read_4((_sc)->res[0], _reg) +#define WRITE4(_sc, _reg, _val) \ + bus_write_4((_sc)->res[0], _reg, _val) + +#define CDES_INT_EN (1 << 15) +#define CDES_CAUSE_MASK 0x3 +#define CDES_CAUSE_SHIFT 13 +#define DEVNAME_MAXLEN 256 + +typedef struct +{ + uint16_t cdes; + uint16_t interrupt_level; + uint16_t in; + uint16_t out; +} control_reg_t; + +struct beri_softc { + struct resource *res[3]; + bus_space_tag_t bst; + bus_space_handle_t bsh; + struct cdev *cdev; + device_t dev; + void *read_ih; + void *write_ih; + struct selinfo beri_rsel; + struct mtx beri_mtx; + int opened; + + char devname[DEVNAME_MAXLEN]; + int control_read; + int control_write; + int data_read; + int data_write; + int data_size; +}; + +static struct resource_spec beri_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, + { SYS_RES_IRQ, 0, RF_ACTIVE }, + { SYS_RES_IRQ, 1, RF_ACTIVE }, + { -1, 0 } +}; + +static control_reg_t +get_control_reg(struct beri_softc *sc, int dir) +{ + uint32_t offset; + uint16_t dst[4]; + control_reg_t c; + uint16_t *cp; + int i; + + cp = (uint16_t *)&c; + + offset = dir ? sc->control_write : sc->control_read; + ((uint32_t *)dst)[0] = READ4(sc, offset); + ((uint32_t *)dst)[1] = READ4(sc, offset + 4); + + for (i = 0; i < 4; i++) + cp[i] = dst[3 - i]; + + return (c); +} + +static void +set_control_reg(struct beri_softc *sc, int dir, control_reg_t *c) +{ + uint32_t offset; + uint16_t src[4]; + uint16_t *cp; + int i; + + cp = (uint16_t *)c; + + for (i = 0; i < 4; i++) + src[3 - i] = cp[i]; + + offset = dir ? sc->control_write : sc->control_read; + WRITE4(sc, offset + 0, ((uint32_t *)src)[0]); + WRITE4(sc, offset + 4, ((uint32_t *)src)[1]); +} + +static int +get_stock(struct beri_softc *sc, int dir, control_reg_t *c) +{ + uint32_t fill; + + fill = (c->in - c->out + sc->data_size) % sc->data_size; + + if (dir) + return (sc->data_size - fill - 1); + else + return (fill); +} + +static void +beri_intr_write(void *arg) +{ + struct beri_softc *sc; + control_reg_t c; + + sc = arg; + + c = get_control_reg(sc, 1); + if (c.cdes & CDES_INT_EN) { + c.cdes &= ~(CDES_INT_EN); + set_control_reg(sc, 1, &c); + } + + mtx_lock(&sc->beri_mtx); + selwakeuppri(&sc->beri_rsel, PZERO + 1); + KNOTE_LOCKED(&sc->beri_rsel.si_note, 0); + mtx_unlock(&sc->beri_mtx); +} + +static void +beri_intr_read(void *arg) +{ + struct beri_softc *sc; + control_reg_t c; + + sc = arg; + + c = get_control_reg(sc, 0); + if (c.cdes & CDES_INT_EN) { + c.cdes &= ~(CDES_INT_EN); + set_control_reg(sc, 0, &c); + } + + mtx_lock(&sc->beri_mtx); + selwakeuppri(&sc->beri_rsel, PZERO + 1); + KNOTE_LOCKED(&sc->beri_rsel.si_note, 0); + mtx_unlock(&sc->beri_mtx); +} + +static int +beri_open(struct cdev *dev, int flags __unused, + int fmt __unused, struct thread *td __unused) +{ + struct beri_softc *sc; + control_reg_t c; + + sc = dev->si_drv1; + + if (sc->opened) + return (1); + + /* Setup interrupt handlers */ + if (bus_setup_intr(sc->dev, sc->res[1], INTR_TYPE_BIO | INTR_MPSAFE, + NULL, beri_intr_read, sc, &sc->read_ih)) { + device_printf(sc->dev, "Unable to setup read intr\n"); + return (1); + } + if (bus_setup_intr(sc->dev, sc->res[2], INTR_TYPE_BIO | INTR_MPSAFE, + NULL, beri_intr_write, sc, &sc->write_ih)) { + device_printf(sc->dev, "Unable to setup write intr\n"); + return (1); + } + + sc->opened = 1; + + /* Clear write buffer */ + c = get_control_reg(sc, 1); + c.in = c.out; + c.cdes = 0; + set_control_reg(sc, 1, &c); + + /* Clear read buffer */ + c = get_control_reg(sc, 0); + c.out = c.in; + c.cdes = 0; + set_control_reg(sc, 0, &c); + + return (0); +} + +static int +beri_close(struct cdev *dev, int flags __unused, + int fmt __unused, struct thread *td __unused) +{ + struct beri_softc *sc; + + sc = dev->si_drv1; + + if (sc->opened) { + sc->opened = 0; + + /* Unsetup interrupt handlers */ + bus_teardown_intr(sc->dev, sc->res[1], sc->read_ih); + bus_teardown_intr(sc->dev, sc->res[2], sc->write_ih); + } + + return (0); +} + +static int +beri_rdwr(struct cdev *dev, struct uio *uio, int ioflag) +{ + struct beri_softc *sc; + uint32_t offset; + control_reg_t c; + uint16_t *ptr; + uint8_t *dst; + int stock; + int dir; + int amount; + int count; + + sc = dev->si_drv1; + + dir = uio->uio_rw ? 1 : 0; + + c = get_control_reg(sc, dir); + stock = get_stock(sc, dir, &c); + if (stock < uio->uio_resid) { + device_printf(sc->dev, "Err: no data/space available\n"); + return (1); + } + + amount = uio->uio_resid; + ptr = dir ? &c.in : &c.out; + count = (sc->data_size - *ptr); + + offset = dir ? sc->data_write : sc->data_read; + dst = (uint8_t *)(sc->bsh + offset); + + if (amount <= count) { + uiomove(dst + *ptr, amount, uio); + } else { + uiomove(dst + *ptr, count, uio); + uiomove(dst, (amount - count), uio); + } + + *ptr = (*ptr + amount) % sc->data_size; + set_control_reg(sc, dir, &c); + + return (0); +} + +static int +beri_kqread(struct knote *kn, long hint) +{ + struct beri_softc *sc; + control_reg_t c; + int stock; + + sc = kn->kn_hook; + + c = get_control_reg(sc, 0); + stock = get_stock(sc, 0, &c); + if (stock) { + kn->kn_data = stock; + return (1); + } + + kn->kn_data = 0; + + /* Wait at least one new byte in buffer */ + c.interrupt_level = 1; + + /* Enable interrupts */ + c.cdes |= (CDES_INT_EN); + set_control_reg(sc, 0, &c); + + return (0); +} + +static int +beri_kqwrite(struct knote *kn, long hint) +{ + struct beri_softc *sc; + control_reg_t c; + int stock; + + sc = kn->kn_hook; + + c = get_control_reg(sc, 1); + stock = get_stock(sc, 1, &c); + if (stock) { + kn->kn_data = stock; + return (1); + } + + kn->kn_data = 0; + + /* Wait at least one free position in buffer */ + c.interrupt_level = sc->data_size - 2; + + /* Enable interrupts */ + c.cdes |= (CDES_INT_EN); + set_control_reg(sc, 1, &c); + + return (0); +} + +static void +beri_kqdetach(struct knote *kn) +{ + struct beri_softc *sc; + + sc = kn->kn_hook; + + knlist_remove(&sc->beri_rsel.si_note, kn, 0); +} + +static struct filterops beri_read_filterops = { + .f_isfd = 1, + .f_attach = NULL, + .f_detach = beri_kqdetach, + .f_event = beri_kqread, +}; + +static struct filterops beri_write_filterops = { + .f_isfd = 1, + .f_attach = NULL, + .f_detach = beri_kqdetach, + .f_event = beri_kqwrite, +}; + +static int +beri_kqfilter(struct cdev *dev, struct knote *kn) +{ + struct beri_softc *sc; + + sc = dev->si_drv1; + + switch(kn->kn_filter) { + case EVFILT_READ: + kn->kn_fop = &beri_read_filterops; + break; + case EVFILT_WRITE: + kn->kn_fop = &beri_write_filterops; + break; + default: + return(EINVAL); + } + + kn->kn_hook = sc; + knlist_add(&sc->beri_rsel.si_note, kn, 0); + + return (0); +} + +static struct cdevsw beri_cdevsw = { + .d_version = D_VERSION, + .d_open = beri_open, + .d_close = beri_close, + .d_write = beri_rdwr, + .d_read = beri_rdwr, + .d_kqfilter = beri_kqfilter, + .d_name = "beri ring buffer", +}; + +static int +parse_fdt(struct beri_softc *sc) +{ + pcell_t dts_value[0]; + phandle_t node; + int len; + + if ((node = ofw_bus_get_node(sc->dev)) == -1) + return (ENXIO); + + /* get device name */ + if (OF_getprop(ofw_bus_get_node(sc->dev), "device_name", + &sc->devname, sizeof(sc->devname)) <= 0) { + device_printf(sc->dev, "Can't get device_name\n"); + return (ENXIO); + } + + if ((len = OF_getproplen(node, "data_size")) <= 0) + return (ENXIO); + OF_getencprop(node, "data_size", dts_value, len); + sc->data_size = dts_value[0]; + + if ((len = OF_getproplen(node, "data_read")) <= 0) + return (ENXIO); + OF_getencprop(node, "data_read", dts_value, len); + sc->data_read = dts_value[0]; + + if ((len = OF_getproplen(node, "data_write")) <= 0) + return (ENXIO); + OF_getencprop(node, "data_write", dts_value, len); + sc->data_write = dts_value[0]; + + if ((len = OF_getproplen(node, "control_read")) <= 0) + return (ENXIO); + OF_getencprop(node, "control_read", dts_value, len); + sc->control_read = dts_value[0]; + + if ((len = OF_getproplen(node, "control_write")) <= 0) + return (ENXIO); + OF_getencprop(node, "control_write", dts_value, len); + sc->control_write = dts_value[0]; + + return (0); +} + +static int +beri_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_is_compatible(dev, "sri-cambridge,beri-ring")) + return (ENXIO); + + device_set_desc(dev, "SRI-Cambridge BERI ring buffer"); + return (BUS_PROBE_DEFAULT); +} + +static int +beri_attach(device_t dev) +{ + struct beri_softc *sc; + + sc = device_get_softc(dev); + sc->dev = dev; + + if (bus_alloc_resources(dev, beri_spec, sc->res)) { + device_printf(dev, "could not allocate resources\n"); + return (ENXIO); + } + + /* Memory interface */ + sc->bst = rman_get_bustag(sc->res[0]); + sc->bsh = rman_get_bushandle(sc->res[0]); + + if (parse_fdt(sc)) { + device_printf(sc->dev, "Can't get FDT values\n"); + return (ENXIO); + } + + sc->cdev = make_dev(&beri_cdevsw, 0, UID_ROOT, GID_WHEEL, + S_IRWXU, "%s", sc->devname); + if (sc->cdev == NULL) { + device_printf(dev, "Failed to create character device.\n"); + return (ENXIO); + } + + sc->cdev->si_drv1 = sc; + + mtx_init(&sc->beri_mtx, "beri_mtx", NULL, MTX_DEF); + knlist_init_mtx(&sc->beri_rsel.si_note, &sc->beri_mtx); + + return (0); +} + +static device_method_t beri_methods[] = { + DEVMETHOD(device_probe, beri_probe), + DEVMETHOD(device_attach, beri_attach), + { 0, 0 } +}; + +static driver_t beri_driver = { + "beri_ring", + beri_methods, + sizeof(struct beri_softc), +}; + +static devclass_t beri_devclass; + +DRIVER_MODULE(beri_ring, simplebus, beri_driver, beri_devclass, 0, 0); From owner-svn-src-all@FreeBSD.ORG Sun Oct 19 16:46:37 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 570B915A; Sun, 19 Oct 2014 16:46:37 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4289DB2A; Sun, 19 Oct 2014 16:46:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9JGkbaC039875; Sun, 19 Oct 2014 16:46:37 GMT (envelope-from gnn@FreeBSD.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9JGkanV039873; Sun, 19 Oct 2014 16:46:36 GMT (envelope-from gnn@FreeBSD.org) Message-Id: <201410191646.s9JGkanV039873@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gnn set sender to gnn@FreeBSD.org using -f From: "George V. Neville-Neil" Date: Sun, 19 Oct 2014 16:46:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273279 - in head/sys/cam: ata scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 16:46:37 -0000 Author: gnn Date: Sun Oct 19 16:46:36 2014 New Revision: 273279 URL: https://svnweb.freebsd.org/changeset/base/273279 Log: Add new quirks for the latest Samsung SSD, model 850. Submitted by: sbruno MFC after: 2 weeks Modified: head/sys/cam/ata/ata_da.c head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/ata/ata_da.c ============================================================================== --- head/sys/cam/ata/ata_da.c Sun Oct 19 16:26:49 2014 (r273278) +++ head/sys/cam/ata/ata_da.c Sun Oct 19 16:46:36 2014 (r273279) @@ -457,6 +457,14 @@ static struct ada_quirk_entry ada_quirk_ { T_DIRECT, SIP_MEDIA_FIXED, "*", "SAMSUNG MZ7WD*", "*" }, /*quirks*/ADA_Q_4K }, + { + /* + * Samsung 850 SSDs + * 4k optimised + */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "Samsung SSD 850*", "*" }, + /*quirks*/ADA_Q_4K + }, { /* * Samsung PM853T Series SSDs Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Sun Oct 19 16:26:49 2014 (r273278) +++ head/sys/cam/scsi/scsi_da.c Sun Oct 19 16:46:36 2014 (r273279) @@ -1132,6 +1132,14 @@ static struct da_quirk_entry da_quirk_ta { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "SAMSUNG MZ7WD*", "*" }, /*quirks*/DA_Q_4K }, + { + /* + * Samsung 850 SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "Samsung SSD 850*", "*" }, + /*quirks*/DA_Q_4K + }, { /* * Samsung PM853T Series SSDs From owner-svn-src-all@FreeBSD.ORG Sun Oct 19 17:29:45 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B8A30C52; Sun, 19 Oct 2014 17:29:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A4AA0F7C; Sun, 19 Oct 2014 17:29:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9JHTj81059213; Sun, 19 Oct 2014 17:29:45 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9JHTjM5059212; Sun, 19 Oct 2014 17:29:45 GMT (envelope-from np@FreeBSD.org) Message-Id: <201410191729.s9JHTjM5059212@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Sun, 19 Oct 2014 17:29:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273280 - head/sys/dev/cxgb/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 17:29:45 -0000 Author: np Date: Sun Oct 19 17:29:44 2014 New Revision: 273280 URL: https://svnweb.freebsd.org/changeset/base/273280 Log: cxgb(4): reset the PHY if it generates an interrupt for no apparent reason. MFC after: 1 week Modified: head/sys/dev/cxgb/common/cxgb_ael1002.c Modified: head/sys/dev/cxgb/common/cxgb_ael1002.c ============================================================================== --- head/sys/dev/cxgb/common/cxgb_ael1002.c Sun Oct 19 16:46:36 2014 (r273279) +++ head/sys/dev/cxgb/common/cxgb_ael1002.c Sun Oct 19 17:29:44 2014 (r273280) @@ -1345,8 +1345,10 @@ static int ael2005_intr_handler(struct c return ret; ret |= cause; - if (!ret) + if (!ret) { + (void) ael2005_reset(phy, 0); ret |= cphy_cause_link_change; + } return ret; } From owner-svn-src-all@FreeBSD.ORG Sun Oct 19 17:55:04 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D3A8632D; Sun, 19 Oct 2014 17:55:04 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BF7C72B1; Sun, 19 Oct 2014 17:55:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9JHt42R072810; Sun, 19 Oct 2014 17:55:04 GMT (envelope-from rpaulo@FreeBSD.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9JHt4DM072809; Sun, 19 Oct 2014 17:55:04 GMT (envelope-from rpaulo@FreeBSD.org) Message-Id: <201410191755.s9JHt4DM072809@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rpaulo set sender to rpaulo@FreeBSD.org using -f From: Rui Paulo Date: Sun, 19 Oct 2014 17:55:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273281 - head/sys/arm/ti X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 17:55:04 -0000 Author: rpaulo Date: Sun Oct 19 17:55:04 2014 New Revision: 273281 URL: https://svnweb.freebsd.org/changeset/base/273281 Log: Style changes as pointed out by stas@. MFC after: 1 week Modified: head/sys/arm/ti/ti_wdt.c Modified: head/sys/arm/ti/ti_wdt.c ============================================================================== --- head/sys/arm/ti/ti_wdt.c Sun Oct 19 17:29:44 2014 (r273280) +++ head/sys/arm/ti/ti_wdt.c Sun Oct 19 17:55:04 2014 (r273281) @@ -98,12 +98,14 @@ DRIVER_MODULE(ti_wdt, simplebus, ti_wdt_ static volatile __inline uint32_t ti_wdt_reg_read(struct ti_wdt_softc *sc, uint32_t reg) { + return (bus_space_read_4(sc->sc_bt, sc->sc_bh, reg)); } static __inline void ti_wdt_reg_write(struct ti_wdt_softc *sc, uint32_t reg, uint32_t val) { + bus_space_write_4(sc->sc_bt, sc->sc_bh, reg, val); } @@ -113,14 +115,15 @@ ti_wdt_reg_write(struct ti_wdt_softc *sc static __inline void ti_wdt_reg_wait(struct ti_wdt_softc *sc, uint32_t bit) { + while (ti_wdt_reg_read(sc, TI_WDT_WWPS) & bit) DELAY(10); - } static __inline void ti_wdt_disable(struct ti_wdt_softc *sc) { + DPRINTF("disabling watchdog %p\n", sc); ti_wdt_reg_write(sc, TI_WDT_WSPR, 0xAAAA); ti_wdt_reg_wait(sc, TI_W_PEND_WSPR); @@ -131,6 +134,7 @@ ti_wdt_disable(struct ti_wdt_softc *sc) static __inline void ti_wdt_enable(struct ti_wdt_softc *sc) { + DPRINTF("enabling watchdog %p\n", sc); ti_wdt_reg_write(sc, TI_WDT_WSPR, 0xBBBB); ti_wdt_reg_wait(sc, TI_W_PEND_WSPR); From owner-svn-src-all@FreeBSD.ORG Sun Oct 19 18:31:12 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7555A907; Sun, 19 Oct 2014 18:31:12 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 60D7D7C5; Sun, 19 Oct 2014 18:31:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9JIVCUb091020; Sun, 19 Oct 2014 18:31:12 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9JIVCk5091019; Sun, 19 Oct 2014 18:31:12 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201410191831.s9JIVCk5091019@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 19 Oct 2014 18:31:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273282 - head/sys/dev/fdt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 18:31:12 -0000 Author: ian Date: Sun Oct 19 18:31:11 2014 New Revision: 273282 URL: https://svnweb.freebsd.org/changeset/base/273282 Log: Fail to probe on simplebus nodes that lack a "ranges" property. Increasingly, FDT data has the "simple-bus" compatible string on nodes that have children, but we wouldn't consider them to be busses. If the node lacks a ranges property then we will fail to attach successfully, so fail to probe as well. Modified: head/sys/dev/fdt/simplebus.c Modified: head/sys/dev/fdt/simplebus.c ============================================================================== --- head/sys/dev/fdt/simplebus.c Sun Oct 19 17:55:04 2014 (r273281) +++ head/sys/dev/fdt/simplebus.c Sun Oct 19 18:31:11 2014 (r273282) @@ -133,7 +133,13 @@ simplebus_probe(device_t dev) if (!ofw_bus_status_okay(dev)) return (ENXIO); - if (!ofw_bus_is_compatible(dev, "simple-bus") && + /* + * FDT data puts a "simple-bus" compatible string on many things that + * have children but aren't really busses in our world. Without a + * ranges property we will fail to attach, so just fail to probe too. + */ + if (!(ofw_bus_is_compatible(dev, "simple-bus") && + ofw_bus_has_prop(dev, "ranges")) && (ofw_bus_get_type(dev) == NULL || strcmp(ofw_bus_get_type(dev), "soc") != 0)) return (ENXIO); From owner-svn-src-all@FreeBSD.ORG Sun Oct 19 18:41:23 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4A0EDB9A; Sun, 19 Oct 2014 18:41:23 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3621E94C; Sun, 19 Oct 2014 18:41:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9JIfNY6094292; Sun, 19 Oct 2014 18:41:23 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9JIfNkl094291; Sun, 19 Oct 2014 18:41:23 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201410191841.s9JIfNkl094291@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 19 Oct 2014 18:41:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273283 - head/sys/arm/freescale/imx X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 18:41:23 -0000 Author: ian Date: Sun Oct 19 18:41:22 2014 New Revision: 273283 URL: https://svnweb.freebsd.org/changeset/base/273283 Log: Attach this driver during BUS_PASS_BUS and move the cpu init code to a bus_new_pass() handler so it doesn't happen until BUS_PASS_CPU. This allows the anatop driver to outbid the generic simplebus driver (which the FDT data describes as compatible). Some day when we handle power regulators, this driver may actually become a functional simplebus and attach the regulators as children, as described in the FDT data. Modified: head/sys/arm/freescale/imx/imx6_anatop.c Modified: head/sys/arm/freescale/imx/imx6_anatop.c ============================================================================== --- head/sys/arm/freescale/imx/imx6_anatop.c Sun Oct 19 18:31:11 2014 (r273282) +++ head/sys/arm/freescale/imx/imx6_anatop.c Sun Oct 19 18:41:22 2014 (r273283) @@ -98,6 +98,7 @@ struct imx6_anatop_softc { uint32_t cpu_maxmv; uint32_t cpu_maxmhz_hw; boolean_t cpu_overclock_enable; + boolean_t cpu_init_done; uint32_t refosc_mhz; void *temp_intrhand; uint32_t temp_high_val; @@ -623,6 +624,31 @@ intr_setup(void *arg) config_intrhook_disestablish(&sc->intr_setup_hook); } +static void +imx6_anatop_new_pass(device_t dev) +{ + struct imx6_anatop_softc *sc; + const int cpu_init_pass = BUS_PASS_CPU + BUS_PASS_ORDER_MIDDLE; + + /* + * We attach during BUS_PASS_BUS (because some day we will be a + * simplebus that has regulator devices as children), but some of our + * init work cannot be done until BUS_PASS_CPU (we rely on other devices + * that attach on the CPU pass). + */ + sc = device_get_softc(dev); + if (!sc->cpu_init_done && bus_current_pass >= cpu_init_pass) { + sc->cpu_init_done = true; + cpufreq_initialize(sc); + initialize_tempmon(sc); + if (bootverbose) { + device_printf(sc->dev, "CPU %uMHz @ %umV\n", + sc->cpu_curmhz, sc->cpu_curmv); + } + } + bus_generic_new_pass(dev); +} + static int imx6_anatop_detach(device_t dev) { @@ -666,13 +692,13 @@ imx6_anatop_attach(device_t dev) imx6_anatop_write_4(IMX6_ANALOG_PMU_MISC0_SET, IMX6_ANALOG_PMU_MISC0_SELFBIASOFF); - cpufreq_initialize(sc); - initialize_tempmon(sc); + /* + * Some day, when we're ready to deal with the actual anatop regulators + * that are described in fdt data as children of this "bus", this would + * be the place to invoke a simplebus helper routine to instantiate the + * children from the fdt data. + */ - if (bootverbose) { - device_printf(sc->dev, "CPU %uMHz @ %umV\n", sc->cpu_curmhz, - sc->cpu_curmv); - } err = 0; out: @@ -715,6 +741,9 @@ static device_method_t imx6_anatop_metho DEVMETHOD(device_attach, imx6_anatop_attach), DEVMETHOD(device_detach, imx6_anatop_detach), + /* Bus interface */ + DEVMETHOD(bus_new_pass, imx6_anatop_new_pass), + DEVMETHOD_END }; @@ -727,5 +756,7 @@ static driver_t imx6_anatop_driver = { static devclass_t imx6_anatop_devclass; EARLY_DRIVER_MODULE(imx6_anatop, simplebus, imx6_anatop_driver, - imx6_anatop_devclass, 0, 0, BUS_PASS_CPU + BUS_PASS_ORDER_FIRST + 1); + imx6_anatop_devclass, 0, 0, BUS_PASS_BUS + BUS_PASS_ORDER_MIDDLE); +EARLY_DRIVER_MODULE(imx6_anatop, ofwbus, imx6_anatop_driver, + imx6_anatop_devclass, 0, 0, BUS_PASS_BUS + BUS_PASS_ORDER_MIDDLE); From owner-svn-src-all@FreeBSD.ORG Sun Oct 19 20:23:33 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 12A88BF4; Sun, 19 Oct 2014 20:23:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E719A1DE; Sun, 19 Oct 2014 20:23:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9JKNW8J043740; Sun, 19 Oct 2014 20:23:32 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9JKNWwU043736; Sun, 19 Oct 2014 20:23:32 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201410192023.s9JKNWwU043736@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sun, 19 Oct 2014 20:23:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273284 - in head: lib/libkvm sys/arm/arm sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 20:23:33 -0000 Author: andrew Date: Sun Oct 19 20:23:31 2014 New Revision: 273284 URL: https://svnweb.freebsd.org/changeset/base/273284 Log: Allow libkvm to get the kernel va to pa delta without the need for physaddr. This should allow for a kernel where PHYSADDR and KERNPHYSADDR are both undefined. For now libkvm will use the old method of reading physaddr and kernaddr to allow it to work with old kernels. This could be removed in the future when enough time has passed. Differential Revision: https://reviews.freebsd.org/D939 MFC after: 1 week Modified: head/lib/libkvm/kvm_arm.c head/sys/arm/arm/dump_machdep.c head/sys/sys/elf_common.h Modified: head/lib/libkvm/kvm_arm.c ============================================================================== --- head/lib/libkvm/kvm_arm.c Sun Oct 19 18:41:22 2014 (r273283) +++ head/lib/libkvm/kvm_arm.c Sun Oct 19 20:23:31 2014 (r273284) @@ -132,8 +132,10 @@ _kvm_initvtop(kvm_t *kd) u_long kernbase, physaddr, pa; pd_entry_t *l1pt; Elf32_Ehdr *ehdr; + Elf32_Phdr *phdr; size_t hdrsz; char minihdr[8]; + int found, i; if (!kd->rawdump) { if (pread(kd->pmfd, &minihdr, 8, 0) == 8) { @@ -158,19 +160,33 @@ _kvm_initvtop(kvm_t *kd) hdrsz = ehdr->e_phoff + ehdr->e_phentsize * ehdr->e_phnum; if (_kvm_maphdrs(kd, hdrsz) == -1) return (-1); - nl[0].n_name = "kernbase"; - nl[1].n_name = NULL; - if (kvm_nlist(kd, nl) != 0) - kernbase = KERNBASE; - else - kernbase = nl[0].n_value; - nl[0].n_name = "physaddr"; - if (kvm_nlist(kd, nl) != 0) { - _kvm_err(kd, kd->program, "couldn't get phys addr"); - return (-1); + phdr = (Elf32_Phdr *)((uint8_t *)ehdr + ehdr->e_phoff); + found = 0; + for (i = 0; i < ehdr->e_phnum; i++) { + if (phdr[i].p_type == PT_DUMP_DELTA) { + kernbase = phdr[i].p_vaddr; + physaddr = phdr[i].p_paddr; + found = 1; + break; + } + } + + nl[1].n_name = NULL; + if (!found) { + nl[0].n_name = "kernbase"; + if (kvm_nlist(kd, nl) != 0) + kernbase = KERNBASE; + else + kernbase = nl[0].n_value; + + nl[0].n_name = "physaddr"; + if (kvm_nlist(kd, nl) != 0) { + _kvm_err(kd, kd->program, "couldn't get phys addr"); + return (-1); + } + physaddr = nl[0].n_value; } - physaddr = nl[0].n_value; nl[0].n_name = "kernel_l1pa"; if (kvm_nlist(kd, nl) != 0) { _kvm_err(kd, kd->program, "bad namelist"); Modified: head/sys/arm/arm/dump_machdep.c ============================================================================== --- head/sys/arm/arm/dump_machdep.c Sun Oct 19 18:41:22 2014 (r273283) +++ head/sys/arm/arm/dump_machdep.c Sun Oct 19 20:23:31 2014 (r273284) @@ -245,6 +245,29 @@ cb_dumphdr(struct md_pa *mdp, int seqnr, return (error); } +/* + * Add a header to be used by libkvm to get the va to pa delta + */ +static int +dump_os_header(struct dumperinfo *di) +{ + Elf_Phdr phdr; + int error; + + bzero(&phdr, sizeof(phdr)); + phdr.p_type = PT_DUMP_DELTA; + phdr.p_flags = PF_R; /* XXX */ + phdr.p_offset = 0; + phdr.p_vaddr = KERNVIRTADDR; + phdr.p_paddr = pmap_kextract(KERNVIRTADDR); + phdr.p_filesz = 0; + phdr.p_memsz = 0; + phdr.p_align = PAGE_SIZE; + + error = buf_write(di, (char*)&phdr, sizeof(phdr)); + return (error); +} + static int cb_size(struct md_pa *mdp, int seqnr, void *arg) { @@ -308,7 +331,7 @@ dumpsys(struct dumperinfo *di) /* Calculate dump size. */ dumpsize = 0L; - ehdr.e_phnum = foreach_chunk(cb_size, &dumpsize); + ehdr.e_phnum = foreach_chunk(cb_size, &dumpsize) + 1; hdrsz = ehdr.e_phoff + ehdr.e_phnum * ehdr.e_phentsize; fileofs = MD_ALIGN(hdrsz); dumpsize += fileofs; @@ -325,7 +348,7 @@ dumpsys(struct dumperinfo *di) mkdumpheader(&kdh, KERNELDUMPMAGIC, KERNELDUMP_ARM_VERSION, dumpsize, di->blocksize); printf("Dumping %llu MB (%d chunks)\n", (long long)dumpsize >> 20, - ehdr.e_phnum); + ehdr.e_phnum - 1); /* Dump leader */ error = dump_write(di, &kdh, 0, dumplo, sizeof(kdh)); @@ -340,6 +363,8 @@ dumpsys(struct dumperinfo *di) /* Dump program headers */ error = foreach_chunk(cb_dumphdr, di); + if (error >= 0) + error = dump_os_header(di); if (error < 0) goto fail; buf_flush(di); Modified: head/sys/sys/elf_common.h ============================================================================== --- head/sys/sys/elf_common.h Sun Oct 19 18:41:22 2014 (r273283) +++ head/sys/sys/elf_common.h Sun Oct 19 20:23:31 2014 (r273284) @@ -340,6 +340,8 @@ typedef struct { #define PT_GNU_EH_FRAME 0x6474e550 #define PT_GNU_STACK 0x6474e551 #define PT_GNU_RELRO 0x6474e552 +#define PT_DUMP_DELTA 0x6fb5d000 /* va->pa map for kernel dumps + (currently arm). */ #define PT_LOSUNW 0x6ffffffa #define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */ #define PT_SUNWSTACK 0x6ffffffb /* describes the stack segment */ From owner-svn-src-all@FreeBSD.ORG Sun Oct 19 20:47:00 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C3702F64; Sun, 19 Oct 2014 20:47:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AFE0F3D7; Sun, 19 Oct 2014 20:47:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9JKl05R053377; Sun, 19 Oct 2014 20:47:00 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9JKl0bx053373; Sun, 19 Oct 2014 20:47:00 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201410192047.s9JKl0bx053373@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sun, 19 Oct 2014 20:47:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273285 - in head: . etc/rc.d X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 20:47:00 -0000 Author: hrs Date: Sun Oct 19 20:46:59 2014 New Revision: 273285 URL: https://svnweb.freebsd.org/changeset/base/273285 Log: - Honer MK_KERBEROS for Heimdal rc.d scripts. - Add rc.c/kerberos to OLD_FILES. Modified: head/ObsoleteFiles.inc head/etc/rc.d/Makefile Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Sun Oct 19 20:23:31 2014 (r273284) +++ head/ObsoleteFiles.inc Sun Oct 19 20:46:59 2014 (r273285) @@ -48,6 +48,8 @@ OLD_FILES+=etc/rc.d/hv_kvpd # 20140917: libnv was accidentally being installed to /usr/lib instead of /lib OLD_LIBS+=usr/lib/libnv.a OLD_LIBS+=usr/lib/libnv.so.0 +# 20140829: rc.d/kerberos removed +OLD_FILES+=etc/rc.d/kerberos # 20140814: libopie version bump OLD_LIBS+=usr/lib/libopie.so.7 OLD_LIBS+=usr/lib32/libopie.so.7 Modified: head/etc/rc.d/Makefile ============================================================================== --- head/etc/rc.d/Makefile Sun Oct 19 20:23:31 2014 (r273284) +++ head/etc/rc.d/Makefile Sun Oct 19 20:46:59 2014 (r273285) @@ -70,12 +70,12 @@ FILES= DAEMON \ iscsictl \ iscsid \ jail \ - kadmind \ - kdc \ - kfd \ + ${_kadmind} \ + ${_kdc} \ + ${_kfd} \ kld \ kldxref \ - kpasswdd \ + ${_kpasswdd} \ ldconfig \ local \ localpkg \ @@ -181,6 +181,13 @@ _casperd= casperd _nscd= nscd .endif +.if ${MK_KERBEROS} != "no" +_kadmind= kadmind +_kdc= kdc +_kfd= kfd +_kpasswdd= kpasswdd +.endif + .if ${MK_OFED} != "no" _opensm= opensm .endif From owner-svn-src-all@FreeBSD.ORG Sun Oct 19 20:54:05 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4ECF0252; Sun, 19 Oct 2014 20:54:05 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 39224670; Sun, 19 Oct 2014 20:54:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9JKs5FE057646; Sun, 19 Oct 2014 20:54:05 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9JKs4uD057644; Sun, 19 Oct 2014 20:54:04 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201410192054.s9JKs4uD057644@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sun, 19 Oct 2014 20:54:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273286 - in stable/10: . etc/rc.d X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 20:54:05 -0000 Author: hrs Date: Sun Oct 19 20:54:04 2014 New Revision: 273286 URL: https://svnweb.freebsd.org/changeset/base/273286 Log: MFC r273285: - Honer MK_KERBEROS for Heimdal rc.d scripts. - Add rc.c/kerberos to OLD_FILES. Modified: stable/10/ObsoleteFiles.inc stable/10/etc/rc.d/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/ObsoleteFiles.inc ============================================================================== --- stable/10/ObsoleteFiles.inc Sun Oct 19 20:46:59 2014 (r273285) +++ stable/10/ObsoleteFiles.inc Sun Oct 19 20:54:04 2014 (r273286) @@ -40,6 +40,8 @@ # 20141015: OpenSSL 1.0.1j import OLD_FILES+=usr/share/openssl/man/man3/CMS_sign_add1_signer.3.gz +# 20141010: rc.d/kerberos removed +OLD_FILES+=etc/rc.d/kerberos # 20140917: hv_kvpd rc.d script removed in favor of devd configuration OLD_FILES+=etc/rc.d/hv_kvpd # 20140814: libopie version bump Modified: stable/10/etc/rc.d/Makefile ============================================================================== --- stable/10/etc/rc.d/Makefile Sun Oct 19 20:46:59 2014 (r273285) +++ stable/10/etc/rc.d/Makefile Sun Oct 19 20:54:04 2014 (r273286) @@ -71,13 +71,13 @@ FILES= DAEMON \ iscsictl \ iscsid \ jail \ - kadmind \ - kdc \ + ${_kadmind} \ + ${_kdc} \ keyserv \ - kfd \ + ${_kfd} \ kld \ kldxref \ - kpasswdd \ + ${_kpasswdd} \ ldconfig \ local \ localpkg \ @@ -173,6 +173,13 @@ FILES= DAEMON \ _ipxrouted= ipxrouted .endif +.if ${MK_KERBEROS} != "no" +_kadmind= kadmind +_kdc= kdc +_kfd= kfd +_kpasswdd= kpasswdd +.endif + .if ${MK_OFED} != "no" _opensm= opensm .endif From owner-svn-src-all@FreeBSD.ORG Sun Oct 19 20:56:06 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5DDFA4A2; Sun, 19 Oct 2014 20:56:06 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49ACA69B; Sun, 19 Oct 2014 20:56:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9JKu6sY057994; Sun, 19 Oct 2014 20:56:06 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9JKu6cY057993; Sun, 19 Oct 2014 20:56:06 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201410192056.s9JKu6cY057993@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sun, 19 Oct 2014 20:56:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273287 - head/sys/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 20:56:06 -0000 Author: andrew Date: Sun Oct 19 20:56:05 2014 New Revision: 273287 URL: https://svnweb.freebsd.org/changeset/base/273287 Log: Only build the ARM tranpoline when KERNPHYSADDR is defined as it is otherwise unneeded in armv6 kernels. MFC after: 1 week Modified: head/sys/conf/Makefile.arm Modified: head/sys/conf/Makefile.arm ============================================================================== --- head/sys/conf/Makefile.arm Sun Oct 19 20:54:04 2014 (r273286) +++ head/sys/conf/Makefile.arm Sun Oct 19 20:56:05 2014 (r273287) @@ -77,6 +77,7 @@ FILES_CPU_FUNC = \ $S/$M/$M/cpufunc_asm_pj4b.S $S/$M/$M/cpufunc_asm_armv6.S \ $S/$M/$M/cpufunc_asm_armv7.S +.if defined(KERNPHYSADDR) KERNEL_EXTRA=trampoline KERNEL_EXTRA_INSTALL=kernel.gz.tramp trampoline: ${KERNEL_KO}.tramp @@ -121,6 +122,7 @@ ${KERNEL_KO}.tramp: ${KERNEL_KO} $S/$M/$ ${KERNEL_KO}.gz.tramp.bin rm ${KERNEL_KO}.tmp.gz ${KERNEL_KO}.tramp.noheader opt_kernname.h \ inflate-tramp.o tmphack.S +.endif %BEFORE_DEPEND From owner-svn-src-all@FreeBSD.ORG Sun Oct 19 21:03:43 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AE680AFB; Sun, 19 Oct 2014 21:03:43 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9A6B6873; Sun, 19 Oct 2014 21:03:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9JL3hLr062500; Sun, 19 Oct 2014 21:03:43 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9JL3hKj062499; Sun, 19 Oct 2014 21:03:43 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201410192103.s9JL3hKj062499@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sun, 19 Oct 2014 21:03:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273288 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 21:03:43 -0000 Author: andrew Date: Sun Oct 19 21:03:42 2014 New Revision: 273288 URL: https://svnweb.freebsd.org/changeset/base/273288 Log: Allow the armv6 kernel to be build with PHYSADDR undefined. The kernel will now find the virtual to physical mapping for libkvm to use at runtime. This makes PHYSADDR redundant, however keep it around to give everyone a chance to update their libkvm. MFC after: 1 week Modified: head/sys/arm/arm/locore.S Modified: head/sys/arm/arm/locore.S ============================================================================== --- head/sys/arm/arm/locore.S Sun Oct 19 20:56:05 2014 (r273287) +++ head/sys/arm/arm/locore.S Sun Oct 19 21:03:42 2014 (r273288) @@ -42,6 +42,18 @@ __FBSDID("$FreeBSD$"); +/* + * Sanity check the configuration. + * FLASHADDR and LOADERRAMADDR depend on PHYSADDR in some cases. + * ARMv4 and ARMv5 make assumptions on where they are loaded. + * + * TODO: Fix the ARMv4/v5 case. + */ +#if (defined(FLASHADDR) || defined(LOADERRAMADDR) || !defined(_ARM_ARCH_6)) && \ + !defined(PHYSADDR) +#error PHYSADDR must be defined for this configuration +#endif + /* What size should this really be ? It is only used by initarm() */ #define INIT_ARM_STACK_SIZE (2048 * 4) @@ -54,15 +66,21 @@ __FBSDID("$FreeBSD$"); CPWAIT_BRANCH /* branch to next insn */ /* - * This is for kvm_mkdb, and should be the address of the beginning + * This is for libkvm, and should be the address of the beginning * of the kernel text segment (not necessarily the same as kernbase). + * + * These are being phased out. Newer copies of libkvm don't need these + * values as the information is added to the core file by inspecting + * the running kernel. */ .text .align 0 +#ifdef PHYSADDR .globl kernbase .set kernbase,KERNBASE .globl physaddr .set physaddr,PHYSADDR +#endif /* * On entry for FreeBSD boot ABI: From owner-svn-src-all@FreeBSD.ORG Sun Oct 19 21:16:25 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5E126DC4; Sun, 19 Oct 2014 21:16:25 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49BE1951; Sun, 19 Oct 2014 21:16:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9JLGPca067648; Sun, 19 Oct 2014 21:16:25 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9JLGPVM067647; Sun, 19 Oct 2014 21:16:25 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201410192116.s9JLGPVM067647@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Sun, 19 Oct 2014 21:16:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273290 - stable/10/lib/libc/stdtime X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 21:16:25 -0000 Author: ache Date: Sun Oct 19 21:16:24 2014 New Revision: 273290 URL: https://svnweb.freebsd.org/changeset/base/273290 Log: MFC r272562,r272678,r272679 1) Fix the case we have less arguments for format string than we expected. 2) Return error on unsupported format specs. (both according to POSIX) 3) For %Z format, understand "UTC" name too. PR: 93197 Modified: stable/10/lib/libc/stdtime/strptime.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/stdtime/strptime.c ============================================================================== --- stable/10/lib/libc/stdtime/strptime.c Sun Oct 19 21:07:35 2014 (r273289) +++ stable/10/lib/libc/stdtime/strptime.c Sun Oct 19 21:16:24 2014 (r273290) @@ -103,9 +103,6 @@ _strptime(const char *buf, const char *f ptr = fmt; while (*ptr != 0) { - if (*buf == 0) - break; - c = *ptr++; if (c != '%') { @@ -123,7 +120,6 @@ _strptime(const char *buf, const char *f label: c = *ptr++; switch (c) { - case 0: case '%': if (*buf++ != '%') return (NULL); @@ -552,7 +548,8 @@ label: strncpy(zonestr, buf, cp - buf); zonestr[cp - buf] = '\0'; tzset(); - if (0 == strcmp(zonestr, "GMT")) { + if (0 == strcmp(zonestr, "GMT") || + 0 == strcmp(zonestr, "UTC")) { *GMTp = 1; } else if (0 == strcmp(zonestr, tzname[0])) { tm->tm_isdst = 0; @@ -599,6 +596,9 @@ label: while (isspace_l((unsigned char)*buf, locale)) buf++; break; + + default: + return (NULL); } } @@ -674,6 +674,7 @@ strptime_l(const char * __restrict buf, ret = _strptime(buf, fmt, tm, &gmt, loc); if (ret && gmt) { time_t t = timegm(tm); + localtime_r(&t, tm); } From owner-svn-src-all@FreeBSD.ORG Sun Oct 19 23:13:17 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5C1CEDF6; Sun, 19 Oct 2014 23:13:17 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47E14694; Sun, 19 Oct 2014 23:13:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9JNDHgM026656; Sun, 19 Oct 2014 23:13:17 GMT (envelope-from gnn@FreeBSD.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9JNDHh9026655; Sun, 19 Oct 2014 23:13:17 GMT (envelope-from gnn@FreeBSD.org) Message-Id: <201410192313.s9JNDHh9026655@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gnn set sender to gnn@FreeBSD.org using -f From: "George V. Neville-Neil" Date: Sun, 19 Oct 2014 23:13:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273293 - head/cddl/lib/libdtrace X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 23:13:17 -0000 Author: gnn Date: Sun Oct 19 23:13:16 2014 New Revision: 273293 URL: https://svnweb.freebsd.org/changeset/base/273293 Log: Update the TCP structure used by DTrace to show the smoothed RTT. This will allow similar functionality to SIFTR to be built with DTrace. Submitted by: Grenville Armitage MFC after: 2 weeks Modified: head/cddl/lib/libdtrace/tcp.d Modified: head/cddl/lib/libdtrace/tcp.d ============================================================================== --- head/cddl/lib/libdtrace/tcp.d Sun Oct 19 23:05:18 2014 (r273292) +++ head/cddl/lib/libdtrace/tcp.d Sun Oct 19 23:13:16 2014 (r273293) @@ -116,6 +116,7 @@ typedef struct tcpsinfo { uint32_t tcps_rto; /* round-trip timeout, msec */ uint32_t tcps_mss; /* max segment size */ int tcps_retransmit; /* retransmit send event, boolean */ + int tcps_srtt; /* smoothed RTT in units of (TCP_RTT_SCALE*hz) */ } tcpsinfo_t; /* @@ -200,6 +201,7 @@ translator tcpsinfo_t < struct tcpcb *p tcps_rto = p == NULL ? -1 : p->t_rxtcur / 1000; /* XXX */ tcps_mss = p == NULL ? -1 : p->t_maxseg; tcps_retransmit = p == NULL ? -1 : p->t_rxtshift > 0 ? 1 : 0; + tcps_srtt = p == NULL ? -1 : p->t_srtt; /* smoothed RTT in units of (TCP_RTT_SCALE*hz) */ }; #pragma D binding "1.6.3" translator From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 00:22:09 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8E2C59AA; Mon, 20 Oct 2014 00:22:09 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5F5FAC72; Mon, 20 Oct 2014 00:22:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K0M9Hh061745; Mon, 20 Oct 2014 00:22:09 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K0M91x061744; Mon, 20 Oct 2014 00:22:09 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201410200022.s9K0M91x061744@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 20 Oct 2014 00:22:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273294 - stable/10/share/man/man4 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 00:22:09 -0000 Author: emaste Date: Mon Oct 20 00:22:08 2014 New Revision: 273294 URL: https://svnweb.freebsd.org/changeset/base/273294 Log: MFC r273178: Update vt(4) for UEFI defaults and special keys vt(4) is the default console for UEFI boot [1], and the bitmapped kern.vt.spclkeys sysctl has been replaced with individual kern.vt.kbd_* enable sysctls. PR: 193710 Modified: stable/10/share/man/man4/vt.4 Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/vt.4 ============================================================================== --- stable/10/share/man/man4/vt.4 Sun Oct 19 23:13:16 2014 (r273293) +++ stable/10/share/man/man4/vt.4 Mon Oct 20 00:22:08 2014 (r273294) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 2, 2014 +.Dd October 16, 2014 .Dt "VIRTUAL TERMINALS" 4 .Os .Sh NAME @@ -45,6 +45,15 @@ In .Xr loader.conf 5 : .Cd hw.vga.textmode=1 .Cd kern.vty=vt +.Pp +In +.Xr loader.conf 5 or +.Xr sysctl.conf 5 : +.Cd kern.vt.kbd_halt=1 +.Cd kern.vt.kbd_poweroff=1 +.Cd kern.vt.kbd_reboot=1 +.Cd kern.vt.kbd_debug=1 +.Cd kern.vt.kbd_panic=0 .Sh DESCRIPTION The .Nm @@ -184,17 +193,41 @@ Set to 1 to use virtual terminals in tex Features that require graphics mode, like loadable fonts, will be disabled. .It Va kern.vty -When both -.Nm -and -.Xr sc 4 have been compiled into the kernel, the one to use for the -system console can be selected by setting this value to +Set this value to .Ql vt or -.Ql sc . -If this value is not set, +.Ql sc +to override the default driver used for the system console. +By default, .Xr sc 4 -is used. +is used on computers that boot from BIOS, and +.Nm +is used on computers that boot from UEFI. +.Sh KEYBOARD SYSCTL TUNABLES +These settings control whether certain special key combinations are enabled or +ignored. +The specific key combinations can be configured by using a +.Xr keymap 5 +file. +.Pp +These settings can be entered at the +.Xr loader 8 +prompt or in +.Xr loader.conf 5 +and can also be changed at runtime with the +.Xr sysctl 8 +command. +.Bl -tag -width indent +.It Va kern.vt.kbd_halt +Enable halt keyboard combination. +.It Va kern.vt.kbd_poweroff +Enable power off key combination. +.It Va kern.vt.kbd_reboot. +Enable reboot key combination, usually Ctrl+Alt+Del. +.It Va kern.vt.kbd_debug +Enable debug request key combination, usually Ctrl+Alt+Esc. +.It Va kern.vt.kbd_panic +Enable panic key combination. .El .Sh FILES .Bl -tag -width /usr/share/vt/keymaps/* -compact From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 00:27:41 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E55B1B47; Mon, 20 Oct 2014 00:27:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D0E93CA5; Mon, 20 Oct 2014 00:27:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K0RfWU062462; Mon, 20 Oct 2014 00:27:41 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K0RegN062458; Mon, 20 Oct 2014 00:27:40 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201410200027.s9K0RegN062458@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Mon, 20 Oct 2014 00:27:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273295 - in head/sbin: ping ping6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 00:27:42 -0000 Author: hrs Date: Mon Oct 20 00:27:40 2014 New Revision: 273295 URL: https://svnweb.freebsd.org/changeset/base/273295 Log: WARNS=3 and style fixes. No functionality change. Modified: head/sbin/ping/Makefile head/sbin/ping/ping.c head/sbin/ping6/Makefile head/sbin/ping6/ping6.c Modified: head/sbin/ping/Makefile ============================================================================== --- head/sbin/ping/Makefile Mon Oct 20 00:22:08 2014 (r273294) +++ head/sbin/ping/Makefile Mon Oct 20 00:27:40 2014 (r273295) @@ -7,7 +7,7 @@ PROG= ping MAN= ping.8 BINOWN= root BINMODE=4555 -WARNS?= 2 +WARNS?= 3 DPADD= ${LIBM} LDADD= -lm Modified: head/sbin/ping/ping.c ============================================================================== --- head/sbin/ping/ping.c Mon Oct 20 00:22:08 2014 (r273294) +++ head/sbin/ping/ping.c Mon Oct 20 00:27:40 2014 (r273295) @@ -122,7 +122,7 @@ struct tv32 { }; /* various options */ -int options; +static int options; #define F_FLOOD 0x0001 #define F_INTERVAL 0x0002 #define F_NUMERIC 0x0004 @@ -157,52 +157,52 @@ int options; * to 8192 for complete accuracy... */ #define MAX_DUP_CHK (8 * 128) -int mx_dup_ck = MAX_DUP_CHK; -char rcvd_tbl[MAX_DUP_CHK / 8]; +static int mx_dup_ck = MAX_DUP_CHK; +static char rcvd_tbl[MAX_DUP_CHK / 8]; -struct sockaddr_in whereto; /* who to ping */ -int datalen = DEFDATALEN; -int maxpayload; -int ssend; /* send socket file descriptor */ -int srecv; /* receive socket file descriptor */ -u_char outpackhdr[IP_MAXPACKET], *outpack; -char BBELL = '\a'; /* characters written for MISSED and AUDIBLE */ -char BSPACE = '\b'; /* characters written for flood */ -char DOT = '.'; -char *hostname; -char *shostname; -int ident; /* process id to identify our packets */ -int uid; /* cached uid for micro-optimization */ -u_char icmp_type = ICMP_ECHO; -u_char icmp_type_rsp = ICMP_ECHOREPLY; -int phdr_len = 0; -int send_len; +static struct sockaddr_in whereto; /* who to ping */ +static int datalen = DEFDATALEN; +static int maxpayload; +static int ssend; /* send socket file descriptor */ +static int srecv; /* receive socket file descriptor */ +static u_char outpackhdr[IP_MAXPACKET], *outpack; +static char BBELL = '\a'; /* characters written for MISSED and AUDIBLE */ +static char BSPACE = '\b'; /* characters written for flood */ +static char DOT = '.'; +static char *hostname; +static char *shostname; +static int ident; /* process id to identify our packets */ +static int uid; /* cached uid for micro-optimization */ +static u_char icmp_type = ICMP_ECHO; +static u_char icmp_type_rsp = ICMP_ECHOREPLY; +static int phdr_len = 0; +static int send_len; /* counters */ -long nmissedmax; /* max value of ntransmitted - nreceived - 1 */ -long npackets; /* max packets to transmit */ -long nreceived; /* # of packets we got back */ -long nrepeats; /* number of duplicates */ -long ntransmitted; /* sequence # for outbound packets = #sent */ -long snpackets; /* max packets to transmit in one sweep */ -long snreceived; /* # of packets we got back in this sweep */ -long sntransmitted; /* # of packets we sent in this sweep */ -int sweepmax; /* max value of payload in sweep */ -int sweepmin = 0; /* start value of payload in sweep */ -int sweepincr = 1; /* payload increment in sweep */ -int interval = 1000; /* interval between packets, ms */ -int waittime = MAXWAIT; /* timeout for each packet */ -long nrcvtimeout = 0; /* # of packets we got back after waittime */ +static long nmissedmax; /* max value of ntransmitted - nreceived - 1 */ +static long npackets; /* max packets to transmit */ +static long nreceived; /* # of packets we got back */ +static long nrepeats; /* number of duplicates */ +static long ntransmitted; /* sequence # for outbound packets = #sent */ +static long snpackets; /* max packets to transmit in one sweep */ +static long sntransmitted; /* # of packets we sent in this sweep */ +static int sweepmax; /* max value of payload in sweep */ +static int sweepmin = 0; /* start value of payload in sweep */ +static int sweepincr = 1; /* payload increment in sweep */ +static int interval = 1000; /* interval between packets, ms */ +static int waittime = MAXWAIT; /* timeout for each packet */ +static long nrcvtimeout = 0; /* # of packets we got back after waittime */ /* timing */ -int timing; /* flag to do timing */ -double tmin = 999999999.0; /* minimum round trip time */ -double tmax = 0.0; /* maximum round trip time */ -double tsum = 0.0; /* sum of all times, for doing average */ -double tsumsq = 0.0; /* sum of all times squared, for std. dev. */ - -volatile sig_atomic_t finish_up; /* nonzero if we've been told to finish up */ -volatile sig_atomic_t siginfo_p; +static int timing; /* flag to do timing */ +static double tmin = 999999999.0; /* minimum round trip time */ +static double tmax = 0.0; /* maximum round trip time */ +static double tsum = 0.0; /* sum of all times, for doing average */ +static double tsumsq = 0.0; /* sum of all times squared, for std. dev. */ + +/* nonzero if we've been told to finish up */ +static volatile sig_atomic_t finish_up; +static volatile sig_atomic_t siginfo_p; #ifdef HAVE_LIBCAPSICUM static cap_channel_t *capdns; @@ -1150,7 +1150,8 @@ pr_pack(char *buf, int cc, struct sockad #endif tp = (const char *)tp + phdr_len; - if (cc - ICMP_MINLEN - phdr_len >= sizeof(tv1)) { + if ((size_t)(cc - ICMP_MINLEN - phdr_len) >= + sizeof(tv1)) { /* Copy to avoid alignment problems: */ memcpy(&tv32, tp, sizeof(tv32)); tv1.tv_sec = ntohl(tv32.tv32_sec); Modified: head/sbin/ping6/Makefile ============================================================================== --- head/sbin/ping6/Makefile Mon Oct 20 00:22:08 2014 (r273294) +++ head/sbin/ping6/Makefile Mon Oct 20 00:27:40 2014 (r273295) @@ -5,7 +5,7 @@ MAN= ping6.8 CFLAGS+=-DIPSEC -DKAME_SCOPEID -DUSE_RFC2292BIS \ -DHAVE_ARC4RANDOM -WARNS?= 2 +WARNS?= 3 BINOWN= root BINMODE=4555 Modified: head/sbin/ping6/ping6.c ============================================================================== --- head/sbin/ping6/ping6.c Mon Oct 20 00:22:08 2014 (r273294) +++ head/sbin/ping6/ping6.c Mon Oct 20 00:27:40 2014 (r273295) @@ -205,84 +205,83 @@ u_int options; * to 8192 for complete accuracy... */ #define MAX_DUP_CHK (8 * 8192) -int mx_dup_ck = MAX_DUP_CHK; -char rcvd_tbl[MAX_DUP_CHK / 8]; +static int mx_dup_ck = MAX_DUP_CHK; +static char rcvd_tbl[MAX_DUP_CHK / 8]; -struct sockaddr_in6 dst; /* who to ping6 */ -struct sockaddr_in6 src; /* src addr of this packet */ -socklen_t srclen; -int datalen = DEFDATALEN; -int s; /* socket file descriptor */ -u_char outpack[MAXPACKETLEN]; -char BSPACE = '\b'; /* characters written for flood */ -char BBELL = '\a'; /* characters written for AUDIBLE */ -char DOT = '.'; -char *hostname; -int ident; /* process id to identify our packets */ -u_int8_t nonce[8]; /* nonce field for node information */ -int hoplimit = -1; /* hoplimit */ -int pathmtu = 0; /* path MTU for the destination. 0 = unspec. */ -u_char *packet = NULL; +static struct sockaddr_in6 dst; /* who to ping6 */ +static struct sockaddr_in6 src; /* src addr of this packet */ +static socklen_t srclen; +static size_t datalen = DEFDATALEN; +static int s; /* socket file descriptor */ +static u_char outpack[MAXPACKETLEN]; +static char BSPACE = '\b'; /* characters written for flood */ +static char BBELL = '\a'; /* characters written for AUDIBLE */ +static char DOT = '.'; +static char *hostname; +static int ident; /* process id to identify our packets */ +static u_int8_t nonce[8]; /* nonce field for node information */ +static int hoplimit = -1; /* hoplimit */ +static u_char *packet = NULL; /* counters */ -long nmissedmax; /* max value of ntransmitted - nreceived - 1 */ -long npackets; /* max packets to transmit */ -long nreceived; /* # of packets we got back */ -long nrepeats; /* number of duplicates */ -long ntransmitted; /* sequence # for outbound packets = #sent */ -int interval = 1000; /* interval between packets in ms */ -int waittime = MAXWAIT; /* timeout for each packet */ -long nrcvtimeout = 0; /* # of packets we got back after waittime */ +static long nmissedmax; /* max value of ntransmitted - nreceived - 1 */ +static long npackets; /* max packets to transmit */ +static long nreceived; /* # of packets we got back */ +static long nrepeats; /* number of duplicates */ +static long ntransmitted; /* sequence # for outbound packets = #sent */ +static int interval = 1000; /* interval between packets in ms */ +static int waittime = MAXWAIT; /* timeout for each packet */ +static long nrcvtimeout = 0; /* # of packets we got back after waittime */ /* timing */ -int timing; /* flag to do timing */ -double tmin = 999999999.0; /* minimum round trip time */ -double tmax = 0.0; /* maximum round trip time */ -double tsum = 0.0; /* sum of all times, for doing average */ -double tsumsq = 0.0; /* sum of all times squared, for std. dev. */ +static int timing; /* flag to do timing */ +static double tmin = 999999999.0; /* minimum round trip time */ +static double tmax = 0.0; /* maximum round trip time */ +static double tsum = 0.0; /* sum of all times, for doing average */ +static double tsumsq = 0.0; /* sum of all times squared, for std. dev. */ /* for node addresses */ -u_short naflags; +static u_short naflags; /* for ancillary data(advanced API) */ -struct msghdr smsghdr; -struct iovec smsgiov; -char *scmsg = 0; +static struct msghdr smsghdr; +static struct iovec smsgiov; +static char *scmsg = 0; -volatile sig_atomic_t seenint; +static volatile sig_atomic_t seenint; #ifdef SIGINFO -volatile sig_atomic_t seeninfo; +static volatile sig_atomic_t seeninfo; #endif int main(int, char *[]); -void fill(char *, char *); -int get_hoplim(struct msghdr *); -int get_pathmtu(struct msghdr *); -struct in6_pktinfo *get_rcvpktinfo(struct msghdr *); -void onsignal(int); -void onint(int); -size_t pingerlen(void); -int pinger(void); -const char *pr_addr(struct sockaddr *, int); -void pr_icmph(struct icmp6_hdr *, u_char *); -void pr_iph(struct ip6_hdr *); -void pr_suptypes(struct icmp6_nodeinfo *, size_t); -void pr_nodeaddr(struct icmp6_nodeinfo *, int); -int myechoreply(const struct icmp6_hdr *); -int mynireply(const struct icmp6_nodeinfo *); -char *dnsdecode(const u_char **, const u_char *, const u_char *, - char *, size_t); -void pr_pack(u_char *, int, struct msghdr *); -void pr_exthdrs(struct msghdr *); -void pr_ip6opt(void *, size_t); -void pr_rthdr(void *, size_t); -int pr_bitrange(u_int32_t, int, int); -void pr_retip(struct ip6_hdr *, u_char *); -void summary(void); -void tvsub(struct timeval *, struct timeval *); -int setpolicy(int, char *); -char *nigroup(char *, int); -void usage(void); +static void fill(char *, char *); +static int get_hoplim(struct msghdr *); +static int get_pathmtu(struct msghdr *); +static struct in6_pktinfo *get_rcvpktinfo(struct msghdr *); +static void onsignal(int); +static void onint(int); +static size_t pingerlen(void); +static int pinger(void); +static const char *pr_addr(struct sockaddr *, int); +static void pr_icmph(struct icmp6_hdr *, u_char *); +static void pr_iph(struct ip6_hdr *); +static void pr_suptypes(struct icmp6_nodeinfo *, size_t); +static void pr_nodeaddr(struct icmp6_nodeinfo *, int); +static int myechoreply(const struct icmp6_hdr *); +static int mynireply(const struct icmp6_nodeinfo *); +static char *dnsdecode(const u_char **, const u_char *, const u_char *, + char *, size_t); +static void pr_pack(u_char *, int, struct msghdr *); +static void pr_exthdrs(struct msghdr *); +static void pr_ip6opt(void *, size_t); +static void pr_rthdr(void *, size_t); +static int pr_bitrange(u_int32_t, int, int); +static void pr_retip(struct ip6_hdr *, u_char *); +static void summary(void); +static void tvsub(struct timeval *, struct timeval *); +static int setpolicy(int, char *); +static char *nigroup(char *, int); +static void usage(void); int main(int argc, char *argv[]) @@ -390,9 +389,9 @@ main(int argc, char *argv[]) errno = 0; e = NULL; lsockbufsize = strtoul(optarg, &e, 10); - sockbufsize = lsockbufsize; + sockbufsize = (int)lsockbufsize; if (errno || !*optarg || *e || - sockbufsize != lsockbufsize) + lsockbufsize > INT_MAX) errx(1, "invalid socket buffer size"); #else errx(1, @@ -751,7 +750,7 @@ main(int argc, char *argv[]) *((int *)&nonce[i]) = rand(); #else memset(nonce, 0, sizeof(nonce)); - for (i = 0; i < sizeof(nonce); i += sizeof(u_int32_t)) + for (i = 0; i < (int)sizeof(nonce); i += sizeof(u_int32_t)) *((u_int32_t *)&nonce[i]) = arc4random(); #endif optval = 1; @@ -1009,7 +1008,7 @@ main(int argc, char *argv[]) #if defined(SO_SNDBUF) && defined(SO_RCVBUF) if (sockbufsize) { - if (datalen > sockbufsize) + if (datalen > (size_t)sockbufsize) warnx("you need -b to increase socket buffer size"); if (setsockopt(s, SOL_SOCKET, SO_SNDBUF, &sockbufsize, sizeof(sockbufsize)) < 0) @@ -1222,7 +1221,7 @@ main(int argc, char *argv[]) exit(nreceived == 0 ? 2 : 0); } -void +static void onsignal(int sig) { @@ -1247,7 +1246,7 @@ onsignal(int sig) * of the data portion are used to hold a UNIX "timeval" struct in VAX * byte-order, to compute the round-trip time. */ -size_t +static size_t pingerlen(void) { size_t l; @@ -1266,7 +1265,7 @@ pingerlen(void) return l; } -int +static int pinger(void) { struct icmp6_hdr *icp; @@ -1381,7 +1380,7 @@ pinger(void) return(0); } -int +static int myechoreply(const struct icmp6_hdr *icp) { if (ntohs(icp->icmp6_id) == ident) @@ -1390,7 +1389,7 @@ myechoreply(const struct icmp6_hdr *icp) return 0; } -int +static int mynireply(const struct icmp6_nodeinfo *nip) { if (memcmp(nip->icmp6_ni_nonce + sizeof(u_int16_t), @@ -1401,7 +1400,7 @@ mynireply(const struct icmp6_nodeinfo *n return 0; } -char * +static char * dnsdecode(const u_char **sp, const u_char *ep, const u_char *base, char *buf, size_t bufsiz) /*base for compressed name*/ @@ -1445,7 +1444,7 @@ dnsdecode(const u_char **sp, const u_cha while (i-- > 0 && cp < ep) { l = snprintf(cresult, sizeof(cresult), isprint(*cp) ? "%c" : "\\%03o", *cp & 0xff); - if (l >= sizeof(cresult) || l < 0) + if ((size_t)l >= sizeof(cresult) || l < 0) return NULL; if (strlcat(buf, cresult, bufsiz) >= bufsiz) return NULL; /*result overrun*/ @@ -1468,7 +1467,7 @@ dnsdecode(const u_char **sp, const u_cha * which arrive ('tis only fair). This permits multiple copies of this * program to be run without having intermingled output (or statistics!). */ -void +static void pr_pack(u_char *buf, int cc, struct msghdr *mhdr) { #define safeputc(c) printf((isprint((c)) ? "%c" : "\\%03o"), c) @@ -1500,7 +1499,7 @@ pr_pack(u_char *buf, int cc, struct msgh } from = (struct sockaddr *)mhdr->msg_name; fromlen = mhdr->msg_namelen; - if (cc < sizeof(struct icmp6_hdr)) { + if (cc < (int)sizeof(struct icmp6_hdr)) { if (options & F_VERBOSE) warnx("packet too short (%d bytes) from %s", cc, pr_addr(from, fromlen)); @@ -1754,7 +1753,7 @@ pr_pack(u_char *buf, int cc, struct msgh #undef safeputc } -void +static void pr_exthdrs(struct msghdr *mhdr) { ssize_t bufsize; @@ -1792,7 +1791,7 @@ pr_exthdrs(struct msghdr *mhdr) } #ifdef USE_RFC2292BIS -void +static void pr_ip6opt(void *extbuf, size_t bufsize) { struct ip6_hbh *ext; @@ -1855,7 +1854,7 @@ pr_ip6opt(void *extbuf, size_t bufsize) } #else /* !USE_RFC2292BIS */ /* ARGSUSED */ -void +static void pr_ip6opt(void *extbuf, size_t bufsize __unused) { putchar('\n'); @@ -1864,7 +1863,7 @@ pr_ip6opt(void *extbuf, size_t bufsize _ #endif /* USE_RFC2292BIS */ #ifdef USE_RFC2292BIS -void +static void pr_rthdr(void *extbuf, size_t bufsize) { struct in6_addr *in6; @@ -1921,7 +1920,7 @@ pr_rthdr(void *extbuf, size_t bufsize) #else /* !USE_RFC2292BIS */ /* ARGSUSED */ -void +static void pr_rthdr(void *extbuf, size_t bufsize __unused) { putchar('\n'); @@ -1929,7 +1928,7 @@ pr_rthdr(void *extbuf, size_t bufsize __ } #endif /* USE_RFC2292BIS */ -int +static int pr_bitrange(u_int32_t v, int soff, int ii) { int off; @@ -1975,7 +1974,7 @@ pr_bitrange(u_int32_t v, int soff, int i return ii; } -void +static void pr_suptypes(struct icmp6_nodeinfo *ni, size_t nilen) /* ni->qtype must be SUPTYPES */ { @@ -2041,7 +2040,7 @@ pr_suptypes(struct icmp6_nodeinfo *ni, s } } -void +static void pr_nodeaddr(struct icmp6_nodeinfo *ni, int nilen) /* ni->qtype must be NODEADDR */ { @@ -2107,7 +2106,7 @@ pr_nodeaddr(struct icmp6_nodeinfo *ni, i } } -int +static int get_hoplim(struct msghdr *mhdr) { struct cmsghdr *cm; @@ -2126,7 +2125,7 @@ get_hoplim(struct msghdr *mhdr) return(-1); } -struct in6_pktinfo * +static struct in6_pktinfo * get_rcvpktinfo(struct msghdr *mhdr) { struct cmsghdr *cm; @@ -2145,7 +2144,7 @@ get_rcvpktinfo(struct msghdr *mhdr) return(NULL); } -int +static int get_pathmtu(struct msghdr *mhdr) { #ifdef IPV6_RECVPATHMTU @@ -2205,7 +2204,7 @@ get_pathmtu(struct msghdr *mhdr) * Subtract 2 timeval structs: out = out - in. Out is assumed to * be >= in. */ -void +static void tvsub(struct timeval *out, struct timeval *in) { if ((out->tv_usec -= in->tv_usec) < 0) { @@ -2220,7 +2219,7 @@ tvsub(struct timeval *out, struct timeva * SIGINT handler. */ /* ARGSUSED */ -void +static void onint(int notused __unused) { /* @@ -2235,7 +2234,7 @@ onint(int notused __unused) * summary -- * Print out statistics. */ -void +static void summary(void) { @@ -2285,7 +2284,7 @@ static const char *nircode[] = { * pr_icmph -- * Print a descriptive string about an ICMP header. */ -void +static void pr_icmph(struct icmp6_hdr *icp, u_char *end) { char ntop_buf[INET6_ADDRSTRLEN]; @@ -2515,7 +2514,7 @@ pr_icmph(struct icmp6_hdr *icp, u_char * * pr_iph -- * Print an IP6 header. */ -void +static void pr_iph(struct ip6_hdr *ip6) { u_int32_t flow = ip6->ip6_flow & IPV6_FLOWLABEL_MASK; @@ -2543,7 +2542,7 @@ pr_iph(struct ip6_hdr *ip6) * Return an ascii host address as a dotted quad and optionally with * a hostname. */ -const char * +static const char * pr_addr(struct sockaddr *addr, int addrlen) { static char buf[NI_MAXHOST]; @@ -2562,13 +2561,13 @@ pr_addr(struct sockaddr *addr, int addrl * pr_retip -- * Dump some info on a returned (via ICMPv6) IPv6 packet. */ -void +static void pr_retip(struct ip6_hdr *ip6, u_char *end) { u_char *cp = (u_char *)ip6, nh; int hlen; - if (end - (u_char *)ip6 < sizeof(*ip6)) { + if ((size_t)(end - (u_char *)ip6) < sizeof(*ip6)) { printf("IP6"); goto trunc; } @@ -2642,7 +2641,7 @@ pr_retip(struct ip6_hdr *ip6, u_char *en return; } -void +static void fill(char *bp, char *patp) { int ii, jj, kk; @@ -2661,7 +2660,7 @@ fill(char *bp, char *patp) /* xxx */ if (ii > 0) for (kk = 0; - kk <= MAXDATALEN - (8 + sizeof(struct tv32) + ii); + (size_t)kk <= MAXDATALEN - 8 + sizeof(struct tv32) + ii; kk += ii) for (jj = 0; jj < ii; ++jj) bp[jj + kk] = pat[jj]; @@ -2675,7 +2674,7 @@ fill(char *bp, char *patp) #ifdef IPSEC #ifdef IPSEC_POLICY_IPSEC -int +static int setpolicy(int so __unused, char *policy) { char *buf; @@ -2696,7 +2695,7 @@ setpolicy(int so __unused, char *policy) #endif #endif -char * +static char * nigroup(char *name, int nig_oldmcprefix) { char *p; @@ -2755,7 +2754,7 @@ nigroup(char *name, int nig_oldmcprefix) return strdup(hbuf); } -void +static void usage(void) { (void)fprintf(stderr, From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 01:01:56 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 123F8A3; Mon, 20 Oct 2014 01:01:56 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EE1B0F79; Mon, 20 Oct 2014 01:01:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K11tNA080339; Mon, 20 Oct 2014 01:01:55 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K11tH4080338; Mon, 20 Oct 2014 01:01:55 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201410200101.s9K11tH4080338@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 20 Oct 2014 01:01:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273296 - stable/10/sys/dev/vt X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 01:01:56 -0000 Author: emaste Date: Mon Oct 20 01:01:55 2014 New Revision: 273296 URL: https://svnweb.freebsd.org/changeset/base/273296 Log: MFC r273219: Do nothing in vt_upgrade if there is no vt driver Previously, if no drivers attached at boot we would panic with "vtbuf_fill_locked begin.tp_row 0 must be < screen height 0". PR: 192248 Modified: stable/10/sys/dev/vt/vt_core.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/vt/vt_core.c ============================================================================== --- stable/10/sys/dev/vt/vt_core.c Mon Oct 20 00:27:40 2014 (r273295) +++ stable/10/sys/dev/vt/vt_core.c Mon Oct 20 01:01:55 2014 (r273296) @@ -2491,6 +2491,8 @@ vt_upgrade(struct vt_device *vd) if (!vty_enabled(VTY_VT)) return; + if (main_vd->vd_driver == NULL) + return; for (i = 0; i < VT_MAXWINDOWS; i++) { vw = vd->vd_windows[i]; From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 01:45:41 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5460C8B7; Mon, 20 Oct 2014 01:45:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 27BE6394; Mon, 20 Oct 2014 01:45:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K1jfUu099521; Mon, 20 Oct 2014 01:45:41 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K1jfUZ099520; Mon, 20 Oct 2014 01:45:41 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201410200145.s9K1jfUZ099520@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 20 Oct 2014 01:45:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r273297 - releng/10.1/share/man/man4 X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 01:45:41 -0000 Author: emaste Date: Mon Oct 20 01:45:40 2014 New Revision: 273297 URL: https://svnweb.freebsd.org/changeset/base/273297 Log: MFS10 r273294 (r273178 in HEAD): Update vt(4) for UEFI defaults and special keys vt(4) is the default console for UEFI boot [1], and the bitmapped kern.vt.spclkeys sysctl has been replaced with individual kern.vt.kbd_* enable sysctls. PR: 193710 Approved by: re Modified: releng/10.1/share/man/man4/vt.4 Directory Properties: releng/10.1/ (props changed) Modified: releng/10.1/share/man/man4/vt.4 ============================================================================== --- releng/10.1/share/man/man4/vt.4 Mon Oct 20 01:01:55 2014 (r273296) +++ releng/10.1/share/man/man4/vt.4 Mon Oct 20 01:45:40 2014 (r273297) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 2, 2014 +.Dd October 16, 2014 .Dt "VIRTUAL TERMINALS" 4 .Os .Sh NAME @@ -45,6 +45,15 @@ In .Xr loader.conf 5 : .Cd hw.vga.textmode=1 .Cd kern.vty=vt +.Pp +In +.Xr loader.conf 5 or +.Xr sysctl.conf 5 : +.Cd kern.vt.kbd_halt=1 +.Cd kern.vt.kbd_poweroff=1 +.Cd kern.vt.kbd_reboot=1 +.Cd kern.vt.kbd_debug=1 +.Cd kern.vt.kbd_panic=0 .Sh DESCRIPTION The .Nm @@ -184,17 +193,41 @@ Set to 1 to use virtual terminals in tex Features that require graphics mode, like loadable fonts, will be disabled. .It Va kern.vty -When both -.Nm -and -.Xr sc 4 have been compiled into the kernel, the one to use for the -system console can be selected by setting this value to +Set this value to .Ql vt or -.Ql sc . -If this value is not set, +.Ql sc +to override the default driver used for the system console. +By default, .Xr sc 4 -is used. +is used on computers that boot from BIOS, and +.Nm +is used on computers that boot from UEFI. +.Sh KEYBOARD SYSCTL TUNABLES +These settings control whether certain special key combinations are enabled or +ignored. +The specific key combinations can be configured by using a +.Xr keymap 5 +file. +.Pp +These settings can be entered at the +.Xr loader 8 +prompt or in +.Xr loader.conf 5 +and can also be changed at runtime with the +.Xr sysctl 8 +command. +.Bl -tag -width indent +.It Va kern.vt.kbd_halt +Enable halt keyboard combination. +.It Va kern.vt.kbd_poweroff +Enable power off key combination. +.It Va kern.vt.kbd_reboot. +Enable reboot key combination, usually Ctrl+Alt+Del. +.It Va kern.vt.kbd_debug +Enable debug request key combination, usually Ctrl+Alt+Esc. +.It Va kern.vt.kbd_panic +Enable panic key combination. .El .Sh FILES .Bl -tag -width /usr/share/vt/keymaps/* -compact From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 01:52:18 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3A742236; Mon, 20 Oct 2014 01:52:18 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 26CB16CB; Mon, 20 Oct 2014 01:52:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K1qIpX003933; Mon, 20 Oct 2014 01:52:18 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K1qIF0003932; Mon, 20 Oct 2014 01:52:18 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201410200152.s9K1qIF0003932@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 20 Oct 2014 01:52:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273298 - head/sys/boot/fdt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 01:52:18 -0000 Author: ian Date: Mon Oct 20 01:52:17 2014 New Revision: 273298 URL: https://svnweb.freebsd.org/changeset/base/273298 Log: The U-Boot README says fdt_addr_r is the right env var for fdt data loaded into ram, but vendors also use fdtaddr and fdt_addr. Check the recommended variable first and fall back to the others. Modified: head/sys/boot/fdt/fdt_loader_cmd.c Modified: head/sys/boot/fdt/fdt_loader_cmd.c ============================================================================== --- head/sys/boot/fdt/fdt_loader_cmd.c Mon Oct 20 01:45:40 2014 (r273297) +++ head/sys/boot/fdt/fdt_loader_cmd.c Mon Oct 20 01:52:17 2014 (r273298) @@ -310,10 +310,13 @@ fdt_setup_fdtp() /* * If the U-boot environment contains a variable giving the address of a - * valid blob in memory, use it. Board vendors use both fdtaddr and - * fdt_addr names. + * valid blob in memory, use it. The U-boot README says the right + * variable for fdt data loaded into ram is fdt_addr_r, so try that + * first. Board vendors also use both fdtaddr and fdt_addr names. */ - s = ub_env_get("fdtaddr"); + s = ub_env_get("fdt_addr_r"); + if (s == NULL) + s = ub_env_get("fdtaddr"); if (s == NULL) s = ub_env_get("fdt_addr"); if (s != NULL && *s != '\0') { From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 03:17:49 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 958E8C1E; Mon, 20 Oct 2014 03:17:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 820D9E1C; Mon, 20 Oct 2014 03:17:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K3Hnpg043071; Mon, 20 Oct 2014 03:17:49 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K3Hnfe043070; Mon, 20 Oct 2014 03:17:49 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201410200317.s9K3Hnfe043070@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 20 Oct 2014 03:17:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r273300 - releng/10.1/sys/dev/vt X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 03:17:49 -0000 Author: emaste Date: Mon Oct 20 03:17:48 2014 New Revision: 273300 URL: https://svnweb.freebsd.org/changeset/base/273300 Log: MFS10 r273296 (r273219 in HEAD): Do nothing in vt_upgrade if there is no vt driver Previously, if no drivers attached at boot we would panic with "vtbuf_fill_locked begin.tp_row 0 must be < screen height 0". PR: 192248 Approved by: re Modified: releng/10.1/sys/dev/vt/vt_core.c Directory Properties: releng/10.1/ (props changed) Modified: releng/10.1/sys/dev/vt/vt_core.c ============================================================================== --- releng/10.1/sys/dev/vt/vt_core.c Mon Oct 20 02:57:30 2014 (r273299) +++ releng/10.1/sys/dev/vt/vt_core.c Mon Oct 20 03:17:48 2014 (r273300) @@ -2491,6 +2491,8 @@ vt_upgrade(struct vt_device *vd) if (!vty_enabled(VTY_VT)) return; + if (main_vd->vd_driver == NULL) + return; for (i = 0; i < VT_MAXWINDOWS; i++) { vw = vd->vd_windows[i]; From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 04:14:36 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3D18532B; Mon, 20 Oct 2014 04:14:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2A42136C; Mon, 20 Oct 2014 04:14:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K4EaIC070560; Mon, 20 Oct 2014 04:14:36 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K4Eal4070559; Mon, 20 Oct 2014 04:14:36 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201410200414.s9K4Eal4070559@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Mon, 20 Oct 2014 04:14:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273301 - head/etc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 04:14:36 -0000 Author: hrs Date: Mon Oct 20 04:14:35 2014 New Revision: 273301 URL: https://svnweb.freebsd.org/changeset/base/273301 Log: Fix a typo. Spotted by: O. Hartmann Modified: head/etc/rc.firewall Modified: head/etc/rc.firewall ============================================================================== --- head/etc/rc.firewall Mon Oct 20 03:17:48 2014 (r273300) +++ head/etc/rc.firewall Mon Oct 20 04:14:35 2014 (r273301) @@ -498,7 +498,8 @@ case ${firewall_type} in ${fwcmd} add pass udp from $i to me ${j%/[Uu][Dd][Pp]} ;; *[0-9A-Za-z]) - echo "Consider using tcp/$j in firewall_myservices." > /dev/stderr + echo "Consider using ${j}/tcp in firewall_myservices." \ + > /dev/stderr ${fwcmd} add pass tcp from $i to me $j ;; *) From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 04:42:29 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1A470845; Mon, 20 Oct 2014 04:42:29 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 05087800; Mon, 20 Oct 2014 04:42:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K4gSg0084229; Mon, 20 Oct 2014 04:42:28 GMT (envelope-from rpaulo@FreeBSD.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K4gSHq084227; Mon, 20 Oct 2014 04:42:28 GMT (envelope-from rpaulo@FreeBSD.org) Message-Id: <201410200442.s9K4gSHq084227@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rpaulo set sender to rpaulo@FreeBSD.org using -f From: Rui Paulo Date: Mon, 20 Oct 2014 04:42:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273302 - stable/10/sys/dev/asmc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 04:42:29 -0000 Author: rpaulo Date: Mon Oct 20 04:42:28 2014 New Revision: 273302 URL: https://svnweb.freebsd.org/changeset/base/273302 Log: MFC r271975: Improvements to asmc(4): 1. changed the code so that 2**16 keys are supported 2. changed the number of possible fans in a system from 2 to 6 3. added write support for some fan sysctls 4. added a new sysctl which shows the ID of the fan 5. added four more apple models with their temperature keys 6. changed the maxnumber of temperature keys from 36 to 80 7. replaced several fixed buf sizes to sizeof buf Obtained from: Denis Ahrens denis at h3q.com Modified: stable/10/sys/dev/asmc/asmc.c stable/10/sys/dev/asmc/asmcvar.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/asmc/asmc.c ============================================================================== --- stable/10/sys/dev/asmc/asmc.c Mon Oct 20 04:14:35 2014 (r273301) +++ stable/10/sys/dev/asmc/asmc.c Mon Oct 20 04:42:28 2014 (r273302) @@ -77,6 +77,7 @@ static int asmc_key_read(device_t dev, uint8_t); static int asmc_fan_count(device_t dev); static int asmc_fan_getvalue(device_t dev, const char *key, int fan); +static int asmc_fan_setvalue(device_t dev, const char *key, int fan, int speed); static int asmc_temp_getvalue(device_t dev, const char *key); static int asmc_sms_read(device_t, const char *key, int16_t *val); static void asmc_sms_calibrate(device_t dev); @@ -94,6 +95,7 @@ static int asmc_key_dump(device_t, int); /* * Model functions. */ +static int asmc_mb_sysctl_fanid(SYSCTL_HANDLER_ARGS); static int asmc_mb_sysctl_fanspeed(SYSCTL_HANDLER_ARGS); static int asmc_mb_sysctl_fansafespeed(SYSCTL_HANDLER_ARGS); static int asmc_mb_sysctl_fanminspeed(SYSCTL_HANDLER_ARGS); @@ -115,6 +117,7 @@ struct asmc_model { int (*smc_sms_x)(SYSCTL_HANDLER_ARGS); int (*smc_sms_y)(SYSCTL_HANDLER_ARGS); int (*smc_sms_z)(SYSCTL_HANDLER_ARGS); + int (*smc_fan_id)(SYSCTL_HANDLER_ARGS); int (*smc_fan_speed)(SYSCTL_HANDLER_ARGS); int (*smc_fan_safespeed)(SYSCTL_HANDLER_ARGS); int (*smc_fan_minspeed)(SYSCTL_HANDLER_ARGS); @@ -134,7 +137,7 @@ static struct asmc_model *asmc_match(dev #define ASMC_SMS_FUNCS asmc_mb_sysctl_sms_x, asmc_mb_sysctl_sms_y, \ asmc_mb_sysctl_sms_z -#define ASMC_FAN_FUNCS asmc_mb_sysctl_fanspeed, asmc_mb_sysctl_fansafespeed, \ +#define ASMC_FAN_FUNCS asmc_mb_sysctl_fanid, asmc_mb_sysctl_fanspeed, asmc_mb_sysctl_fansafespeed, \ asmc_mb_sysctl_fanminspeed, \ asmc_mb_sysctl_fanmaxspeed, \ asmc_mb_sysctl_fantargetspeed @@ -196,6 +199,18 @@ struct asmc_model asmc_models[] = { ASMC_SMS_FUNCS, ASMC_FAN_FUNCS, ASMC_LIGHT_FUNCS, ASMC_MBP4_TEMPS, ASMC_MBP4_TEMPNAMES, ASMC_MBP4_TEMPDESCS }, + + { + "MacBookPro8,2", "Apple SMC MacBook Pro (early 2011)", + ASMC_SMS_FUNCS, ASMC_FAN_FUNCS, ASMC_LIGHT_FUNCS, + ASMC_MBP8_TEMPS, ASMC_MBP8_TEMPNAMES, ASMC_MBP8_TEMPDESCS + }, + + { + "MacBookPro11,3", "Apple SMC MacBook Pro Retina Core i7 (2013/2014)", + ASMC_SMS_FUNCS, ASMC_FAN_FUNCS, ASMC_LIGHT_FUNCS, + ASMC_MBP11_TEMPS, ASMC_MBP11_TEMPNAMES, ASMC_MBP11_TEMPDESCS + }, /* The Mac Mini has no SMS */ { @@ -224,12 +239,27 @@ struct asmc_model asmc_models[] = { ASMC_MP_TEMPS, ASMC_MP_TEMPNAMES, ASMC_MP_TEMPDESCS }, + /* Idem for the MacPro 2010*/ + { + "MacPro5,1", "Apple SMC MacPro (2010)", + NULL, NULL, NULL, + ASMC_FAN_FUNCS, + NULL, NULL, NULL, + ASMC_MP5_TEMPS, ASMC_MP5_TEMPNAMES, ASMC_MP5_TEMPDESCS + }, + { "MacBookAir1,1", "Apple SMC MacBook Air", ASMC_SMS_FUNCS, ASMC_FAN_FUNCS, NULL, NULL, NULL, ASMC_MBA_TEMPS, ASMC_MBA_TEMPNAMES, ASMC_MBA_TEMPDESCS }, + { + "MacBookAir3,1", "Apple SMC MacBook Air Core 2 Duo (Late 2010)", + ASMC_SMS_FUNCS, ASMC_FAN_FUNCS, NULL, NULL, NULL, + ASMC_MBA3_TEMPS, ASMC_MBA3_TEMPNAMES, ASMC_MBA3_TEMPDESCS + }, + { NULL, NULL } }; @@ -361,6 +391,12 @@ asmc_attach(device_t dev) SYSCTL_ADD_PROC(sysctlctx, SYSCTL_CHILDREN(sc->sc_fan_tree[i]), + OID_AUTO, "id", CTLTYPE_STRING | CTLFLAG_RD, + dev, j, model->smc_fan_id, "I", + "Fan ID"); + + SYSCTL_ADD_PROC(sysctlctx, + SYSCTL_CHILDREN(sc->sc_fan_tree[i]), OID_AUTO, "speed", CTLTYPE_INT | CTLFLAG_RD, dev, j, model->smc_fan_speed, "I", "Fan speed in RPM"); @@ -375,21 +411,21 @@ asmc_attach(device_t dev) SYSCTL_ADD_PROC(sysctlctx, SYSCTL_CHILDREN(sc->sc_fan_tree[i]), OID_AUTO, "minspeed", - CTLTYPE_INT | CTLFLAG_RD, + CTLTYPE_INT | CTLFLAG_RW, dev, j, model->smc_fan_minspeed, "I", "Fan minimum speed in RPM"); SYSCTL_ADD_PROC(sysctlctx, SYSCTL_CHILDREN(sc->sc_fan_tree[i]), OID_AUTO, "maxspeed", - CTLTYPE_INT | CTLFLAG_RD, + CTLTYPE_INT | CTLFLAG_RW, dev, j, model->smc_fan_maxspeed, "I", "Fan maximum speed in RPM"); SYSCTL_ADD_PROC(sysctlctx, SYSCTL_CHILDREN(sc->sc_fan_tree[i]), OID_AUTO, "targetspeed", - CTLTYPE_INT | CTLFLAG_RD, + CTLTYPE_INT | CTLFLAG_RW, dev, j, model->smc_fan_targetspeed, "I", "Fan target speed in RPM"); } @@ -641,11 +677,10 @@ nosms: if (bootverbose) { /* - * XXX: The number of keys is a 32 bit buffer, but - * right now Apple only uses the last 8 bit. + * The number of keys is a 32 bit buffer */ asmc_key_read(dev, ASMC_NKEYS, buf, 4); - device_printf(dev, "number of keys: %d\n", buf[3]); + device_printf(dev, "number of keys: %d\n", ntohl(*(uint32_t*)buf)); } #ifdef DEBUG @@ -906,7 +941,7 @@ asmc_fan_count(device_t dev) { uint8_t buf[1]; - if (asmc_key_read(dev, ASMC_KEY_FANCOUNT, buf, 1) < 0) + if (asmc_key_read(dev, ASMC_KEY_FANCOUNT, buf, sizeof buf) < 0) return (-1); return (buf[0]); @@ -920,13 +955,46 @@ asmc_fan_getvalue(device_t dev, const ch char fankey[5]; snprintf(fankey, sizeof(fankey), key, fan); - if (asmc_key_read(dev, fankey, buf, 2) < 0) + if (asmc_key_read(dev, fankey, buf, sizeof buf) < 0) return (-1); speed = (buf[0] << 6) | (buf[1] >> 2); return (speed); } +static char* +asmc_fan_getstring(device_t dev, const char *key, int fan) +{ + uint8_t buf[16]; + char fankey[5]; + char* desc; + + snprintf(fankey, sizeof(fankey), key, fan); + if (asmc_key_read(dev, fankey, buf, sizeof buf) < 0) + return (NULL); + desc = buf+4; + + return (desc); +} + +static int +asmc_fan_setvalue(device_t dev, const char *key, int fan, int speed) +{ + uint8_t buf[2]; + char fankey[5]; + + speed *= 4; + + buf[0] = speed>>8; + buf[1] = speed; + + snprintf(fankey, sizeof(fankey), key, fan); + if (asmc_key_write(dev, fankey, buf, sizeof buf) < 0) + return (-1); + + return (0); +} + static int asmc_mb_sysctl_fanspeed(SYSCTL_HANDLER_ARGS) { @@ -942,6 +1010,22 @@ asmc_mb_sysctl_fanspeed(SYSCTL_HANDLER_A } static int +asmc_mb_sysctl_fanid(SYSCTL_HANDLER_ARGS) +{ + device_t dev = (device_t) arg1; + int fan = arg2; + int error = true; + char* desc; + + desc = asmc_fan_getstring(dev, ASMC_KEY_FANID, fan); + + if (desc != NULL) + error = sysctl_handle_string(oidp, desc, 0, req); + + return (error); +} + +static int asmc_mb_sysctl_fansafespeed(SYSCTL_HANDLER_ARGS) { device_t dev = (device_t) arg1; @@ -967,6 +1051,11 @@ asmc_mb_sysctl_fanminspeed(SYSCTL_HANDLE v = asmc_fan_getvalue(dev, ASMC_KEY_FANMINSPEED, fan); error = sysctl_handle_int(oidp, &v, 0, req); + if (error == 0 && req->newptr != NULL) { + unsigned int newspeed = *(unsigned int *)req->newptr; + asmc_fan_setvalue(dev, ASMC_KEY_FANMINSPEED, fan, newspeed); + } + return (error); } @@ -981,6 +1070,11 @@ asmc_mb_sysctl_fanmaxspeed(SYSCTL_HANDLE v = asmc_fan_getvalue(dev, ASMC_KEY_FANMAXSPEED, fan); error = sysctl_handle_int(oidp, &v, 0, req); + if (error == 0 && req->newptr != NULL) { + unsigned int newspeed = *(unsigned int *)req->newptr; + asmc_fan_setvalue(dev, ASMC_KEY_FANMAXSPEED, fan, newspeed); + } + return (error); } @@ -995,6 +1089,11 @@ asmc_mb_sysctl_fantargetspeed(SYSCTL_HAN v = asmc_fan_getvalue(dev, ASMC_KEY_FANTARGETSPEED, fan); error = sysctl_handle_int(oidp, &v, 0, req); + if (error == 0 && req->newptr != NULL) { + unsigned int newspeed = *(unsigned int *)req->newptr; + asmc_fan_setvalue(dev, ASMC_KEY_FANTARGETSPEED, fan, newspeed); + } + return (error); } @@ -1009,7 +1108,7 @@ asmc_temp_getvalue(device_t dev, const c /* * Check for invalid temperatures. */ - if (asmc_key_read(dev, key, buf, 2) < 0) + if (asmc_key_read(dev, key, buf, sizeof buf) < 0) return (-1); return (buf[0]); @@ -1042,7 +1141,7 @@ asmc_sms_read(device_t dev, const char * case 'X': case 'Y': case 'Z': - error = asmc_key_read(dev, key, buf, 2); + error = asmc_key_read(dev, key, buf, sizeof buf); break; default: device_printf(dev, "%s called with invalid argument %s\n", @@ -1197,7 +1296,7 @@ asmc_mbp_sysctl_light_left(SYSCTL_HANDLE int error; int32_t v; - asmc_key_read(dev, ASMC_KEY_LIGHTLEFT, buf, 6); + asmc_key_read(dev, ASMC_KEY_LIGHTLEFT, buf, sizeof buf); v = buf[2]; error = sysctl_handle_int(oidp, &v, sizeof(v), req); @@ -1212,7 +1311,7 @@ asmc_mbp_sysctl_light_right(SYSCTL_HANDL int error; int32_t v; - asmc_key_read(dev, ASMC_KEY_LIGHTRIGHT, buf, 6); + asmc_key_read(dev, ASMC_KEY_LIGHTRIGHT, buf, sizeof buf); v = buf[2]; error = sysctl_handle_int(oidp, &v, sizeof(v), req); @@ -1236,7 +1335,7 @@ asmc_mbp_sysctl_light_control(SYSCTL_HAN v = level; buf[0] = level; buf[1] = 0x00; - asmc_key_write(dev, ASMC_KEY_LIGHTVALUE, buf, 2); + asmc_key_write(dev, ASMC_KEY_LIGHTVALUE, buf, sizeof buf); } return (error); Modified: stable/10/sys/dev/asmc/asmcvar.h ============================================================================== --- stable/10/sys/dev/asmc/asmcvar.h Mon Oct 20 04:14:35 2014 (r273301) +++ stable/10/sys/dev/asmc/asmcvar.h Mon Oct 20 04:42:28 2014 (r273302) @@ -27,7 +27,7 @@ * */ -#define ASMC_MAXFANS 2 +#define ASMC_MAXFANS 6 struct asmc_softc { device_t sc_dev; @@ -83,6 +83,7 @@ struct asmc_softc { */ #define ASMC_KEY_FANCOUNT "FNum" /* RO; 1 byte */ #define ASMC_KEY_FANMANUAL "FS! " /* RW; 2 bytes */ +#define ASMC_KEY_FANID "F%dID" /* RO; 16 bytes */ #define ASMC_KEY_FANSPEED "F%dAc" /* RO; 2 bytes */ #define ASMC_KEY_FANMINSPEED "F%dMn" /* RO; 2 bytes */ #define ASMC_KEY_FANMAXSPEED "F%dMx" /* RO; 2 bytes */ @@ -132,7 +133,7 @@ struct asmc_softc { * */ /* maximum array size for temperatures including the last NULL */ -#define ASMC_TEMP_MAX 36 +#define ASMC_TEMP_MAX 80 #define ASMC_MB_TEMPS { "TB0T", "TN0P", "TN1P", "Th0H", "Th1H", \ "TM0P", NULL } #define ASMC_MB_TEMPNAMES { "enclosure", "northbridge1", \ @@ -175,6 +176,57 @@ struct asmc_softc { "Unknown", "Unknown", \ "Wireless Module", } +#define ASMC_MBP8_TEMPS { "TB0T", "TB1T", "TB2T", "TC0C", "TC0D", \ + "TC0E", "TC0F", "TC0P", "TC1C", "TC2C", \ + "TC3C", "TC4C", "TCFC", "TCGC", "TCSA", \ + "TCTD", "TG0D", "TG0P", "THSP", "TM0S", \ + "TMBS", "TP0P", "TPCD", "TW0P", "Th1H", \ + "Th2H", "Tm0P", "Ts0P", "Ts0S", NULL } + +#define ASMC_MBP8_TEMPNAMES { "enclosure", "TB1T", "TB2T", "TC0C", "TC0D", \ + "TC0E", "TC0F", "TC0P", "TC1C", "TC2C", \ + "TC3C", "TC4C", "TCFC", "TCGC", "TCSA", \ + "TCTD", "graphics", "TG0P", "THSP", "TM0S", \ + "TMBS", "TP0P", "TPCD", "wireless", "Th1H", \ + "Th2H", "memory", "Ts0P", "Ts0S" } + +#define ASMC_MBP8_TEMPDESCS { "Enclosure Bottomside", "TB1T", "TB2T", "TC0C", "TC0D", \ + "TC0E", "TC0F", "TC0P", "TC1C", "TC2C", \ + "TC3C", "TC4C", "TCFC", "TCGC", "TCSA", \ + "TCTD", "TG0D", "TG0P", "THSP", "TM0S", \ + "TMBS", "TP0P", "TPCD", "TW0P", "Th1H", \ + "Th2H", "Tm0P", "Ts0P", "Ts0S" } + +#define ASMC_MBP11_TEMPS { "TB0T", "TB1T", "TB2T", "TBXT", "TC0E", \ + "TC0F", "TC0P", "TC1C", "TC2C", "TC3C", \ + "TC4C", "TCFC", "TCGC", "TCSA", "TCTD", \ + "TCXC", "TG0D", "TG0P", "TG1D", "TG1F", \ + "TG1d", "TH0A", "TH0B", "TH0F", "TH0R", \ + "TH0V", "TH0a", "TH0b", "TH0c", "TM0P", \ + "TM0S", "TP0P", "TPCD", "TW0P", "Ta0P", \ + "TaSP", "Th1H", "Th2H", "Ts0P", "Ts0S", \ + "Ts1S", NULL } + +#define ASMC_MBP11_TEMPNAMES { "TB0T", "TB1T", "TB2T", "TBXT", "TC0E", \ + "TC0F", "TC0P", "TC1C", "TC2C", "TC3C", \ + "TC4C", "TCFC", "TCGC", "TCSA", "TCTD", \ + "TCXC", "TG0D", "TG0P", "TG1D", "TG1F", \ + "TG1d", "TH0A", "TH0B", "TH0F", "TH0R", \ + "TH0V", "TH0a", "TH0b", "TH0c", "TM0P", \ + "TM0S", "TP0P", "TPCD", "TW0P", "Ta0P", \ + "TaSP", "Th1H", "Th2H", "Ts0P", "Ts0S", \ + "Ts1S" } + +#define ASMC_MBP11_TEMPDESCS { "TB0T", "TB1T", "TB2T", "TBXT", "TC0E", \ + "TC0F", "TC0P", "TC1C", "TC2C", "TC3C", \ + "TC4C", "TCFC", "TCGC", "TCSA", "TCTD", \ + "TCXC", "TG0D", "TG0P", "TG1D", "TG1F", \ + "TG1d", "TH0A", "TH0B", "TH0F", "TH0R", \ + "TH0V", "TH0a", "TH0b", "TH0c", "TM0P", \ + "TM0S", "TP0P", "TPCD", "TW0P", "Ta0P", \ + "TaSP", "Th1H", "Th2H", "Ts0P", "Ts0S", \ + "Ts1S" } + #define ASMC_MM_TEMPS { "TN0P", "TN1P", NULL } #define ASMC_MM_TEMPNAMES { "northbridge1", "northbridge2" } #define ASMC_MM_TEMPDESCS { "Northbridge Point 1", \ @@ -214,8 +266,7 @@ struct asmc_softc { "TH0P", "TH1P", "TH2P", "TH3P", "TMAP", \ "TMAS", "TMBS", "TM0P", "TM0S", "TM1P", \ "TM1S", "TM2P", "TM2S", "TM3S", "TM8P", \ - "TM8S", "TM9P", "TM9S", "TN0H", "TS0C", \ - NULL } + "TM8S", "TM9P", "TM9S", "TN0H", "TS0C", } #define ASMC_MP_TEMPDESCS { "TA0P", "TCAG", "TCAH", "TCBG", "TCBH", \ "TC0C", "TC0D", "TC0P", "TC1C", "TC1D", \ @@ -223,9 +274,66 @@ struct asmc_softc { "TH0P", "TH1P", "TH2P", "TH3P", "TMAP", \ "TMAS", "TMBS", "TM0P", "TM0S", "TM1P", \ "TM1S", "TM2P", "TM2S", "TM3S", "TM8P", \ - "TM8S", "TM9P", "TM9S", "TN0H", "TS0C", \ + "TM8S", "TM9P", "TM9S", "TN0H", "TS0C", } + +#define ASMC_MP5_TEMPS { "TA0P", "TCAC", "TCAD", "TCAG", "TCAH", \ + "TCAS", "TCBC", "TCBD", "TCBG", "TCBH", \ + "TCBS", "TH1F", "TH1P", "TH1V", "TH2F", \ + "TH2P", "TH2V", "TH3F", "TH3P", "TH3V", \ + "TH4F", "TH4P", "TH4V", "THPS", "THTG", \ + "TM1P", "TM2P", "TM2V", "TM3P", "TM3V", \ + "TM4P", "TM5P", "TM6P", "TM6V", "TM7P", \ + "TM7V", "TM8P", "TM8V", "TM9V", "TMA1", \ + "TMA2", "TMA3", "TMA4", "TMB1", "TMB2", \ + "TMB3", "TMB4", "TMHS", "TMLS", "TMPS", \ + "TMPV", "TMTG", "TN0D", "TN0H", "TNTG", \ + "Te1F", "Te1P", "Te1S", "Te2F", "Te2S", \ + "Te3F", "Te3S", "Te4F", "Te4S", "Te5F", \ + "Te5S", "TeGG", "TeGP", "TeRG", "TeRP", \ + "TeRV", "Tp0C", "Tp1C", "TpPS", "TpTG", \ NULL } +#define ASMC_MP5_TEMPNAMES { "ambient", "TCAC", "TCAD", "TCAG", "TCAH", \ + "TCAS", "TCBC", "TCBD", "TCBG", "TCBH", \ + "TCBS", "TH1F", "TH1P", "TH1V", "TH2F", \ + "TH2P", "TH2V", "TH3F", "TH3P", "TH3V", \ + "TH4F", "TH4P", "TH4V", "THPS", "THTG", \ + "TM1P", "TM2P", "TM2V", "TM3P", "TM3V", \ + "TM4P", "TM5P", "TM6P", "TM6V", "TM7P", \ + "TM7V", "TM8P", "TM8V", "TM9V", "ram_a1", \ + "ram_a2", "ram_a3", "ram_a4", "ram_b1", "ram_b2", \ + "ram_b3", "ram_b4", "TMHS", "TMLS", "TMPS", \ + "TMPV", "TMTG", "TN0D", "TN0H", "TNTG", \ + "Te1F", "Te1P", "Te1S", "Te2F", "Te2S", \ + "Te3F", "Te3S", "Te4F", "Te4S", "Te5F", \ + "Te5S", "TeGG", "TeGP", "TeRG", "TeRP", \ + "TeRV", "Tp0C", "Tp1C", "TpPS", "TpTG", } + +#define ASMC_MP5_TEMPDESCS { "TA0P", "TCAC", "TCAD", "TCAG", "TCAH", \ + "TCAS", "TCBC", "TCBD", "TCBG", "TCBH", \ + "TCBS", "TH1F", "TH1P", "TH1V", "TH2F", \ + "TH2P", "TH2V", "TH3F", "TH3P", "TH3V", \ + "TH4F", "TH4P", "TH4V", "THPS", "THTG", \ + "TM1P", "TM2P", "TM2V", "TM3P", "TM3V", \ + "TM4P", "TM5P", "TM6P", "TM6V", "TM7P", \ + "TM7V", "TM8P", "TM8V", "TM9V", "TMA1", \ + "TMA2", "TMA3", "TMA4", "TMB1", "TMB2", \ + "TMB3", "TMB4", "TMHS", "TMLS", "TMPS", \ + "TMPV", "TMTG", "TN0D", "TN0H", "TNTG", \ + "Te1F", "Te1P", "Te1S", "Te2F", "Te2S", \ + "Te3F", "Te3S", "Te4F", "Te4S", "Te5F", \ + "Te5S", "TeGG", "TeGP", "TeRG", "TeRP", \ + "TeRV", "Tp0C", "Tp1C", "TpPS", "TpTG", } + #define ASMC_MBA_TEMPS { "TB0T", NULL } #define ASMC_MBA_TEMPNAMES { "enclosure" } #define ASMC_MBA_TEMPDESCS { "Enclosure Bottom" } + +#define ASMC_MBA3_TEMPS { "TB0T", "TB1T", "TB2T", \ + "TC0D", "TC0E", "TC0P", NULL } + +#define ASMC_MBA3_TEMPNAMES { "enclosure", "TB1T", "TB2T", \ + "TC0D", "TC0E", "TC0P" } + +#define ASMC_MBA3_TEMPDESCS { "Enclosure Bottom", "TB1T", "TB2T", \ + "TC0D", "TC0E", "TC0P" } From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 05:17:17 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5F1E6C0E; Mon, 20 Oct 2014 05:17:17 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4B020A58; Mon, 20 Oct 2014 05:17:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K5HH2V098853; Mon, 20 Oct 2014 05:17:17 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K5HGQn098847; Mon, 20 Oct 2014 05:17:16 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201410200517.s9K5HGQn098847@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 20 Oct 2014 05:17:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r273303 - releng/10.1/sys/netinet X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 05:17:17 -0000 Author: tuexen Date: Mon Oct 20 05:17:16 2014 New Revision: 273303 URL: https://svnweb.freebsd.org/changeset/base/273303 Log: MFC10 r273275 (r273168 in head): Fix the reported streams in a SCTP_STREAM_RESET_EVENT, if a sent incoming stream reset request was responded with failed or denied. Thanks to Peter Bostroem from Google for reporting the issue. Approved by: re (hrs) Sponsored 2y: Modified: releng/10.1/sys/netinet/sctp_header.h releng/10.1/sys/netinet/sctp_input.c releng/10.1/sys/netinet/sctp_input.h Directory Properties: releng/10.1/ (props changed) Modified: releng/10.1/sys/netinet/sctp_header.h ============================================================================== --- releng/10.1/sys/netinet/sctp_header.h Mon Oct 20 04:42:28 2014 (r273302) +++ releng/10.1/sys/netinet/sctp_header.h Mon Oct 20 05:17:16 2014 (r273303) @@ -450,6 +450,11 @@ struct sctp_pktdrop_chunk { /**********STREAM RESET STUFF ******************/ +struct sctp_stream_reset_request { + struct sctp_paramhdr ph; + uint32_t request_seq; +} SCTP_PACKED; + struct sctp_stream_reset_out_request { struct sctp_paramhdr ph; uint32_t request_seq; /* monotonically increasing seq no */ @@ -464,7 +469,6 @@ struct sctp_stream_reset_in_request { uint16_t list_of_streams[]; /* if not all list of streams */ } SCTP_PACKED; - struct sctp_stream_reset_tsn_request { struct sctp_paramhdr ph; uint32_t request_seq; Modified: releng/10.1/sys/netinet/sctp_input.c ============================================================================== --- releng/10.1/sys/netinet/sctp_input.c Mon Oct 20 04:42:28 2014 (r273302) +++ releng/10.1/sys/netinet/sctp_input.c Mon Oct 20 05:17:16 2014 (r273303) @@ -3496,12 +3496,12 @@ sctp_reset_out_streams(struct sctp_tcb * } -struct sctp_stream_reset_out_request * +struct sctp_stream_reset_request * sctp_find_stream_reset(struct sctp_tcb *stcb, uint32_t seq, struct sctp_tmit_chunk **bchk) { struct sctp_association *asoc; struct sctp_chunkhdr *ch; - struct sctp_stream_reset_out_request *r; + struct sctp_stream_reset_request *r; struct sctp_tmit_chunk *chk; int len, clen; @@ -3524,7 +3524,7 @@ sctp_find_stream_reset(struct sctp_tcb * } clen = chk->send_size; ch = mtod(chk->data, struct sctp_chunkhdr *); - r = (struct sctp_stream_reset_out_request *)(ch + 1); + r = (struct sctp_stream_reset_request *)(ch + 1); if (ntohl(r->request_seq) == seq) { /* found it */ return (r); @@ -3532,7 +3532,7 @@ sctp_find_stream_reset(struct sctp_tcb * len = SCTP_SIZE32(ntohs(r->ph.param_length)); if (clen > (len + (int)sizeof(struct sctp_chunkhdr))) { /* move to the next one, there can only be a max of two */ - r = (struct sctp_stream_reset_out_request *)((caddr_t)r + len); + r = (struct sctp_stream_reset_request *)((caddr_t)r + len); if (ntohl(r->request_seq) == seq) { return (r); } @@ -3576,7 +3576,9 @@ sctp_handle_stream_reset_response(struct int lparm_len; struct sctp_association *asoc = &stcb->asoc; struct sctp_tmit_chunk *chk; - struct sctp_stream_reset_out_request *srparam; + struct sctp_stream_reset_request *req_param; + struct sctp_stream_reset_out_request *req_out_param; + struct sctp_stream_reset_in_request *req_in_param; uint32_t number_entries; if (asoc->stream_reset_outstanding == 0) { @@ -3584,35 +3586,36 @@ sctp_handle_stream_reset_response(struct return (0); } if (seq == stcb->asoc.str_reset_seq_out) { - srparam = sctp_find_stream_reset(stcb, seq, &chk); - if (srparam) { + req_param = sctp_find_stream_reset(stcb, seq, &chk); + if (req_param != NULL) { stcb->asoc.str_reset_seq_out++; - type = ntohs(srparam->ph.param_type); - lparm_len = ntohs(srparam->ph.param_length); + type = ntohs(req_param->ph.param_type); + lparm_len = ntohs(req_param->ph.param_length); if (type == SCTP_STR_RESET_OUT_REQUEST) { + req_out_param = (struct sctp_stream_reset_out_request *)req_param; number_entries = (lparm_len - sizeof(struct sctp_stream_reset_out_request)) / sizeof(uint16_t); asoc->stream_reset_out_is_outstanding = 0; if (asoc->stream_reset_outstanding) asoc->stream_reset_outstanding--; if (action == SCTP_STREAM_RESET_RESULT_PERFORMED) { /* do it */ - sctp_reset_out_streams(stcb, number_entries, srparam->list_of_streams); + sctp_reset_out_streams(stcb, number_entries, req_out_param->list_of_streams); } else if (action == SCTP_STREAM_RESET_RESULT_DENIED) { - sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_DENIED_OUT, stcb, number_entries, srparam->list_of_streams, SCTP_SO_NOT_LOCKED); + sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_DENIED_OUT, stcb, number_entries, req_out_param->list_of_streams, SCTP_SO_NOT_LOCKED); } else { - sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_FAILED_OUT, stcb, number_entries, srparam->list_of_streams, SCTP_SO_NOT_LOCKED); + sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_FAILED_OUT, stcb, number_entries, req_out_param->list_of_streams, SCTP_SO_NOT_LOCKED); } } else if (type == SCTP_STR_RESET_IN_REQUEST) { - /* Answered my request */ + req_in_param = (struct sctp_stream_reset_in_request *)req_param; number_entries = (lparm_len - sizeof(struct sctp_stream_reset_in_request)) / sizeof(uint16_t); if (asoc->stream_reset_outstanding) asoc->stream_reset_outstanding--; if (action == SCTP_STREAM_RESET_RESULT_DENIED) { sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_DENIED_IN, stcb, - number_entries, srparam->list_of_streams, SCTP_SO_NOT_LOCKED); + number_entries, req_in_param->list_of_streams, SCTP_SO_NOT_LOCKED); } else if (action != SCTP_STREAM_RESET_RESULT_PERFORMED) { sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_FAILED_IN, stcb, - number_entries, srparam->list_of_streams, SCTP_SO_NOT_LOCKED); + number_entries, req_in_param->list_of_streams, SCTP_SO_NOT_LOCKED); } } else if (type == SCTP_STR_RESET_ADD_OUT_STREAMS) { /* Ok we now may have more streams */ Modified: releng/10.1/sys/netinet/sctp_input.h ============================================================================== --- releng/10.1/sys/netinet/sctp_input.h Mon Oct 20 04:42:28 2014 (r273302) +++ releng/10.1/sys/netinet/sctp_input.h Mon Oct 20 05:17:16 2014 (r273303) @@ -48,7 +48,7 @@ sctp_common_input_processing(struct mbuf uint8_t, uint32_t, uint32_t, uint16_t); -struct sctp_stream_reset_out_request * +struct sctp_stream_reset_request * sctp_find_stream_reset(struct sctp_tcb *stcb, uint32_t seq, struct sctp_tmit_chunk **bchk); From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 05:27:54 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 381C4DB6; Mon, 20 Oct 2014 05:27:54 +0000 (UTC) Received: from mail109.syd.optusnet.com.au (mail109.syd.optusnet.com.au [211.29.132.80]) by mx1.freebsd.org (Postfix) with ESMTP id 39E32B17; Mon, 20 Oct 2014 05:27:52 +0000 (UTC) Received: from c122-106-147-133.carlnfd1.nsw.optusnet.com.au (c122-106-147-133.carlnfd1.nsw.optusnet.com.au [122.106.147.133]) by mail109.syd.optusnet.com.au (Postfix) with ESMTPS id E3BE3D65279; Mon, 20 Oct 2014 16:27:43 +1100 (AEDT) Date: Mon, 20 Oct 2014 16:27:42 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Hiroki Sato Subject: Re: svn commit: r273295 - in head/sbin: ping ping6 In-Reply-To: <201410200027.s9K0RegN062458@svn.freebsd.org> Message-ID: <20141020140848.D935@besplex.bde.org> References: <201410200027.s9K0RegN062458@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=dMCfxopb c=1 sm=1 tr=0 a=7NqvjVvQucbO2RlWB8PEog==:117 a=PO7r1zJSAAAA:8 a=kj9zAlcOel0A:10 a=JzwRw_2MAAAA:8 a=p19h3T3XEtIjB1ijwaYA:9 a=H8qqUDbkyOKwVUSl:21 a=CjuIK1q_8ugA:10 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 05:27:54 -0000 On Mon, 20 Oct 2014, Hiroki Sato wrote: > Log: > WARNS=3 and style fixes. No functionality change. > ... > Modified: head/sbin/ping/ping.c > ============================================================================== > --- head/sbin/ping/ping.c Mon Oct 20 00:22:08 2014 (r273294) > +++ head/sbin/ping/ping.c Mon Oct 20 00:27:40 2014 (r273295) > ... > @@ -1150,7 +1150,8 @@ pr_pack(char *buf, int cc, struct sockad > #endif > tp = (const char *)tp + phdr_len; > > - if (cc - ICMP_MINLEN - phdr_len >= sizeof(tv1)) { > + if ((size_t)(cc - ICMP_MINLEN - phdr_len) >= > + sizeof(tv1)) { > /* Copy to avoid alignment problems: */ > memcpy(&tv32, tp, sizeof(tv32)); > tv1.tv_sec = ntohl(tv32.tv32_sec); This breaks the warning, and breaks the code on exotic (unsupported) where it used to work accidentally. The code was already broken on non-exotic arches. We returned earlier for for runt packets, but this only guarantees that cc >= ICMP_MINLEN. When cc equals ICMP_MINLEN or is only a little larger, the subtractions give a negative value with type int (*). On all supported arches, size_t has the same or higher rank than int, so C's broken "value-preserving" promotion rules apply, and the small negative int is promoted to a huge unsigned value. This compares >= the small size_t value, so garbage beyond the end of the packet is used as a timestamp. On exotic arches where size_t has lower rank than int, the small size_t value was promoted to int, so the code worked. Casting the int breaks this. It is a downcast to an unsigned type, so the small negative int becomes a not so huge unsigned value. Then the promotion rules convert both sides to int for the comparision. This is a strictly upwards conversion, so it doesn't change the values. The LHS remains not so huge, and the RHS remains small. Since all the values are small before the type errors, even the not so huge value on the LHS is >= the small value on the RHS, so again garbage beyond the end of the packet is used as a timestamp. The easiest fix is to cast the size_t to int instead of the reverse. (*) That the subtractions give an int depends on the unobvious point that ICMP_MINLEN has type int. ICMP_MINLEN is not in POSIX and is not documented or even referenced in any man page. Fortunately it is not defined using sizeof(), so it doesn't suffer from the promotion bugs. It is relatively obvious that we avoided foot-shooting for the other terms in the expression -- both cc and phdrlen have type int. Foot-shooting is implemented for CMSG_LEN() and cmsg_len, which are used in a similar but simpler and correct comparision nearby. CMESG_LEN() is also not in POSIX and is not documented in any man page, but it is used in examples in man pages. It happens to be defined using an expression involving sizeof(), so it has type size_t except on exotic arches. This gives the usual promotion bugs. The examples are of the form cmsg_len = CMSG_LEN(). cmsg_len is usually a member of struct cmsghdr. cmsg_len is in POSIX and is well documented there if not in some man page. It has type socklen_t. socklen_t is also in POSIX and is very well documented there if not in some man page. POSIX allows but doesn't require the foot shooting and notes portability problems. It notes that old BSD didn't have socklen_t and used plain int instead. Other systems were apparently broken and used a foot-shooting type. So POSIX allows the foot-shooting. It specifies that socklen_t is an integer type of width at least 32 bits, and notes that the 32nd bit is unusable in portable code. Old BSD includes 4.4BSD- Lite2. FreeBSD broke this and implemented both the foot shooting and incompatibility with old BSD by making socklen_t an unsigned 32-bit type (uint32_t) as not required by POSIX. This is ABI-compatible in practice since the 32nd bit is not useful. socklen_t is not the same as size_t on 64-bit arches, so the type of cmsg_len is not even bug for bug compatible with the type of CMSG_MSG() and doesn't even guarantee the foot shooting on these arches -- it gets promoted to (signed) int64_t in some contexts, while size_t stays unsigned. In future arches, socklen_t might remain as 32 for ABI compatibility (32 bits is more than enough for buffer bloat), while plain int expands to 64 bits (except ABI compatibilty will impede that more strongly). Then the promotion bugs will move. > Modified: head/sbin/ping6/ping6.c > ============================================================================== > --- head/sbin/ping6/ping6.c Mon Oct 20 00:22:08 2014 (r273294) > +++ head/sbin/ping6/ping6.c Mon Oct 20 00:27:40 2014 (r273295) > @@ -205,84 +205,83 @@ u_int options; > * to 8192 for complete accuracy... > */ > #define MAX_DUP_CHK (8 * 8192) > -int mx_dup_ck = MAX_DUP_CHK; > -char rcvd_tbl[MAX_DUP_CHK / 8]; > +static int mx_dup_ck = MAX_DUP_CHK; > +static char rcvd_tbl[MAX_DUP_CHK / 8]; > > -struct sockaddr_in6 dst; /* who to ping6 */ > -struct sockaddr_in6 src; /* src addr of this packet */ > -socklen_t srclen; Old code like ping uses plain int for almost everything except where the broken ABI requires an unsigned type like socklen_t. > -int datalen = DEFDATALEN; > -int s; /* socket file descriptor */ > ... > +static u_int8_t nonce[8]; /* nonce field for node information */ This uses the deprecated nonstandard spelling of uint8_t. I also don't like use of fixed-width types when not necessary. Using fixed-width types for networking code is technically correct and necessary, but most networking code just uses u_char and hacks like n_long. POSIX now requires u_char to be the same as uint8_t, so changes like this are not necessary. > -void pr_suptypes(struct icmp6_nodeinfo *, size_t); The size_t foot-shooting is used a lot in prototypes. It is probably not needed for ABI compatibilty. > @@ -390,9 +389,9 @@ main(int argc, char *argv[]) > errno = 0; > e = NULL; > lsockbufsize = strtoul(optarg, &e, 10); > - sockbufsize = lsockbufsize; > + sockbufsize = (int)lsockbufsize; > if (errno || !*optarg || *e || > - sockbufsize != lsockbufsize) > + lsockbufsize > INT_MAX) > errx(1, "invalid socket buffer size"); I don't like warnings about hackish but correct code like the previous version of the above. Does the compiler actually complain about comparing ints with unsigned longs for equality? If you are going to change the range check, then rearrange the code. It was arranged to set sockbufsize before the value is known to fit so that non-fitting values can be checked. With range checking on the original value, it is more natural to not do the assignment until after the check has passed. Then the cast should be unnecessary since a smart compiler would see from the range check that the assignment can't overflow. > @@ -751,7 +750,7 @@ main(int argc, char *argv[]) > *((int *)&nonce[i]) = rand(); > #else > memset(nonce, 0, sizeof(nonce)); > - for (i = 0; i < sizeof(nonce); i += sizeof(u_int32_t)) > + for (i = 0; i < (int)sizeof(nonce); i += sizeof(u_int32_t)) > *((u_int32_t *)&nonce[i]) = arc4random(); > #endif > optval = 1; Casting sizeof() limits to int instead of the other way is correct, but it is a compiler bug to warn about simple code like the above. `i' has a very limited scope and obviously cannot be negative. > @@ -1009,7 +1008,7 @@ main(int argc, char *argv[]) > > #if defined(SO_SNDBUF) && defined(SO_RCVBUF) > if (sockbufsize) { > - if (datalen > sockbufsize) > + if (datalen > (size_t)sockbufsize) datalen was broken to have the foot-shooting (its type was changed from int to size_t). This is collateral. In ping4, datalen still has type int. In ping4, datalen is is initialized more or less correctly using code like the new code above for sockbufsize but better (use strtoul(), and range-check the value before assigning it). In ping6, the initialization of datalen is unchanged and more broken than before. datalen is assigned to directly from strtol(); then the overflowed value is checked. strtol() at least matched the sign of datalen. I'm suprised that you don't get a warning for the 'datalen <= 0' range check now. This is now an obfuscated way of writing 'datalen == 0'. Compilers apparently only warn about 'datalen < 0'. ping4 also has better error messages ("invalid packet size: `%s'" instead of "illegal datalen value -- %s"). BTW, I don't like compilers warning about checks of the form (datalen >= 0 && datalen <= MAX) or "fixing" these warnings by removing the datalen >= 0 check. datalen might be a typedefed type that might be signed. Careful code must check for negative values. This has no runtime cost if type happens to be unsigned, and no runtime cost on many arches even if it is unsigned. Removing the check breaks this careful code. > @@ -1445,7 +1444,7 @@ dnsdecode(const u_char **sp, const u_cha > while (i-- > 0 && cp < ep) { > l = snprintf(cresult, sizeof(cresult), > isprint(*cp) ? "%c" : "\\%03o", *cp & 0xff); > - if (l >= sizeof(cresult) || l < 0) > + if ((size_t)l >= sizeof(cresult) || l < 0) > return NULL; > if (strlcat(buf, cresult, bufsiz) >= bufsiz) > return NULL; /*result overrun*/ The conversion is backwards. snprintf() is hard to use. Almost no code uses it as carefully as the above. l < 0 probably can't happen in the above. But if you are willing to cast to unsigned, then you can fold the l < 0 check into the other check. snprintf() returns -1 on error, and casting that to size_t gives a huge unsigned value that looks like the non-error of the bufer being too small. "Fixing" warnings by applying size_t casts usually gives this check unintentionally. > @@ -1468,7 +1467,7 @@ dnsdecode(const u_char **sp, const u_cha > * which arrive ('tis only fair). This permits multiple copies of this > * program to be run without having intermingled output (or statistics!). > */ > -void > +static void > pr_pack(u_char *buf, int cc, struct msghdr *mhdr) > { > #define safeputc(c) printf((isprint((c)) ? "%c" : "\\%03o"), c) > @@ -1500,7 +1499,7 @@ pr_pack(u_char *buf, int cc, struct msgh > } > from = (struct sockaddr *)mhdr->msg_name; > fromlen = mhdr->msg_namelen; > - if (cc < sizeof(struct icmp6_hdr)) { > + if (cc < (int)sizeof(struct icmp6_hdr)) { > if (options & F_VERBOSE) > warnx("packet too short (%d bytes) from %s", cc, > pr_addr(from, fromlen)); Correct. > @@ -2562,13 +2561,13 @@ pr_addr(struct sockaddr *addr, int addrl > * pr_retip -- > * Dump some info on a returned (via ICMPv6) IPv6 packet. > */ > -void > +static void > pr_retip(struct ip6_hdr *ip6, u_char *end) > { > u_char *cp = (u_char *)ip6, nh; > int hlen; > > - if (end - (u_char *)ip6 < sizeof(*ip6)) { > + if ((size_t)(end - (u_char *)ip6) < sizeof(*ip6)) { > printf("IP6"); > goto trunc; > } Backwards. The RHS should be cast to ptrdiff_t. Pointer difference are only required to work up to 64K, but that is enough for the size of small objects. If ip6 is somehow larger than end, the unsigned comparsion gives foot-shooting as usual. The pointer difference is then negative; this gets promoted to a huge unsigned value which looks like enough space. > @@ -2642,7 +2641,7 @@ pr_retip(struct ip6_hdr *ip6, u_char *en > return; > } > > -void > +static void > fill(char *bp, char *patp) > { > int ii, jj, kk; > @@ -2661,7 +2660,7 @@ fill(char *bp, char *patp) > /* xxx */ > if (ii > 0) > for (kk = 0; > - kk <= MAXDATALEN - (8 + sizeof(struct tv32) + ii); > + (size_t)kk <= MAXDATALEN - 8 + sizeof(struct tv32) + ii; > kk += ii) > for (jj = 0; jj < ii; ++jj) > bp[jj + kk] = pat[jj]; Backwards. Bruce From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 07:15:05 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9CA574B5; Mon, 20 Oct 2014 07:15:05 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 892DF69B; Mon, 20 Oct 2014 07:15:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K7F5hI062985; Mon, 20 Oct 2014 07:15:05 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K7F5XP062984; Mon, 20 Oct 2014 07:15:05 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410200715.s9K7F5XP062984@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 20 Oct 2014 07:15:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r273304 - releng/10.1/sys/kern X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 07:15:05 -0000 Author: mav Date: Mon Oct 20 07:15:04 2014 New Revision: 273304 URL: https://svnweb.freebsd.org/changeset/base/273304 Log: MFS10 r273272 (r273143 in head): Remove setting BIO_DONE flag for BIOs that have done() method. This fixes use-after-free, caused by geom_disk, completing same BIO twice to save extra allocation, and getting BIO_DONE set after the first. Approved by: re (hrs) Modified: releng/10.1/sys/kern/vfs_bio.c Directory Properties: releng/10.1/ (props changed) Modified: releng/10.1/sys/kern/vfs_bio.c ============================================================================== --- releng/10.1/sys/kern/vfs_bio.c Mon Oct 20 05:17:16 2014 (r273303) +++ releng/10.1/sys/kern/vfs_bio.c Mon Oct 20 07:15:04 2014 (r273304) @@ -3582,10 +3582,8 @@ biodone(struct bio *bp) bp->bio_flags |= BIO_DONE; wakeup(bp); mtx_unlock(mtxp); - } else { - bp->bio_flags |= BIO_DONE; + } else done(bp); - } } /* From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 07:25:58 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1A7DB959; Mon, 20 Oct 2014 07:25:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E06E17DA; Mon, 20 Oct 2014 07:25:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K7Pvjf068805; Mon, 20 Oct 2014 07:25:57 GMT (envelope-from yongari@FreeBSD.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K7PvHl068804; Mon, 20 Oct 2014 07:25:57 GMT (envelope-from yongari@FreeBSD.org) Message-Id: <201410200725.s9K7PvHl068804@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: yongari set sender to yongari@FreeBSD.org using -f From: Pyun YongHyeon Date: Mon, 20 Oct 2014 07:25:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273305 - stable/10/sys/dev/mii X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 07:25:58 -0000 Author: yongari Date: Mon Oct 20 07:25:57 2014 New Revision: 273305 URL: https://svnweb.freebsd.org/changeset/base/273305 Log: MFC r271073: Do not blindly announce 1000baseT half-duplex capability in autonegotiation. Some controllers like cgem(4) do not support half-duplex at gigabit speeds. Modified: stable/10/sys/dev/mii/e1000phy.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mii/e1000phy.c ============================================================================== --- stable/10/sys/dev/mii/e1000phy.c Mon Oct 20 07:15:04 2014 (r273304) +++ stable/10/sys/dev/mii/e1000phy.c Mon Oct 20 07:25:57 2014 (r273305) @@ -169,8 +169,12 @@ e1000phy_attach(device_t dev) PHY_RESET(sc); sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & sc->mii_capmask; - if (sc->mii_capabilities & BMSR_EXTSTAT) + if (sc->mii_capabilities & BMSR_EXTSTAT) { sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR); + if ((sc->mii_extcapabilities & + (EXTSR_1000TFDX | EXTSR_1000THDX)) != 0) + sc->mii_flags |= MIIF_HAVE_GTCR; + } device_printf(dev, " "); mii_phy_add_media(sc); printf("\n"); @@ -325,8 +329,7 @@ e1000phy_service(struct mii_softc *sc, s speed = 0; switch (IFM_SUBTYPE(ife->ifm_media)) { case IFM_1000_T: - if ((sc->mii_extcapabilities & - (EXTSR_1000TFDX | EXTSR_1000THDX)) == 0) + if ((sc->mii_flags & MIIF_HAVE_GTCR) == 0) return (EINVAL); speed = E1000_CR_SPEED_1000; break; @@ -363,10 +366,9 @@ e1000phy_service(struct mii_softc *sc, s if (IFM_SUBTYPE(ife->ifm_media) == IFM_1000_T) { gig |= E1000_1GCR_MS_ENABLE; - if ((ife->ifm_media & IFM_ETH_MASTER) != 0) + if ((ife->ifm_media & IFM_ETH_MASTER) != 0) gig |= E1000_1GCR_MS_VALUE; - } else if ((sc->mii_extcapabilities & - (EXTSR_1000TFDX | EXTSR_1000THDX)) != 0) + } else if ((sc->mii_flags & MIIF_HAVE_GTCR) != 0) gig = 0; PHY_WRITE(sc, E1000_1GCR, gig); PHY_WRITE(sc, E1000_AR, E1000_AR_SELECTOR_FIELD); @@ -497,9 +499,14 @@ e1000phy_mii_phy_auto(struct mii_softc * PHY_WRITE(sc, E1000_AR, reg | E1000_AR_SELECTOR_FIELD); } else PHY_WRITE(sc, E1000_AR, E1000_FA_1000X_FD | E1000_FA_1000X); - if ((sc->mii_extcapabilities & (EXTSR_1000TFDX | EXTSR_1000THDX)) != 0) - PHY_WRITE(sc, E1000_1GCR, - E1000_1GCR_1000T_FD | E1000_1GCR_1000T); + if ((sc->mii_flags & MIIF_HAVE_GTCR) != 0) { + reg = 0; + if ((sc->mii_extcapabilities & EXTSR_1000TFDX) != 0) + reg |= E1000_1GCR_1000T_FD; + if ((sc->mii_extcapabilities & EXTSR_1000THDX) != 0) + reg |= E1000_1GCR_1000T; + PHY_WRITE(sc, E1000_1GCR, reg); + } PHY_WRITE(sc, E1000_CR, E1000_CR_AUTO_NEG_ENABLE | E1000_CR_RESTART_AUTO_NEG); From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 07:27:34 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EDF68A99; Mon, 20 Oct 2014 07:27:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C03A07ED; Mon, 20 Oct 2014 07:27:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K7RYFm069091; Mon, 20 Oct 2014 07:27:34 GMT (envelope-from yongari@FreeBSD.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K7RYWQ069090; Mon, 20 Oct 2014 07:27:34 GMT (envelope-from yongari@FreeBSD.org) Message-Id: <201410200727.s9K7RYWQ069090@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: yongari set sender to yongari@FreeBSD.org using -f From: Pyun YongHyeon Date: Mon, 20 Oct 2014 07:27:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r273306 - stable/9/sys/dev/mii X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 07:27:35 -0000 Author: yongari Date: Mon Oct 20 07:27:34 2014 New Revision: 273306 URL: https://svnweb.freebsd.org/changeset/base/273306 Log: MFC r271073: Do not blindly announce 1000baseT half-duplex capability in autonegotiation. Some controllers like cgem(4) do not support half-duplex at gigabit speeds. Modified: stable/9/sys/dev/mii/e1000phy.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/mii/e1000phy.c ============================================================================== --- stable/9/sys/dev/mii/e1000phy.c Mon Oct 20 07:25:57 2014 (r273305) +++ stable/9/sys/dev/mii/e1000phy.c Mon Oct 20 07:27:34 2014 (r273306) @@ -167,8 +167,12 @@ e1000phy_attach(device_t dev) PHY_RESET(sc); sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & sc->mii_capmask; - if (sc->mii_capabilities & BMSR_EXTSTAT) + if (sc->mii_capabilities & BMSR_EXTSTAT) { sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR); + if ((sc->mii_extcapabilities & + (EXTSR_1000TFDX | EXTSR_1000THDX)) != 0) + sc->mii_flags |= MIIF_HAVE_GTCR; + } device_printf(dev, " "); mii_phy_add_media(sc); printf("\n"); @@ -319,8 +323,7 @@ e1000phy_service(struct mii_softc *sc, s speed = 0; switch (IFM_SUBTYPE(ife->ifm_media)) { case IFM_1000_T: - if ((sc->mii_extcapabilities & - (EXTSR_1000TFDX | EXTSR_1000THDX)) == 0) + if ((sc->mii_flags & MIIF_HAVE_GTCR) == 0) return (EINVAL); speed = E1000_CR_SPEED_1000; break; @@ -357,10 +360,9 @@ e1000phy_service(struct mii_softc *sc, s if (IFM_SUBTYPE(ife->ifm_media) == IFM_1000_T) { gig |= E1000_1GCR_MS_ENABLE; - if ((ife->ifm_media & IFM_ETH_MASTER) != 0) + if ((ife->ifm_media & IFM_ETH_MASTER) != 0) gig |= E1000_1GCR_MS_VALUE; - } else if ((sc->mii_extcapabilities & - (EXTSR_1000TFDX | EXTSR_1000THDX)) != 0) + } else if ((sc->mii_flags & MIIF_HAVE_GTCR) != 0) gig = 0; PHY_WRITE(sc, E1000_1GCR, gig); PHY_WRITE(sc, E1000_AR, E1000_AR_SELECTOR_FIELD); @@ -491,9 +493,14 @@ e1000phy_mii_phy_auto(struct mii_softc * PHY_WRITE(sc, E1000_AR, reg | E1000_AR_SELECTOR_FIELD); } else PHY_WRITE(sc, E1000_AR, E1000_FA_1000X_FD | E1000_FA_1000X); - if ((sc->mii_extcapabilities & (EXTSR_1000TFDX | EXTSR_1000THDX)) != 0) - PHY_WRITE(sc, E1000_1GCR, - E1000_1GCR_1000T_FD | E1000_1GCR_1000T); + if ((sc->mii_flags & MIIF_HAVE_GTCR) != 0) { + reg = 0; + if ((sc->mii_extcapabilities & EXTSR_1000TFDX) != 0) + reg |= E1000_1GCR_1000T_FD; + if ((sc->mii_extcapabilities & EXTSR_1000THDX) != 0) + reg |= E1000_1GCR_1000T; + PHY_WRITE(sc, E1000_1GCR, reg); + } PHY_WRITE(sc, E1000_CR, E1000_CR_AUTO_NEG_ENABLE | E1000_CR_RESTART_AUTO_NEG); From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 07:28:20 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 059ACBD3; Mon, 20 Oct 2014 07:28:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CB75E7F6; Mon, 20 Oct 2014 07:28:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K7SJLQ069386; Mon, 20 Oct 2014 07:28:19 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K7SJv6069384; Mon, 20 Oct 2014 07:28:19 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410200728.s9K7SJv6069384@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 20 Oct 2014 07:28:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273307 - in stable/10/sys: cam/ctl dev/iscsi X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 07:28:20 -0000 Author: mav Date: Mon Oct 20 07:28:18 2014 New Revision: 273307 URL: https://svnweb.freebsd.org/changeset/base/273307 Log: MFC r271395 (by trasz): Make sure we handle less than zero timeouts in iSCSI initiator and target in a reasonable way. Sponsored by: The FreeBSD Foundation Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c stable/10/sys/dev/iscsi/iscsi.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_frontend_iscsi.c Mon Oct 20 07:27:34 2014 (r273306) +++ stable/10/sys/cam/ctl/ctl_frontend_iscsi.c Mon Oct 20 07:28:18 2014 (r273307) @@ -997,7 +997,7 @@ cfiscsi_callout(void *context) #ifdef ICL_KERNEL_PROXY if (cs->cs_waiting_for_ctld || cs->cs_login_phase) { - if (cs->cs_timeout > login_timeout) { + if (login_timeout > 0 && cs->cs_timeout > login_timeout) { CFISCSI_SESSION_WARN(cs, "login timed out after " "%d seconds; dropping connection", cs->cs_timeout); cfiscsi_session_terminate(cs); Modified: stable/10/sys/dev/iscsi/iscsi.c ============================================================================== --- stable/10/sys/dev/iscsi/iscsi.c Mon Oct 20 07:27:34 2014 (r273306) +++ stable/10/sys/dev/iscsi/iscsi.c Mon Oct 20 07:28:18 2014 (r273307) @@ -543,7 +543,7 @@ iscsi_callout(void *context) is->is_timeout++; if (is->is_waiting_for_iscsid) { - if (is->is_timeout > iscsid_timeout) { + if (iscsid_timeout > 0 && is->is_timeout > iscsid_timeout) { ISCSI_SESSION_WARN(is, "timed out waiting for iscsid(8) " "for %d seconds; reconnecting", is->is_timeout); @@ -553,7 +553,7 @@ iscsi_callout(void *context) } if (is->is_login_phase) { - if (is->is_timeout > login_timeout) { + if (login_timeout > 0 && is->is_timeout > login_timeout) { ISCSI_SESSION_WARN(is, "login timed out after %d seconds; " "reconnecting", is->is_timeout); reconnect_needed = true; @@ -561,6 +561,16 @@ iscsi_callout(void *context) goto out; } + if (ping_timeout <= 0) { + /* + * Pings are disabled. Don't send NOP-Out in this case. + * Reset the timeout, to avoid triggering reconnection, + * should the user decide to reenable them. + */ + is->is_timeout = 0; + goto out; + } + if (is->is_timeout >= ping_timeout) { ISCSI_SESSION_WARN(is, "no ping reply (NOP-In) after %d seconds; " "reconnecting", ping_timeout); From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 07:29:44 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id ABF84D0C; Mon, 20 Oct 2014 07:29:44 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 98227800; Mon, 20 Oct 2014 07:29:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K7TiSm069617; Mon, 20 Oct 2014 07:29:44 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K7TiEQ069616; Mon, 20 Oct 2014 07:29:44 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410200729.s9K7TiEQ069616@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 20 Oct 2014 07:29:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273308 - stable/10/sys/cam X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 07:29:44 -0000 Author: mav Date: Mon Oct 20 07:29:43 2014 New Revision: 273308 URL: https://svnweb.freebsd.org/changeset/base/273308 Log: MFC r271718 (by bdrewery): Correct a comment Modified: stable/10/sys/cam/cam_xpt.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/cam_xpt.c ============================================================================== --- stable/10/sys/cam/cam_xpt.c Mon Oct 20 07:28:18 2014 (r273307) +++ stable/10/sys/cam/cam_xpt.c Mon Oct 20 07:29:43 2014 (r273308) @@ -3056,7 +3056,7 @@ xpt_polled_action(union ccb *start_ccb) } /* - * Schedule a peripheral driver to receive a ccb when it's + * Schedule a peripheral driver to receive a ccb when its * target device has space for more transactions. */ void From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 07:31:24 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 55BAEE5E; Mon, 20 Oct 2014 07:31:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 41C2189C; Mon, 20 Oct 2014 07:31:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K7VOSj073337; Mon, 20 Oct 2014 07:31:24 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K7VOMR073336; Mon, 20 Oct 2014 07:31:24 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410200731.s9K7VOMR073336@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 20 Oct 2014 07:31:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273309 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 07:31:24 -0000 Author: mav Date: Mon Oct 20 07:31:23 2014 New Revision: 273309 URL: https://svnweb.freebsd.org/changeset/base/273309 Log: MFC r272597: Fix length of Extended INQUIRY Data VPD page. Modified: stable/10/sys/cam/ctl/ctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Mon Oct 20 07:29:43 2014 (r273308) +++ stable/10/sys/cam/ctl/ctl.c Mon Oct 20 07:31:23 2014 (r273309) @@ -9914,9 +9914,7 @@ ctl_inquiry_evpd_eid(struct ctl_scsiio * lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - data_len = sizeof(struct scsi_vpd_mode_page_policy) + - sizeof(struct scsi_vpd_mode_page_policy_descr); - + data_len = sizeof(struct scsi_vpd_extended_inquiry_data); ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); eid_ptr = (struct scsi_vpd_extended_inquiry_data *)ctsio->kern_data_ptr; ctsio->kern_sg_entries = 0; From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 07:32:34 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2FEB0F90; Mon, 20 Oct 2014 07:32:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 110F48A5; Mon, 20 Oct 2014 07:32:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K7WXqM073544; Mon, 20 Oct 2014 07:32:33 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K7WX6u073542; Mon, 20 Oct 2014 07:32:33 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410200732.s9K7WX6u073542@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 20 Oct 2014 07:32:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273310 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 07:32:34 -0000 Author: mav Date: Mon Oct 20 07:32:33 2014 New Revision: 273310 URL: https://svnweb.freebsd.org/changeset/base/273310 Log: MFC r272613: Add support for MaxBurstLength and Expected Data transfer Length parameters. Before this change target could send R2T request for write transfer of any size, that could violate iSCSI RFC, which allows initiator to limit maximum R2T size by negotiating MaxBurstLength connection parameter. Also report an error in case of write underflow, when initiator provides less data than initiator expects. Previously in such case our target sent R2T request for non-existing data, violating the RFC, and confusing some initiators. SCSI specs don't explicitly define how write underflows should be handled and there are different oppinions, but reporting error is hopefully better then violating iSCSI RFC with unpredictable results. Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c stable/10/sys/cam/ctl/ctl_frontend_iscsi.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_frontend_iscsi.c Mon Oct 20 07:31:23 2014 (r273309) +++ stable/10/sys/cam/ctl/ctl_frontend_iscsi.c Mon Oct 20 07:32:33 2014 (r273310) @@ -158,6 +158,8 @@ static uint32_t cfiscsi_lun_map(void *ar static int cfiscsi_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td); static void cfiscsi_datamove(union ctl_io *io); +static void cfiscsi_datamove_in(union ctl_io *io); +static void cfiscsi_datamove_out(union ctl_io *io); static void cfiscsi_done(union ctl_io *io); static bool cfiscsi_pdu_update_cmdsn(const struct icl_pdu *request); static void cfiscsi_pdu_handle_nop_out(struct icl_pdu *request); @@ -828,7 +830,7 @@ cfiscsi_handle_data_segment(struct icl_p return (true); } - if (io->scsiio.ext_data_filled == io->scsiio.kern_data_len && + if (io->scsiio.ext_data_filled == cdw->cdw_r2t_end && (bhsdo->bhsdo_flags & BHSDO_FLAGS_F) == 0) { CFISCSI_SESSION_WARN(cs, "got the final packet without " "the F flag; flags = 0x%x; dropping connection", @@ -838,7 +840,7 @@ cfiscsi_handle_data_segment(struct icl_p return (true); } - if (io->scsiio.ext_data_filled != io->scsiio.kern_data_len && + if (io->scsiio.ext_data_filled != cdw->cdw_r2t_end && (bhsdo->bhsdo_flags & BHSDO_FLAGS_F) != 0) { if ((request->ip_bhs->bhs_opcode & ~ISCSI_BHS_OPCODE_IMMEDIATE) == ISCSI_BHS_OPCODE_SCSI_DATA_OUT) { @@ -846,7 +848,7 @@ cfiscsi_handle_data_segment(struct icl_p "transmitted size was %zd bytes instead of %d; " "dropping connection", (size_t)io->scsiio.ext_data_filled, - io->scsiio.kern_data_len); + cdw->cdw_r2t_end); ctl_set_data_phase_error(&io->scsiio); cfiscsi_session_terminate(cs); return (true); @@ -859,7 +861,7 @@ cfiscsi_handle_data_segment(struct icl_p } } - if (io->scsiio.ext_data_filled == io->scsiio.kern_data_len) { + if (io->scsiio.ext_data_filled == cdw->cdw_r2t_end) { #if 0 CFISCSI_SESSION_DEBUG(cs, "no longer expecting Data-Out with target " "transfer tag 0x%x", cdw->cdw_target_transfer_tag); @@ -915,8 +917,13 @@ cfiscsi_pdu_handle_data_out(struct icl_p CFISCSI_SESSION_LOCK(cs); TAILQ_REMOVE(&cs->cs_waiting_for_data_out, cdw, cdw_next); CFISCSI_SESSION_UNLOCK(cs); + done = (io->scsiio.ext_data_filled != cdw->cdw_r2t_end || + io->scsiio.ext_data_filled == io->scsiio.kern_data_len); uma_zfree(cfiscsi_data_wait_zone, cdw); - io->scsiio.be_move_done(io); + if (done) + io->scsiio.be_move_done(io); + else + cfiscsi_datamove_out(io); } icl_pdu_free(request); @@ -2571,6 +2578,8 @@ cfiscsi_datamove_out(union ctl_io *io) const struct iscsi_bhs_scsi_command *bhssc; struct iscsi_bhs_r2t *bhsr2t; struct cfiscsi_data_wait *cdw; + struct ctl_sg_entry ctl_sg_entry, *ctl_sglist; + uint32_t expected_len, r2t_off, r2t_len; uint32_t target_transfer_tag; bool done; @@ -2589,9 +2598,16 @@ cfiscsi_datamove_out(union ctl_io *io) PDU_TOTAL_TRANSFER_LEN(request) = io->scsiio.kern_total_len; /* - * We hadn't received anything during this datamove yet. + * Report write underflow as error since CTL and backends don't + * really support it, and SCSI does not tell how to do it right. */ - io->scsiio.ext_data_filled = 0; + expected_len = ntohl(bhssc->bhssc_expected_data_transfer_length); + if (io->scsiio.kern_rel_offset + io->scsiio.kern_data_len > + expected_len) { + io->scsiio.io_hdr.port_status = 43; + io->scsiio.be_move_done(io); + return; + } target_transfer_tag = atomic_fetchadd_32(&cs->cs_target_transfer_tag, 1); @@ -2613,8 +2629,35 @@ cfiscsi_datamove_out(union ctl_io *io) cdw->cdw_ctl_io = io; cdw->cdw_target_transfer_tag = target_transfer_tag; cdw->cdw_initiator_task_tag = bhssc->bhssc_initiator_task_tag; + cdw->cdw_r2t_end = io->scsiio.kern_data_len; + + /* Set initial data pointer for the CDW respecting ext_data_filled. */ + if (io->scsiio.kern_sg_entries > 0) { + ctl_sglist = (struct ctl_sg_entry *)io->scsiio.kern_data_ptr; + } else { + ctl_sglist = &ctl_sg_entry; + ctl_sglist->addr = io->scsiio.kern_data_ptr; + ctl_sglist->len = io->scsiio.kern_data_len; + } + cdw->cdw_sg_index = 0; + cdw->cdw_sg_addr = ctl_sglist[cdw->cdw_sg_index].addr; + cdw->cdw_sg_len = ctl_sglist[cdw->cdw_sg_index].len; + r2t_off = io->scsiio.ext_data_filled; + while (r2t_off > 0) { + if (r2t_off >= cdw->cdw_sg_len) { + r2t_off -= cdw->cdw_sg_len; + cdw->cdw_sg_index++; + cdw->cdw_sg_addr = ctl_sglist[cdw->cdw_sg_index].addr; + cdw->cdw_sg_len = ctl_sglist[cdw->cdw_sg_index].len; + continue; + } + cdw->cdw_sg_addr += r2t_off; + cdw->cdw_sg_len -= r2t_off; + r2t_off = 0; + } - if (cs->cs_immediate_data && io->scsiio.kern_rel_offset < + if (cs->cs_immediate_data && + io->scsiio.kern_rel_offset + io->scsiio.ext_data_filled < icl_pdu_data_segment_length(request)) { done = cfiscsi_handle_data_segment(request, cdw); if (done) { @@ -2624,6 +2667,11 @@ cfiscsi_datamove_out(union ctl_io *io) } } + r2t_off = io->scsiio.kern_rel_offset + io->scsiio.ext_data_filled; + r2t_len = MIN(io->scsiio.kern_data_len - io->scsiio.ext_data_filled, + cs->cs_max_burst_length); + cdw->cdw_r2t_end = io->scsiio.ext_data_filled + r2t_len; + CFISCSI_SESSION_LOCK(cs); TAILQ_INSERT_TAIL(&cs->cs_waiting_for_data_out, cdw, cdw_next); CFISCSI_SESSION_UNLOCK(cs); @@ -2663,16 +2711,13 @@ cfiscsi_datamove_out(union ctl_io *io) * The ext_data_filled is to account for unsolicited * (immediate) data that might have already arrived. */ - bhsr2t->bhsr2t_buffer_offset = - htonl(io->scsiio.kern_rel_offset + io->scsiio.ext_data_filled); + bhsr2t->bhsr2t_buffer_offset = htonl(r2t_off); /* * This is the total length (sum of S/G lengths) this call - * to cfiscsi_datamove() is supposed to handle. - * - * XXX: Limit it to MaxBurstLength. + * to cfiscsi_datamove() is supposed to handle, limited by + * MaxBurstLength. */ - bhsr2t->bhsr2t_desired_data_transfer_length = - htonl(io->scsiio.kern_data_len - io->scsiio.ext_data_filled); + bhsr2t->bhsr2t_desired_data_transfer_length = htonl(r2t_len); cfiscsi_pdu_queue(response); } @@ -2682,8 +2727,11 @@ cfiscsi_datamove(union ctl_io *io) if ((io->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_IN) cfiscsi_datamove_in(io); - else + else { + /* We hadn't received anything during this datamove yet. */ + io->scsiio.ext_data_filled = 0; cfiscsi_datamove_out(io); + } } static void Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_frontend_iscsi.h Mon Oct 20 07:31:23 2014 (r273309) +++ stable/10/sys/cam/ctl/ctl_frontend_iscsi.h Mon Oct 20 07:32:33 2014 (r273310) @@ -56,6 +56,7 @@ struct cfiscsi_data_wait { int cdw_sg_index; char *cdw_sg_addr; size_t cdw_sg_len; + uint32_t cdw_r2t_end; }; #define CFISCSI_SESSION_STATE_INVALID 0 From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 07:33:04 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 85F6F221; Mon, 20 Oct 2014 07:33:04 +0000 (UTC) Received: from mail.allbsd.org (gatekeeper.allbsd.org [IPv6:2001:2f0:104:e001::32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.allbsd.org", Issuer "RapidSSL CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B6B098AC; Mon, 20 Oct 2014 07:33:02 +0000 (UTC) Received: from alph.d.allbsd.org ([IPv6:2001:2f0:104:e010:862b:2bff:febc:8956]) (authenticated bits=56) by mail.allbsd.org (8.14.9/8.14.8) with ESMTP id s9K7WdPF007750 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 20 Oct 2014 16:32:50 +0900 (JST) (envelope-from hrs@FreeBSD.org) Received: from localhost (localhost [IPv6:::1]) (authenticated bits=0) by alph.d.allbsd.org (8.14.8/8.14.8) with ESMTP id s9K7WcQA094172; Mon, 20 Oct 2014 16:32:39 +0900 (JST) (envelope-from hrs@FreeBSD.org) Date: Mon, 20 Oct 2014 16:29:07 +0900 (JST) Message-Id: <20141020.162907.106891462107570268.hrs@allbsd.org> To: brde@optusnet.com.au Subject: Re: svn commit: r273295 - in head/sbin: ping ping6 From: Hiroki Sato In-Reply-To: <20141020140848.D935@besplex.bde.org> References: <201410200027.s9K0RegN062458@svn.freebsd.org> <20141020140848.D935@besplex.bde.org> X-PGPkey-fingerprint: BDB3 443F A5DD B3D0 A530 FFD7 4F2C D3D8 2793 CF2D X-Mailer: Mew version 6.6 on Emacs 24.3 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Multipart/Signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="--Security_Multipart0(Mon_Oct_20_16_29_08_2014_920)--" Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.97.4 at gatekeeper.allbsd.org X-Virus-Status: Clean X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (mail.allbsd.org [IPv6:2001:2f0:104:e001::32]); Mon, 20 Oct 2014 16:32:56 +0900 (JST) X-Spam-Status: No, score=-97.8 required=13.0 tests=CONTENT_TYPE_PRESENT, RDNS_NONE,SPF_SOFTFAIL,T_FRT_STOCK2,USER_IN_WHITELIST autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on gatekeeper.allbsd.org Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 07:33:04 -0000 ----Security_Multipart0(Mon_Oct_20_16_29_08_2014_920)-- Content-Type: Multipart/Mixed; boundary="--Next_Part(Mon_Oct_20_16_29_07_2014_483)--" Content-Transfer-Encoding: 7bit ----Next_Part(Mon_Oct_20_16_29_07_2014_483)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi Bruce, Thank you for your review. I fixed lines you pointed out and attached a patch candidate. I will show each change line by line in this email, too: Bruce Evans wrote in <20141020140848.D935@besplex.bde.org>: br> > - if (cc - ICMP_MINLEN - phdr_len >= sizeof(tv1)) { br> > + if ((size_t)(cc - ICMP_MINLEN - phdr_len) >= br> > + sizeof(tv1)) { br> > /* Copy to avoid alignment problems: */ br> > memcpy(&tv32, tp, sizeof(tv32)); br> > tv1.tv_sec = ntohl(tv32.tv32_sec); br> br> This breaks the warning, and breaks the code on exotic (unsupported) br> where it used to work accidentally. The code was already broken on br> non-exotic arches. - if ((size_t)(cc - ICMP_MINLEN - phdr_len) >= - sizeof(tv1)) { + if (cc - ICMP_MINLEN - phdr_len >= (int)sizeof(tv1)) { br> > -struct sockaddr_in6 dst; /* who to ping6 */ br> > -struct sockaddr_in6 src; /* src addr of this packet */ br> > -socklen_t srclen; br> br> Old code like ping uses plain int for almost everything except where br> the broken ABI requires an unsigned type like socklen_t. -static socklen_t srclen; -static size_t datalen = DEFDATALEN; +static int srclen; +static int datalen = DEFDATALEN; br> > +static u_int8_t nonce[8]; /* nonce field for node information */ br> br> This uses the deprecated nonstandard spelling of uint8_t. s/u_int_{8,16,32}_t/uint_{8,16,32}_t/ in various places. br> > -void pr_suptypes(struct icmp6_nodeinfo *, size_t); s/size_t/int/ br> > - sockbufsize = lsockbufsize; br> > + sockbufsize = (int)lsockbufsize; br> > if (errno || !*optarg || *e || br> > - sockbufsize != lsockbufsize) br> > + lsockbufsize > INT_MAX) br> > errx(1, "invalid socket buffer size"); br> I don't like warnings about hackish but correct code like the previous br> version of the above. Does the compiler actually complain about br> comparing br> ints with unsigned longs for equality? Yes, this part caused the following warning: /usr/src/head/sbin/ping6/ping6.c:395:20: error: comparison of integers of different signs: 'int' and 'u_long' (aka 'unsigned long') [-Werror,-Wsign-compare] sockbufsize != lsockbufsize) br> If you are going to change the range check, then rearrange the code. br> It br> was arranged to set sockbufsize before the value is known to fit so br> that br> non-fitting values can be checked. With range checking on the br> br> original br> value, it is more natural to not do the assignment until after the br> check has passed. Then the cast should be unnecessary since a smart br> compiler would see from the range check that the assignment can't br> overflow. - lsockbufsize = strtoul(optarg, &e, 10); - sockbufsize = (int)lsockbufsize; - if (errno || !*optarg || *e || - lsockbufsize > INT_MAX) + ultmp = strtoul(optarg, &e, 10); + if (errno || !*optarg || *e || ultmp > INT_MAX) errx(1, "invalid socket buffer size"); + sockbufsize = ultmp; br> > - if (l >= sizeof(cresult) || l < 0) br> > + if ((size_t)l >= sizeof(cresult) || l < 0) br> br> The conversion is backwards. br> - if ((size_t)l >= sizeof(cresult) || l < 0) + if (l >= (int)sizeof(cresult) || l < 0) br> > - if (end - (u_char *)ip6 < sizeof(*ip6)) { br> > + if ((size_t)(end - (u_char *)ip6) < sizeof(*ip6)) { br> > printf("IP6"); br> > goto trunc; br> > } br> br> Backwards. The RHS should be cast to ptrdiff_t. Pointer difference br> are only required to work up to 64K, but that is enough for the size br> of small objects. - if ((size_t)(end - (u_char *)ip6) < sizeof(*ip6)) { + if (end - (u_char *)ip6 < (ptrdiff_t)sizeof(*ip6)) { br> > - kk <= MAXDATALEN - (8 + sizeof(struct tv32) + ii); br> > + (size_t)kk <= MAXDATALEN - 8 + sizeof(struct tv32) + ii; - (size_t)kk <= MAXDATALEN - 8 + sizeof(struct tv32) + ii; + kk <= MAXDATALEN - 8 + (int)sizeof(struct tv32) + ii; -- Hiroki ----Next_Part(Mon_Oct_20_16_29_07_2014_483)-- Content-Type: Text/X-Patch; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="ping6.c_20141020-1.diff" Index: ping6.c =================================================================== --- ping6.c (revision 273295) +++ ping6.c (working copy) @@ -122,6 +122,7 @@ #include #include #include +#include #include #include #include @@ -136,8 +137,8 @@ #include struct tv32 { - u_int32_t tv32_sec; - u_int32_t tv32_usec; + uint32_t tv32_sec; + uint32_t tv32_usec; }; #define MAXPACKETLEN 131072 @@ -210,8 +211,8 @@ static struct sockaddr_in6 dst; /* who to ping6 */ static struct sockaddr_in6 src; /* src addr of this packet */ -static socklen_t srclen; -static size_t datalen = DEFDATALEN; +static int srclen; +static int datalen = DEFDATALEN; static int s; /* socket file descriptor */ static u_char outpack[MAXPACKETLEN]; static char BSPACE = '\b'; /* characters written for flood */ @@ -219,7 +220,7 @@ static char DOT = '.'; static char *hostname; static int ident; /* process id to identify our packets */ -static u_int8_t nonce[8]; /* nonce field for node information */ +static u_char nonce[8]; /* nonce field for node information */ static int hoplimit = -1; /* hoplimit */ static u_char *packet = NULL; @@ -265,17 +266,17 @@ static const char *pr_addr(struct sockaddr *, int); static void pr_icmph(struct icmp6_hdr *, u_char *); static void pr_iph(struct ip6_hdr *); -static void pr_suptypes(struct icmp6_nodeinfo *, size_t); +static void pr_suptypes(struct icmp6_nodeinfo *, int); static void pr_nodeaddr(struct icmp6_nodeinfo *, int); static int myechoreply(const struct icmp6_hdr *); static int mynireply(const struct icmp6_nodeinfo *); static char *dnsdecode(const u_char **, const u_char *, const u_char *, - char *, size_t); + char *, int); static void pr_pack(u_char *, int, struct msghdr *); static void pr_exthdrs(struct msghdr *); -static void pr_ip6opt(void *, size_t); -static void pr_rthdr(void *, size_t); -static int pr_bitrange(u_int32_t, int, int); +static void pr_ip6opt(void *, int); +static void pr_rthdr(void *, int); +static int pr_bitrange(uint32_t, int, int); static void pr_retip(struct ip6_hdr *, u_char *); static void summary(void); static void tvsub(struct timeval *, struct timeval *); @@ -303,7 +304,6 @@ /* For control (ancillary) data received from recvmsg() */ struct cmsghdr cm[CONTROLLEN]; #if defined(SO_SNDBUF) && defined(SO_RCVBUF) - u_long lsockbufsize; int sockbufsize = 0; #endif int usepktinfo = 0; @@ -316,7 +316,7 @@ char *policy_out = NULL; #endif double t; - u_long alarmtimeout; + u_long alarmtimeout, ultmp; size_t rthlen; #ifdef IPV6_USE_MIN_MTU int mflag = 0; @@ -388,11 +388,10 @@ #if defined(SO_SNDBUF) && defined(SO_RCVBUF) errno = 0; e = NULL; - lsockbufsize = strtoul(optarg, &e, 10); - sockbufsize = (int)lsockbufsize; - if (errno || !*optarg || *e || - lsockbufsize > INT_MAX) + ultmp = strtoul(optarg, &e, 10); + if (errno || !*optarg || *e || ultmp > INT_MAX) errx(1, "invalid socket buffer size"); + sockbufsize = ultmp; #else errx(1, "-b option ignored: SO_SNDBUF/SO_RCVBUF socket options not supported"); @@ -522,14 +521,15 @@ options |= F_SRCADDR; break; case 's': /* size of packet to send */ - datalen = strtol(optarg, &e, 10); - if (datalen <= 0 || *optarg == '\0' || *e != '\0') - errx(1, "illegal datalen value -- %s", optarg); - if (datalen > MAXDATALEN) { - errx(1, - "datalen value too large, maximum is %d", + ultmp = strtoul(optarg, &e, 10); + if (*e || e == optarg) + errx(EX_USAGE, "invalid packet size: `%s'", + optarg); + if (ultmp > MAXDATALEN) + errx(EX_USAGE, + "packetsize too large, maximum is %d", MAXDATALEN); - } + datalen = ultmp; break; case 't': options &= ~F_NOUSERDATA; @@ -718,7 +718,7 @@ errx(1, "-f and -i incompatible options"); if ((options & F_NOUSERDATA) == 0) { - if (datalen >= sizeof(struct tv32)) { + if (datalen >= (int)sizeof(struct tv32)) { /* we can time transfer */ timing = 1; } else @@ -746,12 +746,12 @@ gettimeofday(&seed, NULL); srand((unsigned int)(seed.tv_sec ^ seed.tv_usec ^ (long)ident)); memset(nonce, 0, sizeof(nonce)); - for (i = 0; i < sizeof(nonce); i += sizeof(int)) + for (i = 0; i < (int)sizeof(nonce); i += sizeof(int)) *((int *)&nonce[i]) = rand(); #else memset(nonce, 0, sizeof(nonce)); - for (i = 0; i < (int)sizeof(nonce); i += sizeof(u_int32_t)) - *((u_int32_t *)&nonce[i]) = arc4random(); + for (i = 0; i < (int)sizeof(nonce); i += sizeof(uint32_t)) + *((uint32_t *)&nonce[i]) = arc4random(); #endif optval = 1; if (options & F_DONTFRAG) @@ -1008,7 +1008,7 @@ #if defined(SO_SNDBUF) && defined(SO_RCVBUF) if (sockbufsize) { - if (datalen > (size_t)sockbufsize) + if (datalen > sockbufsize) warnx("you need -b to increase socket buffer size"); if (setsockopt(s, SOL_SOCKET, SO_SNDBUF, &sockbufsize, sizeof(sockbufsize)) < 0) @@ -1292,7 +1292,7 @@ memcpy(nip->icmp6_ni_nonce, nonce, sizeof(nip->icmp6_ni_nonce)); - *(u_int16_t *)nip->icmp6_ni_nonce = ntohs(seq); + *(uint16_t *)nip->icmp6_ni_nonce = ntohs(seq); memcpy(&outpack[ICMP6_NIQLEN], &dst.sin6_addr, sizeof(dst.sin6_addr)); @@ -1307,7 +1307,7 @@ memcpy(nip->icmp6_ni_nonce, nonce, sizeof(nip->icmp6_ni_nonce)); - *(u_int16_t *)nip->icmp6_ni_nonce = ntohs(seq); + *(uint16_t *)nip->icmp6_ni_nonce = ntohs(seq); cc = ICMP6_NIQLEN; datalen = 0; @@ -1319,7 +1319,7 @@ memcpy(nip->icmp6_ni_nonce, nonce, sizeof(nip->icmp6_ni_nonce)); - *(u_int16_t *)nip->icmp6_ni_nonce = ntohs(seq); + *(uint16_t *)nip->icmp6_ni_nonce = ntohs(seq); memcpy(&outpack[ICMP6_NIQLEN], &dst.sin6_addr, sizeof(dst.sin6_addr)); @@ -1334,7 +1334,7 @@ memcpy(nip->icmp6_ni_nonce, nonce, sizeof(nip->icmp6_ni_nonce)); - *(u_int16_t *)nip->icmp6_ni_nonce = ntohs(seq); + *(uint16_t *)nip->icmp6_ni_nonce = ntohs(seq); cc = ICMP6_NIQLEN; datalen = 0; } else { @@ -1392,9 +1392,9 @@ static int mynireply(const struct icmp6_nodeinfo *nip) { - if (memcmp(nip->icmp6_ni_nonce + sizeof(u_int16_t), - nonce + sizeof(u_int16_t), - sizeof(nonce) - sizeof(u_int16_t)) == 0) + if (memcmp(nip->icmp6_ni_nonce + sizeof(uint16_t), + nonce + sizeof(uint16_t), + sizeof(nonce) - sizeof(uint16_t)) == 0) return 1; else return 0; @@ -1402,7 +1402,7 @@ static char * dnsdecode(const u_char **sp, const u_char *ep, const u_char *base, char *buf, - size_t bufsiz) + int bufsiz) /*base for compressed name*/ { int i; @@ -1419,7 +1419,7 @@ while (cp < ep) { i = *cp; if (i == 0 || cp != *sp) { - if (strlcat((char *)buf, ".", bufsiz) >= bufsiz) + if ((int)strlcat((char *)buf, ".", bufsiz) >= bufsiz) return NULL; /*result overrun*/ } if (i == 0) @@ -1435,7 +1435,7 @@ if (dnsdecode(&comp, cp, base, cresult, sizeof(cresult)) == NULL) return NULL; - if (strlcat(buf, cresult, bufsiz) >= bufsiz) + if ((int)strlcat(buf, cresult, bufsiz) >= bufsiz) return NULL; /*result overrun*/ break; } else if ((i & 0x3f) == i) { @@ -1444,9 +1444,10 @@ while (i-- > 0 && cp < ep) { l = snprintf(cresult, sizeof(cresult), isprint(*cp) ? "%c" : "\\%03o", *cp & 0xff); - if ((size_t)l >= sizeof(cresult) || l < 0) + if (l >= (int)sizeof(cresult) || l < 0) return NULL; - if (strlcat(buf, cresult, bufsiz) >= bufsiz) + if ((int)strlcat(buf, cresult, bufsiz) >= + bufsiz) return NULL; /*result overrun*/ cp++; } @@ -1485,7 +1486,7 @@ int dupflag; size_t off; int oldfqdn; - u_int16_t seq; + uint16_t seq; char dnsname[MAXDNAME + 1]; (void)gettimeofday(&tv, NULL); @@ -1591,7 +1592,7 @@ } } } else if (icp->icmp6_type == ICMP6_NI_REPLY && mynireply(ni)) { - seq = ntohs(*(u_int16_t *)ni->icmp6_ni_nonce); + seq = ntohs(*(uint16_t *)ni->icmp6_ni_nonce); ++nreceived; if (TST(seq % mx_dup_ck)) { ++nrepeats; @@ -1792,16 +1793,16 @@ #ifdef USE_RFC2292BIS static void -pr_ip6opt(void *extbuf, size_t bufsize) +pr_ip6opt(void *extbuf, int bufsize) { struct ip6_hbh *ext; int currentlen; - u_int8_t type; + u_char type; socklen_t extlen, len; void *databuf; size_t offset; - u_int16_t value2; - u_int32_t value4; + uint16_t value2; + uint32_t value4; ext = (struct ip6_hbh *)extbuf; extlen = (ext->ip6h_len + 1) * 8; @@ -1812,7 +1813,7 @@ * Bounds checking on the ancillary data buffer: * subtract the size of a cmsg structure from the buffer size. */ - if (bufsize < (extlen + CMSG_SPACE(0))) { + if (bufsize < (int)(extlen + CMSG_SPACE(0))) { extlen = bufsize - CMSG_SPACE(0); warnx("options truncated, showing only %u (total=%u)", (unsigned int)(extlen / 8 - 1), @@ -1835,7 +1836,7 @@ offset = inet6_opt_get_val(databuf, offset, &value4, sizeof(value4)); printf(" Jumbo Payload Opt: Length %u\n", - (u_int32_t)ntohl(value4)); + (uint32_t)ntohl(value4)); break; case IP6OPT_ROUTER_ALERT: offset = 0; @@ -1864,7 +1865,7 @@ #ifdef USE_RFC2292BIS static void -pr_rthdr(void *extbuf, size_t bufsize) +pr_rthdr(void *extbuf, int bufsize) { struct in6_addr *in6; char ntopbuf[INET6_ADDRSTRLEN]; @@ -1892,7 +1893,7 @@ * dividend is not evenly divisible by the divisor */ rthsize = (rh->ip6r_len + 1) * 8; - if (bufsize < (rthsize + CMSG_SPACE(0))) { + if (bufsize < (int)(rthsize + CMSG_SPACE(0))) { origsegs = segments; size0 = inet6_rth_space(IPV6_RTHDR_TYPE_0, 0); size1 = inet6_rth_space(IPV6_RTHDR_TYPE_0, 1); @@ -1929,7 +1930,7 @@ #endif /* USE_RFC2292BIS */ static int -pr_bitrange(u_int32_t v, int soff, int ii) +pr_bitrange(uint32_t v, int soff, int ii) { int off; int i; @@ -1975,16 +1976,16 @@ } static void -pr_suptypes(struct icmp6_nodeinfo *ni, size_t nilen) +pr_suptypes(struct icmp6_nodeinfo *ni, int nilen) /* ni->qtype must be SUPTYPES */ { size_t clen; - u_int32_t v; + uint32_t v; const u_char *cp, *end; - u_int16_t cur; + uint16_t cur; struct cbit { - u_int16_t words; /*32bit count*/ - u_int16_t skip; + uint16_t words; /*32bit count*/ + uint16_t skip; } cbit; #define MAXQTYPES (1 << 16) size_t off; @@ -2027,7 +2028,7 @@ for (off = 0; off < clen; off += sizeof(v)) { memcpy(&v, cp + off, sizeof(v)); - v = (u_int32_t)ntohl(v); + v = (uint32_t)ntohl(v); b = pr_bitrange(v, (int)(cur + off * 8), b); } /* flush the remaining bits */ @@ -2072,16 +2073,16 @@ * by the length of the data, but note that the detection algorithm * is incomplete. We assume the latest draft by default. */ - if (nilen % (sizeof(u_int32_t) + sizeof(struct in6_addr)) == 0) + if (nilen % (sizeof(uint32_t) + sizeof(struct in6_addr)) == 0) withttl = 1; while (nilen > 0) { - u_int32_t ttl; + uint32_t ttl; if (withttl) { /* XXX: alignment? */ - ttl = (u_int32_t)ntohl(*(u_int32_t *)cp); - cp += sizeof(u_int32_t); - nilen -= sizeof(u_int32_t); + ttl = (uint32_t)ntohl(*(uint32_t *)cp); + cp += sizeof(uint32_t); + nilen -= sizeof(uint32_t); } if (inet_ntop(AF_INET6, cp, ntop_buf, sizeof(ntop_buf)) == @@ -2358,7 +2359,7 @@ break; } (void)printf("pointer = 0x%02x\n", - (u_int32_t)ntohl(icp->icmp6_pptr)); + (uint32_t)ntohl(icp->icmp6_pptr)); pr_retip((struct ip6_hdr *)(icp + 1), end); break; case ICMP6_ECHO_REQUEST: @@ -2517,8 +2518,8 @@ static void pr_iph(struct ip6_hdr *ip6) { - u_int32_t flow = ip6->ip6_flow & IPV6_FLOWLABEL_MASK; - u_int8_t tc; + uint32_t flow = ip6->ip6_flow & IPV6_FLOWLABEL_MASK; + u_char tc; char ntop_buf[INET6_ADDRSTRLEN]; tc = *(&ip6->ip6_vfc + 1); /* XXX */ @@ -2527,7 +2528,7 @@ printf("Vr TC Flow Plen Nxt Hlim\n"); printf(" %1x %02x %05x %04x %02x %02x\n", - (ip6->ip6_vfc & IPV6_VERSION_MASK) >> 4, tc, (u_int32_t)ntohl(flow), + (ip6->ip6_vfc & IPV6_VERSION_MASK) >> 4, tc, (uint32_t)ntohl(flow), ntohs(ip6->ip6_plen), ip6->ip6_nxt, ip6->ip6_hlim); if (!inet_ntop(AF_INET6, &ip6->ip6_src, ntop_buf, sizeof(ntop_buf))) strlcpy(ntop_buf, "?", sizeof(ntop_buf)); @@ -2567,7 +2568,7 @@ u_char *cp = (u_char *)ip6, nh; int hlen; - if ((size_t)(end - (u_char *)ip6) < sizeof(*ip6)) { + if (end - (u_char *)ip6 < (ptrdiff_t)sizeof(*ip6)) { printf("IP6"); goto trunc; } @@ -2660,7 +2661,7 @@ /* xxx */ if (ii > 0) for (kk = 0; - (size_t)kk <= MAXDATALEN - 8 + sizeof(struct tv32) + ii; + kk <= MAXDATALEN - 8 + (int)sizeof(struct tv32) + ii; kk += ii) for (jj = 0; jj < ii; ++jj) bp[jj + kk] = pat[jj]; @@ -2701,8 +2702,8 @@ char *p; char *q; MD5_CTX ctxt; - u_int8_t digest[16]; - u_int8_t c; + u_char digest[16]; + u_char c; size_t l; char hbuf[NI_MAXHOST]; struct in6_addr in6; ----Next_Part(Mon_Oct_20_16_29_07_2014_483)-- Content-Type: Text/X-Patch; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="ping.c_20141020-1.diff" Index: ping.c =================================================================== --- ping.c (revision 273295) +++ ping.c (working copy) @@ -1150,8 +1150,7 @@ #endif tp = (const char *)tp + phdr_len; - if ((size_t)(cc - ICMP_MINLEN - phdr_len) >= - sizeof(tv1)) { + if (cc - ICMP_MINLEN - phdr_len >= (int)sizeof(tv1)) { /* Copy to avoid alignment problems: */ memcpy(&tv32, tp, sizeof(tv32)); tv1.tv_sec = ntohl(tv32.tv32_sec); ----Next_Part(Mon_Oct_20_16_29_07_2014_483)---- ----Security_Multipart0(Mon_Oct_20_16_29_08_2014_920)-- Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEABECAAYFAlREucQACgkQTyzT2CeTzy0jVgCdGyvQeygiqdT6YEwEeLjZNu3b vlQAn0B5WipasyJUBlhUvaN+KfxKpgE5 =KA1u -----END PGP SIGNATURE----- ----Security_Multipart0(Mon_Oct_20_16_29_08_2014_920)---- From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 07:33:43 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8E77437A; Mon, 20 Oct 2014 07:33:43 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6FCAA8BE; Mon, 20 Oct 2014 07:33:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K7Xh6A073872; Mon, 20 Oct 2014 07:33:43 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K7Xfi5073862; Mon, 20 Oct 2014 07:33:41 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410200733.s9K7Xfi5073862@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 20 Oct 2014 07:33:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273311 - in stable/10/sys/cam: ctl scsi X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 07:33:43 -0000 Author: mav Date: Mon Oct 20 07:33:41 2014 New Revision: 273311 URL: https://svnweb.freebsd.org/changeset/base/273311 Log: MFC r272734: Add support for WRITE ATOMIC (16) command and report SBC-4 compliance. Atomic writes are only supported for ZVOLs in "dev" mode. In other cases atomicity can not be guarantied and so the command is blocked. Modified: stable/10/sys/cam/ctl/ctl.c stable/10/sys/cam/ctl/ctl_backend.h stable/10/sys/cam/ctl/ctl_backend_block.c stable/10/sys/cam/ctl/ctl_backend_ramdisk.c stable/10/sys/cam/ctl/ctl_cmd_table.c stable/10/sys/cam/ctl/scsi_ctl.c stable/10/sys/cam/scsi/scsi_all.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Mon Oct 20 07:32:33 2014 (r273310) +++ stable/10/sys/cam/ctl/ctl.c Mon Oct 20 07:33:41 2014 (r273311) @@ -9128,6 +9128,31 @@ ctl_read_write(struct ctl_scsiio *ctsio) num_blocks = scsi_4btoul(cdb->length); break; } + case WRITE_ATOMIC_16: { + struct scsi_rw_16 *cdb; + + if (lun->be_lun->atomicblock == 0) { + ctl_set_invalid_opcode(ctsio); + ctl_done((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); + } + + cdb = (struct scsi_rw_16 *)ctsio->cdb; + if (cdb->byte2 & SRW12_FUA) + flags |= CTL_LLF_FUA; + if (cdb->byte2 & SRW12_DPO) + flags |= CTL_LLF_DPO; + lba = scsi_8btou64(cdb->addr); + num_blocks = scsi_4btoul(cdb->length); + if (num_blocks > lun->be_lun->atomicblock) { + ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, + /*command*/ 1, /*field*/ 12, /*bit_valid*/ 0, + /*bit*/ 0); + ctl_done((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); + } + break; + } case WRITE_VERIFY_16: { struct scsi_write_verify_16 *cdb; @@ -10301,6 +10326,10 @@ ctl_inquiry_evpd_block_limits(struct ctl bl_ptr->unmap_grain_align); } } + scsi_ulto4b(lun->be_lun->atomicblock, + bl_ptr->max_atomic_transfer_length); + scsi_ulto4b(0, bl_ptr->atomic_alignment); + scsi_ulto4b(0, bl_ptr->atomic_transfer_length_granularity); } scsi_u64to8b(UINT64_MAX, bl_ptr->max_write_same_length); @@ -10696,13 +10725,13 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio } if (lun == NULL) { - /* SBC-3 (no version claimed) */ - scsi_ulto2b(0x04C0, inq_ptr->version4); + /* SBC-4 (no version claimed) */ + scsi_ulto2b(0x0600, inq_ptr->version4); } else { switch (lun->be_lun->lun_type) { case T_DIRECT: - /* SBC-3 (no version claimed) */ - scsi_ulto2b(0x04C0, inq_ptr->version4); + /* SBC-4 (no version claimed) */ + scsi_ulto2b(0x0600, inq_ptr->version4); break; case T_PROCESSOR: default: @@ -10820,7 +10849,8 @@ ctl_get_lba_len(union ctl_io *io, uint64 break; } case READ_16: - case WRITE_16: { + case WRITE_16: + case WRITE_ATOMIC_16: { struct scsi_rw_16 *cdb; cdb = (struct scsi_rw_16 *)io->scsiio.cdb; @@ -10834,7 +10864,6 @@ ctl_get_lba_len(union ctl_io *io, uint64 cdb = (struct scsi_write_verify_16 *)io->scsiio.cdb; - *lba = scsi_8btou64(cdb->addr); *len = scsi_4btoul(cdb->length); break; Modified: stable/10/sys/cam/ctl/ctl_backend.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_backend.h Mon Oct 20 07:32:33 2014 (r273310) +++ stable/10/sys/cam/ctl/ctl_backend.h Mon Oct 20 07:33:41 2014 (r273311) @@ -144,6 +144,8 @@ typedef void (*be_lun_config_t)(void *be * * pblockoff is the lowest LBA on the LUN aligned ot physical sector. * + * atomicblock is the number of blocks that can be written atomically. + * * req_lun_id is the requested LUN ID. CTL only pays attention to this * field if the CTL_LUN_FLAG_ID_REQ flag is set. If the requested LUN ID is * not available, the LUN addition will fail. If a particular LUN ID isn't @@ -188,6 +190,7 @@ struct ctl_be_lun { uint32_t blocksize; /* passed to CTL */ uint16_t pblockexp; /* passed to CTL */ uint16_t pblockoff; /* passed to CTL */ + uint32_t atomicblock; /* passed to CTL */ uint32_t req_lun_id; /* passed to CTL */ uint32_t lun_id; /* returned from CTL */ uint8_t serial_num[CTL_SN_LEN]; /* passed to CTL */ Modified: stable/10/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_backend_block.c Mon Oct 20 07:32:33 2014 (r273310) +++ stable/10/sys/cam/ctl/ctl_backend_block.c Mon Oct 20 07:33:41 2014 (r273311) @@ -2006,6 +2006,9 @@ ctl_be_block_create(struct ctl_be_block_ be_lun->ctl_be_lun.flags = CTL_LUN_FLAG_PRIMARY; if (unmap) be_lun->ctl_be_lun.flags |= CTL_LUN_FLAG_UNMAP; + if (be_lun->dispatch == ctl_be_block_dispatch_zvol) + be_lun->ctl_be_lun.atomicblock = CTLBLK_MAX_IO_SIZE / + be_lun->blocksize; be_lun->ctl_be_lun.be_lun = be_lun; be_lun->ctl_be_lun.blocksize = be_lun->blocksize; be_lun->ctl_be_lun.pblockexp = be_lun->pblockexp; Modified: stable/10/sys/cam/ctl/ctl_backend_ramdisk.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_backend_ramdisk.c Mon Oct 20 07:32:33 2014 (r273310) +++ stable/10/sys/cam/ctl/ctl_backend_ramdisk.c Mon Oct 20 07:33:41 2014 (r273311) @@ -595,6 +595,7 @@ ctl_backend_ramdisk_create(struct ctl_be be_lun->ctl_be_lun.flags = CTL_LUN_FLAG_PRIMARY; if (unmap) be_lun->ctl_be_lun.flags |= CTL_LUN_FLAG_UNMAP; + be_lun->ctl_be_lun.atomicblock = UINT32_MAX; be_lun->ctl_be_lun.be_lun = be_lun; if (params->flags & CTL_LUN_FLAG_ID_REQ) { Modified: stable/10/sys/cam/ctl/ctl_cmd_table.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_cmd_table.c Mon Oct 20 07:32:33 2014 (r273310) +++ stable/10/sys/cam/ctl/ctl_cmd_table.c Mon Oct 20 07:33:41 2014 (r273311) @@ -1117,8 +1117,11 @@ const struct ctl_cmd_entry ctl_cmd_table /* 9B */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, -/* 9C */ -{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, +/* 9C WRITE ATOMIC (16) */ +{ctl_read_write, CTL_SERIDX_WRITE, CTL_CMD_FLAG_OK_ON_SLUN| CTL_FLAG_DATA_OUT, + CTL_LUN_PAT_WRITE | CTL_LUN_PAT_RANGE, + 16, {0x18, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0, 0, 0xff, 0xff, 0, 0x07}}, /* 9D */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, Modified: stable/10/sys/cam/ctl/scsi_ctl.c ============================================================================== --- stable/10/sys/cam/ctl/scsi_ctl.c Mon Oct 20 07:32:33 2014 (r273310) +++ stable/10/sys/cam/ctl/scsi_ctl.c Mon Oct 20 07:33:41 2014 (r273311) @@ -1115,6 +1115,7 @@ ctlfe_adjust_cdb(struct ccb_accept_tio * } case READ_16: case WRITE_16: + case WRITE_ATOMIC_16: { struct scsi_rw_16 *cdb = (struct scsi_rw_16 *)cmdbyt; lba = scsi_8btou64(cdb->addr); Modified: stable/10/sys/cam/scsi/scsi_all.h ============================================================================== --- stable/10/sys/cam/scsi/scsi_all.h Mon Oct 20 07:32:33 2014 (r273310) +++ stable/10/sys/cam/scsi/scsi_all.h Mon Oct 20 07:33:41 2014 (r273311) @@ -1720,6 +1720,7 @@ struct ata_pass_16 { #define VERIFY_16 0x8F #define SYNCHRONIZE_CACHE_16 0x91 #define WRITE_SAME_16 0x93 +#define WRITE_ATOMIC_16 0x9C #define SERVICE_ACTION_IN 0x9E #define REPORT_LUNS 0xA0 #define ATA_PASS_12 0xA1 @@ -2437,8 +2438,7 @@ struct scsi_vpd_logical_block_prov }; /* - * Block Limits VDP Page based on - * T10/1799-D Revision 31 + * Block Limits VDP Page based on SBC-4 Revision 2 */ struct scsi_vpd_block_limits { @@ -2459,7 +2459,10 @@ struct scsi_vpd_block_limits u_int8_t opt_unmap_grain[4]; u_int8_t unmap_grain_align[4]; u_int8_t max_write_same_length[8]; - u_int8_t reserved2[20]; + u_int8_t max_atomic_transfer_length[4]; + u_int8_t atomic_alignment[4]; + u_int8_t atomic_transfer_length_granularity[4]; + u_int8_t reserved2[8]; }; struct scsi_read_capacity From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 07:34:38 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 986714BA; Mon, 20 Oct 2014 07:34:38 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 79D1A8C9; Mon, 20 Oct 2014 07:34:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K7YcW9074057; Mon, 20 Oct 2014 07:34:38 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K7YbE7074051; Mon, 20 Oct 2014 07:34:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410200734.s9K7YbE7074051@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 20 Oct 2014 07:34:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273312 - in stable/10: sys/cam/ctl usr.sbin/ctladm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 07:34:38 -0000 Author: mav Date: Mon Oct 20 07:34:37 2014 New Revision: 273312 URL: https://svnweb.freebsd.org/changeset/base/273312 Log: MFC r272748: Implement software (mode page) and hardware (config) write protection. Modified: stable/10/sys/cam/ctl/ctl.c stable/10/sys/cam/ctl/ctl_private.h stable/10/usr.sbin/ctladm/ctladm.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Mon Oct 20 07:33:41 2014 (r273311) +++ stable/10/sys/cam/ctl/ctl.c Mon Oct 20 07:34:37 2014 (r273312) @@ -293,7 +293,7 @@ static struct scsi_control_page control_ /*page_length*/sizeof(struct scsi_control_page) - 2, /*rlec*/SCP_DSENSE, /*queue_flags*/SCP_QUEUE_ALG_MASK, - /*eca_and_aen*/0, + /*eca_and_aen*/SCP_SWP, /*flags4*/0, /*aen_holdoff_period*/{0, 0}, /*busy_timeout_period*/{0, 0}, @@ -4449,7 +4449,7 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft struct ctl_port *port; struct scsi_vpd_id_descriptor *desc; struct scsi_vpd_id_t10 *t10id; - const char *eui, *naa, *scsiname, *vendor; + const char *eui, *naa, *scsiname, *vendor, *value; int lun_number, i, lun_malloced; int devidlen, idlen1, idlen2 = 0, len; @@ -4611,6 +4611,10 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft if (be_lun->flags & CTL_LUN_FLAG_PRIMARY) lun->flags |= CTL_LUN_PRIMARY_SC; + value = ctl_get_opt(&be_lun->options, "readonly"); + if (value != NULL && strcmp(value, "on") == 0) + lun->flags |= CTL_LUN_READONLY; + lun->ctl_softc = ctl_softc; TAILQ_INIT(&lun->ooa_queue); TAILQ_INIT(&lun->blocked_queue); @@ -6221,6 +6225,14 @@ ctl_control_page_handler(struct ctl_scsi saved_cp->queue_flags |= user_cp->queue_flags & SCP_QUEUE_ALG_MASK; set_ua = 1; } + if ((current_cp->eca_and_aen & SCP_SWP) != + (user_cp->eca_and_aen & SCP_SWP)) { + current_cp->eca_and_aen &= ~SCP_SWP; + current_cp->eca_and_aen |= user_cp->eca_and_aen & SCP_SWP; + saved_cp->eca_and_aen &= ~SCP_SWP; + saved_cp->eca_and_aen |= user_cp->eca_and_aen & SCP_SWP; + set_ua = 1; + } if (set_ua != 0) { int i; /* @@ -7047,8 +7059,13 @@ ctl_mode_sense(struct ctl_scsiio *ctsio) header = (struct scsi_mode_hdr_6 *)ctsio->kern_data_ptr; header->datalen = ctl_min(total_len - 1, 254); - if (control_dev == 0) + if (control_dev == 0) { header->dev_specific = 0x10; /* DPOFUA */ + if ((lun->flags & CTL_LUN_READONLY) || + (lun->mode_pages.control_page[CTL_PAGE_CURRENT] + .eca_and_aen & SCP_SWP) != 0) + header->dev_specific |= 0x80; /* WP */ + } if (dbd) header->block_descr_len = 0; else @@ -7065,8 +7082,13 @@ ctl_mode_sense(struct ctl_scsiio *ctsio) datalen = ctl_min(total_len - 2, 65533); scsi_ulto2b(datalen, header->datalen); - if (control_dev == 0) + if (control_dev == 0) { header->dev_specific = 0x10; /* DPOFUA */ + if ((lun->flags & CTL_LUN_READONLY) || + (lun->mode_pages.control_page[CTL_PAGE_CURRENT] + .eca_and_aen & SCP_SWP) != 0) + header->dev_specific |= 0x80; /* WP */ + } if (dbd) scsi_ulto2b(0, header->block_descr_len); else @@ -11315,6 +11337,24 @@ ctl_scsiio_lun_check(struct ctl_softc *c } #endif + if (entry->pattern & CTL_LUN_PAT_WRITE) { + if (lun->flags & CTL_LUN_READONLY) { + ctl_set_sense(ctsio, /*current_error*/ 1, + /*sense_key*/ SSD_KEY_DATA_PROTECT, + /*asc*/ 0x27, /*ascq*/ 0x01, SSD_ELEM_NONE); + retval = 1; + goto bailout; + } + if ((lun->mode_pages.control_page[CTL_PAGE_CURRENT] + .eca_and_aen & SCP_SWP) != 0) { + ctl_set_sense(ctsio, /*current_error*/ 1, + /*sense_key*/ SSD_KEY_DATA_PROTECT, + /*asc*/ 0x27, /*ascq*/ 0x02, SSD_ELEM_NONE); + retval = 1; + goto bailout; + } + } + /* * Check for a reservation conflict. If this command isn't allowed * even on reserved LUNs, and if this initiator isn't the one who Modified: stable/10/sys/cam/ctl/ctl_private.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_private.h Mon Oct 20 07:33:41 2014 (r273311) +++ stable/10/sys/cam/ctl/ctl_private.h Mon Oct 20 07:34:37 2014 (r273312) @@ -198,7 +198,8 @@ typedef enum { CTL_LUN_OFFLINE = 0x080, CTL_LUN_PR_RESERVED = 0x100, CTL_LUN_PRIMARY_SC = 0x200, - CTL_LUN_SENSE_DESC = 0x400 + CTL_LUN_SENSE_DESC = 0x400, + CTL_LUN_READONLY = 0x800 } ctl_lun_flags; typedef enum { Modified: stable/10/usr.sbin/ctladm/ctladm.8 ============================================================================== --- stable/10/usr.sbin/ctladm/ctladm.8 Mon Oct 20 07:33:41 2014 (r273311) +++ stable/10/usr.sbin/ctladm/ctladm.8 Mon Oct 20 07:34:37 2014 (r273312) @@ -34,7 +34,7 @@ .\" $Id: //depot/users/kenm/FreeBSD-test2/usr.sbin/ctladm/ctladm.8#3 $ .\" $FreeBSD$ .\" -.Dd September 13, 2014 +.Dd October 8, 2014 .Dt CTLADM 8 .Os .Sh NAME @@ -961,6 +961,9 @@ This allows to offload copying between d on the same host in trusted environments. .It Va readcache Set to "off", disables read caching for the LUN, if supported by the backend. +.It Va readonly +Set to "on", blocks all media write operations to the LUN, reporting it +as write protected. .It Va reordering Set to "unrestricted", allows target to process commands with SIMPLE task attribute in arbitrary order. Any data integrity exposures related to From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 07:35:48 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 18028603; Mon, 20 Oct 2014 07:35:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 037F98D3; Mon, 20 Oct 2014 07:35:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K7ZlOI074290; Mon, 20 Oct 2014 07:35:47 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K7Zlod074277; Mon, 20 Oct 2014 07:35:47 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410200735.s9K7Zlod074277@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 20 Oct 2014 07:35:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273313 - in stable/10/sys: cam/ctl dev/iscsi X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 07:35:48 -0000 Author: mav Date: Mon Oct 20 07:35:46 2014 New Revision: 273313 URL: https://svnweb.freebsd.org/changeset/base/273313 Log: MFC r272812: Make iSCSI connection close somewhat less aggressive. It allows to push out some final data from the send queue to the socket before its close. In particular, it increases chances for logout response to be delivered to the initiator. Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c stable/10/sys/dev/iscsi/icl.c stable/10/sys/dev/iscsi/icl.h stable/10/sys/dev/iscsi/iscsi.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_frontend_iscsi.c Mon Oct 20 07:34:37 2014 (r273312) +++ stable/10/sys/cam/ctl/ctl_frontend_iscsi.c Mon Oct 20 07:35:46 2014 (r273313) @@ -1139,7 +1139,6 @@ cfiscsi_maintenance_thread(void *arg) * that anymore. We might need to revisit that. */ callout_drain(&cs->cs_callout); - icl_conn_shutdown(cs->cs_conn); icl_conn_close(cs->cs_conn); /* Modified: stable/10/sys/dev/iscsi/icl.c ============================================================================== --- stable/10/sys/dev/iscsi/icl.c Mon Oct 20 07:34:37 2014 (r273312) +++ stable/10/sys/dev/iscsi/icl.c Mon Oct 20 07:35:46 2014 (r273313) @@ -877,8 +877,6 @@ icl_conn_send_pdus(struct icl_conn *ic, SOCKBUF_UNLOCK(&so->so_snd); while (!STAILQ_EMPTY(queue)) { - if (ic->ic_disconnecting) - return; request = STAILQ_FIRST(queue); size = icl_pdu_size(request); if (available < size) { @@ -975,11 +973,6 @@ icl_send_thread(void *arg) ic->ic_send_running = true; for (;;) { - if (ic->ic_disconnecting) { - //ICL_DEBUG("terminating"); - break; - } - for (;;) { /* * If the local queue is empty, populate it from @@ -1018,6 +1011,11 @@ icl_send_thread(void *arg) break; } + if (ic->ic_disconnecting) { + //ICL_DEBUG("terminating"); + break; + } + cv_wait(&ic->ic_send_cv, ic->ic_lock); } @@ -1301,21 +1299,6 @@ icl_conn_handoff(struct icl_conn *ic, in } void -icl_conn_shutdown(struct icl_conn *ic) -{ - ICL_CONN_LOCK_ASSERT_NOT(ic); - - ICL_CONN_LOCK(ic); - if (ic->ic_socket == NULL) { - ICL_CONN_UNLOCK(ic); - return; - } - ICL_CONN_UNLOCK(ic); - - soshutdown(ic->ic_socket, SHUT_RDWR); -} - -void icl_conn_close(struct icl_conn *ic) { struct icl_pdu *pdu; Modified: stable/10/sys/dev/iscsi/icl.h ============================================================================== --- stable/10/sys/dev/iscsi/icl.h Mon Oct 20 07:34:37 2014 (r273312) +++ stable/10/sys/dev/iscsi/icl.h Mon Oct 20 07:35:46 2014 (r273313) @@ -107,7 +107,6 @@ struct icl_conn { struct icl_conn *icl_conn_new(const char *name, struct mtx *lock); void icl_conn_free(struct icl_conn *ic); int icl_conn_handoff(struct icl_conn *ic, int fd); -void icl_conn_shutdown(struct icl_conn *ic); void icl_conn_close(struct icl_conn *ic); bool icl_conn_connected(struct icl_conn *ic); Modified: stable/10/sys/dev/iscsi/iscsi.c ============================================================================== --- stable/10/sys/dev/iscsi/iscsi.c Mon Oct 20 07:34:37 2014 (r273312) +++ stable/10/sys/dev/iscsi/iscsi.c Mon Oct 20 07:35:46 2014 (r273313) @@ -372,7 +372,6 @@ static void iscsi_maintenance_thread_reconnect(struct iscsi_session *is) { - icl_conn_shutdown(is->is_conn); icl_conn_close(is->is_conn); ISCSI_SESSION_LOCK(is); From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 07:38:37 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 18730856; Mon, 20 Oct 2014 07:38:37 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 038788F4; Mon, 20 Oct 2014 07:38:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K7caVT074671; Mon, 20 Oct 2014 07:38:36 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K7caw8074669; Mon, 20 Oct 2014 07:38:36 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410200738.s9K7caw8074669@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 20 Oct 2014 07:38:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273314 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 07:38:37 -0000 Author: mav Date: Mon Oct 20 07:38:36 2014 New Revision: 273314 URL: https://svnweb.freebsd.org/changeset/base/273314 Log: MFC r272893: Store persistent reservation keys as uint64_t instead of uint8_t[8]. This allows to simplify the code and save 512KB of RAM per LUN (8%) by removing no longer needed "registered" keys flags. Modified: stable/10/sys/cam/ctl/ctl.c stable/10/sys/cam/ctl/ctl_private.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Mon Oct 20 07:35:46 2014 (r273313) +++ stable/10/sys/cam/ctl/ctl.c Mon Oct 20 07:38:36 2014 (r273314) @@ -2992,12 +2992,11 @@ ctl_ioctl(struct cdev *dev, u_long cmd, for (j = 0; j < (CTL_MAX_PORTS * 2); j++) { for (k = 0; k < CTL_MAX_INIT_PER_PORT; k++){ idx = j * CTL_MAX_INIT_PER_PORT + k; - if (lun->per_res[idx].registered == 0) + if (lun->pr_keys[idx] == 0) continue; printf(" LUN %d port %d iid %d key " "%#jx\n", i, j, k, - (uintmax_t)scsi_8btou64( - lun->per_res[idx].res_key.key)); + (uintmax_t)lun->pr_keys[idx]); } } } @@ -5538,7 +5537,7 @@ ctl_start_stop(struct ctl_scsiio *ctsio) uint32_t residx; residx = ctl_get_resindex(&ctsio->io_hdr.nexus); - if (!lun->per_res[residx].registered + if (lun->pr_keys[residx] == 0 || (lun->pr_res_idx!=residx && lun->res_type < 4)) { ctl_set_reservation_conflict(ctsio); @@ -5829,7 +5828,7 @@ ctl_read_buffer(struct ctl_scsiio *ctsio && residx != lun->pr_res_idx) || ((lun->res_type == SPR_TYPE_EX_AC_RO || lun->res_type == SPR_TYPE_EX_AC_AR) - && !lun->per_res[residx].registered)) { + && lun->pr_keys[residx] == 0)) { ctl_set_reservation_conflict(ctsio); ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); @@ -6884,7 +6883,7 @@ ctl_mode_sense(struct ctl_scsiio *ctsio) && residx != lun->pr_res_idx) || ((lun->res_type == SPR_TYPE_EX_AC_RO || lun->res_type == SPR_TYPE_EX_AC_AR) - && !lun->per_res[residx].registered)) { + && lun->pr_keys[residx] == 0)) { ctl_set_reservation_conflict(ctsio); ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); @@ -7827,7 +7826,7 @@ retry: lun->pr_key_count, res_keys->header.length); for (i = 0, key_count = 0; i < 2*CTL_MAX_INITIATORS; i++) { - if (!lun->per_res[i].registered) + if (lun->pr_keys[i] == 0) continue; /* @@ -7853,10 +7852,8 @@ retry: key_count++; continue; } - memcpy(res_keys->keys[key_count].key, - lun->per_res[i].res_key.key, - ctl_min(sizeof(res_keys->keys[key_count].key), - sizeof(lun->per_res[i].res_key))); + scsi_u64to8b(lun->pr_keys[i], + res_keys->keys[key_count].key); key_count++; } break; @@ -7907,9 +7904,8 @@ retry: * is 0, since it doesn't really matter. */ if (lun->pr_res_idx != CTL_PR_ALL_REGISTRANTS) { - memcpy(res->data.reservation, - &lun->per_res[lun->pr_res_idx].res_key, - sizeof(struct scsi_per_res_key)); + scsi_u64to8b(lun->pr_keys[lun->pr_res_idx], + res->data.reservation); } res->data.scopetype = lun->res_type; break; @@ -7960,11 +7956,10 @@ retry: res_desc = &res_status->desc[0]; for (i = 0; i < 2*CTL_MAX_INITIATORS; i++) { - if (!lun->per_res[i].registered) + if (lun->pr_keys[i] == 0) continue; - memcpy(&res_desc->res_key, &lun->per_res[i].res_key.key, - sizeof(res_desc->res_key)); + scsi_u64to8b(lun->pr_keys[i], res_desc->res_key.key); if ((lun->flags & CTL_LUN_PR_RESERVED) && (lun->pr_res_idx == i || lun->pr_res_idx == CTL_PR_ALL_REGISTRANTS)) { @@ -8057,15 +8052,12 @@ ctl_pro_preempt(struct ctl_softc *softc, return (1); } - /* temporarily unregister this nexus */ - lun->per_res[residx].registered = 0; - /* * Unregister everybody else and build UA for * them */ for(i=0; i < 2*CTL_MAX_INITIATORS; i++) { - if (lun->per_res[i].registered == 0) + if (i == residx || lun->pr_keys[i] == 0) continue; if (!persis_offset @@ -8076,11 +8068,8 @@ ctl_pro_preempt(struct ctl_softc *softc, && i >= persis_offset) lun->pending_ua[i-persis_offset] |= CTL_UA_REG_PREEMPT; - lun->per_res[i].registered = 0; - memset(&lun->per_res[i].res_key, 0, - sizeof(struct scsi_per_res_key)); + lun->pr_keys[i] = 0; } - lun->per_res[residx].registered = 1; lun->pr_key_count = 1; lun->res_type = type; if (lun->res_type != SPR_TYPE_WR_EX_AR @@ -8144,16 +8133,11 @@ ctl_pro_preempt(struct ctl_softc *softc, } for (i=0; i < 2*CTL_MAX_INITIATORS; i++) { - if (lun->per_res[i].registered - && memcmp(param->serv_act_res_key, - lun->per_res[i].res_key.key, - sizeof(struct scsi_per_res_key)) != 0) + if (lun->pr_keys[i] != sa_res_key) continue; found = 1; - lun->per_res[i].registered = 0; - memset(&lun->per_res[i].res_key, 0, - sizeof(struct scsi_per_res_key)); + lun->pr_keys[i] = 0; lun->pr_key_count--; if (!persis_offset && i < CTL_MAX_INITIATORS) @@ -8187,9 +8171,7 @@ ctl_pro_preempt(struct ctl_softc *softc, } else { /* Reserved but not all registrants */ /* sa_res_key is res holder */ - if (memcmp(param->serv_act_res_key, - lun->per_res[lun->pr_res_idx].res_key.key, - sizeof(struct scsi_per_res_key)) == 0) { + if (sa_res_key == lun->pr_keys[lun->pr_res_idx]) { /* validate scope and type */ if ((cdb->scope_type & SPR_SCOPE_MASK) != SPR_LU_SCOPE) { @@ -8230,22 +8212,12 @@ ctl_pro_preempt(struct ctl_softc *softc, * except don't unregister the res holder. */ - /* - * Temporarily unregister so it won't get - * removed or UA generated - */ - lun->per_res[residx].registered = 0; for(i=0; i < 2*CTL_MAX_INITIATORS; i++) { - if (lun->per_res[i].registered == 0) + if (i == residx || lun->pr_keys[i] == 0) continue; - if (memcmp(param->serv_act_res_key, - lun->per_res[i].res_key.key, - sizeof(struct scsi_per_res_key)) == 0) { - lun->per_res[i].registered = 0; - memset(&lun->per_res[i].res_key, - 0, - sizeof(struct scsi_per_res_key)); + if (sa_res_key == lun->pr_keys[i]) { + lun->pr_keys[i] = 0; lun->pr_key_count--; if (!persis_offset @@ -8270,7 +8242,6 @@ ctl_pro_preempt(struct ctl_softc *softc, CTL_UA_RES_RELEASE; } } - lun->per_res[residx].registered = 1; lun->res_type = type; if (lun->res_type != SPR_TYPE_WR_EX_AR && lun->res_type != SPR_TYPE_EX_AC_AR) @@ -8301,15 +8272,11 @@ ctl_pro_preempt(struct ctl_softc *softc, int found=0; for (i=0; i < 2*CTL_MAX_INITIATORS; i++) { - if (memcmp(param->serv_act_res_key, - lun->per_res[i].res_key.key, - sizeof(struct scsi_per_res_key)) != 0) + if (sa_res_key != lun->pr_keys[i]) continue; found = 1; - lun->per_res[i].registered = 0; - memset(&lun->per_res[i].res_key, 0, - sizeof(struct scsi_per_res_key)); + lun->pr_keys[i] = 0; lun->pr_key_count--; if (!persis_offset @@ -8356,26 +8323,22 @@ ctl_pro_preempt(struct ctl_softc *softc, static void ctl_pro_preempt_other(struct ctl_lun *lun, union ctl_ha_msg *msg) { + uint64_t sa_res_key; int i; + sa_res_key = scsi_8btou64(msg->pr.pr_info.sa_res_key); + if (lun->pr_res_idx == CTL_PR_ALL_REGISTRANTS || lun->pr_res_idx == CTL_PR_NO_RESERVATION - || memcmp(&lun->per_res[lun->pr_res_idx].res_key, - msg->pr.pr_info.sa_res_key, - sizeof(struct scsi_per_res_key)) != 0) { - uint64_t sa_res_key; - sa_res_key = scsi_8btou64(msg->pr.pr_info.sa_res_key); - + || sa_res_key != lun->pr_keys[lun->pr_res_idx]) { if (sa_res_key == 0) { - /* temporarily unregister this nexus */ - lun->per_res[msg->pr.pr_info.residx].registered = 0; - /* * Unregister everybody else and build UA for * them */ for(i=0; i < 2*CTL_MAX_INITIATORS; i++) { - if (lun->per_res[i].registered == 0) + if (i == msg->pr.pr_info.residx || + lun->pr_keys[i] == 0) continue; if (!persis_offset @@ -8385,12 +8348,9 @@ ctl_pro_preempt_other(struct ctl_lun *lu else if (persis_offset && i >= persis_offset) lun->pending_ua[i - persis_offset] |= CTL_UA_REG_PREEMPT; - lun->per_res[i].registered = 0; - memset(&lun->per_res[i].res_key, 0, - sizeof(struct scsi_per_res_key)); + lun->pr_keys[i] = 0; } - lun->per_res[msg->pr.pr_info.residx].registered = 1; lun->pr_key_count = 1; lun->res_type = msg->pr.pr_info.res_type; if (lun->res_type != SPR_TYPE_WR_EX_AR @@ -8398,14 +8358,10 @@ ctl_pro_preempt_other(struct ctl_lun *lu lun->pr_res_idx = msg->pr.pr_info.residx; } else { for (i=0; i < 2*CTL_MAX_INITIATORS; i++) { - if (memcmp(msg->pr.pr_info.sa_res_key, - lun->per_res[i].res_key.key, - sizeof(struct scsi_per_res_key)) != 0) + if (sa_res_key == lun->pr_keys[i]) continue; - lun->per_res[i].registered = 0; - memset(&lun->per_res[i].res_key, 0, - sizeof(struct scsi_per_res_key)); + lun->pr_keys[i] = 0; lun->pr_key_count--; if (!persis_offset @@ -8419,21 +8375,13 @@ ctl_pro_preempt_other(struct ctl_lun *lu } } } else { - /* - * Temporarily unregister so it won't get removed - * or UA generated - */ - lun->per_res[msg->pr.pr_info.residx].registered = 0; for (i=0; i < 2*CTL_MAX_INITIATORS; i++) { - if (lun->per_res[i].registered == 0) + if (i == msg->pr.pr_info.residx || + lun->pr_keys[i] == 0) continue; - if (memcmp(msg->pr.pr_info.sa_res_key, - lun->per_res[i].res_key.key, - sizeof(struct scsi_per_res_key)) == 0) { - lun->per_res[i].registered = 0; - memset(&lun->per_res[i].res_key, 0, - sizeof(struct scsi_per_res_key)); + if (sa_res_key == lun->pr_keys[i]) { + lun->pr_keys[i] = 0; lun->pr_key_count--; if (!persis_offset && i < CTL_MAX_INITIATORS) @@ -8456,7 +8404,6 @@ ctl_pro_preempt_other(struct ctl_lun *lu CTL_UA_RES_RELEASE; } } - lun->per_res[msg->pr.pr_info.residx].registered = 1; lun->res_type = msg->pr.pr_info.res_type; if (lun->res_type != SPR_TYPE_WR_EX_AR && lun->res_type != SPR_TYPE_EX_AC_AR) @@ -8554,11 +8501,8 @@ ctl_persistent_reserve_out(struct ctl_sc */ if ((cdb->action & SPRO_ACTION_MASK) != SPRO_REG_IGNO) { mtx_lock(&lun->lun_lock); - if (lun->per_res[residx].registered) { - if (memcmp(param->res_key.key, - lun->per_res[residx].res_key.key, - ctl_min(sizeof(param->res_key), - sizeof(lun->per_res[residx].res_key))) != 0) { + if (lun->pr_keys[residx] != 0) { + if (res_key != lun->pr_keys[residx]) { /* * The current key passed in doesn't match * the one the initiator previously @@ -8639,14 +8583,12 @@ ctl_persistent_reserve_out(struct ctl_sc if ((res_key == 0 && (cdb->action & SPRO_ACTION_MASK) == SPRO_REGISTER) || ((cdb->action & SPRO_ACTION_MASK) == SPRO_REG_IGNO - && !lun->per_res[residx].registered)) { + && lun->pr_keys[residx] == 0)) { mtx_unlock(&lun->lun_lock); goto done; } - lun->per_res[residx].registered = 0; - memset(&lun->per_res[residx].res_key, - 0, sizeof(lun->per_res[residx].res_key)); + lun->pr_keys[residx] = 0; lun->pr_key_count--; if (residx == lun->pr_res_idx) { @@ -8665,9 +8607,8 @@ ctl_persistent_reserve_out(struct ctl_sc */ for (i = 0; i < CTL_MAX_INITIATORS;i++){ - if (lun->per_res[ - i+persis_offset].registered - == 0) + if (lun->pr_keys[ + i + persis_offset] == 0) continue; lun->pending_ua[i] |= CTL_UA_RES_RELEASE; @@ -8697,15 +8638,9 @@ ctl_persistent_reserve_out(struct ctl_sc * If we aren't registered currently then increment * the key count and set the registered flag. */ - if (!lun->per_res[residx].registered) { + if (lun->pr_keys[residx] == 0) lun->pr_key_count++; - lun->per_res[residx].registered = 1; - } - - memcpy(&lun->per_res[residx].res_key, - param->serv_act_res_key, - ctl_min(sizeof(param->serv_act_res_key), - sizeof(lun->per_res[residx].res_key))); + lun->pr_keys[residx] = sa_res_key; persis_io.hdr.nexus = ctsio->io_hdr.nexus; persis_io.hdr.msg_type = CTL_MSG_PERS_ACTION; @@ -8818,20 +8753,12 @@ ctl_persistent_reserve_out(struct ctl_sc */ if (type != SPR_TYPE_EX_AC && type != SPR_TYPE_WR_EX) { - /* - * temporarily unregister so we don't generate UA - */ - lun->per_res[residx].registered = 0; - for (i = 0; i < CTL_MAX_INITIATORS; i++) { - if (lun->per_res[i+persis_offset].registered - == 0) + if (i == residx || + lun->pr_keys[i + persis_offset] == 0) continue; - lun->pending_ua[i] |= - CTL_UA_RES_RELEASE; + lun->pending_ua[i] |= CTL_UA_RES_RELEASE; } - - lun->per_res[residx].registered = 1; } mtx_unlock(&lun->lun_lock); /* Send msg to other side */ @@ -8854,13 +8781,10 @@ ctl_persistent_reserve_out(struct ctl_sc lun->pr_key_count = 0; lun->pr_res_idx = CTL_PR_NO_RESERVATION; - - memset(&lun->per_res[residx].res_key, - 0, sizeof(lun->per_res[residx].res_key)); - lun->per_res[residx].registered = 0; + lun->pr_keys[residx] = 0; for (i=0; i < 2*CTL_MAX_INITIATORS; i++) - if (lun->per_res[i].registered) { + if (lun->pr_keys[i] != 0) { if (!persis_offset && i < CTL_MAX_INITIATORS) lun->pending_ua[i] |= CTL_UA_RES_PREEMPT; @@ -8868,9 +8792,7 @@ ctl_persistent_reserve_out(struct ctl_sc lun->pending_ua[i-persis_offset] |= CTL_UA_RES_PREEMPT; - memset(&lun->per_res[i].res_key, - 0, sizeof(struct scsi_per_res_key)); - lun->per_res[i].registered = 0; + lun->pr_keys[i] = 0; } lun->PRGeneration++; mtx_unlock(&lun->lun_lock); @@ -8926,20 +8848,15 @@ ctl_hndl_per_res_out_on_other_sc(union c mtx_lock(&lun->lun_lock); switch(msg->pr.pr_info.action) { case CTL_PR_REG_KEY: - if (!lun->per_res[msg->pr.pr_info.residx].registered) { - lun->per_res[msg->pr.pr_info.residx].registered = 1; + if (lun->pr_keys[msg->pr.pr_info.residx] == 0) lun->pr_key_count++; - } + lun->pr_keys[msg->pr.pr_info.residx] = + scsi_8btou64(msg->pr.pr_info.sa_res_key); lun->PRGeneration++; - memcpy(&lun->per_res[msg->pr.pr_info.residx].res_key, - msg->pr.pr_info.sa_res_key, - sizeof(struct scsi_per_res_key)); break; case CTL_PR_UNREG_KEY: - lun->per_res[msg->pr.pr_info.residx].registered = 0; - memset(&lun->per_res[msg->pr.pr_info.residx].res_key, - 0, sizeof(struct scsi_per_res_key)); + lun->pr_keys[msg->pr.pr_info.residx] = 0; lun->pr_key_count--; /* XXX Need to see if the reservation has been released */ @@ -8960,8 +8877,8 @@ ctl_hndl_per_res_out_on_other_sc(union c */ for (i = 0; i < CTL_MAX_INITIATORS; i++) { - if (lun->per_res[i+ - persis_offset].registered == 0) + if (lun->pr_keys[i+ + persis_offset] == 0) continue; lun->pending_ua[i] |= @@ -8994,7 +8911,7 @@ ctl_hndl_per_res_out_on_other_sc(union c if (lun->res_type != SPR_TYPE_EX_AC && lun->res_type != SPR_TYPE_WR_EX) { for (i = 0; i < CTL_MAX_INITIATORS; i++) - if (lun->per_res[i+persis_offset].registered) + if (lun->pr_keys[i+persis_offset] != 0) lun->pending_ua[i] |= CTL_UA_RES_RELEASE; } @@ -9014,7 +8931,7 @@ ctl_hndl_per_res_out_on_other_sc(union c lun->pr_res_idx = CTL_PR_NO_RESERVATION; for (i=0; i < 2*CTL_MAX_INITIATORS; i++) { - if (lun->per_res[i].registered == 0) + if (lun->pr_keys[i] == 0) continue; if (!persis_offset && i < CTL_MAX_INITIATORS) @@ -9023,9 +8940,7 @@ ctl_hndl_per_res_out_on_other_sc(union c && i >= persis_offset) lun->pending_ua[i-persis_offset] |= CTL_UA_RES_PREEMPT; - memset(&lun->per_res[i].res_key, 0, - sizeof(struct scsi_per_res_key)); - lun->per_res[i].registered = 0; + lun->pr_keys[i] = 0; } lun->PRGeneration++; break; @@ -9064,7 +8979,7 @@ ctl_read_write(struct ctl_scsiio *ctsio) && residx != lun->pr_res_idx) || ((lun->res_type == SPR_TYPE_EX_AC_RO || lun->res_type == SPR_TYPE_EX_AC_AR) - && !lun->per_res[residx].registered)) { + && lun->pr_keys[residx] == 0)) { ctl_set_reservation_conflict(ctsio); ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); @@ -11381,7 +11296,7 @@ ctl_scsiio_lun_check(struct ctl_softc *c * type reservations are checked in the particular command * for a conflict. Read and SSU are the only ones. */ - if (!lun->per_res[residx].registered + if (lun->pr_keys[residx] == 0 || (residx != lun->pr_res_idx && lun->res_type < 4)) { ctsio->scsi_status = SCSI_STATUS_RESERV_CONFLICT; ctsio->io_hdr.status = CTL_SCSI_ERROR; Modified: stable/10/sys/cam/ctl/ctl_private.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_private.h Mon Oct 20 07:35:46 2014 (r273313) +++ stable/10/sys/cam/ctl/ctl_private.h Mon Oct 20 07:38:36 2014 (r273314) @@ -353,11 +353,6 @@ typedef enum { CTL_PR_FLAG_ACTIVE_RES = 0x02 } ctl_per_res_flags; -struct ctl_per_res_info { - struct scsi_per_res_key res_key; - uint8_t registered; -}; - #define CTL_PR_ALL_REGISTRANTS 0xFFFFFFFF #define CTL_PR_NO_RESERVATION 0xFFFFFFF0 @@ -398,8 +393,8 @@ struct ctl_lun { struct ctl_mode_pages mode_pages; struct ctl_lun_io_stats stats; uint32_t res_idx; - struct ctl_per_res_info per_res[2*CTL_MAX_INITIATORS]; unsigned int PRGeneration; + uint64_t pr_keys[2*CTL_MAX_INITIATORS]; int pr_key_count; uint32_t pr_res_idx; uint8_t res_type; From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 07:41:40 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0FD85A47; Mon, 20 Oct 2014 07:41:40 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EE22699C; Mon, 20 Oct 2014 07:41:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K7fdNp078493; Mon, 20 Oct 2014 07:41:39 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K7fcgG078477; Mon, 20 Oct 2014 07:41:38 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410200741.s9K7fcgG078477@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 20 Oct 2014 07:41:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273315 - in stable/10: sys/cam/ctl usr.sbin/ctladm usr.sbin/ctld X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 07:41:40 -0000 Author: mav Date: Mon Oct 20 07:41:37 2014 New Revision: 273315 URL: https://svnweb.freebsd.org/changeset/base/273315 Log: MFC r272911: Make ctld start even if some LUNs are unable to open backing storage. Such LUNs will be visible to initiators, but return "not ready" status on media access commands. If backing storage become available later, `ctladm modify ...` or `service ctld reload` can trigger its reopen. Modified: stable/10/sys/cam/ctl/ctl.c stable/10/sys/cam/ctl/ctl_backend.h stable/10/sys/cam/ctl/ctl_backend_block.c stable/10/sys/cam/ctl/ctl_cmd_table.c stable/10/sys/cam/ctl/ctl_ioctl.h stable/10/usr.sbin/ctladm/ctladm.c stable/10/usr.sbin/ctld/kernel.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Mon Oct 20 07:38:36 2014 (r273314) +++ stable/10/sys/cam/ctl/ctl.c Mon Oct 20 07:41:37 2014 (r273315) @@ -4601,6 +4601,9 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft be_lun->ctl_lun = lun; be_lun->lun_id = lun_number; atomic_add_int(&be_lun->be->num_luns, 1); + if (be_lun->flags & CTL_LUN_FLAG_OFFLINE) + lun->flags |= CTL_LUN_OFFLINE; + if (be_lun->flags & CTL_LUN_FLAG_POWERED_OFF) lun->flags |= CTL_LUN_STOPPED; Modified: stable/10/sys/cam/ctl/ctl_backend.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_backend.h Mon Oct 20 07:38:36 2014 (r273314) +++ stable/10/sys/cam/ctl/ctl_backend.h Mon Oct 20 07:41:37 2014 (r273315) @@ -73,6 +73,8 @@ * The DEV_TYPE flag tells us that the device_type field is filled in. * * The UNMAP flag tells us that this LUN supports UNMAP. + * + * The OFFLINE flag tells us that this LUN can not access backing store. */ typedef enum { CTL_LUN_FLAG_ID_REQ = 0x01, @@ -82,7 +84,8 @@ typedef enum { CTL_LUN_FLAG_SERIAL_NUM = 0x10, CTL_LUN_FLAG_DEVID = 0x20, CTL_LUN_FLAG_DEV_TYPE = 0x40, - CTL_LUN_FLAG_UNMAP = 0x80 + CTL_LUN_FLAG_UNMAP = 0x80, + CTL_LUN_FLAG_OFFLINE = 0x100 } ctl_backend_lun_flags; #ifdef _KERNEL Modified: stable/10/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_backend_block.c Mon Oct 20 07:38:36 2014 (r273314) +++ stable/10/sys/cam/ctl/ctl_backend_block.c Mon Oct 20 07:41:37 2014 (r273315) @@ -153,6 +153,7 @@ typedef void (*cbb_dispatch_t)(struct ct * and a backend block LUN, and between a backend block LUN and a CTL LUN. */ struct ctl_be_block_lun { + struct ctl_lun_create_params params; struct ctl_block_disk *disk; char lunname[32]; char *dev_path; @@ -1524,7 +1525,7 @@ ctl_be_block_ioctl(struct cdev *dev, u_l default: lun_req->status = CTL_LUN_ERROR; snprintf(lun_req->error_str, sizeof(lun_req->error_str), - "%s: invalid LUN request type %d", __func__, + "invalid LUN request type %d", lun_req->reqtype); break; } @@ -1548,7 +1549,7 @@ ctl_be_block_open_file(struct ctl_be_blo error = 0; file_data = &be_lun->backend.file; - params = &req->reqdata.create; + params = &be_lun->params; be_lun->dev_type = CTL_BE_BLOCK_FILE; be_lun->dispatch = ctl_be_block_dispatch_file; @@ -1631,7 +1632,7 @@ ctl_be_block_open_dev(struct ctl_be_bloc int error; off_t ps, pss, po, pos; - params = &req->reqdata.create; + params = &be_lun->params; be_lun->dev_type = CTL_BE_BLOCK_DEV; be_lun->backend.dev.cdev = be_lun->vn->v_rdev; @@ -1649,8 +1650,8 @@ ctl_be_block_open_dev(struct ctl_be_bloc error = VOP_GETATTR(be_lun->vn, &vattr, NOCRED); if (error) { snprintf(req->error_str, sizeof(req->error_str), - "%s: error getting vnode attributes for device %s", - __func__, be_lun->dev_path); + "error getting vnode attributes for device %s", + be_lun->dev_path); return (error); } @@ -1658,7 +1659,7 @@ ctl_be_block_open_dev(struct ctl_be_bloc devsw = dev->si_devsw; if (!devsw->d_ioctl) { snprintf(req->error_str, sizeof(req->error_str), - "%s: no d_ioctl for device %s!", __func__, + "no d_ioctl for device %s!", be_lun->dev_path); return (ENODEV); } @@ -1668,8 +1669,8 @@ ctl_be_block_open_dev(struct ctl_be_bloc curthread); if (error) { snprintf(req->error_str, sizeof(req->error_str), - "%s: error %d returned for DIOCGSECTORSIZE ioctl " - "on %s!", __func__, error, be_lun->dev_path); + "error %d returned for DIOCGSECTORSIZE ioctl " + "on %s!", error, be_lun->dev_path); return (error); } @@ -1691,9 +1692,9 @@ ctl_be_block_open_dev(struct ctl_be_bloc be_lun->blocksize = params->blocksize_bytes; } else { snprintf(req->error_str, sizeof(req->error_str), - "%s: requested blocksize %u is not an even " + "requested blocksize %u is not an even " "multiple of backing device blocksize %u", - __func__, params->blocksize_bytes, + params->blocksize_bytes, be_lun->blocksize); return (EINVAL); @@ -1701,8 +1702,8 @@ ctl_be_block_open_dev(struct ctl_be_bloc } else if ((params->blocksize_bytes != 0) && (params->blocksize_bytes != be_lun->blocksize)) { snprintf(req->error_str, sizeof(req->error_str), - "%s: requested blocksize %u < backing device " - "blocksize %u", __func__, params->blocksize_bytes, + "requested blocksize %u < backing device " + "blocksize %u", params->blocksize_bytes, be_lun->blocksize); return (EINVAL); } @@ -1712,8 +1713,8 @@ ctl_be_block_open_dev(struct ctl_be_bloc curthread); if (error) { snprintf(req->error_str, sizeof(req->error_str), - "%s: error %d returned for DIOCGMEDIASIZE " - " ioctl on %s!", __func__, error, + "error %d returned for DIOCGMEDIASIZE " + " ioctl on %s!", error, be_lun->dev_path); return (error); } @@ -1721,8 +1722,8 @@ ctl_be_block_open_dev(struct ctl_be_bloc if (params->lun_size_bytes != 0) { if (params->lun_size_bytes > be_lun->size_bytes) { snprintf(req->error_str, sizeof(req->error_str), - "%s: requested LUN size %ju > backing device " - "size %ju", __func__, + "requested LUN size %ju > backing device " + "size %ju", (uintmax_t)params->lun_size_bytes, (uintmax_t)be_lun->size_bytes); return (EINVAL); @@ -1795,6 +1796,7 @@ ctl_be_block_close(struct ctl_be_block_l panic("Unexpected backend type."); break; } + be_lun->dev_type = CTL_BE_BLOCK_NONE; } PICKUP_GIANT(); @@ -1817,7 +1819,7 @@ ctl_be_block_open(struct ctl_be_block_so if (rootvnode == NULL) { snprintf(req->error_str, sizeof(req->error_str), - "%s: Root filesystem is not mounted", __func__); + "Root filesystem is not mounted"); return (1); } @@ -1861,7 +1863,7 @@ ctl_be_block_open(struct ctl_be_block_so } } snprintf(req->error_str, sizeof(req->error_str), - "%s: error opening %s", __func__, be_lun->dev_path); + "error opening %s: %d", be_lun->dev_path, error); return (error); } @@ -1905,11 +1907,13 @@ ctl_be_block_create(struct ctl_be_block_ params = &req->reqdata.create; retval = 0; + req->status = CTL_LUN_OK; num_threads = cbb_num_threads; be_lun = malloc(sizeof(*be_lun), M_CTLBLK, M_ZERO | M_WAITOK); + be_lun->params = req->reqdata.create; be_lun->softc = softc; STAILQ_INIT(&be_lun->input_queue); STAILQ_INIT(&be_lun->config_write_queue); @@ -1925,7 +1929,7 @@ ctl_be_block_create(struct ctl_be_block_ if (be_lun->lun_zone == NULL) { snprintf(req->error_str, sizeof(req->error_str), - "%s: error allocating UMA zone", __func__); + "error allocating UMA zone"); goto bailout_error; } @@ -1938,26 +1942,18 @@ ctl_be_block_create(struct ctl_be_block_ value = ctl_get_opt(&be_lun->ctl_be_lun.options, "file"); if (value == NULL) { snprintf(req->error_str, sizeof(req->error_str), - "%s: no file argument specified", __func__); + "no file argument specified"); goto bailout_error; } be_lun->dev_path = strdup(value, M_CTLBLK); + be_lun->blocksize = 512; + be_lun->blocksize_shift = fls(be_lun->blocksize) - 1; retval = ctl_be_block_open(softc, be_lun, req); if (retval != 0) { retval = 0; - goto bailout_error; + req->status = CTL_LUN_WARNING; } - - /* - * Tell the user the size of the file/device. - */ - params->lun_size_bytes = be_lun->size_bytes; - - /* - * The maximum LBA is the size - 1. - */ - be_lun->ctl_be_lun.maxlba = be_lun->size_blocks - 1; } else { /* * For processor devices, we don't have any size. @@ -1968,7 +1964,6 @@ ctl_be_block_create(struct ctl_be_block_ be_lun->size_blocks = 0; be_lun->size_bytes = 0; be_lun->ctl_be_lun.maxlba = 0; - params->lun_size_bytes = 0; /* * Default to just 1 thread for processor devices. @@ -1991,8 +1986,8 @@ ctl_be_block_create(struct ctl_be_block_ */ if (tmp_num_threads < 1) { snprintf(req->error_str, sizeof(req->error_str), - "%s: invalid number of threads %s", - __func__, num_thread_str); + "invalid number of threads %s", + num_thread_str); goto bailout_error; } num_threads = tmp_num_threads; @@ -2004,16 +1999,22 @@ ctl_be_block_create(struct ctl_be_block_ be_lun->flags = CTL_BE_BLOCK_LUN_UNCONFIGURED; be_lun->ctl_be_lun.flags = CTL_LUN_FLAG_PRIMARY; + if (be_lun->vn == NULL) + be_lun->ctl_be_lun.flags |= CTL_LUN_FLAG_OFFLINE; if (unmap) be_lun->ctl_be_lun.flags |= CTL_LUN_FLAG_UNMAP; - if (be_lun->dispatch == ctl_be_block_dispatch_zvol) - be_lun->ctl_be_lun.atomicblock = CTLBLK_MAX_IO_SIZE / - be_lun->blocksize; be_lun->ctl_be_lun.be_lun = be_lun; + be_lun->ctl_be_lun.maxlba = (be_lun->size_blocks == 0) ? + 0 : (be_lun->size_blocks - 1); be_lun->ctl_be_lun.blocksize = be_lun->blocksize; be_lun->ctl_be_lun.pblockexp = be_lun->pblockexp; be_lun->ctl_be_lun.pblockoff = be_lun->pblockoff; + if (be_lun->dispatch == ctl_be_block_dispatch_zvol && + be_lun->blocksize != 0) + be_lun->ctl_be_lun.atomicblock = CTLBLK_MAX_IO_SIZE / + be_lun->blocksize; /* Tell the user the blocksize we ended up using */ + params->lun_size_bytes = be_lun->size_bytes; params->blocksize_bytes = be_lun->blocksize; if (params->flags & CTL_LUN_FLAG_ID_REQ) { be_lun->ctl_be_lun.req_lun_id = params->req_lun_id; @@ -2065,7 +2066,7 @@ ctl_be_block_create(struct ctl_be_block_ if (be_lun->io_taskqueue == NULL) { snprintf(req->error_str, sizeof(req->error_str), - "%s: Unable to create taskqueue", __func__); + "unable to create taskqueue"); goto bailout_error; } @@ -2108,8 +2109,8 @@ ctl_be_block_create(struct ctl_be_block_ softc->num_luns--; mtx_unlock(&softc->lock); snprintf(req->error_str, sizeof(req->error_str), - "%s: ctl_add_lun() returned error %d, see dmesg for " - "details", __func__, retval); + "ctl_add_lun() returned error %d, see dmesg for " + "details", retval); retval = 0; goto bailout_error; } @@ -2131,8 +2132,7 @@ ctl_be_block_create(struct ctl_be_block_ if (be_lun->flags & CTL_BE_BLOCK_LUN_CONFIG_ERR) { snprintf(req->error_str, sizeof(req->error_str), - "%s: LUN configuration error, see dmesg for details", - __func__); + "LUN configuration error, see dmesg for details"); STAILQ_REMOVE(&softc->lun_list, be_lun, ctl_be_block_lun, links); softc->num_luns--; @@ -2151,9 +2151,6 @@ ctl_be_block_create(struct ctl_be_block_ | DEVSTAT_TYPE_IF_OTHER, DEVSTAT_PRIORITY_OTHER); - - req->status = CTL_LUN_OK; - return (retval); bailout_error: @@ -2195,8 +2192,8 @@ ctl_be_block_rm(struct ctl_be_block_soft if (be_lun == NULL) { snprintf(req->error_str, sizeof(req->error_str), - "%s: LUN %u is not managed by the block backend", - __func__, params->lun_id); + "LUN %u is not managed by the block backend", + params->lun_id); goto bailout_error; } @@ -2204,8 +2201,8 @@ ctl_be_block_rm(struct ctl_be_block_soft if (retval != 0) { snprintf(req->error_str, sizeof(req->error_str), - "%s: error %d returned from ctl_disable_lun() for " - "LUN %d", __func__, retval, params->lun_id); + "error %d returned from ctl_disable_lun() for " + "LUN %d", retval, params->lun_id); goto bailout_error; } @@ -2213,8 +2210,8 @@ ctl_be_block_rm(struct ctl_be_block_soft retval = ctl_invalidate_lun(&be_lun->ctl_be_lun); if (retval != 0) { snprintf(req->error_str, sizeof(req->error_str), - "%s: error %d returned from ctl_invalidate_lun() for " - "LUN %d", __func__, retval, params->lun_id); + "error %d returned from ctl_invalidate_lun() for " + "LUN %d", retval, params->lun_id); goto bailout_error; } @@ -2232,8 +2229,7 @@ ctl_be_block_rm(struct ctl_be_block_soft if ((be_lun->flags & CTL_BE_BLOCK_LUN_UNCONFIGURED) == 0) { snprintf(req->error_str, sizeof(req->error_str), - "%s: interrupted waiting for LUN to be freed", - __func__); + "interrupted waiting for LUN to be freed"); mtx_unlock(&softc->lock); goto bailout_error; } @@ -2277,9 +2273,7 @@ ctl_be_block_modify_file(struct ctl_be_b { struct vattr vattr; int error; - struct ctl_lun_modify_params *params; - - params = &req->reqdata.modify; + struct ctl_lun_create_params *params = &be_lun->params; if (params->lun_size_bytes != 0) { be_lun->size_bytes = params->lun_size_bytes; @@ -2306,16 +2300,13 @@ ctl_be_block_modify_dev(struct ctl_be_bl { struct ctl_be_block_devdata *dev_data; int error; - struct ctl_lun_modify_params *params; + struct ctl_lun_create_params *params = &be_lun->params; uint64_t size_bytes; - params = &req->reqdata.modify; - dev_data = &be_lun->backend.dev; if (!dev_data->csw->d_ioctl) { snprintf(req->error_str, sizeof(req->error_str), - "%s: no d_ioctl for device %s!", __func__, - be_lun->dev_path); + "no d_ioctl for device %s!", be_lun->dev_path); return (ENODEV); } @@ -2324,16 +2315,16 @@ ctl_be_block_modify_dev(struct ctl_be_bl curthread); if (error) { snprintf(req->error_str, sizeof(req->error_str), - "%s: error %d returned for DIOCGMEDIASIZE ioctl " - "on %s!", __func__, error, be_lun->dev_path); + "error %d returned for DIOCGMEDIASIZE ioctl " + "on %s!", error, be_lun->dev_path); return (error); } if (params->lun_size_bytes != 0) { if (params->lun_size_bytes > size_bytes) { snprintf(req->error_str, sizeof(req->error_str), - "%s: requested LUN size %ju > backing device " - "size %ju", __func__, + "requested LUN size %ju > backing device " + "size %ju", (uintmax_t)params->lun_size_bytes, (uintmax_t)size_bytes); return (EINVAL); @@ -2358,9 +2349,7 @@ ctl_be_block_modify(struct ctl_be_block_ params = &req->reqdata.modify; mtx_lock(&softc->lock); - be_lun = NULL; - STAILQ_FOREACH(be_lun, &softc->lun_list, links) { if (be_lun->ctl_be_lun.lun_id == params->lun_id) break; @@ -2369,29 +2358,22 @@ ctl_be_block_modify(struct ctl_be_block_ if (be_lun == NULL) { snprintf(req->error_str, sizeof(req->error_str), - "%s: LUN %u is not managed by the block backend", - __func__, params->lun_id); + "LUN %u is not managed by the block backend", + params->lun_id); goto bailout_error; } - if (params->lun_size_bytes != 0) { - if (params->lun_size_bytes < be_lun->blocksize) { - snprintf(req->error_str, sizeof(req->error_str), - "%s: LUN size %ju < blocksize %u", __func__, - params->lun_size_bytes, be_lun->blocksize); - goto bailout_error; - } - } + be_lun->params.lun_size_bytes = params->lun_size_bytes; - oldsize = be_lun->size_bytes; - if (be_lun->vn->v_type == VREG) + oldsize = be_lun->size_blocks; + if (be_lun->vn == NULL) + error = ctl_be_block_open(softc, be_lun, req); + else if (be_lun->vn->v_type == VREG) error = ctl_be_block_modify_file(be_lun, req); else error = ctl_be_block_modify_dev(be_lun, req); - if (error != 0) - goto bailout_error; - if (be_lun->size_bytes != oldsize) { + if (error == 0 && be_lun->size_blocks != oldsize) { be_lun->size_blocks = be_lun->size_bytes >> be_lun->blocksize_shift; @@ -2401,14 +2383,24 @@ ctl_be_block_modify(struct ctl_be_block_ * XXX: Note that this field is being updated without locking, * which might cause problems on 32-bit architectures. */ - be_lun->ctl_be_lun.maxlba = be_lun->size_blocks - 1; + be_lun->ctl_be_lun.maxlba = (be_lun->size_blocks == 0) ? + 0 : (be_lun->size_blocks - 1); + be_lun->ctl_be_lun.blocksize = be_lun->blocksize; + be_lun->ctl_be_lun.pblockexp = be_lun->pblockexp; + be_lun->ctl_be_lun.pblockoff = be_lun->pblockoff; + if (be_lun->dispatch == ctl_be_block_dispatch_zvol && + be_lun->blocksize != 0) + be_lun->ctl_be_lun.atomicblock = CTLBLK_MAX_IO_SIZE / + be_lun->blocksize; ctl_lun_capacity_changed(&be_lun->ctl_be_lun); + if (oldsize == 0 && be_lun->size_blocks != 0) + ctl_lun_online(&be_lun->ctl_be_lun); } /* Tell the user the exact size we ended up using */ params->lun_size_bytes = be_lun->size_bytes; - req->status = CTL_LUN_OK; + req->status = error ? CTL_LUN_WARNING : CTL_LUN_OK; return (0); Modified: stable/10/sys/cam/ctl/ctl_cmd_table.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_cmd_table.c Mon Oct 20 07:38:36 2014 (r273314) +++ stable/10/sys/cam/ctl/ctl_cmd_table.c Mon Oct 20 07:41:37 2014 (r273315) @@ -70,6 +70,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -81,6 +82,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -92,6 +94,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -103,6 +106,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -120,6 +124,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_OUT | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -131,6 +136,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_OUT | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -142,6 +148,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_OUT | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -153,6 +160,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_OUT | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -164,6 +172,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_OUT | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -178,6 +187,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_OUT | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -460,6 +470,7 @@ const struct ctl_cmd_entry ctl_cmd_table {ctl_report_tagret_port_groups, CTL_SERIDX_INQ, CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_IN, CTL_LUN_PAT_NONE, @@ -472,6 +483,7 @@ const struct ctl_cmd_entry ctl_cmd_table {ctl_report_supported_opcodes, CTL_SERIDX_INQ, CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -482,6 +494,7 @@ const struct ctl_cmd_entry ctl_cmd_table {ctl_report_supported_tmf, CTL_SERIDX_INQ, CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -495,6 +508,7 @@ const struct ctl_cmd_entry ctl_cmd_table {ctl_report_timestamp, CTL_SERIDX_INQ, CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_IN, CTL_LUN_PAT_NONE, @@ -601,6 +615,7 @@ const struct ctl_cmd_entry ctl_cmd_table {ctl_mode_select, CTL_SERIDX_MD_SEL, CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_OUT, CTL_LUN_PAT_NONE, 6, {0x11, 0, 0, 0xff, 0x07}}, @@ -610,6 +625,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_OUT, CTL_LUN_PAT_NONE, 6, {0, 0, 0, 0, 0x07}}, @@ -619,6 +635,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_NONE, CTL_LUN_PAT_NONE, 6, {0, 0, 0, 0, 0x07}}, @@ -633,6 +650,7 @@ const struct ctl_cmd_entry ctl_cmd_table {ctl_mode_sense, CTL_SERIDX_MD_SNS, CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -855,6 +873,7 @@ const struct ctl_cmd_entry ctl_cmd_table {ctl_mode_select, CTL_SERIDX_MD_SEL, CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_OUT, CTL_LUN_PAT_NONE, 10, {0x11, 0, 0, 0, 0, 0, 0xff, 0xff, 0x07} }, @@ -864,6 +883,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_OUT, CTL_LUN_PAT_NONE, 10, {0x02, 0, 0xff, 0, 0, 0, 0xff, 0xff, 0x07} }, @@ -873,6 +893,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_OUT, CTL_LUN_PAT_NONE, 10, {0x02, 0, 0xff, 0, 0, 0, 0xff, 0xff, 0x07} }, @@ -887,6 +908,7 @@ const struct ctl_cmd_entry ctl_cmd_table {ctl_mode_sense, CTL_SERIDX_MD_SNS, CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, Modified: stable/10/sys/cam/ctl/ctl_ioctl.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_ioctl.h Mon Oct 20 07:38:36 2014 (r273314) +++ stable/10/sys/cam/ctl/ctl_ioctl.h Mon Oct 20 07:41:37 2014 (r273315) @@ -363,7 +363,8 @@ struct ctl_port_list { typedef enum { CTL_LUN_NOSTATUS, CTL_LUN_OK, - CTL_LUN_ERROR + CTL_LUN_ERROR, + CTL_LUN_WARNING } ctl_lun_status; #define CTL_ERROR_STR_LEN 160 Modified: stable/10/usr.sbin/ctladm/ctladm.c ============================================================================== --- stable/10/usr.sbin/ctladm/ctladm.c Mon Oct 20 07:38:36 2014 (r273314) +++ stable/10/usr.sbin/ctladm/ctladm.c Mon Oct 20 07:41:37 2014 (r273315) @@ -3174,14 +3174,18 @@ cctl_create_lun(int fd, int argc, char * goto bailout; } - if (req.status == CTL_LUN_ERROR) { - warnx("%s: error returned from LUN creation request:\n%s", - __func__, req.error_str); + switch (req.status) { + case CTL_LUN_ERROR: + warnx("LUN creation error: %s", req.error_str); retval = 1; goto bailout; - } else if (req.status != CTL_LUN_OK) { - warnx("%s: unknown LUN creation request status %d", - __func__, req.status); + case CTL_LUN_WARNING: + warnx("LUN creation warning: %s", req.error_str); + break; + case CTL_LUN_OK: + break; + default: + warnx("unknown LUN creation status: %d", req.status); retval = 1; goto bailout; } @@ -3320,19 +3324,23 @@ cctl_rm_lun(int fd, int argc, char **arg goto bailout; } - if (req.status == CTL_LUN_ERROR) { - warnx("%s: error returned from LUN removal request:\n%s", - __func__, req.error_str); + switch (req.status) { + case CTL_LUN_ERROR: + warnx("LUN removal error: %s", req.error_str); retval = 1; goto bailout; - } else if (req.status != CTL_LUN_OK) { - warnx("%s: unknown LUN removal request status %d", - __func__, req.status); + case CTL_LUN_WARNING: + warnx("LUN removal warning: %s", req.error_str); + break; + case CTL_LUN_OK: + break; + default: + warnx("unknown LUN removal status: %d", req.status); retval = 1; goto bailout; } - printf("LUN %d deleted successfully\n", lun_id); + printf("LUN %d removed successfully\n", lun_id); bailout: return (retval); @@ -3397,14 +3405,18 @@ cctl_modify_lun(int fd, int argc, char * goto bailout; } - if (req.status == CTL_LUN_ERROR) { - warnx("%s: error returned from LUN modification request:\n%s", - __func__, req.error_str); + switch (req.status) { + case CTL_LUN_ERROR: + warnx("LUN modification error: %s", req.error_str); retval = 1; goto bailout; - } else if (req.status != CTL_LUN_OK) { - warnx("%s: unknown LUN modification request status %d", - __func__, req.status); + case CTL_LUN_WARNING: + warnx("LUN modification warning: %s", req.error_str); + break; + case CTL_LUN_OK: + break; + default: + warnx("unknown LUN modification status: %d", req.status); retval = 1; goto bailout; } Modified: stable/10/usr.sbin/ctld/kernel.c ============================================================================== --- stable/10/usr.sbin/ctld/kernel.c Mon Oct 20 07:38:36 2014 (r273314) +++ stable/10/usr.sbin/ctld/kernel.c Mon Oct 20 07:41:37 2014 (r273315) @@ -700,20 +700,22 @@ kernel_lun_add(struct lun *lun) return (1); } - if (req.status == CTL_LUN_ERROR) { - log_warnx("error returned from LUN creation request: %s", - req.error_str); - return (1); - } - - if (req.status != CTL_LUN_OK) { - log_warnx("unknown LUN creation request status %d", + switch (req.status) { + case CTL_LUN_ERROR: + log_warnx("LUN creation error: %s", req.error_str); + return (1); + case CTL_LUN_WARNING: + log_warnx("LUN creation warning: %s", req.error_str); + break; + case CTL_LUN_OK: + break; + default: + log_warnx("unknown LUN creation status: %d", req.status); return (1); } lun_set_ctl_lun(lun, req.reqdata.create.req_lun_id); - return (0); } @@ -735,14 +737,17 @@ kernel_lun_resize(struct lun *lun) return (1); } - if (req.status == CTL_LUN_ERROR) { - log_warnx("error returned from LUN modification request: %s", - req.error_str); - return (1); - } - - if (req.status != CTL_LUN_OK) { - log_warnx("unknown LUN modification request status %d", + switch (req.status) { + case CTL_LUN_ERROR: + log_warnx("LUN modification error: %s", req.error_str); + return (1); + case CTL_LUN_WARNING: + log_warnx("LUN modification warning: %s", req.error_str); + break; + case CTL_LUN_OK: + break; + default: + log_warnx("unknown LUN modification status: %d", req.status); return (1); } @@ -767,14 +772,17 @@ kernel_lun_remove(struct lun *lun) return (1); } - if (req.status == CTL_LUN_ERROR) { - log_warnx("error returned from LUN removal request: %s", - req.error_str); - return (1); - } - - if (req.status != CTL_LUN_OK) { - log_warnx("unknown LUN removal request status %d", req.status); + switch (req.status) { + case CTL_LUN_ERROR: + log_warnx("LUN removal error: %s", req.error_str); + return (1); + case CTL_LUN_WARNING: + log_warnx("LUN removal warning: %s", req.error_str); + break; + case CTL_LUN_OK: + break; + default: + log_warnx("unknown LUN removal status: %d", req.status); return (1); } From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 07:52:48 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CFF49D58; Mon, 20 Oct 2014 07:52:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BBEFEA9C; Mon, 20 Oct 2014 07:52:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K7qmoU083472; Mon, 20 Oct 2014 07:52:48 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K7qm8L083471; Mon, 20 Oct 2014 07:52:48 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410200752.s9K7qm8L083471@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 20 Oct 2014 07:52:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273316 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 07:52:48 -0000 Author: mav Date: Mon Oct 20 07:52:48 2014 New Revision: 273316 URL: https://svnweb.freebsd.org/changeset/base/273316 Log: MFC r272935: Mark CTL frontend's CAM driver as CAM_PERIPH_DRV_EARLY. Target mode operation does not depend on the initiator mode scan process. This change allows the target driver to attach earlier and receive some async events (like AC_CONTRACT) that could be lost otherwise. Modified: stable/10/sys/cam/ctl/scsi_ctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/scsi_ctl.c ============================================================================== --- stable/10/sys/cam/ctl/scsi_ctl.c Mon Oct 20 07:41:37 2014 (r273315) +++ stable/10/sys/cam/ctl/scsi_ctl.c Mon Oct 20 07:52:48 2014 (r273316) @@ -224,7 +224,8 @@ static void ctlfe_dump(void); static struct periph_driver ctlfe_driver = { ctlfeperiphinit, "ctl", - TAILQ_HEAD_INITIALIZER(ctlfe_driver.units), /*generation*/ 0 + TAILQ_HEAD_INITIALIZER(ctlfe_driver.units), /*generation*/ 0, + CAM_PERIPH_DRV_EARLY }; static struct ctl_frontend ctlfe_frontend = From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 07:57:08 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2FA7AF74; Mon, 20 Oct 2014 07:57:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1B597AD5; Mon, 20 Oct 2014 07:57:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K7v7Mk084074; Mon, 20 Oct 2014 07:57:07 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K7v7f0084073; Mon, 20 Oct 2014 07:57:07 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410200757.s9K7v7f0084073@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 20 Oct 2014 07:57:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273317 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 07:57:08 -0000 Author: mav Date: Mon Oct 20 07:57:07 2014 New Revision: 273317 URL: https://svnweb.freebsd.org/changeset/base/273317 Log: MFC r272938: Filter out duplicate AC_PATH_REGISTERED async events. Queued async events handling in CAM opened race, that may lead to duplicate AC_PATH_REGISTERED events delivery during boot. That was not happening before r272935 because the driver was initialized later. After that change it started create duplicate ports in CTL. Modified: stable/10/sys/cam/ctl/scsi_ctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/scsi_ctl.c ============================================================================== --- stable/10/sys/cam/ctl/scsi_ctl.c Mon Oct 20 07:52:48 2014 (r273316) +++ stable/10/sys/cam/ctl/scsi_ctl.c Mon Oct 20 07:57:07 2014 (r273317) @@ -271,11 +271,19 @@ ctlfeperiphinit(void) static void ctlfeasync(void *callback_arg, uint32_t code, struct cam_path *path, void *arg) { + struct ctlfe_softc *softc; #ifdef CTLFEDEBUG printf("%s: entered\n", __func__); #endif + mtx_lock(&ctlfe_list_mtx); + STAILQ_FOREACH(softc, &ctlfe_softc_list, links) { + if (softc->path_id == xpt_path_path_id(path)) + break; + } + mtx_unlock(&ctlfe_list_mtx); + /* * When a new path gets registered, and it is capable of target * mode, go ahead and attach. Later on, we may need to be more @@ -284,7 +292,6 @@ ctlfeasync(void *callback_arg, uint32_t switch (code) { case AC_PATH_REGISTERED: { struct ctl_port *port; - struct ctlfe_softc *bus_softc; struct ccb_pathinq *cpi; int retval; @@ -299,6 +306,14 @@ ctlfeasync(void *callback_arg, uint32_t break; } + if (softc != NULL) { +#ifdef CTLFEDEBUG + printf("%s: CTL port for CAM path %u already exists\n", + __func__, xpt_path_path_id(path)); +#endif + break; + } + #ifdef CTLFE_INIT_ENABLE if (ctlfe_num_targets >= ctlfe_max_targets) { union ccb *ccb; @@ -347,25 +362,23 @@ ctlfeasync(void *callback_arg, uint32_t * use M_NOWAIT. Of course this means trouble if we * can't allocate memory. */ - bus_softc = malloc(sizeof(*bus_softc), M_CTLFE, - M_NOWAIT | M_ZERO); - if (bus_softc == NULL) { + softc = malloc(sizeof(*softc), M_CTLFE, M_NOWAIT | M_ZERO); + if (softc == NULL) { printf("%s: unable to malloc %zd bytes for softc\n", - __func__, sizeof(*bus_softc)); + __func__, sizeof(*softc)); return; } - bus_softc->path_id = cpi->ccb_h.path_id; - bus_softc->sim = xpt_path_sim(path); + softc->path_id = cpi->ccb_h.path_id; + softc->sim = xpt_path_sim(path); if (cpi->maxio != 0) - bus_softc->maxio = cpi->maxio; + softc->maxio = cpi->maxio; else - bus_softc->maxio = DFLTPHYS; - mtx_init(&bus_softc->lun_softc_mtx, "LUN softc mtx", NULL, - MTX_DEF); - STAILQ_INIT(&bus_softc->lun_softc_list); + softc->maxio = DFLTPHYS; + mtx_init(&softc->lun_softc_mtx, "LUN softc mtx", NULL, MTX_DEF); + STAILQ_INIT(&softc->lun_softc_list); - port = &bus_softc->port; + port = &softc->port; port->frontend = &ctlfe_frontend; /* @@ -380,21 +393,21 @@ ctlfeasync(void *callback_arg, uint32_t /* XXX KDM what should the real number be here? */ port->num_requested_ctl_io = 4096; - snprintf(bus_softc->port_name, sizeof(bus_softc->port_name), + snprintf(softc->port_name, sizeof(softc->port_name), "%s%d", cpi->dev_name, cpi->unit_number); /* * XXX KDM it would be nice to allocate storage in the * frontend structure itself. */ - port->port_name = bus_softc->port_name; + port->port_name = softc->port_name; port->physical_port = cpi->unit_number; port->virtual_port = cpi->bus_id; port->port_online = ctlfe_online; port->port_offline = ctlfe_offline; - port->onoff_arg = bus_softc; + port->onoff_arg = softc; port->lun_enable = ctlfe_lun_enable; port->lun_disable = ctlfe_lun_disable; - port->targ_lun_arg = bus_softc; + port->targ_lun_arg = softc; port->fe_datamove = ctlfe_datamove_done; port->fe_done = ctlfe_datamove_done; /* @@ -416,35 +429,28 @@ ctlfeasync(void *callback_arg, uint32_t if (retval != 0) { printf("%s: ctl_port_register() failed with " "error %d!\n", __func__, retval); - mtx_destroy(&bus_softc->lun_softc_mtx); - free(bus_softc, M_CTLFE); + mtx_destroy(&softc->lun_softc_mtx); + free(softc, M_CTLFE); break; } else { mtx_lock(&ctlfe_list_mtx); - STAILQ_INSERT_TAIL(&ctlfe_softc_list, bus_softc, links); + STAILQ_INSERT_TAIL(&ctlfe_softc_list, softc, links); mtx_unlock(&ctlfe_list_mtx); } break; } case AC_PATH_DEREGISTERED: { - struct ctlfe_softc *softc = NULL; - - mtx_lock(&ctlfe_list_mtx); - STAILQ_FOREACH(softc, &ctlfe_softc_list, links) { - if (softc->path_id == xpt_path_path_id(path)) { - STAILQ_REMOVE(&ctlfe_softc_list, softc, - ctlfe_softc, links); - break; - } - } - mtx_unlock(&ctlfe_list_mtx); if (softc != NULL) { /* * XXX KDM are we certain at this point that there * are no outstanding commands for this frontend? */ + mtx_lock(&ctlfe_list_mtx); + STAILQ_REMOVE(&ctlfe_softc_list, softc, ctlfe_softc, + links); + mtx_unlock(&ctlfe_list_mtx); ctl_port_deregister(&softc->port); mtx_destroy(&softc->lun_softc_mtx); free(softc, M_CTLFE); @@ -459,8 +465,7 @@ ctlfeasync(void *callback_arg, uint32_t switch (ac->contract_number) { case AC_CONTRACT_DEV_CHG: { struct ac_device_changed *dev_chg; - struct ctlfe_softc *softc; - int retval, found; + int retval; dev_chg = (struct ac_device_changed *)ac->contract_data; @@ -469,18 +474,7 @@ ctlfeasync(void *callback_arg, uint32_t xpt_path_path_id(path), dev_chg->target, (dev_chg->arrived == 0) ? "left" : "arrived"); - found = 0; - - mtx_lock(&ctlfe_list_mtx); - STAILQ_FOREACH(softc, &ctlfe_softc_list, links) { - if (softc->path_id == xpt_path_path_id(path)) { - found = 1; - break; - } - } - mtx_unlock(&ctlfe_list_mtx); - - if (found == 0) { + if (softc == NULL) { printf("%s: CTL port for CAM path %u not " "found!\n", __func__, xpt_path_path_id(path)); From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 07:58:02 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AB7EC130; Mon, 20 Oct 2014 07:58:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 97485ADB; Mon, 20 Oct 2014 07:58:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K7w26c084242; Mon, 20 Oct 2014 07:58:02 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K7w2VL084241; Mon, 20 Oct 2014 07:58:02 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410200758.s9K7w2VL084241@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 20 Oct 2014 07:58:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273318 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 07:58:02 -0000 Author: mav Date: Mon Oct 20 07:58:01 2014 New Revision: 273318 URL: https://svnweb.freebsd.org/changeset/base/273318 Log: MFC r272939: Shorten frontend name. Modified: stable/10/sys/cam/ctl/scsi_ctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/scsi_ctl.c ============================================================================== --- stable/10/sys/cam/ctl/scsi_ctl.c Mon Oct 20 07:57:07 2014 (r273317) +++ stable/10/sys/cam/ctl/scsi_ctl.c Mon Oct 20 07:58:01 2014 (r273318) @@ -230,7 +230,7 @@ static struct periph_driver ctlfe_driver static struct ctl_frontend ctlfe_frontend = { - .name = "camtarget", + .name = "camtgt", .init = ctlfeinitialize, .fe_dump = ctlfe_dump, .shutdown = ctlfeshutdown, From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 07:59:31 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1AE3A2A7; Mon, 20 Oct 2014 07:59:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F0650AEF; Mon, 20 Oct 2014 07:59:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K7xUWx084466; Mon, 20 Oct 2014 07:59:30 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K7xU2c084463; Mon, 20 Oct 2014 07:59:30 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410200759.s9K7xU2c084463@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 20 Oct 2014 07:59:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273319 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 07:59:31 -0000 Author: mav Date: Mon Oct 20 07:59:29 2014 New Revision: 273319 URL: https://svnweb.freebsd.org/changeset/base/273319 Log: MFC r272947: Give physical and virtual ports numbers some more meaning. Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c stable/10/sys/cam/ctl/ctl_frontend_iscsi.h stable/10/sys/cam/ctl/scsi_ctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_frontend_iscsi.c Mon Oct 20 07:58:01 2014 (r273318) +++ stable/10/sys/cam/ctl/ctl_frontend_iscsi.c Mon Oct 20 07:59:29 2014 (r273319) @@ -2000,7 +2000,8 @@ cfiscsi_ioctl_port_create(struct ctl_req /* XXX KDM what should the real number be here? */ port->num_requested_ctl_io = 4096; port->port_name = "iscsi"; - port->virtual_port = strtoul(tag, NULL, 0); + port->physical_port = strtoul(tag, NULL, 0); + port->virtual_port = ct->ct_target_id; port->port_online = cfiscsi_online; port->port_offline = cfiscsi_offline; port->port_info = cfiscsi_info; @@ -2033,7 +2034,7 @@ cfiscsi_ioctl_port_create(struct ctl_req SVPD_ID_TYPE_SCSI_NAME; desc->length = idlen; snprintf(desc->identifier, idlen, "%s,t,0x%4.4x", - target, port->virtual_port); + target, port->physical_port); /* Generate Target ID. */ idlen = strlen(target) + 1; @@ -2261,6 +2262,9 @@ cfiscsi_target_find_or_create(struct cfi strlcpy(newct->ct_alias, alias, sizeof(newct->ct_alias)); refcount_init(&newct->ct_refcount, 1); newct->ct_softc = softc; + if (TAILQ_EMPTY(&softc->targets)) + softc->last_target_id = 0; + newct->ct_target_id = ++softc->last_target_id; TAILQ_INSERT_TAIL(&softc->targets, newct, ct_next); mtx_unlock(&softc->lock); Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_frontend_iscsi.h Mon Oct 20 07:58:01 2014 (r273318) +++ stable/10/sys/cam/ctl/ctl_frontend_iscsi.h Mon Oct 20 07:59:29 2014 (r273319) @@ -45,6 +45,7 @@ struct cfiscsi_target { char ct_alias[CTL_ISCSI_ALIAS_LEN]; int ct_state; int ct_online; + int ct_target_id; struct ctl_port ct_port; }; @@ -110,6 +111,7 @@ struct cfiscsi_softc { struct mtx lock; char port_name[32]; int online; + int last_target_id; unsigned int last_session_id; TAILQ_HEAD(, cfiscsi_target) targets; TAILQ_HEAD(, cfiscsi_session) sessions; Modified: stable/10/sys/cam/ctl/scsi_ctl.c ============================================================================== --- stable/10/sys/cam/ctl/scsi_ctl.c Mon Oct 20 07:58:01 2014 (r273318) +++ stable/10/sys/cam/ctl/scsi_ctl.c Mon Oct 20 07:59:29 2014 (r273319) @@ -400,8 +400,8 @@ ctlfeasync(void *callback_arg, uint32_t * frontend structure itself. */ port->port_name = softc->port_name; - port->physical_port = cpi->unit_number; - port->virtual_port = cpi->bus_id; + port->physical_port = cpi->bus_id; + port->virtual_port = 0; port->port_online = ctlfe_online; port->port_offline = ctlfe_offline; port->onoff_arg = softc; From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 08:03:24 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5E5515F1; Mon, 20 Oct 2014 08:03:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3F1B2BE4; Mon, 20 Oct 2014 08:03:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K83ORw088552; Mon, 20 Oct 2014 08:03:24 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K83NAs088549; Mon, 20 Oct 2014 08:03:23 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410200803.s9K83NAs088549@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 20 Oct 2014 08:03:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273320 - in stable/10: sys/cam/ctl usr.sbin/ctladm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 08:03:24 -0000 Author: mav Date: Mon Oct 20 08:03:23 2014 New Revision: 273320 URL: https://svnweb.freebsd.org/changeset/base/273320 Log: MFC r272978: Improve and document `ctladm portlist` subcommand. Make this subcommand less FC-specific, reporting target and port addresses in more generic way. Also make it report list of connected initiators in unified way, working for both FC and iSCSI, and potentially others. Modified: stable/10/sys/cam/ctl/ctl.c stable/10/usr.sbin/ctladm/ctladm.8 stable/10/usr.sbin/ctladm/ctladm.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Mon Oct 20 07:59:29 2014 (r273319) +++ stable/10/sys/cam/ctl/ctl.c Mon Oct 20 08:03:23 2014 (r273320) @@ -2239,6 +2239,43 @@ ctl_sbuf_printf_esc(struct sbuf *sb, cha return (retval); } +static void +ctl_id_sbuf(struct ctl_devid *id, struct sbuf *sb) +{ + struct scsi_vpd_id_descriptor *desc; + int i; + + if (id == NULL || id->len < 4) + return; + desc = (struct scsi_vpd_id_descriptor *)id->data; + switch (desc->id_type & SVPD_ID_TYPE_MASK) { + case SVPD_ID_TYPE_T10: + sbuf_printf(sb, "t10."); + break; + case SVPD_ID_TYPE_EUI64: + sbuf_printf(sb, "eui."); + break; + case SVPD_ID_TYPE_NAA: + sbuf_printf(sb, "naa."); + break; + case SVPD_ID_TYPE_SCSI_NAME: + break; + } + switch (desc->proto_codeset & SVPD_ID_CODESET_MASK) { + case SVPD_ID_CODESET_BINARY: + for (i = 0; i < desc->length; i++) + sbuf_printf(sb, "%02x", desc->identifier[i]); + break; + case SVPD_ID_CODESET_ASCII: + sbuf_printf(sb, "%.*s", (int)desc->length, + (char *)desc->identifier); + break; + case SVPD_ID_CODESET_UTF8: + sbuf_printf(sb, "%s", (char *)desc->identifier); + break; + } +} + static int ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td) @@ -3290,6 +3327,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, struct ctl_port *port; struct ctl_lun_list *list; struct ctl_option *opt; + int j; list = (struct ctl_lun_list *)addr; @@ -3346,15 +3384,17 @@ ctl_ioctl(struct cdev *dev, u_long cmd, if (retval != 0) break; - retval = sbuf_printf(sb, "\t%#jx\n", - (uintmax_t)port->wwnn); - if (retval != 0) - break; + if (port->target_devid != NULL) { + sbuf_printf(sb, "\t"); + ctl_id_sbuf(port->target_devid, sb); + sbuf_printf(sb, "\n"); + } - retval = sbuf_printf(sb, "\t%#jx\n", - (uintmax_t)port->wwpn); - if (retval != 0) - break; + if (port->port_devid != NULL) { + sbuf_printf(sb, "\t"); + ctl_id_sbuf(port->port_devid, sb); + sbuf_printf(sb, "\n"); + } if (port->port_info != NULL) { retval = port->port_info(port->onoff_arg, sb); @@ -3368,6 +3408,26 @@ ctl_ioctl(struct cdev *dev, u_long cmd, break; } + for (j = 0; j < CTL_MAX_INIT_PER_PORT; j++) { + if (port->wwpn_iid[j].in_use == 0 || + (port->wwpn_iid[j].wwpn == 0 && + port->wwpn_iid[j].name == NULL)) + continue; + + if (port->wwpn_iid[j].name != NULL) + retval = sbuf_printf(sb, + "\t%u %s\n", + j, port->wwpn_iid[j].name); + else + retval = sbuf_printf(sb, + "\t%u naa.%08jx\n", + j, port->wwpn_iid[j].wwpn); + if (retval != 0) + break; + } + if (retval != 0) + break; + retval = sbuf_printf(sb, "\n"); if (retval != 0) break; Modified: stable/10/usr.sbin/ctladm/ctladm.8 ============================================================================== --- stable/10/usr.sbin/ctladm/ctladm.8 Mon Oct 20 07:59:29 2014 (r273319) +++ stable/10/usr.sbin/ctladm/ctladm.8 Mon Oct 20 08:03:23 2014 (r273320) @@ -34,7 +34,7 @@ .\" $Id: //depot/users/kenm/FreeBSD-test2/usr.sbin/ctladm/ctladm.8#3 $ .\" $FreeBSD$ .\" -.Dd October 8, 2014 +.Dd October 12, 2014 .Dt CTLADM 8 .Os .Sh NAME @@ -193,6 +193,14 @@ .Op Fl q .Op Fl x .Nm +.Ic portlist +.Op Fl f Ar frontend +.Op Fl i +.Op Fl p Ar targ_port +.Op Fl q +.Op Fl v +.Op Fl x +.Nm .Ic dumpooa .Nm .Ic dumpstructs @@ -768,6 +776,22 @@ As a general rule, the WWPN must be diff .It Fl x Output the port list in XML format. .El +.It Ic portlist +List CTL frontend ports. +.Bl -tag -width 12n +.It Fl f Ar frontend +Specify the frontend type. +.It Fl i +Report target and connected initiators addresses +.It Fl p Ar targ_port +Specify the frontend port number. +.It Fl q +Omit the header in the port list output. +.It Fl v +Enable verbose output (report all port options). +.It Fl x +Output the port list in XML format. +.El .It Ic dumpooa Dump the OOA (Order Of Arrival) queue for each LUN registered with CTL. .It Ic dumpstructs Modified: stable/10/usr.sbin/ctladm/ctladm.c ============================================================================== --- stable/10/usr.sbin/ctladm/ctladm.c Mon Oct 20 07:59:29 2014 (r273319) +++ stable/10/usr.sbin/ctladm/ctladm.c Mon Oct 20 08:03:23 2014 (r273320) @@ -191,7 +191,7 @@ static struct ctladm_opts option_table[] {"modesense", CTLADM_CMD_MODESENSE, CTLADM_ARG_NEED_TL, "P:S:dlm:c:"}, {"modify", CTLADM_CMD_MODIFY, CTLADM_ARG_NONE, "b:l:s:"}, {"port", CTLADM_CMD_PORT, CTLADM_ARG_NONE, "lo:p:qt:w:W:x"}, - {"portlist", CTLADM_CMD_PORTLIST, CTLADM_ARG_NONE, "f:vx"}, + {"portlist", CTLADM_CMD_PORTLIST, CTLADM_ARG_NONE, "f:ip:qvx"}, {"prin", CTLADM_CMD_PRES_IN, CTLADM_ARG_NEED_TL, "a:"}, {"prout", CTLADM_CMD_PRES_OUT, CTLADM_ARG_NEED_TL, "a:k:r:s:"}, {"read", CTLADM_CMD_READ, CTLADM_ARG_NEED_TL, rw_opts}, @@ -4100,7 +4100,8 @@ struct cctl_port { char *frontend_type; char *name; int pp, vp; - char *wwnn, *wwpn; + char *target, *port; + STAILQ_HEAD(,cctl_lun_nv) init_list; STAILQ_HEAD(,cctl_lun_nv) attr_list; STAILQ_ENTRY(cctl_port) links; }; @@ -4144,6 +4145,7 @@ cctl_start_pelement(void *user_data, con portlist->num_ports++; portlist->cur_port = cur_port; + STAILQ_INIT(&cur_port->init_list); STAILQ_INIT(&cur_port->attr_list); STAILQ_INSERT_TAIL(&portlist->port_list, cur_port, links); @@ -4205,11 +4207,11 @@ cctl_end_pelement(void *user_data, const cur_port->pp = strtoull(str, NULL, 0); } else if (strcmp(name, "virtual_port") == 0) { cur_port->vp = strtoull(str, NULL, 0); - } else if (strcmp(name, "wwnn") == 0) { - cur_port->wwnn = str; + } else if (strcmp(name, "target") == 0) { + cur_port->target = str; str = NULL; - } else if (strcmp(name, "wwpn") == 0) { - cur_port->wwpn = str; + } else if (strcmp(name, "port") == 0) { + cur_port->port = str; str = NULL; } else if (strcmp(name, "targ_port") == 0) { portlist->cur_port = NULL; @@ -4230,7 +4232,10 @@ cctl_end_pelement(void *user_data, const nv->value = str; str = NULL; - STAILQ_INSERT_TAIL(&cur_port->attr_list, nv, links); + if (strcmp(name, "initiator") == 0) + STAILQ_INSERT_TAIL(&cur_port->init_list, nv, links); + else + STAILQ_INSERT_TAIL(&cur_port->attr_list, nv, links); } free(str); @@ -4258,7 +4263,8 @@ cctl_portlist(int fd, int argc, char **a int dump_xml = 0; int retval, c; char *frontend = NULL; - int verbose = 0; + uint64_t portarg = UINT64_MAX; + int verbose = 0, init = 0, quiet = 0; retval = 0; port_len = 4096; @@ -4271,6 +4277,15 @@ cctl_portlist(int fd, int argc, char **a case 'f': frontend = strdup(optarg); break; + case 'i': + init++; + break; + case 'p': + portarg = strtoll(optarg, NULL, 0); + break; + case 'q': + quiet++; + break; case 'v': verbose++; break; @@ -4327,8 +4342,8 @@ retry: goto bailout; } - printf("Port Online Frontend %-12s pp vp %-18s %-18s\n", - "Name", "WWNN", "WWPN"); + if (quiet == 0) + printf("Port Online Frontend Name pp vp\n"); STAILQ_FOREACH(port, &portlist.port_list, links) { struct cctl_lun_nv *nv; @@ -4336,16 +4351,26 @@ retry: && (strcmp(port->frontend_type, frontend) != 0)) continue; - printf("%-4ju %-6s %-8s %-12s %-2d %-2d %-18s %-18s\n", + if ((portarg != UINT64_MAX) && (portarg != port->port_id)) + continue; + + printf("%-4ju %-6s %-8s %-8s %-2d %-2d %s\n", (uintmax_t)port->port_id, port->online, port->frontend_type, port->name, port->pp, port->vp, - port->wwnn, port->wwpn); + port->port ? port->port : ""); - if (verbose == 0) - continue; + if (init || verbose) { + if (port->target) + printf(" Target: %s\n", port->target); + STAILQ_FOREACH(nv, &port->init_list, links) { + printf(" Initiator: %s\n", nv->value); + } + } - STAILQ_FOREACH(nv, &port->attr_list, links) { - printf(" %s=%s\n", nv->name, nv->value); + if (verbose) { + STAILQ_FOREACH(nv, &port->attr_list, links) { + printf(" %s=%s\n", nv->name, nv->value); + } } } bailout: @@ -4401,7 +4426,7 @@ usage(int error) " [-s len fmt [args]] [-c] [-d delete_id]\n" " ctladm port <-l | -o | [-w wwnn][-W wwpn]>\n" " [-p targ_port] [-t port_type] [-q] [-x]\n" -" ctladm portlist [-f frontend] [-v] [-x]\n" +" ctladm portlist [-f frontend] [-i] [-p targ_port] [-q] [-v] [-x]\n" " ctladm islist [-v | -x]\n" " ctladm islogout <-a | -c connection-id | -i name | -p portal>\n" " ctladm isterminate <-a | -c connection-id | -i name | -p portal>\n" @@ -4487,6 +4512,13 @@ usage(int error) "-p targ_port : specify target port number\n" "-q : omit header in list output\n" "-x : output port list in XML format\n" +"portlist options:\n" +"-f fronetnd : specify frontend type\n" +"-i : report target and initiators addresses\n" +"-p targ_port : specify target port number\n" +"-q : omit header in list output\n" +"-v : verbose output (report all port options)\n" +"-x : output port list in XML format\n" "bbrread options:\n" "-l lba : starting LBA\n" "-d datalen : length, in bytes, to read\n", From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 08:04:47 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 599B372D; Mon, 20 Oct 2014 08:04:47 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 45A64BED; Mon, 20 Oct 2014 08:04:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K84lDo088768; Mon, 20 Oct 2014 08:04:47 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K84lU5088767; Mon, 20 Oct 2014 08:04:47 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410200804.s9K84lU5088767@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 20 Oct 2014 08:04:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273321 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 08:04:47 -0000 Author: mav Date: Mon Oct 20 08:04:46 2014 New Revision: 273321 URL: https://svnweb.freebsd.org/changeset/base/273321 Log: MFC r273008: Remove stale comments. Modified: stable/10/sys/cam/ctl/scsi_ctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/scsi_ctl.c ============================================================================== --- stable/10/sys/cam/ctl/scsi_ctl.c Mon Oct 20 08:03:23 2014 (r273320) +++ stable/10/sys/cam/ctl/scsi_ctl.c Mon Oct 20 08:04:46 2014 (r273321) @@ -1513,11 +1513,6 @@ ctlfedone(struct cam_periph *periph, uni case CAM_MESSAGE_RECV: switch (inot->arg) { case MSG_ABORT_TASK_SET: - /* - * XXX KDM this isn't currently - * supported by CTL. It ends up - * being a no-op. - */ io->taskio.task_action = CTL_TASK_ABORT_TASK_SET; break; @@ -1534,11 +1529,6 @@ ctlfedone(struct cam_periph *periph, uni CTL_TASK_LUN_RESET; break; case MSG_CLEAR_TASK_SET: - /* - * XXX KDM this isn't currently - * supported by CTL. It ends up - * being a no-op. - */ io->taskio.task_action = CTL_TASK_CLEAR_TASK_SET; break; From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 08:06:18 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 509C487C; Mon, 20 Oct 2014 08:06:18 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 228FABFA; Mon, 20 Oct 2014 08:06:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K86I1h089041; Mon, 20 Oct 2014 08:06:18 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K86IYm089040; Mon, 20 Oct 2014 08:06:18 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410200806.s9K86IYm089040@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 20 Oct 2014 08:06:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273322 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 08:06:18 -0000 Author: mav Date: Mon Oct 20 08:06:17 2014 New Revision: 273322 URL: https://svnweb.freebsd.org/changeset/base/273322 Log: MFC r273029: Report physical block size for file-backed LUNs, using vattr.va_blocksize. Modified: stable/10/sys/cam/ctl/ctl_backend_block.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_backend_block.c Mon Oct 20 08:04:46 2014 (r273321) +++ stable/10/sys/cam/ctl/ctl_backend_block.c Mon Oct 20 08:06:17 2014 (r273322) @@ -1545,6 +1545,7 @@ ctl_be_block_open_file(struct ctl_be_blo struct ctl_be_block_filedata *file_data; struct ctl_lun_create_params *params; struct vattr vattr; + off_t pss; int error; error = 0; @@ -1593,21 +1594,21 @@ ctl_be_block_open_file(struct ctl_be_blo be_lun->flags |= CTL_BE_BLOCK_LUN_MULTI_THREAD; /* - * XXX KDM vattr.va_blocksize may be larger than 512 bytes here. - * With ZFS, it is 131072 bytes. Block sizes that large don't work - * with disklabel and UFS on FreeBSD at least. Large block sizes - * may not work with other OSes as well. So just export a sector - * size of 512 bytes, which should work with any OS or - * application. Since our backing is a file, any block size will - * work fine for the backing store. + * For files we can use any logical block size. Prefer 512 bytes + * for compatibility reasons. If file's vattr.va_blocksize + * (preferred I/O block size) is bigger and multiple to chosen + * logical block size -- report it as physical block size. */ -#if 0 - be_lun->blocksize= vattr.va_blocksize; -#endif if (params->blocksize_bytes != 0) be_lun->blocksize = params->blocksize_bytes; else be_lun->blocksize = 512; + pss = vattr.va_blocksize / be_lun->blocksize; + if ((pss > 0) && (pss * be_lun->blocksize == vattr.va_blocksize) && + ((pss & (pss - 1)) == 0)) { + be_lun->pblockexp = fls(pss) - 1; + be_lun->pblockoff = 0; + } /* * Sanity check. The media size has to be at least one From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 08:07:31 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 961B59AA; Mon, 20 Oct 2014 08:07:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 81975C06; Mon, 20 Oct 2014 08:07:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K87VA2089253; Mon, 20 Oct 2014 08:07:31 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K87UtX089249; Mon, 20 Oct 2014 08:07:30 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410200807.s9K87UtX089249@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 20 Oct 2014 08:07:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273323 - in stable/10/sys/cam: ctl scsi X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 08:07:31 -0000 Author: mav Date: Mon Oct 20 08:07:29 2014 New Revision: 273323 URL: https://svnweb.freebsd.org/changeset/base/273323 Log: MFC r273038: Add support for READ DEFECT DATA (10/12) commands. SPC-4 r2 allows to return empty defect list if the list is not supported. We don't reallu support defect data lists, but this suppresses some errors. Modified: stable/10/sys/cam/ctl/ctl.c stable/10/sys/cam/ctl/ctl_cmd_table.c stable/10/sys/cam/ctl/ctl_private.h stable/10/sys/cam/scsi/scsi_da.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Mon Oct 20 08:06:17 2014 (r273322) +++ stable/10/sys/cam/ctl/ctl.c Mon Oct 20 08:07:29 2014 (r273323) @@ -7391,6 +7391,89 @@ ctl_read_capacity_16(struct ctl_scsiio * } int +ctl_read_defect(struct ctl_scsiio *ctsio) +{ + struct scsi_read_defect_data_10 *ccb10; + struct scsi_read_defect_data_12 *ccb12; + struct scsi_read_defect_data_hdr_10 *data10; + struct scsi_read_defect_data_hdr_12 *data12; + struct ctl_lun *lun; + uint32_t alloc_len, data_len; + uint8_t format; + + CTL_DEBUG_PRINT(("ctl_read_defect\n")); + + lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + if (lun->flags & CTL_LUN_PR_RESERVED) { + uint32_t residx; + + /* + * XXX KDM need a lock here. + */ + residx = ctl_get_resindex(&ctsio->io_hdr.nexus); + if ((lun->res_type == SPR_TYPE_EX_AC + && residx != lun->pr_res_idx) + || ((lun->res_type == SPR_TYPE_EX_AC_RO + || lun->res_type == SPR_TYPE_EX_AC_AR) + && lun->pr_keys[residx] == 0)) { + ctl_set_reservation_conflict(ctsio); + ctl_done((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); + } + } + + if (ctsio->cdb[0] == READ_DEFECT_DATA_10) { + ccb10 = (struct scsi_read_defect_data_10 *)&ctsio->cdb; + format = ccb10->format; + alloc_len = scsi_2btoul(ccb10->alloc_length); + data_len = sizeof(*data10); + } else { + ccb12 = (struct scsi_read_defect_data_12 *)&ctsio->cdb; + format = ccb12->format; + alloc_len = scsi_4btoul(ccb12->alloc_length); + data_len = sizeof(*data12); + } + if (alloc_len == 0) { + ctl_set_success(ctsio); + ctl_done((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); + } + + ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); + if (data_len < alloc_len) { + ctsio->residual = alloc_len - data_len; + ctsio->kern_data_len = data_len; + ctsio->kern_total_len = data_len; + } else { + ctsio->residual = 0; + ctsio->kern_data_len = alloc_len; + ctsio->kern_total_len = alloc_len; + } + ctsio->kern_data_resid = 0; + ctsio->kern_rel_offset = 0; + ctsio->kern_sg_entries = 0; + + if (ctsio->cdb[0] == READ_DEFECT_DATA_10) { + data10 = (struct scsi_read_defect_data_hdr_10 *) + ctsio->kern_data_ptr; + data10->format = format; + scsi_ulto2b(0, data10->length); + } else { + data12 = (struct scsi_read_defect_data_hdr_12 *) + ctsio->kern_data_ptr; + data12->format = format; + scsi_ulto2b(0, data12->generation); + scsi_ulto4b(0, data12->length); + } + + ctsio->scsi_status = SCSI_STATUS_OK; + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; + ctsio->be_move_done = ctl_config_move_done; + ctl_datamove((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); +} + +int ctl_report_tagret_port_groups(struct ctl_scsiio *ctsio) { struct scsi_maintenance_in *cdb; Modified: stable/10/sys/cam/ctl/ctl_cmd_table.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_cmd_table.c Mon Oct 20 08:06:17 2014 (r273322) +++ stable/10/sys/cam/ctl/ctl_cmd_table.c Mon Oct 20 08:07:29 2014 (r273323) @@ -768,7 +768,11 @@ const struct ctl_cmd_entry ctl_cmd_table {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, /* 37 READ DEFECT DATA(10) */ -{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, +{ctl_read_defect, CTL_SERIDX_MD_SNS, CTL_CMD_FLAG_OK_ON_SLUN | + CTL_FLAG_DATA_IN | + CTL_CMD_FLAG_ALLOW_ON_PR_RESV, + CTL_LUN_PAT_NONE, + 10, {0, 0x1f, 0, 0, 0, 0, 0xff, 0xff, 0x07}}, /* 38 MEDIUM SCAN */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, @@ -1247,7 +1251,11 @@ const struct ctl_cmd_entry ctl_cmd_table {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, /* B7 READ DEFECT DATA(12) */ -{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, +{ctl_read_defect, CTL_SERIDX_MD_SNS, CTL_CMD_FLAG_OK_ON_SLUN | + CTL_FLAG_DATA_IN | + CTL_CMD_FLAG_ALLOW_ON_PR_RESV, + CTL_LUN_PAT_NONE, + 12, {0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, /* B8 READ ELEMENT STATUS */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, Modified: stable/10/sys/cam/ctl/ctl_private.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_private.h Mon Oct 20 08:06:17 2014 (r273322) +++ stable/10/sys/cam/ctl/ctl_private.h Mon Oct 20 08:07:29 2014 (r273323) @@ -486,6 +486,7 @@ int ctl_mode_select(struct ctl_scsiio *c int ctl_mode_sense(struct ctl_scsiio *ctsio); int ctl_read_capacity(struct ctl_scsiio *ctsio); int ctl_read_capacity_16(struct ctl_scsiio *ctsio); +int ctl_read_defect(struct ctl_scsiio *ctsio); int ctl_read_write(struct ctl_scsiio *ctsio); int ctl_cnw(struct ctl_scsiio *ctsio); int ctl_report_luns(struct ctl_scsiio *ctsio); Modified: stable/10/sys/cam/scsi/scsi_da.h ============================================================================== --- stable/10/sys/cam/scsi/scsi_da.h Mon Oct 20 08:06:17 2014 (r273322) +++ stable/10/sys/cam/scsi/scsi_da.h Mon Oct 20 08:07:29 2014 (r273323) @@ -92,28 +92,19 @@ struct scsi_reassign_blocks struct scsi_read_defect_data_10 { - u_int8_t opcode; - - /* - * The most significant 3 bits are the LUN, the other 5 are - * reserved. - */ -#define SRDD10_LUN_MASK 0xE0 - u_int8_t byte2; + uint8_t opcode; + uint8_t byte2; #define SRDD10_GLIST 0x08 #define SRDD10_PLIST 0x10 #define SRDD10_DLIST_FORMAT_MASK 0x07 #define SRDD10_BLOCK_FORMAT 0x00 #define SRDD10_BYTES_FROM_INDEX_FORMAT 0x04 #define SRDD10_PHYSICAL_SECTOR_FORMAT 0x05 - u_int8_t format; - - u_int8_t reserved[4]; - - u_int8_t alloc_length[2]; + uint8_t format; + uint8_t reserved[4]; + uint8_t alloc_length[2]; #define SRDD10_MAX_LENGTH 0xffff - - u_int8_t control; + uint8_t control; }; struct scsi_sanitize @@ -143,29 +134,18 @@ struct scsi_sanitize_parameter_list struct scsi_read_defect_data_12 { - u_int8_t opcode; - - /* - * The most significant 3 bits are the LUN, the other 5 are - * reserved. - */ -#define SRDD12_LUN_MASK 0xE0 - u_int8_t byte2; - + uint8_t opcode; #define SRDD12_GLIST 0x08 #define SRDD12_PLIST 0x10 #define SRDD12_DLIST_FORMAT_MASK 0x07 #define SRDD12_BLOCK_FORMAT 0x00 #define SRDD12_BYTES_FROM_INDEX_FORMAT 0x04 #define SRDD12_PHYSICAL_SECTOR_FORMAT 0x05 - u_int8_t format; - - u_int8_t reserved[4]; - - u_int8_t alloc_length[4]; - - u_int8_t control; - + uint8_t format; + uint8_t address_descriptor_index[4]; + uint8_t alloc_length[4]; + uint8_t reserved; + uint8_t control; }; @@ -376,6 +356,7 @@ struct scsi_read_defect_data_hdr_12 #define SRDDH12_BYTES_FROM_INDEX_FORMAT 0x04 #define SRDDH12_PHYSICAL_SECTOR_FORMAT 0x05 u_int8_t format; + u_int8_t generation[2]; u_int8_t length[4]; }; From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 08:08:44 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F29E7B1C; Mon, 20 Oct 2014 08:08:43 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DEB56C18; Mon, 20 Oct 2014 08:08:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K88hEQ089459; Mon, 20 Oct 2014 08:08:43 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K88htU089458; Mon, 20 Oct 2014 08:08:43 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410200808.s9K88htU089458@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 20 Oct 2014 08:08:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273324 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 08:08:44 -0000 Author: mav Date: Mon Oct 20 08:08:43 2014 New Revision: 273324 URL: https://svnweb.freebsd.org/changeset/base/273324 Log: MFC r273046: Don't confuse frontend with zero length data moves, just return immediately. Modified: stable/10/sys/cam/ctl/ctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Mon Oct 20 08:07:29 2014 (r273323) +++ stable/10/sys/cam/ctl/ctl.c Mon Oct 20 08:08:43 2014 (r273324) @@ -10823,15 +10823,9 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio } ctsio->scsi_status = SCSI_STATUS_OK; - if (ctsio->kern_data_len > 0) { - ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; - ctsio->be_move_done = ctl_config_move_done; - ctl_datamove((union ctl_io *)ctsio); - } else { - ctsio->io_hdr.status = CTL_SUCCESS; - ctl_done((union ctl_io *)ctsio); - } - + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; + ctsio->be_move_done = ctl_config_move_done; + ctl_datamove((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); } @@ -12903,6 +12897,12 @@ ctl_datamove(union ctl_io *io) return; } + /* Don't confuse frontend with zero length data move. */ + if (io->scsiio.kern_data_len == 0) { + io->scsiio.be_move_done(io); + return; + } + /* * If we're in XFER mode and this I/O is from the other shelf * controller, we need to send the DMA to the other side to From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 08:09:37 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AA49FC52; Mon, 20 Oct 2014 08:09:37 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9659FC21; Mon, 20 Oct 2014 08:09:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K89b4t089982; Mon, 20 Oct 2014 08:09:37 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K89bPZ089980; Mon, 20 Oct 2014 08:09:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410200809.s9K89bPZ089980@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 20 Oct 2014 08:09:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273325 - in stable/10: share/misc sys/cam/scsi X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 08:09:37 -0000 Author: mav Date: Mon Oct 20 08:09:36 2014 New Revision: 273325 URL: https://svnweb.freebsd.org/changeset/base/273325 Log: MFC r273072: Add LBPERE mode bit definition. Modified: stable/10/share/misc/scsi_modes stable/10/sys/cam/scsi/scsi_da.h Directory Properties: stable/10/ (props changed) Modified: stable/10/share/misc/scsi_modes ============================================================================== --- stable/10/share/misc/scsi_modes Mon Oct 20 08:08:43 2014 (r273324) +++ stable/10/share/misc/scsi_modes Mon Oct 20 08:09:36 2014 (r273325) @@ -223,7 +223,8 @@ {Correction Span} i1 {Head Offset Count} i1 {Data Strobe Offset Count} i1 - {Reserved} *i1 + {LBPERE (LBP Error Reporting Enabled)} t1 + {Reserved} *t7 {Write Retry Count} i1 {Reserved} *i1 {Recovery Time Limit} i2 Modified: stable/10/sys/cam/scsi/scsi_da.h ============================================================================== --- stable/10/sys/cam/scsi/scsi_da.h Mon Oct 20 08:08:43 2014 (r273324) +++ stable/10/sys/cam/scsi/scsi_da.h Mon Oct 20 08:09:36 2014 (r273325) @@ -527,7 +527,8 @@ struct scsi_da_rw_recovery_page { u_int8_t correction_span; u_int8_t head_offset_count; u_int8_t data_strobe_offset_cnt; - u_int8_t reserved; + u_int8_t byte8; +#define SMS_RWER_LBPERE 0x80 u_int8_t write_retry_count; u_int8_t reserved2; u_int8_t recovery_time_limit[2]; From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 08:59:31 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3BA72CAA; Mon, 20 Oct 2014 08:59:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0EF1515B; Mon, 20 Oct 2014 08:59:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K8xU2g015378; Mon, 20 Oct 2014 08:59:30 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K8xUvP015377; Mon, 20 Oct 2014 08:59:30 GMT (envelope-from des@FreeBSD.org) Message-Id: <201410200859.s9K8xUvP015377@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: des set sender to des@FreeBSD.org using -f From: Dag-Erling Smørgrav Date: Mon, 20 Oct 2014 08:59:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273326 - stable/10/contrib/openpam/lib/libpam X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 08:59:31 -0000 Author: des Date: Mon Oct 20 08:59:30 2014 New Revision: 273326 URL: https://svnweb.freebsd.org/changeset/base/273326 Log: MFH (r273273): Merge upstream r825: fix line continuation in whitespace Modified: stable/10/contrib/openpam/lib/libpam/openpam_readword.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/openpam/lib/libpam/openpam_readword.c ============================================================================== --- stable/10/contrib/openpam/lib/libpam/openpam_readword.c Mon Oct 20 08:09:36 2014 (r273325) +++ stable/10/contrib/openpam/lib/libpam/openpam_readword.c Mon Oct 20 08:59:30 2014 (r273326) @@ -55,18 +55,35 @@ openpam_readword(FILE *f, int *lineno, s { char *word; size_t size, len; - int ch, comment, escape, quote; + int ch, escape, quote; int serrno; errno = 0; /* skip initial whitespace */ - comment = 0; - while ((ch = getc(f)) != EOF && ch != '\n') { - if (ch == '#') - comment = 1; - if (!is_lws(ch) && !comment) + escape = quote = 0; + while ((ch = getc(f)) != EOF) { + if (ch == '\n') { + /* either EOL or line continuation */ + if (!escape) + break; + if (lineno != NULL) + ++*lineno; + escape = 0; + } else if (escape) { + /* escaped something else */ + break; + } else if (ch == '#') { + /* comment: until EOL, no continuation */ + while ((ch = getc(f)) != EOF) + if (ch == '\n') + break; break; + } else if (ch == '\\') { + escape = 1; + } else if (!is_ws(ch)) { + break; + } } if (ch == EOF) return (NULL); @@ -76,7 +93,6 @@ openpam_readword(FILE *f, int *lineno, s word = NULL; size = len = 0; - escape = quote = 0; while ((ch = fgetc(f)) != EOF && (!is_ws(ch) || quote || escape)) { if (ch == '\\' && !escape && quote != '\'') { /* escape next character */ @@ -90,7 +106,7 @@ openpam_readword(FILE *f, int *lineno, s } else if (ch == quote && !escape) { /* end quote */ quote = 0; - } else if (ch == '\n' && escape && quote != '\'') { + } else if (ch == '\n' && escape) { /* line continuation */ escape = 0; } else { From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 11:21:08 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0D80AA6D; Mon, 20 Oct 2014 11:21:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EDDC1663; Mon, 20 Oct 2014 11:21:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KBL7ud096350; Mon, 20 Oct 2014 11:21:07 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KBL7JH096349; Mon, 20 Oct 2014 11:21:07 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201410201121.s9KBL7JH096349@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Mon, 20 Oct 2014 11:21:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273327 - head/sys/netpfil/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 11:21:08 -0000 Author: melifaro Date: Mon Oct 20 11:21:07 2014 New Revision: 273327 URL: https://svnweb.freebsd.org/changeset/base/273327 Log: Use copyout() directly instead of updating various fields before/after each sooptcopyout() call. Found by: luigi Sponsored by: Yandex LLC Modified: head/sys/netpfil/ipfw/ip_fw_sockopt.c Modified: head/sys/netpfil/ipfw/ip_fw_sockopt.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_sockopt.c Mon Oct 20 08:59:30 2014 (r273326) +++ head/sys/netpfil/ipfw/ip_fw_sockopt.c Mon Oct 20 11:21:07 2014 (r273327) @@ -2535,30 +2535,33 @@ ipfw_del_sopt_handler(struct ipfw_sopt_h static int ipfw_flush_sopt_data(struct sockopt_data *sd) { -#define RULE_MAXSIZE (512*sizeof(u_int32_t)) + struct sockopt *sopt; int error; size_t sz; - if ((sz = sd->koff) == 0) + sz = sd->koff; + if (sz == 0) return (0); - if (sd->sopt->sopt_dir == SOPT_GET) { - error = sooptcopyout(sd->sopt, sd->kbuf, sz); + sopt = sd->sopt; + + if (sopt->sopt_dir == SOPT_GET) { + error = copyout(sd->kbuf, sopt->sopt_val, sz); if (error != 0) return (error); } memset(sd->kbuf, 0, sd->ksize); - sd->ktotal += sd->koff; + sd->ktotal += sz; sd->koff = 0; if (sd->ktotal + sd->ksize < sd->valsize) sd->kavail = sd->ksize; else sd->kavail = sd->valsize - sd->ktotal; - /* Update sopt buffer */ - sd->sopt->sopt_valsize = sd->ktotal; - sd->sopt->sopt_val = sd->sopt_val + sd->ktotal; + /* Update sopt buffer data */ + sopt->sopt_valsize = sd->ktotal; + sopt->sopt_val = sd->sopt_val + sd->ktotal; return (0); } From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 12:47:29 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1FE7C788; Mon, 20 Oct 2014 12:47:29 +0000 (UTC) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id A6214F17; Mon, 20 Oct 2014 12:47:28 +0000 (UTC) Received: from c122-106-147-133.carlnfd1.nsw.optusnet.com.au (c122-106-147-133.carlnfd1.nsw.optusnet.com.au [122.106.147.133]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id 4B05A4240CA; Mon, 20 Oct 2014 23:47:19 +1100 (AEDT) Date: Mon, 20 Oct 2014 23:47:18 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Hiroki Sato Subject: Re: svn commit: r273295 - in head/sbin: ping ping6 In-Reply-To: <20141020.162907.106891462107570268.hrs@allbsd.org> Message-ID: <20141020204324.K913@besplex.bde.org> References: <201410200027.s9K0RegN062458@svn.freebsd.org> <20141020140848.D935@besplex.bde.org> <20141020.162907.106891462107570268.hrs@allbsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=dMCfxopb c=1 sm=1 tr=0 a=7NqvjVvQucbO2RlWB8PEog==:117 a=PO7r1zJSAAAA:8 a=kj9zAlcOel0A:10 a=JzwRw_2MAAAA:8 a=p_RFkTfqcLTqdni3OYcA:9 a=yIE4LVJX8x7CMHjK:21 a=RrRjPvj0TDJZaVYh:21 a=cR5uNpvTFSLpZS-F:21 a=CjuIK1q_8ugA:10 a=oZ2IPoelaH8A:10 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, brde@optusnet.com.au X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 12:47:29 -0000 On Mon, 20 Oct 2014, Hiroki Sato wrote: > Thank you for your review. I fixed lines you pointed out and > attached a patch candidate. I will show each change line by line in > this email, too: Thanks. > Bruce Evans wrote > in <20141020140848.D935@besplex.bde.org>: > > br> > - if (cc - ICMP_MINLEN - phdr_len >= sizeof(tv1)) { > br> > + if ((size_t)(cc - ICMP_MINLEN - phdr_len) >= > br> > + sizeof(tv1)) { > br> > /* Copy to avoid alignment problems: */ > br> > memcpy(&tv32, tp, sizeof(tv32)); > br> > tv1.tv_sec = ntohl(tv32.tv32_sec); > br> > br> This breaks the warning, and breaks the code on exotic (unsupported) > br> where it used to work accidentally. The code was already broken on > br> non-exotic arches. > > - if ((size_t)(cc - ICMP_MINLEN - phdr_len) >= > - sizeof(tv1)) { > + if (cc - ICMP_MINLEN - phdr_len >= (int)sizeof(tv1)) { I tested this. I couldn't get it to fail, but noticed another type error and re-noticed associated style bugs. The packet format is a network 32+32-bit timeval, and that is what is copied, but the bounds check is for a host timeval. On i386, network timeval == host timeval so there is no problem. On other 32-bit systems with 32+32-bit timevals, ntohl() fixes up the byte order if necessary. But on N-bit systems with >64-bit timevals, ping -s 8 is broken. It should send a 32+32-bit timeval but either doesn't send it or can't receive it. Such systems include: - most 64-bit systems. All supported ones. Most have a 64-bit time_t, and if they didn't then all supported ones have 64-bit longs so a timeval would consist of a 32-bit time_t, 32 bits of padding, and a 64-bit long. ping -s 15 doesn't work on these systems, but ping -s 16 does. - 32-bit systems with 64-bit time_t. All supported ones have only 32-bit 32-bit longs and probably have no padding, so they have 96-bit time_t and ping -s 12 would work. ping -s 8 worked on i386 in my simple tests because phdr_len is normally 0 (I don't know how to make it nonzero). The full packet size is then 36. This consists of hlen = 20, ICMP_MINLEN = 8, phdr_len = 0, and a payload consisting of the network 8-byte timeval. The style bugs here are that there is a macro TIMEVAL_LEN that is used in some places to obfuscate the problem. I don't know much about networking but have hacked on ping a bit and have old code with comments about this: % diff -u2 ping.c~ ping.c *** ping.c~ Sat Apr 10 12:10:59 2004 --- ping.c Sat Apr 10 12:11:00 2004 % @@ -93,4 +93,9 @@ % % #define INADDR_LEN ((int)sizeof(in_addr_t)) % +/* % + * XXX this macro used to hide the details of the packet layout, but it now % + * just obfuscates timevals and is not even consistently used for the size % + * of a timeval. % + */ % #define TIMEVAL_LEN ((int)sizeof(struct timeval)) % #define MASK_LEN (ICMP_MASKLEN - ICMP_MINLEN) The obfuscation has increased in -current. The above is broken since it uses host timevals. This has been fixed in -current by replacing 'timeval' by 'tv32', but that increases the obfuscation because the macro still looks like it is for a host timeval. Note that the macro already has a cast to int in it (presumably to fix warnings), so changing the patch to use it will fix both problems. But I don't like the obfuscation of that. It is good practice to use sizeof(var) instead of sizeof(typedef_name) like the code does now. This gives a better chance of applying sizeof() to the right variable although that is not done now. It was done in the old version that was broken by using host timevals. That version was consistently broken -- it didn't have tv2, and it both the sizeof and the copy were done on tv1. Further review showed that TIMEVAL_LEN is used a lot and is clearer than '(int)sizeof(struct tv32)' all over. Just rename it to something like NTIMEVAL_LEN so that it is clear that it is for a network timeval. Grepping for sizeof shows just one place where sizeof() is applied to struct timeval. This allocates space for a message. I think this should use struct tv32 too, but allocating more space than is needed and sending a larger message than needed is fairly harmless. Only 6 out of 32 lines have the style bug of following sizeof by a space. All of these also have the style bug of not parenthesizing the arg. ping6.c doesn't have TIMEVAL, and also doesn't seem to have the bug -- ping6 -s 8 works on freefall. > br> > +static u_int8_t nonce[8]; /* nonce field for node information */ > br> > br> This uses the deprecated nonstandard spelling of uint8_t. > > s/u_int_{8,16,32}_t/uint_{8,16,32}_t/ in various places. I don't like changing old code like that. Makes it hard to see important changes. You actually changed u_int8_t to u_char. > br> > - sockbufsize = lsockbufsize; > br> > + sockbufsize = (int)lsockbufsize; > br> > if (errno || !*optarg || *e || > br> > - sockbufsize != lsockbufsize) > br> > + lsockbufsize > INT_MAX) > br> > errx(1, "invalid socket buffer size"); > > br> I don't like warnings about hackish but correct code like the previous > br> version of the above. Does the compiler actually complain about > br> comparing > br> ints with unsigned longs for equality? > > Yes, this part caused the following warning: > > /usr/src/head/sbin/ping6/ping6.c:395:20: error: comparison of integers of > different signs: 'int' and 'u_long' (aka 'unsigned long') > [-Werror,-Wsign-compare] > sockbufsize != lsockbufsize) ping has much better args handling than ping6. wollman changed it from sloppy atoi()s to reasonable strtoul()s in 1997. strtoul() is easier to use than usual because most of the args have a lower limit of 0 and an upper limit of less than ULONG_MAX so simple range checks work. The methods of setting errno to 0 before the call and checking it afterwards are never needed or used. Most cases seem to be correct. ping6 was apparently fixed separatlely, not as well, and never merged. It uses errno or strtoul() only in the code quoted above. It mostly uses strtol() with the base restricted to 10 instead of strtoul() with the base unrestricted as in ping. Most cases are broken using the technique of assigning the long result to an int variable before checking it. % Index: ping6.c % =================================================================== % --- ping6.c (revision 273295) % +++ ping6.c (working copy) % @@ -136,8 +137,8 @@ % #include % % struct tv32 { % - u_int32_t tv32_sec; % - u_int32_t tv32_usec; % + uint32_t tv32_sec; % + uint32_t tv32_usec; % }; tv32 actually consists of a 32-bit time_t and a 32-bit long. The first is signed on all supported arches. The second is always signed. This is surely harmless. There are lots of type puns no matter how this is declared. The host values started as signed, but are usually nonnegative so there is no problem. Even htonl() to a host time_t or long is a type error. It depends on 2's complement to work, but you get that using int32_t. % @@ -316,7 +316,7 @@ % char *policy_out = NULL; % #endif % double t; % - u_long alarmtimeout; % + u_long alarmtimeout, ultmp; % size_t rthlen; % #ifdef IPV6_USE_MIN_MTU % int mflag = 0; u_long is a bogus type for the alarm timeout. alarm() takes a u_int arg. ping.c has this bug too. All the alarmtimeout code in ping.c was obviously not cleaned up by Wollman in 1997, since has a different style and lower quality. u_long is used here mainly to assign the result of alarmtimeout directly to it, instead of using ultmp like almost everywhere else. Other style bugs include using excessive parentheses not checking for null operands in the usual way (this is only a style bug since null operands give an out-of-range operand of 0) and a bogus ULONG_MAX check (this is only a style bug since ULONG_MAX fails a correct range check later). Other bugs include not checking for garbage after the operand. Implementing these bugs takes about 50% more code (mainly to duplicate the err() message). That was for the arg parsing of alarmtimeout. Then when it is used, it is bogusly cast to int. The prototype would convert it to the correct type, u_int. Compilers should warn about either or none of the the explicit conversion to int or the prototype's conversion to u_int, depending on the warning level and whether thay can see that the range checking ensures that that the value always fits in an int. % @@ -388,11 +388,10 @@ % #if defined(SO_SNDBUF) && defined(SO_RCVBUF) % errno = 0; This can probably be removed too. % e = NULL; This was nonsense and can certainly be removed. The endptr parameter in the strtol() family is output-only. % - lsockbufsize = strtoul(optarg, &e, 10); % - sockbufsize = (int)lsockbufsize; % - if (errno || !*optarg || *e || % - lsockbufsize > INT_MAX) % + ultmp = strtoul(optarg, &e, 10); % + if (errno || !*optarg || *e || ultmp > INT_MAX) % errx(1, "invalid socket buffer size"); % + sockbufsize = ultmp; Compare with 1997 ping code. It is similar after removing errno. Other differences: - ping spells the endptr variable ep - ping doesn't limit the base to 10 - ping orders the test with *ep first - both use the boolean test for the non-boolean *ep, but only ping6 uses it for !*optarg. Anyway, the !*optarg test is broken. It only detects empty strings, while the correct test ep == optarg that is used by ping detects other garbage like strings consisting of only leading whitespace (maybe followed by a sign). % #else % errx(1, % "-b option ignored: SO_SNDBUF/SO_RCVBUF socket options not supported"); % @@ -522,14 +521,15 @@ % options |= F_SRCADDR; % break; % case 's': /* size of packet to send */ % - datalen = strtol(optarg, &e, 10); % - if (datalen <= 0 || *optarg == '\0' || *e != '\0') % - errx(1, "illegal datalen value -- %s", optarg); % - if (datalen > MAXDATALEN) { % - errx(1, % - "datalen value too large, maximum is %d", % + ultmp = strtoul(optarg, &e, 10); % + if (*e || e == optarg) % + errx(EX_USAGE, "invalid packet size: `%s'", % + optarg); % + if (ultmp > MAXDATALEN) % + errx(EX_USAGE, % + "packetsize too large, maximum is %d", % MAXDATALEN); % - } % + datalen = ultmp; % break; Here you seem to have mostly copied ping. ping requires privileges for sizes larger than DEFDATALEN. In the privileged case it is broken by not having a bounds check. In the unprivileged case, its error is EPERM, while the error is always EX_USAGE in the above. I don't like the restriction for ping. Is inet6 so much different that it doesn't need the restriction? I think inet4 never needed it after about 1990 in the US and a bit later here when anyone could afford a system for spamming the internet. Anyone could exercise the winping bug, but such bugs should have been fixed by now. The separate context-dependent messages in the above and in ping are not very useful. The first one is often incorrect. It says that the packet size is invalid, but the size has not been checked yet. Only the format of the arg has been checked. The second message is missing a space in "packet size" and has a grammar error (comman splice) in the above only. ping.c's second message also prints the value that is too large (this is more than echoing the arg, since it removes leading spaces and converts -1 to a huge u_long value). I wouldn't try hard to generate correct context-sensitive messages for all types of errors from strto*(). % @@ -718,7 +718,7 @@ % errx(1, "-f and -i incompatible options"); % % if ((options & F_NOUSERDATA) == 0) { % - if (datalen >= sizeof(struct tv32)) { % + if (datalen >= (int)sizeof(struct tv32)) { Another use for TIMEVAL_LEN. % @@ -1419,7 +1419,7 @@ % while (cp < ep) { % i = *cp; % if (i == 0 || cp != *sp) { % - if (strlcat((char *)buf, ".", bufsiz) >= bufsiz) % + if ((int)strlcat((char *)buf, ".", bufsiz) >= bufsiz) % return NULL; /*result overrun*/ % } % if (i == 0) I don't like strlcat() and haven't thought about code like this much. It returns size_t where snprintf() returns int. This causes them to have the opposite sign extension and possibly representability problems. I think the case is safe because all possible return values are small. % @@ -1812,7 +1813,7 @@ % * Bounds checking on the ancillary data buffer: % * subtract the size of a cmsg structure from the buffer size. % */ % - if (bufsize < (extlen + CMSG_SPACE(0))) { % + if (bufsize < (int)(extlen + CMSG_SPACE(0))) { % extlen = bufsize - CMSG_SPACE(0); % warnx("options truncated, showing only %u (total=%u)", % (unsigned int)(extlen / 8 - 1), Oops, it wasn't such a good idea to change bufsize from size_t. Now it interacts badly with strlcat() and CMSG*(). % @@ -1835,7 +1836,7 @@ % offset = inet6_opt_get_val(databuf, offset, % &value4, sizeof(value4)); % printf(" Jumbo Payload Opt: Length %u\n", % - (u_int32_t)ntohl(value4)); % + (uint32_t)ntohl(value4)); This case is bogus. ntohl() already returns uint32_t, so the cast has no effect. However it is only accidental that uint32_t matches the format arg. The correct cast is to u_int, but it is painful to fix all the print formats that have this bug (similarly for signed int). % @@ -2027,7 +2028,7 @@ % % for (off = 0; off < clen; off += sizeof(v)) { % memcpy(&v, cp + off, sizeof(v)); % - v = (u_int32_t)ntohl(v); % + v = (uint32_t)ntohl(v); This bogus cast has no effect at all. ntohl() returning uint32_t has been in POSIX since at least 2001, and BSD always assumed 32-bit longs so it didn't need this cast before 2001. % @@ -2072,16 +2073,16 @@ % * by the length of the data, but note that the detection algorithm % * is incomplete. We assume the latest draft by default. % */ % - if (nilen % (sizeof(u_int32_t) + sizeof(struct in6_addr)) == 0) % + if (nilen % (sizeof(uint32_t) + sizeof(struct in6_addr)) == 0) % withttl = 1; % while (nilen > 0) { % - u_int32_t ttl; % + uint32_t ttl; % % if (withttl) { % /* XXX: alignment? */ % - ttl = (u_int32_t)ntohl(*(u_int32_t *)cp); % - cp += sizeof(u_int32_t); % - nilen -= sizeof(u_int32_t); % + ttl = (uint32_t)ntohl(*(uint32_t *)cp); % + cp += sizeof(uint32_t); % + nilen -= sizeof(uint32_t); Lots more bogus casts. Why spell 4 as sizeof(uint32_t)? Spelling it as sizeof(var), where var is the uint32_t variable copied to would be a more useful spelling. % @@ -2527,7 +2528,7 @@ % % printf("Vr TC Flow Plen Nxt Hlim\n"); % printf(" %1x %02x %05x %04x %02x %02x\n", % - (ip6->ip6_vfc & IPV6_VERSION_MASK) >> 4, tc, (u_int32_t)ntohl(flow), % + (ip6->ip6_vfc & IPV6_VERSION_MASK) >> 4, tc, (uint32_t)ntohl(flow), % ntohs(ip6->ip6_plen), ip6->ip6_nxt, ip6->ip6_hlim); % if (!inet_ntop(AF_INET6, &ip6->ip6_src, ntop_buf, sizeof(ntop_buf))) % strlcpy(ntop_buf, "?", sizeof(ntop_buf)); Looks like most of the bogus casts were from a time when ntohl() returned long on some systems, but instead of fixing the format to match the type, the type was broken to match the format. Bruce From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 13:18:53 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 78B062BC; Mon, 20 Oct 2014 13:18:53 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6594C2E1; Mon, 20 Oct 2014 13:18:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KDIrhx054145; Mon, 20 Oct 2014 13:18:53 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KDIqhN054143; Mon, 20 Oct 2014 13:18:52 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410201318.s9KDIqhN054143@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 20 Oct 2014 13:18:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273328 - in head/sys/dev/ata: . chipsets X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 13:18:53 -0000 Author: mav Date: Mon Oct 20 13:18:52 2014 New Revision: 273328 URL: https://svnweb.freebsd.org/changeset/base/273328 Log: Add another PCI ID for JMB368 PATA controller. MFC after: 1 week Modified: head/sys/dev/ata/ata-pci.h head/sys/dev/ata/chipsets/ata-jmicron.c Modified: head/sys/dev/ata/ata-pci.h ============================================================================== --- head/sys/dev/ata/ata-pci.h Mon Oct 20 11:21:07 2014 (r273327) +++ head/sys/dev/ata/ata-pci.h Mon Oct 20 13:18:52 2014 (r273328) @@ -306,6 +306,7 @@ struct ata_pci_controller { #define ATA_JMB365 0x2365197b #define ATA_JMB366 0x2366197b #define ATA_JMB368 0x2368197b +#define ATA_JMB368_2 0x0368197b #define ATA_MARVELL_ID 0x11ab #define ATA_M88SX5040 0x504011ab Modified: head/sys/dev/ata/chipsets/ata-jmicron.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-jmicron.c Mon Oct 20 11:21:07 2014 (r273327) +++ head/sys/dev/ata/chipsets/ata-jmicron.c Mon Oct 20 13:18:52 2014 (r273328) @@ -71,6 +71,7 @@ ata_jmicron_probe(device_t dev) { ATA_JMB365, 0, 1, 2, ATA_UDMA6, "JMB365" }, { ATA_JMB366, 0, 2, 2, ATA_UDMA6, "JMB366" }, { ATA_JMB368, 0, 0, 1, ATA_UDMA6, "JMB368" }, + { ATA_JMB368_2, 0, 0, 1, ATA_UDMA6, "JMB368" }, { 0, 0, 0, 0, 0, 0}}; char buffer[64]; From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 13:36:53 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9568D60E; Mon, 20 Oct 2014 13:36:53 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 81F2E6BE; Mon, 20 Oct 2014 13:36:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KDarfa063376; Mon, 20 Oct 2014 13:36:53 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KDarfB063375; Mon, 20 Oct 2014 13:36:53 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201410201336.s9KDarfB063375@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Mon, 20 Oct 2014 13:36:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273329 - head/sys/arm/broadcom/bcm2835 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 13:36:53 -0000 Author: loos Date: Mon Oct 20 13:36:52 2014 New Revision: 273329 URL: https://svnweb.freebsd.org/changeset/base/273329 Log: Add another wakeup() after actually set the bus as free. This fix a race where the threads waiting for the bus would wake up early and still see bus as busy. While here, give a better description to wmesg for the two use cases we have (bus and io waiting). MFC after: 1 week Modified: head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Mon Oct 20 13:18:52 2014 (r273328) +++ head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Mon Oct 20 13:36:52 2014 (r273329) @@ -395,7 +395,7 @@ bcm_bsc_transfer(device_t dev, struct ii /* If the controller is busy wait until it is available. */ while (sc->sc_flags & BCM_I2C_BUSY) - mtx_sleep(dev, &sc->sc_mtx, 0, "bcm_bsc", 0); + mtx_sleep(dev, &sc->sc_mtx, 0, "bscbusw", 0); /* Now we have control over the BSC controller. */ sc->sc_flags = BCM_I2C_BUSY; @@ -439,7 +439,7 @@ bcm_bsc_transfer(device_t dev, struct ii BCM_BSC_CTRL_ST | read | intr); /* Wait for the transaction to complete. */ - err = mtx_sleep(dev, &sc->sc_mtx, 0, "bcm_bsc", hz); + err = mtx_sleep(dev, &sc->sc_mtx, 0, "bsciow", hz); /* Check if we have a timeout or an I2C error. */ if ((sc->sc_flags & BCM_I2C_ERROR) || err == EWOULDBLOCK) { @@ -452,6 +452,9 @@ bcm_bsc_transfer(device_t dev, struct ii /* Clean the controller flags. */ sc->sc_flags = 0; + /* Wake up the threads waiting for bus. */ + wakeup(dev); + BCM_BSC_UNLOCK(sc); return (err); From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 14:25:24 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7A1ED6EB; Mon, 20 Oct 2014 14:25:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6686AF94; Mon, 20 Oct 2014 14:25:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KEPOJr086700; Mon, 20 Oct 2014 14:25:24 GMT (envelope-from dumbbell@FreeBSD.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KEPOWx086699; Mon, 20 Oct 2014 14:25:24 GMT (envelope-from dumbbell@FreeBSD.org) Message-Id: <201410201425.s9KEPOWx086699@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dumbbell set sender to dumbbell@FreeBSD.org using -f From: Jean-Sebastien Pedron Date: Mon, 20 Oct 2014 14:25:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273330 - head/sys/dev/vt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 14:25:24 -0000 Author: dumbbell Date: Mon Oct 20 14:25:23 2014 New Revision: 273330 URL: https://svnweb.freebsd.org/changeset/base/273330 Log: vt(4): Refuse to load a font if hw.vga.textmode is selected Before, the font was loaded and the window size recalculated, giving an unusable terminal, even if the actual font didn't change. Reported by: beeessdee@ruggedinbox.com MFC after: 3 days Modified: head/sys/dev/vt/vt_core.c Modified: head/sys/dev/vt/vt_core.c ============================================================================== --- head/sys/dev/vt/vt_core.c Mon Oct 20 13:36:52 2014 (r273329) +++ head/sys/dev/vt/vt_core.c Mon Oct 20 14:25:23 2014 (r273330) @@ -2207,6 +2207,9 @@ skip_thunk: case PIO_VFONT: { struct vt_font *vf; + if (vd->vd_flags & VDF_TEXTMODE) + return (ENOTSUP); + error = vtfont_load((void *)data, &vf); if (error != 0) return (error); From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 14:42:44 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2B3F51F8; Mon, 20 Oct 2014 14:42:44 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 14D492F8; Mon, 20 Oct 2014 14:42:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KEgixT096175; Mon, 20 Oct 2014 14:42:44 GMT (envelope-from bryanv@FreeBSD.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KEggqt096167; Mon, 20 Oct 2014 14:42:42 GMT (envelope-from bryanv@FreeBSD.org) Message-Id: <201410201442.s9KEggqt096167@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bryanv set sender to bryanv@FreeBSD.org using -f From: Bryan Venteicher Date: Mon, 20 Oct 2014 14:42:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273331 - in head: sbin/ifconfig share/man/man4 sys/conf sys/modules sys/modules/if_vxlan sys/net sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 14:42:44 -0000 Author: bryanv Date: Mon Oct 20 14:42:42 2014 New Revision: 273331 URL: https://svnweb.freebsd.org/changeset/base/273331 Log: Add vxlan interface vxlan creates a virtual LAN by encapsulating the inner Ethernet frame in a UDP packet. This implementation is based on RFC7348. Currently, the IPv6 support is not fully compliant with the specification: we should be able to receive UPDv6 packets with a zero checksum, but we need to support RFC6935 first. Patches for this should come soon. Encapsulation protocols such as vxlan emphasize the need for the FreeBSD network stack to support batching, GRO, and GSO. Each frame has to make two trips through the network stack, and each frame will be at most MTU sized. Performance suffers accordingly. Some latest generation NICs have begun to support vxlan HW offloads that we should also take advantage of. VIMAGE support should also be added soon. Differential Revision: https://reviews.freebsd.org/D384 Reviewed by: gnn Relnotes: yes Added: head/sbin/ifconfig/ifvxlan.c (contents, props changed) head/share/man/man4/vxlan.4 (contents, props changed) head/sys/modules/if_vxlan/ head/sys/modules/if_vxlan/Makefile (contents, props changed) head/sys/net/if_vxlan.c (contents, props changed) head/sys/net/if_vxlan.h (contents, props changed) Modified: head/sbin/ifconfig/Makefile head/sbin/ifconfig/ifconfig.8 head/share/man/man4/Makefile head/sys/conf/NOTES head/sys/conf/files head/sys/modules/Makefile head/sys/sys/priv.h Modified: head/sbin/ifconfig/Makefile ============================================================================== --- head/sbin/ifconfig/Makefile Mon Oct 20 14:25:23 2014 (r273330) +++ head/sbin/ifconfig/Makefile Mon Oct 20 14:42:42 2014 (r273331) @@ -30,6 +30,7 @@ SRCS+= ifmac.c # MAC support SRCS+= ifmedia.c # SIOC[GS]IFMEDIA support SRCS+= iffib.c # non-default FIB support SRCS+= ifvlan.c # SIOC[GS]ETVLAN support +SRCS+= ifvxlan.c # VXLAN support SRCS+= ifgre.c # GRE keys etc SRCS+= ifgif.c # GIF reversed header workaround Modified: head/sbin/ifconfig/ifconfig.8 ============================================================================== --- head/sbin/ifconfig/ifconfig.8 Mon Oct 20 14:25:23 2014 (r273330) +++ head/sbin/ifconfig/ifconfig.8 Mon Oct 20 14:42:42 2014 (r273331) @@ -28,7 +28,7 @@ .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94 .\" $FreeBSD$ .\" -.Dd October 1, 2014 +.Dd October 20, 2014 .Dt IFCONFIG 8 .Os .Sh NAME @@ -2541,6 +2541,76 @@ argument is useless and hence deprecated .El .Pp The following parameters are used to configure +.Xr vxlan 4 +interfaces. +.Bl -tag -width indent +.It Cm vni Ar identifier +This value is a 24-bit VXLAN Network Identifier (VNI) that identifies the +virtual network segment membership of the interface. +.It Cm local Ar address +The source address used in the encapsulating IPv4/IPv6 header. +The address should already be assigned to an existing interface. +When the interface is configured in unicast mode, the listening socket +is bound to this address. +.It Cm remote Ar address +The interface can be configured in a unicast, or point-to-point, mode +to create a tunnel between two hosts. +This is the IP address of the remote end of the tunnel. +.It Cm group Ar address +The interface can be configured in a multicast mode +to create a virtual network of hosts. +This is the IP multicast group address the interface will join. +.It Cm localport Ar port +The port number the interface will listen on. +The default port number is 4789. +.It Cm remoteport Ar port +The destination port number used in the encapsulating IPv4/IPv6 header. +The remote host should be listening on this port. +The default port number is 4789. +Note some other implementations, such as Linux, +do not default to the IANA assigned port, +but instead listen on port 8472. +.It Cm portrange Ar low high +The range of source ports used in the encapsulating IPv4/IPv6 header. +The port selected within the range is based on a hash of the inner frame. +A range is useful to provide entropy within the outer IP header +for more effective load balancing. +The default range is between the +.Xr sysctl 8 +variables +.Va net.inet.ip.portrange.first +and +.Va net.inet.ip.portrange.last +.It Cm timeout Ar timeout +The maximum time, in seconds, before an entry in the forwarding table +is pruned. +The default is 1200 seconds (20 minutes). +.It Cm maxaddr Ar max +The maximum number of entries in the forwarding table. +The default is 2000. +.It Cm vxlandev Ar dev +When the interface is configured in multicast mode, the +.Cm dev +interface is used to transmit IP multicast packets. +.It Cm ttl Ar ttl +The TTL used in the encapsulating IPv4/IPv6 header. +The default is 64. +.It Cm learn +The source IP address and inner source Ethernet MAC address of +received packets are used to dynamically populate the forwarding table. +When in multicast mode, an entry in the forwarding table allows the +interface to send the frame directly to the remote host instead of +broadcasting the frame to the multicast group. +This is the default. +.It Fl learn +The forwarding table is not populated by recevied packets. +.It Cm flush +Delete all dynamically-learned addresses from the forwarding table. +.It Cm flushall +Delete all addresses, including static addresses, from the forwarding table. +.El +.Pp +The following parameters are used to configure .Xr carp 4 protocol on an interface: .Bl -tag -width indent @@ -2745,6 +2815,7 @@ tried to alter an interface's configurat .Xr pfsync 4 , .Xr polling 4 , .Xr vlan 4 , +.Xr vxlan 4 , .Xr devd.conf 5 , .\" .Xr eon 5 , .Xr devd 8 , Added: head/sbin/ifconfig/ifvxlan.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/ifconfig/ifvxlan.c Mon Oct 20 14:42:42 2014 (r273331) @@ -0,0 +1,648 @@ +/*- + * Copyright (c) 2014, Bryan Venteicher + * 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, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "ifconfig.h" + +static struct ifvxlanparam params = { + .vxlp_vni = VXLAN_VNI_MAX, +}; + +static int +get_val(const char *cp, u_long *valp) +{ + char *endptr; + u_long val; + + errno = 0; + val = strtoul(cp, &endptr, 0); + if (cp[0] == '\0' || endptr[0] != '\0' || errno == ERANGE) + return (-1); + + *valp = val; + return (0); +} + +static int +do_cmd(int sock, u_long op, void *arg, size_t argsize, int set) +{ + struct ifdrv ifd; + + bzero(&ifd, sizeof(ifd)); + + strlcpy(ifd.ifd_name, ifr.ifr_name, sizeof(ifd.ifd_name)); + ifd.ifd_cmd = op; + ifd.ifd_len = argsize; + ifd.ifd_data = arg; + + return (ioctl(sock, set ? SIOCSDRVSPEC : SIOCGDRVSPEC, &ifd)); +} + +static int +vxlan_exists(int sock) +{ + struct ifvxlancfg cfg; + + bzero(&cfg, sizeof(cfg)); + + return (do_cmd(sock, VXLAN_CMD_GET_CONFIG, &cfg, sizeof(cfg), 0) != -1); +} + +static void +vxlan_status(int s) +{ + struct ifvxlancfg cfg; + char src[NI_MAXHOST], dst[NI_MAXHOST]; + char srcport[NI_MAXSERV], dstport[NI_MAXSERV]; + struct sockaddr *lsa, *rsa; + int vni, mc, ipv6; + + bzero(&cfg, sizeof(cfg)); + + if (do_cmd(s, VXLAN_CMD_GET_CONFIG, &cfg, sizeof(cfg), 0) < 0) + return; + + vni = cfg.vxlc_vni; + lsa = &cfg.vxlc_local_sa.sa; + rsa = &cfg.vxlc_remote_sa.sa; + ipv6 = rsa->sa_family == AF_INET6; + + /* Just report nothing if the network identity isn't set yet. */ + if (vni >= VXLAN_VNI_MAX) + return; + + if (getnameinfo(lsa, lsa->sa_len, src, sizeof(src), + srcport, sizeof(srcport), NI_NUMERICHOST | NI_NUMERICSERV) != 0) + src[0] = srcport[0] = '\0'; + if (getnameinfo(rsa, rsa->sa_len, dst, sizeof(dst), + dstport, sizeof(dstport), NI_NUMERICHOST | NI_NUMERICSERV) != 0) + dst[0] = dstport[0] = '\0'; + + if (!ipv6) { + struct sockaddr_in *sin = (struct sockaddr_in *)rsa; + mc = IN_MULTICAST(ntohl(sin->sin_addr.s_addr)); + } else { + struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)rsa; + mc = IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr); + } + + printf("\tvxlan vni %d", vni); + printf(" local %s%s%s:%s", ipv6 ? "[" : "", src, ipv6 ? "]" : "", + srcport); + printf(" %s %s%s%s:%s", mc ? "group" : "remote", ipv6 ? "[" : "", + dst, ipv6 ? "]" : "", dstport); + + if (verbose) { + printf("\n\t\tconfig: "); + printf("%slearning portrange %d-%d ttl %d", + cfg.vxlc_learn ? "" : "no", cfg.vxlc_port_min, + cfg.vxlc_port_max, cfg.vxlc_ttl); + printf("\n\t\tftable: "); + printf("cnt %d max %d timeout %d", + cfg.vxlc_ftable_cnt, cfg.vxlc_ftable_max, + cfg.vxlc_ftable_timeout); + } + + putchar('\n'); +} + +#define _LOCAL_ADDR46 \ + (VXLAN_PARAM_WITH_LOCAL_ADDR4 | VXLAN_PARAM_WITH_LOCAL_ADDR6) +#define _REMOTE_ADDR46 \ + (VXLAN_PARAM_WITH_REMOTE_ADDR4 | VXLAN_PARAM_WITH_REMOTE_ADDR6) + +static void +vxlan_check_params(void) +{ + + if ((params.vxlp_with & _LOCAL_ADDR46) == _LOCAL_ADDR46) + errx(1, "cannot specify both local IPv4 and IPv6 addresses"); + if ((params.vxlp_with & _REMOTE_ADDR46) == _REMOTE_ADDR46) + errx(1, "cannot specify both remote IPv4 and IPv6 addresses"); + if ((params.vxlp_with & VXLAN_PARAM_WITH_LOCAL_ADDR4 && + params.vxlp_with & VXLAN_PARAM_WITH_REMOTE_ADDR6) || + (params.vxlp_with & VXLAN_PARAM_WITH_LOCAL_ADDR6 && + params.vxlp_with & VXLAN_PARAM_WITH_REMOTE_ADDR4)) + errx(1, "cannot mix IPv4 and IPv6 addresses"); +} + +#undef _LOCAL_ADDR46 +#undef _REMOTE_ADDR46 + +static void +vxlan_cb(int s, void *arg) +{ + +} + +static void +vxlan_create(int s, struct ifreq *ifr) +{ + + vxlan_check_params(); + + ifr->ifr_data = (caddr_t) ¶ms; + if (ioctl(s, SIOCIFCREATE2, ifr) < 0) + err(1, "SIOCIFCREATE2"); +} + +static +DECL_CMD_FUNC(setvxlan_vni, arg, d) +{ + struct ifvxlancmd cmd; + u_long val; + + if (get_val(arg, &val) < 0 || val >= VXLAN_VNI_MAX) + errx(1, "invalid network identifier: %s", arg); + + if (!vxlan_exists(s)) { + params.vxlp_with |= VXLAN_PARAM_WITH_VNI; + params.vxlp_vni = val; + return; + } + + bzero(&cmd, sizeof(cmd)); + cmd.vxlcmd_vni = val; + + if (do_cmd(s, VXLAN_CMD_SET_VNI, &cmd, sizeof(cmd), 1) < 0) + err(1, "VXLAN_CMD_SET_VNI"); +} + +static +DECL_CMD_FUNC(setvxlan_local, addr, d) +{ + struct ifvxlancmd cmd; + struct addrinfo *ai; + struct sockaddr *sa; + int error; + + bzero(&cmd, sizeof(cmd)); + + if ((error = getaddrinfo(addr, NULL, NULL, &ai)) != 0) + errx(1, "error in parsing local address string: %s", + gai_strerror(error)); + + sa = ai->ai_addr; + + switch (ai->ai_family) { +#ifdef INET + case AF_INET: { + struct in_addr addr = ((struct sockaddr_in *) sa)->sin_addr; + + if (IN_MULTICAST(ntohl(addr.s_addr))) + errx(1, "local address cannot be multicast"); + + cmd.vxlcmd_sa.in4.sin_family = AF_INET; + cmd.vxlcmd_sa.in4.sin_addr = addr; + break; + } +#endif +#ifdef INET6 + case AF_INET6: { + struct in6_addr *addr = &((struct sockaddr_in6 *)sa)->sin6_addr; + + if (IN6_IS_ADDR_MULTICAST(addr)) + errx(1, "local address cannot be multicast"); + + cmd.vxlcmd_sa.in6.sin6_family = AF_INET6; + cmd.vxlcmd_sa.in6.sin6_addr = *addr; + break; + } +#endif + default: + errx(1, "local address %s not supported", addr); + } + + freeaddrinfo(ai); + + if (!vxlan_exists(s)) { + if (cmd.vxlcmd_sa.sa.sa_family == AF_INET) { + params.vxlp_with |= VXLAN_PARAM_WITH_LOCAL_ADDR4; + params.vxlp_local_in4 = cmd.vxlcmd_sa.in4.sin_addr; + } else { + params.vxlp_with |= VXLAN_PARAM_WITH_LOCAL_ADDR6; + params.vxlp_local_in6 = cmd.vxlcmd_sa.in6.sin6_addr; + } + return; + } + + if (do_cmd(s, VXLAN_CMD_SET_LOCAL_ADDR, &cmd, sizeof(cmd), 1) < 0) + err(1, "VXLAN_CMD_SET_LOCAL_ADDR"); +} + +static +DECL_CMD_FUNC(setvxlan_remote, addr, d) +{ + struct ifvxlancmd cmd; + struct addrinfo *ai; + struct sockaddr *sa; + int error; + + bzero(&cmd, sizeof(cmd)); + + if ((error = getaddrinfo(addr, NULL, NULL, &ai)) != 0) + errx(1, "error in parsing remote address string: %s", + gai_strerror(error)); + + sa = ai->ai_addr; + + switch (ai->ai_family) { +#ifdef INET + case AF_INET: { + struct in_addr addr = ((struct sockaddr_in *)sa)->sin_addr; + + if (IN_MULTICAST(ntohl(addr.s_addr))) + errx(1, "remote address cannot be multicast"); + + cmd.vxlcmd_sa.in4.sin_family = AF_INET; + cmd.vxlcmd_sa.in4.sin_addr = addr; + break; + } +#endif +#ifdef INET6 + case AF_INET6: { + struct in6_addr *addr = &((struct sockaddr_in6 *)sa)->sin6_addr; + + if (IN6_IS_ADDR_MULTICAST(addr)) + errx(1, "remote address cannot be multicast"); + + cmd.vxlcmd_sa.in6.sin6_family = AF_INET6; + cmd.vxlcmd_sa.in6.sin6_addr = *addr; + break; + } +#endif + default: + errx(1, "remote address %s not supported", addr); + } + + freeaddrinfo(ai); + + if (!vxlan_exists(s)) { + if (cmd.vxlcmd_sa.sa.sa_family == AF_INET) { + params.vxlp_with |= VXLAN_PARAM_WITH_REMOTE_ADDR4; + params.vxlp_remote_in4 = cmd.vxlcmd_sa.in4.sin_addr; + } else { + params.vxlp_with |= VXLAN_PARAM_WITH_REMOTE_ADDR6; + params.vxlp_remote_in6 = cmd.vxlcmd_sa.in6.sin6_addr; + } + return; + } + + if (do_cmd(s, VXLAN_CMD_SET_REMOTE_ADDR, &cmd, sizeof(cmd), 1) < 0) + err(1, "VXLAN_CMD_SET_REMOTE_ADDR"); +} + +static +DECL_CMD_FUNC(setvxlan_group, addr, d) +{ + struct ifvxlancmd cmd; + struct addrinfo *ai; + struct sockaddr *sa; + int error; + + bzero(&cmd, sizeof(cmd)); + + if ((error = getaddrinfo(addr, NULL, NULL, &ai)) != 0) + errx(1, "error in parsing group address string: %s", + gai_strerror(error)); + + sa = ai->ai_addr; + + switch (ai->ai_family) { +#ifdef INET + case AF_INET: { + struct in_addr addr = ((struct sockaddr_in *)sa)->sin_addr; + + if (!IN_MULTICAST(ntohl(addr.s_addr))) + errx(1, "group address must be multicast"); + + cmd.vxlcmd_sa.in4.sin_family = AF_INET; + cmd.vxlcmd_sa.in4.sin_addr = addr; + break; + } +#endif +#ifdef INET6 + case AF_INET6: { + struct in6_addr *addr = &((struct sockaddr_in6 *)sa)->sin6_addr; + + if (!IN6_IS_ADDR_MULTICAST(addr)) + errx(1, "group address must be multicast"); + + cmd.vxlcmd_sa.in6.sin6_family = AF_INET6; + cmd.vxlcmd_sa.in6.sin6_addr = *addr; + break; + } +#endif + default: + errx(1, "group address %s not supported", addr); + } + + freeaddrinfo(ai); + + if (!vxlan_exists(s)) { + if (cmd.vxlcmd_sa.sa.sa_family == AF_INET) { + params.vxlp_with |= VXLAN_PARAM_WITH_REMOTE_ADDR4; + params.vxlp_remote_in4 = cmd.vxlcmd_sa.in4.sin_addr; + } else { + params.vxlp_with |= VXLAN_PARAM_WITH_REMOTE_ADDR6; + params.vxlp_remote_in6 = cmd.vxlcmd_sa.in6.sin6_addr; + } + return; + } + + if (do_cmd(s, VXLAN_CMD_SET_REMOTE_ADDR, &cmd, sizeof(cmd), 1) < 0) + err(1, "VXLAN_CMD_SET_REMOTE_ADDR"); +} + +static +DECL_CMD_FUNC(setvxlan_local_port, arg, d) +{ + struct ifvxlancmd cmd; + u_long val; + + if (get_val(arg, &val) < 0 || val >= UINT16_MAX) + errx(1, "invalid local port: %s", arg); + + if (!vxlan_exists(s)) { + params.vxlp_with |= VXLAN_PARAM_WITH_LOCAL_PORT; + params.vxlp_local_port = val; + return; + } + + bzero(&cmd, sizeof(cmd)); + cmd.vxlcmd_port = val; + + if (do_cmd(s, VXLAN_CMD_SET_LOCAL_PORT, &cmd, sizeof(cmd), 1) < 0) + err(1, "VXLAN_CMD_SET_LOCAL_PORT"); +} + +static +DECL_CMD_FUNC(setvxlan_remote_port, arg, d) +{ + struct ifvxlancmd cmd; + u_long val; + + if (get_val(arg, &val) < 0 || val >= UINT16_MAX) + errx(1, "invalid remote port: %s", arg); + + if (!vxlan_exists(s)) { + params.vxlp_with |= VXLAN_PARAM_WITH_REMOTE_PORT; + params.vxlp_remote_port = val; + return; + } + + bzero(&cmd, sizeof(cmd)); + cmd.vxlcmd_port = val; + + if (do_cmd(s, VXLAN_CMD_SET_REMOTE_PORT, &cmd, sizeof(cmd), 1) < 0) + err(1, "VXLAN_CMD_SET_REMOTE_PORT"); +} + +static +DECL_CMD_FUNC2(setvxlan_port_range, arg1, arg2) +{ + struct ifvxlancmd cmd; + u_long min, max; + + if (get_val(arg1, &min) < 0 || min >= UINT16_MAX) + errx(1, "invalid port range minimum: %s", arg1); + if (get_val(arg2, &max) < 0 || max >= UINT16_MAX) + errx(1, "invalid port range maximum: %s", arg2); + if (max < min) + errx(1, "invalid port range"); + + if (!vxlan_exists(s)) { + params.vxlp_with |= VXLAN_PARAM_WITH_PORT_RANGE; + params.vxlp_min_port = min; + params.vxlp_max_port = max; + return; + } + + bzero(&cmd, sizeof(cmd)); + cmd.vxlcmd_port_min = min; + cmd.vxlcmd_port_max = max; + + if (do_cmd(s, VXLAN_CMD_SET_PORT_RANGE, &cmd, sizeof(cmd), 1) < 0) + err(1, "VXLAN_CMD_SET_PORT_RANGE"); +} + +static +DECL_CMD_FUNC(setvxlan_timeout, arg, d) +{ + struct ifvxlancmd cmd; + u_long val; + + if (get_val(arg, &val) < 0 || (val & ~0xFFFFFFFF) != 0) + errx(1, "invalid timeout value: %s", arg); + + if (!vxlan_exists(s)) { + params.vxlp_with |= VXLAN_PARAM_WITH_FTABLE_TIMEOUT; + params.vxlp_ftable_timeout = val & 0xFFFFFFFF; + return; + } + + bzero(&cmd, sizeof(cmd)); + cmd.vxlcmd_ftable_timeout = val & 0xFFFFFFFF; + + if (do_cmd(s, VXLAN_CMD_SET_FTABLE_TIMEOUT, &cmd, sizeof(cmd), 1) < 0) + err(1, "VXLAN_CMD_SET_FTABLE_TIMEOUT"); +} + +static +DECL_CMD_FUNC(setvxlan_maxaddr, arg, d) +{ + struct ifvxlancmd cmd; + u_long val; + + if (get_val(arg, &val) < 0 || (val & ~0xFFFFFFFF) != 0) + errx(1, "invalid maxaddr value: %s", arg); + + if (!vxlan_exists(s)) { + params.vxlp_with |= VXLAN_PARAM_WITH_FTABLE_MAX; + params.vxlp_ftable_max = val & 0xFFFFFFFF; + return; + } + + bzero(&cmd, sizeof(cmd)); + cmd.vxlcmd_ftable_max = val & 0xFFFFFFFF; + + if (do_cmd(s, VXLAN_CMD_SET_FTABLE_MAX, &cmd, sizeof(cmd), 1) < 0) + err(1, "VXLAN_CMD_SET_FTABLE_MAX"); +} + +static +DECL_CMD_FUNC(setvxlan_dev, arg, d) +{ + struct ifvxlancmd cmd; + + if (!vxlan_exists(s)) { + params.vxlp_with |= VXLAN_PARAM_WITH_MULTICAST_IF; + strlcpy(params.vxlp_mc_ifname, arg, + sizeof(params.vxlp_mc_ifname)); + return; + } + + bzero(&cmd, sizeof(cmd)); + strlcpy(cmd.vxlcmd_ifname, arg, sizeof(cmd.vxlcmd_ifname)); + + if (do_cmd(s, VXLAN_CMD_SET_MULTICAST_IF, &cmd, sizeof(cmd), 1) < 0) + err(1, "VXLAN_CMD_SET_MULTICAST_IF"); +} + +static +DECL_CMD_FUNC(setvxlan_ttl, arg, d) +{ + struct ifvxlancmd cmd; + u_long val; + + if (get_val(arg, &val) < 0 || val > 256) + errx(1, "invalid TTL value: %s", arg); + + if (!vxlan_exists(s)) { + params.vxlp_with |= VXLAN_PARAM_WITH_TTL; + params.vxlp_ttl = val; + return; + } + + bzero(&cmd, sizeof(cmd)); + cmd.vxlcmd_ttl = val; + + if (do_cmd(s, VXLAN_CMD_SET_TTL, &cmd, sizeof(cmd), 1) < 0) + err(1, "VXLAN_CMD_SET_TTL"); +} + +static +DECL_CMD_FUNC(setvxlan_learn, arg, d) +{ + struct ifvxlancmd cmd; + + if (!vxlan_exists(s)) { + params.vxlp_with |= VXLAN_PARAM_WITH_LEARN; + params.vxlp_learn = d; + return; + } + + bzero(&cmd, sizeof(cmd)); + if (d != 0) + cmd.vxlcmd_flags |= VXLAN_CMD_FLAG_LEARN; + + if (do_cmd(s, VXLAN_CMD_SET_LEARN, &cmd, sizeof(cmd), 1) < 0) + err(1, "VXLAN_CMD_SET_LEARN"); +} + +static void +setvxlan_flush(const char *val, int d, int s, const struct afswtch *afp) +{ + struct ifvxlancmd cmd; + + bzero(&cmd, sizeof(cmd)); + if (d != 0) + cmd.vxlcmd_flags |= VXLAN_CMD_FLAG_FLUSH_ALL; + + if (do_cmd(s, VXLAN_CMD_FLUSH, &cmd, sizeof(cmd), 1) < 0) + err(1, "VXLAN_CMD_FLUSH"); +} + +static struct cmd vxlan_cmds[] = { + + DEF_CLONE_CMD_ARG("vni", setvxlan_vni), + DEF_CLONE_CMD_ARG("local", setvxlan_local), + DEF_CLONE_CMD_ARG("remote", setvxlan_remote), + DEF_CLONE_CMD_ARG("group", setvxlan_group), + DEF_CLONE_CMD_ARG("localport", setvxlan_local_port), + DEF_CLONE_CMD_ARG("remoteport", setvxlan_remote_port), + DEF_CLONE_CMD_ARG2("portrange", setvxlan_port_range), + DEF_CLONE_CMD_ARG("timeout", setvxlan_timeout), + DEF_CLONE_CMD_ARG("maxaddr", setvxlan_maxaddr), + DEF_CLONE_CMD_ARG("vxlandev", setvxlan_dev), + DEF_CLONE_CMD_ARG("ttl", setvxlan_ttl), + DEF_CLONE_CMD("learn", 1, setvxlan_learn), + DEF_CLONE_CMD("-learn", 0, setvxlan_learn), + + DEF_CMD_ARG("vni", setvxlan_vni), + DEF_CMD_ARG("local", setvxlan_local), + DEF_CMD_ARG("remote", setvxlan_remote), + DEF_CMD_ARG("group", setvxlan_group), + DEF_CMD_ARG("localport", setvxlan_local_port), + DEF_CMD_ARG("remoteport", setvxlan_remote_port), + DEF_CMD_ARG2("portrange", setvxlan_port_range), + DEF_CMD_ARG("timeout", setvxlan_timeout), + DEF_CMD_ARG("maxaddr", setvxlan_maxaddr), + DEF_CMD_ARG("vxlandev", setvxlan_dev), + DEF_CMD_ARG("ttl", setvxlan_ttl), + DEF_CMD("learn", 1, setvxlan_learn), + DEF_CMD("-learn", 0, setvxlan_learn), + + DEF_CMD("flush", 0, setvxlan_flush), + DEF_CMD("flushall", 1, setvxlan_flush), +}; + +static struct afswtch af_vxlan = { + .af_name = "af_vxlan", + .af_af = AF_UNSPEC, + .af_other_status = vxlan_status, +}; + +static __constructor void +vxlan_ctor(void) +{ +#define N(a) (sizeof(a) / sizeof(a[0])) + size_t i; + + for (i = 0; i < N(vxlan_cmds); i++) + cmd_register(&vxlan_cmds[i]); + af_register(&af_vxlan); + callback_register(vxlan_cb, NULL); + clone_setdefcallback("vxlan", vxlan_create); +#undef N +} Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Mon Oct 20 14:25:23 2014 (r273330) +++ head/share/man/man4/Makefile Mon Oct 20 14:42:42 2014 (r273331) @@ -567,6 +567,7 @@ MAN= aac.4 \ ${_virtio_scsi.4} \ vkbd.4 \ vlan.4 \ + vxlan.4 \ ${_vmx.4} \ vpo.4 \ vr.4 \ @@ -743,6 +744,7 @@ MLINKS+=urndis.4 if_urndis.4 MLINKS+=${_urtw.4} ${_if_urtw.4} MLINKS+=vge.4 if_vge.4 MLINKS+=vlan.4 if_vlan.4 +MLINKS+=vxlan.4 if_vxlan.4 MLINKS+=${_vmx.4} ${_if_vmx.4} MLINKS+=vpo.4 imm.4 MLINKS+=vr.4 if_vr.4 Added: head/share/man/man4/vxlan.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/vxlan.4 Mon Oct 20 14:42:42 2014 (r273331) @@ -0,0 +1,235 @@ +.\" Copyright (c) 2014 Bryan Venteicher +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 October 20, 2014 +.Dt VXLAN 4 +.Os +.Sh NAME +.Nm vxlan +.Nd "Virtual eXtensible LAN interface" +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device vxlan" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +if_vxlan_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver creates a virtual tunnel endpoint in a +.Nm +segment. +A +.Nm +segment is a virtual Layer 2 (Ethernet) network that is overlaid +in a Layer 3 (IP/UDP) network. +.Nm +is analogous to +.Xr vlan 4 +but is designed to be better suited for large, multiple tenant +data center environments. +.Pp +Each +.Nm +interface is created at runtime using interface cloning. +This is most easily done with the +.Xr ifconfig 8 +.Cm create +command or using the +.Va cloned_interfaces +variable in +.Xr rc.conf 5 . +The interface may be removed with the +.Xr ifconfig 8 +.Cm destroy +command. +.Pp +The +.Nm +driver creates a pseudo Ethernet network interface +that supports the usual network +.Xr ioctl 2 Ns s +and is thus can be used with +.Xr ifconfig 8 +like any other Ethernet interface. +The +.Nm +interface encapsulates the Ethernet frame +by prepending IP/UDP and +.Nm +headers. +Thus, the encapsulated (inner) frame is able to transmitted +over a routed, Layer 3 network to the remote host. +.Pp +The +.Nm +interface may be configured in either unicast or multicast mode. +When in unicast mode, +the interface creates a tunnel to a single remote host, +and all traffic is transmitted to that host. +When in multicast mode, +the interface joins an IP multicast group, +and receives packets sent to the group address, +and transmits packets to either the multicast group address, +or directly the remote host if there is an appropriate +forwarding table entry. +.Pp +When the +.Nm +interface is brought up, a +.Xr UDP 4 +.Xr socket 9 +is created based on the configuration, +such as the local address for unicast mode or +the group address for multicast mode, +and the listening (local) port number. +Since multiple +.Nm +interfaces may be created that either +use the same local address +or join the same group address, +and use the same port, +the driver may share a socket among multiple interfaces. +However, each interface within a socket must belong to +a unique +.Nm +segment. +The analogous +.Xr vlan 4 +configuration would be a physical interface configured as +the parent device for multiple VLAN interfaces, each with +a unique VLAN tag. +Each +.Nm +segment is identified by a 24-bit value in the +.Nm +header called the +.Dq VXLAN Network Identifier , +or VNI. +.Pp +When configured with the +.Xr ifconfig 8 +.Cm learn +parameter, the interface dynamically creates forwarding table entries +from received packets. +An entry in the forwarding table maps the inner source MAC address +to the outer remote IP address. +During transmit, the interface attempts to lookup an entry for +the encapsulated destination MAC address. +If an entry is found, the IP address in the entry is used to directly +transmit the encapsulated frame to the destination. +Otherwise, when configured in multicast mode, +the interface must flood the frame to all hosts in the group. +The maximum number of entries in the table is configurable with the +.Xr ifconfig 8 +.Cm maxaddr +command. +Stale entries in the table periodically pruned. +The timeout is configurable with the +.Xr ifconfig 8 +.Cm timeout +command. +The table may be viewed with the +.Xr sysctl 8 +.Cm net.link.vlxan.N.ftable.dump +command. +.Sh MTU +Since the +.Nm +interface encapsulates the Ethernet frame with an IP, UDP, and +.Nm +header, the resulting frame may be larger than the MTU of the +physical network. +The +.Nm +specification recommends the physical network MTU be configured +to use jumbo frames to accommodate the encapsulated frame size. +Alternatively, the +.Xr ifconfig 8 +.Cm mtu +command may be used to reduce the MTU size on the +.Nm +interface to allow the encapsulated frame to fit in the +current MTU of the physical network. +.Sh EXAMPLES +Create a +.Nm +interface in unicast mode +with the +.Cm local +tunnel address of 192.168.100.1, +and the +.Cm remote +tunnel address of 192.168.100.2. +.Bd -literal -offset indent +ifconfig vxlan create vni 108 local 192.168.100.1 remote 192.168.100.2 +.Ed +.Pp +Create a +.Nm +interface in multicast mode, +with the +.Cm local +address of 192.168.10.95, +and the +.Cm group +address of 224.0.2.6. +The em0 interface will be used to transmit multicast packets. +.Bd -literal -offset indent +ifconfig vxlan create vni 42 local 192.168.10.95 group 224.0.2.6 vxlandev em0 +.Ed +.Pp +Once created, the +.Nm +interface can be configured with +.Xr ifconfig 8 . +.Sh SEE ALSO +.Xr ifconfig 8 , +.Xr inet 4 , +.Xr inet 6 , +.Xr sysctl 8 , +.Xr vlan 8 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 14:48:20 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C74F74B1; Mon, 20 Oct 2014 14:48:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B3B67364; Mon, 20 Oct 2014 14:48:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KEmKiV096977; Mon, 20 Oct 2014 14:48:20 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KEmKIe096976; Mon, 20 Oct 2014 14:48:20 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201410201448.s9KEmKIe096976@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 20 Oct 2014 14:48:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273332 - head/share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 14:48:20 -0000 Author: emaste Date: Mon Oct 20 14:48:20 2014 New Revision: 273332 URL: https://svnweb.freebsd.org/changeset/base/273332 Log: Add vtfontcvt(8) cross-reference to vt(4) man page Reported by: beeessdee@ruggedinbox.com MFC after: 3 days Modified: head/share/man/man4/vt.4 Modified: head/share/man/man4/vt.4 ============================================================================== --- head/share/man/man4/vt.4 Mon Oct 20 14:42:42 2014 (r273331) +++ head/share/man/man4/vt.4 Mon Oct 20 14:48:20 2014 (r273332) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 16, 2014 +.Dd October 20, 2014 .Dt "VIRTUAL TERMINALS" 4 .Os .Sh NAME @@ -273,7 +273,8 @@ on a black background, or black on a bri .Xr getty 8 , .Xr kbdmux 8 , .Xr kldload 8 , -.Xr moused 8 +.Xr moused 8 , +.Xr vtfontcvt 8 .Sh HISTORY The .Nm From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 15:41:12 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 88750430; Mon, 20 Oct 2014 15:41:12 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 74C34D2B; Mon, 20 Oct 2014 15:41:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KFfCnh026039; Mon, 20 Oct 2014 15:41:12 GMT (envelope-from pluknet@FreeBSD.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KFfCkl026038; Mon, 20 Oct 2014 15:41:12 GMT (envelope-from pluknet@FreeBSD.org) Message-Id: <201410201541.s9KFfCkl026038@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pluknet set sender to pluknet@FreeBSD.org using -f From: Sergey Kandaurov Date: Mon, 20 Oct 2014 15:41:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273333 - head/share/misc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 15:41:12 -0000 Author: pluknet Date: Mon Oct 20 15:41:11 2014 New Revision: 273333 URL: https://svnweb.freebsd.org/changeset/base/273333 Log: Mac OS X 10.10 added. Modified: head/share/misc/bsd-family-tree Modified: head/share/misc/bsd-family-tree ============================================================================== --- head/share/misc/bsd-family-tree Mon Oct 20 14:48:20 2014 (r273332) +++ head/share/misc/bsd-family-tree Mon Oct 20 15:41:11 2014 (r273333) @@ -315,6 +315,8 @@ FreeBSD 5.2 | | | FreeBSD | | | | | 9.3 | | | | | | | | DragonFly 3.8.2 + | Mac OS X | | | + | 10.10 | | | | | | | | | | | | | | | | | | @@ -653,6 +655,7 @@ DragonFly 3.8.1 2014-06-16 [DFB] DragonFly 3.6.3 2014-06-17 [DFB] FreeBSD 9.3 2014-07-05 [FBD] DragonFly 3.8.2 2014-08-08 [DFB] +Mac OS X 10.10 2014-10-16 [APL] Bibliography ------------------------ From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 16:57:37 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 711D8455; Mon, 20 Oct 2014 16:57:37 +0000 (UTC) Received: from mail-wi0-x233.google.com (mail-wi0-x233.google.com [IPv6:2a00:1450:400c:c05::233]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 623E5A26; Mon, 20 Oct 2014 16:57:36 +0000 (UTC) Received: by mail-wi0-f179.google.com with SMTP id d1so6937562wiv.6 for ; Mon, 20 Oct 2014 09:57:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=xr9kvgSjVpnMCf9MHIfwEmvaZteCTqcI8Wfxsim6Ol0=; b=PGXDoRoKBnj9UJVQGnHhjYP2zeW5rP5XF/pBLcStfAXUJfbrwghNx8WL//YSmFu1bC UEHnrILfrNj4grL59Q7rqg7DKcMytPJVv2mrgtBS0ndjcca37Yr1pJ52WAt2Fe/ibBe9 Mb8IVaOpTIR6Reodxn0mXGFsS2gzfU8h3FLIzaJo6acvFnHzJWHfp5Uet4SCIEj87y0h crMmh3XJXaP1CFWuVGPm4BUSdZAeGPSKX5eB2q4QyuWxs3EdIGAudeGQ5nW3f7EB+L/C fhuJVm/r+5ZooMyIUNuoSbSBRBIzAJebBmxiHCdnSjRSHz6+FmcISvN1GmJI9MZerH9s gqig== MIME-Version: 1.0 X-Received: by 10.181.27.197 with SMTP id ji5mr21926514wid.26.1413824254651; Mon, 20 Oct 2014 09:57:34 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.216.106.136 with HTTP; Mon, 20 Oct 2014 09:57:34 -0700 (PDT) In-Reply-To: <201410201442.s9KEggqt096167@svn.freebsd.org> References: <201410201442.s9KEggqt096167@svn.freebsd.org> Date: Mon, 20 Oct 2014 09:57:34 -0700 X-Google-Sender-Auth: EY5K7_D4ZFnyPkVQRcDMC57CIZ8 Message-ID: Subject: Re: svn commit: r273331 - in head: sbin/ifconfig share/man/man4 sys/conf sys/modules sys/modules/if_vxlan sys/net sys/sys From: Adrian Chadd To: Bryan Venteicher Content-Type: text/plain; charset=UTF-8 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 16:57:37 -0000 Hi, Can you please create a PR that says something like "review vxlan code for RSS after de-capsulation" and assign it to me? I'm going to have to insert a hash recalculation after decapsulation but I'm too busy at the moment to do it. Thanks, -a On 20 October 2014 07:42, Bryan Venteicher wrote: > Author: bryanv > Date: Mon Oct 20 14:42:42 2014 > New Revision: 273331 > URL: https://svnweb.freebsd.org/changeset/base/273331 > > Log: > Add vxlan interface > > vxlan creates a virtual LAN by encapsulating the inner Ethernet frame in > a UDP packet. This implementation is based on RFC7348. > > Currently, the IPv6 support is not fully compliant with the specification: > we should be able to receive UPDv6 packets with a zero checksum, but we > need to support RFC6935 first. Patches for this should come soon. > > Encapsulation protocols such as vxlan emphasize the need for the FreeBSD > network stack to support batching, GRO, and GSO. Each frame has to make > two trips through the network stack, and each frame will be at most MTU > sized. Performance suffers accordingly. > > Some latest generation NICs have begun to support vxlan HW offloads that > we should also take advantage of. VIMAGE support should also be added soon. > > Differential Revision: https://reviews.freebsd.org/D384 > Reviewed by: gnn > Relnotes: yes > > Added: > head/sbin/ifconfig/ifvxlan.c (contents, props changed) > head/share/man/man4/vxlan.4 (contents, props changed) > head/sys/modules/if_vxlan/ > head/sys/modules/if_vxlan/Makefile (contents, props changed) > head/sys/net/if_vxlan.c (contents, props changed) > head/sys/net/if_vxlan.h (contents, props changed) > Modified: > head/sbin/ifconfig/Makefile > head/sbin/ifconfig/ifconfig.8 > head/share/man/man4/Makefile > head/sys/conf/NOTES > head/sys/conf/files > head/sys/modules/Makefile > head/sys/sys/priv.h > > Modified: head/sbin/ifconfig/Makefile > ============================================================================== > --- head/sbin/ifconfig/Makefile Mon Oct 20 14:25:23 2014 (r273330) > +++ head/sbin/ifconfig/Makefile Mon Oct 20 14:42:42 2014 (r273331) > @@ -30,6 +30,7 @@ SRCS+= ifmac.c # MAC support > SRCS+= ifmedia.c # SIOC[GS]IFMEDIA support > SRCS+= iffib.c # non-default FIB support > SRCS+= ifvlan.c # SIOC[GS]ETVLAN support > +SRCS+= ifvxlan.c # VXLAN support > SRCS+= ifgre.c # GRE keys etc > SRCS+= ifgif.c # GIF reversed header workaround > > > Modified: head/sbin/ifconfig/ifconfig.8 > ============================================================================== > --- head/sbin/ifconfig/ifconfig.8 Mon Oct 20 14:25:23 2014 (r273330) > +++ head/sbin/ifconfig/ifconfig.8 Mon Oct 20 14:42:42 2014 (r273331) > @@ -28,7 +28,7 @@ > .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94 > .\" $FreeBSD$ > .\" > -.Dd October 1, 2014 > +.Dd October 20, 2014 > .Dt IFCONFIG 8 > .Os > .Sh NAME > @@ -2541,6 +2541,76 @@ argument is useless and hence deprecated > .El > .Pp > The following parameters are used to configure > +.Xr vxlan 4 > +interfaces. > +.Bl -tag -width indent > +.It Cm vni Ar identifier > +This value is a 24-bit VXLAN Network Identifier (VNI) that identifies the > +virtual network segment membership of the interface. > +.It Cm local Ar address > +The source address used in the encapsulating IPv4/IPv6 header. > +The address should already be assigned to an existing interface. > +When the interface is configured in unicast mode, the listening socket > +is bound to this address. > +.It Cm remote Ar address > +The interface can be configured in a unicast, or point-to-point, mode > +to create a tunnel between two hosts. > +This is the IP address of the remote end of the tunnel. > +.It Cm group Ar address > +The interface can be configured in a multicast mode > +to create a virtual network of hosts. > +This is the IP multicast group address the interface will join. > +.It Cm localport Ar port > +The port number the interface will listen on. > +The default port number is 4789. > +.It Cm remoteport Ar port > +The destination port number used in the encapsulating IPv4/IPv6 header. > +The remote host should be listening on this port. > +The default port number is 4789. > +Note some other implementations, such as Linux, > +do not default to the IANA assigned port, > +but instead listen on port 8472. > +.It Cm portrange Ar low high > +The range of source ports used in the encapsulating IPv4/IPv6 header. > +The port selected within the range is based on a hash of the inner frame. > +A range is useful to provide entropy within the outer IP header > +for more effective load balancing. > +The default range is between the > +.Xr sysctl 8 > +variables > +.Va net.inet.ip.portrange.first > +and > +.Va net.inet.ip.portrange.last > +.It Cm timeout Ar timeout > +The maximum time, in seconds, before an entry in the forwarding table > +is pruned. > +The default is 1200 seconds (20 minutes). > +.It Cm maxaddr Ar max > +The maximum number of entries in the forwarding table. > +The default is 2000. > +.It Cm vxlandev Ar dev > +When the interface is configured in multicast mode, the > +.Cm dev > +interface is used to transmit IP multicast packets. > +.It Cm ttl Ar ttl > +The TTL used in the encapsulating IPv4/IPv6 header. > +The default is 64. > +.It Cm learn > +The source IP address and inner source Ethernet MAC address of > +received packets are used to dynamically populate the forwarding table. > +When in multicast mode, an entry in the forwarding table allows the > +interface to send the frame directly to the remote host instead of > +broadcasting the frame to the multicast group. > +This is the default. > +.It Fl learn > +The forwarding table is not populated by recevied packets. > +.It Cm flush > +Delete all dynamically-learned addresses from the forwarding table. > +.It Cm flushall > +Delete all addresses, including static addresses, from the forwarding table. > +.El > +.Pp > +The following parameters are used to configure > .Xr carp 4 > protocol on an interface: > .Bl -tag -width indent > @@ -2745,6 +2815,7 @@ tried to alter an interface's configurat > .Xr pfsync 4 , > .Xr polling 4 , > .Xr vlan 4 , > +.Xr vxlan 4 , > .Xr devd.conf 5 , > .\" .Xr eon 5 , > .Xr devd 8 , > > Added: head/sbin/ifconfig/ifvxlan.c > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sbin/ifconfig/ifvxlan.c Mon Oct 20 14:42:42 2014 (r273331) > @@ -0,0 +1,648 @@ > +/*- > + * Copyright (c) 2014, Bryan Venteicher > + * 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, this list of conditions and the following disclaimer in the > + * documentation and/or other materials provided with the distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR > + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES > + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. > + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, > + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT > + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, > + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY > + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT > + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF > + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > + */ > + > +#include > +__FBSDID("$FreeBSD$"); > + > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "ifconfig.h" > + > +static struct ifvxlanparam params = { > + .vxlp_vni = VXLAN_VNI_MAX, > +}; > + > +static int > +get_val(const char *cp, u_long *valp) > +{ > + char *endptr; > + u_long val; > + > + errno = 0; > + val = strtoul(cp, &endptr, 0); > + if (cp[0] == '\0' || endptr[0] != '\0' || errno == ERANGE) > + return (-1); > + > + *valp = val; > + return (0); > +} > + > +static int > +do_cmd(int sock, u_long op, void *arg, size_t argsize, int set) > +{ > + struct ifdrv ifd; > + > + bzero(&ifd, sizeof(ifd)); > + > + strlcpy(ifd.ifd_name, ifr.ifr_name, sizeof(ifd.ifd_name)); > + ifd.ifd_cmd = op; > + ifd.ifd_len = argsize; > + ifd.ifd_data = arg; > + > + return (ioctl(sock, set ? SIOCSDRVSPEC : SIOCGDRVSPEC, &ifd)); > +} > + > +static int > +vxlan_exists(int sock) > +{ > + struct ifvxlancfg cfg; > + > + bzero(&cfg, sizeof(cfg)); > + > + return (do_cmd(sock, VXLAN_CMD_GET_CONFIG, &cfg, sizeof(cfg), 0) != -1); > +} > + > +static void > +vxlan_status(int s) > +{ > + struct ifvxlancfg cfg; > + char src[NI_MAXHOST], dst[NI_MAXHOST]; > + char srcport[NI_MAXSERV], dstport[NI_MAXSERV]; > + struct sockaddr *lsa, *rsa; > + int vni, mc, ipv6; > + > + bzero(&cfg, sizeof(cfg)); > + > + if (do_cmd(s, VXLAN_CMD_GET_CONFIG, &cfg, sizeof(cfg), 0) < 0) > + return; > + > + vni = cfg.vxlc_vni; > + lsa = &cfg.vxlc_local_sa.sa; > + rsa = &cfg.vxlc_remote_sa.sa; > + ipv6 = rsa->sa_family == AF_INET6; > + > + /* Just report nothing if the network identity isn't set yet. */ > + if (vni >= VXLAN_VNI_MAX) > + return; > + > + if (getnameinfo(lsa, lsa->sa_len, src, sizeof(src), > + srcport, sizeof(srcport), NI_NUMERICHOST | NI_NUMERICSERV) != 0) > + src[0] = srcport[0] = '\0'; > + if (getnameinfo(rsa, rsa->sa_len, dst, sizeof(dst), > + dstport, sizeof(dstport), NI_NUMERICHOST | NI_NUMERICSERV) != 0) > + dst[0] = dstport[0] = '\0'; > + > + if (!ipv6) { > + struct sockaddr_in *sin = (struct sockaddr_in *)rsa; > + mc = IN_MULTICAST(ntohl(sin->sin_addr.s_addr)); > + } else { > + struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)rsa; > + mc = IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr); > + } > + > + printf("\tvxlan vni %d", vni); > + printf(" local %s%s%s:%s", ipv6 ? "[" : "", src, ipv6 ? "]" : "", > + srcport); > + printf(" %s %s%s%s:%s", mc ? "group" : "remote", ipv6 ? "[" : "", > + dst, ipv6 ? "]" : "", dstport); > + > + if (verbose) { > + printf("\n\t\tconfig: "); > + printf("%slearning portrange %d-%d ttl %d", > + cfg.vxlc_learn ? "" : "no", cfg.vxlc_port_min, > + cfg.vxlc_port_max, cfg.vxlc_ttl); > + printf("\n\t\tftable: "); > + printf("cnt %d max %d timeout %d", > + cfg.vxlc_ftable_cnt, cfg.vxlc_ftable_max, > + cfg.vxlc_ftable_timeout); > + } > + > + putchar('\n'); > +} > + > +#define _LOCAL_ADDR46 \ > + (VXLAN_PARAM_WITH_LOCAL_ADDR4 | VXLAN_PARAM_WITH_LOCAL_ADDR6) > +#define _REMOTE_ADDR46 \ > + (VXLAN_PARAM_WITH_REMOTE_ADDR4 | VXLAN_PARAM_WITH_REMOTE_ADDR6) > + > +static void > +vxlan_check_params(void) > +{ > + > + if ((params.vxlp_with & _LOCAL_ADDR46) == _LOCAL_ADDR46) > + errx(1, "cannot specify both local IPv4 and IPv6 addresses"); > + if ((params.vxlp_with & _REMOTE_ADDR46) == _REMOTE_ADDR46) > + errx(1, "cannot specify both remote IPv4 and IPv6 addresses"); > + if ((params.vxlp_with & VXLAN_PARAM_WITH_LOCAL_ADDR4 && > + params.vxlp_with & VXLAN_PARAM_WITH_REMOTE_ADDR6) || > + (params.vxlp_with & VXLAN_PARAM_WITH_LOCAL_ADDR6 && > + params.vxlp_with & VXLAN_PARAM_WITH_REMOTE_ADDR4)) > + errx(1, "cannot mix IPv4 and IPv6 addresses"); > +} > + > +#undef _LOCAL_ADDR46 > +#undef _REMOTE_ADDR46 > + > +static void > +vxlan_cb(int s, void *arg) > +{ > + > +} > + > +static void > +vxlan_create(int s, struct ifreq *ifr) > +{ > + > + vxlan_check_params(); > + > + ifr->ifr_data = (caddr_t) ¶ms; > + if (ioctl(s, SIOCIFCREATE2, ifr) < 0) > + err(1, "SIOCIFCREATE2"); > +} > + > +static > +DECL_CMD_FUNC(setvxlan_vni, arg, d) > +{ > + struct ifvxlancmd cmd; > + u_long val; > + > + if (get_val(arg, &val) < 0 || val >= VXLAN_VNI_MAX) > + errx(1, "invalid network identifier: %s", arg); > + > + if (!vxlan_exists(s)) { > + params.vxlp_with |= VXLAN_PARAM_WITH_VNI; > + params.vxlp_vni = val; > + return; > + } > + > + bzero(&cmd, sizeof(cmd)); > + cmd.vxlcmd_vni = val; > + > + if (do_cmd(s, VXLAN_CMD_SET_VNI, &cmd, sizeof(cmd), 1) < 0) > + err(1, "VXLAN_CMD_SET_VNI"); > +} > + > +static > +DECL_CMD_FUNC(setvxlan_local, addr, d) > +{ > + struct ifvxlancmd cmd; > + struct addrinfo *ai; > + struct sockaddr *sa; > + int error; > + > + bzero(&cmd, sizeof(cmd)); > + > + if ((error = getaddrinfo(addr, NULL, NULL, &ai)) != 0) > + errx(1, "error in parsing local address string: %s", > + gai_strerror(error)); > + > + sa = ai->ai_addr; > + > + switch (ai->ai_family) { > +#ifdef INET > + case AF_INET: { > + struct in_addr addr = ((struct sockaddr_in *) sa)->sin_addr; > + > + if (IN_MULTICAST(ntohl(addr.s_addr))) > + errx(1, "local address cannot be multicast"); > + > + cmd.vxlcmd_sa.in4.sin_family = AF_INET; > + cmd.vxlcmd_sa.in4.sin_addr = addr; > + break; > + } > +#endif > +#ifdef INET6 > + case AF_INET6: { > + struct in6_addr *addr = &((struct sockaddr_in6 *)sa)->sin6_addr; > + > + if (IN6_IS_ADDR_MULTICAST(addr)) > + errx(1, "local address cannot be multicast"); > + > + cmd.vxlcmd_sa.in6.sin6_family = AF_INET6; > + cmd.vxlcmd_sa.in6.sin6_addr = *addr; > + break; > + } > +#endif > + default: > + errx(1, "local address %s not supported", addr); > + } > + > + freeaddrinfo(ai); > + > + if (!vxlan_exists(s)) { > + if (cmd.vxlcmd_sa.sa.sa_family == AF_INET) { > + params.vxlp_with |= VXLAN_PARAM_WITH_LOCAL_ADDR4; > + params.vxlp_local_in4 = cmd.vxlcmd_sa.in4.sin_addr; > + } else { > + params.vxlp_with |= VXLAN_PARAM_WITH_LOCAL_ADDR6; > + params.vxlp_local_in6 = cmd.vxlcmd_sa.in6.sin6_addr; > + } > + return; > + } > + > + if (do_cmd(s, VXLAN_CMD_SET_LOCAL_ADDR, &cmd, sizeof(cmd), 1) < 0) > + err(1, "VXLAN_CMD_SET_LOCAL_ADDR"); > +} > + > +static > +DECL_CMD_FUNC(setvxlan_remote, addr, d) > +{ > + struct ifvxlancmd cmd; > + struct addrinfo *ai; > + struct sockaddr *sa; > + int error; > + > + bzero(&cmd, sizeof(cmd)); > + > + if ((error = getaddrinfo(addr, NULL, NULL, &ai)) != 0) > + errx(1, "error in parsing remote address string: %s", > + gai_strerror(error)); > + > + sa = ai->ai_addr; > + > + switch (ai->ai_family) { > +#ifdef INET > + case AF_INET: { > + struct in_addr addr = ((struct sockaddr_in *)sa)->sin_addr; > + > + if (IN_MULTICAST(ntohl(addr.s_addr))) > + errx(1, "remote address cannot be multicast"); > + > + cmd.vxlcmd_sa.in4.sin_family = AF_INET; > + cmd.vxlcmd_sa.in4.sin_addr = addr; > + break; > + } > +#endif > +#ifdef INET6 > + case AF_INET6: { > + struct in6_addr *addr = &((struct sockaddr_in6 *)sa)->sin6_addr; > + > + if (IN6_IS_ADDR_MULTICAST(addr)) > + errx(1, "remote address cannot be multicast"); > + > + cmd.vxlcmd_sa.in6.sin6_family = AF_INET6; > + cmd.vxlcmd_sa.in6.sin6_addr = *addr; > + break; > + } > +#endif > + default: > + errx(1, "remote address %s not supported", addr); > + } > + > + freeaddrinfo(ai); > + > + if (!vxlan_exists(s)) { > + if (cmd.vxlcmd_sa.sa.sa_family == AF_INET) { > + params.vxlp_with |= VXLAN_PARAM_WITH_REMOTE_ADDR4; > + params.vxlp_remote_in4 = cmd.vxlcmd_sa.in4.sin_addr; > + } else { > + params.vxlp_with |= VXLAN_PARAM_WITH_REMOTE_ADDR6; > + params.vxlp_remote_in6 = cmd.vxlcmd_sa.in6.sin6_addr; > + } > + return; > + } > + > + if (do_cmd(s, VXLAN_CMD_SET_REMOTE_ADDR, &cmd, sizeof(cmd), 1) < 0) > + err(1, "VXLAN_CMD_SET_REMOTE_ADDR"); > +} > + > +static > +DECL_CMD_FUNC(setvxlan_group, addr, d) > +{ > + struct ifvxlancmd cmd; > + struct addrinfo *ai; > + struct sockaddr *sa; > + int error; > + > + bzero(&cmd, sizeof(cmd)); > + > + if ((error = getaddrinfo(addr, NULL, NULL, &ai)) != 0) > + errx(1, "error in parsing group address string: %s", > + gai_strerror(error)); > + > + sa = ai->ai_addr; > + > + switch (ai->ai_family) { > +#ifdef INET > + case AF_INET: { > + struct in_addr addr = ((struct sockaddr_in *)sa)->sin_addr; > + > + if (!IN_MULTICAST(ntohl(addr.s_addr))) > + errx(1, "group address must be multicast"); > + > + cmd.vxlcmd_sa.in4.sin_family = AF_INET; > + cmd.vxlcmd_sa.in4.sin_addr = addr; > + break; > + } > +#endif > +#ifdef INET6 > + case AF_INET6: { > + struct in6_addr *addr = &((struct sockaddr_in6 *)sa)->sin6_addr; > + > + if (!IN6_IS_ADDR_MULTICAST(addr)) > + errx(1, "group address must be multicast"); > + > + cmd.vxlcmd_sa.in6.sin6_family = AF_INET6; > + cmd.vxlcmd_sa.in6.sin6_addr = *addr; > + break; > + } > +#endif > + default: > + errx(1, "group address %s not supported", addr); > + } > + > + freeaddrinfo(ai); > + > + if (!vxlan_exists(s)) { > + if (cmd.vxlcmd_sa.sa.sa_family == AF_INET) { > + params.vxlp_with |= VXLAN_PARAM_WITH_REMOTE_ADDR4; > + params.vxlp_remote_in4 = cmd.vxlcmd_sa.in4.sin_addr; > + } else { > + params.vxlp_with |= VXLAN_PARAM_WITH_REMOTE_ADDR6; > + params.vxlp_remote_in6 = cmd.vxlcmd_sa.in6.sin6_addr; > + } > + return; > + } > + > + if (do_cmd(s, VXLAN_CMD_SET_REMOTE_ADDR, &cmd, sizeof(cmd), 1) < 0) > + err(1, "VXLAN_CMD_SET_REMOTE_ADDR"); > +} > + > +static > +DECL_CMD_FUNC(setvxlan_local_port, arg, d) > +{ > + struct ifvxlancmd cmd; > + u_long val; > + > + if (get_val(arg, &val) < 0 || val >= UINT16_MAX) > + errx(1, "invalid local port: %s", arg); > + > + if (!vxlan_exists(s)) { > + params.vxlp_with |= VXLAN_PARAM_WITH_LOCAL_PORT; > + params.vxlp_local_port = val; > + return; > + } > + > + bzero(&cmd, sizeof(cmd)); > + cmd.vxlcmd_port = val; > + > + if (do_cmd(s, VXLAN_CMD_SET_LOCAL_PORT, &cmd, sizeof(cmd), 1) < 0) > + err(1, "VXLAN_CMD_SET_LOCAL_PORT"); > +} > + > +static > +DECL_CMD_FUNC(setvxlan_remote_port, arg, d) > +{ > + struct ifvxlancmd cmd; > + u_long val; > + > + if (get_val(arg, &val) < 0 || val >= UINT16_MAX) > + errx(1, "invalid remote port: %s", arg); > + > + if (!vxlan_exists(s)) { > + params.vxlp_with |= VXLAN_PARAM_WITH_REMOTE_PORT; > + params.vxlp_remote_port = val; > + return; > + } > + > + bzero(&cmd, sizeof(cmd)); > + cmd.vxlcmd_port = val; > + > + if (do_cmd(s, VXLAN_CMD_SET_REMOTE_PORT, &cmd, sizeof(cmd), 1) < 0) > + err(1, "VXLAN_CMD_SET_REMOTE_PORT"); > +} > + > +static > +DECL_CMD_FUNC2(setvxlan_port_range, arg1, arg2) > +{ > + struct ifvxlancmd cmd; > + u_long min, max; > + > + if (get_val(arg1, &min) < 0 || min >= UINT16_MAX) > + errx(1, "invalid port range minimum: %s", arg1); > + if (get_val(arg2, &max) < 0 || max >= UINT16_MAX) > + errx(1, "invalid port range maximum: %s", arg2); > + if (max < min) > + errx(1, "invalid port range"); > + > + if (!vxlan_exists(s)) { > + params.vxlp_with |= VXLAN_PARAM_WITH_PORT_RANGE; > + params.vxlp_min_port = min; > + params.vxlp_max_port = max; > + return; > + } > + > + bzero(&cmd, sizeof(cmd)); > + cmd.vxlcmd_port_min = min; > + cmd.vxlcmd_port_max = max; > + > + if (do_cmd(s, VXLAN_CMD_SET_PORT_RANGE, &cmd, sizeof(cmd), 1) < 0) > + err(1, "VXLAN_CMD_SET_PORT_RANGE"); > +} > + > +static > +DECL_CMD_FUNC(setvxlan_timeout, arg, d) > +{ > + struct ifvxlancmd cmd; > + u_long val; > + > + if (get_val(arg, &val) < 0 || (val & ~0xFFFFFFFF) != 0) > + errx(1, "invalid timeout value: %s", arg); > + > + if (!vxlan_exists(s)) { > + params.vxlp_with |= VXLAN_PARAM_WITH_FTABLE_TIMEOUT; > + params.vxlp_ftable_timeout = val & 0xFFFFFFFF; > + return; > + } > + > + bzero(&cmd, sizeof(cmd)); > + cmd.vxlcmd_ftable_timeout = val & 0xFFFFFFFF; > + > + if (do_cmd(s, VXLAN_CMD_SET_FTABLE_TIMEOUT, &cmd, sizeof(cmd), 1) < 0) > + err(1, "VXLAN_CMD_SET_FTABLE_TIMEOUT"); > +} > + > +static > +DECL_CMD_FUNC(setvxlan_maxaddr, arg, d) > +{ > + struct ifvxlancmd cmd; > + u_long val; > + > + if (get_val(arg, &val) < 0 || (val & ~0xFFFFFFFF) != 0) > + errx(1, "invalid maxaddr value: %s", arg); > + > + if (!vxlan_exists(s)) { > + params.vxlp_with |= VXLAN_PARAM_WITH_FTABLE_MAX; > + params.vxlp_ftable_max = val & 0xFFFFFFFF; > + return; > + } > + > + bzero(&cmd, sizeof(cmd)); > + cmd.vxlcmd_ftable_max = val & 0xFFFFFFFF; > + > + if (do_cmd(s, VXLAN_CMD_SET_FTABLE_MAX, &cmd, sizeof(cmd), 1) < 0) > + err(1, "VXLAN_CMD_SET_FTABLE_MAX"); > +} > + > +static > +DECL_CMD_FUNC(setvxlan_dev, arg, d) > +{ > + struct ifvxlancmd cmd; > + > + if (!vxlan_exists(s)) { > + params.vxlp_with |= VXLAN_PARAM_WITH_MULTICAST_IF; > + strlcpy(params.vxlp_mc_ifname, arg, > + sizeof(params.vxlp_mc_ifname)); > + return; > + } > + > + bzero(&cmd, sizeof(cmd)); > + strlcpy(cmd.vxlcmd_ifname, arg, sizeof(cmd.vxlcmd_ifname)); > + > + if (do_cmd(s, VXLAN_CMD_SET_MULTICAST_IF, &cmd, sizeof(cmd), 1) < 0) > + err(1, "VXLAN_CMD_SET_MULTICAST_IF"); > +} > + > +static > +DECL_CMD_FUNC(setvxlan_ttl, arg, d) > +{ > + struct ifvxlancmd cmd; > + u_long val; > + > + if (get_val(arg, &val) < 0 || val > 256) > + errx(1, "invalid TTL value: %s", arg); > + > + if (!vxlan_exists(s)) { > + params.vxlp_with |= VXLAN_PARAM_WITH_TTL; > + params.vxlp_ttl = val; > + return; > + } > + > + bzero(&cmd, sizeof(cmd)); > + cmd.vxlcmd_ttl = val; > + > + if (do_cmd(s, VXLAN_CMD_SET_TTL, &cmd, sizeof(cmd), 1) < 0) > + err(1, "VXLAN_CMD_SET_TTL"); > +} > + > +static > +DECL_CMD_FUNC(setvxlan_learn, arg, d) > +{ > + struct ifvxlancmd cmd; > + > + if (!vxlan_exists(s)) { > + params.vxlp_with |= VXLAN_PARAM_WITH_LEARN; > + params.vxlp_learn = d; > + return; > + } > + > + bzero(&cmd, sizeof(cmd)); > + if (d != 0) > + cmd.vxlcmd_flags |= VXLAN_CMD_FLAG_LEARN; > + > + if (do_cmd(s, VXLAN_CMD_SET_LEARN, &cmd, sizeof(cmd), 1) < 0) > + err(1, "VXLAN_CMD_SET_LEARN"); > +} > + > +static void > +setvxlan_flush(const char *val, int d, int s, const struct afswtch *afp) > +{ > + struct ifvxlancmd cmd; > + > + bzero(&cmd, sizeof(cmd)); > + if (d != 0) > + cmd.vxlcmd_flags |= VXLAN_CMD_FLAG_FLUSH_ALL; > + > + if (do_cmd(s, VXLAN_CMD_FLUSH, &cmd, sizeof(cmd), 1) < 0) > + err(1, "VXLAN_CMD_FLUSH"); > +} > + > +static struct cmd vxlan_cmds[] = { > + > + DEF_CLONE_CMD_ARG("vni", setvxlan_vni), > + DEF_CLONE_CMD_ARG("local", setvxlan_local), > + DEF_CLONE_CMD_ARG("remote", setvxlan_remote), > + DEF_CLONE_CMD_ARG("group", setvxlan_group), > + DEF_CLONE_CMD_ARG("localport", setvxlan_local_port), > + DEF_CLONE_CMD_ARG("remoteport", setvxlan_remote_port), > + DEF_CLONE_CMD_ARG2("portrange", setvxlan_port_range), > + DEF_CLONE_CMD_ARG("timeout", setvxlan_timeout), > + DEF_CLONE_CMD_ARG("maxaddr", setvxlan_maxaddr), > + DEF_CLONE_CMD_ARG("vxlandev", setvxlan_dev), > + DEF_CLONE_CMD_ARG("ttl", setvxlan_ttl), > + DEF_CLONE_CMD("learn", 1, setvxlan_learn), > + DEF_CLONE_CMD("-learn", 0, setvxlan_learn), > + > + DEF_CMD_ARG("vni", setvxlan_vni), > + DEF_CMD_ARG("local", setvxlan_local), > + DEF_CMD_ARG("remote", setvxlan_remote), > + DEF_CMD_ARG("group", setvxlan_group), > + DEF_CMD_ARG("localport", setvxlan_local_port), > + DEF_CMD_ARG("remoteport", setvxlan_remote_port), > + DEF_CMD_ARG2("portrange", setvxlan_port_range), > + DEF_CMD_ARG("timeout", setvxlan_timeout), > + DEF_CMD_ARG("maxaddr", setvxlan_maxaddr), > + DEF_CMD_ARG("vxlandev", setvxlan_dev), > + DEF_CMD_ARG("ttl", setvxlan_ttl), > + DEF_CMD("learn", 1, setvxlan_learn), > + DEF_CMD("-learn", 0, setvxlan_learn), > + > + DEF_CMD("flush", 0, setvxlan_flush), > + DEF_CMD("flushall", 1, setvxlan_flush), > +}; > + > +static struct afswtch af_vxlan = { > + .af_name = "af_vxlan", > + .af_af = AF_UNSPEC, > + .af_other_status = vxlan_status, > +}; > + > +static __constructor void > +vxlan_ctor(void) > +{ > +#define N(a) (sizeof(a) / sizeof(a[0])) > + size_t i; > + > + for (i = 0; i < N(vxlan_cmds); i++) > + cmd_register(&vxlan_cmds[i]); > + af_register(&af_vxlan); > + callback_register(vxlan_cb, NULL); > + clone_setdefcallback("vxlan", vxlan_create); > +#undef N > +} > > Modified: head/share/man/man4/Makefile > ============================================================================== > --- head/share/man/man4/Makefile Mon Oct 20 14:25:23 2014 (r273330) > +++ head/share/man/man4/Makefile Mon Oct 20 14:42:42 2014 (r273331) > @@ -567,6 +567,7 @@ MAN= aac.4 \ > ${_virtio_scsi.4} \ > vkbd.4 \ > vlan.4 \ > + vxlan.4 \ > ${_vmx.4} \ > vpo.4 \ > vr.4 \ > @@ -743,6 +744,7 @@ MLINKS+=urndis.4 if_urndis.4 > MLINKS+=${_urtw.4} ${_if_urtw.4} > MLINKS+=vge.4 if_vge.4 > MLINKS+=vlan.4 if_vlan.4 > +MLINKS+=vxlan.4 if_vxlan.4 > MLINKS+=${_vmx.4} ${_if_vmx.4} > MLINKS+=vpo.4 imm.4 > MLINKS+=vr.4 if_vr.4 > > Added: head/share/man/man4/vxlan.4 > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/share/man/man4/vxlan.4 Mon Oct 20 14:42:42 2014 (r273331) > @@ -0,0 +1,235 @@ > +.\" Copyright (c) 2014 Bryan Venteicher > +.\" All rights reserved. > +.\" > +.\" Redistribution and use in source and binary forms, with or without > +.\" modification, are permitted provided that the following conditions > +.\" are met: > +.\" 1. Redistributions of source code must retain the above copyright > +.\" notice, this list of conditions and the following disclaimer. > +.\" 2. Redistributions in binary form must reproduce the above copyright > +.\" notice, this list of conditions and the following disclaimer in the > +.\" documentation and/or other materials provided with the distribution. > +.\" > +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 October 20, 2014 > +.Dt VXLAN 4 > +.Os > +.Sh NAME > +.Nm vxlan > +.Nd "Virtual eXtensible LAN interface" > +.Sh SYNOPSIS > +To compile this driver into the kernel, > +place the following line in your > +kernel configuration file: > +.Bd -ragged -offset indent > +.Cd "device vxlan" > +.Ed > +.Pp > +Alternatively, to load the driver as a > +module at boot time, place the following line in > +.Xr loader.conf 5 : > +.Bd -literal -offset indent > +if_vxlan_load="YES" > +.Ed > +.Sh DESCRIPTION > +The > +.Nm > +driver creates a virtual tunnel endpoint in a > +.Nm > +segment. > +A > +.Nm > +segment is a virtual Layer 2 (Ethernet) network that is overlaid > +in a Layer 3 (IP/UDP) network. > +.Nm > +is analogous to > +.Xr vlan 4 > +but is designed to be better suited for large, multiple tenant > +data center environments. > +.Pp > +Each > +.Nm > +interface is created at runtime using interface cloning. > +This is most easily done with the > +.Xr ifconfig 8 > +.Cm create > +command or using the > +.Va cloned_interfaces > +variable in > +.Xr rc.conf 5 . > +The interface may be removed with the > +.Xr ifconfig 8 > +.Cm destroy > +command. > +.Pp > +The > +.Nm > +driver creates a pseudo Ethernet network interface > +that supports the usual network > +.Xr ioctl 2 Ns s > +and is thus can be used with > +.Xr ifconfig 8 > +like any other Ethernet interface. > +The > +.Nm > +interface encapsulates the Ethernet frame > +by prepending IP/UDP and > +.Nm > +headers. > +Thus, the encapsulated (inner) frame is able to transmitted > +over a routed, Layer 3 network to the remote host. > +.Pp > +The > +.Nm > +interface may be configured in either unicast or multicast mode. > +When in unicast mode, > +the interface creates a tunnel to a single remote host, > +and all traffic is transmitted to that host. > +When in multicast mode, > +the interface joins an IP multicast group, > +and receives packets sent to the group address, > +and transmits packets to either the multicast group address, > +or directly the remote host if there is an appropriate > +forwarding table entry. > +.Pp > +When the > +.Nm > +interface is brought up, a > +.Xr UDP 4 > +.Xr socket 9 > +is created based on the configuration, > +such as the local address for unicast mode or > +the group address for multicast mode, > +and the listening (local) port number. > +Since multiple > +.Nm > +interfaces may be created that either > +use the same local address > +or join the same group address, > +and use the same port, > +the driver may share a socket among multiple interfaces. > +However, each interface within a socket must belong to > +a unique > +.Nm > +segment. > +The analogous > +.Xr vlan 4 > +configuration would be a physical interface configured as > +the parent device for multiple VLAN interfaces, each with > +a unique VLAN tag. > +Each > +.Nm > +segment is identified by a 24-bit value in the > +.Nm > +header called the > +.Dq VXLAN Network Identifier , > +or VNI. > +.Pp > +When configured with the > +.Xr ifconfig 8 > +.Cm learn > +parameter, the interface dynamically creates forwarding table entries > +from received packets. > +An entry in the forwarding table maps the inner source MAC address > +to the outer remote IP address. > +During transmit, the interface attempts to lookup an entry for > +the encapsulated destination MAC address. > +If an entry is found, the IP address in the entry is used to directly > +transmit the encapsulated frame to the destination. > +Otherwise, when configured in multicast mode, > +the interface must flood the frame to all hosts in the group. > +The maximum number of entries in the table is configurable with the > +.Xr ifconfig 8 > +.Cm maxaddr > +command. > +Stale entries in the table periodically pruned. > +The timeout is configurable with the > +.Xr ifconfig 8 > +.Cm timeout > +command. > +The table may be viewed with the > +.Xr sysctl 8 > +.Cm net.link.vlxan.N.ftable.dump > +command. > +.Sh MTU > +Since the > +.Nm > +interface encapsulates the Ethernet frame with an IP, UDP, and > +.Nm > +header, the resulting frame may be larger than the MTU of the > +physical network. > +The > +.Nm > +specification recommends the physical network MTU be configured > +to use jumbo frames to accommodate the encapsulated frame size. > +Alternatively, the > +.Xr ifconfig 8 > +.Cm mtu > +command may be used to reduce the MTU size on the > +.Nm > +interface to allow the encapsulated frame to fit in the > +current MTU of the physical network. > +.Sh EXAMPLES > +Create a > +.Nm > +interface in unicast mode > +with the > +.Cm local > +tunnel address of 192.168.100.1, > +and the > +.Cm remote > +tunnel address of 192.168.100.2. > +.Bd -literal -offset indent > +ifconfig vxlan create vni 108 local 192.168.100.1 remote 192.168.100.2 > +.Ed > +.Pp > +Create a > +.Nm > +interface in multicast mode, > +with the > +.Cm local > +address of 192.168.10.95, > +and the > +.Cm group > +address of 224.0.2.6. > +The em0 interface will be used to transmit multicast packets. > +.Bd -literal -offset indent > +ifconfig vxlan create vni 42 local 192.168.10.95 group 224.0.2.6 vxlandev em0 > +.Ed > +.Pp > +Once created, the > +.Nm > +interface can be configured with > +.Xr ifconfig 8 . > +.Sh SEE ALSO > +.Xr ifconfig 8 , > +.Xr inet 4 , > +.Xr inet 6 , > +.Xr sysctl 8 , > +.Xr vlan 8 > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 17:04:06 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0FC7D70A; Mon, 20 Oct 2014 17:04:06 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EE96CB18; Mon, 20 Oct 2014 17:04:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KH45df080152; Mon, 20 Oct 2014 17:04:05 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KH44wX079917; Mon, 20 Oct 2014 17:04:04 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201410201704.s9KH44wX079917@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Mon, 20 Oct 2014 17:04:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273334 - in head/sys: boot/common kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 17:04:06 -0000 Author: marcel Date: Mon Oct 20 17:04:03 2014 New Revision: 273334 URL: https://svnweb.freebsd.org/changeset/base/273334 Log: Fully support constructors for the purpose of code coverage analysis. This involves: 1. Have the loader pass the start and size of the .ctors section to the kernel in 2 new metadata elements. 2. Have the linker backends look for and record the start and size of the .ctors section in dynamically loaded modules. 3. Have the linker backends call the constructors as part of the final work of initializing preloaded or dynamically loaded modules. Note that LLVM appends the priority of the constructors to the name of the .ctors section. Not so when compiling with GCC. The code currently works for GCC and not for LLVM. Submitted by: Dmitry Mikulin Obtained from: Juniper Networks, Inc. Modified: head/sys/boot/common/load_elf.c head/sys/kern/kern_linker.c head/sys/kern/link_elf.c head/sys/kern/link_elf_obj.c head/sys/kern/subr_prof.c head/sys/sys/linker.h Modified: head/sys/boot/common/load_elf.c ============================================================================== --- head/sys/boot/common/load_elf.c Mon Oct 20 15:41:11 2014 (r273333) +++ head/sys/boot/common/load_elf.c Mon Oct 20 17:04:03 2014 (r273334) @@ -240,6 +240,7 @@ __elfN(loadimage)(struct preloaded_file Elf_Ehdr *ehdr; Elf_Phdr *phdr, *php; Elf_Shdr *shdr; + char *shstr; int ret; vm_offset_t firstaddr; vm_offset_t lastaddr; @@ -248,6 +249,7 @@ __elfN(loadimage)(struct preloaded_file Elf_Addr ssym, esym; Elf_Dyn *dp; Elf_Addr adp; + Elf_Addr ctors; int ndp; int symstrindex; int symtabindex; @@ -383,10 +385,11 @@ __elfN(loadimage)(struct preloaded_file lastaddr = roundup(lastaddr, sizeof(long)); /* - * Now grab the symbol tables. This isn't easy if we're reading a - * .gz file. I think the rule is going to have to be that you must - * strip a file to remove symbols before gzipping it so that we do not - * try to lseek() on it. + * Get the section headers. We need this for finding the .ctors + * section as well as for loading any symbols. Both may be hard + * to do if reading from a .gz file as it involves seeking. I + * think the rule is going to have to be that you must strip a + * file to remove symbols before gzipping it. */ chunk = ehdr->e_shnum * ehdr->e_shentsize; if (chunk == 0 || ehdr->e_shoff == 0) @@ -399,6 +402,33 @@ __elfN(loadimage)(struct preloaded_file } file_addmetadata(fp, MODINFOMD_SHDR, chunk, shdr); + /* + * Read the section string table and look for the .ctors section. + * We need to tell the kernel where it is so that it can call the + * ctors. + */ + chunk = shdr[ehdr->e_shstrndx].sh_size; + if (chunk) { + shstr = alloc_pread(ef->fd, shdr[ehdr->e_shstrndx].sh_offset, chunk); + if (shstr) { + for (i = 0; i < ehdr->e_shnum; i++) { + if (strcmp(shstr + shdr[i].sh_name, ".ctors") != 0) + continue; + ctors = shdr[i].sh_addr; + file_addmetadata(fp, MODINFOMD_CTORS_ADDR, sizeof(ctors), + &ctors); + size = shdr[i].sh_size; + file_addmetadata(fp, MODINFOMD_CTORS_SIZE, sizeof(size), + &size); + break; + } + free(shstr); + } + } + + /* + * Now load any symbols. + */ symtabindex = -1; symstrindex = -1; for (i = 0; i < ehdr->e_shnum; i++) { Modified: head/sys/kern/kern_linker.c ============================================================================== --- head/sys/kern/kern_linker.c Mon Oct 20 15:41:11 2014 (r273333) +++ head/sys/kern/kern_linker.c Mon Oct 20 17:04:03 2014 (r273334) @@ -573,6 +573,8 @@ linker_make_file(const char *pathname, l lf = (linker_file_t)kobj_create((kobj_class_t)lc, M_LINKER, M_WAITOK); if (lf == NULL) return (NULL); + lf->ctors_addr = 0; + lf->ctors_size = 0; lf->refs = 1; lf->userrefs = 0; lf->flags = 0; Modified: head/sys/kern/link_elf.c ============================================================================== --- head/sys/kern/link_elf.c Mon Oct 20 15:41:11 2014 (r273333) +++ head/sys/kern/link_elf.c Mon Oct 20 17:04:03 2014 (r273334) @@ -331,6 +331,22 @@ link_elf_error(const char *filename, con printf("kldload: %s: %s\n", filename, s); } +static void +link_elf_invoke_ctors(caddr_t addr, size_t size) +{ + void (**ctor)(void); + size_t i, cnt; + + if (addr == NULL || size == 0) + return; + cnt = size / sizeof(*ctor); + ctor = (void *)addr; + for (i = 0; i < cnt; i++) { + if (ctor[i] != NULL) + (*ctor[i])(); + } +} + /* * Actions performed after linking/loading both the preloaded kernel and any * modules; whether preloaded or dynamicly loaded. @@ -360,6 +376,8 @@ link_elf_link_common_finish(linker_file_ GDB_STATE(RT_CONSISTENT); #endif + /* Invoke .ctors */ + link_elf_invoke_ctors(lf->ctors_addr, lf->ctors_size); return (0); } @@ -367,6 +385,8 @@ static void link_elf_init(void* arg) { Elf_Dyn *dp; + Elf_Addr *ctors_addrp; + Elf_Size *ctors_sizep; caddr_t modptr, baseptr, sizeptr; elf_file_t ef; char *modname; @@ -408,6 +428,15 @@ link_elf_init(void* arg) sizeptr = preload_search_info(modptr, MODINFO_SIZE); if (sizeptr != NULL) linker_kernel_file->size = *(size_t *)sizeptr; + ctors_addrp = (Elf_Addr *)preload_search_info(modptr, + MODINFO_METADATA | MODINFOMD_CTORS_ADDR); + ctors_sizep = (Elf_Size *)preload_search_info(modptr, + MODINFO_METADATA | MODINFOMD_CTORS_SIZE); + if (ctors_addrp != NULL && ctors_sizep != NULL) { + linker_kernel_file->ctors_addr = ef->address + + *ctors_addrp; + linker_kernel_file->ctors_size = *ctors_sizep; + } } (void)link_elf_preload_parse_symbols(ef); @@ -635,6 +664,8 @@ static int link_elf_link_preload(linker_class_t cls, const char* filename, linker_file_t *result) { + Elf_Addr *ctors_addrp; + Elf_Size *ctors_sizep; caddr_t modptr, baseptr, sizeptr, dynptr; char *type; elf_file_t ef; @@ -675,6 +706,15 @@ link_elf_link_preload(linker_class_t cls lf->address = ef->address; lf->size = *(size_t *)sizeptr; + ctors_addrp = (Elf_Addr *)preload_search_info(modptr, + MODINFO_METADATA | MODINFOMD_CTORS_ADDR); + ctors_sizep = (Elf_Size *)preload_search_info(modptr, + MODINFO_METADATA | MODINFOMD_CTORS_SIZE); + if (ctors_addrp != NULL && ctors_sizep != NULL) { + lf->ctors_addr = ef->address + *ctors_addrp; + lf->ctors_size = *ctors_sizep; + } + error = parse_dynamic(ef); if (error == 0) error = parse_dpcpu(ef); @@ -734,11 +774,14 @@ link_elf_load_file(linker_class_t cls, c Elf_Shdr *shdr; int symtabindex; int symstrindex; + int shstrindex; int symcnt; int strcnt; + char *shstrs; shdr = NULL; lf = NULL; + shstrs = NULL; NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, filename, td); flags = FREAD; @@ -977,12 +1020,31 @@ link_elf_load_file(linker_class_t cls, c &resid, td); if (error != 0) goto out; + + /* Read section string table */ + shstrindex = hdr->e_shstrndx; + if (shstrindex != 0 && shdr[shstrindex].sh_type == SHT_STRTAB && + shdr[shstrindex].sh_size != 0) { + nbytes = shdr[shstrindex].sh_size; + shstrs = malloc(nbytes, M_LINKER, M_WAITOK | M_ZERO); + error = vn_rdwr(UIO_READ, nd.ni_vp, (caddr_t)shstrs, nbytes, + shdr[shstrindex].sh_offset, UIO_SYSSPACE, IO_NODELOCKED, + td->td_ucred, NOCRED, &resid, td); + if (error) + goto out; + } + symtabindex = -1; symstrindex = -1; for (i = 0; i < hdr->e_shnum; i++) { if (shdr[i].sh_type == SHT_SYMTAB) { symtabindex = i; symstrindex = shdr[i].sh_link; + } else if (shstrs != NULL && shdr[i].sh_name != 0 && + strcmp(shstrs + shdr[i].sh_name, ".ctors") == 0) { + /* Record relocated address and size of .ctors. */ + lf->ctors_addr = mapbase + shdr[i].sh_addr - base_vaddr; + lf->ctors_size = shdr[i].sh_size; } } if (symtabindex < 0 || symstrindex < 0) @@ -1027,6 +1089,8 @@ out: free(shdr, M_LINKER); if (firstpage != NULL) free(firstpage, M_LINKER); + if (shstrs != NULL) + free(shstrs, M_LINKER); return (error); } Modified: head/sys/kern/link_elf_obj.c ============================================================================== --- head/sys/kern/link_elf_obj.c Mon Oct 20 15:41:11 2014 (r273333) +++ head/sys/kern/link_elf_obj.c Mon Oct 20 17:04:03 2014 (r273334) @@ -363,6 +363,10 @@ link_elf_link_preload(linker_class_t cls vnet_data_copy(vnet_data, shdr[i].sh_size); ef->progtab[pb].addr = vnet_data; #endif + } else if (ef->progtab[pb].name != NULL && + !strcmp(ef->progtab[pb].name, ".ctors")) { + lf->ctors_addr = ef->progtab[pb].addr; + lf->ctors_size = shdr[i].sh_size; } /* Update all symbol values with the offset. */ @@ -408,6 +412,22 @@ out: return (error); } +static void +link_elf_invoke_ctors(caddr_t addr, size_t size) +{ + void (**ctor)(void); + size_t i, cnt; + + if (addr == NULL || size == 0) + return; + cnt = size / sizeof(*ctor); + ctor = (void *)addr; + for (i = 0; i < cnt; i++) { + if (ctor[i] != NULL) + (*ctor[i])(); + } +} + static int link_elf_link_preload_finish(linker_file_t lf) { @@ -424,6 +444,8 @@ link_elf_link_preload_finish(linker_file if (error) return (error); + /* Invoke .ctors */ + link_elf_invoke_ctors(lf->ctors_addr, lf->ctors_size); return (0); } @@ -727,10 +749,14 @@ link_elf_load_file(linker_class_t cls, c alignmask = shdr[i].sh_addralign - 1; mapbase += alignmask; mapbase &= ~alignmask; - if (ef->shstrtab && shdr[i].sh_name != 0) + if (ef->shstrtab != NULL && shdr[i].sh_name != 0) { ef->progtab[pb].name = ef->shstrtab + shdr[i].sh_name; - else if (shdr[i].sh_type == SHT_PROGBITS) + if (!strcmp(ef->progtab[pb].name, ".ctors")) { + lf->ctors_addr = (caddr_t)mapbase; + lf->ctors_size = shdr[i].sh_size; + } + } else if (shdr[i].sh_type == SHT_PROGBITS) ef->progtab[pb].name = "<>"; else ef->progtab[pb].name = "<>"; @@ -860,6 +886,9 @@ link_elf_load_file(linker_class_t cls, c if (error) goto out; + /* Invoke .ctors */ + link_elf_invoke_ctors(lf->ctors_addr, lf->ctors_size); + *result = lf; out: Modified: head/sys/kern/subr_prof.c ============================================================================== --- head/sys/kern/subr_prof.c Mon Oct 20 15:41:11 2014 (r273333) +++ head/sys/kern/subr_prof.c Mon Oct 20 17:04:03 2014 (r273334) @@ -540,50 +540,3 @@ out: stopprofclock(p); PROC_UNLOCK(p); } - -#if (defined(__amd64__) || defined(__i386__)) && \ - defined(__GNUCLIKE_CTOR_SECTION_HANDLING) -/* - * Support for "--test-coverage --profile-arcs" in GCC. - * - * We need to call all the functions in the .ctor section, in order - * to get all the counter-arrays strung into a list. - * - * XXX: the .ctors call __bb_init_func which is located in over in - * XXX: i386/i386/support.s for historical reasons. There is probably - * XXX: no reason for that to be assembler anymore, but doing it right - * XXX: in MI C code requires one to reverse-engineer the type-selection - * XXX: inside GCC. Have fun. - * - * XXX: Worrisome perspective: Calling the .ctors may make C++ in the - * XXX: kernel feasible. Don't. - */ -typedef void (*ctor_t)(void); -extern ctor_t _start_ctors, _stop_ctors; - -static void -tcov_init(void *foo __unused) -{ - ctor_t *p, q; - - for (p = &_start_ctors; p < &_stop_ctors; p++) { - q = *p; - q(); - } -} - -SYSINIT(tcov_init, SI_SUB_KPROF, SI_ORDER_SECOND, tcov_init, NULL); - -/* - * GCC contains magic to recognize calls to for instance execve() and - * puts in calls to this function to preserve the profile counters. - * XXX: Put zinging punchline here. - */ -void __bb_fork_func(void); -void -__bb_fork_func(void) -{ -} - -#endif - Modified: head/sys/sys/linker.h ============================================================================== --- head/sys/sys/linker.h Mon Oct 20 15:41:11 2014 (r273333) +++ head/sys/sys/linker.h Mon Oct 20 17:04:03 2014 (r273334) @@ -79,6 +79,8 @@ struct linker_file { int id; /* unique id */ caddr_t address; /* load address */ size_t size; /* size of file */ + caddr_t ctors_addr; /* address of .ctors */ + size_t ctors_size; /* size of .ctors */ int ndeps; /* number of dependencies */ linker_file_t* deps; /* list of dependencies */ STAILQ_HEAD(, common_symbol) common; /* list of common symbols */ @@ -211,6 +213,8 @@ void *linker_hwpmc_list_objects(void); #define MODINFOMD_KERNEND 0x0008 /* kernend */ #endif #define MODINFOMD_SHDR 0x0009 /* section header table */ +#define MODINFOMD_CTORS_ADDR 0x000a /* address of .ctors */ +#define MODINFOMD_CTORS_SIZE 0x000b /* size of .ctors */ #define MODINFOMD_NOCOPY 0x8000 /* don't copy this metadata to the kernel */ #define MODINFOMD_DEPLIST (0x4001 | MODINFOMD_NOCOPY) /* depends on */ From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 17:53:49 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DB1086C0; Mon, 20 Oct 2014 17:53:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C7EB6D5; Mon, 20 Oct 2014 17:53:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KHrn5J009501; Mon, 20 Oct 2014 17:53:49 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KHrnaG009500; Mon, 20 Oct 2014 17:53:49 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410201753.s9KHrnaG009500@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 20 Oct 2014 17:53:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273335 - head/sys/fs/unionfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 17:53:50 -0000 Author: mjg Date: Mon Oct 20 17:53:49 2014 New Revision: 273335 URL: https://svnweb.freebsd.org/changeset/base/273335 Log: unionfs: hold mount interlock while manipulating mnt_flag This is for consistency with other filesystems. Modified: head/sys/fs/unionfs/union_vfsops.c Modified: head/sys/fs/unionfs/union_vfsops.c ============================================================================== --- head/sys/fs/unionfs/union_vfsops.c Mon Oct 20 17:04:03 2014 (r273334) +++ head/sys/fs/unionfs/union_vfsops.c Mon Oct 20 17:53:49 2014 (r273335) @@ -290,12 +290,14 @@ unionfs_domount(struct mount *mp) return (error); } + MNT_ILOCK(mp); /* * Check mnt_flag */ if ((ump->um_lowervp->v_mount->mnt_flag & MNT_LOCAL) && (ump->um_uppervp->v_mount->mnt_flag & MNT_LOCAL)) mp->mnt_flag |= MNT_LOCAL; + MNT_IUNLOCK(mp); /* * Get new fsid From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 18:00:52 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E731D983; Mon, 20 Oct 2014 18:00:52 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C81F9128; Mon, 20 Oct 2014 18:00:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KI0qja010951; Mon, 20 Oct 2014 18:00:52 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KI0pKK010940; Mon, 20 Oct 2014 18:00:51 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410201800.s9KI0pKK010940@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 20 Oct 2014 18:00:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273336 - in head/sys: fs/nullfs fs/tmpfs fs/unionfs kern sys ufs/ffs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 18:00:53 -0000 Author: mjg Date: Mon Oct 20 18:00:50 2014 New Revision: 273336 URL: https://svnweb.freebsd.org/changeset/base/273336 Log: Provide vfs suspension support only for filesystems which need it, take two. nullfs and unionfs need to request suspension if underlying filesystem(s) use it. Utilize mnt_kern_flag for this purpose. This is a fixup for 273271. No strong objections from: kib Pointy hat to: mjg MFC after: 2 weeks Modified: head/sys/fs/nullfs/null_vfsops.c head/sys/fs/tmpfs/tmpfs_vfsops.c head/sys/fs/unionfs/union_vfsops.c head/sys/kern/vfs_vnops.c head/sys/sys/mount.h head/sys/ufs/ffs/ffs_vfsops.c Modified: head/sys/fs/nullfs/null_vfsops.c ============================================================================== --- head/sys/fs/nullfs/null_vfsops.c Mon Oct 20 17:53:49 2014 (r273335) +++ head/sys/fs/nullfs/null_vfsops.c Mon Oct 20 18:00:50 2014 (r273336) @@ -198,6 +198,8 @@ nullfs_mount(struct mount *mp) MNTK_EXTENDED_SHARED); } mp->mnt_kern_flag |= MNTK_LOOKUP_EXCL_DOTDOT; + mp->mnt_kern_flag |= lowerrootvp->v_mount->mnt_kern_flag & + MNTK_SUSPENDABLE; MNT_IUNLOCK(mp); mp->mnt_data = xmp; vfs_getnewfsid(mp); Modified: head/sys/fs/tmpfs/tmpfs_vfsops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vfsops.c Mon Oct 20 17:53:49 2014 (r273335) +++ head/sys/fs/tmpfs/tmpfs_vfsops.c Mon Oct 20 18:00:50 2014 (r273336) @@ -255,6 +255,7 @@ tmpfs_mount(struct mount *mp) MNT_ILOCK(mp); mp->mnt_flag |= MNT_LOCAL; + mp->mnt_kern_flag |= MNTK_SUSPENDABLE; MNT_IUNLOCK(mp); mp->mnt_data = tmp; @@ -427,14 +428,6 @@ tmpfs_sync(struct mount *mp, int waitfor } /* - * A stub created so that vfs does vn_start_write for this filesystem - */ -static void -tmpfs_susp_clean(struct mount *mp) -{ -} - -/* * tmpfs vfs operations. */ @@ -445,6 +438,5 @@ struct vfsops tmpfs_vfsops = { .vfs_statfs = tmpfs_statfs, .vfs_fhtovp = tmpfs_fhtovp, .vfs_sync = tmpfs_sync, - .vfs_susp_clean = tmpfs_susp_clean, }; VFS_SET(tmpfs_vfsops, tmpfs, VFCF_JAIL); Modified: head/sys/fs/unionfs/union_vfsops.c ============================================================================== --- head/sys/fs/unionfs/union_vfsops.c Mon Oct 20 17:53:49 2014 (r273335) +++ head/sys/fs/unionfs/union_vfsops.c Mon Oct 20 18:00:50 2014 (r273336) @@ -297,6 +297,13 @@ unionfs_domount(struct mount *mp) if ((ump->um_lowervp->v_mount->mnt_flag & MNT_LOCAL) && (ump->um_uppervp->v_mount->mnt_flag & MNT_LOCAL)) mp->mnt_flag |= MNT_LOCAL; + + /* + * Check mnt_kern_flag + */ + if ((ump->um_lowervp->v_mount->mnt_flag & MNTK_SUSPENDABLE) || + (ump->um_uppervp->v_mount->mnt_flag & MNTK_SUSPENDABLE)) + mp->mnt_kern_flag |= MNTK_SUSPENDABLE; MNT_IUNLOCK(mp); /* Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Mon Oct 20 17:53:49 2014 (r273335) +++ head/sys/kern/vfs_vnops.c Mon Oct 20 18:00:50 2014 (r273336) @@ -1576,7 +1576,7 @@ static bool vn_suspendable_mp(struct mount *mp) { - return (mp->mnt_op->vfs_susp_clean != NULL); + return ((mp->mnt_kern_flag & MNTK_SUSPENDABLE) != 0); } static bool Modified: head/sys/sys/mount.h ============================================================================== --- head/sys/sys/mount.h Mon Oct 20 17:53:49 2014 (r273335) +++ head/sys/sys/mount.h Mon Oct 20 18:00:50 2014 (r273336) @@ -361,7 +361,7 @@ void __mnt_vnode_markerfree_act #define MNTK_SUSPEND 0x08000000 /* request write suspension */ #define MNTK_SUSPEND2 0x04000000 /* block secondary writes */ #define MNTK_SUSPENDED 0x10000000 /* write operations are suspended */ -#define MNTK_UNUSED25 0x20000000 /* --available-- */ +#define MNTK_SUSPENDABLE 0x20000000 /* writes can be suspended */ #define MNTK_LOOKUP_SHARED 0x40000000 /* FS supports shared lock lookups */ #define MNTK_NOKNOTE 0x80000000 /* Don't send KNOTEs from VOP hooks */ @@ -754,10 +754,11 @@ vfs_statfs_t __vfs_statfs; _rc; }) #define VFS_SUSP_CLEAN(MP) do { \ - MPASS(*(MP)->mnt_op->vfs_susp_clean != NULL); \ - VFS_PROLOGUE(MP); \ - (*(MP)->mnt_op->vfs_susp_clean)(MP); \ - VFS_EPILOGUE(MP); \ + if (*(MP)->mnt_op->vfs_susp_clean != NULL) { \ + VFS_PROLOGUE(MP); \ + (*(MP)->mnt_op->vfs_susp_clean)(MP); \ + VFS_EPILOGUE(MP); \ + } \ } while (0) #define VFS_RECLAIM_LOWERVP(MP, VP) do { \ Modified: head/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vfsops.c Mon Oct 20 17:53:49 2014 (r273335) +++ head/sys/ufs/ffs/ffs_vfsops.c Mon Oct 20 18:00:50 2014 (r273336) @@ -1055,7 +1055,7 @@ ffs_mountfs(devvp, mp, td) */ MNT_ILOCK(mp); mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_EXTENDED_SHARED | - MNTK_NO_IOPF | MNTK_UNMAPPED_BUFS; + MNTK_NO_IOPF | MNTK_UNMAPPED_BUFS | MNTK_SUSPENDABLE; MNT_IUNLOCK(mp); #ifdef UFS_EXTATTR #ifdef UFS_EXTATTR_AUTOSTART From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 18:04:21 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4321CC33; Mon, 20 Oct 2014 18:04:21 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2F1151E3; Mon, 20 Oct 2014 18:04:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KI4LRH014772; Mon, 20 Oct 2014 18:04:21 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KI4LmG014771; Mon, 20 Oct 2014 18:04:21 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201410201804.s9KI4LmG014771@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Mon, 20 Oct 2014 18:04:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273337 - head/sys/arm/broadcom/bcm2835 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 18:04:21 -0000 Author: loos Date: Mon Oct 20 18:04:20 2014 New Revision: 273337 URL: https://svnweb.freebsd.org/changeset/base/273337 Log: Fix the mtx_sleep() error checking, catch all errors and not only EWOULDBLOCK. Do not print any message at errors. The errors are properly sent to upper layers which should be able to deal with it, including printing the errors when they need to. The error message was quite annoying while scanning the i2c bus. MFC after: 1 week Modified: head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Mon Oct 20 18:00:50 2014 (r273336) +++ head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Mon Oct 20 18:04:20 2014 (r273337) @@ -441,12 +441,11 @@ bcm_bsc_transfer(device_t dev, struct ii /* Wait for the transaction to complete. */ err = mtx_sleep(dev, &sc->sc_mtx, 0, "bsciow", hz); - /* Check if we have a timeout or an I2C error. */ - if ((sc->sc_flags & BCM_I2C_ERROR) || err == EWOULDBLOCK) { - device_printf(sc->sc_dev, "I2C error\n"); + /* Check for errors. */ + if (err != 0 && (sc->sc_flags & BCM_I2C_ERROR)) err = EIO; + if (err != 0) break; - } } /* Clean the controller flags. */ From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 18:07:14 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C5D6CDF2; Mon, 20 Oct 2014 18:07:14 +0000 (UTC) Received: from vlakno.cz (mail.vlakno.cz [91.217.96.224]) by mx1.freebsd.org (Postfix) with ESMTP id 89177208; Mon, 20 Oct 2014 18:07:14 +0000 (UTC) Received: by vlakno.cz (Postfix, from userid 1002) id 729331D95A3C; Mon, 20 Oct 2014 20:00:02 +0200 (CEST) Date: Mon, 20 Oct 2014 20:00:02 +0200 From: Roman Divacky To: Marcel Moolenaar Subject: Re: svn commit: r273334 - in head/sys: boot/common kern sys Message-ID: <20141020180002.GA85946@vlakno.cz> References: <201410201704.s9KH44wX079917@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201410201704.s9KH44wX079917@svn.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 18:07:14 -0000 > Note that LLVM appends the priority of the constructors to the name of > the .ctors section. Not so when compiling with GCC. The code currently > works for GCC and not for LLVM. Uhm? LLVM here creates ".ctors" section, nothing is appended. Can you be more specific on what you're seing? Roman From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 18:09:35 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2DC4CF52; Mon, 20 Oct 2014 18:09:35 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0ED01216; Mon, 20 Oct 2014 18:09:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KI9YIP015614; Mon, 20 Oct 2014 18:09:34 GMT (envelope-from neel@FreeBSD.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KI9YQu015608; Mon, 20 Oct 2014 18:09:34 GMT (envelope-from neel@FreeBSD.org) Message-Id: <201410201809.s9KI9YQu015608@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: neel set sender to neel@FreeBSD.org using -f From: Neel Natu Date: Mon, 20 Oct 2014 18:09:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273338 - in head/sys: amd64/amd64 sys x86/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 18:09:35 -0000 Author: neel Date: Mon Oct 20 18:09:33 2014 New Revision: 273338 URL: https://svnweb.freebsd.org/changeset/base/273338 Log: Merge from projects/bhyve_svm all the changes outside vmm.ko or bhyve utilities: Add support for AMD's nested page tables in pmap.c: - Provide the correct bit mask for various bit fields in a PTE (e.g. valid bit) for a pmap of type PT_RVI. - Add a function 'pmap_type_guest(pmap)' that returns TRUE if the pmap is of type PT_EPT or PT_RVI. Add CPU_SET_ATOMIC_ACQ(num, cpuset): This is used when activating a vcpu in the nested pmap. Using the 'acquire' variant guarantees that the load of the 'pm_eptgen' will happen only after the vcpu is activated in 'pm_active'. Add defines for various AMD-specific MSRs. Submitted by: Anish Gupta (akgupt3@gmail.com) Modified: head/sys/amd64/amd64/pmap.c head/sys/sys/bitset.h head/sys/sys/cpuset.h head/sys/x86/include/specialreg.h Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Mon Oct 20 18:04:20 2014 (r273337) +++ head/sys/amd64/amd64/pmap.c Mon Oct 20 18:09:33 2014 (r273338) @@ -146,6 +146,13 @@ __FBSDID("$FreeBSD$"); #endif static __inline boolean_t +pmap_type_guest(pmap_t pmap) +{ + + return ((pmap->pm_type == PT_EPT) || (pmap->pm_type == PT_RVI)); +} + +static __inline boolean_t pmap_emulate_ad_bits(pmap_t pmap) { @@ -159,6 +166,7 @@ pmap_valid_bit(pmap_t pmap) switch (pmap->pm_type) { case PT_X86: + case PT_RVI: mask = X86_PG_V; break; case PT_EPT: @@ -181,6 +189,7 @@ pmap_rw_bit(pmap_t pmap) switch (pmap->pm_type) { case PT_X86: + case PT_RVI: mask = X86_PG_RW; break; case PT_EPT: @@ -205,6 +214,7 @@ pmap_global_bit(pmap_t pmap) case PT_X86: mask = X86_PG_G; break; + case PT_RVI: case PT_EPT: mask = 0; break; @@ -222,6 +232,7 @@ pmap_accessed_bit(pmap_t pmap) switch (pmap->pm_type) { case PT_X86: + case PT_RVI: mask = X86_PG_A; break; case PT_EPT: @@ -244,6 +255,7 @@ pmap_modified_bit(pmap_t pmap) switch (pmap->pm_type) { case PT_X86: + case PT_RVI: mask = X86_PG_M; break; case PT_EPT: @@ -1103,6 +1115,7 @@ pmap_swap_pat(pmap_t pmap, pt_entry_t en switch (pmap->pm_type) { case PT_X86: + case PT_RVI: /* Verify that both PAT bits are not set at the same time */ KASSERT((entry & x86_pat_bits) != x86_pat_bits, ("Invalid PAT bits in entry %#lx", entry)); @@ -1138,6 +1151,7 @@ pmap_cache_bits(pmap_t pmap, int mode, b switch (pmap->pm_type) { case PT_X86: + case PT_RVI: /* The PAT bit is different for PTE's and PDE's. */ pat_flag = is_pde ? X86_PG_PDE_PAT : X86_PG_PTE_PAT; @@ -1172,6 +1186,7 @@ pmap_cache_mask(pmap_t pmap, boolean_t i switch (pmap->pm_type) { case PT_X86: + case PT_RVI: mask = is_pde ? X86_PG_PDE_CACHE : X86_PG_PTE_CACHE; break; case PT_EPT: @@ -1198,6 +1213,7 @@ pmap_update_pde_store(pmap_t pmap, pd_en switch (pmap->pm_type) { case PT_X86: break; + case PT_RVI: case PT_EPT: /* * XXX @@ -1233,7 +1249,7 @@ pmap_update_pde_invalidate(pmap_t pmap, { pt_entry_t PG_G; - if (pmap->pm_type == PT_EPT) + if (pmap_type_guest(pmap)) return; KASSERT(pmap->pm_type == PT_X86, @@ -1347,7 +1363,7 @@ pmap_invalidate_page(pmap_t pmap, vm_off cpuset_t other_cpus; u_int cpuid; - if (pmap->pm_type == PT_EPT) { + if (pmap_type_guest(pmap)) { pmap_invalidate_ept(pmap); return; } @@ -1425,7 +1441,7 @@ pmap_invalidate_range(pmap_t pmap, vm_of vm_offset_t addr; u_int cpuid; - if (pmap->pm_type == PT_EPT) { + if (pmap_type_guest(pmap)) { pmap_invalidate_ept(pmap); return; } @@ -1484,7 +1500,7 @@ pmap_invalidate_all(pmap_t pmap) uint64_t cr3; u_int cpuid; - if (pmap->pm_type == PT_EPT) { + if (pmap_type_guest(pmap)) { pmap_invalidate_ept(pmap); return; } @@ -1606,7 +1622,7 @@ pmap_update_pde(pmap_t pmap, vm_offset_t cpuid = PCPU_GET(cpuid); other_cpus = all_cpus; CPU_CLR(cpuid, &other_cpus); - if (pmap == kernel_pmap || pmap->pm_type == PT_EPT) + if (pmap == kernel_pmap || pmap_type_guest(pmap)) active = all_cpus; else { active = pmap->pm_active; @@ -1644,6 +1660,7 @@ pmap_invalidate_page(pmap_t pmap, vm_off if (pmap == kernel_pmap || !CPU_EMPTY(&pmap->pm_active)) invlpg(va); break; + case PT_RVI: case PT_EPT: pmap->pm_eptgen++; break; @@ -1663,6 +1680,7 @@ pmap_invalidate_range(pmap_t pmap, vm_of for (addr = sva; addr < eva; addr += PAGE_SIZE) invlpg(addr); break; + case PT_RVI: case PT_EPT: pmap->pm_eptgen++; break; @@ -1680,6 +1698,7 @@ pmap_invalidate_all(pmap_t pmap) if (pmap == kernel_pmap || !CPU_EMPTY(&pmap->pm_active)) invltlb(); break; + case PT_RVI: case PT_EPT: pmap->pm_eptgen++; break; Modified: head/sys/sys/bitset.h ============================================================================== --- head/sys/sys/bitset.h Mon Oct 20 18:04:20 2014 (r273337) +++ head/sys/sys/bitset.h Mon Oct 20 18:09:33 2014 (r273338) @@ -135,6 +135,10 @@ atomic_set_long(&(p)->__bits[__bitset_word(_s, n)], \ __bitset_mask((_s), n)) +#define BIT_SET_ATOMIC_ACQ(_s, n, p) \ + atomic_set_acq_long(&(p)->__bits[__bitset_word(_s, n)], \ + __bitset_mask((_s), n)) + /* Convenience functions catering special cases. */ #define BIT_AND_ATOMIC(_s, d, s) do { \ __size_t __i; \ Modified: head/sys/sys/cpuset.h ============================================================================== --- head/sys/sys/cpuset.h Mon Oct 20 18:04:20 2014 (r273337) +++ head/sys/sys/cpuset.h Mon Oct 20 18:09:33 2014 (r273338) @@ -55,6 +55,7 @@ #define CPU_NAND(d, s) BIT_NAND(CPU_SETSIZE, d, s) #define CPU_CLR_ATOMIC(n, p) BIT_CLR_ATOMIC(CPU_SETSIZE, n, p) #define CPU_SET_ATOMIC(n, p) BIT_SET_ATOMIC(CPU_SETSIZE, n, p) +#define CPU_SET_ATOMIC_ACQ(n, p) BIT_SET_ATOMIC_ACQ(CPU_SETSIZE, n, p) #define CPU_AND_ATOMIC(n, p) BIT_AND_ATOMIC(CPU_SETSIZE, n, p) #define CPU_OR_ATOMIC(d, s) BIT_OR_ATOMIC(CPU_SETSIZE, d, s) #define CPU_COPY_STORE_REL(f, t) BIT_COPY_STORE_REL(CPU_SETSIZE, f, t) Modified: head/sys/x86/include/specialreg.h ============================================================================== --- head/sys/x86/include/specialreg.h Mon Oct 20 18:04:20 2014 (r273337) +++ head/sys/x86/include/specialreg.h Mon Oct 20 18:09:33 2014 (r273338) @@ -81,6 +81,7 @@ #define EFER_LME 0x000000100 /* Long mode enable (R/W) */ #define EFER_LMA 0x000000400 /* Long mode active (R) */ #define EFER_NXE 0x000000800 /* PTE No-Execute bit enable (R/W) */ +#define EFER_SVM 0x000001000 /* SVM enable bit for AMD, reserved for Intel */ /* * Intel Extended Features registers @@ -783,8 +784,21 @@ #define MSR_IORRMASK1 0xc0010019 #define MSR_TOP_MEM 0xc001001a /* boundary for ram below 4G */ #define MSR_TOP_MEM2 0xc001001d /* boundary for ram above 4G */ +#define MSR_NB_CFG1 0xc001001f /* NB configuration 1 */ +#define MSR_P_STATE_LIMIT 0xc0010061 /* P-state Current Limit Register */ +#define MSR_P_STATE_CONTROL 0xc0010062 /* P-state Control Register */ +#define MSR_P_STATE_STATUS 0xc0010063 /* P-state Status Register */ +#define MSR_P_STATE_CONFIG(n) (0xc0010064 + (n)) /* P-state Config */ +#define MSR_SMM_ADDR 0xc0010112 /* SMM TSEG base address */ +#define MSR_SMM_MASK 0xc0010113 /* SMM TSEG address mask */ +#define MSR_IC_CFG 0xc0011021 /* Instruction Cache Configuration */ #define MSR_K8_UCODE_UPDATE 0xc0010020 /* update microcode */ #define MSR_MC0_CTL_MASK 0xc0010044 +#define MSR_VM_CR 0xc0010114 /* SVM: feature control */ +#define MSR_VM_HSAVE_PA 0xc0010117 /* SVM: host save area address */ + +/* MSR_VM_CR related */ +#define VM_CR_SVMDIS 0x10 /* SVM: disabled by BIOS */ /* VIA ACE crypto featureset: for via_feature_rng */ #define VIA_HAS_RNG 1 /* cpu has RNG */ From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 18:39:20 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E97E983F; Mon, 20 Oct 2014 18:39:20 +0000 (UTC) Received: from mail.xcllnt.net (mail.xcllnt.net [50.0.150.214]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C5D64802; Mon, 20 Oct 2014 18:39:20 +0000 (UTC) Received: from djonathan-sslvpn-nc.jnpr.net ([66.129.239.11]) (authenticated bits=0) by mail.xcllnt.net (8.14.9/8.14.9) with ESMTP id s9KIdD4L010262 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 20 Oct 2014 11:39:13 -0700 (PDT) (envelope-from marcel@xcllnt.net) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 8.0 \(1990.1\)) Subject: Re: svn commit: r273334 - in head/sys: boot/common kern sys From: Marcel Moolenaar In-Reply-To: <20141020180002.GA85946@vlakno.cz> Date: Mon, 20 Oct 2014 11:39:07 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201410201704.s9KH44wX079917@svn.freebsd.org> <20141020180002.GA85946@vlakno.cz> To: Roman Divacky X-Mailer: Apple Mail (2.1990.1) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Marcel Moolenaar , src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 18:39:21 -0000 > On Oct 20, 2014, at 11:00 AM, Roman Divacky = wrote: >=20 >> Note that LLVM appends the priority of the constructors to the name = of >> the .ctors section. Not so when compiling with GCC. The code = currently >> works for GCC and not for LLVM. >=20 > Uhm? LLVM here creates ".ctors" section, nothing is appended. Can you = be more > specific on what you're seing? Go to a module build directory (I picked uart) and build on amd64: % make DEBUG_FLAGS=3D"-ftest-coverage -fprofile-arcs" Check with objdump: % objdump -x /usr/obj/usr/src/sys/modules/uart/uart.ko | grep ctors 16 .ctors.65535 00000080 0000000000000000 0000000000000000 00020320 = 2**3 0000000000000000 l d .ctors.65535 0000000000000000 .ctors.65535 RELOCATION RECORDS FOR [.ctors.65535]: As you can see, the section is not called .ctors, but it's called .ctors.$((65536-priority)). The priority suffix is removed as part of linking, but on amd64, kernel modules are relocatables... FYI, --=20 Marcel Moolenaar marcel@xcllnt.net From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 18:53:55 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5C5071DE; Mon, 20 Oct 2014 18:53:55 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4813BA03; Mon, 20 Oct 2014 18:53:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KIrtnv039629; Mon, 20 Oct 2014 18:53:55 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KIrtlC039628; Mon, 20 Oct 2014 18:53:55 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410201853.s9KIrtlC039628@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 20 Oct 2014 18:53:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273340 - stable/10/lib/libc/sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 18:53:55 -0000 Author: delphij Date: Mon Oct 20 18:53:54 2014 New Revision: 273340 URL: https://svnweb.freebsd.org/changeset/base/273340 Log: MFC r272884: accept(2) may and can return EAGAIN, document it. Modified: stable/10/lib/libc/sys/accept.2 Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/sys/accept.2 ============================================================================== --- stable/10/lib/libc/sys/accept.2 Mon Oct 20 18:33:34 2014 (r273339) +++ stable/10/lib/libc/sys/accept.2 Mon Oct 20 18:53:54 2014 (r273340) @@ -28,7 +28,7 @@ .\" @(#)accept.2 8.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd October 1, 2013 +.Dd October 9, 2014 .Dt ACCEPT 2 .Os .Sh NAME @@ -201,7 +201,7 @@ The .Fa addr argument is not in a writable part of the user address space. -.It Bq Er EWOULDBLOCK +.It Bo Er EWOULDBLOCK Bc or Bq Er EAGAIN The socket is marked non-blocking and no connections are present to be accepted. .It Bq Er ECONNABORTED From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 18:58:47 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5ED4A39E; Mon, 20 Oct 2014 18:58:47 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3FFF0A4F; Mon, 20 Oct 2014 18:58:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KIwlNF040308; Mon, 20 Oct 2014 18:58:47 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KIwkXf040300; Mon, 20 Oct 2014 18:58:46 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410201858.s9KIwkXf040300@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 20 Oct 2014 18:58:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273341 - in stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 18:58:47 -0000 Author: delphij Date: Mon Oct 20 18:58:45 2014 New Revision: 273341 URL: https://svnweb.freebsd.org/changeset/base/273341 Log: MFC r272504: MFV r272494: Make space_map_truncate() always do space_map_reallocate(). Without this, setting space_map_max_blksz would cause panic for existing pool, as dmu_objset_set_blocksize would fail if the object have multiple blocks. Illumos issues: 5164 space_map_max_blksz causes panic, does not work 5165 zdb fails assertion when run on pool with recently-enabled spacemap_histogram feature Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/space_map.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Mon Oct 20 18:53:54 2014 (r273340) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Mon Oct 20 18:58:45 2014 (r273341) @@ -77,7 +77,7 @@ SYSCTL_INT(_vfs_zfs, OID_AUTO, condense_ /* * Condensing a metaslab is not guaranteed to actually reduce the amount of * space used on disk. In particular, a space map uses data in increments of - * MAX(1 << ashift, SPACE_MAP_INITIAL_BLOCKSIZE), so a metaslab might use the + * MAX(1 << ashift, space_map_blksize), so a metaslab might use the * same number of blocks after condensing. Since the goal of condensing is to * reduce the number of IOPs required to read the space map, we only want to * condense when we can be sure we will reduce the number of blocks used by the @@ -1491,10 +1491,12 @@ metaslab_fragmentation(metaslab_t *msp) uint64_t txg = spa_syncing_txg(spa); vdev_t *vd = msp->ms_group->mg_vd; - msp->ms_condense_wanted = B_TRUE; - vdev_dirty(vd, VDD_METASLAB, msp, txg + 1); - spa_dbgmsg(spa, "txg %llu, requesting force condense: " - "msp %p, vd %p", txg, msp, vd); + if (spa_writeable(spa)) { + msp->ms_condense_wanted = B_TRUE; + vdev_dirty(vd, VDD_METASLAB, msp, txg + 1); + spa_dbgmsg(spa, "txg %llu, requesting force condense: " + "msp %p, vd %p", txg, msp, vd); + } return (ZFS_FRAG_INVALID); } @@ -1938,6 +1940,15 @@ metaslab_sync(metaslab_t *msp, uint64_t mutex_enter(&msp->ms_lock); + /* + * Note: metaslab_condense() clears the space_map's histogram. + * Therefore we must verify and remove this histogram before + * condensing. + */ + metaslab_group_histogram_verify(mg); + metaslab_class_histogram_verify(mg->mg_class); + metaslab_group_histogram_remove(mg, msp); + if (msp->ms_loaded && spa_sync_pass(spa) == 1 && metaslab_should_condense(msp)) { metaslab_condense(msp, txg, tx); @@ -1946,9 +1957,6 @@ metaslab_sync(metaslab_t *msp, uint64_t space_map_write(msp->ms_sm, *freetree, SM_FREE, tx); } - metaslab_group_histogram_verify(mg); - metaslab_class_histogram_verify(mg->mg_class); - metaslab_group_histogram_remove(mg, msp); if (msp->ms_loaded) { /* * When the space map is loaded, we have an accruate Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c Mon Oct 20 18:53:54 2014 (r273340) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c Mon Oct 20 18:58:45 2014 (r273341) @@ -38,15 +38,12 @@ #include /* - * This value controls how the space map's block size is allowed to grow. - * If the value is set to the same size as SPACE_MAP_INITIAL_BLOCKSIZE then - * the space map block size will remain fixed. Setting this value to something - * greater than SPACE_MAP_INITIAL_BLOCKSIZE will allow the space map to - * increase its block size as needed. To maintain backwards compatibilty the - * space map's block size must be a power of 2 and SPACE_MAP_INITIAL_BLOCKSIZE - * or larger. + * The data for a given space map can be kept on blocks of any size. + * Larger blocks entail fewer i/o operations, but they also cause the + * DMU to keep more data in-core, and also to waste more i/o bandwidth + * when only a few blocks have changed since the last transaction group. */ -int space_map_max_blksz = (1 << 12); +int space_map_blksz = (1 << 12); /* * Load the space map disk into the specified range tree. Segments of maptype @@ -233,58 +230,6 @@ space_map_entries(space_map_t *sm, range return (entries); } -void -space_map_set_blocksize(space_map_t *sm, uint64_t size, dmu_tx_t *tx) -{ - uint32_t blksz; - u_longlong_t blocks; - - ASSERT3U(sm->sm_blksz, !=, 0); - ASSERT3U(space_map_object(sm), !=, 0); - ASSERT(sm->sm_dbuf != NULL); - VERIFY(ISP2(space_map_max_blksz)); - - if (sm->sm_blksz >= space_map_max_blksz) - return; - - /* - * The object contains more than one block so we can't adjust - * its size. - */ - if (sm->sm_phys->smp_objsize > sm->sm_blksz) - return; - - if (size > sm->sm_blksz) { - uint64_t newsz; - - /* - * Older software versions treat space map blocks as fixed - * entities. The DMU is capable of handling different block - * sizes making it possible for us to increase the - * block size and maintain backwards compatibility. The - * caveat is that the new block sizes must be a - * power of 2 so that old software can append to the file, - * adding more blocks. The block size can grow until it - * reaches space_map_max_blksz. - */ - newsz = ISP2(size) ? size : 1ULL << highbit64(size); - if (newsz > space_map_max_blksz) - newsz = space_map_max_blksz; - - VERIFY0(dmu_object_set_blocksize(sm->sm_os, - space_map_object(sm), newsz, 0, tx)); - dmu_object_size_from_db(sm->sm_dbuf, &blksz, &blocks); - - zfs_dbgmsg("txg %llu, spa %s, increasing blksz from %d to %d", - dmu_tx_get_txg(tx), spa_name(dmu_objset_spa(sm->sm_os)), - sm->sm_blksz, blksz); - - VERIFY3U(newsz, ==, blksz); - VERIFY3U(sm->sm_blksz, <, blksz); - sm->sm_blksz = blksz; - } -} - /* * Note: space_map_write() will drop sm_lock across dmu_write() calls. */ @@ -298,7 +243,7 @@ space_map_write(space_map_t *sm, range_t range_seg_t *rs; uint64_t size, total, rt_space, nodes; uint64_t *entry, *entry_map, *entry_map_end; - uint64_t newsz, expected_entries, actual_entries = 1; + uint64_t expected_entries, actual_entries = 1; ASSERT(MUTEX_HELD(rt->rt_lock)); ASSERT(dsl_pool_sync_context(dmu_objset_pool(os))); @@ -324,13 +269,6 @@ space_map_write(space_map_t *sm, range_t expected_entries = space_map_entries(sm, rt); - /* - * Calculate the new size for the space map on-disk and see if - * we can grow the block size to accommodate the new size. - */ - newsz = sm->sm_phys->smp_objsize + expected_entries * sizeof (uint64_t); - space_map_set_blocksize(sm, newsz, tx); - entry_map = zio_buf_alloc(sm->sm_blksz); entry_map_end = entry_map + (sm->sm_blksz / sizeof (uint64_t)); entry = entry_map; @@ -457,46 +395,48 @@ space_map_close(space_map_t *sm) kmem_free(sm, sizeof (*sm)); } -static void -space_map_reallocate(space_map_t *sm, dmu_tx_t *tx) -{ - ASSERT(dmu_tx_is_syncing(tx)); - - space_map_free(sm, tx); - dmu_buf_rele(sm->sm_dbuf, sm); - - sm->sm_object = space_map_alloc(sm->sm_os, tx); - VERIFY0(space_map_open_impl(sm)); -} - void space_map_truncate(space_map_t *sm, dmu_tx_t *tx) { objset_t *os = sm->sm_os; spa_t *spa = dmu_objset_spa(os); dmu_object_info_t doi; - int bonuslen; ASSERT(dsl_pool_sync_context(dmu_objset_pool(os))); ASSERT(dmu_tx_is_syncing(tx)); - VERIFY0(dmu_free_range(os, space_map_object(sm), 0, -1ULL, tx)); dmu_object_info_from_db(sm->sm_dbuf, &doi); - if (spa_feature_is_enabled(spa, SPA_FEATURE_SPACEMAP_HISTOGRAM)) { - bonuslen = sizeof (space_map_phys_t); - ASSERT3U(bonuslen, <=, dmu_bonus_max()); - } else { - bonuslen = SPACE_MAP_SIZE_V0; - } - - if (bonuslen != doi.doi_bonus_size || - doi.doi_data_block_size != SPACE_MAP_INITIAL_BLOCKSIZE) { + /* + * If the space map has the wrong bonus size (because + * SPA_FEATURE_SPACEMAP_HISTOGRAM has recently been enabled), or + * the wrong block size (because space_map_blksz has changed), + * free and re-allocate its object with the updated sizes. + * + * Otherwise, just truncate the current object. + */ + if ((spa_feature_is_enabled(spa, SPA_FEATURE_SPACEMAP_HISTOGRAM) && + doi.doi_bonus_size != sizeof (space_map_phys_t)) || + doi.doi_data_block_size != space_map_blksz) { zfs_dbgmsg("txg %llu, spa %s, reallocating: " "old bonus %u, old blocksz %u", dmu_tx_get_txg(tx), spa_name(spa), doi.doi_bonus_size, doi.doi_data_block_size); - space_map_reallocate(sm, tx); - VERIFY3U(sm->sm_blksz, ==, SPACE_MAP_INITIAL_BLOCKSIZE); + + space_map_free(sm, tx); + dmu_buf_rele(sm->sm_dbuf, sm); + + sm->sm_object = space_map_alloc(sm->sm_os, tx); + VERIFY0(space_map_open_impl(sm)); + } else { + VERIFY0(dmu_free_range(os, space_map_object(sm), 0, -1ULL, tx)); + + /* + * If the spacemap is reallocated, its histogram + * will be reset. Do the same in the common case so that + * bugs related to the uncommon case do not go unnoticed. + */ + bzero(sm->sm_phys->smp_histogram, + sizeof (sm->sm_phys->smp_histogram)); } dmu_buf_will_dirty(sm->sm_dbuf, tx); @@ -535,7 +475,7 @@ space_map_alloc(objset_t *os, dmu_tx_t * } object = dmu_object_alloc(os, - DMU_OT_SPACE_MAP, SPACE_MAP_INITIAL_BLOCKSIZE, + DMU_OT_SPACE_MAP, space_map_blksz, DMU_OT_SPACE_MAP_HEADER, bonuslen, tx); return (object); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/space_map.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/space_map.h Mon Oct 20 18:53:54 2014 (r273340) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/space_map.h Mon Oct 20 18:58:45 2014 (r273341) @@ -133,17 +133,6 @@ typedef enum { SM_FREE } maptype_t; -/* - * The data for a given space map can be kept on blocks of any size. - * Larger blocks entail fewer i/o operations, but they also cause the - * DMU to keep more data in-core, and also to waste more i/o bandwidth - * when only a few blocks have changed since the last transaction group. - * Rather than having a fixed block size for all space maps the block size - * can adjust as needed (see space_map_max_blksz). Set the initial block - * size for the space map to 4k. - */ -#define SPACE_MAP_INITIAL_BLOCKSIZE (1ULL << 12) - int space_map_load(space_map_t *sm, range_tree_t *rt, maptype_t maptype); void space_map_histogram_clear(space_map_t *sm); From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 20:10:46 2014 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DFE9A91E for ; Mon, 20 Oct 2014 20:10:46 +0000 (UTC) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ABF6127A for ; Mon, 20 Oct 2014 20:10:46 +0000 (UTC) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by gateway2.nyi.internal (Postfix) with ESMTP id 0E07D20959 for ; Mon, 20 Oct 2014 16:10:43 -0400 (EDT) Received: from web6 ([10.202.2.216]) by compute4.internal (MEProxy); Mon, 20 Oct 2014 16:10:44 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.net; h= message-id:x-sasl-enc:from:to:mime-version :content-transfer-encoding:content-type:in-reply-to:references :subject:date; s=mesmtp; bh=pgkbJF81e+6GKJ4yW9TwHi+XOfs=; b=jWJG SOl4I+hQ3kzWA6fnwHB0/VgRyDZwS5EpQvOGuV+PSuR7G24KLvckwg6ufccwSZI+ W7GzbfMkYlG4IFgf7v5pJ0Bnzd7N5ORkBzf/DGR9HZcSFffrnsyQE7r2yhC5NwP6 EH2XPhgSRycnKkTeQBdlwqv5Ic17YqfI5s0YcEM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=message-id:x-sasl-enc:from:to :mime-version:content-transfer-encoding:content-type:in-reply-to :references:subject:date; s=smtpout; bh=pgkbJF81e+6GKJ4yW9TwHi+X Ofs=; b=g52J5mVm7senD11MQCeCiWHKmRUvC61sVpMEwKTx27IENejNxKB/P3hk E5Kalls2s9XeESR3MgUEt5YO9UhSpfl+4MuA6Oy69xn+3liOrksy3pYzqUX9OS+y JnP/x87YPJD/88hWaEHu9ua/jTTN7TPJegDiHFguF49iLx5ZH3o= Received: by web6.nyi.internal (Postfix, from userid 99) id BCE3648D60; Mon, 20 Oct 2014 16:10:43 -0400 (EDT) Message-Id: <1413835843.3284180.181238849.236EFDEE@webmail.messagingengine.com> X-Sasl-Enc: J98mwy4wHPZgD8b9QvPHFWRa5OaTyvZ+IFaJO1eM754W 1413835843 From: Bruce Simpson To: Andriy Gapon , "Alexander V. Chernikov" , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain X-Mailer: MessagingEngine.com Webmail Interface - ajax-e69fc525 In-Reply-To: <5443A83F.5090807@FreeBSD.org> References: <201410191115.s9JBFJxA058370@svn.freebsd.org> <5443A83F.5090807@FreeBSD.org> Subject: Re: svn commit: r273274 - head/sys/netpfil/ipfw Date: Mon, 20 Oct 2014 21:10:43 +0100 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 20:10:47 -0000 On Sun, 19 Oct 2014, at 13:02, Andriy Gapon wrote: > I think that on platforms where an optimized version of fls() is > available that > would work faster than this cool piece of bit magic. This is a common enough idiom that perhaps a macro should be added: sys/param.h: #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) /* to any y */ #define roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */ #define powerof2(x) ((((x)-1)&(x))==0) sys/amd64/amd64/mp_machdep.c: /* * Round up to the next power of two, if necessary, and then * take log2. * Returns -1 if argument is zero. */ static __inline int mask_width(u_int x) { return (fls(x << (1 - powerof2(x))) - 1); } -- BMS (sent via webmail) From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 20:21:41 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6FC68D79; Mon, 20 Oct 2014 20:21:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5C15C3CD; Mon, 20 Oct 2014 20:21:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KKLfH8082670; Mon, 20 Oct 2014 20:21:41 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KKLfNJ082669; Mon, 20 Oct 2014 20:21:41 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201410202021.s9KKLfNJ082669@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 20 Oct 2014 20:21:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273342 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 20:21:41 -0000 Author: markj Date: Mon Oct 20 20:21:40 2014 New Revision: 273342 URL: https://svnweb.freebsd.org/changeset/base/273342 Log: Fix a typo from r189544, which replaced unp_global_rwlock with unp_list_lock and unp_link_rwlock. MFC after: 3 days Modified: head/sys/kern/subr_witness.c Modified: head/sys/kern/subr_witness.c ============================================================================== --- head/sys/kern/subr_witness.c Mon Oct 20 18:58:45 2014 (r273341) +++ head/sys/kern/subr_witness.c Mon Oct 20 20:21:40 2014 (r273342) @@ -528,7 +528,7 @@ static struct witness_order_list_entry o /* * UNIX Domain Sockets */ - { "unp_global_rwlock", &lock_class_rw }, + { "unp_link_rwlock", &lock_class_rw }, { "unp_list_lock", &lock_class_mtx_sleep }, { "unp", &lock_class_mtx_sleep }, { "so_snd", &lock_class_mtx_sleep }, From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 21:53:52 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1CA06560; Mon, 20 Oct 2014 21:53:52 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 07BC2FC1; Mon, 20 Oct 2014 21:53:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KLrp6f026057; Mon, 20 Oct 2014 21:53:51 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KLrpDQ026056; Mon, 20 Oct 2014 21:53:51 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410202153.s9KLrpDQ026056@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 20 Oct 2014 21:53:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273343 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 21:53:52 -0000 Author: delphij Date: Mon Oct 20 21:53:51 2014 New Revision: 273343 URL: https://svnweb.freebsd.org/changeset/base/273343 Log: MFC r272507: MFV r272496: Add tunable for number of metaslabs per vdev (vfs.zfs.vdev.metaslabs_per_vdev). The default remains at 200. Illumos issue: 5161 add tunable for number of metaslabs per vdev Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Mon Oct 20 20:21:40 2014 (r273342) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Mon Oct 20 21:53:51 2014 (r273343) @@ -156,6 +156,15 @@ static vdev_ops_t *vdev_ops_table[] = { /* + * When a vdev is added, it will be divided into approximately (but no + * more than) this number of metaslabs. + */ +int metaslabs_per_vdev = 200; +SYSCTL_INT(_vfs_zfs_vdev, OID_AUTO, metaslabs_per_vdev, CTLFLAG_RDTUN, + &metaslabs_per_vdev, 0, + "When a vdev is added, how many metaslabs the vdev should be divided into"); + +/* * Given a vdev type, return the appropriate ops vector. */ static vdev_ops_t * @@ -1663,9 +1672,9 @@ void vdev_metaslab_set_size(vdev_t *vd) { /* - * Aim for roughly 200 metaslabs per vdev. + * Aim for roughly metaslabs_per_vdev (default 200) metaslabs per vdev. */ - vd->vdev_ms_shift = highbit64(vd->vdev_asize / 200); + vd->vdev_ms_shift = highbit64(vd->vdev_asize / metaslabs_per_vdev); vd->vdev_ms_shift = MAX(vd->vdev_ms_shift, SPA_MAXBLOCKSHIFT); } From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 21:57:25 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 211DC6CB; Mon, 20 Oct 2014 21:57:25 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0D6D9FFA; Mon, 20 Oct 2014 21:57:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KLvO1r026575; Mon, 20 Oct 2014 21:57:24 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KLvO4S026574; Mon, 20 Oct 2014 21:57:24 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410202157.s9KLvO4S026574@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 20 Oct 2014 21:57:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273344 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 21:57:25 -0000 Author: mjg Date: Mon Oct 20 21:57:24 2014 New Revision: 273344 URL: https://svnweb.freebsd.org/changeset/base/273344 Log: filedesc: plug 2 write-only variables Reported by: Coverity CID: 1245745, 1245746 Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Mon Oct 20 21:53:51 2014 (r273343) +++ head/sys/kern/kern_descrip.c Mon Oct 20 21:57:24 2014 (r273344) @@ -3138,7 +3138,6 @@ export_vnode_to_sb(struct vnode *vp, int int kern_proc_filedesc_out(struct proc *p, struct sbuf *sb, ssize_t maxlen) { - struct thread *td; struct file *fp; struct filedesc *fdp; struct export_fd_buf *efbuf; @@ -3146,7 +3145,6 @@ kern_proc_filedesc_out(struct proc *p, int error, i; cap_rights_t rights; - td = curthread; PROC_LOCK_ASSERT(p, MA_OWNED); /* ktrace vnode */ @@ -3301,12 +3299,10 @@ sysctl_kern_proc_ofiledesc(SYSCTL_HANDLE struct kinfo_ofile *okif; struct kinfo_file *kif; struct filedesc *fdp; - struct thread *td; int error, i, *name; struct file *fp; struct proc *p; - td = curthread; name = (int *)arg1; error = pget((pid_t)name[0], PGET_CANDEBUG | PGET_NOTWEXIT, &p); if (error != 0) From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 21:59:12 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 20BAC82E; Mon, 20 Oct 2014 21:59:12 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0BDFB74; Mon, 20 Oct 2014 21:59:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KLxBdc026839; Mon, 20 Oct 2014 21:59:11 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KLxBko026838; Mon, 20 Oct 2014 21:59:11 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410202159.s9KLxBko026838@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 20 Oct 2014 21:59:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273345 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 21:59:12 -0000 Author: delphij Date: Mon Oct 20 21:59:11 2014 New Revision: 273345 URL: https://svnweb.freebsd.org/changeset/base/273345 Log: MFC r272510: MFV r272498: Add a new sysctl, vfs.zfs.vol.unmap_enabled, which allows the system administrator to toggle whether ZFS should ignore UNMAP requests. Illumos issue: 5149 zvols need a way to ignore DKIOCFREE Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Mon Oct 20 21:57:24 2014 (r273344) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Mon Oct 20 21:59:11 2014 (r273345) @@ -168,6 +168,14 @@ static LIST_HEAD(, zvol_state) all_zvols */ int zvol_maxphys = DMU_MAX_ACCESS/2; +/* + * Toggle unmap functionality. + */ +boolean_t zvol_unmap_enabled = B_TRUE; +SYSCTL_INT(_vfs_zfs_vol, OID_AUTO, unmap_enabled, CTLFLAG_RWTUN, + &zvol_unmap_enabled, 0, + "Enable UNMAP functionality"); + static d_open_t zvol_d_open; static d_close_t zvol_d_close; static d_read_t zvol_read; @@ -1972,6 +1980,9 @@ zvol_ioctl(dev_t dev, int cmd, intptr_t dkioc_free_t df; dmu_tx_t *tx; + if (!zvol_unmap_enabled) + break; + if (ddi_copyin((void *)arg, &df, sizeof (df), flag)) { error = SET_ERROR(EFAULT); break; @@ -2816,6 +2827,9 @@ zvol_d_ioctl(struct cdev *dev, u_long cm zil_commit(zv->zv_zilog, ZVOL_OBJ); break; case DIOCGDELETE: + if (!zvol_unmap_enabled) + break; + offset = ((off_t *)data)[0]; length = ((off_t *)data)[1]; if ((offset % DEV_BSIZE) != 0 || (length % DEV_BSIZE) != 0 || From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 22:04:50 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 58AF79AA; Mon, 20 Oct 2014 22:04:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 43D7115E; Mon, 20 Oct 2014 22:04:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KM4oAx031091; Mon, 20 Oct 2014 22:04:50 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KM4oJB031090; Mon, 20 Oct 2014 22:04:50 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410202204.s9KM4oJB031090@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 20 Oct 2014 22:04:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273346 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 22:04:50 -0000 Author: delphij Date: Mon Oct 20 22:04:49 2014 New Revision: 273346 URL: https://svnweb.freebsd.org/changeset/base/273346 Log: MFC r272511: MFV r272499: Illumos issue: 5174 add sdt probe for blocked read in dbuf_read() Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Mon Oct 20 21:59:11 2014 (r273345) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Mon Oct 20 22:04:49 2014 (r273346) @@ -671,6 +671,8 @@ dbuf_read(dmu_buf_impl_t *db, zio_t *zio db->db_state == DB_FILL) { ASSERT(db->db_state == DB_READ || (flags & DB_RF_HAVESTRUCT) == 0); + DTRACE_PROBE2(blocked__read, dmu_buf_impl_t *, + db, zio_t *, zio); cv_wait(&db->db_changed, &db->db_mtx); } if (db->db_state == DB_UNCACHED) From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 22:09:30 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EE361B11; Mon, 20 Oct 2014 22:09:30 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D055C187; Mon, 20 Oct 2014 22:09:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KM9U7M031806; Mon, 20 Oct 2014 22:09:30 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KM9UoC031805; Mon, 20 Oct 2014 22:09:30 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410202209.s9KM9UoC031805@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 20 Oct 2014 22:09:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273347 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 22:09:31 -0000 Author: delphij Date: Mon Oct 20 22:09:30 2014 New Revision: 273347 URL: https://svnweb.freebsd.org/changeset/base/273347 Log: MFC r272584: MFV r272501: Illumos issue: 5177 remove dead code from dsl_scan.c Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Mon Oct 20 22:04:49 2014 (r273346) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Mon Oct 20 22:09:30 2014 (r273347) @@ -384,13 +384,12 @@ dsl_scan_cancel(dsl_pool_t *dp) dsl_scan_cancel_sync, NULL, 3, ZFS_SPACE_CHECK_RESERVED)); } -static void dsl_scan_visitbp(blkptr_t *bp, - const zbookmark_phys_t *zb, dnode_phys_t *dnp, arc_buf_t *pbuf, - dsl_dataset_t *ds, dsl_scan_t *scn, dmu_objset_type_t ostype, - dmu_tx_t *tx); +static void dsl_scan_visitbp(blkptr_t *bp, const zbookmark_phys_t *zb, + dnode_phys_t *dnp, dsl_dataset_t *ds, dsl_scan_t *scn, + dmu_objset_type_t ostype, dmu_tx_t *tx); static void dsl_scan_visitdnode(dsl_scan_t *, dsl_dataset_t *ds, dmu_objset_type_t ostype, - dnode_phys_t *dnp, arc_buf_t *buf, uint64_t object, dmu_tx_t *tx); + dnode_phys_t *dnp, uint64_t object, dmu_tx_t *tx); void dsl_free(dsl_pool_t *dp, uint64_t txg, const blkptr_t *bp) @@ -624,7 +623,7 @@ dsl_scan_check_resume(dsl_scan_t *scn, c static int dsl_scan_recurse(dsl_scan_t *scn, dsl_dataset_t *ds, dmu_objset_type_t ostype, dnode_phys_t *dnp, const blkptr_t *bp, - const zbookmark_phys_t *zb, dmu_tx_t *tx, arc_buf_t **bufp) + const zbookmark_phys_t *zb, dmu_tx_t *tx) { dsl_pool_t *dp = scn->scn_dp; int zio_flags = ZIO_FLAG_CANFAIL | ZIO_FLAG_SCAN_THREAD; @@ -635,76 +634,72 @@ dsl_scan_recurse(dsl_scan_t *scn, dsl_da int i; blkptr_t *cbp; int epb = BP_GET_LSIZE(bp) >> SPA_BLKPTRSHIFT; + arc_buf_t *buf; - err = arc_read(NULL, dp->dp_spa, bp, arc_getbuf_func, bufp, + err = arc_read(NULL, dp->dp_spa, bp, arc_getbuf_func, &buf, ZIO_PRIORITY_ASYNC_READ, zio_flags, &flags, zb); if (err) { scn->scn_phys.scn_errors++; return (err); } - for (i = 0, cbp = (*bufp)->b_data; i < epb; i++, cbp++) { - dsl_scan_prefetch(scn, *bufp, cbp, zb->zb_objset, + for (i = 0, cbp = buf->b_data; i < epb; i++, cbp++) { + dsl_scan_prefetch(scn, buf, cbp, zb->zb_objset, zb->zb_object, zb->zb_blkid * epb + i); } - for (i = 0, cbp = (*bufp)->b_data; i < epb; i++, cbp++) { + for (i = 0, cbp = buf->b_data; i < epb; i++, cbp++) { zbookmark_phys_t czb; SET_BOOKMARK(&czb, zb->zb_objset, zb->zb_object, zb->zb_level - 1, zb->zb_blkid * epb + i); dsl_scan_visitbp(cbp, &czb, dnp, - *bufp, ds, scn, ostype, tx); - } - } else if (BP_GET_TYPE(bp) == DMU_OT_USERGROUP_USED) { - uint32_t flags = ARC_WAIT; - - err = arc_read(NULL, dp->dp_spa, bp, arc_getbuf_func, bufp, - ZIO_PRIORITY_ASYNC_READ, zio_flags, &flags, zb); - if (err) { - scn->scn_phys.scn_errors++; - return (err); + ds, scn, ostype, tx); } + (void) arc_buf_remove_ref(buf, &buf); } else if (BP_GET_TYPE(bp) == DMU_OT_DNODE) { uint32_t flags = ARC_WAIT; dnode_phys_t *cdnp; int i, j; int epb = BP_GET_LSIZE(bp) >> DNODE_SHIFT; + arc_buf_t *buf; - err = arc_read(NULL, dp->dp_spa, bp, arc_getbuf_func, bufp, + err = arc_read(NULL, dp->dp_spa, bp, arc_getbuf_func, &buf, ZIO_PRIORITY_ASYNC_READ, zio_flags, &flags, zb); if (err) { scn->scn_phys.scn_errors++; return (err); } - for (i = 0, cdnp = (*bufp)->b_data; i < epb; i++, cdnp++) { + for (i = 0, cdnp = buf->b_data; i < epb; i++, cdnp++) { for (j = 0; j < cdnp->dn_nblkptr; j++) { blkptr_t *cbp = &cdnp->dn_blkptr[j]; - dsl_scan_prefetch(scn, *bufp, cbp, + dsl_scan_prefetch(scn, buf, cbp, zb->zb_objset, zb->zb_blkid * epb + i, j); } } - for (i = 0, cdnp = (*bufp)->b_data; i < epb; i++, cdnp++) { + for (i = 0, cdnp = buf->b_data; i < epb; i++, cdnp++) { dsl_scan_visitdnode(scn, ds, ostype, - cdnp, *bufp, zb->zb_blkid * epb + i, tx); + cdnp, zb->zb_blkid * epb + i, tx); } + (void) arc_buf_remove_ref(buf, &buf); } else if (BP_GET_TYPE(bp) == DMU_OT_OBJSET) { uint32_t flags = ARC_WAIT; objset_phys_t *osp; + arc_buf_t *buf; - err = arc_read(NULL, dp->dp_spa, bp, arc_getbuf_func, bufp, + err = arc_read(NULL, dp->dp_spa, bp, arc_getbuf_func, &buf, ZIO_PRIORITY_ASYNC_READ, zio_flags, &flags, zb); if (err) { scn->scn_phys.scn_errors++; return (err); } - osp = (*bufp)->b_data; + osp = buf->b_data; dsl_scan_visitdnode(scn, ds, osp->os_type, - &osp->os_meta_dnode, *bufp, DMU_META_DNODE_OBJECT, tx); + &osp->os_meta_dnode, DMU_META_DNODE_OBJECT, tx); - if (OBJSET_BUF_HAS_USERUSED(*bufp)) { + if (OBJSET_BUF_HAS_USERUSED(buf)) { /* * We also always visit user/group accounting * objects, and never skip them, even if we are @@ -712,12 +707,13 @@ dsl_scan_recurse(dsl_scan_t *scn, dsl_da * deltas from this txg get integrated. */ dsl_scan_visitdnode(scn, ds, osp->os_type, - &osp->os_groupused_dnode, *bufp, + &osp->os_groupused_dnode, DMU_GROUPUSED_OBJECT, tx); dsl_scan_visitdnode(scn, ds, osp->os_type, - &osp->os_userused_dnode, *bufp, + &osp->os_userused_dnode, DMU_USERUSED_OBJECT, tx); } + (void) arc_buf_remove_ref(buf, &buf); } return (0); @@ -725,7 +721,7 @@ dsl_scan_recurse(dsl_scan_t *scn, dsl_da static void dsl_scan_visitdnode(dsl_scan_t *scn, dsl_dataset_t *ds, - dmu_objset_type_t ostype, dnode_phys_t *dnp, arc_buf_t *buf, + dmu_objset_type_t ostype, dnode_phys_t *dnp, uint64_t object, dmu_tx_t *tx) { int j; @@ -736,7 +732,7 @@ dsl_scan_visitdnode(dsl_scan_t *scn, dsl SET_BOOKMARK(&czb, ds ? ds->ds_object : 0, object, dnp->dn_nlevels - 1, j); dsl_scan_visitbp(&dnp->dn_blkptr[j], - &czb, dnp, buf, ds, scn, ostype, tx); + &czb, dnp, ds, scn, ostype, tx); } if (dnp->dn_flags & DNODE_FLAG_SPILL_BLKPTR) { @@ -744,7 +740,7 @@ dsl_scan_visitdnode(dsl_scan_t *scn, dsl SET_BOOKMARK(&czb, ds ? ds->ds_object : 0, object, 0, DMU_SPILL_BLKID); dsl_scan_visitbp(&dnp->dn_spill, - &czb, dnp, buf, ds, scn, ostype, tx); + &czb, dnp, ds, scn, ostype, tx); } } @@ -754,9 +750,8 @@ dsl_scan_visitdnode(dsl_scan_t *scn, dsl */ static void dsl_scan_visitbp(blkptr_t *bp, const zbookmark_phys_t *zb, - dnode_phys_t *dnp, arc_buf_t *pbuf, - dsl_dataset_t *ds, dsl_scan_t *scn, dmu_objset_type_t ostype, - dmu_tx_t *tx) + dnode_phys_t *dnp, dsl_dataset_t *ds, dsl_scan_t *scn, + dmu_objset_type_t ostype, dmu_tx_t *tx) { dsl_pool_t *dp = scn->scn_dp; arc_buf_t *buf = NULL; @@ -776,16 +771,15 @@ dsl_scan_visitbp(blkptr_t *bp, const zbo scn->scn_visited_this_txg++; dprintf_bp(bp, - "visiting ds=%p/%llu zb=%llx/%llx/%llx/%llx buf=%p bp=%p", + "visiting ds=%p/%llu zb=%llx/%llx/%llx/%llx bp=%p", ds, ds ? ds->ds_object : 0, zb->zb_objset, zb->zb_object, zb->zb_level, zb->zb_blkid, - pbuf, bp); + bp); if (bp->blk_birth <= scn->scn_phys.scn_cur_min_txg) return; - if (dsl_scan_recurse(scn, ds, ostype, dnp, &bp_toread, zb, tx, - &buf) != 0) + if (dsl_scan_recurse(scn, ds, ostype, dnp, &bp_toread, zb, tx) != 0) return; /* @@ -809,8 +803,6 @@ dsl_scan_visitbp(blkptr_t *bp, const zbo if (BP_PHYSICAL_BIRTH(bp) <= scn->scn_phys.scn_cur_max_txg) { scan_funcs[scn->scn_phys.scn_func](dp, bp, zb); } - if (buf) - (void) arc_buf_remove_ref(buf, &buf); } static void @@ -821,7 +813,7 @@ dsl_scan_visit_rootbp(dsl_scan_t *scn, d SET_BOOKMARK(&zb, ds ? ds->ds_object : DMU_META_OBJSET, ZB_ROOT_OBJECT, ZB_ROOT_LEVEL, ZB_ROOT_BLKID); - dsl_scan_visitbp(bp, &zb, NULL, NULL, + dsl_scan_visitbp(bp, &zb, NULL, ds, scn, DMU_OST_NONE, tx); dprintf_ds(ds, "finished scan%s", ""); From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 22:13:52 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 23CE7CAF; Mon, 20 Oct 2014 22:13:52 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0491C251; Mon, 20 Oct 2014 22:13:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KMDpJ8035802; Mon, 20 Oct 2014 22:13:51 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KMDovX035797; Mon, 20 Oct 2014 22:13:50 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410202213.s9KMDovX035797@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 20 Oct 2014 22:13:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273348 - in stable/10: cddl/contrib/opensolaris/cmd/zdb sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 22:13:52 -0000 Author: delphij Date: Mon Oct 20 22:13:50 2014 New Revision: 273348 URL: https://svnweb.freebsd.org/changeset/base/273348 Log: MFC r272598: MFV r272585: Split the godfather zio into CPU number's to reduce lock contention. Illumos issue: 5176 lock contention on godfather zio Modified: stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c Mon Oct 20 22:09:30 2014 (r273347) +++ stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c Mon Oct 20 22:13:50 2014 (r273348) @@ -2594,10 +2594,12 @@ dump_block_stats(spa_t *spa) * all async I/Os to complete. */ if (dump_opt['c']) { - (void) zio_wait(spa->spa_async_zio_root); - spa->spa_async_zio_root = zio_root(spa, NULL, NULL, - ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE | - ZIO_FLAG_GODFATHER); + for (int i = 0; i < max_ncpus; i++) { + (void) zio_wait(spa->spa_async_zio_root[i]); + spa->spa_async_zio_root[i] = zio_root(spa, NULL, NULL, + ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE | + ZIO_FLAG_GODFATHER); + } } if (zcb.zcb_haderrors) { Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Mon Oct 20 22:09:30 2014 (r273347) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Mon Oct 20 22:13:50 2014 (r273348) @@ -1274,7 +1274,9 @@ spa_unload(spa_t *spa) * Wait for any outstanding async I/O to complete. */ if (spa->spa_async_zio_root != NULL) { - (void) zio_wait(spa->spa_async_zio_root); + for (int i = 0; i < max_ncpus; i++) + (void) zio_wait(spa->spa_async_zio_root[i]); + kmem_free(spa->spa_async_zio_root, max_ncpus * sizeof (void *)); spa->spa_async_zio_root = NULL; } @@ -2210,8 +2212,13 @@ spa_load_impl(spa_t *spa, uint64_t pool_ /* * Create "The Godfather" zio to hold all async IOs */ - spa->spa_async_zio_root = zio_root(spa, NULL, NULL, - ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE | ZIO_FLAG_GODFATHER); + spa->spa_async_zio_root = kmem_alloc(max_ncpus * sizeof (void *), + KM_SLEEP); + for (int i = 0; i < max_ncpus; i++) { + spa->spa_async_zio_root[i] = zio_root(spa, NULL, NULL, + ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE | + ZIO_FLAG_GODFATHER); + } /* * Parse the configuration into a vdev tree. We explicitly set the @@ -3564,8 +3571,13 @@ spa_create(const char *pool, nvlist_t *n /* * Create "The Godfather" zio to hold all async IOs */ - spa->spa_async_zio_root = zio_root(spa, NULL, NULL, - ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE | ZIO_FLAG_GODFATHER); + spa->spa_async_zio_root = kmem_alloc(max_ncpus * sizeof (void *), + KM_SLEEP); + for (int i = 0; i < max_ncpus; i++) { + spa->spa_async_zio_root[i] = zio_root(spa, NULL, NULL, + ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE | + ZIO_FLAG_GODFATHER); + } /* * Create the root vdev. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Mon Oct 20 22:09:30 2014 (r273347) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Mon Oct 20 22:13:50 2014 (r273348) @@ -206,7 +206,8 @@ struct spa { uint64_t spa_failmode; /* failure mode for the pool */ uint64_t spa_delegation; /* delegation on/off */ list_t spa_config_list; /* previous cache file(s) */ - zio_t *spa_async_zio_root; /* root of all async I/O */ + /* per-CPU array of root of async I/O: */ + zio_t **spa_async_zio_root; zio_t *spa_suspend_zio_root; /* root of all suspended I/O */ kmutex_t spa_suspend_lock; /* protects suspend_zio_root */ kcondvar_t spa_suspend_cv; /* notification of resume */ Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Mon Oct 20 22:09:30 2014 (r273347) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Mon Oct 20 22:13:50 2014 (r273348) @@ -1462,7 +1462,7 @@ zio_nowait(zio_t *zio) */ spa_t *spa = zio->io_spa; - zio_add_child(spa->spa_async_zio_root, zio); + zio_add_child(spa->spa_async_zio_root[CPU_SEQID], zio); } zio_execute(zio); From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 22:18:22 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6298FEAD; Mon, 20 Oct 2014 22:18:22 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DEC727D; Mon, 20 Oct 2014 22:18:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KMIMGO036448; Mon, 20 Oct 2014 22:18:22 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KMIMIS036447; Mon, 20 Oct 2014 22:18:22 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410202218.s9KMIMIS036447@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 20 Oct 2014 22:18:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273349 - stable/10/cddl/contrib/opensolaris/cmd/zdb X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 22:18:22 -0000 Author: delphij Date: Mon Oct 20 22:18:21 2014 New Revision: 273349 URL: https://svnweb.freebsd.org/changeset/base/273349 Log: MFC r272599: MFV r272588: Handle old format deadlist. Illumos issue: 5178 zdb -vvvvv on old-format pool fails in dump_deadlist() Modified: stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c Mon Oct 20 22:13:50 2014 (r273348) +++ stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c Mon Oct 20 22:18:21 2014 (r273349) @@ -1461,6 +1461,11 @@ dump_deadlist(dsl_deadlist_t *dl) if (dump_opt['d'] < 3) return; + if (dl->dl_oldfmt) { + dump_bpobj(&dl->dl_bpobj, "old-format deadlist", 0); + return; + } + zdb_nicenum(dl->dl_phys->dl_used, bytes); zdb_nicenum(dl->dl_phys->dl_comp, comp); zdb_nicenum(dl->dl_phys->dl_uncomp, uncomp); From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 22:22:40 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 86C4C1EE; Mon, 20 Oct 2014 22:22:40 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6899037A; Mon, 20 Oct 2014 22:22:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KMMePf040428; Mon, 20 Oct 2014 22:22:40 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KMMe4E040424; Mon, 20 Oct 2014 22:22:40 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410202222.s9KMMe4E040424@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 20 Oct 2014 22:22:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273350 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 22:22:40 -0000 Author: delphij Date: Mon Oct 20 22:22:39 2014 New Revision: 273350 URL: https://svnweb.freebsd.org/changeset/base/273350 Log: MFC r272601: MFV r272591: Use loaned ARC buffer for zfs receive to avoid copy. Illumos issue: 5162 zfs recv should use loaned arc buffer to avoid copy Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Mon Oct 20 22:18:21 2014 (r273349) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Mon Oct 20 22:22:39 2014 (r273350) @@ -1333,7 +1333,14 @@ dmu_assign_arcbuf(dmu_buf_t *handle, uin rw_exit(&dn->dn_struct_rwlock); DB_DNODE_EXIT(dbuf); - if (offset == db->db.db_offset && blksz == db->db.db_size) { + /* + * We can only assign if the offset is aligned, the arc buf is the + * same size as the dbuf, and the dbuf is not metadata. It + * can't be metadata because the loaned arc buf comes from the + * user-data kmem arena. + */ + if (offset == db->db.db_offset && blksz == db->db.db_size && + DBUF_GET_BUFC_TYPE(db) == ARC_BUFC_DATA) { dbuf_assign_arcbuf(db, buf, tx); dbuf_rele(db, FTAG); } else { Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Mon Oct 20 22:18:21 2014 (r273349) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Mon Oct 20 22:22:39 2014 (r273350) @@ -1273,18 +1273,20 @@ restore_bytes(struct restorearg *ra, voi } static void * -restore_read(struct restorearg *ra, int len) +restore_read(struct restorearg *ra, int len, char *buf) { - void *rv; int done = 0; + if (buf == NULL) + buf = ra->buf; + /* some things will require 8-byte alignment, so everything must */ ASSERT0(len % 8); while (done < len) { ssize_t resid; - ra->err = restore_bytes(ra, (caddr_t)ra->buf + done, + ra->err = restore_bytes(ra, buf + done, len - done, ra->voff, &resid); if (resid == len - done) @@ -1296,12 +1298,11 @@ restore_read(struct restorearg *ra, int } ASSERT3U(done, ==, len); - rv = ra->buf; if (ra->byteswap) - fletcher_4_incremental_byteswap(rv, len, &ra->cksum); + fletcher_4_incremental_byteswap(buf, len, &ra->cksum); else - fletcher_4_incremental_native(rv, len, &ra->cksum); - return (rv); + fletcher_4_incremental_native(buf, len, &ra->cksum); + return (buf); } static void @@ -1416,7 +1417,7 @@ restore_object(struct restorearg *ra, ob return (SET_ERROR(EINVAL)); if (drro->drr_bonuslen) { - data = restore_read(ra, P2ROUNDUP(drro->drr_bonuslen, 8)); + data = restore_read(ra, P2ROUNDUP(drro->drr_bonuslen, 8), NULL); if (ra->err != 0) return (ra->err); } @@ -1513,19 +1514,30 @@ restore_write(struct restorearg *ra, obj !DMU_OT_IS_VALID(drrw->drr_type)) return (SET_ERROR(EINVAL)); - data = restore_read(ra, drrw->drr_length); - if (data == NULL) - return (ra->err); - if (dmu_object_info(os, drrw->drr_object, NULL) != 0) return (SET_ERROR(EINVAL)); + dmu_buf_t *bonus; + if (dmu_bonus_hold(os, drrw->drr_object, FTAG, &bonus) != 0) + return (SET_ERROR(EINVAL)); + + arc_buf_t *abuf = dmu_request_arcbuf(bonus, drrw->drr_length); + + data = restore_read(ra, drrw->drr_length, abuf->b_data); + if (data == NULL) { + dmu_return_arcbuf(abuf); + dmu_buf_rele(bonus, FTAG); + return (ra->err); + } + tx = dmu_tx_create(os); dmu_tx_hold_write(tx, drrw->drr_object, drrw->drr_offset, drrw->drr_length); err = dmu_tx_assign(tx, TXG_WAIT); if (err != 0) { + dmu_return_arcbuf(abuf); + dmu_buf_rele(bonus, FTAG); dmu_tx_abort(tx); return (err); } @@ -1534,9 +1546,9 @@ restore_write(struct restorearg *ra, obj DMU_OT_BYTESWAP(drrw->drr_type); dmu_ot_byteswap[byteswap].ob_func(data, drrw->drr_length); } - dmu_write(os, drrw->drr_object, - drrw->drr_offset, drrw->drr_length, data, tx); + dmu_assign_arcbuf(bonus, drrw->drr_offset, abuf, tx); dmu_tx_commit(tx); + dmu_buf_rele(bonus, FTAG); return (0); } @@ -1618,7 +1630,7 @@ restore_write_embedded(struct restorearg if (drrwnp->drr_compression >= ZIO_COMPRESS_FUNCTIONS) return (EINVAL); - data = restore_read(ra, P2ROUNDUP(drrwnp->drr_psize, 8)); + data = restore_read(ra, P2ROUNDUP(drrwnp->drr_psize, 8), NULL); if (data == NULL) return (ra->err); @@ -1653,7 +1665,7 @@ restore_spill(struct restorearg *ra, obj drrs->drr_length > SPA_MAXBLOCKSIZE) return (SET_ERROR(EINVAL)); - data = restore_read(ra, drrs->drr_length); + data = restore_read(ra, drrs->drr_length, NULL); if (data == NULL) return (ra->err); @@ -1795,7 +1807,7 @@ dmu_recv_stream(dmu_recv_cookie_t *drc, */ pcksum = ra.cksum; while (ra.err == 0 && - NULL != (drr = restore_read(&ra, sizeof (*drr)))) { + NULL != (drr = restore_read(&ra, sizeof (*drr), NULL))) { if (issig(JUSTLOOKING) && issig(FORREAL)) { ra.err = SET_ERROR(EINTR); goto out; From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 22:37:19 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E8BB8650 for ; Mon, 20 Oct 2014 22:37:18 +0000 (UTC) Received: from mail-pd0-f181.google.com (mail-pd0-f181.google.com [209.85.192.181]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BBBD4678 for ; Mon, 20 Oct 2014 22:37:18 +0000 (UTC) Received: by mail-pd0-f181.google.com with SMTP id w10so4300pde.26 for ; Mon, 20 Oct 2014 15:37:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=IcJDyxRs42Qf60onFy97BQ/tuycHav1WbBhSobu0JWM=; b=AHt+j58XaYZtU1N2e+QyhVlYVrlXf6xRpsU90znCSMfJU0jVqQED52QZwqq6zXOZE+ FH4jl0wmzWx7bn0FGuwzB3aSR7cFymYlDm1BEMHO2BqJxbMLOsyt3xFFpZetPsdwMxAe KTC3y+QNK+WUFeDEgjVzsIas5g9cWMrMQLW4qN/jQl5vNqhPABAofI+RNyrU42C82Yvz E3K0e2xmlVbiWrNE3q5w9py80Hi4pUYI1XAzi2+r6NmyoZv1BRyIAS88osjgurNjm8kY EB3SWljOH7dTAYrFBockYk6wPffr+OhNEH3NEY2xvc2NewNs4iPqTVA8q4kI+2vAExAI CnUg== X-Gm-Message-State: ALoCoQmR6cchVhHz5c/64hcIiRaAZbncd/hUrxcM8FXyocJc6ZHLPgqDq5Jr0XYxs8e9dLt48jmY MIME-Version: 1.0 X-Received: by 10.68.125.164 with SMTP id mr4mr13992101pbb.78.1413844631828; Mon, 20 Oct 2014 15:37:11 -0700 (PDT) Sender: andy@fud.org.nz Received: by 10.70.109.175 with HTTP; Mon, 20 Oct 2014 15:37:11 -0700 (PDT) In-Reply-To: <201410201442.s9KEggqt096167@svn.freebsd.org> References: <201410201442.s9KEggqt096167@svn.freebsd.org> Date: Tue, 21 Oct 2014 11:37:11 +1300 X-Google-Sender-Auth: Cb6N57Z7Q8cDHOZIyW7J09hAnPo Message-ID: Subject: Re: svn commit: r273331 - in head: sbin/ifconfig share/man/man4 sys/conf sys/modules sys/modules/if_vxlan sys/net sys/sys From: Andrew Thompson To: Bryan Venteicher Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 22:37:19 -0000 On 21 October 2014 03:42, Bryan Venteicher wrote: > Author: bryanv > Date: Mon Oct 20 14:42:42 2014 > New Revision: 273331 > URL: https://svnweb.freebsd.org/changeset/base/273331 > > Log: > Add vxlan interface > > vxlan creates a virtual LAN by encapsulating the inner Ethernet frame in > a UDP packet. This implementation is based on RFC7348. > > Currently, the IPv6 support is not fully compliant with the > specification: > we should be able to receive UPDv6 packets with a zero checksum, but we > need to support RFC6935 first. Patches for this should come soon. > > Given it is self contained new code is it a 10.1 MFC candidate? Andrew From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 22:52:16 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5E24D898; Mon, 20 Oct 2014 22:52:16 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4AB3F864; Mon, 20 Oct 2014 22:52:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KMqGw8054193; Mon, 20 Oct 2014 22:52:16 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KMqGA0054192; Mon, 20 Oct 2014 22:52:16 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410202252.s9KMqGA0054192@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 20 Oct 2014 22:52:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273351 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 22:52:16 -0000 Author: mjg Date: Mon Oct 20 22:52:15 2014 New Revision: 273351 URL: https://svnweb.freebsd.org/changeset/base/273351 Log: Plug unnecessary binvp NULL initialization and test. Reported by: Coverity CID: 1018889 Modified: head/sys/kern/kern_exec.c Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Mon Oct 20 22:22:39 2014 (r273350) +++ head/sys/kern/kern_exec.c Mon Oct 20 22:52:15 2014 (r273351) @@ -348,7 +348,7 @@ do_execve(td, args, mac_p) struct vnode *tracevp = NULL; struct ucred *tracecred = NULL; #endif - struct vnode *textvp = NULL, *binvp = NULL; + struct vnode *textvp = NULL, *binvp; cap_rights_t rights; int credential_changing; int textset; @@ -422,7 +422,7 @@ interpret: if (error) goto exec_fail; - binvp = nd.ni_vp; + binvp = nd.ni_vp; imgp->vp = binvp; } else { AUDIT_ARG_FD(args->fd); @@ -839,7 +839,7 @@ done1: */ if (textvp != NULL) vrele(textvp); - if (binvp && error != 0) + if (error != 0) vrele(binvp); #ifdef KTRACE if (tracevp != NULL) From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 22:53:04 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8BEC69D6; Mon, 20 Oct 2014 22:53:04 +0000 (UTC) Received: from mail-ie0-x22a.google.com (mail-ie0-x22a.google.com [IPv6:2607:f8b0:4001:c03::22a]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2DC9D86A; Mon, 20 Oct 2014 22:53:04 +0000 (UTC) Received: by mail-ie0-f170.google.com with SMTP id rd18so38118iec.1 for ; Mon, 20 Oct 2014 15:53:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=hm1Yiu++0X0NxMtVVx5fVu87SS3l6l/hRUSI/zaITEQ=; b=aVC8NtvaeNn6Iz5sm6SwqSmai59BO1FMqyJPxS/tYWXMSw3Liwvsao8/k76lNPq3eJ 6pBpW2GjYoKiM10jRrzIwQ5eNqtpwmO3ommMcUqwF6KVmvAXtN1NeMAd/9rJhA/gK76I hdLOEN8Z2s8NKh+Nez40Gw7yzJzMw8NdVqu6D6hsicH/1feMidMLWLn3bxgb4GPmz5W7 uTUa7Av4BUWcfh4EXZV2t+t0lswruzHXBpK/Ft6/qjwXjs+vmeY44t4BOdK2AxSlglDm lawB5LOn4Vw4AnWm/Iq7cXTalDuOUPpt/4kBYQwt+Xl1Tpk/wUDizeMLVu+IEyzzU/4h Sreg== X-Received: by 10.42.121.17 with SMTP id h17mr5134642icr.75.1413845583450; Mon, 20 Oct 2014 15:53:03 -0700 (PDT) MIME-Version: 1.0 Sender: mr.kodiak@gmail.com Received: by 10.64.86.230 with HTTP; Mon, 20 Oct 2014 15:52:33 -0700 (PDT) In-Reply-To: References: <201410201442.s9KEggqt096167@svn.freebsd.org> From: Bryan Venteicher Date: Mon, 20 Oct 2014 17:52:33 -0500 X-Google-Sender-Auth: cIOwY7Hnx7TQ3jCmILPTCLHmXgg Message-ID: Subject: Re: svn commit: r273331 - in head: sbin/ifconfig share/man/man4 sys/conf sys/modules sys/modules/if_vxlan sys/net sys/sys To: Andrew Thompson Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: "svn-src-head@freebsd.org" , Bryan Venteicher , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 22:53:04 -0000 On Mon, Oct 20, 2014 at 5:37 PM, Andrew Thompson wrote: > > > On 21 October 2014 03:42, Bryan Venteicher wrote: > >> Author: bryanv >> Date: Mon Oct 20 14:42:42 2014 >> New Revision: 273331 >> URL: https://svnweb.freebsd.org/changeset/base/273331 >> >> Log: >> Add vxlan interface >> >> vxlan creates a virtual LAN by encapsulating the inner Ethernet frame in >> a UDP packet. This implementation is based on RFC7348. >> >> Currently, the IPv6 support is not fully compliant with the >> specification: >> we should be able to receive UPDv6 packets with a zero checksum, but we >> need to support RFC6935 first. Patches for this should come soon. >> >> > > Given it is self contained new code is it a 10.1 MFC candidate? > > > I hope to merge vxlan to 10-STABLE in a couple of months, but need to determine how to handle prerequisite commit r272886. There's ways without it - use a mbuf tag and a reserved field in the inpcb - but it would be nice if that commit is MFC'able. https://svnweb.freebsd.org/base?view=revision&revision=272886 > Andrew > > From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 22:55:18 2014 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 186DAC09; Mon, 20 Oct 2014 22:55:18 +0000 (UTC) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 7C90F87F; Mon, 20 Oct 2014 22:55:15 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id BAA29258; Tue, 21 Oct 2014 01:55:13 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1XgLr5-00017B-ST; Tue, 21 Oct 2014 01:55:13 +0300 Message-ID: <54459294.2090904@FreeBSD.org> Date: Tue, 21 Oct 2014 01:54:12 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.1.2 MIME-Version: 1.0 To: Steven Hartland , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r269407 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys References: <201408012316.s71NGnBh071036@svn.freebsd.org> In-Reply-To: <201408012316.s71NGnBh071036@svn.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 22:55:18 -0000 On 02/08/2014 02:16, Steven Hartland wrote: > Author: smh > Date: Fri Aug 1 23:16:48 2014 > New Revision: 269407 > URL: http://svnweb.freebsd.org/changeset/base/269407 > > Log: > Don't return ZIO_PIPELINE_CONTINUE from vdev_op_io_start methods > > This prevents recursion of vdev_queue_io_done as per r265321 but > using a different method as recommended on the openzfs list. > > We now use zio_interrupt(zio) and return ZIO_PIPELINE_STOP instead > of returning ZIO_PIPELINE_CONTINUE from vdev_*_io_start methods. > > zio_vdev_io_start now ASSERTS the that vdev_op_io_start returns > ZIO_PIPELINE_STOP to ensure future changes don't reintroduce > ZIO_PIPELINE_CONTINUE returns. Steve, it seems that the issue is applicable to OpenZFS in general, but unfortunately, as far as I can see, it's been applied only to FreeBSD. Now, I see the following bug report and a proposed fix: https://www.illumos.org/projects/illumos-gate//issues/5244 https://reviews.csiden.org/r/119/ I am not 100% sure, but it seems that those upstream changes could fix the problem that you've found. What do you think? Thanks! > Cleanup flow in vdev_geom_io_start while I'm here. > > Also fix some cases not using SET_ERROR(..) > > MFC after: 2 weeks > X-MFC-With: r265321 > > Modified: > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Fri Aug 1 23:06:38 2014 (r269406) > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Fri Aug 1 23:16:48 2014 (r269407) > @@ -208,7 +208,6 @@ enum zio_flag { > ZIO_FLAG_NOPWRITE = 1 << 26, > ZIO_FLAG_REEXECUTED = 1 << 27, > ZIO_FLAG_DELEGATED = 1 << 28, > - ZIO_FLAG_QUEUE_IO_DONE = 1 << 29, > }; > > #define ZIO_FLAG_MUSTSUCCEED 0 > @@ -363,7 +362,7 @@ typedef struct zio_transform { > struct zio_transform *zt_next; > } zio_transform_t; > > -typedef int zio_pipe_stage_t(zio_t **ziop); > +typedef int zio_pipe_stage_t(zio_t *zio); > > /* > * The io_reexecute flags are distinct from io_flags because the child must > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c Fri Aug 1 23:06:38 2014 (r269406) > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c Fri Aug 1 23:16:48 2014 (r269407) > @@ -684,7 +684,7 @@ vdev_disk_io_intr(buf_t *bp) > * Rather than teach the rest of the stack about other error > * possibilities (EFAULT, etc), we normalize the error value here. > */ > - zio->io_error = (geterror(bp) != 0 ? EIO : 0); > + zio->io_error = (geterror(bp) != 0 ? SET_ERROR(EIO) : 0); > > if (zio->io_error == 0 && bp->b_resid != 0) > zio->io_error = SET_ERROR(EIO); > @@ -730,15 +730,17 @@ vdev_disk_io_start(zio_t *zio) > * Nothing to be done here but return failure. > */ > if (dvd == NULL || (dvd->vd_ldi_offline && dvd->vd_lh == NULL)) { > - zio->io_error = ENXIO; > - return (ZIO_PIPELINE_CONTINUE); > + zio->io_error = SET_ERROR(ENXIO); > + zio_interrupt(zio); > + return (ZIO_PIPELINE_STOP); > } > > if (zio->io_type == ZIO_TYPE_IOCTL) { > /* XXPOLICY */ > if (!vdev_readable(vd)) { > zio->io_error = SET_ERROR(ENXIO); > - return (ZIO_PIPELINE_CONTINUE); > + zio_interrupt(zio); > + return (ZIO_PIPELINE_STOP); > } > > switch (zio->io_cmd) { > @@ -790,7 +792,8 @@ vdev_disk_io_start(zio_t *zio) > zio->io_error = SET_ERROR(ENOTSUP); > } > > - return (ZIO_PIPELINE_CONTINUE); > + zio_interrupt(zio); > + return (ZIO_PIPELINE_STOP); > } > > vb = kmem_alloc(sizeof (vdev_buf_t), KM_SLEEP); > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c Fri Aug 1 23:06:38 2014 (r269406) > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c Fri Aug 1 23:16:48 2014 (r269407) > @@ -164,7 +164,8 @@ vdev_file_io_start(zio_t *zio) > > if (!vdev_readable(vd)) { > zio->io_error = SET_ERROR(ENXIO); > - return (ZIO_PIPELINE_CONTINUE); > + zio_interrupt(zio); > + return (ZIO_PIPELINE_STOP); > } > > vf = vd->vdev_tsd; > @@ -180,7 +181,8 @@ vdev_file_io_start(zio_t *zio) > zio->io_error = SET_ERROR(ENOTSUP); > } > > - return (ZIO_PIPELINE_CONTINUE); > + zio_interrupt(zio); > + return (ZIO_PIPELINE_STOP); > } > > zio->io_error = vn_rdwr(zio->io_type == ZIO_TYPE_READ ? > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Fri Aug 1 23:06:38 2014 (r269406) > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Fri Aug 1 23:16:48 2014 (r269407) > @@ -749,7 +749,7 @@ vdev_geom_io_intr(struct bio *bp) > vd = zio->io_vd; > zio->io_error = bp->bio_error; > if (zio->io_error == 0 && bp->bio_resid != 0) > - zio->io_error = EIO; > + zio->io_error = SET_ERROR(EIO); > > switch(zio->io_error) { > case ENOTSUP: > @@ -803,37 +803,38 @@ vdev_geom_io_start(zio_t *zio) > /* XXPOLICY */ > if (!vdev_readable(vd)) { > zio->io_error = SET_ERROR(ENXIO); > - return (ZIO_PIPELINE_CONTINUE); > - } > - > - switch (zio->io_cmd) { > - case DKIOCFLUSHWRITECACHE: > - if (zfs_nocacheflush || vdev_geom_bio_flush_disable) > - break; > - if (vd->vdev_nowritecache) { > + } else { > + switch (zio->io_cmd) { > + case DKIOCFLUSHWRITECACHE: > + if (zfs_nocacheflush || vdev_geom_bio_flush_disable) > + break; > + if (vd->vdev_nowritecache) { > + zio->io_error = SET_ERROR(ENOTSUP); > + break; > + } > + goto sendreq; > + default: > zio->io_error = SET_ERROR(ENOTSUP); > - break; > } > - goto sendreq; > - default: > - zio->io_error = SET_ERROR(ENOTSUP); > } > > - return (ZIO_PIPELINE_CONTINUE); > + zio_interrupt(zio); > + return (ZIO_PIPELINE_STOP); > case ZIO_TYPE_FREE: > - if (vdev_geom_bio_delete_disable) > - return (ZIO_PIPELINE_CONTINUE); > - > if (vd->vdev_notrim) { > zio->io_error = SET_ERROR(ENOTSUP); > - return (ZIO_PIPELINE_CONTINUE); > + } else if (!vdev_geom_bio_delete_disable) { > + goto sendreq; > } > + zio_interrupt(zio); > + return (ZIO_PIPELINE_STOP); > } > sendreq: > cp = vd->vdev_tsd; > if (cp == NULL) { > zio->io_error = SET_ERROR(ENXIO); > - return (ZIO_PIPELINE_CONTINUE); > + zio_interrupt(zio); > + return (ZIO_PIPELINE_STOP); > } > bp = g_alloc_bio(); > bp->bio_caller1 = zio; > @@ -852,14 +853,11 @@ sendreq: > bp->bio_length = zio->io_size; > break; > case ZIO_TYPE_IOCTL: > - if (zio->io_cmd == DKIOCFLUSHWRITECACHE) { > - bp->bio_cmd = BIO_FLUSH; > - bp->bio_flags |= BIO_ORDERED; > - bp->bio_data = NULL; > - bp->bio_offset = cp->provider->mediasize; > - bp->bio_length = 0; > - break; > - } > + bp->bio_cmd = BIO_FLUSH; > + bp->bio_flags |= BIO_ORDERED; > + bp->bio_data = NULL; > + bp->bio_offset = cp->provider->mediasize; > + bp->bio_length = 0; > break; > } > bp->bio_done = vdev_geom_io_intr; > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c Fri Aug 1 23:06:38 2014 (r269406) > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c Fri Aug 1 23:16:48 2014 (r269407) > @@ -450,7 +450,8 @@ vdev_mirror_io_start(zio_t *zio) > zio->io_type, zio->io_priority, 0, > vdev_mirror_scrub_done, mc)); > } > - return (ZIO_PIPELINE_CONTINUE); > + zio_interrupt(zio); > + return (ZIO_PIPELINE_STOP); > } > /* > * For normal reads just pick one child. > @@ -477,7 +478,8 @@ vdev_mirror_io_start(zio_t *zio) > c++; > } > > - return (ZIO_PIPELINE_CONTINUE); > + zio_interrupt(zio); > + return (ZIO_PIPELINE_STOP); > } > > static int > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c Fri Aug 1 23:06:38 2014 (r269406) > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c Fri Aug 1 23:16:48 2014 (r269407) > @@ -71,7 +71,8 @@ static int > vdev_missing_io_start(zio_t *zio) > { > zio->io_error = SET_ERROR(ENOTSUP); > - return (ZIO_PIPELINE_CONTINUE); > + zio_interrupt(zio); > + return (ZIO_PIPELINE_STOP); > } > > /* ARGSUSED */ > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c Fri Aug 1 23:06:38 2014 (r269406) > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c Fri Aug 1 23:16:48 2014 (r269407) > @@ -796,25 +796,14 @@ vdev_queue_io_done(zio_t *zio) > > vq->vq_io_complete_ts = gethrtime(); > > - if (zio->io_flags & ZIO_FLAG_QUEUE_IO_DONE) { > - /* > - * Executing from a previous vdev_queue_io_done so > - * to avoid recursion we just unlock and return. > - */ > - mutex_exit(&vq->vq_lock); > - return; > - } > - > while ((nio = vdev_queue_io_to_issue(vq)) != NULL) { > mutex_exit(&vq->vq_lock); > - nio->io_flags |= ZIO_FLAG_QUEUE_IO_DONE; > if (nio->io_done == vdev_queue_agg_io_done) { > zio_nowait(nio); > } else { > zio_vdev_io_reissue(nio); > zio_execute(nio); > } > - nio->io_flags &= ~ZIO_FLAG_QUEUE_IO_DONE; > mutex_enter(&vq->vq_lock); > } > > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c Fri Aug 1 23:06:38 2014 (r269406) > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c Fri Aug 1 23:16:48 2014 (r269407) > @@ -1755,7 +1755,9 @@ vdev_raidz_io_start(zio_t *zio) > zio->io_type, zio->io_priority, 0, > vdev_raidz_child_done, rc)); > } > - return (ZIO_PIPELINE_CONTINUE); > + > + zio_interrupt(zio); > + return (ZIO_PIPELINE_STOP); > } > > if (zio->io_type == ZIO_TYPE_WRITE) { > @@ -1787,7 +1789,8 @@ vdev_raidz_io_start(zio_t *zio) > ZIO_FLAG_NODATA | ZIO_FLAG_OPTIONAL, NULL, NULL)); > } > > - return (ZIO_PIPELINE_CONTINUE); > + zio_interrupt(zio); > + return (ZIO_PIPELINE_STOP); > } > > ASSERT(zio->io_type == ZIO_TYPE_READ); > @@ -1827,7 +1830,8 @@ vdev_raidz_io_start(zio_t *zio) > } > } > > - return (ZIO_PIPELINE_CONTINUE); > + zio_interrupt(zio); > + return (ZIO_PIPELINE_STOP); > } > > > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Fri Aug 1 23:06:38 2014 (r269406) > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Fri Aug 1 23:16:48 2014 (r269407) > @@ -1038,9 +1038,8 @@ zio_shrink(zio_t *zio, uint64_t size) > */ > > static int > -zio_read_bp_init(zio_t **ziop) > +zio_read_bp_init(zio_t *zio) > { > - zio_t *zio = *ziop; > blkptr_t *bp = zio->io_bp; > > if (BP_GET_COMPRESS(bp) != ZIO_COMPRESS_OFF && > @@ -1073,9 +1072,8 @@ zio_read_bp_init(zio_t **ziop) > } > > static int > -zio_write_bp_init(zio_t **ziop) > +zio_write_bp_init(zio_t *zio) > { > - zio_t *zio = *ziop; > spa_t *spa = zio->io_spa; > zio_prop_t *zp = &zio->io_prop; > enum zio_compress compress = zp->zp_compress; > @@ -1255,9 +1253,8 @@ zio_write_bp_init(zio_t **ziop) > } > > static int > -zio_free_bp_init(zio_t **ziop) > +zio_free_bp_init(zio_t *zio) > { > - zio_t *zio = *ziop; > blkptr_t *bp = zio->io_bp; > > if (zio->io_child_type == ZIO_CHILD_LOGICAL) { > @@ -1340,10 +1337,8 @@ zio_taskq_member(zio_t *zio, zio_taskq_t > } > > static int > -zio_issue_async(zio_t **ziop) > +zio_issue_async(zio_t *zio) > { > - zio_t *zio = *ziop; > - > zio_taskq_dispatch(zio, ZIO_TASKQ_ISSUE, B_FALSE); > > return (ZIO_PIPELINE_STOP); > @@ -1411,7 +1406,7 @@ zio_execute(zio_t *zio) > } > > zio->io_stage = stage; > - rv = zio_pipeline[highbit64(stage) - 1](&zio); > + rv = zio_pipeline[highbit64(stage) - 1](zio); > > if (rv == ZIO_PIPELINE_STOP) > return; > @@ -1845,9 +1840,8 @@ zio_gang_tree_issue(zio_t *pio, zio_gang > } > > static int > -zio_gang_assemble(zio_t **ziop) > +zio_gang_assemble(zio_t *zio) > { > - zio_t *zio = *ziop; > blkptr_t *bp = zio->io_bp; > > ASSERT(BP_IS_GANG(bp) && zio->io_gang_leader == NULL); > @@ -1861,9 +1855,8 @@ zio_gang_assemble(zio_t **ziop) > } > > static int > -zio_gang_issue(zio_t **ziop) > +zio_gang_issue(zio_t *zio) > { > - zio_t *zio = *ziop; > blkptr_t *bp = zio->io_bp; > > if (zio_wait_for_children(zio, ZIO_CHILD_GANG, ZIO_WAIT_DONE)) > @@ -1997,9 +1990,8 @@ zio_write_gang_block(zio_t *pio) > * writes) and as a result is mutually exclusive with dedup. > */ > static int > -zio_nop_write(zio_t **ziop) > +zio_nop_write(zio_t *zio) > { > - zio_t *zio = *ziop; > blkptr_t *bp = zio->io_bp; > blkptr_t *bp_orig = &zio->io_bp_orig; > zio_prop_t *zp = &zio->io_prop; > @@ -2070,9 +2062,8 @@ zio_ddt_child_read_done(zio_t *zio) > } > > static int > -zio_ddt_read_start(zio_t **ziop) > +zio_ddt_read_start(zio_t *zio) > { > - zio_t *zio = *ziop; > blkptr_t *bp = zio->io_bp; > > ASSERT(BP_GET_DEDUP(bp)); > @@ -2114,9 +2105,8 @@ zio_ddt_read_start(zio_t **ziop) > } > > static int > -zio_ddt_read_done(zio_t **ziop) > +zio_ddt_read_done(zio_t *zio) > { > - zio_t *zio = *ziop; > blkptr_t *bp = zio->io_bp; > > if (zio_wait_for_children(zio, ZIO_CHILD_DDT, ZIO_WAIT_DONE)) > @@ -2284,9 +2274,8 @@ zio_ddt_ditto_write_done(zio_t *zio) > } > > static int > -zio_ddt_write(zio_t **ziop) > +zio_ddt_write(zio_t *zio) > { > - zio_t *zio = *ziop; > spa_t *spa = zio->io_spa; > blkptr_t *bp = zio->io_bp; > uint64_t txg = zio->io_txg; > @@ -2397,9 +2386,8 @@ zio_ddt_write(zio_t **ziop) > ddt_entry_t *freedde; /* for debugging */ > > static int > -zio_ddt_free(zio_t **ziop) > +zio_ddt_free(zio_t *zio) > { > - zio_t *zio = *ziop; > spa_t *spa = zio->io_spa; > blkptr_t *bp = zio->io_bp; > ddt_t *ddt = ddt_select(spa, bp); > @@ -2424,9 +2412,8 @@ zio_ddt_free(zio_t **ziop) > * ========================================================================== > */ > static int > -zio_dva_allocate(zio_t **ziop) > +zio_dva_allocate(zio_t *zio) > { > - zio_t *zio = *ziop; > spa_t *spa = zio->io_spa; > metaslab_class_t *mc = spa_normal_class(spa); > blkptr_t *bp = zio->io_bp; > @@ -2468,19 +2455,16 @@ zio_dva_allocate(zio_t **ziop) > } > > static int > -zio_dva_free(zio_t **ziop) > +zio_dva_free(zio_t *zio) > { > - zio_t *zio = *ziop; > - > metaslab_free(zio->io_spa, zio->io_bp, zio->io_txg, B_FALSE); > > return (ZIO_PIPELINE_CONTINUE); > } > > static int > -zio_dva_claim(zio_t **ziop) > +zio_dva_claim(zio_t *zio) > { > - zio_t *zio = *ziop; > int error; > > error = metaslab_claim(zio->io_spa, zio->io_bp, zio->io_txg); > @@ -2574,12 +2558,12 @@ zio_free_zil(spa_t *spa, uint64_t txg, b > * ========================================================================== > */ > static int > -zio_vdev_io_start(zio_t **ziop) > +zio_vdev_io_start(zio_t *zio) > { > - zio_t *zio = *ziop; > vdev_t *vd = zio->io_vd; > uint64_t align; > spa_t *spa = zio->io_spa; > + int ret; > > ASSERT(zio->io_error == 0); > ASSERT(zio->io_child_error[ZIO_CHILD_VDEV] == 0); > @@ -2690,7 +2674,6 @@ zio_vdev_io_start(zio_t **ziop) > case ZIO_TYPE_FREE: > if ((zio = vdev_queue_io(zio)) == NULL) > return (ZIO_PIPELINE_STOP); > - *ziop = zio; > > if (!vdev_accessible(vd, zio)) { > zio->io_error = SET_ERROR(ENXIO); > @@ -2710,13 +2693,15 @@ zio_vdev_io_start(zio_t **ziop) > return (ZIO_PIPELINE_STOP); > } > > - return (vd->vdev_ops->vdev_op_io_start(zio)); > + ret = vd->vdev_ops->vdev_op_io_start(zio); > + ASSERT(ret == ZIO_PIPELINE_STOP); > + > + return (ret); > } > > static int > -zio_vdev_io_done(zio_t **ziop) > +zio_vdev_io_done(zio_t *zio) > { > - zio_t *zio = *ziop; > vdev_t *vd = zio->io_vd; > vdev_ops_t *ops = vd ? vd->vdev_ops : &vdev_mirror_ops; > boolean_t unexpected_error = B_FALSE; > @@ -2794,9 +2779,8 @@ zio_vsd_default_cksum_report(zio_t *zio, > } > > static int > -zio_vdev_io_assess(zio_t **ziop) > +zio_vdev_io_assess(zio_t *zio) > { > - zio_t *zio = *ziop; > vdev_t *vd = zio->io_vd; > > if (zio_wait_for_children(zio, ZIO_CHILD_VDEV, ZIO_WAIT_DONE)) > @@ -2911,9 +2895,8 @@ zio_vdev_io_bypass(zio_t *zio) > * ========================================================================== > */ > static int > -zio_checksum_generate(zio_t **ziop) > +zio_checksum_generate(zio_t *zio) > { > - zio_t *zio = *ziop; > blkptr_t *bp = zio->io_bp; > enum zio_checksum checksum; > > @@ -2943,9 +2926,8 @@ zio_checksum_generate(zio_t **ziop) > } > > static int > -zio_checksum_verify(zio_t **ziop) > +zio_checksum_verify(zio_t *zio) > { > - zio_t *zio = *ziop; > zio_bad_cksum_t info; > blkptr_t *bp = zio->io_bp; > int error; > @@ -3016,9 +2998,8 @@ zio_worst_error(int e1, int e2) > * ========================================================================== > */ > static int > -zio_ready(zio_t **ziop) > +zio_ready(zio_t *zio) > { > - zio_t *zio = *ziop; > blkptr_t *bp = zio->io_bp; > zio_t *pio, *pio_next; > > @@ -3075,9 +3056,8 @@ zio_ready(zio_t **ziop) > } > > static int > -zio_done(zio_t **ziop) > +zio_done(zio_t *zio) > { > - zio_t *zio = *ziop; > spa_t *spa = zio->io_spa; > zio_t *lio = zio->io_logical; > blkptr_t *bp = zio->io_bp; > -- Andriy Gapon From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 23:32:35 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0D9BC529; Mon, 20 Oct 2014 23:32:35 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EE2DFC03; Mon, 20 Oct 2014 23:32:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KNWYgF073285; Mon, 20 Oct 2014 23:32:34 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KNWYiQ073284; Mon, 20 Oct 2014 23:32:34 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201410202332.s9KNWYiQ073284@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 20 Oct 2014 23:32:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273352 - head/sys/arm/freescale/imx X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 23:32:35 -0000 Author: ian Date: Mon Oct 20 23:32:34 2014 New Revision: 273352 URL: https://svnweb.freebsd.org/changeset/base/273352 Log: The imx6 hardware is fast enough to make good use of however much timecounter resolution is available, so ask for a 1 GHz frequency. It won't actually get one that fast, but that'll get the fastest available clock and use a divisor of 1 (probably 132 or 66mhz on current hardware). Modified: head/sys/arm/freescale/imx/imx_gpt.c Modified: head/sys/arm/freescale/imx/imx_gpt.c ============================================================================== --- head/sys/arm/freescale/imx/imx_gpt.c Mon Oct 20 22:52:15 2014 (r273351) +++ head/sys/arm/freescale/imx/imx_gpt.c Mon Oct 20 23:32:34 2014 (r273352) @@ -95,7 +95,7 @@ struct imx_gpt_softc *imx_gpt_sc = NULL; static const int imx_gpt_delay_count = 78; /* Try to divide down an available fast clock to this frequency. */ -#define TARGET_FREQUENCY 10000000 +#define TARGET_FREQUENCY 1000000000 /* Don't try to set an event timer period smaller than this. */ #define MIN_ET_PERIOD 10LLU From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 23:34:47 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DBC52681; Mon, 20 Oct 2014 23:34:47 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C8A34C14; Mon, 20 Oct 2014 23:34:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KNYl5G073602; Mon, 20 Oct 2014 23:34:47 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KNYlAp073601; Mon, 20 Oct 2014 23:34:47 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201410202334.s9KNYlAp073601@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 20 Oct 2014 23:34:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273353 - head/sys/arm/freescale/imx X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 23:34:48 -0000 Author: ian Date: Mon Oct 20 23:34:47 2014 New Revision: 273353 URL: https://svnweb.freebsd.org/changeset/base/273353 Log: Attach the imx6 CCM driver during BUS_PASS_CPU. It controls the clocks for most on-chip devices and needs to be available before other drivers start attaching and asking to have their clocks enabled. Modified: head/sys/arm/freescale/imx/imx6_ccm.c Modified: head/sys/arm/freescale/imx/imx6_ccm.c ============================================================================== --- head/sys/arm/freescale/imx/imx6_ccm.c Mon Oct 20 23:32:34 2014 (r273352) +++ head/sys/arm/freescale/imx/imx6_ccm.c Mon Oct 20 23:34:47 2014 (r273353) @@ -261,5 +261,6 @@ static driver_t ccm_driver = { static devclass_t ccm_devclass; -DRIVER_MODULE(ccm, simplebus, ccm_driver, ccm_devclass, 0, 0); +EARLY_DRIVER_MODULE(ccm, simplebus, ccm_driver, ccm_devclass, 0, 0, + BUS_PASS_CPU + BUS_PASS_ORDER_EARLY); From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 23:43:17 2014 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BBEA6869; Mon, 20 Oct 2014 23:43:17 +0000 (UTC) Received: from smtp1.multiplay.co.uk (smtp1.multiplay.co.uk [85.236.96.35]) by mx1.freebsd.org (Postfix) with ESMTP id 801F0CD8; Mon, 20 Oct 2014 23:43:17 +0000 (UTC) Received: by smtp1.multiplay.co.uk (Postfix, from userid 65534) id 4757F20E70899; Mon, 20 Oct 2014 23:43:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.multiplay.co.uk X-Spam-Level: X-Spam-Status: No, score=0.1 required=8.0 tests=AWL,BAYES_00,RDNS_DYNAMIC autolearn=no version=3.3.1 Received: from [10.10.1.68] (82-69-141-170.dsl.in-addr.zen.co.uk [82.69.141.170]) by smtp1.multiplay.co.uk (Postfix) with ESMTP id 95B1220E7088A; Mon, 20 Oct 2014 23:43:13 +0000 (UTC) Message-ID: <54459E1D.1040401@freebsd.org> Date: Tue, 21 Oct 2014 00:43:25 +0100 From: Steven Hartland User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Andriy Gapon , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r269407 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys References: <201408012316.s71NGnBh071036@svn.freebsd.org> <54459294.2090904@FreeBSD.org> In-Reply-To: <54459294.2090904@FreeBSD.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 23:43:17 -0000 On 20/10/2014 23:54, Andriy Gapon wrote: > On 02/08/2014 02:16, Steven Hartland wrote: >> Author: smh >> Date: Fri Aug 1 23:16:48 2014 >> New Revision: 269407 >> URL: http://svnweb.freebsd.org/changeset/base/269407 >> >> Log: >> Don't return ZIO_PIPELINE_CONTINUE from vdev_op_io_start methods >> >> This prevents recursion of vdev_queue_io_done as per r265321 but >> using a different method as recommended on the openzfs list. >> >> We now use zio_interrupt(zio) and return ZIO_PIPELINE_STOP instead >> of returning ZIO_PIPELINE_CONTINUE from vdev_*_io_start methods. >> >> zio_vdev_io_start now ASSERTS the that vdev_op_io_start returns >> ZIO_PIPELINE_STOP to ensure future changes don't reintroduce >> ZIO_PIPELINE_CONTINUE returns. > > Steve, > > it seems that the issue is applicable to OpenZFS in general, but unfortunately, > as far as I can see, it's been applied only to FreeBSD. > > Now, I see the following bug report and a proposed fix: > https://www.illumos.org/projects/illumos-gate//issues/5244 > https://reviews.csiden.org/r/119/ > > I am not 100% sure, but it seems that those upstream changes could fix the > problem that you've found. > > What do you think? Yep very similar change overall. The only real difference is they changed the vdev_op_io_start call to a void and return stop direct from zio_vdev_io_start. The result should be identical and it will be easy to merge the upstream change when it gets committed. Shame that wasn't suggested when I posted my suggested patch ;-) Regards Steve From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 00:06:04 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CC7E5CBE; Tue, 21 Oct 2014 00:06:04 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9E2A2E9A; Tue, 21 Oct 2014 00:06:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L064CZ088587; Tue, 21 Oct 2014 00:06:04 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L064OB088586; Tue, 21 Oct 2014 00:06:04 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201410210006.s9L064OB088586@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 21 Oct 2014 00:06:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273354 - stable/10/release X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 00:06:04 -0000 Author: gjb Date: Tue Oct 21 00:06:03 2014 New Revision: 273354 URL: https://svnweb.freebsd.org/changeset/base/273354 Log: MFC r273204: Add more descriptive metadata to the ISO images. Sponsored by: The FreeBSD Foundation Modified: stable/10/release/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/release/Makefile ============================================================================== --- stable/10/release/Makefile Mon Oct 20 23:34:47 2014 (r273353) +++ stable/10/release/Makefile Tue Oct 21 00:06:03 2014 (r273354) @@ -62,6 +62,8 @@ OSRELEASE= ${TYPE}-${REVISION}-${BRANCH} .endfor .endif +VOLUME_LABEL= ${OSRELEASE:C/[-\.]/_/g:S/^$${TYPE}_//} + .if !exists(${DOCDIR}) NODOC= true .endif @@ -254,28 +256,31 @@ dvd: release.iso: disc1.iso disc1.iso: system - sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.TARGET} release + sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b ${VOLUME_LABEL}_CD ${.TARGET} release uefi-disc1.iso: system .if exists(${.CURDIR}/${TARGET}/mkisoimages-uefi.sh) - sh ${.CURDIR}/${TARGET}/mkisoimages-uefi.sh -b FreeBSD_Install ${.TARGET} release + sh ${.CURDIR}/${TARGET}/mkisoimages-uefi.sh -b ${VOLUME_LABEL}_UEFICD \ + ${.TARGET} release .endif uefi-bootonly.iso: bootonly .if exists(${.CURDIR}/${TARGET}/mkisoimages-uefi.sh) - sh ${.CURDIR}/${TARGET}/mkisoimages-uefi.sh -b FreeBSD_Install ${.TARGET} bootonly + sh ${.CURDIR}/${TARGET}/mkisoimages-uefi.sh -b ${VOLUME_LABEL}_UEFICD \ + ${.TARGET} bootonly .endif dvd1.iso: dvd pkg-stage - sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.TARGET} dvd + sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b ${VOLUME_LABEL}_DVD ${.TARGET} dvd uefi-dvd1.iso: dvd pkg-stage .if exists(${.CURDIR}/${TARGET}/mkisoimages-uefi.sh) - sh ${.CURDIR}/${TARGET}/mkisoimages-uefi.sh -b FreeBSD_Install ${.TARGET} dvd + sh ${.CURDIR}/${TARGET}/mkisoimages-uefi.sh -b ${VOLUME_LABEL}_UEFIDVD \ + ${.TARGET} dvd .endif bootonly.iso: bootonly - sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.TARGET} bootonly + sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b ${VOLUME_LABEL}_BO ${.TARGET} bootonly memstick: memstick.img memstick.img: system From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 00:07:38 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4F1CCE0C; Tue, 21 Oct 2014 00:07:38 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3AEBDEB0; Tue, 21 Oct 2014 00:07:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L07cBj088877; Tue, 21 Oct 2014 00:07:38 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L07cv9088876; Tue, 21 Oct 2014 00:07:38 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201410210007.s9L07cv9088876@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 21 Oct 2014 00:07:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273355 - stable/10/release X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 00:07:38 -0000 Author: gjb Date: Tue Oct 21 00:07:37 2014 New Revision: 273355 URL: https://svnweb.freebsd.org/changeset/base/273355 Log: Fix label for the UEFI bootonly cd. Sponsored by: The FreeBSD Foundation Modified: stable/10/release/Makefile Modified: stable/10/release/Makefile ============================================================================== --- stable/10/release/Makefile Tue Oct 21 00:06:03 2014 (r273354) +++ stable/10/release/Makefile Tue Oct 21 00:07:37 2014 (r273355) @@ -266,7 +266,7 @@ uefi-disc1.iso: system uefi-bootonly.iso: bootonly .if exists(${.CURDIR}/${TARGET}/mkisoimages-uefi.sh) - sh ${.CURDIR}/${TARGET}/mkisoimages-uefi.sh -b ${VOLUME_LABEL}_UEFICD \ + sh ${.CURDIR}/${TARGET}/mkisoimages-uefi.sh -b ${VOLUME_LABEL}_UEFIBO \ ${.TARGET} bootonly .endif From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 00:09:18 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from hub.FreeBSD.org (hub.freebsd.org [IPv6:2001:1900:2254:206c::16:88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 55033F4F; Tue, 21 Oct 2014 00:09:17 +0000 (UTC) Date: Tue, 21 Oct 2014 00:09:13 +0000 From: Glen Barber To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: Re: svn commit: r273355 - stable/10/release Message-ID: <20141021000913.GB1212@hub.FreeBSD.org> References: <201410210007.s9L07cv9088876@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="i0/AhcQY5QxfSsSZ" Content-Disposition: inline In-Reply-To: <201410210007.s9L07cv9088876@svn.freebsd.org> X-Operating-System: FreeBSD 11.0-CURRENT amd64 X-SCUD-Definition: Sudden Completely Unexpected Dataloss X-SULE-Definition: Sudden Unexpected Learning Event User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 00:09:18 -0000 --i0/AhcQY5QxfSsSZ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Oct 21, 2014 at 12:07:38AM +0000, Glen Barber wrote: > Author: gjb > Date: Tue Oct 21 00:07:37 2014 > New Revision: 273355 > URL: https://svnweb.freebsd.org/changeset/base/273355 >=20 > Log: > Fix label for the UEFI bootonly cd. > =20 This is a direct commit to stable/10, head/ does not have this differentiation between UEFI and non-UEFI CDs. Glen --i0/AhcQY5QxfSsSZ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJURaQpAAoJEAMUWKVHj+KTL4oP/0oUxdDCqVwLPXxfGIW838WR GMMxk23TyNF/0hgBISYWpltxADIthGEhSBLICIZ9/Cs59WOs5c3PZQUOPBzHIWJK hYU1cMGBC3hwyYPa8et8Ws/BQ2+IPDcrn5uqMV8l4yahaY5uXxXYfcQetTmRdBKF Y9hNDol3J9+PYr7YuulCEad5WUnxPQBt+RIHmoTP/BsymathsH1cmFHJLPY655n2 +uwOm7bidp7hOMSaDK4aaTupLaoQW87dVB5hG5kR82Gmg4+Sq1y+WGuEPmerCKl/ iJef3Uqwd3mn1NyporKsbRHcr7EH6XXOutZNy876+Xr09HuMjNaNeTUkaE47MfC9 U3ZkQxNndXWsADW+jlWPplou/P09wnKGWYoXP0keHSP0JQ1MuW2JYkWyamOqZE/4 lMem5D3MIJtTd78ZEnZ1uTOJb7gvRtw2zywg3OCzkHMpfjT3O9MNNnDZnDbd0THN qmmDmcxAaKCmIjrpxW/DXJhOjVVSCZVHiTAb+dXPSDLjD63mdZUvtIKbnOLbLsHA srSKQHlTZFMAJq6vIahhtLdKKiFEsfR6beBRfTuxe0eNjpRP7xEYUgdXB5+UedlB QZneQQ/MM3l2j3VljIgiK5eV+Hif0lb2bZMUzQa9VEQ3CZar5bB8ONyBsh2z6F+c fGtmrfPNbGkF4/BqRpwH =NhAD -----END PGP SIGNATURE----- --i0/AhcQY5QxfSsSZ-- From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 01:06:59 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 30C2C7F6; Tue, 21 Oct 2014 01:06:59 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1DD41663; Tue, 21 Oct 2014 01:06:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L16wvB016765; Tue, 21 Oct 2014 01:06:58 GMT (envelope-from neel@FreeBSD.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L16wXd016764; Tue, 21 Oct 2014 01:06:58 GMT (envelope-from neel@FreeBSD.org) Message-Id: <201410210106.s9L16wXd016764@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: neel set sender to neel@FreeBSD.org using -f From: Neel Natu Date: Tue, 21 Oct 2014 01:06:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273356 - head/sys/amd64/amd64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 01:06:59 -0000 Author: neel Date: Tue Oct 21 01:06:58 2014 New Revision: 273356 URL: https://svnweb.freebsd.org/changeset/base/273356 Log: Fix a race in pmap_emulate_accessed_dirty() that could trigger a EPT misconfiguration VM-exit. An EPT misconfiguration is triggered when the processor encounters a PTE that is writable but not readable (WR=10). On processors that require A/D bit emulation PG_M and PG_A map to EPT_PG_WRITE and EPT_PG_READ respectively. If the PTE is updated as in the following code snippet: *pte |= PG_M; *pte |= PG_A; then it is possible for another processor to observe the PTE after the PG_M (aka EPT_PG_WRITE) bit is set but before PG_A (aka EPT_PG_READ) bit is set. This will trigger an EPT misconfiguration VM-exit on the other processor. Reported by: rodrigc Reviewed by: grehan MFC after: 3 days Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Tue Oct 21 00:07:37 2014 (r273355) +++ head/sys/amd64/amd64/pmap.c Tue Oct 21 01:06:58 2014 (r273356) @@ -6810,9 +6810,19 @@ retry: if (ftype == VM_PROT_WRITE) { if ((*pte & PG_RW) == 0) goto done; - *pte |= PG_M; + /* + * Set the modified and accessed bits simultaneously. + * + * Intel EPT PTEs that do software emulation of A/D bits map + * PG_A and PG_M to EPT_PG_READ and EPT_PG_WRITE respectively. + * An EPT misconfiguration is triggered if the PTE is writable + * but not readable (WR=10). This is avoided by setting PG_A + * and PG_M simultaneously. + */ + *pte |= PG_M | PG_A; + } else { + *pte |= PG_A; } - *pte |= PG_A; /* try to promote the mapping */ if (va < VM_MAXUSER_ADDRESS) From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 01:14:58 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9A4849A9; Tue, 21 Oct 2014 01:14:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7C282782; Tue, 21 Oct 2014 01:14:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L1EwFj021193; Tue, 21 Oct 2014 01:14:58 GMT (envelope-from yongari@FreeBSD.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L1Eva9021187; Tue, 21 Oct 2014 01:14:57 GMT (envelope-from yongari@FreeBSD.org) Message-Id: <201410210114.s9L1Eva9021187@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: yongari set sender to yongari@FreeBSD.org using -f From: Pyun YongHyeon Date: Tue, 21 Oct 2014 01:14:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273357 - in stable/10/sys/dev: alc ale X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 01:14:58 -0000 Author: yongari Date: Tue Oct 21 01:14:56 2014 New Revision: 273357 URL: https://svnweb.freebsd.org/changeset/base/273357 Log: MFC r272721: Fix a long standing bug in MAC statistics register access. One additional register was erroneously added in the MAC register set such that 7 TX statistics counters were wrong. Modified: stable/10/sys/dev/alc/if_alc.c stable/10/sys/dev/alc/if_alcreg.h stable/10/sys/dev/ale/if_ale.c stable/10/sys/dev/ale/if_alereg.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/alc/if_alc.c ============================================================================== --- stable/10/sys/dev/alc/if_alc.c Tue Oct 21 01:06:58 2014 (r273356) +++ stable/10/sys/dev/alc/if_alc.c Tue Oct 21 01:14:56 2014 (r273357) @@ -1286,8 +1286,6 @@ alc_sysctl_node(struct alc_softc *sc) &stats->tx_late_colls, "Late collisions"); ALC_SYSCTL_STAT_ADD32(ctx, child, "excess_colls", &stats->tx_excess_colls, "Excessive collisions"); - ALC_SYSCTL_STAT_ADD32(ctx, child, "abort", - &stats->tx_abort, "Aborted frames due to Excessive collisions"); ALC_SYSCTL_STAT_ADD32(ctx, child, "underruns", &stats->tx_underrun, "FIFO underruns"); ALC_SYSCTL_STAT_ADD32(ctx, child, "desc_underruns", @@ -2603,7 +2601,6 @@ alc_stats_update(struct alc_softc *sc) stat->tx_multi_colls += smb->tx_multi_colls; stat->tx_late_colls += smb->tx_late_colls; stat->tx_excess_colls += smb->tx_excess_colls; - stat->tx_abort += smb->tx_abort; stat->tx_underrun += smb->tx_underrun; stat->tx_desc_underrun += smb->tx_desc_underrun; stat->tx_lenerrs += smb->tx_lenerrs; @@ -2616,7 +2613,7 @@ alc_stats_update(struct alc_softc *sc) ifp->if_collisions += smb->tx_single_colls + smb->tx_multi_colls * 2 + smb->tx_late_colls + - smb->tx_abort * HDPX_CFG_RETRY_DEFAULT; + smb->tx_excess_colls * HDPX_CFG_RETRY_DEFAULT; /* * XXX @@ -2625,8 +2622,8 @@ alc_stats_update(struct alc_softc *sc) * the counter name is not correct one so I've removed the * counter in output errors. */ - ifp->if_oerrors += smb->tx_abort + smb->tx_late_colls + - smb->tx_underrun; + ifp->if_oerrors += smb->tx_late_colls + smb->tx_excess_colls + + smb->tx_underrun + smb->tx_pkts_truncated; ifp->if_ipackets += smb->rx_frames; Modified: stable/10/sys/dev/alc/if_alcreg.h ============================================================================== --- stable/10/sys/dev/alc/if_alcreg.h Tue Oct 21 01:06:58 2014 (r273356) +++ stable/10/sys/dev/alc/if_alcreg.h Tue Oct 21 01:14:56 2014 (r273357) @@ -860,7 +860,6 @@ struct smb { uint32_t tx_multi_colls; uint32_t tx_late_colls; uint32_t tx_excess_colls; - uint32_t tx_abort; uint32_t tx_underrun; uint32_t tx_desc_underrun; uint32_t tx_lenerrs; Modified: stable/10/sys/dev/ale/if_ale.c ============================================================================== --- stable/10/sys/dev/ale/if_ale.c Tue Oct 21 01:06:58 2014 (r273356) +++ stable/10/sys/dev/ale/if_ale.c Tue Oct 21 01:14:56 2014 (r273357) @@ -945,8 +945,6 @@ ale_sysctl_node(struct ale_softc *sc) &stats->tx_late_colls, "Late collisions"); ALE_SYSCTL_STAT_ADD32(ctx, child, "excess_colls", &stats->tx_excess_colls, "Excessive collisions"); - ALE_SYSCTL_STAT_ADD32(ctx, child, "abort", - &stats->tx_abort, "Aborted frames due to Excessive collisions"); ALE_SYSCTL_STAT_ADD32(ctx, child, "underruns", &stats->tx_underrun, "FIFO underruns"); ALE_SYSCTL_STAT_ADD32(ctx, child, "desc_underruns", @@ -2200,7 +2198,6 @@ ale_stats_update(struct ale_softc *sc) stat->tx_multi_colls += smb->tx_multi_colls; stat->tx_late_colls += smb->tx_late_colls; stat->tx_excess_colls += smb->tx_excess_colls; - stat->tx_abort += smb->tx_abort; stat->tx_underrun += smb->tx_underrun; stat->tx_desc_underrun += smb->tx_desc_underrun; stat->tx_lenerrs += smb->tx_lenerrs; @@ -2213,17 +2210,10 @@ ale_stats_update(struct ale_softc *sc) ifp->if_collisions += smb->tx_single_colls + smb->tx_multi_colls * 2 + smb->tx_late_colls + - smb->tx_abort * HDPX_CFG_RETRY_DEFAULT; + smb->tx_excess_colls * HDPX_CFG_RETRY_DEFAULT; - /* - * XXX - * tx_pkts_truncated counter looks suspicious. It constantly - * increments with no sign of Tx errors. This may indicate - * the counter name is not correct one so I've removed the - * counter in output errors. - */ - ifp->if_oerrors += smb->tx_abort + smb->tx_late_colls + - smb->tx_underrun; + ifp->if_oerrors += smb->tx_late_colls + smb->tx_excess_colls + + smb->tx_underrun + smb->tx_pkts_truncated; ifp->if_ipackets += smb->rx_frames; Modified: stable/10/sys/dev/ale/if_alereg.h ============================================================================== --- stable/10/sys/dev/ale/if_alereg.h Tue Oct 21 01:06:58 2014 (r273356) +++ stable/10/sys/dev/ale/if_alereg.h Tue Oct 21 01:14:56 2014 (r273357) @@ -605,7 +605,6 @@ struct smb { uint32_t tx_multi_colls; uint32_t tx_late_colls; uint32_t tx_excess_colls; - uint32_t tx_abort; uint32_t tx_underrun; uint32_t tx_desc_underrun; uint32_t tx_lenerrs; From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 01:15:45 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2DBBBAE1; Tue, 21 Oct 2014 01:15:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0FE5A78B; Tue, 21 Oct 2014 01:15:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L1FigD021390; Tue, 21 Oct 2014 01:15:44 GMT (envelope-from yongari@FreeBSD.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L1FieL021383; Tue, 21 Oct 2014 01:15:44 GMT (envelope-from yongari@FreeBSD.org) Message-Id: <201410210115.s9L1FieL021383@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: yongari set sender to yongari@FreeBSD.org using -f From: Pyun YongHyeon Date: Tue, 21 Oct 2014 01:15:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r273358 - in stable/9/sys/dev: alc ale X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 01:15:45 -0000 Author: yongari Date: Tue Oct 21 01:15:43 2014 New Revision: 273358 URL: https://svnweb.freebsd.org/changeset/base/273358 Log: MFC r272721: Fix a long standing bug in MAC statistics register access. One additional register was erroneously added in the MAC register set such that 7 TX statistics counters were wrong. Modified: stable/9/sys/dev/alc/if_alc.c stable/9/sys/dev/alc/if_alcreg.h stable/9/sys/dev/ale/if_ale.c stable/9/sys/dev/ale/if_alereg.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/alc/if_alc.c ============================================================================== --- stable/9/sys/dev/alc/if_alc.c Tue Oct 21 01:14:56 2014 (r273357) +++ stable/9/sys/dev/alc/if_alc.c Tue Oct 21 01:15:43 2014 (r273358) @@ -1286,8 +1286,6 @@ alc_sysctl_node(struct alc_softc *sc) &stats->tx_late_colls, "Late collisions"); ALC_SYSCTL_STAT_ADD32(ctx, child, "excess_colls", &stats->tx_excess_colls, "Excessive collisions"); - ALC_SYSCTL_STAT_ADD32(ctx, child, "abort", - &stats->tx_abort, "Aborted frames due to Excessive collisions"); ALC_SYSCTL_STAT_ADD32(ctx, child, "underruns", &stats->tx_underrun, "FIFO underruns"); ALC_SYSCTL_STAT_ADD32(ctx, child, "desc_underruns", @@ -2603,7 +2601,6 @@ alc_stats_update(struct alc_softc *sc) stat->tx_multi_colls += smb->tx_multi_colls; stat->tx_late_colls += smb->tx_late_colls; stat->tx_excess_colls += smb->tx_excess_colls; - stat->tx_abort += smb->tx_abort; stat->tx_underrun += smb->tx_underrun; stat->tx_desc_underrun += smb->tx_desc_underrun; stat->tx_lenerrs += smb->tx_lenerrs; @@ -2616,17 +2613,10 @@ alc_stats_update(struct alc_softc *sc) ifp->if_collisions += smb->tx_single_colls + smb->tx_multi_colls * 2 + smb->tx_late_colls + - smb->tx_abort * HDPX_CFG_RETRY_DEFAULT; + smb->tx_excess_colls * HDPX_CFG_RETRY_DEFAULT; - /* - * XXX - * tx_pkts_truncated counter looks suspicious. It constantly - * increments with no sign of Tx errors. This may indicate - * the counter name is not correct one so I've removed the - * counter in output errors. - */ - ifp->if_oerrors += smb->tx_abort + smb->tx_late_colls + - smb->tx_underrun; + ifp->if_oerrors += smb->tx_late_colls + smb->tx_excess_colls + + smb->tx_underrun + smb->tx_pkts_truncated; ifp->if_ipackets += smb->rx_frames; Modified: stable/9/sys/dev/alc/if_alcreg.h ============================================================================== --- stable/9/sys/dev/alc/if_alcreg.h Tue Oct 21 01:14:56 2014 (r273357) +++ stable/9/sys/dev/alc/if_alcreg.h Tue Oct 21 01:15:43 2014 (r273358) @@ -860,7 +860,6 @@ struct smb { uint32_t tx_multi_colls; uint32_t tx_late_colls; uint32_t tx_excess_colls; - uint32_t tx_abort; uint32_t tx_underrun; uint32_t tx_desc_underrun; uint32_t tx_lenerrs; Modified: stable/9/sys/dev/ale/if_ale.c ============================================================================== --- stable/9/sys/dev/ale/if_ale.c Tue Oct 21 01:14:56 2014 (r273357) +++ stable/9/sys/dev/ale/if_ale.c Tue Oct 21 01:15:43 2014 (r273358) @@ -945,8 +945,6 @@ ale_sysctl_node(struct ale_softc *sc) &stats->tx_late_colls, "Late collisions"); ALE_SYSCTL_STAT_ADD32(ctx, child, "excess_colls", &stats->tx_excess_colls, "Excessive collisions"); - ALE_SYSCTL_STAT_ADD32(ctx, child, "abort", - &stats->tx_abort, "Aborted frames due to Excessive collisions"); ALE_SYSCTL_STAT_ADD32(ctx, child, "underruns", &stats->tx_underrun, "FIFO underruns"); ALE_SYSCTL_STAT_ADD32(ctx, child, "desc_underruns", @@ -2200,7 +2198,6 @@ ale_stats_update(struct ale_softc *sc) stat->tx_multi_colls += smb->tx_multi_colls; stat->tx_late_colls += smb->tx_late_colls; stat->tx_excess_colls += smb->tx_excess_colls; - stat->tx_abort += smb->tx_abort; stat->tx_underrun += smb->tx_underrun; stat->tx_desc_underrun += smb->tx_desc_underrun; stat->tx_lenerrs += smb->tx_lenerrs; @@ -2213,17 +2210,10 @@ ale_stats_update(struct ale_softc *sc) ifp->if_collisions += smb->tx_single_colls + smb->tx_multi_colls * 2 + smb->tx_late_colls + - smb->tx_abort * HDPX_CFG_RETRY_DEFAULT; + smb->tx_excess_colls * HDPX_CFG_RETRY_DEFAULT; - /* - * XXX - * tx_pkts_truncated counter looks suspicious. It constantly - * increments with no sign of Tx errors. This may indicate - * the counter name is not correct one so I've removed the - * counter in output errors. - */ - ifp->if_oerrors += smb->tx_abort + smb->tx_late_colls + - smb->tx_underrun; + ifp->if_oerrors += smb->tx_late_colls + smb->tx_excess_colls + + smb->tx_underrun + smb->tx_pkts_truncated; ifp->if_ipackets += smb->rx_frames; Modified: stable/9/sys/dev/ale/if_alereg.h ============================================================================== --- stable/9/sys/dev/ale/if_alereg.h Tue Oct 21 01:14:56 2014 (r273357) +++ stable/9/sys/dev/ale/if_alereg.h Tue Oct 21 01:15:43 2014 (r273358) @@ -605,7 +605,6 @@ struct smb { uint32_t tx_multi_colls; uint32_t tx_late_colls; uint32_t tx_excess_colls; - uint32_t tx_abort; uint32_t tx_underrun; uint32_t tx_desc_underrun; uint32_t tx_lenerrs; From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 01:31:24 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E1BA5DE8; Tue, 21 Oct 2014 01:31:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CDFA7914; Tue, 21 Oct 2014 01:31:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L1VOBp029699; Tue, 21 Oct 2014 01:31:24 GMT (envelope-from yongari@FreeBSD.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L1VOA5029698; Tue, 21 Oct 2014 01:31:24 GMT (envelope-from yongari@FreeBSD.org) Message-Id: <201410210131.s9L1VOA5029698@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: yongari set sender to yongari@FreeBSD.org using -f From: Pyun YongHyeon Date: Tue, 21 Oct 2014 01:31:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273359 - head/sys/dev/re X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 01:31:25 -0000 Author: yongari Date: Tue Oct 21 01:31:24 2014 New Revision: 273359 URL: https://svnweb.freebsd.org/changeset/base/273359 Log: It seems multicast filtering of RTL8168F does not work. Workaround the silicon bug by accepting any multicast packets. PR: 193488 MFC After: 1 week Modified: head/sys/dev/re/if_re.c Modified: head/sys/dev/re/if_re.c ============================================================================== --- head/sys/dev/re/if_re.c Tue Oct 21 01:15:43 2014 (r273358) +++ head/sys/dev/re/if_re.c Tue Oct 21 01:31:24 2014 (r273359) @@ -703,6 +703,12 @@ re_set_rxmode(struct rl_softc *sc) rxfilt |= RL_RXCFG_RX_MULTI; } + if (sc->rl_hwrev->rl_rev == RL_HWREV_8168F) { + /* Disable multicast filtering due to silicon bug. */ + hashes[0] = 0xffffffff; + hashes[1] = 0xffffffff; + } + done: CSR_WRITE_4(sc, RL_MAR0, hashes[0]); CSR_WRITE_4(sc, RL_MAR4, hashes[1]); From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 01:34:19 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 433BAF5A; Tue, 21 Oct 2014 01:34:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2F84A933; Tue, 21 Oct 2014 01:34:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L1YJxL030562; Tue, 21 Oct 2014 01:34:19 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L1YJnM030561; Tue, 21 Oct 2014 01:34:19 GMT (envelope-from np@FreeBSD.org) Message-Id: <201410210134.s9L1YJnM030561@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Tue, 21 Oct 2014 01:34:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273360 - head/tools/tools/cxgbetool X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 01:34:19 -0000 Author: np Date: Tue Oct 21 01:34:18 2014 New Revision: 273360 URL: https://svnweb.freebsd.org/changeset/base/273360 Log: cxgbetool: Catch up with r185979. One of MAP_ANON, MAP_PRIVATE, MAP_SHARED, or MAP_STACK must be specified. This fixes the "loadfw" subcommand. MFC after: 1 week Modified: head/tools/tools/cxgbetool/cxgbetool.c Modified: head/tools/tools/cxgbetool/cxgbetool.c ============================================================================== --- head/tools/tools/cxgbetool/cxgbetool.c Tue Oct 21 01:31:24 2014 (r273359) +++ head/tools/tools/cxgbetool/cxgbetool.c Tue Oct 21 01:34:18 2014 (r273360) @@ -1462,7 +1462,7 @@ loadfw(int argc, const char *argv[]) } data.len = st.st_size; - data.data = mmap(0, data.len, PROT_READ, 0, fd, 0); + data.data = mmap(0, data.len, PROT_READ, MAP_PRIVATE, fd, 0); if (data.data == MAP_FAILED) { warn("mmap"); close(fd); From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 01:38:43 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C4260150; Tue, 21 Oct 2014 01:38:43 +0000 (UTC) Received: from mail-pd0-x232.google.com (mail-pd0-x232.google.com [IPv6:2607:f8b0:400e:c02::232]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8C4A395A; Tue, 21 Oct 2014 01:38:43 +0000 (UTC) Received: by mail-pd0-f178.google.com with SMTP id y10so242892pdj.37 for ; Mon, 20 Oct 2014 18:38:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=ZVZJggY3Dz2LxC1xnlxRot7XCip4teiRcClL0Dpkx68=; b=pDfKrYFRd4ZigwoHPJk8uuVor11F7lz3jtTZ98P6SjeoB1/1+XMB0K7W1lAIk4TzJx kX7m9A0pIJt73GfDF2QGmq5fC+mw83ZaOneBxrUbg3PjGi8Z3zfSsC4TQKm7hsO03/3H 1ZQT8qINMqzCreLLRZFP6BpLI0iIMrYndWpNoEY7X+7TTzohZaWqgVhNytqN88NvLcXG XhgLmux2d64nhg9mfXJduXKcy4mc0p7S8PMukl3dTitYSD97tWOuiNgE2E3djfrKCTXY GKqhuV3P2ZVGmsHyAGmNIXncGWvSwJV0bFP8n9uO3giHL7vE9N60f3xMK7QaEmEGxlpP CFtA== X-Received: by 10.67.1.39 with SMTP id bd7mr14857785pad.57.1413855523018; Mon, 20 Oct 2014 18:38:43 -0700 (PDT) Received: from [10.192.166.0] (stargate.chelsio.com. [67.207.112.58]) by mx.google.com with ESMTPSA id zq13sm10369664pab.44.2014.10.20.18.38.41 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Oct 2014 18:38:41 -0700 (PDT) Sender: Navdeep Parhar Message-ID: <5445B920.4070005@FreeBSD.org> Date: Mon, 20 Oct 2014 18:38:40 -0700 From: Navdeep Parhar User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r273360 - head/tools/tools/cxgbetool References: <201410210134.s9L1YJnM030561@svn.freebsd.org> In-Reply-To: <201410210134.s9L1YJnM030561@svn.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 01:38:43 -0000 On 10/20/14 18:34, Navdeep Parhar wrote: > Author: np > Date: Tue Oct 21 01:34:18 2014 > New Revision: 273360 > URL: https://svnweb.freebsd.org/changeset/base/273360 > > Log: > cxgbetool: Catch up with r185979. One of MAP_ANON, MAP_PRIVATE, > MAP_SHARED, or MAP_STACK must be specified. Sorry, I meant r271635. (185979 isn't a random number in case you're wondering -- it's the mercurial changelog number for r271635 in my workspace). Regards, Navdeep From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 01:48:20 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 32CF5357; Tue, 21 Oct 2014 01:48:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 04C37A39; Tue, 21 Oct 2014 01:48:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L1mJR0035616; Tue, 21 Oct 2014 01:48:19 GMT (envelope-from yongari@FreeBSD.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L1mJ0d035615; Tue, 21 Oct 2014 01:48:19 GMT (envelope-from yongari@FreeBSD.org) Message-Id: <201410210148.s9L1mJ0d035615@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: yongari set sender to yongari@FreeBSD.org using -f From: Pyun YongHyeon Date: Tue, 21 Oct 2014 01:48:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273361 - stable/10/sys/dev/pci X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 01:48:20 -0000 Author: yongari Date: Tue Oct 21 01:48:19 2014 New Revision: 273361 URL: https://svnweb.freebsd.org/changeset/base/273361 Log: MFC r272729,272732: Add new quirk PCI_QUIRK_MSI_INTX_BUG to pci(4). QAC AR816x/E2200 controller has a silicon bug that MSI interrupt does not assert if PCIM_CMD_INTxDIS bit of command register is set. Modified: stable/10/sys/dev/pci/pci.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/pci/pci.c ============================================================================== --- stable/10/sys/dev/pci/pci.c Tue Oct 21 01:34:18 2014 (r273360) +++ stable/10/sys/dev/pci/pci.c Tue Oct 21 01:48:19 2014 (r273361) @@ -196,6 +196,7 @@ struct pci_quirk { #define PCI_QUIRK_ENABLE_MSI_VM 3 /* Older chipset in VM where MSI works */ #define PCI_QUIRK_UNMAP_REG 4 /* Ignore PCI map register */ #define PCI_QUIRK_DISABLE_MSIX 5 /* MSI-X doesn't work */ +#define PCI_QUIRK_MSI_INTX_BUG 6 /* PCIM_CMD_INTxDIS disables MSI */ int arg1; int arg2; }; @@ -255,6 +256,15 @@ static const struct pci_quirk pci_quirks */ { 0x43851002, PCI_QUIRK_UNMAP_REG, 0x14, 0 }, + /* + * Atheros AR8161/AR8162/E2200 ethernet controller has a bug that + * MSI interrupt does not assert if PCIM_CMD_INTxDIS bit of the + * command register is set. + */ + { 0x10911969, PCI_QUIRK_MSI_INTX_BUG, 0, 0 }, + { 0xE0911969, PCI_QUIRK_MSI_INTX_BUG, 0, 0 }, + { 0x10901969, PCI_QUIRK_MSI_INTX_BUG, 0, 0 }, + { 0 } }; @@ -3624,8 +3634,14 @@ pci_setup_intr(device_t dev, device_t ch mte->mte_handlers++; } - /* Make sure that INTx is disabled if we are using MSI/MSIX */ - pci_set_command_bit(dev, child, PCIM_CMD_INTxDIS); + if (!pci_has_quirk(pci_get_devid(dev), + PCI_QUIRK_MSI_INTX_BUG)) { + /* + * Make sure that INTx is disabled if we are + * using MSI/MSIX + */ + pci_set_command_bit(dev, child, PCIM_CMD_INTxDIS); + } bad: if (error) { (void)bus_generic_teardown_intr(dev, child, irq, From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 01:49:08 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5B96648B; Tue, 21 Oct 2014 01:49:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2D16FA41; Tue, 21 Oct 2014 01:49:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L1n8Jx035761; Tue, 21 Oct 2014 01:49:08 GMT (envelope-from yongari@FreeBSD.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L1n8gT035760; Tue, 21 Oct 2014 01:49:08 GMT (envelope-from yongari@FreeBSD.org) Message-Id: <201410210149.s9L1n8gT035760@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: yongari set sender to yongari@FreeBSD.org using -f From: Pyun YongHyeon Date: Tue, 21 Oct 2014 01:49:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r273362 - stable/9/sys/dev/pci X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 01:49:08 -0000 Author: yongari Date: Tue Oct 21 01:49:07 2014 New Revision: 273362 URL: https://svnweb.freebsd.org/changeset/base/273362 Log: MFC r272729,272732: Add new quirk PCI_QUIRK_MSI_INTX_BUG to pci(4). QAC AR816x/E2200 controller has a silicon bug that MSI interrupt does not assert if PCIM_CMD_INTxDIS bit of command register is set. Modified: stable/9/sys/dev/pci/pci.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/pci/pci.c ============================================================================== --- stable/9/sys/dev/pci/pci.c Tue Oct 21 01:48:19 2014 (r273361) +++ stable/9/sys/dev/pci/pci.c Tue Oct 21 01:49:07 2014 (r273362) @@ -209,6 +209,7 @@ struct pci_quirk { #define PCI_QUIRK_ENABLE_MSI_VM 3 /* Older chipset in VM where MSI works */ #define PCI_QUIRK_UNMAP_REG 4 /* Ignore PCI map register */ #define PCI_QUIRK_DISABLE_MSIX 5 /* MSI-X doesn't work */ +#define PCI_QUIRK_MSI_INTX_BUG 6 /* PCIM_CMD_INTxDIS disables MSI */ int arg1; int arg2; }; @@ -268,6 +269,15 @@ static const struct pci_quirk pci_quirks */ { 0x43851002, PCI_QUIRK_UNMAP_REG, 0x14, 0 }, + /* + * Atheros AR8161/AR8162/E2200 ethernet controller has a bug that + * MSI interrupt does not assert if PCIM_CMD_INTxDIS bit of the + * command register is set. + */ + { 0x10911969, PCI_QUIRK_MSI_INTX_BUG, 0, 0 }, + { 0xE0911969, PCI_QUIRK_MSI_INTX_BUG, 0, 0 }, + { 0x10901969, PCI_QUIRK_MSI_INTX_BUG, 0, 0 }, + { 0 } }; @@ -3557,8 +3567,14 @@ pci_setup_intr(device_t dev, device_t ch mte->mte_handlers++; } - /* Make sure that INTx is disabled if we are using MSI/MSIX */ - pci_set_command_bit(dev, child, PCIM_CMD_INTxDIS); + if (!pci_has_quirk(pci_get_devid(dev), + PCI_QUIRK_MSI_INTX_BUG)) { + /* + * Make sure that INTx is disabled if we are + * using MSI/MSIX + */ + pci_set_command_bit(dev, child, PCIM_CMD_INTxDIS); + } bad: if (error) { (void)bus_generic_teardown_intr(dev, child, irq, From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 02:41:41 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 679EBBC7; Tue, 21 Oct 2014 02:41:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 39B4EF29; Tue, 21 Oct 2014 02:41:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L2ffoN062611; Tue, 21 Oct 2014 02:41:41 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L2ffqU062610; Tue, 21 Oct 2014 02:41:41 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201410210241.s9L2ffqU062610@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 21 Oct 2014 02:41:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r273364 - releng/10.1/release X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 02:41:41 -0000 Author: gjb Date: Tue Oct 21 02:41:40 2014 New Revision: 273364 URL: https://svnweb.freebsd.org/changeset/base/273364 Log: MFstable10 r273354: MFC r273204: Add more descriptive metadata to the ISO images. MFstable10 r273355: Fix label for the UEFI bootonly cd. PR: 165876 Approved by: re (hrs) Sponsored by: The FreeBSD Foundation Modified: releng/10.1/release/Makefile Directory Properties: releng/10.1/ (props changed) Modified: releng/10.1/release/Makefile ============================================================================== --- releng/10.1/release/Makefile Tue Oct 21 01:57:36 2014 (r273363) +++ releng/10.1/release/Makefile Tue Oct 21 02:41:40 2014 (r273364) @@ -62,6 +62,8 @@ OSRELEASE= ${TYPE}-${REVISION}-${BRANCH} .endfor .endif +VOLUME_LABEL= ${OSRELEASE:C/[-\.]/_/g:S/^$${TYPE}_//} + .if !exists(${DOCDIR}) NODOC= true .endif @@ -254,28 +256,31 @@ dvd: release.iso: disc1.iso disc1.iso: system - sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.TARGET} release + sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b ${VOLUME_LABEL}_CD ${.TARGET} release uefi-disc1.iso: system .if exists(${.CURDIR}/${TARGET}/mkisoimages-uefi.sh) - sh ${.CURDIR}/${TARGET}/mkisoimages-uefi.sh -b FreeBSD_Install ${.TARGET} release + sh ${.CURDIR}/${TARGET}/mkisoimages-uefi.sh -b ${VOLUME_LABEL}_UEFICD \ + ${.TARGET} release .endif uefi-bootonly.iso: bootonly .if exists(${.CURDIR}/${TARGET}/mkisoimages-uefi.sh) - sh ${.CURDIR}/${TARGET}/mkisoimages-uefi.sh -b FreeBSD_Install ${.TARGET} bootonly + sh ${.CURDIR}/${TARGET}/mkisoimages-uefi.sh -b ${VOLUME_LABEL}_UEFIBO \ + ${.TARGET} bootonly .endif dvd1.iso: dvd pkg-stage - sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.TARGET} dvd + sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b ${VOLUME_LABEL}_DVD ${.TARGET} dvd uefi-dvd1.iso: dvd pkg-stage .if exists(${.CURDIR}/${TARGET}/mkisoimages-uefi.sh) - sh ${.CURDIR}/${TARGET}/mkisoimages-uefi.sh -b FreeBSD_Install ${.TARGET} dvd + sh ${.CURDIR}/${TARGET}/mkisoimages-uefi.sh -b ${VOLUME_LABEL}_UEFIDVD \ + ${.TARGET} dvd .endif bootonly.iso: bootonly - sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.TARGET} bootonly + sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b ${VOLUME_LABEL}_BO ${.TARGET} bootonly memstick: memstick.img memstick.img: system From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 04:30:00 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E78D5842; Tue, 21 Oct 2014 04:30:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D37CCBAC; Tue, 21 Oct 2014 04:30:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L4U06L011622; Tue, 21 Oct 2014 04:30:00 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L4U0eU011621; Tue, 21 Oct 2014 04:30:00 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201410210430.s9L4U0eU011621@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 21 Oct 2014 04:30:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273365 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 04:30:01 -0000 Author: markj Date: Tue Oct 21 04:30:00 2014 New Revision: 273365 URL: https://svnweb.freebsd.org/changeset/base/273365 Log: Fix a few small bugs in the DTrace USDT rules: * anchor search strings appropriately, * use .ALLSRC to pass the full path to the D script to dtrace(1), * don't insert the auto-generated header into SRCS - it doesn't accomplish anything, and we end up having to remove it from OBJS anyway. Reviewed by: rpaulo Differential Revision: https://reviews.freebsd.org/D978 MFC after: 3 weeks Sponsored by: EMC / Isilon Storage Division Modified: head/share/mk/bsd.dep.mk Modified: head/share/mk/bsd.dep.mk ============================================================================== --- head/share/mk/bsd.dep.mk Tue Oct 21 02:41:40 2014 (r273364) +++ head/share/mk/bsd.dep.mk Tue Oct 21 04:30:00 2014 (r273365) @@ -132,20 +132,17 @@ CFLAGS+= -I${.OBJDIR} DHDRS+= ${_D}.h ${_D}.h: ${_DSRC} ${DTRACE} -xnolibs -h -s ${.ALLSRC} -SRCS:= ${SRCS:S/${_DSRC}/${_D}.h/} +SRCS:= ${SRCS:S/^${_DSRC}$//} OBJS+= ${_D}.o CLEANFILES+= ${_D}.h ${_D}.o -${_D}.o: ${_D}.h ${OBJS:S/${_D}.o//} - ${DTRACE} -xnolibs -G -o ${.TARGET} -s ${.CURDIR}/${_DSRC} \ - ${OBJS:S/${_D}.o//} +${_D}.o: ${_DSRC} ${OBJS:S/^${_D}.o$//} + ${DTRACE} -xnolibs -G -o ${.TARGET} -s ${.ALLSRC} .if defined(LIB) CLEANFILES+= ${_D}.So ${_D}.po -${_D}.So: ${_D}.h ${SOBJS:S/${_D}.So//} - ${DTRACE} -xnolibs -G -o ${.TARGET} -s ${.CURDIR}/${_DSRC} \ - ${SOBJS:S/${_D}.So//} -${_D}.po: ${_D}.h ${POBJS:S/${_D}.po//} - ${DTRACE} -xnolibs -G -o ${.TARGET} -s ${.CURDIR}/${_DSRC} \ - ${POBJS:S/${_D}.po//} +${_D}.So: ${_DSRC} ${SOBJS:S/^${_D}.So$//} + ${DTRACE} -xnolibs -G -o ${.TARGET} -s ${.ALLSRC} +${_D}.po: ${_DSRC} ${POBJS:S/^${_D}.po$//} + ${DTRACE} -xnolibs -G -o ${.TARGET} -s ${.ALLSRC} .endif .endfor .endfor From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 04:48:50 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4D062A7F; Tue, 21 Oct 2014 04:48:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3770CD34; Tue, 21 Oct 2014 04:48:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L4moYO020538; Tue, 21 Oct 2014 04:48:50 GMT (envelope-from yongari@FreeBSD.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L4mobH020536; Tue, 21 Oct 2014 04:48:50 GMT (envelope-from yongari@FreeBSD.org) Message-Id: <201410210448.s9L4mobH020536@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: yongari set sender to yongari@FreeBSD.org using -f From: Pyun YongHyeon Date: Tue, 21 Oct 2014 04:48:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273366 - stable/10/sys/dev/alc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 04:48:50 -0000 Author: yongari Date: Tue Oct 21 04:48:49 2014 New Revision: 273366 URL: https://svnweb.freebsd.org/changeset/base/273366 Log: MFC r272730,273018: Add support for QAC AR816x/AR817x Gigabit/Fast Ethernet controllers. These controllers seem to have the same feature of AR813x/AR815x and improved RSS support(4 TX queues and 8 RX queues). alc(4) supports all hardware features except RSS. I didn't implement RX checksum offloading for AR816x/AR817x just because I couldn't get confirmation from the Vendor whether AR816x/AR817x corrected its predecessor's RX checksum offloading bug on fragmented packets. This change adds supports for the following controllers. o AR8161 PCIe Gigabit Ethernet controller o AR8162 PCIe Fast Ethernet controller o AR8171 PCIe Gigabit Ethernet controller o AR8172 PCIe Fast Ethernet controller o Killer E2200 Gigabit Ethernet controller Relnotes: yes Modified: stable/10/sys/dev/alc/if_alc.c stable/10/sys/dev/alc/if_alcreg.h stable/10/sys/dev/alc/if_alcvar.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/alc/if_alc.c ============================================================================== --- stable/10/sys/dev/alc/if_alc.c Tue Oct 21 04:30:00 2014 (r273365) +++ stable/10/sys/dev/alc/if_alc.c Tue Oct 21 04:48:49 2014 (r273366) @@ -110,17 +110,31 @@ static struct alc_ident alc_ident_table[ "Atheros AR8152 v1.1 PCIe Fast Ethernet" }, { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8152_B2, 6 * 1024, "Atheros AR8152 v2.0 PCIe Fast Ethernet" }, + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8161, 9 * 1024, + "Atheros AR8161 PCIe Gigabit Ethernet" }, + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8162, 9 * 1024, + "Atheros AR8161 PCIe Fast Ethernet" }, + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8171, 9 * 1024, + "Atheros AR8161 PCIe Gigabit Ethernet" }, + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8172, 9 * 1024, + "Atheros AR8161 PCIe Fast Ethernet" }, + { VENDORID_ATHEROS, DEVICEID_ATHEROS_E2200, 9 * 1024, + "Killer E2200 Gigabit Ethernet" }, { 0, 0, 0, NULL} }; -static void alc_aspm(struct alc_softc *, int); +static void alc_aspm(struct alc_softc *, int, int); +static void alc_aspm_813x(struct alc_softc *, int); +static void alc_aspm_816x(struct alc_softc *, int); static int alc_attach(device_t); static int alc_check_boundary(struct alc_softc *); +static void alc_config_msi(struct alc_softc *); static int alc_detach(device_t); static void alc_disable_l0s_l1(struct alc_softc *); static int alc_dma_alloc(struct alc_softc *); static void alc_dma_free(struct alc_softc *); static void alc_dmamap_cb(void *, bus_dma_segment_t *, int, int); +static void alc_dsp_fixup(struct alc_softc *, int); static int alc_encap(struct alc_softc *, struct mbuf **); static struct alc_ident * alc_find_ident(device_t); @@ -129,6 +143,9 @@ static struct mbuf * alc_fixup_rx(struct ifnet *, struct mbuf *); #endif static void alc_get_macaddr(struct alc_softc *); +static void alc_get_macaddr_813x(struct alc_softc *); +static void alc_get_macaddr_816x(struct alc_softc *); +static void alc_get_macaddr_par(struct alc_softc *); static void alc_init(void *); static void alc_init_cmb(struct alc_softc *); static void alc_init_locked(struct alc_softc *); @@ -140,14 +157,26 @@ static void alc_int_task(void *, int); static int alc_intr(void *); static int alc_ioctl(struct ifnet *, u_long, caddr_t); static void alc_mac_config(struct alc_softc *); +static uint32_t alc_mii_readreg_813x(struct alc_softc *, int, int); +static uint32_t alc_mii_readreg_816x(struct alc_softc *, int, int); +static uint32_t alc_mii_writereg_813x(struct alc_softc *, int, int, int); +static uint32_t alc_mii_writereg_816x(struct alc_softc *, int, int, int); static int alc_miibus_readreg(device_t, int, int); static void alc_miibus_statchg(device_t); static int alc_miibus_writereg(device_t, int, int, int); +static uint32_t alc_miidbg_readreg(struct alc_softc *, int); +static uint32_t alc_miidbg_writereg(struct alc_softc *, int, int); +static uint32_t alc_miiext_readreg(struct alc_softc *, int, int); +static uint32_t alc_miiext_writereg(struct alc_softc *, int, int, int); static int alc_mediachange(struct ifnet *); +static int alc_mediachange_locked(struct alc_softc *); static void alc_mediastatus(struct ifnet *, struct ifmediareq *); static int alc_newbuf(struct alc_softc *, struct alc_rxdesc *); +static void alc_osc_reset(struct alc_softc *); static void alc_phy_down(struct alc_softc *); static void alc_phy_reset(struct alc_softc *); +static void alc_phy_reset_813x(struct alc_softc *); +static void alc_phy_reset_816x(struct alc_softc *); static int alc_probe(device_t); static void alc_reset(struct alc_softc *); static int alc_resume(device_t); @@ -157,6 +186,8 @@ static void alc_rxfilter(struct alc_soft static void alc_rxvlan(struct alc_softc *); static void alc_setlinkspeed(struct alc_softc *); static void alc_setwol(struct alc_softc *); +static void alc_setwol_813x(struct alc_softc *); +static void alc_setwol_816x(struct alc_softc *); static int alc_shutdown(device_t); static void alc_start(struct ifnet *); static void alc_start_locked(struct ifnet *); @@ -229,10 +260,21 @@ static int alc_miibus_readreg(device_t dev, int phy, int reg) { struct alc_softc *sc; - uint32_t v; - int i; + int v; sc = device_get_softc(dev); + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0) + v = alc_mii_readreg_816x(sc, phy, reg); + else + v = alc_mii_readreg_813x(sc, phy, reg); + return (v); +} + +static uint32_t +alc_mii_readreg_813x(struct alc_softc *sc, int phy, int reg) +{ + uint32_t v; + int i; /* * For AR8132 fast ethernet controller, do not report 1000baseT @@ -261,14 +303,52 @@ alc_miibus_readreg(device_t dev, int phy return ((v & MDIO_DATA_MASK) >> MDIO_DATA_SHIFT); } +static uint32_t +alc_mii_readreg_816x(struct alc_softc *sc, int phy, int reg) +{ + uint32_t clk, v; + int i; + + if ((sc->alc_flags & ALC_FLAG_LINK) != 0) + clk = MDIO_CLK_25_128; + else + clk = MDIO_CLK_25_4; + CSR_WRITE_4(sc, ALC_MDIO, MDIO_OP_EXECUTE | MDIO_OP_READ | + MDIO_SUP_PREAMBLE | clk | MDIO_REG_ADDR(reg)); + for (i = ALC_PHY_TIMEOUT; i > 0; i--) { + DELAY(5); + v = CSR_READ_4(sc, ALC_MDIO); + if ((v & MDIO_OP_BUSY) == 0) + break; + } + + if (i == 0) { + device_printf(sc->alc_dev, "phy read timeout : %d\n", reg); + return (0); + } + + return ((v & MDIO_DATA_MASK) >> MDIO_DATA_SHIFT); +} + static int alc_miibus_writereg(device_t dev, int phy, int reg, int val) { struct alc_softc *sc; - uint32_t v; - int i; + int v; sc = device_get_softc(dev); + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0) + v = alc_mii_writereg_816x(sc, phy, reg, val); + else + v = alc_mii_writereg_813x(sc, phy, reg, val); + return (v); +} + +static uint32_t +alc_mii_writereg_813x(struct alc_softc *sc, int phy, int reg, int val) +{ + uint32_t v; + int i; CSR_WRITE_4(sc, ALC_MDIO, MDIO_OP_EXECUTE | MDIO_OP_WRITE | (val & MDIO_DATA_MASK) << MDIO_DATA_SHIFT | @@ -286,6 +366,32 @@ alc_miibus_writereg(device_t dev, int ph return (0); } +static uint32_t +alc_mii_writereg_816x(struct alc_softc *sc, int phy, int reg, int val) +{ + uint32_t clk, v; + int i; + + if ((sc->alc_flags & ALC_FLAG_LINK) != 0) + clk = MDIO_CLK_25_128; + else + clk = MDIO_CLK_25_4; + CSR_WRITE_4(sc, ALC_MDIO, MDIO_OP_EXECUTE | MDIO_OP_WRITE | + ((val & MDIO_DATA_MASK) << MDIO_DATA_SHIFT) | MDIO_REG_ADDR(reg) | + MDIO_SUP_PREAMBLE | clk); + for (i = ALC_PHY_TIMEOUT; i > 0; i--) { + DELAY(5); + v = CSR_READ_4(sc, ALC_MDIO); + if ((v & MDIO_OP_BUSY) == 0) + break; + } + + if (i == 0) + device_printf(sc->alc_dev, "phy write timeout : %d\n", reg); + + return (0); +} + static void alc_miibus_statchg(device_t dev) { @@ -318,7 +424,6 @@ alc_miibus_statchg(device_t dev) break; } } - alc_stop_queue(sc); /* Stop Rx/Tx MACs. */ alc_stop_mac(sc); @@ -330,7 +435,159 @@ alc_miibus_statchg(device_t dev) reg = CSR_READ_4(sc, ALC_MAC_CFG); reg |= MAC_CFG_TX_ENB | MAC_CFG_RX_ENB; CSR_WRITE_4(sc, ALC_MAC_CFG, reg); - alc_aspm(sc, IFM_SUBTYPE(mii->mii_media_active)); + } + alc_aspm(sc, 0, IFM_SUBTYPE(mii->mii_media_active)); + alc_dsp_fixup(sc, IFM_SUBTYPE(mii->mii_media_active)); +} + +static uint32_t +alc_miidbg_readreg(struct alc_softc *sc, int reg) +{ + + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, ALC_MII_DBG_ADDR, + reg); + return (alc_miibus_readreg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA)); +} + +static uint32_t +alc_miidbg_writereg(struct alc_softc *sc, int reg, int val) +{ + + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, ALC_MII_DBG_ADDR, + reg); + return (alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA, val)); +} + +static uint32_t +alc_miiext_readreg(struct alc_softc *sc, int devaddr, int reg) +{ + uint32_t clk, v; + int i; + + CSR_WRITE_4(sc, ALC_EXT_MDIO, EXT_MDIO_REG(reg) | + EXT_MDIO_DEVADDR(devaddr)); + if ((sc->alc_flags & ALC_FLAG_LINK) != 0) + clk = MDIO_CLK_25_128; + else + clk = MDIO_CLK_25_4; + CSR_WRITE_4(sc, ALC_MDIO, MDIO_OP_EXECUTE | MDIO_OP_READ | + MDIO_SUP_PREAMBLE | clk | MDIO_MODE_EXT); + for (i = ALC_PHY_TIMEOUT; i > 0; i--) { + DELAY(5); + v = CSR_READ_4(sc, ALC_MDIO); + if ((v & MDIO_OP_BUSY) == 0) + break; + } + + if (i == 0) { + device_printf(sc->alc_dev, "phy ext read timeout : %d, %d\n", + devaddr, reg); + return (0); + } + + return ((v & MDIO_DATA_MASK) >> MDIO_DATA_SHIFT); +} + +static uint32_t +alc_miiext_writereg(struct alc_softc *sc, int devaddr, int reg, int val) +{ + uint32_t clk, v; + int i; + + CSR_WRITE_4(sc, ALC_EXT_MDIO, EXT_MDIO_REG(reg) | + EXT_MDIO_DEVADDR(devaddr)); + if ((sc->alc_flags & ALC_FLAG_LINK) != 0) + clk = MDIO_CLK_25_128; + else + clk = MDIO_CLK_25_4; + CSR_WRITE_4(sc, ALC_MDIO, MDIO_OP_EXECUTE | MDIO_OP_WRITE | + ((val & MDIO_DATA_MASK) << MDIO_DATA_SHIFT) | + MDIO_SUP_PREAMBLE | clk | MDIO_MODE_EXT); + for (i = ALC_PHY_TIMEOUT; i > 0; i--) { + DELAY(5); + v = CSR_READ_4(sc, ALC_MDIO); + if ((v & MDIO_OP_BUSY) == 0) + break; + } + + if (i == 0) + device_printf(sc->alc_dev, "phy ext write timeout : %d, %d\n", + devaddr, reg); + + return (0); +} + +static void +alc_dsp_fixup(struct alc_softc *sc, int media) +{ + uint16_t agc, len, val; + + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0) + return; + if (AR816X_REV(sc->alc_rev) >= AR816X_REV_C0) + return; + + /* + * Vendor PHY magic. + * 1000BT/AZ, wrong cable length + */ + if ((sc->alc_flags & ALC_FLAG_LINK) != 0) { + len = alc_miiext_readreg(sc, MII_EXT_PCS, MII_EXT_CLDCTL6); + len = (len >> EXT_CLDCTL6_CAB_LEN_SHIFT) & + EXT_CLDCTL6_CAB_LEN_MASK; + agc = alc_miidbg_readreg(sc, MII_DBG_AGC); + agc = (agc >> DBG_AGC_2_VGA_SHIFT) & DBG_AGC_2_VGA_MASK; + if ((media == IFM_1000_T && len > EXT_CLDCTL6_CAB_LEN_SHORT1G && + agc > DBG_AGC_LONG1G_LIMT) || + (media == IFM_100_TX && len > DBG_AGC_LONG100M_LIMT && + agc > DBG_AGC_LONG1G_LIMT)) { + alc_miidbg_writereg(sc, MII_DBG_AZ_ANADECT, + DBG_AZ_ANADECT_LONG); + val = alc_miiext_readreg(sc, MII_EXT_ANEG, + MII_EXT_ANEG_AFE); + val |= ANEG_AFEE_10BT_100M_TH; + alc_miiext_writereg(sc, MII_EXT_ANEG, MII_EXT_ANEG_AFE, + val); + } else { + alc_miidbg_writereg(sc, MII_DBG_AZ_ANADECT, + DBG_AZ_ANADECT_DEFAULT); + val = alc_miiext_readreg(sc, MII_EXT_ANEG, + MII_EXT_ANEG_AFE); + val &= ~ANEG_AFEE_10BT_100M_TH; + alc_miiext_writereg(sc, MII_EXT_ANEG, MII_EXT_ANEG_AFE, + val); + } + if ((sc->alc_flags & ALC_FLAG_LINK_WAR) != 0 && + AR816X_REV(sc->alc_rev) == AR816X_REV_B0) { + if (media == IFM_1000_T) { + /* + * Giga link threshold, raise the tolerance of + * noise 50%. + */ + val = alc_miidbg_readreg(sc, MII_DBG_MSE20DB); + val &= ~DBG_MSE20DB_TH_MASK; + val |= (DBG_MSE20DB_TH_HI << + DBG_MSE20DB_TH_SHIFT); + alc_miidbg_writereg(sc, MII_DBG_MSE20DB, val); + } else if (media == IFM_100_TX) + alc_miidbg_writereg(sc, MII_DBG_MSE16DB, + DBG_MSE16DB_UP); + } + } else { + val = alc_miiext_readreg(sc, MII_EXT_ANEG, MII_EXT_ANEG_AFE); + val &= ~ANEG_AFEE_10BT_100M_TH; + alc_miiext_writereg(sc, MII_EXT_ANEG, MII_EXT_ANEG_AFE, val); + if ((sc->alc_flags & ALC_FLAG_LINK_WAR) != 0 && + AR816X_REV(sc->alc_rev) == AR816X_REV_B0) { + alc_miidbg_writereg(sc, MII_DBG_MSE16DB, + DBG_MSE16DB_DOWN); + val = alc_miidbg_readreg(sc, MII_DBG_MSE20DB); + val &= ~DBG_MSE20DB_TH_MASK; + val |= (DBG_MSE20DB_TH_DEFAULT << DBG_MSE20DB_TH_SHIFT); + alc_miidbg_writereg(sc, MII_DBG_MSE20DB, val); + } } } @@ -358,17 +615,29 @@ static int alc_mediachange(struct ifnet *ifp) { struct alc_softc *sc; - struct mii_data *mii; - struct mii_softc *miisc; int error; sc = ifp->if_softc; ALC_LOCK(sc); + error = alc_mediachange_locked(sc); + ALC_UNLOCK(sc); + + return (error); +} + +static int +alc_mediachange_locked(struct alc_softc *sc) +{ + struct mii_data *mii; + struct mii_softc *miisc; + int error; + + ALC_LOCK_ASSERT(sc); + mii = device_get_softc(sc->alc_miibus); LIST_FOREACH(miisc, &mii->mii_phys, mii_list) PHY_RESET(miisc); error = mii_mediachg(mii); - ALC_UNLOCK(sc); return (error); } @@ -406,7 +675,17 @@ alc_probe(device_t dev) static void alc_get_macaddr(struct alc_softc *sc) { - uint32_t ea[2], opt; + + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0) + alc_get_macaddr_816x(sc); + else + alc_get_macaddr_813x(sc); +} + +static void +alc_get_macaddr_813x(struct alc_softc *sc) +{ + uint32_t opt; uint16_t val; int eeprom, i; @@ -501,6 +780,73 @@ alc_get_macaddr(struct alc_softc *sc) } } + alc_get_macaddr_par(sc); +} + +static void +alc_get_macaddr_816x(struct alc_softc *sc) +{ + uint32_t reg; + int i, reloaded; + + reloaded = 0; + /* Try to reload station address via TWSI. */ + for (i = 100; i > 0; i--) { + reg = CSR_READ_4(sc, ALC_SLD); + if ((reg & (SLD_PROGRESS | SLD_START)) == 0) + break; + DELAY(1000); + } + if (i != 0) { + CSR_WRITE_4(sc, ALC_SLD, reg | SLD_START); + for (i = 100; i > 0; i--) { + DELAY(1000); + reg = CSR_READ_4(sc, ALC_SLD); + if ((reg & SLD_START) == 0) + break; + } + if (i != 0) + reloaded++; + else if (bootverbose) + device_printf(sc->alc_dev, + "reloading station address via TWSI timed out!\n"); + } + + /* Try to reload station address from EEPROM or FLASH. */ + if (reloaded == 0) { + reg = CSR_READ_4(sc, ALC_EEPROM_LD); + if ((reg & (EEPROM_LD_EEPROM_EXIST | + EEPROM_LD_FLASH_EXIST)) != 0) { + for (i = 100; i > 0; i--) { + reg = CSR_READ_4(sc, ALC_EEPROM_LD); + if ((reg & (EEPROM_LD_PROGRESS | + EEPROM_LD_START)) == 0) + break; + DELAY(1000); + } + if (i != 0) { + CSR_WRITE_4(sc, ALC_EEPROM_LD, reg | + EEPROM_LD_START); + for (i = 100; i > 0; i--) { + DELAY(1000); + reg = CSR_READ_4(sc, ALC_EEPROM_LD); + if ((reg & EEPROM_LD_START) == 0) + break; + } + } else if (bootverbose) + device_printf(sc->alc_dev, + "reloading EEPROM/FLASH timed out!\n"); + } + } + + alc_get_macaddr_par(sc); +} + +static void +alc_get_macaddr_par(struct alc_softc *sc) +{ + uint32_t ea[2]; + ea[0] = CSR_READ_4(sc, ALC_PAR0); ea[1] = CSR_READ_4(sc, ALC_PAR1); sc->alc_eaddr[0] = (ea[1] >> 8) & 0xFF; @@ -516,19 +862,31 @@ alc_disable_l0s_l1(struct alc_softc *sc) { uint32_t pmcfg; - /* Another magic from vendor. */ - pmcfg = CSR_READ_4(sc, ALC_PM_CFG); - pmcfg &= ~(PM_CFG_L1_ENTRY_TIMER_MASK | PM_CFG_CLK_SWH_L1 | - PM_CFG_ASPM_L0S_ENB | PM_CFG_ASPM_L1_ENB | PM_CFG_MAC_ASPM_CHK | - PM_CFG_SERDES_PD_EX_L1); - pmcfg |= PM_CFG_SERDES_BUDS_RX_L1_ENB | PM_CFG_SERDES_PLL_L1_ENB | - PM_CFG_SERDES_L1_ENB; - CSR_WRITE_4(sc, ALC_PM_CFG, pmcfg); + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) == 0) { + /* Another magic from vendor. */ + pmcfg = CSR_READ_4(sc, ALC_PM_CFG); + pmcfg &= ~(PM_CFG_L1_ENTRY_TIMER_MASK | PM_CFG_CLK_SWH_L1 | + PM_CFG_ASPM_L0S_ENB | PM_CFG_ASPM_L1_ENB | + PM_CFG_MAC_ASPM_CHK | PM_CFG_SERDES_PD_EX_L1); + pmcfg |= PM_CFG_SERDES_BUDS_RX_L1_ENB | + PM_CFG_SERDES_PLL_L1_ENB | PM_CFG_SERDES_L1_ENB; + CSR_WRITE_4(sc, ALC_PM_CFG, pmcfg); + } } static void alc_phy_reset(struct alc_softc *sc) { + + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0) + alc_phy_reset_816x(sc); + else + alc_phy_reset_813x(sc); +} + +static void +alc_phy_reset_813x(struct alc_softc *sc) +{ uint16_t data; /* Reset magic from Linux. */ @@ -641,12 +999,101 @@ alc_phy_reset(struct alc_softc *sc) } static void +alc_phy_reset_816x(struct alc_softc *sc) +{ + uint32_t val; + + val = CSR_READ_4(sc, ALC_GPHY_CFG); + val &= ~(GPHY_CFG_EXT_RESET | GPHY_CFG_LED_MODE | + GPHY_CFG_GATE_25M_ENB | GPHY_CFG_PHY_IDDQ | GPHY_CFG_PHY_PLL_ON | + GPHY_CFG_PWDOWN_HW | GPHY_CFG_100AB_ENB); + val |= GPHY_CFG_SEL_ANA_RESET; +#ifdef notyet + val |= GPHY_CFG_HIB_PULSE | GPHY_CFG_HIB_EN | GPHY_CFG_SEL_ANA_RESET; +#else + /* Disable PHY hibernation. */ + val &= ~(GPHY_CFG_HIB_PULSE | GPHY_CFG_HIB_EN); +#endif + CSR_WRITE_4(sc, ALC_GPHY_CFG, val); + DELAY(10); + CSR_WRITE_4(sc, ALC_GPHY_CFG, val | GPHY_CFG_EXT_RESET); + DELAY(800); + + /* Vendor PHY magic. */ +#ifdef notyet + alc_miidbg_writereg(sc, MII_DBG_LEGCYPS, DBG_LEGCYPS_DEFAULT); + alc_miidbg_writereg(sc, MII_DBG_SYSMODCTL, DBG_SYSMODCTL_DEFAULT); + alc_miiext_writereg(sc, MII_EXT_PCS, MII_EXT_VDRVBIAS, + EXT_VDRVBIAS_DEFAULT); +#else + /* Disable PHY hibernation. */ + alc_miidbg_writereg(sc, MII_DBG_LEGCYPS, + DBG_LEGCYPS_DEFAULT & ~DBG_LEGCYPS_ENB); + alc_miidbg_writereg(sc, MII_DBG_HIBNEG, + DBG_HIBNEG_DEFAULT & ~(DBG_HIBNEG_PSHIB_EN | DBG_HIBNEG_HIB_PULSE)); + alc_miidbg_writereg(sc, MII_DBG_GREENCFG, DBG_GREENCFG_DEFAULT); +#endif + + /* XXX Disable EEE. */ + val = CSR_READ_4(sc, ALC_LPI_CTL); + val &= ~LPI_CTL_ENB; + CSR_WRITE_4(sc, ALC_LPI_CTL, val); + alc_miiext_writereg(sc, MII_EXT_ANEG, MII_EXT_ANEG_LOCAL_EEEADV, 0); + + /* PHY power saving. */ + alc_miidbg_writereg(sc, MII_DBG_TST10BTCFG, DBG_TST10BTCFG_DEFAULT); + alc_miidbg_writereg(sc, MII_DBG_SRDSYSMOD, DBG_SRDSYSMOD_DEFAULT); + alc_miidbg_writereg(sc, MII_DBG_TST100BTCFG, DBG_TST100BTCFG_DEFAULT); + alc_miidbg_writereg(sc, MII_DBG_ANACTL, DBG_ANACTL_DEFAULT); + val = alc_miidbg_readreg(sc, MII_DBG_GREENCFG2); + val &= ~DBG_GREENCFG2_GATE_DFSE_EN; + alc_miidbg_writereg(sc, MII_DBG_GREENCFG2, val); + + /* RTL8139C, 120m issue. */ + alc_miiext_writereg(sc, MII_EXT_ANEG, MII_EXT_ANEG_NLP78, + ANEG_NLP78_120M_DEFAULT); + alc_miiext_writereg(sc, MII_EXT_ANEG, MII_EXT_ANEG_S3DIG10, + ANEG_S3DIG10_DEFAULT); + + if ((sc->alc_flags & ALC_FLAG_LINK_WAR) != 0) { + /* Turn off half amplitude. */ + val = alc_miiext_readreg(sc, MII_EXT_PCS, MII_EXT_CLDCTL3); + val |= EXT_CLDCTL3_BP_CABLE1TH_DET_GT; + alc_miiext_writereg(sc, MII_EXT_PCS, MII_EXT_CLDCTL3, val); + /* Turn off Green feature. */ + val = alc_miidbg_readreg(sc, MII_DBG_GREENCFG2); + val |= DBG_GREENCFG2_BP_GREEN; + alc_miidbg_writereg(sc, MII_DBG_GREENCFG2, val); + /* Turn off half bias. */ + val = alc_miiext_readreg(sc, MII_EXT_PCS, MII_EXT_CLDCTL5); + val |= EXT_CLDCTL5_BP_VD_HLFBIAS; + alc_miiext_writereg(sc, MII_EXT_PCS, MII_EXT_CLDCTL5, val); + } +} + +static void alc_phy_down(struct alc_softc *sc) { + uint32_t gphy; switch (sc->alc_ident->deviceid) { + case DEVICEID_ATHEROS_AR8161: + case DEVICEID_ATHEROS_E2200: + case DEVICEID_ATHEROS_AR8162: + case DEVICEID_ATHEROS_AR8171: + case DEVICEID_ATHEROS_AR8172: + gphy = CSR_READ_4(sc, ALC_GPHY_CFG); + gphy &= ~(GPHY_CFG_EXT_RESET | GPHY_CFG_LED_MODE | + GPHY_CFG_100AB_ENB | GPHY_CFG_PHY_PLL_ON); + gphy |= GPHY_CFG_HIB_EN | GPHY_CFG_HIB_PULSE | + GPHY_CFG_SEL_ANA_RESET; + gphy |= GPHY_CFG_PHY_IDDQ | GPHY_CFG_PWDOWN_HW; + CSR_WRITE_4(sc, ALC_GPHY_CFG, gphy); + break; case DEVICEID_ATHEROS_AR8151: case DEVICEID_ATHEROS_AR8151_V2: + case DEVICEID_ATHEROS_AR8152_B: + case DEVICEID_ATHEROS_AR8152_B2: /* * GPHY power down caused more problems on AR8151 v2.0. * When driver is reloaded after GPHY power down, @@ -672,12 +1119,23 @@ alc_phy_down(struct alc_softc *sc) } static void -alc_aspm(struct alc_softc *sc, int media) +alc_aspm(struct alc_softc *sc, int init, int media) +{ + + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0) + alc_aspm_816x(sc, init); + else + alc_aspm_813x(sc, media); +} + +static void +alc_aspm_813x(struct alc_softc *sc, int media) { uint32_t pmcfg; uint16_t linkcfg; - ALC_LOCK_ASSERT(sc); + if ((sc->alc_flags & ALC_FLAG_LINK) == 0) + return; pmcfg = CSR_READ_4(sc, ALC_PM_CFG); if ((sc->alc_flags & (ALC_FLAG_APS | ALC_FLAG_PCIE)) == @@ -758,71 +1216,61 @@ alc_aspm(struct alc_softc *sc, int media CSR_WRITE_4(sc, ALC_PM_CFG, pmcfg); } -static int -alc_attach(device_t dev) +static void +alc_aspm_816x(struct alc_softc *sc, int init) { - struct alc_softc *sc; - struct ifnet *ifp; - char *aspm_state[] = { "L0s/L1", "L0s", "L1", "L0s/L1" }; - uint16_t burst; - int base, error, i, msic, msixc, state; - uint32_t cap, ctl, val; - - error = 0; - sc = device_get_softc(dev); - sc->alc_dev = dev; - - mtx_init(&sc->alc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, - MTX_DEF); - callout_init_mtx(&sc->alc_tick_ch, &sc->alc_mtx, 0); - TASK_INIT(&sc->alc_int_task, 0, alc_int_task, sc); - sc->alc_ident = alc_find_ident(dev); + uint32_t pmcfg; - /* Map the device. */ - pci_enable_busmaster(dev); - sc->alc_res_spec = alc_res_spec_mem; - sc->alc_irq_spec = alc_irq_spec_legacy; - error = bus_alloc_resources(dev, sc->alc_res_spec, sc->alc_res); - if (error != 0) { - device_printf(dev, "cannot allocate memory resources.\n"); - goto fail; + pmcfg = CSR_READ_4(sc, ALC_PM_CFG); + pmcfg &= ~PM_CFG_L1_ENTRY_TIMER_816X_MASK; + pmcfg |= PM_CFG_L1_ENTRY_TIMER_816X_DEFAULT; + pmcfg &= ~PM_CFG_PM_REQ_TIMER_MASK; + pmcfg |= PM_CFG_PM_REQ_TIMER_816X_DEFAULT; + pmcfg &= ~PM_CFG_LCKDET_TIMER_MASK; + pmcfg |= PM_CFG_LCKDET_TIMER_DEFAULT; + pmcfg |= PM_CFG_SERDES_PD_EX_L1 | PM_CFG_CLK_SWH_L1 | PM_CFG_PCIE_RECV; + pmcfg &= ~(PM_CFG_RX_L1_AFTER_L0S | PM_CFG_TX_L1_AFTER_L0S | + PM_CFG_ASPM_L1_ENB | PM_CFG_ASPM_L0S_ENB | + PM_CFG_SERDES_L1_ENB | PM_CFG_SERDES_PLL_L1_ENB | + PM_CFG_SERDES_BUDS_RX_L1_ENB | PM_CFG_SA_DLY_ENB | + PM_CFG_MAC_ASPM_CHK | PM_CFG_HOTRST); + if (AR816X_REV(sc->alc_rev) <= AR816X_REV_A1 && + (sc->alc_rev & 0x01) != 0) + pmcfg |= PM_CFG_SERDES_L1_ENB | PM_CFG_SERDES_PLL_L1_ENB; + if ((sc->alc_flags & ALC_FLAG_LINK) != 0) { + /* Link up, enable both L0s, L1s. */ + pmcfg |= PM_CFG_ASPM_L0S_ENB | PM_CFG_ASPM_L1_ENB | + PM_CFG_MAC_ASPM_CHK; + } else { + if (init != 0) + pmcfg |= PM_CFG_ASPM_L0S_ENB | PM_CFG_ASPM_L1_ENB | + PM_CFG_MAC_ASPM_CHK; + else if ((sc->alc_ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + pmcfg |= PM_CFG_ASPM_L1_ENB | PM_CFG_MAC_ASPM_CHK; } + CSR_WRITE_4(sc, ALC_PM_CFG, pmcfg); +} - /* Set PHY address. */ - sc->alc_phyaddr = ALC_PHY_ADDR; +static void +alc_init_pcie(struct alc_softc *sc) +{ + const char *aspm_state[] = { "L0s/L1", "L0s", "L1", "L0s/L1" }; + uint32_t cap, ctl, val; + int state; - /* Initialize DMA parameters. */ - sc->alc_dma_rd_burst = 0; - sc->alc_dma_wr_burst = 0; - sc->alc_rcb = DMA_CFG_RCB_64; - if (pci_find_cap(dev, PCIY_EXPRESS, &base) == 0) { - sc->alc_flags |= ALC_FLAG_PCIE; - sc->alc_expcap = base; - burst = CSR_READ_2(sc, base + PCIER_DEVICE_CTL); - sc->alc_dma_rd_burst = - (burst & PCIEM_CTL_MAX_READ_REQUEST) >> 12; - sc->alc_dma_wr_burst = (burst & PCIEM_CTL_MAX_PAYLOAD) >> 5; - if (bootverbose) { - device_printf(dev, "Read request size : %u bytes.\n", - alc_dma_burst[sc->alc_dma_rd_burst]); - device_printf(dev, "TLP payload size : %u bytes.\n", - alc_dma_burst[sc->alc_dma_wr_burst]); - } - if (alc_dma_burst[sc->alc_dma_rd_burst] > 1024) - sc->alc_dma_rd_burst = 3; - if (alc_dma_burst[sc->alc_dma_wr_burst] > 1024) - sc->alc_dma_wr_burst = 3; - /* Clear data link and flow-control protocol error. */ - val = CSR_READ_4(sc, ALC_PEX_UNC_ERR_SEV); - val &= ~(PEX_UNC_ERR_SEV_DLP | PEX_UNC_ERR_SEV_FCP); - CSR_WRITE_4(sc, ALC_PEX_UNC_ERR_SEV, val); + /* Clear data link and flow-control protocol error. */ + val = CSR_READ_4(sc, ALC_PEX_UNC_ERR_SEV); + val &= ~(PEX_UNC_ERR_SEV_DLP | PEX_UNC_ERR_SEV_FCP); + CSR_WRITE_4(sc, ALC_PEX_UNC_ERR_SEV, val); + + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) == 0) { CSR_WRITE_4(sc, ALC_LTSSM_ID_CFG, CSR_READ_4(sc, ALC_LTSSM_ID_CFG) & ~LTSSM_ID_WRO_ENB); CSR_WRITE_4(sc, ALC_PCIE_PHYMISC, CSR_READ_4(sc, ALC_PCIE_PHYMISC) | PCIE_PHYMISC_FORCE_RCV_DET); if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B && - pci_get_revid(dev) == ATHEROS_AR8152_B_V10) { + sc->alc_rev == ATHEROS_AR8152_B_V10) { val = CSR_READ_4(sc, ALC_PCIE_PHYMISC2); val &= ~(PCIE_PHYMISC2_SERDES_CDR_MASK | PCIE_PHYMISC2_SERDES_TH_MASK); @@ -831,13 +1279,13 @@ alc_attach(device_t dev) CSR_WRITE_4(sc, ALC_PCIE_PHYMISC2, val); } /* Disable ASPM L0S and L1. */ - cap = CSR_READ_2(sc, base + PCIER_LINK_CAP); + cap = CSR_READ_2(sc, sc->alc_expcap + PCIER_LINK_CAP); if ((cap & PCIEM_LINK_CAP_ASPM) != 0) { - ctl = CSR_READ_2(sc, base + PCIER_LINK_CTL); + ctl = CSR_READ_2(sc, sc->alc_expcap + PCIER_LINK_CTL); if ((ctl & PCIEM_LINK_CTL_RCB) != 0) sc->alc_rcb = DMA_CFG_RCB_128; if (bootverbose) - device_printf(dev, "RCB %u bytes\n", + device_printf(sc->alc_dev, "RCB %u bytes\n", sc->alc_rcb == DMA_CFG_RCB_64 ? 64 : 128); state = ctl & PCIEM_LINK_CTL_ASPMC; if (state & PCIEM_LINK_CTL_ASPMC_L0S) @@ -854,13 +1302,91 @@ alc_attach(device_t dev) device_printf(sc->alc_dev, "no ASPM support\n"); } + } else { + val = CSR_READ_4(sc, ALC_PDLL_TRNS1); + val &= ~PDLL_TRNS1_D3PLLOFF_ENB; + CSR_WRITE_4(sc, ALC_PDLL_TRNS1, val); + val = CSR_READ_4(sc, ALC_MASTER_CFG); + if (AR816X_REV(sc->alc_rev) <= AR816X_REV_A1 && + (sc->alc_rev & 0x01) != 0) { + if ((val & MASTER_WAKEN_25M) == 0 || + (val & MASTER_CLK_SEL_DIS) == 0) { + val |= MASTER_WAKEN_25M | MASTER_CLK_SEL_DIS; + CSR_WRITE_4(sc, ALC_MASTER_CFG, val); + } + } else { + if ((val & MASTER_WAKEN_25M) == 0 || + (val & MASTER_CLK_SEL_DIS) != 0) { + val |= MASTER_WAKEN_25M; + val &= ~MASTER_CLK_SEL_DIS; + CSR_WRITE_4(sc, ALC_MASTER_CFG, val); + } + } } + alc_aspm(sc, 1, IFM_UNKNOWN); +} - /* Reset PHY. */ - alc_phy_reset(sc); +static void +alc_config_msi(struct alc_softc *sc) +{ + uint32_t ctl, mod; - /* Reset the ethernet controller. */ - alc_reset(sc); + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0) { + /* + * It seems interrupt moderation is controlled by + * ALC_MSI_RETRANS_TIMER register if MSI/MSIX is active. + * Driver uses RX interrupt moderation parameter to + * program ALC_MSI_RETRANS_TIMER register. + */ + ctl = CSR_READ_4(sc, ALC_MSI_RETRANS_TIMER); + ctl &= ~MSI_RETRANS_TIMER_MASK; + ctl &= ~MSI_RETRANS_MASK_SEL_LINE; + mod = ALC_USECS(sc->alc_int_rx_mod); + if (mod == 0) + mod = 1; + ctl |= mod; + if ((sc->alc_flags & ALC_FLAG_MSIX) != 0) + CSR_WRITE_4(sc, ALC_MSI_RETRANS_TIMER, ctl | + MSI_RETRANS_MASK_SEL_STD); + else if ((sc->alc_flags & ALC_FLAG_MSI) != 0) + CSR_WRITE_4(sc, ALC_MSI_RETRANS_TIMER, ctl | + MSI_RETRANS_MASK_SEL_LINE); + else + CSR_WRITE_4(sc, ALC_MSI_RETRANS_TIMER, 0); + } +} + +static int +alc_attach(device_t dev) +{ + struct alc_softc *sc; + struct ifnet *ifp; + int base, error, i, msic, msixc; + uint16_t burst; + + error = 0; + sc = device_get_softc(dev); + sc->alc_dev = dev; + sc->alc_rev = pci_get_revid(dev); + + mtx_init(&sc->alc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, + MTX_DEF); + callout_init_mtx(&sc->alc_tick_ch, &sc->alc_mtx, 0); + TASK_INIT(&sc->alc_int_task, 0, alc_int_task, sc); + sc->alc_ident = alc_find_ident(dev); + + /* Map the device. */ + pci_enable_busmaster(dev); + sc->alc_res_spec = alc_res_spec_mem; + sc->alc_irq_spec = alc_irq_spec_legacy; + error = bus_alloc_resources(dev, sc->alc_res_spec, sc->alc_res); + if (error != 0) { + device_printf(dev, "cannot allocate memory resources.\n"); + goto fail; + } + + /* Set PHY address. */ + sc->alc_phyaddr = ALC_PHY_ADDR; /* * One odd thing is AR8132 uses the same PHY hardware(F1 @@ -870,6 +1396,19 @@ alc_attach(device_t dev) * shows the same PHY model/revision number of AR8131. */ switch (sc->alc_ident->deviceid) { + case DEVICEID_ATHEROS_AR8161: + if (pci_get_subvendor(dev) == VENDORID_ATHEROS && + pci_get_subdevice(dev) == 0x0091 && sc->alc_rev == 0) + sc->alc_flags |= ALC_FLAG_LINK_WAR; + /* FALLTHROUGH */ + case DEVICEID_ATHEROS_E2200: + case DEVICEID_ATHEROS_AR8171: + sc->alc_flags |= ALC_FLAG_AR816X_FAMILY; + break; + case DEVICEID_ATHEROS_AR8162: + case DEVICEID_ATHEROS_AR8172: + sc->alc_flags |= ALC_FLAG_FASTETHER | ALC_FLAG_AR816X_FAMILY; + break; case DEVICEID_ATHEROS_AR8152_B: case DEVICEID_ATHEROS_AR8152_B2: sc->alc_flags |= ALC_FLAG_APS; @@ -884,7 +1423,7 @@ alc_attach(device_t dev) default: break; } - sc->alc_flags |= ALC_FLAG_ASPM_MON | ALC_FLAG_JUMBO; + sc->alc_flags |= ALC_FLAG_JUMBO; /* * It seems that AR813x/AR815x has silicon bug for SMB. In @@ -897,7 +1436,6 @@ alc_attach(device_t dev) * Don't use Tx CMB. It is known to have silicon bug. */ sc->alc_flags |= ALC_FLAG_CMB_BUG; - sc->alc_rev = pci_get_revid(dev); sc->alc_chip_rev = CSR_READ_4(sc, ALC_MASTER_CFG) >> MASTER_CHIP_REV_SHIFT; if (bootverbose) { @@ -905,11 +1443,45 @@ alc_attach(device_t dev) sc->alc_rev); device_printf(dev, "Chip id/revision : 0x%04x\n", sc->alc_chip_rev); + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0) + device_printf(dev, "AR816x revision : 0x%x\n", + AR816X_REV(sc->alc_rev)); } device_printf(dev, "%u Tx FIFO, %u Rx FIFO\n", CSR_READ_4(sc, ALC_SRAM_TX_FIFO_LEN) * 8, CSR_READ_4(sc, ALC_SRAM_RX_FIFO_LEN) * 8); + /* Initialize DMA parameters. */ + sc->alc_dma_rd_burst = 0; + sc->alc_dma_wr_burst = 0; + sc->alc_rcb = DMA_CFG_RCB_64; + if (pci_find_cap(dev, PCIY_EXPRESS, &base) == 0) { + sc->alc_flags |= ALC_FLAG_PCIE; + sc->alc_expcap = base; + burst = CSR_READ_2(sc, base + PCIER_DEVICE_CTL); + sc->alc_dma_rd_burst = + (burst & PCIEM_CTL_MAX_READ_REQUEST) >> 12; + sc->alc_dma_wr_burst = (burst & PCIEM_CTL_MAX_PAYLOAD) >> 5; + if (bootverbose) { + device_printf(dev, "Read request size : %u bytes.\n", + alc_dma_burst[sc->alc_dma_rd_burst]); + device_printf(dev, "TLP payload size : %u bytes.\n", + alc_dma_burst[sc->alc_dma_wr_burst]); + } + if (alc_dma_burst[sc->alc_dma_rd_burst] > 1024) + sc->alc_dma_rd_burst = 3; + if (alc_dma_burst[sc->alc_dma_wr_burst] > 1024) + sc->alc_dma_wr_burst = 3; + alc_init_pcie(sc); + } + + /* Reset PHY. */ + alc_phy_reset(sc); + + /* Reset the ethernet controller. */ + alc_stop_mac(sc); + alc_reset(sc); + /* Allocate IRQ resources. */ msixc = pci_msix_count(dev); msic = pci_msi_count(dev); @@ -917,11 +1489,20 @@ alc_attach(device_t dev) device_printf(dev, "MSIX count : %d\n", msixc); device_printf(dev, "MSI count : %d\n", msic); } - /* Prefer MSIX over MSI. */ + if (msixc > 1) + msixc = 1; + if (msic > 1) + msic = 1; + /* + * Prefer MSIX over MSI. + * AR816x controller has a silicon bug that MSI interrupt + * does not assert if PCIM_CMD_INTxDIS bit of command + * register is set. pci(4) was taught to handle that case. + */ if (msix_disable == 0 || msi_disable == 0) { - if (msix_disable == 0 && msixc == ALC_MSIX_MESSAGES && + if (msix_disable == 0 && msixc > 0 && pci_alloc_msix(dev, &msixc) == 0) { - if (msic == ALC_MSIX_MESSAGES) { + if (msic == 1) { device_printf(dev, "Using %d MSIX message(s).\n", msixc); sc->alc_flags |= ALC_FLAG_MSIX; @@ -930,9 +1511,8 @@ alc_attach(device_t dev) pci_release_msi(dev); } if (msi_disable == 0 && (sc->alc_flags & ALC_FLAG_MSIX) == 0 && - msic == ALC_MSI_MESSAGES && - pci_alloc_msi(dev, &msic) == 0) { - if (msic == ALC_MSI_MESSAGES) { + msic > 0 && pci_alloc_msi(dev, &msic) == 0) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 04:50:08 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 129BCBBE; Tue, 21 Oct 2014 04:50:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F1085D40; Tue, 21 Oct 2014 04:50:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L4o7aC022656; Tue, 21 Oct 2014 04:50:07 GMT (envelope-from yongari@FreeBSD.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L4o7oM022654; Tue, 21 Oct 2014 04:50:07 GMT (envelope-from yongari@FreeBSD.org) Message-Id: <201410210450.s9L4o7oM022654@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: yongari set sender to yongari@FreeBSD.org using -f From: Pyun YongHyeon Date: Tue, 21 Oct 2014 04:50:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r273367 - stable/9/sys/dev/alc X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 04:50:08 -0000 Author: yongari Date: Tue Oct 21 04:50:07 2014 New Revision: 273367 URL: https://svnweb.freebsd.org/changeset/base/273367 Log: MFC r272730,273018: Add support for QAC AR816x/AR817x Gigabit/Fast Ethernet controllers. These controllers seem to have the same feature of AR813x/AR815x and improved RSS support(4 TX queues and 8 RX queues). alc(4) supports all hardware features except RSS. I didn't implement RX checksum offloading for AR816x/AR817x just because I couldn't get confirmation from the Vendor whether AR816x/AR817x corrected its predecessor's RX checksum offloading bug on fragmented packets. This change adds supports for the following controllers. o AR8161 PCIe Gigabit Ethernet controller o AR8162 PCIe Fast Ethernet controller o AR8171 PCIe Gigabit Ethernet controller o AR8172 PCIe Fast Ethernet controller o Killer E2200 Gigabit Ethernet controller Modified: stable/9/sys/dev/alc/if_alc.c stable/9/sys/dev/alc/if_alcreg.h stable/9/sys/dev/alc/if_alcvar.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/alc/if_alc.c ============================================================================== --- stable/9/sys/dev/alc/if_alc.c Tue Oct 21 04:48:49 2014 (r273366) +++ stable/9/sys/dev/alc/if_alc.c Tue Oct 21 04:50:07 2014 (r273367) @@ -110,17 +110,31 @@ static struct alc_ident alc_ident_table[ "Atheros AR8152 v1.1 PCIe Fast Ethernet" }, { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8152_B2, 6 * 1024, "Atheros AR8152 v2.0 PCIe Fast Ethernet" }, + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8161, 9 * 1024, + "Atheros AR8161 PCIe Gigabit Ethernet" }, + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8162, 9 * 1024, + "Atheros AR8161 PCIe Fast Ethernet" }, + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8171, 9 * 1024, + "Atheros AR8161 PCIe Gigabit Ethernet" }, + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8172, 9 * 1024, + "Atheros AR8161 PCIe Fast Ethernet" }, + { VENDORID_ATHEROS, DEVICEID_ATHEROS_E2200, 9 * 1024, + "Killer E2200 Gigabit Ethernet" }, { 0, 0, 0, NULL} }; -static void alc_aspm(struct alc_softc *, int); +static void alc_aspm(struct alc_softc *, int, int); +static void alc_aspm_813x(struct alc_softc *, int); +static void alc_aspm_816x(struct alc_softc *, int); static int alc_attach(device_t); static int alc_check_boundary(struct alc_softc *); +static void alc_config_msi(struct alc_softc *); static int alc_detach(device_t); static void alc_disable_l0s_l1(struct alc_softc *); static int alc_dma_alloc(struct alc_softc *); static void alc_dma_free(struct alc_softc *); static void alc_dmamap_cb(void *, bus_dma_segment_t *, int, int); +static void alc_dsp_fixup(struct alc_softc *, int); static int alc_encap(struct alc_softc *, struct mbuf **); static struct alc_ident * alc_find_ident(device_t); @@ -129,6 +143,9 @@ static struct mbuf * alc_fixup_rx(struct ifnet *, struct mbuf *); #endif static void alc_get_macaddr(struct alc_softc *); +static void alc_get_macaddr_813x(struct alc_softc *); +static void alc_get_macaddr_816x(struct alc_softc *); +static void alc_get_macaddr_par(struct alc_softc *); static void alc_init(void *); static void alc_init_cmb(struct alc_softc *); static void alc_init_locked(struct alc_softc *); @@ -140,14 +157,26 @@ static void alc_int_task(void *, int); static int alc_intr(void *); static int alc_ioctl(struct ifnet *, u_long, caddr_t); static void alc_mac_config(struct alc_softc *); +static uint32_t alc_mii_readreg_813x(struct alc_softc *, int, int); +static uint32_t alc_mii_readreg_816x(struct alc_softc *, int, int); +static uint32_t alc_mii_writereg_813x(struct alc_softc *, int, int, int); +static uint32_t alc_mii_writereg_816x(struct alc_softc *, int, int, int); static int alc_miibus_readreg(device_t, int, int); static void alc_miibus_statchg(device_t); static int alc_miibus_writereg(device_t, int, int, int); +static uint32_t alc_miidbg_readreg(struct alc_softc *, int); +static uint32_t alc_miidbg_writereg(struct alc_softc *, int, int); +static uint32_t alc_miiext_readreg(struct alc_softc *, int, int); +static uint32_t alc_miiext_writereg(struct alc_softc *, int, int, int); static int alc_mediachange(struct ifnet *); +static int alc_mediachange_locked(struct alc_softc *); static void alc_mediastatus(struct ifnet *, struct ifmediareq *); static int alc_newbuf(struct alc_softc *, struct alc_rxdesc *); +static void alc_osc_reset(struct alc_softc *); static void alc_phy_down(struct alc_softc *); static void alc_phy_reset(struct alc_softc *); +static void alc_phy_reset_813x(struct alc_softc *); +static void alc_phy_reset_816x(struct alc_softc *); static int alc_probe(device_t); static void alc_reset(struct alc_softc *); static int alc_resume(device_t); @@ -157,6 +186,8 @@ static void alc_rxfilter(struct alc_soft static void alc_rxvlan(struct alc_softc *); static void alc_setlinkspeed(struct alc_softc *); static void alc_setwol(struct alc_softc *); +static void alc_setwol_813x(struct alc_softc *); +static void alc_setwol_816x(struct alc_softc *); static int alc_shutdown(device_t); static void alc_start(struct ifnet *); static void alc_start_locked(struct ifnet *); @@ -229,10 +260,21 @@ static int alc_miibus_readreg(device_t dev, int phy, int reg) { struct alc_softc *sc; - uint32_t v; - int i; + int v; sc = device_get_softc(dev); + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0) + v = alc_mii_readreg_816x(sc, phy, reg); + else + v = alc_mii_readreg_813x(sc, phy, reg); + return (v); +} + +static uint32_t +alc_mii_readreg_813x(struct alc_softc *sc, int phy, int reg) +{ + uint32_t v; + int i; /* * For AR8132 fast ethernet controller, do not report 1000baseT @@ -261,14 +303,52 @@ alc_miibus_readreg(device_t dev, int phy return ((v & MDIO_DATA_MASK) >> MDIO_DATA_SHIFT); } +static uint32_t +alc_mii_readreg_816x(struct alc_softc *sc, int phy, int reg) +{ + uint32_t clk, v; + int i; + + if ((sc->alc_flags & ALC_FLAG_LINK) != 0) + clk = MDIO_CLK_25_128; + else + clk = MDIO_CLK_25_4; + CSR_WRITE_4(sc, ALC_MDIO, MDIO_OP_EXECUTE | MDIO_OP_READ | + MDIO_SUP_PREAMBLE | clk | MDIO_REG_ADDR(reg)); + for (i = ALC_PHY_TIMEOUT; i > 0; i--) { + DELAY(5); + v = CSR_READ_4(sc, ALC_MDIO); + if ((v & MDIO_OP_BUSY) == 0) + break; + } + + if (i == 0) { + device_printf(sc->alc_dev, "phy read timeout : %d\n", reg); + return (0); + } + + return ((v & MDIO_DATA_MASK) >> MDIO_DATA_SHIFT); +} + static int alc_miibus_writereg(device_t dev, int phy, int reg, int val) { struct alc_softc *sc; - uint32_t v; - int i; + int v; sc = device_get_softc(dev); + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0) + v = alc_mii_writereg_816x(sc, phy, reg, val); + else + v = alc_mii_writereg_813x(sc, phy, reg, val); + return (v); +} + +static uint32_t +alc_mii_writereg_813x(struct alc_softc *sc, int phy, int reg, int val) +{ + uint32_t v; + int i; CSR_WRITE_4(sc, ALC_MDIO, MDIO_OP_EXECUTE | MDIO_OP_WRITE | (val & MDIO_DATA_MASK) << MDIO_DATA_SHIFT | @@ -286,6 +366,32 @@ alc_miibus_writereg(device_t dev, int ph return (0); } +static uint32_t +alc_mii_writereg_816x(struct alc_softc *sc, int phy, int reg, int val) +{ + uint32_t clk, v; + int i; + + if ((sc->alc_flags & ALC_FLAG_LINK) != 0) + clk = MDIO_CLK_25_128; + else + clk = MDIO_CLK_25_4; + CSR_WRITE_4(sc, ALC_MDIO, MDIO_OP_EXECUTE | MDIO_OP_WRITE | + ((val & MDIO_DATA_MASK) << MDIO_DATA_SHIFT) | MDIO_REG_ADDR(reg) | + MDIO_SUP_PREAMBLE | clk); + for (i = ALC_PHY_TIMEOUT; i > 0; i--) { + DELAY(5); + v = CSR_READ_4(sc, ALC_MDIO); + if ((v & MDIO_OP_BUSY) == 0) + break; + } + + if (i == 0) + device_printf(sc->alc_dev, "phy write timeout : %d\n", reg); + + return (0); +} + static void alc_miibus_statchg(device_t dev) { @@ -318,7 +424,6 @@ alc_miibus_statchg(device_t dev) break; } } - alc_stop_queue(sc); /* Stop Rx/Tx MACs. */ alc_stop_mac(sc); @@ -330,7 +435,159 @@ alc_miibus_statchg(device_t dev) reg = CSR_READ_4(sc, ALC_MAC_CFG); reg |= MAC_CFG_TX_ENB | MAC_CFG_RX_ENB; CSR_WRITE_4(sc, ALC_MAC_CFG, reg); - alc_aspm(sc, IFM_SUBTYPE(mii->mii_media_active)); + } + alc_aspm(sc, 0, IFM_SUBTYPE(mii->mii_media_active)); + alc_dsp_fixup(sc, IFM_SUBTYPE(mii->mii_media_active)); +} + +static uint32_t +alc_miidbg_readreg(struct alc_softc *sc, int reg) +{ + + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, ALC_MII_DBG_ADDR, + reg); + return (alc_miibus_readreg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA)); +} + +static uint32_t +alc_miidbg_writereg(struct alc_softc *sc, int reg, int val) +{ + + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, ALC_MII_DBG_ADDR, + reg); + return (alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA, val)); +} + +static uint32_t +alc_miiext_readreg(struct alc_softc *sc, int devaddr, int reg) +{ + uint32_t clk, v; + int i; + + CSR_WRITE_4(sc, ALC_EXT_MDIO, EXT_MDIO_REG(reg) | + EXT_MDIO_DEVADDR(devaddr)); + if ((sc->alc_flags & ALC_FLAG_LINK) != 0) + clk = MDIO_CLK_25_128; + else + clk = MDIO_CLK_25_4; + CSR_WRITE_4(sc, ALC_MDIO, MDIO_OP_EXECUTE | MDIO_OP_READ | + MDIO_SUP_PREAMBLE | clk | MDIO_MODE_EXT); + for (i = ALC_PHY_TIMEOUT; i > 0; i--) { + DELAY(5); + v = CSR_READ_4(sc, ALC_MDIO); + if ((v & MDIO_OP_BUSY) == 0) + break; + } + + if (i == 0) { + device_printf(sc->alc_dev, "phy ext read timeout : %d, %d\n", + devaddr, reg); + return (0); + } + + return ((v & MDIO_DATA_MASK) >> MDIO_DATA_SHIFT); +} + +static uint32_t +alc_miiext_writereg(struct alc_softc *sc, int devaddr, int reg, int val) +{ + uint32_t clk, v; + int i; + + CSR_WRITE_4(sc, ALC_EXT_MDIO, EXT_MDIO_REG(reg) | + EXT_MDIO_DEVADDR(devaddr)); + if ((sc->alc_flags & ALC_FLAG_LINK) != 0) + clk = MDIO_CLK_25_128; + else + clk = MDIO_CLK_25_4; + CSR_WRITE_4(sc, ALC_MDIO, MDIO_OP_EXECUTE | MDIO_OP_WRITE | + ((val & MDIO_DATA_MASK) << MDIO_DATA_SHIFT) | + MDIO_SUP_PREAMBLE | clk | MDIO_MODE_EXT); + for (i = ALC_PHY_TIMEOUT; i > 0; i--) { + DELAY(5); + v = CSR_READ_4(sc, ALC_MDIO); + if ((v & MDIO_OP_BUSY) == 0) + break; + } + + if (i == 0) + device_printf(sc->alc_dev, "phy ext write timeout : %d, %d\n", + devaddr, reg); + + return (0); +} + +static void +alc_dsp_fixup(struct alc_softc *sc, int media) +{ + uint16_t agc, len, val; + + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0) + return; + if (AR816X_REV(sc->alc_rev) >= AR816X_REV_C0) + return; + + /* + * Vendor PHY magic. + * 1000BT/AZ, wrong cable length + */ + if ((sc->alc_flags & ALC_FLAG_LINK) != 0) { + len = alc_miiext_readreg(sc, MII_EXT_PCS, MII_EXT_CLDCTL6); + len = (len >> EXT_CLDCTL6_CAB_LEN_SHIFT) & + EXT_CLDCTL6_CAB_LEN_MASK; + agc = alc_miidbg_readreg(sc, MII_DBG_AGC); + agc = (agc >> DBG_AGC_2_VGA_SHIFT) & DBG_AGC_2_VGA_MASK; + if ((media == IFM_1000_T && len > EXT_CLDCTL6_CAB_LEN_SHORT1G && + agc > DBG_AGC_LONG1G_LIMT) || + (media == IFM_100_TX && len > DBG_AGC_LONG100M_LIMT && + agc > DBG_AGC_LONG1G_LIMT)) { + alc_miidbg_writereg(sc, MII_DBG_AZ_ANADECT, + DBG_AZ_ANADECT_LONG); + val = alc_miiext_readreg(sc, MII_EXT_ANEG, + MII_EXT_ANEG_AFE); + val |= ANEG_AFEE_10BT_100M_TH; + alc_miiext_writereg(sc, MII_EXT_ANEG, MII_EXT_ANEG_AFE, + val); + } else { + alc_miidbg_writereg(sc, MII_DBG_AZ_ANADECT, + DBG_AZ_ANADECT_DEFAULT); + val = alc_miiext_readreg(sc, MII_EXT_ANEG, + MII_EXT_ANEG_AFE); + val &= ~ANEG_AFEE_10BT_100M_TH; + alc_miiext_writereg(sc, MII_EXT_ANEG, MII_EXT_ANEG_AFE, + val); + } + if ((sc->alc_flags & ALC_FLAG_LINK_WAR) != 0 && + AR816X_REV(sc->alc_rev) == AR816X_REV_B0) { + if (media == IFM_1000_T) { + /* + * Giga link threshold, raise the tolerance of + * noise 50%. + */ + val = alc_miidbg_readreg(sc, MII_DBG_MSE20DB); + val &= ~DBG_MSE20DB_TH_MASK; + val |= (DBG_MSE20DB_TH_HI << + DBG_MSE20DB_TH_SHIFT); + alc_miidbg_writereg(sc, MII_DBG_MSE20DB, val); + } else if (media == IFM_100_TX) + alc_miidbg_writereg(sc, MII_DBG_MSE16DB, + DBG_MSE16DB_UP); + } + } else { + val = alc_miiext_readreg(sc, MII_EXT_ANEG, MII_EXT_ANEG_AFE); + val &= ~ANEG_AFEE_10BT_100M_TH; + alc_miiext_writereg(sc, MII_EXT_ANEG, MII_EXT_ANEG_AFE, val); + if ((sc->alc_flags & ALC_FLAG_LINK_WAR) != 0 && + AR816X_REV(sc->alc_rev) == AR816X_REV_B0) { + alc_miidbg_writereg(sc, MII_DBG_MSE16DB, + DBG_MSE16DB_DOWN); + val = alc_miidbg_readreg(sc, MII_DBG_MSE20DB); + val &= ~DBG_MSE20DB_TH_MASK; + val |= (DBG_MSE20DB_TH_DEFAULT << DBG_MSE20DB_TH_SHIFT); + alc_miidbg_writereg(sc, MII_DBG_MSE20DB, val); + } } } @@ -358,17 +615,29 @@ static int alc_mediachange(struct ifnet *ifp) { struct alc_softc *sc; - struct mii_data *mii; - struct mii_softc *miisc; int error; sc = ifp->if_softc; ALC_LOCK(sc); + error = alc_mediachange_locked(sc); + ALC_UNLOCK(sc); + + return (error); +} + +static int +alc_mediachange_locked(struct alc_softc *sc) +{ + struct mii_data *mii; + struct mii_softc *miisc; + int error; + + ALC_LOCK_ASSERT(sc); + mii = device_get_softc(sc->alc_miibus); LIST_FOREACH(miisc, &mii->mii_phys, mii_list) PHY_RESET(miisc); error = mii_mediachg(mii); - ALC_UNLOCK(sc); return (error); } @@ -406,7 +675,17 @@ alc_probe(device_t dev) static void alc_get_macaddr(struct alc_softc *sc) { - uint32_t ea[2], opt; + + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0) + alc_get_macaddr_816x(sc); + else + alc_get_macaddr_813x(sc); +} + +static void +alc_get_macaddr_813x(struct alc_softc *sc) +{ + uint32_t opt; uint16_t val; int eeprom, i; @@ -501,6 +780,73 @@ alc_get_macaddr(struct alc_softc *sc) } } + alc_get_macaddr_par(sc); +} + +static void +alc_get_macaddr_816x(struct alc_softc *sc) +{ + uint32_t reg; + int i, reloaded; + + reloaded = 0; + /* Try to reload station address via TWSI. */ + for (i = 100; i > 0; i--) { + reg = CSR_READ_4(sc, ALC_SLD); + if ((reg & (SLD_PROGRESS | SLD_START)) == 0) + break; + DELAY(1000); + } + if (i != 0) { + CSR_WRITE_4(sc, ALC_SLD, reg | SLD_START); + for (i = 100; i > 0; i--) { + DELAY(1000); + reg = CSR_READ_4(sc, ALC_SLD); + if ((reg & SLD_START) == 0) + break; + } + if (i != 0) + reloaded++; + else if (bootverbose) + device_printf(sc->alc_dev, + "reloading station address via TWSI timed out!\n"); + } + + /* Try to reload station address from EEPROM or FLASH. */ + if (reloaded == 0) { + reg = CSR_READ_4(sc, ALC_EEPROM_LD); + if ((reg & (EEPROM_LD_EEPROM_EXIST | + EEPROM_LD_FLASH_EXIST)) != 0) { + for (i = 100; i > 0; i--) { + reg = CSR_READ_4(sc, ALC_EEPROM_LD); + if ((reg & (EEPROM_LD_PROGRESS | + EEPROM_LD_START)) == 0) + break; + DELAY(1000); + } + if (i != 0) { + CSR_WRITE_4(sc, ALC_EEPROM_LD, reg | + EEPROM_LD_START); + for (i = 100; i > 0; i--) { + DELAY(1000); + reg = CSR_READ_4(sc, ALC_EEPROM_LD); + if ((reg & EEPROM_LD_START) == 0) + break; + } + } else if (bootverbose) + device_printf(sc->alc_dev, + "reloading EEPROM/FLASH timed out!\n"); + } + } + + alc_get_macaddr_par(sc); +} + +static void +alc_get_macaddr_par(struct alc_softc *sc) +{ + uint32_t ea[2]; + ea[0] = CSR_READ_4(sc, ALC_PAR0); ea[1] = CSR_READ_4(sc, ALC_PAR1); sc->alc_eaddr[0] = (ea[1] >> 8) & 0xFF; @@ -516,19 +862,31 @@ alc_disable_l0s_l1(struct alc_softc *sc) { uint32_t pmcfg; - /* Another magic from vendor. */ - pmcfg = CSR_READ_4(sc, ALC_PM_CFG); - pmcfg &= ~(PM_CFG_L1_ENTRY_TIMER_MASK | PM_CFG_CLK_SWH_L1 | - PM_CFG_ASPM_L0S_ENB | PM_CFG_ASPM_L1_ENB | PM_CFG_MAC_ASPM_CHK | - PM_CFG_SERDES_PD_EX_L1); - pmcfg |= PM_CFG_SERDES_BUDS_RX_L1_ENB | PM_CFG_SERDES_PLL_L1_ENB | - PM_CFG_SERDES_L1_ENB; - CSR_WRITE_4(sc, ALC_PM_CFG, pmcfg); + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) == 0) { + /* Another magic from vendor. */ + pmcfg = CSR_READ_4(sc, ALC_PM_CFG); + pmcfg &= ~(PM_CFG_L1_ENTRY_TIMER_MASK | PM_CFG_CLK_SWH_L1 | + PM_CFG_ASPM_L0S_ENB | PM_CFG_ASPM_L1_ENB | + PM_CFG_MAC_ASPM_CHK | PM_CFG_SERDES_PD_EX_L1); + pmcfg |= PM_CFG_SERDES_BUDS_RX_L1_ENB | + PM_CFG_SERDES_PLL_L1_ENB | PM_CFG_SERDES_L1_ENB; + CSR_WRITE_4(sc, ALC_PM_CFG, pmcfg); + } } static void alc_phy_reset(struct alc_softc *sc) { + + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0) + alc_phy_reset_816x(sc); + else + alc_phy_reset_813x(sc); +} + +static void +alc_phy_reset_813x(struct alc_softc *sc) +{ uint16_t data; /* Reset magic from Linux. */ @@ -641,12 +999,101 @@ alc_phy_reset(struct alc_softc *sc) } static void +alc_phy_reset_816x(struct alc_softc *sc) +{ + uint32_t val; + + val = CSR_READ_4(sc, ALC_GPHY_CFG); + val &= ~(GPHY_CFG_EXT_RESET | GPHY_CFG_LED_MODE | + GPHY_CFG_GATE_25M_ENB | GPHY_CFG_PHY_IDDQ | GPHY_CFG_PHY_PLL_ON | + GPHY_CFG_PWDOWN_HW | GPHY_CFG_100AB_ENB); + val |= GPHY_CFG_SEL_ANA_RESET; +#ifdef notyet + val |= GPHY_CFG_HIB_PULSE | GPHY_CFG_HIB_EN | GPHY_CFG_SEL_ANA_RESET; +#else + /* Disable PHY hibernation. */ + val &= ~(GPHY_CFG_HIB_PULSE | GPHY_CFG_HIB_EN); +#endif + CSR_WRITE_4(sc, ALC_GPHY_CFG, val); + DELAY(10); + CSR_WRITE_4(sc, ALC_GPHY_CFG, val | GPHY_CFG_EXT_RESET); + DELAY(800); + + /* Vendor PHY magic. */ +#ifdef notyet + alc_miidbg_writereg(sc, MII_DBG_LEGCYPS, DBG_LEGCYPS_DEFAULT); + alc_miidbg_writereg(sc, MII_DBG_SYSMODCTL, DBG_SYSMODCTL_DEFAULT); + alc_miiext_writereg(sc, MII_EXT_PCS, MII_EXT_VDRVBIAS, + EXT_VDRVBIAS_DEFAULT); +#else + /* Disable PHY hibernation. */ + alc_miidbg_writereg(sc, MII_DBG_LEGCYPS, + DBG_LEGCYPS_DEFAULT & ~DBG_LEGCYPS_ENB); + alc_miidbg_writereg(sc, MII_DBG_HIBNEG, + DBG_HIBNEG_DEFAULT & ~(DBG_HIBNEG_PSHIB_EN | DBG_HIBNEG_HIB_PULSE)); + alc_miidbg_writereg(sc, MII_DBG_GREENCFG, DBG_GREENCFG_DEFAULT); +#endif + + /* XXX Disable EEE. */ + val = CSR_READ_4(sc, ALC_LPI_CTL); + val &= ~LPI_CTL_ENB; + CSR_WRITE_4(sc, ALC_LPI_CTL, val); + alc_miiext_writereg(sc, MII_EXT_ANEG, MII_EXT_ANEG_LOCAL_EEEADV, 0); + + /* PHY power saving. */ + alc_miidbg_writereg(sc, MII_DBG_TST10BTCFG, DBG_TST10BTCFG_DEFAULT); + alc_miidbg_writereg(sc, MII_DBG_SRDSYSMOD, DBG_SRDSYSMOD_DEFAULT); + alc_miidbg_writereg(sc, MII_DBG_TST100BTCFG, DBG_TST100BTCFG_DEFAULT); + alc_miidbg_writereg(sc, MII_DBG_ANACTL, DBG_ANACTL_DEFAULT); + val = alc_miidbg_readreg(sc, MII_DBG_GREENCFG2); + val &= ~DBG_GREENCFG2_GATE_DFSE_EN; + alc_miidbg_writereg(sc, MII_DBG_GREENCFG2, val); + + /* RTL8139C, 120m issue. */ + alc_miiext_writereg(sc, MII_EXT_ANEG, MII_EXT_ANEG_NLP78, + ANEG_NLP78_120M_DEFAULT); + alc_miiext_writereg(sc, MII_EXT_ANEG, MII_EXT_ANEG_S3DIG10, + ANEG_S3DIG10_DEFAULT); + + if ((sc->alc_flags & ALC_FLAG_LINK_WAR) != 0) { + /* Turn off half amplitude. */ + val = alc_miiext_readreg(sc, MII_EXT_PCS, MII_EXT_CLDCTL3); + val |= EXT_CLDCTL3_BP_CABLE1TH_DET_GT; + alc_miiext_writereg(sc, MII_EXT_PCS, MII_EXT_CLDCTL3, val); + /* Turn off Green feature. */ + val = alc_miidbg_readreg(sc, MII_DBG_GREENCFG2); + val |= DBG_GREENCFG2_BP_GREEN; + alc_miidbg_writereg(sc, MII_DBG_GREENCFG2, val); + /* Turn off half bias. */ + val = alc_miiext_readreg(sc, MII_EXT_PCS, MII_EXT_CLDCTL5); + val |= EXT_CLDCTL5_BP_VD_HLFBIAS; + alc_miiext_writereg(sc, MII_EXT_PCS, MII_EXT_CLDCTL5, val); + } +} + +static void alc_phy_down(struct alc_softc *sc) { + uint32_t gphy; switch (sc->alc_ident->deviceid) { + case DEVICEID_ATHEROS_AR8161: + case DEVICEID_ATHEROS_E2200: + case DEVICEID_ATHEROS_AR8162: + case DEVICEID_ATHEROS_AR8171: + case DEVICEID_ATHEROS_AR8172: + gphy = CSR_READ_4(sc, ALC_GPHY_CFG); + gphy &= ~(GPHY_CFG_EXT_RESET | GPHY_CFG_LED_MODE | + GPHY_CFG_100AB_ENB | GPHY_CFG_PHY_PLL_ON); + gphy |= GPHY_CFG_HIB_EN | GPHY_CFG_HIB_PULSE | + GPHY_CFG_SEL_ANA_RESET; + gphy |= GPHY_CFG_PHY_IDDQ | GPHY_CFG_PWDOWN_HW; + CSR_WRITE_4(sc, ALC_GPHY_CFG, gphy); + break; case DEVICEID_ATHEROS_AR8151: case DEVICEID_ATHEROS_AR8151_V2: + case DEVICEID_ATHEROS_AR8152_B: + case DEVICEID_ATHEROS_AR8152_B2: /* * GPHY power down caused more problems on AR8151 v2.0. * When driver is reloaded after GPHY power down, @@ -672,12 +1119,23 @@ alc_phy_down(struct alc_softc *sc) } static void -alc_aspm(struct alc_softc *sc, int media) +alc_aspm(struct alc_softc *sc, int init, int media) +{ + + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0) + alc_aspm_816x(sc, init); + else + alc_aspm_813x(sc, media); +} + +static void +alc_aspm_813x(struct alc_softc *sc, int media) { uint32_t pmcfg; uint16_t linkcfg; - ALC_LOCK_ASSERT(sc); + if ((sc->alc_flags & ALC_FLAG_LINK) == 0) + return; pmcfg = CSR_READ_4(sc, ALC_PM_CFG); if ((sc->alc_flags & (ALC_FLAG_APS | ALC_FLAG_PCIE)) == @@ -758,71 +1216,61 @@ alc_aspm(struct alc_softc *sc, int media CSR_WRITE_4(sc, ALC_PM_CFG, pmcfg); } -static int -alc_attach(device_t dev) +static void +alc_aspm_816x(struct alc_softc *sc, int init) { - struct alc_softc *sc; - struct ifnet *ifp; - char *aspm_state[] = { "L0s/L1", "L0s", "L1", "L0s/L1" }; - uint16_t burst; - int base, error, i, msic, msixc, state; - uint32_t cap, ctl, val; - - error = 0; - sc = device_get_softc(dev); - sc->alc_dev = dev; - - mtx_init(&sc->alc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, - MTX_DEF); - callout_init_mtx(&sc->alc_tick_ch, &sc->alc_mtx, 0); - TASK_INIT(&sc->alc_int_task, 0, alc_int_task, sc); - sc->alc_ident = alc_find_ident(dev); + uint32_t pmcfg; - /* Map the device. */ - pci_enable_busmaster(dev); - sc->alc_res_spec = alc_res_spec_mem; - sc->alc_irq_spec = alc_irq_spec_legacy; - error = bus_alloc_resources(dev, sc->alc_res_spec, sc->alc_res); - if (error != 0) { - device_printf(dev, "cannot allocate memory resources.\n"); - goto fail; + pmcfg = CSR_READ_4(sc, ALC_PM_CFG); + pmcfg &= ~PM_CFG_L1_ENTRY_TIMER_816X_MASK; + pmcfg |= PM_CFG_L1_ENTRY_TIMER_816X_DEFAULT; + pmcfg &= ~PM_CFG_PM_REQ_TIMER_MASK; + pmcfg |= PM_CFG_PM_REQ_TIMER_816X_DEFAULT; + pmcfg &= ~PM_CFG_LCKDET_TIMER_MASK; + pmcfg |= PM_CFG_LCKDET_TIMER_DEFAULT; + pmcfg |= PM_CFG_SERDES_PD_EX_L1 | PM_CFG_CLK_SWH_L1 | PM_CFG_PCIE_RECV; + pmcfg &= ~(PM_CFG_RX_L1_AFTER_L0S | PM_CFG_TX_L1_AFTER_L0S | + PM_CFG_ASPM_L1_ENB | PM_CFG_ASPM_L0S_ENB | + PM_CFG_SERDES_L1_ENB | PM_CFG_SERDES_PLL_L1_ENB | + PM_CFG_SERDES_BUDS_RX_L1_ENB | PM_CFG_SA_DLY_ENB | + PM_CFG_MAC_ASPM_CHK | PM_CFG_HOTRST); + if (AR816X_REV(sc->alc_rev) <= AR816X_REV_A1 && + (sc->alc_rev & 0x01) != 0) + pmcfg |= PM_CFG_SERDES_L1_ENB | PM_CFG_SERDES_PLL_L1_ENB; + if ((sc->alc_flags & ALC_FLAG_LINK) != 0) { + /* Link up, enable both L0s, L1s. */ + pmcfg |= PM_CFG_ASPM_L0S_ENB | PM_CFG_ASPM_L1_ENB | + PM_CFG_MAC_ASPM_CHK; + } else { + if (init != 0) + pmcfg |= PM_CFG_ASPM_L0S_ENB | PM_CFG_ASPM_L1_ENB | + PM_CFG_MAC_ASPM_CHK; + else if ((sc->alc_ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + pmcfg |= PM_CFG_ASPM_L1_ENB | PM_CFG_MAC_ASPM_CHK; } + CSR_WRITE_4(sc, ALC_PM_CFG, pmcfg); +} - /* Set PHY address. */ - sc->alc_phyaddr = ALC_PHY_ADDR; +static void +alc_init_pcie(struct alc_softc *sc) +{ + const char *aspm_state[] = { "L0s/L1", "L0s", "L1", "L0s/L1" }; + uint32_t cap, ctl, val; + int state; - /* Initialize DMA parameters. */ - sc->alc_dma_rd_burst = 0; - sc->alc_dma_wr_burst = 0; - sc->alc_rcb = DMA_CFG_RCB_64; - if (pci_find_cap(dev, PCIY_EXPRESS, &base) == 0) { - sc->alc_flags |= ALC_FLAG_PCIE; - sc->alc_expcap = base; - burst = CSR_READ_2(sc, base + PCIER_DEVICE_CTL); - sc->alc_dma_rd_burst = - (burst & PCIEM_CTL_MAX_READ_REQUEST) >> 12; - sc->alc_dma_wr_burst = (burst & PCIEM_CTL_MAX_PAYLOAD) >> 5; - if (bootverbose) { - device_printf(dev, "Read request size : %u bytes.\n", - alc_dma_burst[sc->alc_dma_rd_burst]); - device_printf(dev, "TLP payload size : %u bytes.\n", - alc_dma_burst[sc->alc_dma_wr_burst]); - } - if (alc_dma_burst[sc->alc_dma_rd_burst] > 1024) - sc->alc_dma_rd_burst = 3; - if (alc_dma_burst[sc->alc_dma_wr_burst] > 1024) - sc->alc_dma_wr_burst = 3; - /* Clear data link and flow-control protocol error. */ - val = CSR_READ_4(sc, ALC_PEX_UNC_ERR_SEV); - val &= ~(PEX_UNC_ERR_SEV_DLP | PEX_UNC_ERR_SEV_FCP); - CSR_WRITE_4(sc, ALC_PEX_UNC_ERR_SEV, val); + /* Clear data link and flow-control protocol error. */ + val = CSR_READ_4(sc, ALC_PEX_UNC_ERR_SEV); + val &= ~(PEX_UNC_ERR_SEV_DLP | PEX_UNC_ERR_SEV_FCP); + CSR_WRITE_4(sc, ALC_PEX_UNC_ERR_SEV, val); + + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) == 0) { CSR_WRITE_4(sc, ALC_LTSSM_ID_CFG, CSR_READ_4(sc, ALC_LTSSM_ID_CFG) & ~LTSSM_ID_WRO_ENB); CSR_WRITE_4(sc, ALC_PCIE_PHYMISC, CSR_READ_4(sc, ALC_PCIE_PHYMISC) | PCIE_PHYMISC_FORCE_RCV_DET); if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B && - pci_get_revid(dev) == ATHEROS_AR8152_B_V10) { + sc->alc_rev == ATHEROS_AR8152_B_V10) { val = CSR_READ_4(sc, ALC_PCIE_PHYMISC2); val &= ~(PCIE_PHYMISC2_SERDES_CDR_MASK | PCIE_PHYMISC2_SERDES_TH_MASK); @@ -831,13 +1279,13 @@ alc_attach(device_t dev) CSR_WRITE_4(sc, ALC_PCIE_PHYMISC2, val); } /* Disable ASPM L0S and L1. */ - cap = CSR_READ_2(sc, base + PCIER_LINK_CAP); + cap = CSR_READ_2(sc, sc->alc_expcap + PCIER_LINK_CAP); if ((cap & PCIEM_LINK_CAP_ASPM) != 0) { - ctl = CSR_READ_2(sc, base + PCIER_LINK_CTL); + ctl = CSR_READ_2(sc, sc->alc_expcap + PCIER_LINK_CTL); if ((ctl & 0x08) != 0) sc->alc_rcb = DMA_CFG_RCB_128; if (bootverbose) - device_printf(dev, "RCB %u bytes\n", + device_printf(sc->alc_dev, "RCB %u bytes\n", sc->alc_rcb == DMA_CFG_RCB_64 ? 64 : 128); state = ctl & 0x03; if (state & 0x01) @@ -854,13 +1302,91 @@ alc_attach(device_t dev) device_printf(sc->alc_dev, "no ASPM support\n"); } + } else { + val = CSR_READ_4(sc, ALC_PDLL_TRNS1); + val &= ~PDLL_TRNS1_D3PLLOFF_ENB; + CSR_WRITE_4(sc, ALC_PDLL_TRNS1, val); + val = CSR_READ_4(sc, ALC_MASTER_CFG); + if (AR816X_REV(sc->alc_rev) <= AR816X_REV_A1 && + (sc->alc_rev & 0x01) != 0) { + if ((val & MASTER_WAKEN_25M) == 0 || + (val & MASTER_CLK_SEL_DIS) == 0) { + val |= MASTER_WAKEN_25M | MASTER_CLK_SEL_DIS; + CSR_WRITE_4(sc, ALC_MASTER_CFG, val); + } + } else { + if ((val & MASTER_WAKEN_25M) == 0 || + (val & MASTER_CLK_SEL_DIS) != 0) { + val |= MASTER_WAKEN_25M; + val &= ~MASTER_CLK_SEL_DIS; + CSR_WRITE_4(sc, ALC_MASTER_CFG, val); + } + } } + alc_aspm(sc, 1, IFM_UNKNOWN); +} - /* Reset PHY. */ - alc_phy_reset(sc); +static void +alc_config_msi(struct alc_softc *sc) +{ + uint32_t ctl, mod; - /* Reset the ethernet controller. */ - alc_reset(sc); + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0) { + /* + * It seems interrupt moderation is controlled by + * ALC_MSI_RETRANS_TIMER register if MSI/MSIX is active. + * Driver uses RX interrupt moderation parameter to + * program ALC_MSI_RETRANS_TIMER register. + */ + ctl = CSR_READ_4(sc, ALC_MSI_RETRANS_TIMER); + ctl &= ~MSI_RETRANS_TIMER_MASK; + ctl &= ~MSI_RETRANS_MASK_SEL_LINE; + mod = ALC_USECS(sc->alc_int_rx_mod); + if (mod == 0) + mod = 1; + ctl |= mod; + if ((sc->alc_flags & ALC_FLAG_MSIX) != 0) + CSR_WRITE_4(sc, ALC_MSI_RETRANS_TIMER, ctl | + MSI_RETRANS_MASK_SEL_STD); + else if ((sc->alc_flags & ALC_FLAG_MSI) != 0) + CSR_WRITE_4(sc, ALC_MSI_RETRANS_TIMER, ctl | + MSI_RETRANS_MASK_SEL_LINE); + else + CSR_WRITE_4(sc, ALC_MSI_RETRANS_TIMER, 0); + } +} + +static int +alc_attach(device_t dev) +{ + struct alc_softc *sc; + struct ifnet *ifp; + int base, error, i, msic, msixc; + uint16_t burst; + + error = 0; + sc = device_get_softc(dev); + sc->alc_dev = dev; + sc->alc_rev = pci_get_revid(dev); + + mtx_init(&sc->alc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, + MTX_DEF); + callout_init_mtx(&sc->alc_tick_ch, &sc->alc_mtx, 0); + TASK_INIT(&sc->alc_int_task, 0, alc_int_task, sc); + sc->alc_ident = alc_find_ident(dev); + + /* Map the device. */ + pci_enable_busmaster(dev); + sc->alc_res_spec = alc_res_spec_mem; + sc->alc_irq_spec = alc_irq_spec_legacy; + error = bus_alloc_resources(dev, sc->alc_res_spec, sc->alc_res); + if (error != 0) { + device_printf(dev, "cannot allocate memory resources.\n"); + goto fail; + } + + /* Set PHY address. */ + sc->alc_phyaddr = ALC_PHY_ADDR; /* * One odd thing is AR8132 uses the same PHY hardware(F1 @@ -870,6 +1396,19 @@ alc_attach(device_t dev) * shows the same PHY model/revision number of AR8131. */ switch (sc->alc_ident->deviceid) { + case DEVICEID_ATHEROS_AR8161: + if (pci_get_subvendor(dev) == VENDORID_ATHEROS && + pci_get_subdevice(dev) == 0x0091 && sc->alc_rev == 0) + sc->alc_flags |= ALC_FLAG_LINK_WAR; + /* FALLTHROUGH */ + case DEVICEID_ATHEROS_E2200: + case DEVICEID_ATHEROS_AR8171: + sc->alc_flags |= ALC_FLAG_AR816X_FAMILY; + break; + case DEVICEID_ATHEROS_AR8162: + case DEVICEID_ATHEROS_AR8172: + sc->alc_flags |= ALC_FLAG_FASTETHER | ALC_FLAG_AR816X_FAMILY; + break; case DEVICEID_ATHEROS_AR8152_B: case DEVICEID_ATHEROS_AR8152_B2: sc->alc_flags |= ALC_FLAG_APS; @@ -884,7 +1423,7 @@ alc_attach(device_t dev) default: break; } - sc->alc_flags |= ALC_FLAG_ASPM_MON | ALC_FLAG_JUMBO; + sc->alc_flags |= ALC_FLAG_JUMBO; /* * It seems that AR813x/AR815x has silicon bug for SMB. In @@ -897,7 +1436,6 @@ alc_attach(device_t dev) * Don't use Tx CMB. It is known to have silicon bug. */ sc->alc_flags |= ALC_FLAG_CMB_BUG; - sc->alc_rev = pci_get_revid(dev); sc->alc_chip_rev = CSR_READ_4(sc, ALC_MASTER_CFG) >> MASTER_CHIP_REV_SHIFT; if (bootverbose) { @@ -905,11 +1443,45 @@ alc_attach(device_t dev) sc->alc_rev); device_printf(dev, "Chip id/revision : 0x%04x\n", sc->alc_chip_rev); + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0) + device_printf(dev, "AR816x revision : 0x%x\n", + AR816X_REV(sc->alc_rev)); } device_printf(dev, "%u Tx FIFO, %u Rx FIFO\n", CSR_READ_4(sc, ALC_SRAM_TX_FIFO_LEN) * 8, CSR_READ_4(sc, ALC_SRAM_RX_FIFO_LEN) * 8); + /* Initialize DMA parameters. */ + sc->alc_dma_rd_burst = 0; + sc->alc_dma_wr_burst = 0; + sc->alc_rcb = DMA_CFG_RCB_64; + if (pci_find_cap(dev, PCIY_EXPRESS, &base) == 0) { + sc->alc_flags |= ALC_FLAG_PCIE; + sc->alc_expcap = base; + burst = CSR_READ_2(sc, base + PCIER_DEVICE_CTL); + sc->alc_dma_rd_burst = + (burst & PCIEM_CTL_MAX_READ_REQUEST) >> 12; + sc->alc_dma_wr_burst = (burst & PCIEM_CTL_MAX_PAYLOAD) >> 5; + if (bootverbose) { + device_printf(dev, "Read request size : %u bytes.\n", + alc_dma_burst[sc->alc_dma_rd_burst]); + device_printf(dev, "TLP payload size : %u bytes.\n", + alc_dma_burst[sc->alc_dma_wr_burst]); + } + if (alc_dma_burst[sc->alc_dma_rd_burst] > 1024) + sc->alc_dma_rd_burst = 3; + if (alc_dma_burst[sc->alc_dma_wr_burst] > 1024) + sc->alc_dma_wr_burst = 3; + alc_init_pcie(sc); + } + + /* Reset PHY. */ + alc_phy_reset(sc); + + /* Reset the ethernet controller. */ + alc_stop_mac(sc); + alc_reset(sc); + /* Allocate IRQ resources. */ msixc = pci_msix_count(dev); msic = pci_msi_count(dev); @@ -917,11 +1489,20 @@ alc_attach(device_t dev) device_printf(dev, "MSIX count : %d\n", msixc); device_printf(dev, "MSI count : %d\n", msic); } - /* Prefer MSIX over MSI. */ + if (msixc > 1) + msixc = 1; + if (msic > 1) + msic = 1; + /* + * Prefer MSIX over MSI. + * AR816x controller has a silicon bug that MSI interrupt + * does not assert if PCIM_CMD_INTxDIS bit of command + * register is set. pci(4) was taught to handle that case. + */ if (msix_disable == 0 || msi_disable == 0) { - if (msix_disable == 0 && msixc == ALC_MSIX_MESSAGES && + if (msix_disable == 0 && msixc > 0 && pci_alloc_msix(dev, &msixc) == 0) { - if (msic == ALC_MSIX_MESSAGES) { + if (msic == 1) { device_printf(dev, "Using %d MSIX message(s).\n", msixc); sc->alc_flags |= ALC_FLAG_MSIX; @@ -930,9 +1511,8 @@ alc_attach(device_t dev) pci_release_msi(dev); } if (msi_disable == 0 && (sc->alc_flags & ALC_FLAG_MSIX) == 0 && - msic == ALC_MSI_MESSAGES && - pci_alloc_msi(dev, &msic) == 0) { - if (msic == ALC_MSI_MESSAGES) { + msic > 0 && pci_alloc_msi(dev, &msic) == 0) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 04:54:37 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id ED0A5D42; Tue, 21 Oct 2014 04:54:37 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BE27ADE6; Tue, 21 Oct 2014 04:54:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L4sbwt024747; Tue, 21 Oct 2014 04:54:37 GMT (envelope-from yongari@FreeBSD.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L4sbMY024746; Tue, 21 Oct 2014 04:54:37 GMT (envelope-from yongari@FreeBSD.org) Message-Id: <201410210454.s9L4sbMY024746@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: yongari set sender to yongari@FreeBSD.org using -f From: Pyun YongHyeon Date: Tue, 21 Oct 2014 04:54:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273368 - stable/10/share/man/man4 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 04:54:38 -0000 Author: yongari Date: Tue Oct 21 04:54:37 2014 New Revision: 273368 URL: https://svnweb.freebsd.org/changeset/base/273368 Log: MFC r272731: Document newly added controller AR816x/AR817x. Modified: stable/10/share/man/man4/alc.4 Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/alc.4 ============================================================================== --- stable/10/share/man/man4/alc.4 Tue Oct 21 04:50:07 2014 (r273367) +++ stable/10/share/man/man4/alc.4 Tue Oct 21 04:54:37 2014 (r273368) @@ -24,12 +24,12 @@ .\" .\" $FreeBSD$ .\" -.Dd August 9, 2010 +.Dd October 8, 2014 .Dt ALC 4 .Os .Sh NAME .Nm alc -.Nd Atheros AR813x/AR815x Gigabit/Fast Ethernet driver +.Nd Atheros AR813x/AR815x/AR816x/AR817x Gigabit/Fast Ethernet driver .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your @@ -48,8 +48,8 @@ if_alc_load="YES" .Sh DESCRIPTION The .Nm -device driver provides support for Atheros AR813x and AR815x PCI -Express Gigabit/Fast Ethernet controllers. +device driver provides support for Atheros AR813x, AR815x, AR816x +and AR817x PCI Express Gigabit/Fast Ethernet controllers. .Pp All LOMs supported by the .Nm @@ -58,9 +58,9 @@ segmentation offload (TSO), hardware VLA features, Wake On Lan (WOL) and an interrupt moderation mechanism as well as a 64-bit multicast hash filter. .Pp -The AR813x and AR815x supports Jumbo Frames (up to 9216 and 6144 -bytes, respectively), which can be configured via the interface -MTU setting. +The AR813x, AR815x, AR816x and AR817x supports Jumbo Frames (up to +9216, 6144, 9216 and 9216 bytes, respectively), which can be +configured via the interface MTU setting. Selecting an MTU larger than 1500 bytes with the .Xr ifconfig 8 utility configures the adapter to receive and transmit Jumbo Frames. @@ -112,6 +112,16 @@ Atheros AR8151 v2.0 PCI Express Gigabit Atheros AR8152 v1.1 PCI Express Fast Ethernet controller .It Atheros AR8152 v2.0 PCI Express Fast Ethernet controller +.It +Atheros AR8161 PCI Express Gigabit Ethernet controller +.It +Atheros AR8162 PCI Express Fast Ethernet controller +.It +Atheros AR8171 PCI Express Gigabit Ethernet controller +.It +Atheros AR8172 PCI Express Fast Ethernet controller +.It +Killer E2200 Gigabit Ethernet controller .El .Sh LOADER TUNABLES Tunables can be set at the From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 04:55:56 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 77D84E7B; Tue, 21 Oct 2014 04:55:56 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49457DF0; Tue, 21 Oct 2014 04:55:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L4tuM9025050; Tue, 21 Oct 2014 04:55:56 GMT (envelope-from yongari@FreeBSD.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L4tuCs025049; Tue, 21 Oct 2014 04:55:56 GMT (envelope-from yongari@FreeBSD.org) Message-Id: <201410210455.s9L4tuCs025049@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: yongari set sender to yongari@FreeBSD.org using -f From: Pyun YongHyeon Date: Tue, 21 Oct 2014 04:55:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r273369 - stable/9/share/man/man4 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 04:55:56 -0000 Author: yongari Date: Tue Oct 21 04:55:55 2014 New Revision: 273369 URL: https://svnweb.freebsd.org/changeset/base/273369 Log: MFC r272731: Document newly added controller AR816x/AR817x. Modified: stable/9/share/man/man4/alc.4 Directory Properties: stable/9/share/man/man4/ (props changed) Modified: stable/9/share/man/man4/alc.4 ============================================================================== --- stable/9/share/man/man4/alc.4 Tue Oct 21 04:54:37 2014 (r273368) +++ stable/9/share/man/man4/alc.4 Tue Oct 21 04:55:55 2014 (r273369) @@ -24,12 +24,12 @@ .\" .\" $FreeBSD$ .\" -.Dd August 9, 2010 +.Dd October 8, 2014 .Dt ALC 4 .Os .Sh NAME .Nm alc -.Nd Atheros AR813x/AR815x Gigabit/Fast Ethernet driver +.Nd Atheros AR813x/AR815x/AR816x/AR817x Gigabit/Fast Ethernet driver .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your @@ -48,8 +48,8 @@ if_alc_load="YES" .Sh DESCRIPTION The .Nm -device driver provides support for Atheros AR813x and AR815x PCI -Express Gigabit/Fast Ethernet controllers. +device driver provides support for Atheros AR813x, AR815x, AR816x +and AR817x PCI Express Gigabit/Fast Ethernet controllers. .Pp All LOMs supported by the .Nm @@ -58,9 +58,9 @@ segmentation offload (TSO), hardware VLA features, Wake On Lan (WOL) and an interrupt moderation mechanism as well as a 64-bit multicast hash filter. .Pp -The AR813x and AR815x supports Jumbo Frames (up to 9216 and 6144 -bytes, respectively), which can be configured via the interface -MTU setting. +The AR813x, AR815x, AR816x and AR817x supports Jumbo Frames (up to +9216, 6144, 9216 and 9216 bytes, respectively), which can be +configured via the interface MTU setting. Selecting an MTU larger than 1500 bytes with the .Xr ifconfig 8 utility configures the adapter to receive and transmit Jumbo Frames. @@ -112,6 +112,16 @@ Atheros AR8151 v2.0 PCI Express Gigabit Atheros AR8152 v1.1 PCI Express Fast Ethernet controller .It Atheros AR8152 v2.0 PCI Express Fast Ethernet controller +.It +Atheros AR8161 PCI Express Gigabit Ethernet controller +.It +Atheros AR8162 PCI Express Fast Ethernet controller +.It +Atheros AR8171 PCI Express Gigabit Ethernet controller +.It +Atheros AR8172 PCI Express Fast Ethernet controller +.It +Killer E2200 Gigabit Ethernet controller .El .Sh LOADER TUNABLES Tunables can be set at the From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 05:19:09 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 329F22CD; Tue, 21 Oct 2014 05:19:09 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1EA43FA6; Tue, 21 Oct 2014 05:19:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L5J81g034934; Tue, 21 Oct 2014 05:19:08 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L5J8iu034933; Tue, 21 Oct 2014 05:19:08 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201410210519.s9L5J8iu034933@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 21 Oct 2014 05:19:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273370 - head/cddl/lib/libdtrace X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 05:19:09 -0000 Author: markj Date: Tue Oct 21 05:19:08 2014 New Revision: 273370 URL: https://svnweb.freebsd.org/changeset/base/273370 Log: Correct the calculation of tcps_rto in the struct tcpcb -> tcpsinfo_t translator. Submitted by: Grenville Armitage MFC after: 1 week Modified: head/cddl/lib/libdtrace/tcp.d Modified: head/cddl/lib/libdtrace/tcp.d ============================================================================== --- head/cddl/lib/libdtrace/tcp.d Tue Oct 21 04:55:55 2014 (r273369) +++ head/cddl/lib/libdtrace/tcp.d Tue Oct 21 05:19:08 2014 (r273370) @@ -198,7 +198,7 @@ translator tcpsinfo_t < struct tcpcb *p tcps_cwnd_ssthresh = p == NULL ? -1 : p->snd_ssthresh; tcps_sack_fack = p == NULL ? 0 : p->snd_fack; tcps_sack_snxt = p == NULL ? 0 : p->sack_newdata; - tcps_rto = p == NULL ? -1 : p->t_rxtcur / 1000; /* XXX */ + tcps_rto = p == NULL ? -1 : (p->t_rxtcur * 1000) / `hz; tcps_mss = p == NULL ? -1 : p->t_maxseg; tcps_retransmit = p == NULL ? -1 : p->t_rxtshift > 0 ? 1 : 0; tcps_srtt = p == NULL ? -1 : p->t_srtt; /* smoothed RTT in units of (TCP_RTT_SCALE*hz) */ From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 05:44:02 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 33242935; Tue, 21 Oct 2014 05:44:02 +0000 (UTC) Received: from mail-lb0-x22f.google.com (mail-lb0-x22f.google.com [IPv6:2a00:1450:4010:c04::22f]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 438DF2EE; Tue, 21 Oct 2014 05:44:01 +0000 (UTC) Received: by mail-lb0-f175.google.com with SMTP id u10so363271lbd.20 for ; Mon, 20 Oct 2014 22:43:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=5fA8LYp8CF2kJE8aFTLhrD74NqKqjqm98aTP4VxZUaM=; b=jFjMFXxJAv3FkXzlYpdSWVM5hdBmsj6WI66z1WsyRP16jSStsBnVJ19CC+ykOewtEZ +q+k+ac2wd7TiIcUvMKKJUFDf75z3zNcc0ogg10eJz6dKHcbJgOc//fLXbpQN5ACS1tH p8yOZwwtkVBm1Rntj9su8N3mQXLHGg2pnz9jYj+vFkjuOv+nekHX3eWP/82C062eHWA6 SLc7yB9NMUOcQ52kuQ+Vnms6JzBi4H+X1RU4iCkhaJ5UYg4xagO05LIbM25aHBHTZRMq FxAz38oCv3ydS4uN6lMAuNcPBRGMM3AbgCek2xEqYbQ4tN+QHiQtfHiPno4Qn4xrIhI0 Vn6w== MIME-Version: 1.0 X-Received: by 10.112.147.225 with SMTP id tn1mr32059159lbb.37.1413870239164; Mon, 20 Oct 2014 22:43:59 -0700 (PDT) Sender: crodr001@gmail.com Received: by 10.112.131.66 with HTTP; Mon, 20 Oct 2014 22:43:59 -0700 (PDT) In-Reply-To: <201410210106.s9L16wXd016764@svn.freebsd.org> References: <201410210106.s9L16wXd016764@svn.freebsd.org> Date: Mon, 20 Oct 2014 22:43:59 -0700 X-Google-Sender-Auth: fOktHhb-SLwq2XolSZUGJZRyU4A Message-ID: Subject: Re: svn commit: r273356 - head/sys/amd64/amd64 From: Craig Rodrigues To: src-committers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 05:44:02 -0000 Hi, Just to add some background to this fix, in the https://jenkins.freebsd.org cluster, we are using several bhyve VM's to host the environment for doing builds and tests. We are hammering on the VM's quite nicely. We found one problem where the bhyve binary would crash. Neel looked at the problem, and came up with this fix. Thanks, Neel! -- Craig On Mon, Oct 20, 2014 at 6:06 PM, Neel Natu wrote: > Author: neel > Date: Tue Oct 21 01:06:58 2014 > New Revision: 273356 > URL: https://svnweb.freebsd.org/changeset/base/273356 > > Log: > Fix a race in pmap_emulate_accessed_dirty() that could trigger a EPT > misconfiguration VM-exit. > > An EPT misconfiguration is triggered when the processor encounters a PTE > that is writable but not readable (WR=10). On processors that require A/D > bit emulation PG_M and PG_A map to EPT_PG_WRITE and EPT_PG_READ > respectively. > > If the PTE is updated as in the following code snippet: > *pte |= PG_M; > *pte |= PG_A; > then it is possible for another processor to observe the PTE after the > PG_M > (aka EPT_PG_WRITE) bit is set but before PG_A (aka EPT_PG_READ) bit is > set. > > This will trigger an EPT misconfiguration VM-exit on the other processor. > > Reported by: rodrigc > Reviewed by: grehan > MFC after: 3 days > > Modified: > head/sys/amd64/amd64/pmap.c > > Modified: head/sys/amd64/amd64/pmap.c > > ============================================================================== > --- head/sys/amd64/amd64/pmap.c Tue Oct 21 00:07:37 2014 (r273355) > +++ head/sys/amd64/amd64/pmap.c Tue Oct 21 01:06:58 2014 (r273356) > @@ -6810,9 +6810,19 @@ retry: > if (ftype == VM_PROT_WRITE) { > if ((*pte & PG_RW) == 0) > goto done; > - *pte |= PG_M; > + /* > + * Set the modified and accessed bits simultaneously. > + * > + * Intel EPT PTEs that do software emulation of A/D bits > map > + * PG_A and PG_M to EPT_PG_READ and EPT_PG_WRITE > respectively. > + * An EPT misconfiguration is triggered if the PTE is > writable > + * but not readable (WR=10). This is avoided by setting > PG_A > + * and PG_M simultaneously. > + */ > + *pte |= PG_M | PG_A; > + } else { > + *pte |= PG_A; > } > - *pte |= PG_A; > > /* try to promote the mapping */ > if (va < VM_MAXUSER_ADDRESS) > > From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 05:45:58 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A16AEAA3; Tue, 21 Oct 2014 05:45:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8DB0330B; Tue, 21 Oct 2014 05:45:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L5jwKo048500; Tue, 21 Oct 2014 05:45:58 GMT (envelope-from bryanv@FreeBSD.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L5jwbP048499; Tue, 21 Oct 2014 05:45:58 GMT (envelope-from bryanv@FreeBSD.org) Message-Id: <201410210545.s9L5jwbP048499@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bryanv set sender to bryanv@FreeBSD.org using -f From: Bryan Venteicher Date: Tue, 21 Oct 2014 05:45:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273371 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 05:45:58 -0000 Author: bryanv Date: Tue Oct 21 05:45:57 2014 New Revision: 273371 URL: https://svnweb.freebsd.org/changeset/base/273371 Log: Use the size of the Ethernet address, not the entire header, when copying into forwarding entry. Reported by: Coverity CID: 1248849 Modified: head/sys/net/if_vxlan.c Modified: head/sys/net/if_vxlan.c ============================================================================== --- head/sys/net/if_vxlan.c Tue Oct 21 05:19:08 2014 (r273370) +++ head/sys/net/if_vxlan.c Tue Oct 21 05:45:57 2014 (r273371) @@ -716,7 +716,7 @@ vxlan_ftable_entry_init(struct vxlan_sof fe->vxlfe_flags = flags; fe->vxlfe_expire = time_uptime + sc->vxl_ftable_timeout; - memcpy(fe->vxlfe_mac, mac, ETHER_HDR_LEN); + memcpy(fe->vxlfe_mac, mac, ETHER_ADDR_LEN); vxlan_sockaddr_copy(&fe->vxlfe_raddr, sa); } From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 06:23:15 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5044634F; Tue, 21 Oct 2014 06:23:15 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3BF5F8F7; Tue, 21 Oct 2014 06:23:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L6NFIw067151; Tue, 21 Oct 2014 06:23:15 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L6NFUh067150; Tue, 21 Oct 2014 06:23:15 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410210623.s9L6NFUh067150@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 21 Oct 2014 06:23:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273372 - stable/10/share/man/man4 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 06:23:15 -0000 Author: mav Date: Tue Oct 21 06:23:14 2014 New Revision: 273372 URL: https://svnweb.freebsd.org/changeset/base/273372 Log: MFC r262294 (by ivoras): Explain how and where kern.cam.ada.write_cache can be set in practical situations. Modified: stable/10/share/man/man4/ada.4 Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/ada.4 ============================================================================== --- stable/10/share/man/man4/ada.4 Tue Oct 21 05:45:57 2014 (r273371) +++ stable/10/share/man/man4/ada.4 Tue Oct 21 06:23:14 2014 (r273372) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 8, 2012 +.Dd February 21, 2014 .Dt ADA 4 .Os .Sh NAME @@ -129,8 +129,13 @@ The default is currently enabled. These variables determines whether device write cache should be enabled globally or per-device or disabled. Set to 1 to enable write cache, 0 to disable, -1 to leave it as-is. -Values modified in runtime take effect only after device reset. -The global default is currently enabled. +Values modified at runtime take effect only after device reset +.Pq using the reset subcommand of Xr camcontrol 8 . +Because of that, this setting should be changed in +.Pa /boot/loader.conf +instead of +.Pa /etc/sysctl.conf . +The global default is currently 1. The per-device default is to leave it as-is (follow global setting). .El .Sh FILES From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 06:24:16 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 646AF486; Tue, 21 Oct 2014 06:24:16 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5026A900; Tue, 21 Oct 2014 06:24:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L6OGoG067339; Tue, 21 Oct 2014 06:24:16 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L6OGXU067338; Tue, 21 Oct 2014 06:24:16 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410210624.s9L6OGXU067338@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 21 Oct 2014 06:24:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273373 - stable/10/share/man/man4 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 06:24:16 -0000 Author: mav Date: Tue Oct 21 06:24:15 2014 New Revision: 273373 URL: https://svnweb.freebsd.org/changeset/base/273373 Log: MFC r262332 (by ivoras): Grammar fix Modified: stable/10/share/man/man4/ada.4 Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/ada.4 ============================================================================== --- stable/10/share/man/man4/ada.4 Tue Oct 21 06:23:14 2014 (r273372) +++ stable/10/share/man/man4/ada.4 Tue Oct 21 06:24:15 2014 (r273373) @@ -126,7 +126,7 @@ The default is currently enabled. .It Va kern.cam.ada.write_cache .It Va kern.cam.ada. Ns Ar X Ns Va .write_cache .Pp -These variables determines whether device write cache should be enabled +These variables determine whether device write cache should be enabled globally or per-device or disabled. Set to 1 to enable write cache, 0 to disable, -1 to leave it as-is. Values modified at runtime take effect only after device reset From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 06:25:42 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3A9B45EA; Tue, 21 Oct 2014 06:25:42 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2667B914; Tue, 21 Oct 2014 06:25:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L6PgU1067601; Tue, 21 Oct 2014 06:25:42 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L6PgQk067600; Tue, 21 Oct 2014 06:25:42 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410210625.s9L6PgQk067600@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 21 Oct 2014 06:25:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273374 - stable/10/share/man/man4 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 06:25:42 -0000 Author: mav Date: Tue Oct 21 06:25:41 2014 New Revision: 273374 URL: https://svnweb.freebsd.org/changeset/base/273374 Log: MFC r271926: Mention read_ahead tunables/sysctls. Modified: stable/10/share/man/man4/ada.4 Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/ada.4 ============================================================================== --- stable/10/share/man/man4/ada.4 Tue Oct 21 06:24:15 2014 (r273373) +++ stable/10/share/man/man4/ada.4 Tue Oct 21 06:25:41 2014 (r273374) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 21, 2014 +.Dd September 21, 2014 .Dt ADA 4 .Os .Sh NAME @@ -123,11 +123,13 @@ seconds. This variable determines whether to spin-down disks when shutting down. Set to 1 to enable spin-down, 0 to disable. The default is currently enabled. +.It Va kern.cam.ada.read_ahead +.It Va kern.cam.ada. Ns Ar X Ns Va .read_ahead .It Va kern.cam.ada.write_cache .It Va kern.cam.ada. Ns Ar X Ns Va .write_cache .Pp -These variables determine whether device write cache should be enabled -globally or per-device or disabled. +These variables determine whether device read-ahead and write caches +should be enabled globally or per-device or disabled. Set to 1 to enable write cache, 0 to disable, -1 to leave it as-is. Values modified at runtime take effect only after device reset .Pq using the reset subcommand of Xr camcontrol 8 . From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 07:10:45 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C176EBB4; Tue, 21 Oct 2014 07:10:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A9F7FCD3; Tue, 21 Oct 2014 07:10:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L7AjL9086943; Tue, 21 Oct 2014 07:10:45 GMT (envelope-from neel@FreeBSD.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L7Ai8S086934; Tue, 21 Oct 2014 07:10:44 GMT (envelope-from neel@FreeBSD.org) Message-Id: <201410210710.s9L7Ai8S086934@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: neel set sender to neel@FreeBSD.org using -f From: Neel Natu Date: Tue, 21 Oct 2014 07:10:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273375 - in head: sys/amd64/include sys/amd64/vmm sys/amd64/vmm/amd sys/amd64/vmm/intel sys/amd64/vmm/io sys/modules/vmm usr.sbin/bhyve usr.sbin/bhyvectl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 07:10:46 -0000 Author: neel Date: Tue Oct 21 07:10:43 2014 New Revision: 273375 URL: https://svnweb.freebsd.org/changeset/base/273375 Log: Merge projects/bhyve_svm into HEAD. After this change bhyve supports AMD processors with the SVM/AMD-V hardware extensions. More details available here: https://lists.freebsd.org/pipermail/freebsd-virtualization/2014-October/002905.html Submitted by: Anish Gupta (akgupt3@gmail.com) Tested by: Benjamin Perrault (ben.perrault@gmail.com) Tested by: Willem Jan Withagen (wjw@digiware.nl) Added: - copied unchanged from r273369, projects/bhyve_svm/sys/amd64/vmm/amd/npt.c - copied unchanged from r273369, projects/bhyve_svm/sys/amd64/vmm/amd/npt.h - copied unchanged from r273369, projects/bhyve_svm/sys/amd64/vmm/amd/svm.c - copied unchanged from r273369, projects/bhyve_svm/sys/amd64/vmm/amd/svm.h - copied unchanged from r273369, projects/bhyve_svm/sys/amd64/vmm/amd/svm_genassym.c - copied unchanged from r273369, projects/bhyve_svm/sys/amd64/vmm/amd/svm_msr.c - copied unchanged from r273369, projects/bhyve_svm/sys/amd64/vmm/amd/svm_msr.h - copied unchanged from r273369, projects/bhyve_svm/sys/amd64/vmm/amd/svm_softc.h - copied unchanged from r273369, projects/bhyve_svm/sys/amd64/vmm/amd/svm_support.S - copied unchanged from r273369, projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.c - copied unchanged from r273369, projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.h Directory Properties: head/sys/amd64/vmm/amd/npt.c (props changed) head/sys/amd64/vmm/amd/npt.h (props changed) head/sys/amd64/vmm/amd/svm.c (props changed) head/sys/amd64/vmm/amd/svm.h (props changed) head/sys/amd64/vmm/amd/svm_genassym.c (props changed) head/sys/amd64/vmm/amd/svm_msr.c (props changed) head/sys/amd64/vmm/amd/svm_msr.h (props changed) head/sys/amd64/vmm/amd/svm_softc.h (props changed) head/sys/amd64/vmm/amd/svm_support.S (props changed) head/sys/amd64/vmm/amd/vmcb.c (props changed) head/sys/amd64/vmm/amd/vmcb.h (props changed) Modified: head/sys/amd64/include/vmm.h head/sys/amd64/include/vmm_instruction_emul.h head/sys/amd64/vmm/amd/amdv.c head/sys/amd64/vmm/intel/vmx.c head/sys/amd64/vmm/io/vlapic.c head/sys/amd64/vmm/vmm.c head/sys/amd64/vmm/vmm_instruction_emul.c head/sys/amd64/vmm/x86.c head/sys/modules/vmm/Makefile head/usr.sbin/bhyve/bhyverun.c head/usr.sbin/bhyve/xmsr.c head/usr.sbin/bhyvectl/bhyvectl.c Modified: head/sys/amd64/include/vmm.h ============================================================================== --- head/sys/amd64/include/vmm.h Tue Oct 21 06:25:41 2014 (r273374) +++ head/sys/amd64/include/vmm.h Tue Oct 21 07:10:43 2014 (r273375) @@ -487,6 +487,7 @@ enum vm_exitcode { VM_EXITCODE_TASK_SWITCH, VM_EXITCODE_MONITOR, VM_EXITCODE_MWAIT, + VM_EXITCODE_SVM, VM_EXITCODE_MAX }; @@ -564,6 +565,14 @@ struct vm_exit { int inst_type; int inst_error; } vmx; + /* + * SVM specific payload. + */ + struct { + uint64_t exitcode; + uint64_t exitinfo1; + uint64_t exitinfo2; + } svm; struct { uint32_t code; /* ecx value */ uint64_t wval; Modified: head/sys/amd64/include/vmm_instruction_emul.h ============================================================================== --- head/sys/amd64/include/vmm_instruction_emul.h Tue Oct 21 06:25:41 2014 (r273374) +++ head/sys/amd64/include/vmm_instruction_emul.h Tue Oct 21 07:10:43 2014 (r273375) @@ -93,7 +93,7 @@ int vmm_fetch_instruction(struct vm *vm, int vmm_gla2gpa(struct vm *vm, int vcpuid, struct vm_guest_paging *paging, uint64_t gla, int prot, uint64_t *gpa); -void vie_init(struct vie *vie); +void vie_init(struct vie *vie, const char *inst_bytes, int inst_length); /* * Decode the instruction fetched into 'vie' so it can be emulated. Modified: head/sys/amd64/vmm/amd/amdv.c ============================================================================== --- head/sys/amd64/vmm/amd/amdv.c Tue Oct 21 06:25:41 2014 (r273374) +++ head/sys/amd64/vmm/amd/amdv.c Tue Oct 21 07:10:43 2014 (r273375) @@ -38,149 +38,6 @@ __FBSDID("$FreeBSD$"); #include "io/iommu.h" static int -amdv_init(int ipinum) -{ - - printf("amdv_init: not implemented\n"); - return (ENXIO); -} - -static int -amdv_cleanup(void) -{ - - printf("amdv_cleanup: not implemented\n"); - return (ENXIO); -} - -static void -amdv_resume(void) -{ -} - -static void * -amdv_vminit(struct vm *vm, struct pmap *pmap) -{ - - printf("amdv_vminit: not implemented\n"); - return (NULL); -} - -static int -amdv_vmrun(void *arg, int vcpu, register_t rip, struct pmap *pmap, - void *rptr, void *sptr) -{ - - printf("amdv_vmrun: not implemented\n"); - return (ENXIO); -} - -static void -amdv_vmcleanup(void *arg) -{ - - printf("amdv_vmcleanup: not implemented\n"); - return; -} - -static int -amdv_getreg(void *arg, int vcpu, int regnum, uint64_t *retval) -{ - - printf("amdv_getreg: not implemented\n"); - return (EINVAL); -} - -static int -amdv_setreg(void *arg, int vcpu, int regnum, uint64_t val) -{ - - printf("amdv_setreg: not implemented\n"); - return (EINVAL); -} - -static int -amdv_getdesc(void *vmi, int vcpu, int num, struct seg_desc *desc) -{ - - printf("amdv_get_desc: not implemented\n"); - return (EINVAL); -} - -static int -amdv_setdesc(void *vmi, int vcpu, int num, struct seg_desc *desc) -{ - - printf("amdv_get_desc: not implemented\n"); - return (EINVAL); -} - -static int -amdv_getcap(void *arg, int vcpu, int type, int *retval) -{ - - printf("amdv_getcap: not implemented\n"); - return (EINVAL); -} - -static int -amdv_setcap(void *arg, int vcpu, int type, int val) -{ - - printf("amdv_setcap: not implemented\n"); - return (EINVAL); -} - -static struct vmspace * -amdv_vmspace_alloc(vm_offset_t min, vm_offset_t max) -{ - - printf("amdv_vmspace_alloc: not implemented\n"); - return (NULL); -} - -static void -amdv_vmspace_free(struct vmspace *vmspace) -{ - - printf("amdv_vmspace_free: not implemented\n"); - return; -} - -static struct vlapic * -amdv_vlapic_init(void *arg, int vcpuid) -{ - - panic("amdv_vlapic_init: not implmented"); -} - -static void -amdv_vlapic_cleanup(void *arg, struct vlapic *vlapic) -{ - - panic("amdv_vlapic_cleanup: not implemented"); -} - -struct vmm_ops vmm_ops_amd = { - amdv_init, - amdv_cleanup, - amdv_resume, - amdv_vminit, - amdv_vmrun, - amdv_vmcleanup, - amdv_getreg, - amdv_setreg, - amdv_getdesc, - amdv_setdesc, - amdv_getcap, - amdv_setcap, - amdv_vmspace_alloc, - amdv_vmspace_free, - amdv_vlapic_init, - amdv_vlapic_cleanup, -}; - -static int amd_iommu_init(void) { Copied: head/sys/amd64/vmm/amd/npt.c (from r273369, projects/bhyve_svm/sys/amd64/vmm/amd/npt.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/amd64/vmm/amd/npt.c Tue Oct 21 07:10:43 2014 (r273375, copy of r273369, projects/bhyve_svm/sys/amd64/vmm/amd/npt.c) @@ -0,0 +1,87 @@ +/*- + * Copyright (c) 2013 Anish Gupta (akgupt3@gmail.com) + * 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, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include "npt.h" + +SYSCTL_DECL(_hw_vmm); +SYSCTL_NODE(_hw_vmm, OID_AUTO, npt, CTLFLAG_RW, NULL, NULL); + +static int npt_flags; +SYSCTL_INT(_hw_vmm_npt, OID_AUTO, pmap_flags, CTLFLAG_RD, + &npt_flags, 0, NULL); + +#define NPT_IPIMASK 0xFF + +/* + * AMD nested page table init. + */ +int +svm_npt_init(int ipinum) +{ + int enable_superpage = 1; + + npt_flags = ipinum & NPT_IPIMASK; + TUNABLE_INT_FETCH("hw.vmm.npt.enable_superpage", &enable_superpage); + if (enable_superpage) + npt_flags |= PMAP_PDE_SUPERPAGE; + + return (0); +} + +static int +npt_pinit(pmap_t pmap) +{ + + return (pmap_pinit_type(pmap, PT_RVI, npt_flags)); +} + +struct vmspace * +svm_npt_alloc(vm_offset_t min, vm_offset_t max) +{ + + return (vmspace_alloc(min, max, npt_pinit)); +} + +void +svm_npt_free(struct vmspace *vmspace) +{ + + vmspace_free(vmspace); +} Copied: head/sys/amd64/vmm/amd/npt.h (from r273369, projects/bhyve_svm/sys/amd64/vmm/amd/npt.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/amd64/vmm/amd/npt.h Tue Oct 21 07:10:43 2014 (r273375, copy of r273369, projects/bhyve_svm/sys/amd64/vmm/amd/npt.h) @@ -0,0 +1,36 @@ +/*- + * Copyright (c) 2013 Anish Gupta (akgupt3@gmail.com) + * 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, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _SVM_NPT_H_ +#define _SVM_NPT_H_ + +int svm_npt_init(int ipinum); +struct vmspace *svm_npt_alloc(vm_offset_t min, vm_offset_t max); +void svm_npt_free(struct vmspace *vmspace); + +#endif /* _SVM_NPT_H_ */ Copied: head/sys/amd64/vmm/amd/svm.c (from r273369, projects/bhyve_svm/sys/amd64/vmm/amd/svm.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/amd64/vmm/amd/svm.c Tue Oct 21 07:10:43 2014 (r273375, copy of r273369, projects/bhyve_svm/sys/amd64/vmm/amd/svm.c) @@ -0,0 +1,2092 @@ +/*- + * Copyright (c) 2013, Anish Gupta (akgupt3@gmail.com) + * 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, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "vmm_lapic.h" +#include "vmm_stat.h" +#include "vmm_ktr.h" +#include "vmm_ioport.h" +#include "vatpic.h" +#include "vlapic.h" +#include "vlapic_priv.h" + +#include "x86.h" +#include "vmcb.h" +#include "svm.h" +#include "svm_softc.h" +#include "svm_msr.h" +#include "npt.h" + +SYSCTL_DECL(_hw_vmm); +SYSCTL_NODE(_hw_vmm, OID_AUTO, svm, CTLFLAG_RW, NULL, NULL); + +/* + * SVM CPUID function 0x8000_000A, edx bit decoding. + */ +#define AMD_CPUID_SVM_NP BIT(0) /* Nested paging or RVI */ +#define AMD_CPUID_SVM_LBR BIT(1) /* Last branch virtualization */ +#define AMD_CPUID_SVM_SVML BIT(2) /* SVM lock */ +#define AMD_CPUID_SVM_NRIP_SAVE BIT(3) /* Next RIP is saved */ +#define AMD_CPUID_SVM_TSC_RATE BIT(4) /* TSC rate control. */ +#define AMD_CPUID_SVM_VMCB_CLEAN BIT(5) /* VMCB state caching */ +#define AMD_CPUID_SVM_FLUSH_BY_ASID BIT(6) /* Flush by ASID */ +#define AMD_CPUID_SVM_DECODE_ASSIST BIT(7) /* Decode assist */ +#define AMD_CPUID_SVM_PAUSE_INC BIT(10) /* Pause intercept filter. */ +#define AMD_CPUID_SVM_PAUSE_FTH BIT(12) /* Pause filter threshold */ + +#define VMCB_CACHE_DEFAULT (VMCB_CACHE_ASID | \ + VMCB_CACHE_IOPM | \ + VMCB_CACHE_I | \ + VMCB_CACHE_TPR | \ + VMCB_CACHE_CR2 | \ + VMCB_CACHE_CR | \ + VMCB_CACHE_DT | \ + VMCB_CACHE_SEG | \ + VMCB_CACHE_NP) + +static uint32_t vmcb_clean = VMCB_CACHE_DEFAULT; +SYSCTL_INT(_hw_vmm_svm, OID_AUTO, vmcb_clean, CTLFLAG_RDTUN, &vmcb_clean, + 0, NULL); + +static MALLOC_DEFINE(M_SVM, "svm", "svm"); +static MALLOC_DEFINE(M_SVM_VLAPIC, "svm-vlapic", "svm-vlapic"); + +/* Per-CPU context area. */ +extern struct pcpu __pcpu[]; + +static uint32_t svm_feature; /* AMD SVM features. */ +SYSCTL_UINT(_hw_vmm_svm, OID_AUTO, features, CTLFLAG_RD, &svm_feature, 0, + "SVM features advertised by CPUID.8000000AH:EDX"); + +static int disable_npf_assist; +SYSCTL_INT(_hw_vmm_svm, OID_AUTO, disable_npf_assist, CTLFLAG_RWTUN, + &disable_npf_assist, 0, NULL); + +/* Maximum ASIDs supported by the processor */ +static uint32_t nasid; +SYSCTL_UINT(_hw_vmm_svm, OID_AUTO, num_asids, CTLFLAG_RD, &nasid, 0, + "Number of ASIDs supported by this processor"); + +/* Current ASID generation for each host cpu */ +static struct asid asid[MAXCPU]; + +/* + * SVM host state saved area of size 4KB for each core. + */ +static uint8_t hsave[MAXCPU][PAGE_SIZE] __aligned(PAGE_SIZE); + +static VMM_STAT_AMD(VCPU_EXITINTINFO, "VM exits during event delivery"); +static VMM_STAT_AMD(VCPU_INTINFO_INJECTED, "Events pending at VM entry"); +static VMM_STAT_AMD(VMEXIT_VINTR, "VM exits due to interrupt window"); + +static int svm_setreg(void *arg, int vcpu, int ident, uint64_t val); + +static __inline int +flush_by_asid(void) +{ + + return (svm_feature & AMD_CPUID_SVM_FLUSH_BY_ASID); +} + +static __inline int +decode_assist(void) +{ + + return (svm_feature & AMD_CPUID_SVM_DECODE_ASSIST); +} + +static void +svm_disable(void *arg __unused) +{ + uint64_t efer; + + efer = rdmsr(MSR_EFER); + efer &= ~EFER_SVM; + wrmsr(MSR_EFER, efer); +} + +/* + * Disable SVM on all CPUs. + */ +static int +svm_cleanup(void) +{ + + smp_rendezvous(NULL, svm_disable, NULL, NULL); + return (0); +} + +/* + * Verify that all the features required by bhyve are available. + */ +static int +check_svm_features(void) +{ + u_int regs[4]; + + /* CPUID Fn8000_000A is for SVM */ + do_cpuid(0x8000000A, regs); + svm_feature = regs[3]; + + printf("SVM: Revision %d\n", regs[0] & 0xFF); + printf("SVM: NumASID %u\n", regs[1]); + + nasid = regs[1]; + KASSERT(nasid > 1, ("Insufficient ASIDs for guests: %#x", nasid)); + + printf("SVM: Features 0x%b\n", svm_feature, + "\020" + "\001NP" /* Nested paging */ + "\002LbrVirt" /* LBR virtualization */ + "\003SVML" /* SVM lock */ + "\004NRIPS" /* NRIP save */ + "\005TscRateMsr" /* MSR based TSC rate control */ + "\006VmcbClean" /* VMCB clean bits */ + "\007FlushByAsid" /* Flush by ASID */ + "\010DecodeAssist" /* Decode assist */ + "\011" + "\012" + "\013PauseFilter" + "\014" + "\015PauseFilterThreshold" + "\016AVIC" + ); + + /* bhyve requires the Nested Paging feature */ + if (!(svm_feature & AMD_CPUID_SVM_NP)) { + printf("SVM: Nested Paging feature not available.\n"); + return (ENXIO); + } + + /* bhyve requires the NRIP Save feature */ + if (!(svm_feature & AMD_CPUID_SVM_NRIP_SAVE)) { + printf("SVM: NRIP Save feature not available.\n"); + return (ENXIO); + } + + return (0); +} + +static void +svm_enable(void *arg __unused) +{ + uint64_t efer; + + efer = rdmsr(MSR_EFER); + efer |= EFER_SVM; + wrmsr(MSR_EFER, efer); + + wrmsr(MSR_VM_HSAVE_PA, vtophys(hsave[curcpu])); +} + +/* + * Return 1 if SVM is enabled on this processor and 0 otherwise. + */ +static int +svm_available(void) +{ + uint64_t msr; + + /* Section 15.4 Enabling SVM from APM2. */ + if ((amd_feature2 & AMDID2_SVM) == 0) { + printf("SVM: not available.\n"); + return (0); + } + + msr = rdmsr(MSR_VM_CR); + if ((msr & VM_CR_SVMDIS) != 0) { + printf("SVM: disabled by BIOS.\n"); + return (0); + } + + return (1); +} + +static int +svm_init(int ipinum) +{ + int error, cpu; + + if (!svm_available()) + return (ENXIO); + + error = check_svm_features(); + if (error) + return (error); + + vmcb_clean &= VMCB_CACHE_DEFAULT; + + for (cpu = 0; cpu < MAXCPU; cpu++) { + /* + * Initialize the host ASIDs to their "highest" valid values. + * + * The next ASID allocation will rollover both 'gen' and 'num' + * and start off the sequence at {1,1}. + */ + asid[cpu].gen = ~0UL; + asid[cpu].num = nasid - 1; + } + + svm_msr_init(); + svm_npt_init(ipinum); + + /* Enable SVM on all CPUs */ + smp_rendezvous(NULL, svm_enable, NULL, NULL); + + return (0); +} + +static void +svm_restore(void) +{ + + svm_enable(NULL); +} + +/* Pentium compatible MSRs */ +#define MSR_PENTIUM_START 0 +#define MSR_PENTIUM_END 0x1FFF +/* AMD 6th generation and Intel compatible MSRs */ +#define MSR_AMD6TH_START 0xC0000000UL +#define MSR_AMD6TH_END 0xC0001FFFUL +/* AMD 7th and 8th generation compatible MSRs */ +#define MSR_AMD7TH_START 0xC0010000UL +#define MSR_AMD7TH_END 0xC0011FFFUL + +/* + * Get the index and bit position for a MSR in permission bitmap. + * Two bits are used for each MSR: lower bit for read and higher bit for write. + */ +static int +svm_msr_index(uint64_t msr, int *index, int *bit) +{ + uint32_t base, off; + + *index = -1; + *bit = (msr % 4) * 2; + base = 0; + + if (msr >= MSR_PENTIUM_START && msr <= MSR_PENTIUM_END) { + *index = msr / 4; + return (0); + } + + base += (MSR_PENTIUM_END - MSR_PENTIUM_START + 1); + if (msr >= MSR_AMD6TH_START && msr <= MSR_AMD6TH_END) { + off = (msr - MSR_AMD6TH_START); + *index = (off + base) / 4; + return (0); + } + + base += (MSR_AMD6TH_END - MSR_AMD6TH_START + 1); + if (msr >= MSR_AMD7TH_START && msr <= MSR_AMD7TH_END) { + off = (msr - MSR_AMD7TH_START); + *index = (off + base) / 4; + return (0); + } + + return (EINVAL); +} + +/* + * Allow vcpu to read or write the 'msr' without trapping into the hypervisor. + */ +static void +svm_msr_perm(uint8_t *perm_bitmap, uint64_t msr, bool read, bool write) +{ + int index, bit, error; + + error = svm_msr_index(msr, &index, &bit); + KASSERT(error == 0, ("%s: invalid msr %#lx", __func__, msr)); + KASSERT(index >= 0 && index < SVM_MSR_BITMAP_SIZE, + ("%s: invalid index %d for msr %#lx", __func__, index, msr)); + KASSERT(bit >= 0 && bit <= 6, ("%s: invalid bit position %d " + "msr %#lx", __func__, bit, msr)); + + if (read) + perm_bitmap[index] &= ~(1UL << bit); + + if (write) + perm_bitmap[index] &= ~(2UL << bit); +} + +static void +svm_msr_rw_ok(uint8_t *perm_bitmap, uint64_t msr) +{ + + svm_msr_perm(perm_bitmap, msr, true, true); +} + +static void +svm_msr_rd_ok(uint8_t *perm_bitmap, uint64_t msr) +{ + + svm_msr_perm(perm_bitmap, msr, true, false); +} + +static __inline int +svm_get_intercept(struct svm_softc *sc, int vcpu, int idx, uint32_t bitmask) +{ + struct vmcb_ctrl *ctrl; + + KASSERT(idx >=0 && idx < 5, ("invalid intercept index %d", idx)); + + ctrl = svm_get_vmcb_ctrl(sc, vcpu); + return (ctrl->intercept[idx] & bitmask ? 1 : 0); +} + +static __inline void +svm_set_intercept(struct svm_softc *sc, int vcpu, int idx, uint32_t bitmask, + int enabled) +{ + struct vmcb_ctrl *ctrl; + uint32_t oldval; + + KASSERT(idx >=0 && idx < 5, ("invalid intercept index %d", idx)); + + ctrl = svm_get_vmcb_ctrl(sc, vcpu); + oldval = ctrl->intercept[idx]; + + if (enabled) + ctrl->intercept[idx] |= bitmask; + else + ctrl->intercept[idx] &= ~bitmask; + + if (ctrl->intercept[idx] != oldval) { + svm_set_dirty(sc, vcpu, VMCB_CACHE_I); + VCPU_CTR3(sc->vm, vcpu, "intercept[%d] modified " + "from %#x to %#x", idx, oldval, ctrl->intercept[idx]); + } +} + +static __inline void +svm_disable_intercept(struct svm_softc *sc, int vcpu, int off, uint32_t bitmask) +{ + + svm_set_intercept(sc, vcpu, off, bitmask, 0); +} + +static __inline void +svm_enable_intercept(struct svm_softc *sc, int vcpu, int off, uint32_t bitmask) +{ + + svm_set_intercept(sc, vcpu, off, bitmask, 1); +} + +static void +vmcb_init(struct svm_softc *sc, int vcpu, uint64_t iopm_base_pa, + uint64_t msrpm_base_pa, uint64_t np_pml4) +{ + struct vmcb_ctrl *ctrl; + struct vmcb_state *state; + uint32_t mask; + int n; + + ctrl = svm_get_vmcb_ctrl(sc, vcpu); + state = svm_get_vmcb_state(sc, vcpu); + + ctrl->iopm_base_pa = iopm_base_pa; + ctrl->msrpm_base_pa = msrpm_base_pa; + + /* Enable nested paging */ + ctrl->np_enable = 1; + ctrl->n_cr3 = np_pml4; + + /* + * Intercept accesses to the control registers that are not shadowed + * in the VMCB - i.e. all except cr0, cr2, cr3, cr4 and cr8. + */ + for (n = 0; n < 16; n++) { + mask = (BIT(n) << 16) | BIT(n); + if (n == 0 || n == 2 || n == 3 || n == 4 || n == 8) + svm_disable_intercept(sc, vcpu, VMCB_CR_INTCPT, mask); + else + svm_enable_intercept(sc, vcpu, VMCB_CR_INTCPT, mask); + } + + /* Intercept Machine Check exceptions. */ + svm_enable_intercept(sc, vcpu, VMCB_EXC_INTCPT, BIT(IDT_MC)); + + /* Intercept various events (for e.g. I/O, MSR and CPUID accesses) */ + svm_enable_intercept(sc, vcpu, VMCB_CTRL1_INTCPT, VMCB_INTCPT_IO); + svm_enable_intercept(sc, vcpu, VMCB_CTRL1_INTCPT, VMCB_INTCPT_MSR); + svm_enable_intercept(sc, vcpu, VMCB_CTRL1_INTCPT, VMCB_INTCPT_CPUID); + svm_enable_intercept(sc, vcpu, VMCB_CTRL1_INTCPT, VMCB_INTCPT_INTR); + svm_enable_intercept(sc, vcpu, VMCB_CTRL1_INTCPT, VMCB_INTCPT_INIT); + svm_enable_intercept(sc, vcpu, VMCB_CTRL1_INTCPT, VMCB_INTCPT_NMI); + svm_enable_intercept(sc, vcpu, VMCB_CTRL1_INTCPT, VMCB_INTCPT_SMI); + svm_enable_intercept(sc, vcpu, VMCB_CTRL1_INTCPT, VMCB_INTCPT_SHUTDOWN); + svm_enable_intercept(sc, vcpu, VMCB_CTRL1_INTCPT, + VMCB_INTCPT_FERR_FREEZE); + + /* + * From section "Canonicalization and Consistency Checks" in APMv2 + * the VMRUN intercept bit must be set to pass the consistency check. + */ + svm_enable_intercept(sc, vcpu, VMCB_CTRL2_INTCPT, VMCB_INTCPT_VMRUN); + + /* + * The ASID will be set to a non-zero value just before VMRUN. + */ + ctrl->asid = 0; + + /* + * Section 15.21.1, Interrupt Masking in EFLAGS + * Section 15.21.2, Virtualizing APIC.TPR + * + * This must be set for %rflag and %cr8 isolation of guest and host. + */ + ctrl->v_intr_masking = 1; + + /* Enable Last Branch Record aka LBR for debugging */ + ctrl->lbr_virt_en = 1; + state->dbgctl = BIT(0); + + /* EFER_SVM must always be set when the guest is executing */ + state->efer = EFER_SVM; + + /* Set up the PAT to power-on state */ + state->g_pat = PAT_VALUE(0, PAT_WRITE_BACK) | + PAT_VALUE(1, PAT_WRITE_THROUGH) | + PAT_VALUE(2, PAT_UNCACHED) | + PAT_VALUE(3, PAT_UNCACHEABLE) | + PAT_VALUE(4, PAT_WRITE_BACK) | + PAT_VALUE(5, PAT_WRITE_THROUGH) | + PAT_VALUE(6, PAT_UNCACHED) | + PAT_VALUE(7, PAT_UNCACHEABLE); +} + +/* + * Initialize a virtual machine. + */ +static void * +svm_vminit(struct vm *vm, pmap_t pmap) +{ + struct svm_softc *svm_sc; + struct svm_vcpu *vcpu; + vm_paddr_t msrpm_pa, iopm_pa, pml4_pa; + int i; + + svm_sc = malloc(sizeof (struct svm_softc), M_SVM, M_WAITOK | M_ZERO); + svm_sc->vm = vm; + svm_sc->nptp = (vm_offset_t)vtophys(pmap->pm_pml4); + + /* + * Intercept read and write accesses to all MSRs. + */ + memset(svm_sc->msr_bitmap, 0xFF, sizeof(svm_sc->msr_bitmap)); + + /* + * Access to the following MSRs is redirected to the VMCB when the + * guest is executing. Therefore it is safe to allow the guest to + * read/write these MSRs directly without hypervisor involvement. + */ + svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_GSBASE); + svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_FSBASE); + svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_KGSBASE); + + svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_STAR); + svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_LSTAR); + svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_CSTAR); + svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_SF_MASK); + svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_SYSENTER_CS_MSR); + svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_SYSENTER_ESP_MSR); + svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_SYSENTER_EIP_MSR); + svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_PAT); + + svm_msr_rd_ok(svm_sc->msr_bitmap, MSR_TSC); + + /* + * Intercept writes to make sure that the EFER_SVM bit is not cleared. + */ + svm_msr_rd_ok(svm_sc->msr_bitmap, MSR_EFER); + + /* Intercept access to all I/O ports. */ + memset(svm_sc->iopm_bitmap, 0xFF, sizeof(svm_sc->iopm_bitmap)); + + iopm_pa = vtophys(svm_sc->iopm_bitmap); + msrpm_pa = vtophys(svm_sc->msr_bitmap); + pml4_pa = svm_sc->nptp; + for (i = 0; i < VM_MAXCPU; i++) { + vcpu = svm_get_vcpu(svm_sc, i); + vcpu->lastcpu = NOCPU; + vcpu->vmcb_pa = vtophys(&vcpu->vmcb); + vmcb_init(svm_sc, i, iopm_pa, msrpm_pa, pml4_pa); + svm_msr_guest_init(svm_sc, i); + } + return (svm_sc); +} + +static int +svm_cpl(struct vmcb_state *state) +{ + + /* + * From APMv2: + * "Retrieve the CPL from the CPL field in the VMCB, not + * from any segment DPL" + */ + return (state->cpl); +} + +static enum vm_cpu_mode +svm_vcpu_mode(struct vmcb *vmcb) +{ + struct vmcb_segment seg; + struct vmcb_state *state; + int error; + + state = &vmcb->state; + + if (state->efer & EFER_LMA) { + error = vmcb_seg(vmcb, VM_REG_GUEST_CS, &seg); + KASSERT(error == 0, ("%s: vmcb_seg(cs) error %d", __func__, + error)); + + /* + * Section 4.8.1 for APM2, check if Code Segment has + * Long attribute set in descriptor. + */ + if (seg.attrib & VMCB_CS_ATTRIB_L) + return (CPU_MODE_64BIT); + else + return (CPU_MODE_COMPATIBILITY); + } else if (state->cr0 & CR0_PE) { + return (CPU_MODE_PROTECTED); + } else { + return (CPU_MODE_REAL); + } +} + +static enum vm_paging_mode +svm_paging_mode(uint64_t cr0, uint64_t cr4, uint64_t efer) +{ + + if ((cr0 & CR0_PG) == 0) + return (PAGING_MODE_FLAT); + if ((cr4 & CR4_PAE) == 0) + return (PAGING_MODE_32); + if (efer & EFER_LME) + return (PAGING_MODE_64); + else + return (PAGING_MODE_PAE); +} + +/* + * ins/outs utility routines + */ +static uint64_t +svm_inout_str_index(struct svm_regctx *regs, int in) +{ + uint64_t val; + + val = in ? regs->sctx_rdi : regs->sctx_rsi; + + return (val); +} + +static uint64_t +svm_inout_str_count(struct svm_regctx *regs, int rep) +{ + uint64_t val; + + val = rep ? regs->sctx_rcx : 1; + + return (val); +} + +static void +svm_inout_str_seginfo(struct svm_softc *svm_sc, int vcpu, int64_t info1, + int in, struct vm_inout_str *vis) +{ + int error, s; + + if (in) { + vis->seg_name = VM_REG_GUEST_ES; + } else { + /* The segment field has standard encoding */ + s = (info1 >> 10) & 0x7; + vis->seg_name = vm_segment_name(s); + } + + error = vmcb_getdesc(svm_sc, vcpu, vis->seg_name, &vis->seg_desc); + KASSERT(error == 0, ("%s: svm_getdesc error %d", __func__, error)); +} + +static int +svm_inout_str_addrsize(uint64_t info1) +{ + uint32_t size; + + size = (info1 >> 7) & 0x7; + switch (size) { + case 1: + return (2); /* 16 bit */ + case 2: + return (4); /* 32 bit */ + case 4: + return (8); /* 64 bit */ + default: + panic("%s: invalid size encoding %d", __func__, size); + } +} + +static void *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 07:24:59 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 481DDE60; Tue, 21 Oct 2014 07:24:59 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3460EE4C; Tue, 21 Oct 2014 07:24:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L7Ox54095483; Tue, 21 Oct 2014 07:24:59 GMT (envelope-from kevlo@FreeBSD.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L7OwNe095481; Tue, 21 Oct 2014 07:24:58 GMT (envelope-from kevlo@FreeBSD.org) Message-Id: <201410210724.s9L7OwNe095481@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kevlo set sender to kevlo@FreeBSD.org using -f From: Kevin Lo Date: Tue, 21 Oct 2014 07:24:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273376 - head/sys/dev/usb/controller X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 07:24:59 -0000 Author: kevlo Date: Tue Oct 21 07:24:58 2014 New Revision: 273376 URL: https://svnweb.freebsd.org/changeset/base/273376 Log: Add the Intel BayTrail USB device which needs port routing for USB 3.0. Tested on the BayTrail E3845 platform. Reviewed by: hselasky Modified: head/sys/dev/usb/controller/ehci_pci.c head/sys/dev/usb/controller/xhci_pci.c Modified: head/sys/dev/usb/controller/ehci_pci.c ============================================================================== --- head/sys/dev/usb/controller/ehci_pci.c Tue Oct 21 07:10:43 2014 (r273375) +++ head/sys/dev/usb/controller/ehci_pci.c Tue Oct 21 07:24:58 2014 (r273376) @@ -120,6 +120,8 @@ ehci_pci_match(device_t self) case 0x43961002: return ("AMD SB7x0/SB8x0/SB9x0 USB 2.0 controller"); + case 0x0f348086: + return ("Intel BayTrail USB 2.0 controller"); case 0x1d268086: return ("Intel Patsburg USB 2.0 controller"); case 0x1d2d8086: Modified: head/sys/dev/usb/controller/xhci_pci.c ============================================================================== --- head/sys/dev/usb/controller/xhci_pci.c Tue Oct 21 07:10:43 2014 (r273375) +++ head/sys/dev/usb/controller/xhci_pci.c Tue Oct 21 07:24:58 2014 (r273376) @@ -102,6 +102,8 @@ xhci_pci_match(device_t self) case 0x10421b21: return ("ASMedia ASM1042 USB 3.0 controller"); + case 0x0f358086: + return ("Intel Intel BayTrail USB 3.0 controller"); case 0x9c318086: case 0x1e318086: return ("Intel Panther Point USB 3.0 controller"); @@ -244,6 +246,7 @@ xhci_pci_attach(device_t self) /* On Intel chipsets reroute ports from EHCI to XHCI controller. */ switch (pci_get_devid(self)) { + case 0x0f358086: /* BayTrail */ case 0x9c318086: /* Panther Point */ case 0x1e318086: /* Panther Point */ case 0x8c318086: /* Lynx Point */ From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 07:31:27 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 09B83FFE; Tue, 21 Oct 2014 07:31:27 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E5FC9F09; Tue, 21 Oct 2014 07:31:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L7VQU8097046; Tue, 21 Oct 2014 07:31:26 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L7VMww096983; Tue, 21 Oct 2014 07:31:22 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201410210731.s9L7VMww096983@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 21 Oct 2014 07:31:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273377 - in head: share/man/man9 sys/amd64/amd64 sys/arm/arm sys/cam/scsi sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/dev/dtrace sys/compat/ndis sys/dev/acpi_support sys/de... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 07:31:27 -0000 Author: hselasky Date: Tue Oct 21 07:31:21 2014 New Revision: 273377 URL: https://svnweb.freebsd.org/changeset/base/273377 Log: Fix multiple incorrect SYSCTL arguments in the kernel: - Wrong integer type was specified. - Wrong or missing "access" specifier. The "access" specifier sometimes included the SYSCTL type, which it should not, except for procedural SYSCTL nodes. - Logical OR where binary OR was expected. - Properly assert the "access" argument passed to all SYSCTL macros, using the CTASSERT macro. This applies to both static- and dynamically created SYSCTLs. - Properly assert the the data type for both static and dynamic SYSCTLs. In the case of static SYSCTLs we only assert that the data pointed to by the SYSCTL data pointer has the correct size, hence there is no easy way to assert types in the C language outside a C-function. - Rewrote some code which doesn't pass a constant "access" specifier when creating dynamic SYSCTL nodes, which is now a requirement. - Updated "EXAMPLES" section in SYSCTL manual page. MFC after: 3 days Sponsored by: Mellanox Technologies Modified: head/share/man/man9/Makefile head/share/man/man9/sysctl.9 head/sys/amd64/amd64/fpu.c head/sys/arm/arm/busdma_machdep-v6.c head/sys/arm/arm/busdma_machdep.c head/sys/cam/scsi/scsi_sa.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c head/sys/cddl/dev/dtrace/dtrace_sysctl.c head/sys/compat/ndis/kern_ndis.c head/sys/dev/acpi_support/acpi_asus.c head/sys/dev/acpi_support/acpi_asus_wmi.c head/sys/dev/acpi_support/acpi_hp.c head/sys/dev/acpi_support/acpi_ibm.c head/sys/dev/acpi_support/acpi_rapidstart.c head/sys/dev/acpi_support/acpi_sony.c head/sys/dev/bxe/bxe.c head/sys/dev/cxgb/cxgb_sge.c head/sys/dev/cxgbe/t4_main.c head/sys/dev/e1000/if_em.c head/sys/dev/e1000/if_igb.c head/sys/dev/e1000/if_lem.c head/sys/dev/hatm/if_hatm.c head/sys/dev/ixgbe/ixgbe.c head/sys/dev/ixgbe/ixv.c head/sys/dev/ixl/if_ixl.c head/sys/dev/mpr/mpr.c head/sys/dev/mps/mps.c head/sys/dev/mrsas/mrsas.c head/sys/dev/mrsas/mrsas.h head/sys/dev/mxge/if_mxge.c head/sys/dev/oce/oce_sysctl.c head/sys/dev/qlxgb/qla_os.c head/sys/dev/qlxgbe/ql_os.c head/sys/dev/rt/if_rt.c head/sys/dev/sound/pci/hda/hdaa.c head/sys/dev/vxge/vxge.c head/sys/dev/xen/netfront/netfront.c head/sys/fs/devfs/devfs_devs.c head/sys/fs/fuse/fuse_main.c head/sys/fs/fuse/fuse_vfsops.c head/sys/geom/geom_kern.c head/sys/kern/kern_cpuset.c head/sys/kern/kern_descrip.c head/sys/kern/kern_mib.c head/sys/kern/kern_synch.c head/sys/kern/subr_devstat.c head/sys/kern/subr_kdb.c head/sys/kern/subr_uio.c head/sys/kern/vfs_cache.c head/sys/mips/mips/busdma_machdep.c head/sys/net80211/ieee80211_ht.c head/sys/net80211/ieee80211_hwmp.c head/sys/net80211/ieee80211_mesh.c head/sys/net80211/ieee80211_superg.c head/sys/netgraph/bluetooth/common/ng_bluetooth.c head/sys/netgraph/ng_base.c head/sys/netgraph/ng_socket.c head/sys/netinet/cc/cc_chd.c head/sys/netinet/tcp_timer.c head/sys/netipsec/ipsec.h head/sys/netpfil/pf/pf.c head/sys/ofed/drivers/net/mlx4/mlx4_en.h head/sys/powerpc/powermac/fcu.c head/sys/powerpc/powermac/smu.c head/sys/powerpc/powerpc/cpu.c head/sys/sys/sysctl.h head/sys/vm/memguard.c head/sys/vm/vm_kern.c head/sys/x86/x86/busdma_bounce.c Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Tue Oct 21 07:24:58 2014 (r273376) +++ head/share/man/man9/Makefile Tue Oct 21 07:31:21 2014 (r273377) @@ -1499,6 +1499,7 @@ MLINKS+=sysctl.9 SYSCTL_DECL.9 \ sysctl.9 SYSCTL_ADD_ROOT_NODE.9 \ sysctl.9 SYSCTL_ADD_STRING.9 \ sysctl.9 SYSCTL_ADD_STRUCT.9 \ + sysctl.9 SYSCTL_ADD_UAUTO.9 \ sysctl.9 SYSCTL_ADD_UINT.9 \ sysctl.9 SYSCTL_ADD_ULONG.9 \ sysctl.9 SYSCTL_ADD_UQUAD.9 \ Modified: head/share/man/man9/sysctl.9 ============================================================================== --- head/share/man/man9/sysctl.9 Tue Oct 21 07:24:58 2014 (r273376) +++ head/share/man/man9/sysctl.9 Tue Oct 21 07:31:21 2014 (r273377) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 15, 2014 +.Dd October 20, 2014 .Dt SYSCTL 9 .Os .Sh NAME @@ -39,6 +39,7 @@ .Nm SYSCTL_ADD_ROOT_NODE , .Nm SYSCTL_ADD_STRING , .Nm SYSCTL_ADD_STRUCT , +.Nm SYSCTL_ADD_UAUTO , .Nm SYSCTL_ADD_UINT , .Nm SYSCTL_ADD_ULONG , .Nm SYSCTL_ADD_UQUAD , @@ -82,7 +83,6 @@ .Fa "const char *name" .Fa "int ctlflags" .Fa "long *ptr" -.Fa "intptr_t val" .Fa "const char *descr" .Fc .Ft struct sysctl_oid * @@ -128,7 +128,6 @@ .Fa "const char *name" .Fa "int ctlflags" .Fa "quad_t *ptr" -.Fa "intptr_t val" .Fa "const char *descr" .Fc .Ft struct sysctl_oid * @@ -181,7 +180,6 @@ .Fa "const char *name" .Fa "int ctlflags" .Fa "unsigned long *ptr" -.Fa "intptr_t val" .Fa "const char *descr" .Fc .Ft struct sysctl_oid * @@ -192,7 +190,16 @@ .Fa "const char *name" .Fa "int ctlflags" .Fa "u_quad_t *ptr" -.Fa "intptr_t val" +.Fa "const char *descr" +.Fc +.Ft struct sysctl_oid * +.Fo SYSCTL_ADD_UAUTO +.Fa "struct sysctl_ctx_list *ctx" +.Fa "struct sysctl_oid_list *parent" +.Fa "int number" +.Fa "const char *name" +.Fa "int ctlflags" +.Fa "void *ptr" .Fa "const char *descr" .Fc .Ft struct sysctl_oid_list * @@ -283,13 +290,13 @@ For string type OIDs a length of zero me will be used to get the length of the string at each access to the OID. .It Fa ptr Pointer to sysctl variable or string data. -For sysctl values the pointer can be NULL which means the OID is read-only and the returned value should be taken from the +For sysctl values the pointer can be SYSCTL_NULL_XXX_PTR which means the OID is read-only and the returned value should be taken from the .Fa val argument. .It Fa val If the .Fa ptr -argument is NULL, gives the constant value returned by this OID. +argument is SYSCTL_NULL_XXX_PTR, gives the constant value returned by this OID. Else this argument is not used. .It Fa struct_type Name of structure type. @@ -424,8 +431,9 @@ Dynamic nodes are created using one of t .Fn SYSCTL_ADD_ROOT_NODE , .Fn SYSCTL_ADD_STRING , .Fn SYSCTL_ADD_STRUCT , +.Fn SYSCTL_ADD_UAUTO , .Fn SYSCTL_ADD_UINT , -.Fn SYSCTL_ADD_ULONG +.Fn SYSCTL_ADD_ULONG , or .Fn SYSCTL_UQUAD functions. @@ -521,10 +529,10 @@ Examples of integer, opaque, string, and .Bd -literal -offset indent /* * Example of a constant integer value. Notice that the control - * flags are CTLFLAG_RD, the variable pointer is NULL, and the - * value is declared. + * flags are CTLFLAG_RD, the variable pointer is SYSCTL_NULL_INT_PTR, + * and the value is declared. */ -SYSCTL_INT(_debug_sizeof, OID_AUTO, bio, CTLFLAG_RD, NULL, +SYSCTL_INT(_debug_sizeof, OID_AUTO, bio, CTLFLAG_RD, SYSCTL_NULL_INT_PTR, sizeof(struct bio), "sizeof(struct bio)"); /* Modified: head/sys/amd64/amd64/fpu.c ============================================================================== --- head/sys/amd64/amd64/fpu.c Tue Oct 21 07:24:58 2014 (r273376) +++ head/sys/amd64/amd64/fpu.c Tue Oct 21 07:31:21 2014 (r273377) @@ -130,7 +130,7 @@ CTASSERT(sizeof(struct pcb) % XSAVE_AREA static void fpu_clean_state(void); SYSCTL_INT(_hw, HW_FLOATINGPT, floatingpoint, CTLFLAG_RD, - NULL, 1, "Floating point instructions executed in hardware"); + SYSCTL_NULL_INT_PTR, 1, "Floating point instructions executed in hardware"); int use_xsave; /* non-static for cpu_switch.S */ uint64_t xsave_mask; /* the same */ Modified: head/sys/arm/arm/busdma_machdep-v6.c ============================================================================== --- head/sys/arm/arm/busdma_machdep-v6.c Tue Oct 21 07:24:58 2014 (r273376) +++ head/sys/arm/arm/busdma_machdep-v6.c Tue Oct 21 07:31:21 2014 (r273377) @@ -1525,9 +1525,9 @@ alloc_bounce_zone(bus_dma_tag_t dmat) SYSCTL_ADD_STRING(busdma_sysctl_tree(bz), SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO, "lowaddr", CTLFLAG_RD, bz->lowaddrid, 0, ""); - SYSCTL_ADD_INT(busdma_sysctl_tree(bz), + SYSCTL_ADD_ULONG(busdma_sysctl_tree(bz), SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO, - "alignment", CTLFLAG_RD, &bz->alignment, 0, ""); + "alignment", CTLFLAG_RD, &bz->alignment, ""); return (0); } Modified: head/sys/arm/arm/busdma_machdep.c ============================================================================== --- head/sys/arm/arm/busdma_machdep.c Tue Oct 21 07:24:58 2014 (r273376) +++ head/sys/arm/arm/busdma_machdep.c Tue Oct 21 07:31:21 2014 (r273377) @@ -1346,9 +1346,9 @@ alloc_bounce_zone(bus_dma_tag_t dmat) SYSCTL_ADD_STRING(busdma_sysctl_tree(bz), SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO, "lowaddr", CTLFLAG_RD, bz->lowaddrid, 0, ""); - SYSCTL_ADD_INT(busdma_sysctl_tree(bz), + SYSCTL_ADD_ULONG(busdma_sysctl_tree(bz), SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO, - "alignment", CTLFLAG_RD, &bz->alignment, 0, ""); + "alignment", CTLFLAG_RD, &bz->alignment, ""); return (0); } Modified: head/sys/cam/scsi/scsi_sa.c ============================================================================== --- head/sys/cam/scsi/scsi_sa.c Tue Oct 21 07:24:58 2014 (r273376) +++ head/sys/cam/scsi/scsi_sa.c Tue Oct 21 07:31:21 2014 (r273377) @@ -1487,13 +1487,13 @@ sasysctlinit(void *context, int pending) goto bailout; SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), - OID_AUTO, "allow_io_split", CTLTYPE_INT | CTLFLAG_RDTUN | CTLFLAG_NOFETCH, + OID_AUTO, "allow_io_split", CTLFLAG_RDTUN | CTLFLAG_NOFETCH, &softc->allow_io_split, 0, "Allow Splitting I/O"); SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), - OID_AUTO, "maxio", CTLTYPE_INT | CTLFLAG_RD, + OID_AUTO, "maxio", CTLFLAG_RD, &softc->maxio, 0, "Maximum I/O size"); SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), - OID_AUTO, "cpi_maxio", CTLTYPE_INT | CTLFLAG_RD, + OID_AUTO, "cpi_maxio", CTLFLAG_RD, &softc->cpi_maxio, 0, "Maximum Controller I/O size"); bailout: Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Tue Oct 21 07:24:58 2014 (r273376) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Tue Oct 21 07:31:21 2014 (r273377) @@ -67,8 +67,8 @@ #include "zfs_comutil.h" /* Used by fstat(1). */ -SYSCTL_INT(_debug_sizeof, OID_AUTO, znode, CTLFLAG_RD, 0, sizeof(znode_t), - "sizeof(znode_t)"); +SYSCTL_INT(_debug_sizeof, OID_AUTO, znode, CTLFLAG_RD, + SYSCTL_NULL_INT_PTR, sizeof(znode_t), "sizeof(znode_t)"); /* * Define ZNODE_STATS to turn on statistic gathering. By default, it is only Modified: head/sys/cddl/dev/dtrace/dtrace_sysctl.c ============================================================================== --- head/sys/cddl/dev/dtrace/dtrace_sysctl.c Tue Oct 21 07:24:58 2014 (r273376) +++ head/sys/cddl/dev/dtrace/dtrace_sysctl.c Tue Oct 21 07:31:21 2014 (r273377) @@ -86,8 +86,8 @@ SYSCTL_NODE(_kern, OID_AUTO, dtrace, CTL SYSCTL_INT(_kern_dtrace, OID_AUTO, memstr_max, CTLFLAG_RW, &dtrace_memstr_max, 0, "largest allowed argument to memstr(), 0 indicates no limit"); -SYSCTL_LONG(_kern_dtrace, OID_AUTO, dof_maxsize, CTLFLAG_RW, +SYSCTL_QUAD(_kern_dtrace, OID_AUTO, dof_maxsize, CTLFLAG_RW, &dtrace_dof_maxsize, 0, "largest allowed DOF table"); -SYSCTL_LONG(_kern_dtrace, OID_AUTO, helper_actions_max, CTLFLAG_RW, +SYSCTL_QUAD(_kern_dtrace, OID_AUTO, helper_actions_max, CTLFLAG_RW, &dtrace_helper_actions_max, 0, "maximum number of allowed helper actions"); Modified: head/sys/compat/ndis/kern_ndis.c ============================================================================== --- head/sys/compat/ndis/kern_ndis.c Tue Oct 21 07:24:58 2014 (r273376) +++ head/sys/compat/ndis/kern_ndis.c Tue Oct 21 07:31:21 2014 (r273377) @@ -79,6 +79,7 @@ __FBSDID("$FreeBSD$"); #include #define NDIS_DUMMY_PATH "\\\\some\\bogus\\path" +#define NDIS_FLAG_RDONLY 1 static void ndis_status_func(ndis_handle, ndis_status, void *, uint32_t); static void ndis_statusdone_func(ndis_handle); @@ -326,48 +327,48 @@ ndis_create_sysctls(arg) * We qualify as the latter. */ ndis_add_sysctl(sc, "Environment", - "Windows environment", "1", CTLFLAG_RD); + "Windows environment", "1", NDIS_FLAG_RDONLY); /* NDIS version should be 5.1. */ ndis_add_sysctl(sc, "NdisVersion", - "NDIS API Version", "0x00050001", CTLFLAG_RD); + "NDIS API Version", "0x00050001", NDIS_FLAG_RDONLY); /* * Some miniport drivers rely on the existence of the SlotNumber, * NetCfgInstanceId and DriverDesc keys. */ - ndis_add_sysctl(sc, "SlotNumber", "Slot Numer", "01", CTLFLAG_RD); + ndis_add_sysctl(sc, "SlotNumber", "Slot Numer", "01", NDIS_FLAG_RDONLY); ndis_add_sysctl(sc, "NetCfgInstanceId", "NetCfgInstanceId", - "{12345678-1234-5678-CAFE0-123456789ABC}", CTLFLAG_RD); + "{12345678-1234-5678-CAFE0-123456789ABC}", NDIS_FLAG_RDONLY); ndis_add_sysctl(sc, "DriverDesc", "Driver Description", - "NDIS Network Adapter", CTLFLAG_RD); + "NDIS Network Adapter", NDIS_FLAG_RDONLY); /* Bus type (PCI, PCMCIA, etc...) */ sprintf(buf, "%d", (int)sc->ndis_iftype); - ndis_add_sysctl(sc, "BusType", "Bus Type", buf, CTLFLAG_RD); + ndis_add_sysctl(sc, "BusType", "Bus Type", buf, NDIS_FLAG_RDONLY); if (sc->ndis_res_io != NULL) { sprintf(buf, "0x%lx", rman_get_start(sc->ndis_res_io)); ndis_add_sysctl(sc, "IOBaseAddress", - "Base I/O Address", buf, CTLFLAG_RD); + "Base I/O Address", buf, NDIS_FLAG_RDONLY); } if (sc->ndis_irq != NULL) { sprintf(buf, "%lu", rman_get_start(sc->ndis_irq)); ndis_add_sysctl(sc, "InterruptNumber", - "Interrupt Number", buf, CTLFLAG_RD); + "Interrupt Number", buf, NDIS_FLAG_RDONLY); } return (0); } int -ndis_add_sysctl(arg, key, desc, val, flag) +ndis_add_sysctl(arg, key, desc, val, flag_rdonly) void *arg; char *key; char *desc; char *val; - int flag; + int flag_rdonly; { struct ndis_softc *sc; struct ndis_cfglist *cfg; @@ -392,13 +393,21 @@ ndis_add_sysctl(arg, key, desc, val, fla TAILQ_INSERT_TAIL(&sc->ndis_cfglist_head, cfg, link); - cfg->ndis_oid = - SYSCTL_ADD_STRING(device_get_sysctl_ctx(sc->ndis_dev), - SYSCTL_CHILDREN(device_get_sysctl_tree(sc->ndis_dev)), - OID_AUTO, cfg->ndis_cfg.nc_cfgkey, flag, - cfg->ndis_cfg.nc_val, sizeof(cfg->ndis_cfg.nc_val), - cfg->ndis_cfg.nc_cfgdesc); - + if (flag_rdonly != 0) { + cfg->ndis_oid = + SYSCTL_ADD_STRING(device_get_sysctl_ctx(sc->ndis_dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(sc->ndis_dev)), + OID_AUTO, cfg->ndis_cfg.nc_cfgkey, CTLFLAG_RD, + cfg->ndis_cfg.nc_val, sizeof(cfg->ndis_cfg.nc_val), + cfg->ndis_cfg.nc_cfgdesc); + } else { + cfg->ndis_oid = + SYSCTL_ADD_STRING(device_get_sysctl_ctx(sc->ndis_dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(sc->ndis_dev)), + OID_AUTO, cfg->ndis_cfg.nc_cfgkey, CTLFLAG_RW, + cfg->ndis_cfg.nc_val, sizeof(cfg->ndis_cfg.nc_val), + cfg->ndis_cfg.nc_cfgdesc); + } return (0); } Modified: head/sys/dev/acpi_support/acpi_asus.c ============================================================================== --- head/sys/dev/acpi_support/acpi_asus.c Tue Oct 21 07:24:58 2014 (r273376) +++ head/sys/dev/acpi_support/acpi_asus.c Tue Oct 21 07:31:21 2014 (r273377) @@ -465,43 +465,39 @@ static struct { char *name; char *description; int method; - int flags; + int flag_anybody; } acpi_asus_sysctls[] = { { .name = "lcd_backlight", .method = ACPI_ASUS_METHOD_LCD, .description = "state of the lcd backlight", - .flags = CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_ANYBODY + .flag_anybody = 1 }, { .name = "lcd_brightness", .method = ACPI_ASUS_METHOD_BRN, .description = "brightness of the lcd panel", - .flags = CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_ANYBODY + .flag_anybody = 1 }, { .name = "video_output", .method = ACPI_ASUS_METHOD_DISP, .description = "display output state", - .flags = CTLTYPE_INT | CTLFLAG_RW }, { .name = "camera", .method = ACPI_ASUS_METHOD_CAMERA, .description = "internal camera state", - .flags = CTLTYPE_INT | CTLFLAG_RW }, { .name = "cardreader", .method = ACPI_ASUS_METHOD_CARDRD, .description = "internal card reader state", - .flags = CTLTYPE_INT | CTLFLAG_RW }, { .name = "wlan", .method = ACPI_ASUS_METHOD_WLAN, .description = "wireless lan state", - .flags = CTLTYPE_INT | CTLFLAG_RW }, { .name = NULL } @@ -741,12 +737,21 @@ acpi_asus_attach(device_t dev) if (!acpi_asus_sysctl_init(sc, acpi_asus_sysctls[i].method)) continue; - SYSCTL_ADD_PROC(&sc->sysctl_ctx, - SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, - acpi_asus_sysctls[i].name, - acpi_asus_sysctls[i].flags, - sc, i, acpi_asus_sysctl, "I", - acpi_asus_sysctls[i].description); + if (acpi_asus_sysctls[i].flag_anybody != 0) { + SYSCTL_ADD_PROC(&sc->sysctl_ctx, + SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, + acpi_asus_sysctls[i].name, + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_ANYBODY, + sc, i, acpi_asus_sysctl, "I", + acpi_asus_sysctls[i].description); + } else { + SYSCTL_ADD_PROC(&sc->sysctl_ctx, + SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, + acpi_asus_sysctls[i].name, + CTLTYPE_INT | CTLFLAG_RW, + sc, i, acpi_asus_sysctl, "I", + acpi_asus_sysctls[i].description); + } } /* Attach leds */ Modified: head/sys/dev/acpi_support/acpi_asus_wmi.c ============================================================================== --- head/sys/dev/acpi_support/acpi_asus_wmi.c Tue Oct 21 07:24:58 2014 (r273376) +++ head/sys/dev/acpi_support/acpi_asus_wmi.c Tue Oct 21 07:31:21 2014 (r273377) @@ -119,163 +119,139 @@ static struct { char *name; int dev_id; char *description; - int access; + int flag_rdonly; } acpi_asus_wmi_sysctls[] = { { .name = "hw_switch", .dev_id = ASUS_WMI_DEVID_HW_SWITCH, .description = "hw_switch", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "wireless_led", .dev_id = ASUS_WMI_DEVID_WIRELESS_LED, .description = "Wireless LED control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "cwap", .dev_id = ASUS_WMI_DEVID_CWAP, .description = "Alt+F2 function", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "wlan", .dev_id = ASUS_WMI_DEVID_WLAN, .description = "WLAN power control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "bluetooth", .dev_id = ASUS_WMI_DEVID_BLUETOOTH, .description = "Bluetooth power control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "gps", .dev_id = ASUS_WMI_DEVID_GPS, .description = "GPS power control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "wimax", .dev_id = ASUS_WMI_DEVID_WIMAX, .description = "WiMAX power control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "wwan3g", .dev_id = ASUS_WMI_DEVID_WWAN3G, .description = "WWAN-3G power control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "uwb", .dev_id = ASUS_WMI_DEVID_UWB, .description = "UWB power control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "led1", .dev_id = ASUS_WMI_DEVID_LED1, .description = "LED1 control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "led2", .dev_id = ASUS_WMI_DEVID_LED2, .description = "LED2 control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "led3", .dev_id = ASUS_WMI_DEVID_LED3, .description = "LED3 control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "led4", .dev_id = ASUS_WMI_DEVID_LED4, .description = "LED4 control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "led5", .dev_id = ASUS_WMI_DEVID_LED5, .description = "LED5 control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "led6", .dev_id = ASUS_WMI_DEVID_LED6, .description = "LED6 control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "backlight", .dev_id = ASUS_WMI_DEVID_BACKLIGHT, .description = "LCD backlight on/off control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "brightness", .dev_id = ASUS_WMI_DEVID_BRIGHTNESS, .description = "LCD backlight brightness control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "kbd_backlight", .dev_id = ASUS_WMI_DEVID_KBD_BACKLIGHT, .description = "Keyboard backlight brightness control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "light_sensor", .dev_id = ASUS_WMI_DEVID_LIGHT_SENSOR, .description = "Ambient light sensor", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "camera", .dev_id = ASUS_WMI_DEVID_CAMERA, .description = "Camera power control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "cardreader", .dev_id = ASUS_WMI_DEVID_CARDREADER, .description = "Cardreader power control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "touchpad", .dev_id = ASUS_WMI_DEVID_TOUCHPAD, .description = "Touchpad control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "touchpad_led", .dev_id = ASUS_WMI_DEVID_TOUCHPAD_LED, .description = "Touchpad LED control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "themperature", .dev_id = ASUS_WMI_DEVID_THERMAL_CTRL, .description = "Temperature (C)", - .access = CTLTYPE_INT | CTLFLAG_RD + .flag_rdonly = 1 }, { .name = "fan_speed", .dev_id = ASUS_WMI_DEVID_FAN_CTRL, .description = "Fan speed (0-3)", - .access = CTLTYPE_INT | CTLFLAG_RD + .flag_rdonly = 1 }, { .name = "processor_state", .dev_id = ASUS_WMI_DEVID_PROCESSOR_STATE, - .description = "Processor state", - .access = CTLTYPE_INT | CTLFLAG_RW + .flag_rdonly = 1 }, { NULL, 0, NULL, 0 } }; @@ -449,12 +425,21 @@ next: break; } - SYSCTL_ADD_PROC(sc->sysctl_ctx, - SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, - acpi_asus_wmi_sysctls[i].name, - acpi_asus_wmi_sysctls[i].access, - sc, i, acpi_asus_wmi_sysctl, "I", - acpi_asus_wmi_sysctls[i].description); + if (acpi_asus_wmi_sysctls[i].flag_rdonly != 0) { + SYSCTL_ADD_PROC(sc->sysctl_ctx, + SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, + acpi_asus_wmi_sysctls[i].name, + CTLTYPE_INT | CTLFLAG_RD, + sc, i, acpi_asus_wmi_sysctl, "I", + acpi_asus_wmi_sysctls[i].description); + } else { + SYSCTL_ADD_PROC(sc->sysctl_ctx, + SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, + acpi_asus_wmi_sysctls[i].name, + CTLTYPE_INT | CTLFLAG_RW, + sc, i, acpi_asus_wmi_sysctl, "I", + acpi_asus_wmi_sysctls[i].description); + } } ACPI_SERIAL_END(asus_wmi); Modified: head/sys/dev/acpi_support/acpi_hp.c ============================================================================== --- head/sys/dev/acpi_support/acpi_hp.c Tue Oct 21 07:24:58 2014 (r273376) +++ head/sys/dev/acpi_support/acpi_hp.c Tue Oct 21 07:31:21 2014 (r273377) @@ -152,135 +152,123 @@ static struct { char *name; int method; char *description; - int access; + int flag_rdonly; } acpi_hp_sysctls[] = { { .name = "wlan_enabled", .method = ACPI_HP_METHOD_WLAN_ENABLED, .description = "Enable/Disable WLAN (WiFi)", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "wlan_radio", .method = ACPI_HP_METHOD_WLAN_RADIO, .description = "WLAN radio status", - .access = CTLTYPE_INT | CTLFLAG_RD + .flag_rdonly = 1 }, { .name = "wlan_on_air", .method = ACPI_HP_METHOD_WLAN_ON_AIR, .description = "WLAN radio ready to use (enabled and radio)", - .access = CTLTYPE_INT | CTLFLAG_RD + .flag_rdonly = 1 }, { .name = "wlan_enable_if_radio_on", .method = ACPI_HP_METHOD_WLAN_ENABLE_IF_RADIO_ON, .description = "Enable WLAN if radio is turned on", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "wlan_disable_if_radio_off", .method = ACPI_HP_METHOD_WLAN_DISABLE_IF_RADIO_OFF, .description = "Disable WLAN if radio is turned off", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "bt_enabled", .method = ACPI_HP_METHOD_BLUETOOTH_ENABLED, .description = "Enable/Disable Bluetooth", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "bt_radio", .method = ACPI_HP_METHOD_BLUETOOTH_RADIO, .description = "Bluetooth radio status", - .access = CTLTYPE_INT | CTLFLAG_RD + .flag_rdonly = 1 }, { .name = "bt_on_air", .method = ACPI_HP_METHOD_BLUETOOTH_ON_AIR, .description = "Bluetooth radio ready to use" " (enabled and radio)", - .access = CTLTYPE_INT | CTLFLAG_RD + .flag_rdonly = 1 }, { .name = "bt_enable_if_radio_on", .method = ACPI_HP_METHOD_BLUETOOTH_ENABLE_IF_RADIO_ON, .description = "Enable bluetooth if radio is turned on", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "bt_disable_if_radio_off", .method = ACPI_HP_METHOD_BLUETOOTH_DISABLE_IF_RADIO_OFF, .description = "Disable bluetooth if radio is turned off", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "wwan_enabled", .method = ACPI_HP_METHOD_WWAN_ENABLED, .description = "Enable/Disable WWAN (UMTS)", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "wwan_radio", .method = ACPI_HP_METHOD_WWAN_RADIO, .description = "WWAN radio status", - .access = CTLTYPE_INT | CTLFLAG_RD + .flag_rdonly = 1 }, { .name = "wwan_on_air", .method = ACPI_HP_METHOD_WWAN_ON_AIR, .description = "WWAN radio ready to use (enabled and radio)", - .access = CTLTYPE_INT | CTLFLAG_RD + .flag_rdonly = 1 }, { .name = "wwan_enable_if_radio_on", .method = ACPI_HP_METHOD_WWAN_ENABLE_IF_RADIO_ON, .description = "Enable WWAN if radio is turned on", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "wwan_disable_if_radio_off", .method = ACPI_HP_METHOD_WWAN_DISABLE_IF_RADIO_OFF, .description = "Disable WWAN if radio is turned off", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "als_enabled", .method = ACPI_HP_METHOD_ALS, .description = "Enable/Disable ALS (Ambient light sensor)", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "display", .method = ACPI_HP_METHOD_DISPLAY, .description = "Display status", - .access = CTLTYPE_INT | CTLFLAG_RD + .flag_rdonly = 1 }, { .name = "hdd_temperature", .method = ACPI_HP_METHOD_HDDTEMP, .description = "HDD temperature", - .access = CTLTYPE_INT | CTLFLAG_RD + .flag_rdonly = 1 }, { .name = "is_docked", .method = ACPI_HP_METHOD_DOCK, .description = "Docking station status", - .access = CTLTYPE_INT | CTLFLAG_RD + .flag_rdonly = 1 }, { .name = "cmi_detail", .method = ACPI_HP_METHOD_CMI_DETAIL, .description = "Details shown in CMI output " "(cat /dev/hpcmi)", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "verbose", .method = ACPI_HP_METHOD_VERBOSE, .description = "Verbosity level", - .access = CTLTYPE_INT | CTLFLAG_RW }, { NULL, 0, NULL, 0 } @@ -560,11 +548,19 @@ acpi_hp_attach(device_t dev) sc->was_wwan_on_air = arg; } - SYSCTL_ADD_PROC(sc->sysctl_ctx, - SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, - acpi_hp_sysctls[i].name, acpi_hp_sysctls[i].access, - sc, i, acpi_hp_sysctl, "I", - acpi_hp_sysctls[i].description); + if (acpi_hp_sysctls[i].flag_rdonly != 0) { + SYSCTL_ADD_PROC(sc->sysctl_ctx, + SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, + acpi_hp_sysctls[i].name, CTLTYPE_INT | CTLFLAG_RD, + sc, i, acpi_hp_sysctl, "I", + acpi_hp_sysctls[i].description); + } else { + SYSCTL_ADD_PROC(sc->sysctl_ctx, + SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, + acpi_hp_sysctls[i].name, CTLTYPE_INT | CTLFLAG_RW, + sc, i, acpi_hp_sysctl, "I", + acpi_hp_sysctls[i].description); + } } ACPI_SERIAL_END(hp); Modified: head/sys/dev/acpi_support/acpi_ibm.c ============================================================================== --- head/sys/dev/acpi_support/acpi_ibm.c Tue Oct 21 07:24:58 2014 (r273376) +++ head/sys/dev/acpi_support/acpi_ibm.c Tue Oct 21 07:31:21 2014 (r273377) @@ -192,79 +192,70 @@ static struct { char *name; int method; char *description; - int access; + int flag_rdonly; } acpi_ibm_sysctls[] = { { .name = "events", .method = ACPI_IBM_METHOD_EVENTS, .description = "ACPI events enable", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "eventmask", .method = ACPI_IBM_METHOD_EVENTMASK, .description = "ACPI eventmask", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "hotkey", .method = ACPI_IBM_METHOD_HOTKEY, .description = "Key Status", - .access = CTLTYPE_INT | CTLFLAG_RD + .flag_rdonly = 1 }, { .name = "lcd_brightness", .method = ACPI_IBM_METHOD_BRIGHTNESS, .description = "LCD Brightness", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "volume", .method = ACPI_IBM_METHOD_VOLUME, .description = "Volume", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "mute", .method = ACPI_IBM_METHOD_MUTE, .description = "Mute", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "thinklight", .method = ACPI_IBM_METHOD_THINKLIGHT, .description = "Thinklight enable", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "bluetooth", .method = ACPI_IBM_METHOD_BLUETOOTH, .description = "Bluetooth enable", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "wlan", .method = ACPI_IBM_METHOD_WLAN, .description = "WLAN enable", - .access = CTLTYPE_INT | CTLFLAG_RD + .flag_rdonly = 1 }, { .name = "fan_speed", .method = ACPI_IBM_METHOD_FANSPEED, .description = "Fan speed", - .access = CTLTYPE_INT | CTLFLAG_RD + .flag_rdonly = 1 }, { .name = "fan_level", .method = ACPI_IBM_METHOD_FANLEVEL, .description = "Fan level", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "fan", .method = ACPI_IBM_METHOD_FANSTATUS, .description = "Fan enable", - .access = CTLTYPE_INT | CTLFLAG_RW }, { NULL, 0, NULL, 0 } @@ -415,11 +406,19 @@ acpi_ibm_attach(device_t dev) if (!acpi_ibm_sysctl_init(sc, acpi_ibm_sysctls[i].method)) continue; - SYSCTL_ADD_PROC(sc->sysctl_ctx, - SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, - acpi_ibm_sysctls[i].name, acpi_ibm_sysctls[i].access, - sc, i, acpi_ibm_sysctl, "I", - acpi_ibm_sysctls[i].description); + if (acpi_ibm_sysctls[i].flag_rdonly != 0) { + SYSCTL_ADD_PROC(sc->sysctl_ctx, + SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, + acpi_ibm_sysctls[i].name, CTLTYPE_INT | CTLFLAG_RD, + sc, i, acpi_ibm_sysctl, "I", + acpi_ibm_sysctls[i].description); + } else { + SYSCTL_ADD_PROC(sc->sysctl_ctx, + SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, + acpi_ibm_sysctls[i].name, CTLTYPE_INT | CTLFLAG_RW, + sc, i, acpi_ibm_sysctl, "I", + acpi_ibm_sysctls[i].description); + } } /* Hook up thermal node */ @@ -483,15 +482,10 @@ acpi_ibm_resume(device_t dev) for (int i = 0; acpi_ibm_sysctls[i].name != NULL; i++) { int val; - if ((acpi_ibm_sysctls[i].access & CTLFLAG_RD) == 0) { - continue; - } - val = acpi_ibm_sysctl_get(sc, i); - if ((acpi_ibm_sysctls[i].access & CTLFLAG_WR) == 0) { + if (acpi_ibm_sysctls[i].flag_rdonly != 0) continue; - } acpi_ibm_sysctl_set(sc, i, val); } Modified: head/sys/dev/acpi_support/acpi_rapidstart.c ============================================================================== --- head/sys/dev/acpi_support/acpi_rapidstart.c Tue Oct 21 07:24:58 2014 (r273376) +++ head/sys/dev/acpi_support/acpi_rapidstart.c Tue Oct 21 07:31:21 2014 (r273377) @@ -84,12 +84,21 @@ acpi_rapidstart_attach(device_t dev) sc->sysctl_ctx = device_get_sysctl_ctx(dev); sc->sysctl_tree = device_get_sysctl_tree(dev); for (i = 0 ; acpi_rapidstart_oids[i].nodename != NULL; i++){ - SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), - SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - i, acpi_rapidstart_oids[i].nodename , CTLTYPE_INT | - ((acpi_rapidstart_oids[i].setmethod)? CTLFLAG_RW: CTLFLAG_RD), - dev, i, sysctl_acpi_rapidstart_gen_handler, "I", - acpi_rapidstart_oids[i].comment); + if (acpi_rapidstart_oids[i].setmethod != NULL) { + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + i, acpi_rapidstart_oids[i].nodename, + CTLTYPE_INT | CTLFLAG_RW, + dev, i, sysctl_acpi_rapidstart_gen_handler, "I", + acpi_rapidstart_oids[i].comment); + } else { + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + i, acpi_rapidstart_oids[i].nodename, + CTLTYPE_INT | CTLFLAG_RD, + dev, i, sysctl_acpi_rapidstart_gen_handler, "I", + acpi_rapidstart_oids[i].comment); + } } return (0); } Modified: head/sys/dev/acpi_support/acpi_sony.c ============================================================================== --- head/sys/dev/acpi_support/acpi_sony.c Tue Oct 21 07:24:58 2014 (r273376) +++ head/sys/dev/acpi_support/acpi_sony.c Tue Oct 21 07:31:21 2014 (r273377) @@ -132,13 +132,22 @@ acpi_sony_attach(device_t dev) sc = device_get_softc(dev); acpi_GetInteger(acpi_get_handle(dev), ACPI_SONY_GET_PID, &sc->pid); device_printf(dev, "PID %x\n", sc->pid); - for (i = 0 ; acpi_sony_oids[i].nodename != NULL; i++){ - SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), - SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - i, acpi_sony_oids[i].nodename , CTLTYPE_INT | - ((acpi_sony_oids[i].setmethod)? CTLFLAG_RW: CTLFLAG_RD), - dev, i, sysctl_acpi_sony_gen_handler, "I", - acpi_sony_oids[i].comment); + for (i = 0 ; acpi_sony_oids[i].nodename != NULL; i++) { + if (acpi_sony_oids[i].setmethod != NULL) { + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + i, acpi_sony_oids[i].nodename , + CTLTYPE_INT | CTLFLAG_RW, + dev, i, sysctl_acpi_sony_gen_handler, "I", + acpi_sony_oids[i].comment); + } else { + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + i, acpi_sony_oids[i].nodename , + CTLTYPE_INT | CTLFLAG_RD, + dev, i, sysctl_acpi_sony_gen_handler, "I", + acpi_sony_oids[i].comment); + } } return (0); } Modified: head/sys/dev/bxe/bxe.c ============================================================================== --- head/sys/dev/bxe/bxe.c Tue Oct 21 07:24:58 2014 (r273376) +++ head/sys/dev/bxe/bxe.c Tue Oct 21 07:31:21 2014 (r273377) @@ -16216,7 +16216,7 @@ bxe_add_sysctls(struct bxe_softc *sc) "version"); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "bc_version", - CTLFLAG_RD, &sc->devinfo.bc_ver_str, 0, + CTLFLAG_RD, sc->devinfo.bc_ver_str, 0, "bootcode version"); snprintf(sc->fw_ver_str, sizeof(sc->fw_ver_str), "%d.%d.%d.%d", @@ -16225,7 +16225,7 @@ bxe_add_sysctls(struct bxe_softc *sc) BCM_5710_FW_REVISION_VERSION, BCM_5710_FW_ENGINEERING_VERSION); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "fw_version", - CTLFLAG_RD, &sc->fw_ver_str, 0, + CTLFLAG_RD, sc->fw_ver_str, 0, "firmware version"); snprintf(sc->mf_mode_str, sizeof(sc->mf_mode_str), "%s", @@ -16235,7 +16235,7 @@ bxe_add_sysctls(struct bxe_softc *sc) (sc->devinfo.mf_info.mf_mode == MULTI_FUNCTION_AFEX) ? "MF-AFEX" : "Unknown")); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "mf_mode", - CTLFLAG_RD, &sc->mf_mode_str, 0, + CTLFLAG_RD, sc->mf_mode_str, 0, "multifunction mode"); SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "mf_vnics", @@ -16243,7 +16243,7 @@ bxe_add_sysctls(struct bxe_softc *sc) "multifunction vnics per port"); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "mac_addr", - CTLFLAG_RD, &sc->mac_addr_str, 0, + CTLFLAG_RD, sc->mac_addr_str, 0, "mac address"); snprintf(sc->pci_link_str, sizeof(sc->pci_link_str), "%s x%d", @@ -16253,12 +16253,12 @@ bxe_add_sysctls(struct bxe_softc *sc) "???GT/s"), sc->devinfo.pcie_link_width); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "pci_link", - CTLFLAG_RD, &sc->pci_link_str, 0, + CTLFLAG_RD, sc->pci_link_str, 0, "pci link status"); sc->debug = bxe_debug; - SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "debug", - CTLFLAG_RW, &sc->debug, 0, + SYSCTL_ADD_ULONG(ctx, children, OID_AUTO, "debug", + CTLFLAG_RW, &sc->debug, "debug logging mode"); sc->rx_budget = bxe_rx_budget; Modified: head/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- head/sys/dev/cxgb/cxgb_sge.c Tue Oct 21 07:24:58 2014 (r273376) +++ head/sys/dev/cxgb/cxgb_sge.c Tue Oct 21 07:31:21 2014 (r273377) @@ -3365,7 +3365,7 @@ t3_add_attach_sysctls(adapter_t *sc) /* random information */ SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "firmware_version", - CTLFLAG_RD, &sc->fw_version, + CTLFLAG_RD, sc->fw_version, 0, "firmware version"); SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "hw_revision", @@ -3373,7 +3373,7 @@ t3_add_attach_sysctls(adapter_t *sc) 0, "chip model"); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 07:49:34 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E13DD644; Tue, 21 Oct 2014 07:49:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CDF92D7; Tue, 21 Oct 2014 07:49:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L7nYIK005488; Tue, 21 Oct 2014 07:49:34 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L7nY4v005487; Tue, 21 Oct 2014 07:49:34 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201410210749.s9L7nY4v005487@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 21 Oct 2014 07:49:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273378 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 07:49:35 -0000 Author: hselasky Date: Tue Oct 21 07:49:34 2014 New Revision: 273378 URL: https://svnweb.freebsd.org/changeset/base/273378 Log: Fix minor typo in currently unused macro. MFC after: 3 days Modified: head/sys/sys/sysctl.h Modified: head/sys/sys/sysctl.h ============================================================================== --- head/sys/sys/sysctl.h Tue Oct 21 07:31:21 2014 (r273377) +++ head/sys/sys/sysctl.h Tue Oct 21 07:49:34 2014 (r273378) @@ -378,7 +378,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e }) /* Oid for a quad. The pointer must be non NULL. */ -#define SYSCTL_NULL_QUAD_PTR ((int64_T *)NULL) +#define SYSCTL_NULL_QUAD_PTR ((int64_t *)NULL) #define SYSCTL_QUAD(parent, nbr, name, access, ptr, val, descr) \ SYSCTL_OID(parent, nbr, name, \ CTLTYPE_S64 | CTLFLAG_MPSAFE | (access), \ From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 07:54:50 2014 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DCD727FC; Tue, 21 Oct 2014 07:54:50 +0000 (UTC) Received: from theravensnest.org (theraven.freebsd.your.org [216.14.102.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cloud.theravensnest.org", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id AB7A91A3; Tue, 21 Oct 2014 07:54:49 +0000 (UTC) Received: from [192.168.0.106] (cpc14-cmbg15-2-0-cust307.5-4.cable.virginm.net [82.26.1.52]) (authenticated bits=0) by theravensnest.org (8.14.9/8.14.9) with ESMTP id s9L7si0O099321 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Tue, 21 Oct 2014 07:54:46 GMT (envelope-from theraven@FreeBSD.org) X-Authentication-Warning: theravensnest.org: Host cpc14-cmbg15-2-0-cust307.5-4.cable.virginm.net [82.26.1.52] claimed to be [192.168.0.106] Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: svn commit: r273274 - head/sys/netpfil/ipfw From: David Chisnall In-Reply-To: <5443A83F.5090807@FreeBSD.org> Date: Tue, 21 Oct 2014 08:54:35 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <6FEB1269-2A8D-48A7-A18E-2EAB9961EDA6@FreeBSD.org> References: <201410191115.s9JBFJxA058370@svn.freebsd.org> <5443A83F.5090807@FreeBSD.org> To: Andriy Gapon X-Mailer: Apple Mail (2.1878.6) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, "Alexander V. Chernikov" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 07:54:51 -0000 On 19 Oct 2014, at 13:02, Andriy Gapon wrote: > I think that on platforms where an optimized version of fls() is = available that > would work faster than this cool piece of bit magic. If you're lucky, the compiler's idiom recogniser will spot this. You're = generally better off using the builtins though, because then the = compiler will expand them to something sensible (hopefully - old = versions of gcc did horribly inefficient things for bswap and clz on = platforms without native support). David From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 08:24:14 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4217DEB7; Tue, 21 Oct 2014 08:24:14 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 138296C5; Tue, 21 Oct 2014 08:24:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L8OD6g023615; Tue, 21 Oct 2014 08:24:13 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L8ODM1023612; Tue, 21 Oct 2014 08:24:13 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201410210824.s9L8ODM1023612@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 21 Oct 2014 08:24:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273379 - in stable/10/sys/ofed: drivers/net/mlx4 include/linux/mlx4 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 08:24:14 -0000 Author: hselasky Date: Tue Oct 21 08:24:12 2014 New Revision: 273379 URL: https://svnweb.freebsd.org/changeset/base/273379 Log: MFC r272683: - Fix compile warning when compiling with GCC. - Add missed chunk in previous driver code MFC. Sponsored by: Mellanox Technologies Modified: stable/10/sys/ofed/drivers/net/mlx4/en_tx.c stable/10/sys/ofed/drivers/net/mlx4/mlx4.h stable/10/sys/ofed/include/linux/mlx4/device.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ofed/drivers/net/mlx4/en_tx.c ============================================================================== --- stable/10/sys/ofed/drivers/net/mlx4/en_tx.c Tue Oct 21 07:49:34 2014 (r273378) +++ stable/10/sys/ofed/drivers/net/mlx4/en_tx.c Tue Oct 21 08:24:12 2014 (r273379) @@ -1028,9 +1028,6 @@ mlx4_en_transmit_locked(struct ifnet *de } drbr_advance(dev, ring->br); enqueued++; - dev->if_obytes += next->m_pkthdr.len; - if (next->m_flags & M_MCAST) - dev->if_omcasts++; if ((dev->if_drv_flags & IFF_DRV_RUNNING) == 0) break; } Modified: stable/10/sys/ofed/drivers/net/mlx4/mlx4.h ============================================================================== --- stable/10/sys/ofed/drivers/net/mlx4/mlx4.h Tue Oct 21 07:49:34 2014 (r273378) +++ stable/10/sys/ofed/drivers/net/mlx4/mlx4.h Tue Oct 21 08:24:12 2014 (r273379) @@ -1234,6 +1234,7 @@ int mlx4_trans_to_dmfs_attach(struct mlx u8 gid[16], u8 port, int block_mcast_loopback, enum mlx4_protocol prot, u64 *reg_id); +int mlx4_SET_MCAST_FLTR(struct mlx4_dev *dev, u8 port, u64 mac, u64 clear, u8 mode); int mlx4_SET_MCAST_FLTR_wrapper(struct mlx4_dev *dev, int slave, struct mlx4_vhcr *vhcr, struct mlx4_cmd_mailbox *inbox, Modified: stable/10/sys/ofed/include/linux/mlx4/device.h ============================================================================== --- stable/10/sys/ofed/include/linux/mlx4/device.h Tue Oct 21 07:49:34 2014 (r273378) +++ stable/10/sys/ofed/include/linux/mlx4/device.h Tue Oct 21 08:24:12 2014 (r273379) @@ -1210,7 +1210,6 @@ int mlx4_multicast_promisc_add(struct ml int mlx4_multicast_promisc_remove(struct mlx4_dev *dev, u32 qpn, u8 port); int mlx4_unicast_promisc_add(struct mlx4_dev *dev, u32 qpn, u8 port); int mlx4_unicast_promisc_remove(struct mlx4_dev *dev, u32 qpn, u8 port); -int mlx4_SET_MCAST_FLTR(struct mlx4_dev *dev, u8 port, u64 mac, u64 clear, u8 mode); int mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac); void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, u64 mac); From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 09:14:19 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4983DF30; Tue, 21 Oct 2014 09:14:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2A586CA7; Tue, 21 Oct 2014 09:14:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L9EJSu047213; Tue, 21 Oct 2014 09:14:19 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L9EHtm047206; Tue, 21 Oct 2014 09:14:17 GMT (envelope-from br@FreeBSD.org) Message-Id: <201410210914.s9L9EHtm047206@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Tue, 21 Oct 2014 09:14:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273380 - in head/sys: arm/altera/socfpga arm/conf boot/fdt/dts/arm dev/mii X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 09:14:19 -0000 Author: br Date: Tue Oct 21 09:14:16 2014 New Revision: 273380 URL: https://svnweb.freebsd.org/changeset/base/273380 Log: Add driver for Micrel KSZ9021 Gigabit Ethernet Transceiver (PHY). Sponsored by: DARPA, AFRL Added: head/sys/dev/mii/micphy.c (contents, props changed) Modified: head/sys/arm/altera/socfpga/files.socfpga head/sys/arm/conf/SOCKIT head/sys/arm/conf/SOCKIT-BERI head/sys/boot/fdt/dts/arm/socfpga-sockit-beri.dts head/sys/boot/fdt/dts/arm/socfpga-sockit.dts head/sys/dev/mii/miidevs Modified: head/sys/arm/altera/socfpga/files.socfpga ============================================================================== --- head/sys/arm/altera/socfpga/files.socfpga Tue Oct 21 08:24:12 2014 (r273379) +++ head/sys/arm/altera/socfpga/files.socfpga Tue Oct 21 09:14:16 2014 (r273380) @@ -20,5 +20,6 @@ arm/altera/socfpga/socfpga_rstmgr.c sta arm/altera/socfpga/socfpga_mp.c optional smp dev/dwc/if_dwc.c optional dwc +dev/mii/micphy.c optional micphy dev/mmc/host/dwmmc.c optional dwmmc dev/beri/beri_ring.c optional beri_ring Modified: head/sys/arm/conf/SOCKIT ============================================================================== --- head/sys/arm/conf/SOCKIT Tue Oct 21 08:24:12 2014 (r273379) +++ head/sys/arm/conf/SOCKIT Tue Oct 21 09:14:16 2014 (r273380) @@ -125,6 +125,7 @@ device mii device smsc device smscphy device dwc +device micphy # USB ethernet support, requires miibus device miibus Modified: head/sys/arm/conf/SOCKIT-BERI ============================================================================== --- head/sys/arm/conf/SOCKIT-BERI Tue Oct 21 08:24:12 2014 (r273379) +++ head/sys/arm/conf/SOCKIT-BERI Tue Oct 21 09:14:16 2014 (r273380) @@ -128,6 +128,7 @@ device mii device smsc device smscphy device dwc +device micphy # USB ethernet support, requires miibus device miibus Modified: head/sys/boot/fdt/dts/arm/socfpga-sockit-beri.dts ============================================================================== --- head/sys/boot/fdt/dts/arm/socfpga-sockit-beri.dts Tue Oct 21 08:24:12 2014 (r273379) +++ head/sys/boot/fdt/dts/arm/socfpga-sockit-beri.dts Tue Oct 21 09:14:16 2014 (r273380) @@ -57,6 +57,15 @@ gmac1: ethernet@ff702000 { status = "okay"; + + rxd0-skew-ps = <0>; + rxd1-skew-ps = <0>; + rxd2-skew-ps = <0>; + rxd3-skew-ps = <0>; + txen-skew-ps = <0>; + txc-skew-ps = <2600>; + rxdv-skew-ps = <0>; + rxc-skew-ps = <2000>; }; mmc: dwmmc@ff704000 { @@ -69,7 +78,7 @@ slot@0 { reg = <0>; bus-width = <4>; - }; + }; }; beri_debug: ring@c0000000 { Modified: head/sys/boot/fdt/dts/arm/socfpga-sockit.dts ============================================================================== --- head/sys/boot/fdt/dts/arm/socfpga-sockit.dts Tue Oct 21 08:24:12 2014 (r273379) +++ head/sys/boot/fdt/dts/arm/socfpga-sockit.dts Tue Oct 21 09:14:16 2014 (r273380) @@ -57,6 +57,15 @@ gmac1: ethernet@ff702000 { status = "okay"; + + rxd0-skew-ps = <0>; + rxd1-skew-ps = <0>; + rxd2-skew-ps = <0>; + rxd3-skew-ps = <0>; + txen-skew-ps = <0>; + txc-skew-ps = <2600>; + rxdv-skew-ps = <0>; + rxc-skew-ps = <2000>; }; mmc: dwmmc@ff704000 { @@ -69,7 +78,7 @@ slot@0 { reg = <0>; bus-width = <4>; - }; + }; }; }; Added: head/sys/dev/mii/micphy.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/mii/micphy.c Tue Oct 21 09:14:16 2014 (r273380) @@ -0,0 +1,215 @@ +/*- + * Copyright (c) 2014 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * Micrel KSZ9021 Gigabit Ethernet Transceiver + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include "miidevs.h" + +#include "miibus_if.h" + +#include +#include +#include +#include + +#define MII_KSZPHY_EXTREG 0x0b +#define KSZPHY_EXTREG_WRITE (1 << 15) +#define MII_KSZPHY_EXTREG_WRITE 0x0c +#define MII_KSZPHY_EXTREG_READ 0x0d +#define MII_KSZPHY_CLK_CONTROL_PAD_SKEW 0x104 +#define MII_KSZPHY_RX_DATA_PAD_SKEW 0x105 +#define MII_KSZPHY_TX_DATA_PAD_SKEW 0x106 + +#define PS_TO_REG(p) (p / 200) + +static int micphy_probe(device_t); +static int micphy_attach(device_t); +static int micphy_service(struct mii_softc *, struct mii_data *, int); + +static device_method_t micphy_methods[] = { + /* device interface */ + DEVMETHOD(device_probe, micphy_probe), + DEVMETHOD(device_attach, micphy_attach), + DEVMETHOD(device_detach, mii_phy_detach), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + DEVMETHOD_END +}; + +static devclass_t micphy_devclass; + +static driver_t micphy_driver = { + "micphy", + micphy_methods, + sizeof(struct mii_softc) +}; + +DRIVER_MODULE(micphy, miibus, micphy_driver, micphy_devclass, 0, 0); + +static const struct mii_phydesc micphys[] = { + MII_PHY_DESC(MICREL, KSZ9021), + MII_PHY_END +}; + +static const struct mii_phy_funcs micphy_funcs = { + micphy_service, + ukphy_status, + mii_phy_reset +}; + +static void micphy_write(struct mii_softc *sc, uint32_t reg, uint32_t val) +{ + + PHY_WRITE(sc, MII_KSZPHY_EXTREG, KSZPHY_EXTREG_WRITE | reg); + PHY_WRITE(sc, MII_KSZPHY_EXTREG_WRITE, val); +} + +static int +ksz9021_load_values(struct mii_softc *sc, phandle_t node, uint32_t reg, + char *field1, char *field2, + char *field3, char *field4) +{ + pcell_t dts_value[1]; + int len; + int val; + + val = 0; + + if ((len = OF_getproplen(node, field1)) > 0) { + OF_getencprop(node, field1, dts_value, len); + val = PS_TO_REG(dts_value[0]); + } + + if ((len = OF_getproplen(node, field2)) > 0) { + OF_getencprop(node, field2, dts_value, len); + val |= PS_TO_REG(dts_value[0]) << 4; + } + + if ((len = OF_getproplen(node, field3)) > 0) { + OF_getencprop(node, field3, dts_value, len); + val |= PS_TO_REG(dts_value[0]) << 8; + } + + if ((len = OF_getproplen(node, field4)) > 0) { + OF_getencprop(node, field4, dts_value, len); + val |= PS_TO_REG(dts_value[0]) << 12; + } + + micphy_write(sc, reg, val); + + return (0); +} + +static int +micphy_probe(device_t dev) +{ + + return (mii_phy_dev_probe(dev, micphys, BUS_PROBE_DEFAULT)); +} + +static int +micphy_attach(device_t dev) +{ + struct mii_softc *sc; + phandle_t node; + device_t miibus; + device_t parent; + + sc = device_get_softc(dev); + + mii_phy_dev_attach(dev, MIIF_NOMANPAUSE, &micphy_funcs, 1); + mii_phy_setmedia(sc); + + miibus = device_get_parent(dev); + parent = device_get_parent(miibus); + + if ((node = ofw_bus_get_node(parent)) == -1) + return (ENXIO); + + ksz9021_load_values(sc, node, MII_KSZPHY_CLK_CONTROL_PAD_SKEW, + "txen-skew-ps", "txc-skew-ps", + "rxdv-skew-ps", "rxc-skew-ps"); + + ksz9021_load_values(sc, node, MII_KSZPHY_RX_DATA_PAD_SKEW, + "rxd0-skew-ps", "rxd1-skew-ps", + "rxd2-skew-ps", "rxd3-skew-ps"); + + ksz9021_load_values(sc, node, MII_KSZPHY_TX_DATA_PAD_SKEW, + "txd0-skew-ps", "txd1-skew-ps", + "txd2-skew-ps", "txd3-skew-ps"); + + return (0); +} + +static int +micphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd) +{ + + switch (cmd) { + case MII_POLLSTAT: + break; + + case MII_MEDIACHG: + mii_phy_setmedia(sc); + break; + + case MII_TICK: + if (mii_phy_tick(sc) == EJUSTRETURN) + return (0); + break; + } + + /* Update the media status. */ + PHY_STATUS(sc); + + /* Callback if something changed. */ + mii_phy_update(sc, cmd); + return (0); +} Modified: head/sys/dev/mii/miidevs ============================================================================== --- head/sys/dev/mii/miidevs Tue Oct 21 08:24:12 2014 (r273379) +++ head/sys/dev/mii/miidevs Tue Oct 21 09:14:16 2014 (r273380) @@ -62,6 +62,7 @@ oui INTEL 0x00aa00 Intel Corporation oui JMICRON 0x00d831 JMicron Technologies oui LEVEL1 0x00207b Level 1 oui MARVELL 0x005043 Marvell Semiconductor +oui MICREL 0x0010a1 Micrel oui MYSON 0x00c0b4 Myson Technology oui NATSEMI 0x080017 National Semiconductor oui PMCSIERRA 0x00e004 PMC-Sierra @@ -274,6 +275,9 @@ model MARVELL E1000_3 0x0003 Marvell 88 model MARVELL E1000_5 0x0005 Marvell 88E1000 Gigabit PHY model MARVELL E1111 0x000c Marvell 88E1111 Gigabit PHY +/* Micrel PHYs */ +model MICREL KSZ9021 0x0021 Micrel KSZ9021 10/100/1000 PHY + /* Myson Technology PHYs */ model xxMYSON MTD972 0x0000 MTD972 10/100 media interface model MYSON MTD803 0x0000 MTD803 3-in-1 media interface From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 10:19:47 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2716CC6E; Tue, 21 Oct 2014 10:19:47 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 12E2A405; Tue, 21 Oct 2014 10:19:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LAJk5B075854; Tue, 21 Oct 2014 10:19:46 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LAJkv9075848; Tue, 21 Oct 2014 10:19:46 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410211019.s9LAJkv9075848@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 21 Oct 2014 10:19:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273381 - in head: contrib/libcxxrt lib/libcxxrt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 10:19:47 -0000 Author: bapt Date: Tue Oct 21 10:19:45 2014 New Revision: 273381 URL: https://svnweb.freebsd.org/changeset/base/273381 Log: Add support for __cxa_throw_bad_array_new_length in libcxxrt It is required for use with newer g++49 Differential Revision: https://reviews.freebsd.org/D982 Reviewed by: theraven Approved by: theraven MFC after: 3 weeks Modified: head/contrib/libcxxrt/auxhelper.cc head/contrib/libcxxrt/stdexcept.cc head/contrib/libcxxrt/stdexcept.h head/lib/libcxxrt/Version.map Modified: head/contrib/libcxxrt/auxhelper.cc ============================================================================== --- head/contrib/libcxxrt/auxhelper.cc Tue Oct 21 09:14:16 2014 (r273380) +++ head/contrib/libcxxrt/auxhelper.cc Tue Oct 21 10:19:45 2014 (r273381) @@ -75,3 +75,8 @@ extern "C" void __cxa_deleted_virtual() { abort(); } + +extern "C" void __cxa_throw_bad_array_new_length() +{ + throw std::bad_array_new_length(); +} Modified: head/contrib/libcxxrt/stdexcept.cc ============================================================================== --- head/contrib/libcxxrt/stdexcept.cc Tue Oct 21 09:14:16 2014 (r273380) +++ head/contrib/libcxxrt/stdexcept.cc Tue Oct 21 10:19:45 2014 (r273381) @@ -82,5 +82,13 @@ const char* bad_typeid::what() const thr return "std::bad_typeid"; } +bad_array_new_length::bad_array_new_length() throw() {} +bad_array_new_length::~bad_array_new_length() {} +bad_array_new_length::bad_array_new_length(const bad_array_new_length&) throw() {} +bad_array_new_length& bad_array_new_length::operator=(const bad_array_new_length&) throw() +{ + return *this; +} + } // namespace std Modified: head/contrib/libcxxrt/stdexcept.h ============================================================================== --- head/contrib/libcxxrt/stdexcept.h Tue Oct 21 09:14:16 2014 (r273380) +++ head/contrib/libcxxrt/stdexcept.h Tue Oct 21 10:19:45 2014 (r273381) @@ -81,6 +81,15 @@ namespace std virtual const char* what() const throw(); }; + class bad_array_new_length: public exception + { + public: + bad_array_new_length() throw(); + bad_array_new_length(const bad_array_new_length&) throw(); + bad_array_new_length& operator=(const bad_array_new_length&) throw(); + virtual ~bad_array_new_length(); + virtual const char *what() const throw(); + }; } // namespace std Modified: head/lib/libcxxrt/Version.map ============================================================================== --- head/lib/libcxxrt/Version.map Tue Oct 21 09:14:16 2014 (r273380) +++ head/lib/libcxxrt/Version.map Tue Oct 21 10:19:45 2014 (r273381) @@ -26,6 +26,7 @@ CXXABI_1.3 { __cxa_pure_virtual; __cxa_rethrow; __cxa_throw; + __cxa_throw_bad_array_new_length; __cxa_type_match; __cxa_vec_cctor; __cxa_vec_cleanup; @@ -273,6 +274,9 @@ CXXRT_1.0 { "std::bad_alloc::bad_alloc(std::bad_alloc const&)"; "std::bad_alloc::bad_alloc()"; "std::bad_alloc::operator=(std::bad_alloc const&)"; + "std::bad_array_new_length::bad_array_new_length(std::bad_array_new_length const&)"; + "std::bad_array_new_length::bad_array_new_length()"; + "std::bad_array_new_length::operator=(std::bad_array_new_length const&)"; }; __cxa_allocate_dependent_exception; @@ -307,6 +311,7 @@ GLIBCXX_3.4 { "std::bad_typeid::~bad_typeid()"; "std::exception::~exception()"; "std::bad_alloc::~bad_alloc()"; + "std::bad_array_new_length::~bad_array_new_length()"; "std::exception::what() const"; @@ -320,17 +325,20 @@ GLIBCXX_3.4 { "vtable for std::bad_typeid"; "vtable for std::exception"; "vtable for std::type_info"; + "vtable for std::bad_array_new_length"; "typeinfo for std::bad_alloc"; "typeinfo for std::bad_typeid"; "typeinfo for std::bad_cast"; "typeinfo for std::exception"; "typeinfo for std::type_info"; + "typeinfo for std::bad_array_new_length"; "typeinfo name for std::bad_alloc"; "typeinfo name for std::bad_typeid"; "typeinfo name for std::bad_cast"; "typeinfo name for std::exception"; "typeinfo name for std::type_info"; + "typeinfo name for std::bad_array_new_length"; }; }; @@ -340,6 +348,7 @@ GLIBCXX_3.4.9 { "std::bad_typeid::what() const"; "std::bad_cast::what() const"; "std::bad_alloc::what() const"; + "std::bad_array_new_length::what() const"; }; } GLIBCXX_3.4; From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 12:06:02 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 94CC7FD5; Tue, 21 Oct 2014 12:06:02 +0000 (UTC) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id 161CF1A7; Tue, 21 Oct 2014 12:06:01 +0000 (UTC) Received: from c122-106-147-133.carlnfd1.nsw.optusnet.com.au (c122-106-147-133.carlnfd1.nsw.optusnet.com.au [122.106.147.133]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id 90136421FB2; Tue, 21 Oct 2014 23:05:59 +1100 (AEDT) Date: Tue, 21 Oct 2014 23:05:58 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: David Chisnall Subject: Re: svn commit: r273274 - head/sys/netpfil/ipfw In-Reply-To: <6FEB1269-2A8D-48A7-A18E-2EAB9961EDA6@FreeBSD.org> Message-ID: <20141021203956.C1228@besplex.bde.org> References: <201410191115.s9JBFJxA058370@svn.freebsd.org> <5443A83F.5090807@FreeBSD.org> <6FEB1269-2A8D-48A7-A18E-2EAB9961EDA6@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=fvDlOjIf c=1 sm=1 tr=0 a=7NqvjVvQucbO2RlWB8PEog==:117 a=PO7r1zJSAAAA:8 a=kj9zAlcOel0A:10 a=JzwRw_2MAAAA:8 a=6I5d2MoRAAAA:8 a=MolaBozWl2p_9SFP6FgA:9 a=CjuIK1q_8ugA:10 a=SV7veod9ZcQA:10 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, "Alexander V. Chernikov" , Andriy Gapon X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 12:06:02 -0000 On Tue, 21 Oct 2014, David Chisnall wrote: > On 19 Oct 2014, at 13:02, Andriy Gapon wrote: > >> I think that on platforms where an optimized version of fls() is available that >> would work faster than this cool piece of bit magic. Even a lightly optimized naive linear search might work faster. The fancy method has about 7 dependent operations, while the naive method has about 32 independent operations. > If you're lucky, the compiler's idiom recogniser will spot this. You're generally better off using the builtins though, because then the compiler will expand them to something sensible (hopefully - old versions of gcc did horribly inefficient things for bswap and clz on platforms without native support). No one cared when cperciva optimized fls() using a lookup table and I investigated 11 different method to show that neither the builtins nor the lookup table were especially good (or bad). On i386, the best portable method is to use ilogb() (floating point). The next best is to use floating point directly. These methods are not the fastest, except probably for 64 bits on i386, but they are quite fast and fairly portable. Not all systems have fls() in libc, and FreeBSD has only pessimized implementations there. I just ran my benchmark on ref11-i386 and got the following: % UNIFORM/BUILTIN_FFS: 0.08 real 0.08 user 0.00 sys % UNIFORM/CPUFUNC_FFS: 0.12 real 0.11 user 0.00 sys % UNIFORM/LIBMET0_FFS: 0.11 real 0.09 user 0.00 sys % UNIFORM/LIBMETH_FFS: 0.11 real 0.10 user 0.00 sys % UNIFORM/LUTMETH_FFS: 0.10 real 0.09 user 0.00 sys % UNIFORM/CPUFUNC_FLS: 0.12 real 0.10 user 0.01 sys % UNIFORM/ILOGMET_FLS: 0.14 real 0.13 user 0.00 sys % UNIFORM/ILOGBME_FLS: 0.23 real 0.23 user 0.00 sys % UNIFORM/ILOGBM0_FLS: 0.23 real 0.23 user 0.00 sys % UNIFORM/LIBMET0_FLS: 1.63 real 1.61 user 0.00 sys % UNIFORM/LIBMETH_FLS: 1.61 real 1.60 user 0.00 sys Several bit patterns are tested, to try to see if there are cache effects. The builtin is now clearly fastest. (On old Athlon64 in 32-bit mode with gcc, it loses to floating point: @ UNIFORM/BUILTIN_FFS: 0.22 real 0.22 user 0.00 sys @ UNIFORM/ILOGMET_FLS: 0.17 real 0.17 user 0.00 sys), but even in the benchmark that spends 100% of its time doing ffs(), the speedup from using the builtin vs the next best is only 20%. Only the pessimized libc methods are very slow. Programs like ministat are intentionally not used. It takes long enough to read the results of 55 simple tests. 44 more follow: % RANDBIT/BUILTIN_FFS: 0.08 real 0.08 user 0.00 sys % RANDBIT/CPUFUNC_FFS: 0.12 real 0.12 user 0.00 sys % RANDBIT/LIBMET0_FFS: 0.11 real 0.10 user 0.00 sys % RANDBIT/LIBMETH_FFS: 0.11 real 0.10 user 0.00 sys % RANDBIT/LUTMETH_FFS: 0.10 real 0.09 user 0.00 sys % RANDBIT/CPUFUNC_FLS: 0.12 real 0.11 user 0.00 sys % RANDBIT/ILOGMET_FLS: 0.14 real 0.13 user 0.00 sys % RANDBIT/ILOGBME_FLS: 0.23 real 0.23 user 0.00 sys % RANDBIT/ILOGBM0_FLS: 0.23 real 0.23 user 0.00 sys % RANDBIT/LIBMET0_FLS: 1.25 real 1.24 user 0.00 sys % RANDBIT/LIBMETH_FLS: 1.24 real 1.24 user 0.00 sys % ALLZERO/BUILTIN_FFS: 0.08 real 0.07 user 0.00 sys % ALLZERO/CPUFUNC_FFS: 0.05 real 0.04 user 0.00 sys % ALLZERO/LIBMET0_FFS: 0.11 real 0.10 user 0.00 sys % ALLZERO/LIBMETH_FFS: 0.11 real 0.10 user 0.00 sys % ALLZERO/LUTMETH_FFS: 0.05 real 0.04 user 0.00 sys % ALLZERO/CPUFUNC_FLS: 0.05 real 0.04 user 0.00 sys % ALLZERO/ILOGMET_FLS: 0.07 real 0.06 user 0.00 sys % ALLZERO/ILOGBME_FLS: 0.05 real 0.03 user 0.00 sys % ALLZERO/ILOGBM0_FLS: 0.05 real 0.04 user 0.00 sys % ALLZERO/LIBMET0_FLS: 0.18 real 0.17 user 0.00 sys % ALLZERO/LIBMETH_FLS: 0.20 real 0.20 user 0.00 sys % ALLONE_/BUILTIN_FFS: 0.08 real 0.08 user 0.00 sys % ALLONE_/CPUFUNC_FFS: 0.12 real 0.12 user 0.00 sys % ALLONE_/LIBMET0_FFS: 0.11 real 0.10 user 0.00 sys % ALLONE_/LIBMETH_FFS: 0.11 real 0.10 user 0.00 sys % ALLONE_/LUTMETH_FFS: 0.10 real 0.09 user 0.00 sys % ALLONE_/CPUFUNC_FLS: 0.12 real 0.12 user 0.00 sys % ALLONE_/ILOGMET_FLS: 0.10 real 0.09 user 0.00 sys % ALLONE_/ILOGBME_FLS: 0.23 real 0.23 user 0.00 sys % ALLONE_/ILOGBM0_FLS: 0.23 real 0.23 user 0.00 sys % ALLONE_/LIBMET0_FLS: 0.20 real 0.19 user 0.00 sys % ALLONE_/LIBMETH_FLS: 0.20 real 0.19 user 0.00 sys % ALLLAST/BUILTIN_FFS: 0.08 real 0.08 user 0.00 sys % ALLLAST/CPUFUNC_FFS: 0.13 real 0.11 user 0.00 sys % ALLLAST/LIBMET0_FFS: 0.11 real 0.10 user 0.00 sys % ALLLAST/LIBMETH_FFS: 0.11 real 0.10 user 0.00 sys % ALLLAST/LUTMETH_FFS: 0.10 real 0.09 user 0.00 sys % ALLLAST/CPUFUNC_FLS: 0.13 real 0.12 user 0.00 sys % ALLLAST/ILOGMET_FLS: 0.07 real 0.06 user 0.00 sys % ALLLAST/ILOGBME_FLS: 0.23 real 0.23 user 0.00 sys % ALLLAST/ILOGBM0_FLS: 0.23 real 0.23 user 0.00 sys % ALLLAST/LIBMET0_FLS: 1.57 real 1.55 user 0.00 sys % ALLLAST/LIBMETH_FLS: 1.57 real 1.56 user 0.00 sys Part of the program with the methods: % #if defined(CPUFUNC_FFS) || defined(CPUFUNC_FLS) % #define _KERNEL /* now needed to get non-builtin */ % #include % /* MI library versions: */ % #elif ILOGBM0_FLS % #include "/usr/src/lib/msun/src/s_ilogb.c" % #elif LIBMET0_FLS % #include "/usr/src/lib/libc/string/ffs.c" % #elif LIBMET0_FFS % #include "/usr/src/lib/libc/string/fls.c" % #endif % % static int ffslut32[32]; % % static inline int % ilog_fls(int x) % { % union { % float fvalue; % uint32_t uvalue; % } u; % % if (x <= 0) % return (x == 0 ? 0 : 32); % u.fvalue = x; % return ((u.uvalue >> 23) - 127 + 1); % } This is like the libm (fdlibm/FreeBSD ilogb()) with minor optimizations and de-obfuscations. It might be too sloppy to be correct. % static inline int % ilogb_fls(int x) % { % return (x == 0 ? 0 : ilogbf(x) + 1); % } The portable FP method. % % static inline int % lut_ffs(int mask) % { % return (mask ? ffslut32[(((mask & (-mask)) * 0x0FB9AC52) >> 27) + 16] : 0); % } cperciva's lookup table method. It is not simply examining 8 nybbles using a lookup table of size 16. % ... % #ifdef BUILTIN_FFS % v = __builtin_ffs(z[i]); % #elif CPUFUNC_FFS % v = ffs(z[i]); % #elif CPUFUNC_FLS % v = fls(z[i]); % #elif ILOGMET_FLS % v = ilog_fls(z[i]); % #elif ILOGBME_FLS % v = ilogb_fls(z[i]); % #elif ILOGBM0_FLS % v = ilogb_fls(z[i]); % #elif LIBMET0_FFS % v = ffs(z[i]); % #elif LIBMET0_FLS % v = fls(z[i]); % #elif LIBMETH_FFS % v = ffs(z[i]); % #elif LIBMETH_FLS % v = fls(z[i]); % #elif LUTMETH_FFS % v = lut_ffs(z[i]); % #else % #error "No method" % ; % #endif Further comments on the methods: % RANDBIT/BUILTIN_FFS: 0.08 real 0.08 user 0.00 sys % RANDBIT/CPUFUNC_FFS: 0.12 real 0.12 user 0.00 sys CPUFUNC_* is the kernel version. On amd64, it is #defined'ed as the builtin, but ffsll() (bletch) still uses old methods. (Apart from using the long long abomination, ffsll() and flsll() shouldn't exist in the kernel. They are used approximately once, in code that can be written better without them.) This is on i386. i386 kernel ffs() still uses my 1994 de-pessimization for gcc-2. This is now slower than the builtin. Even the current amd64 methods are similar except for ffs(). There is a problem converting the result of bsf*/bsr* to ffs*()/fls*(). Efficiently. gcc-2 used a method with a badly-placed branch, and I changed FreeBSD to use a less badly-placed branch. Branches were much more important with no branch prediction or caches in 1994. Now they don't matter if they are correctly predicted. The tests try to get them mispredicted but are probably defeated by the prediction being too smart. % RANDBIT/LIBMET0_FFS: 0.11 real 0.10 user 0.00 sys LIBMET0 is #including the libc source. It is a naive linear search but is optimized well, but apparently not to the same code as the builtin. % RANDBIT/LIBMETH_FFS: 0.11 real 0.10 user 0.00 sys LIBMETH is a function call to libc. Statically linked of course. Other CFLAGS are -O -march=athlon-xp. Not the right arch. clang gives excessive optimizations with -O so -O2 would make little difference. % RANDBIT/LUTMETH_FFS: 0.10 real 0.09 user 0.00 sys cperciva's lookup table method. Only implemented for ffs(). % RANDBIT/CPUFUNC_FLS: 0.12 real 0.11 user 0.00 sys Same time as CPUFUNC_FFS. No test for BUILTIN_FLS since the kernel didn't have it when this was written. % RANDBIT/ILOGMET_FLS: 0.14 real 0.13 user 0.00 sys Direct FP method is now not the fastest. % RANDBIT/ILOGBME_FLS: 0.23 real 0.23 user 0.00 sys Function call FP method never was the fastest. % RANDBIT/ILOGBM0_FLS: 0.23 real 0.23 user 0.00 sys Function call FP method with the function code exposed in the same compilation unit -- makes no difference. % RANDBIT/LIBMET0_FLS: 1.25 real 1.24 user 0.00 sys % RANDBIT/LIBMETH_FLS: 1.24 real 1.24 user 0.00 sys As for LIBMETH*_FLS, except now the naive linear search in the libc source is not optimized well. Summary: use the simple naive libc source and wait for the compiler to catch up for fls() and other functions. The slowness of LIBMET0 relative to the builtin is just due to it making function calls. Here is a disassembly of ffs.o: % 00000000 : % 0: 0f bc 44 24 04 bsf 0x4(%esp),%eax % 5: 74 03 je a % 7: 40 inc %eax % 8: c3 ret % 9: 90 nop % % 0000000a : % a: 31 c0 xor %eax,%eax % c: c3 ret (Why does it align to merely an even boundary?) Disassembly of fls.o shows a naive loop. Quite good code for the inner loop. Now there is alignment to a 16-byte boundary and almost half of the function's size is for padding. Disassembly of ffsl.o shows a naive loop. ffsl() is not optimized although it is essentially the same as ffs(). ffsll() is of course fully pessimized. You could write a much faster one using 2 ffs()'s and that would be good enough for a portable library. Splitting up can handle any number of bits. On amd64, even ffs.o uses the naive loop. The optimization is not in the copmpiler at all. Someone just wrote ffs.S for i386 only. This and many other machine-dependent optimizations shouldn't exist. You can write them better using builtins. The weird even alignment is now easy to explain. The alignment statement was written in 1993 when .align 2 meant 4-byte alignment. (I forget when this changed, but checked the FreeBSD-1 sources where I documented what .align 2 meant and changed all the hard-coded .align 2's to use either the ALIGN macro or the ALIGN_TEXT macro. ALIGN_TEXT hard-codes a fill byte. FreeBSD still uses these macros but spells .align as .p2align of course. Plain .align is too unportable to use for anything. The fill byte shouldn't be hard-coded but still is.) Optimizing string functions is so important that the i386 optimizations are still not so good ones for original i386's, with minor unimprovements from the drift in .align. Most still use .align 2. The exceptions are a couple of wide char functions which use .p2align 2 and also .p2align 4. Even in the kernel where the alignment statements are macro-ized, it is practically impossible to do alignment as well as compilers. There are too many special cases (depending on the arch and code context). Here is (most of) the code produced for ffs(x) { return __builtin_ffs(x); }: with default CFLAGS except for -O -fomit-frame-pointer: % .align 16, 0x90 % ffs: # @ffs % movl 4(%esp), %eax % testl %eax, %eax % je .LBB0_2 % bsfl %eax, %eax % incl %eax % .LBB0_2: # %entry % ret It does nothing special, and produces the same code that I wrote in the inline asm in 1994. Here is the libc code again: % 00000000 : % 0: 0f bc 44 24 04 bsf 0x4(%esp),%eax % 5: 74 03 je a % 7: 40 inc %eax % 8: c3 ret % 9: 90 nop % % 0000000a : % a: 31 c0 xor %eax,%eax % c: c3 ret This is pessimized by doing a less-predictable branch, later. This was not so bad in 1994. Modern CPUs can start working on the bsfl in parallel to testing the value. They can probably also predict the branch and thus not really care about the order. The branch is because I forgot to optimize for an arch that supports cmove. Compiling with -march=core2 gives: movl 4(%esp), %ecx bsfl %ecx, %eax incl %ecx testl %ecx, %ecx cmovel %ecx, %eax ret This explains another 10-20% of the speed of the builtin vs libc asm. Bruce From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 12:52:02 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 84BB2B5A; Tue, 21 Oct 2014 12:52:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 71678908; Tue, 21 Oct 2014 12:52:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LCq2uJ053287; Tue, 21 Oct 2014 12:52:02 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LCq2R5053286; Tue, 21 Oct 2014 12:52:02 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410211252.s9LCq2R5053286@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 21 Oct 2014 12:52:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273382 - head/contrib/libcxxrt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 12:52:02 -0000 Author: bapt Date: Tue Oct 21 12:52:01 2014 New Revision: 273382 URL: https://svnweb.freebsd.org/changeset/base/273382 Log: Fix build by marking the new functions as weak This is a temporary fix Modified: head/contrib/libcxxrt/stdexcept.cc Modified: head/contrib/libcxxrt/stdexcept.cc ============================================================================== --- head/contrib/libcxxrt/stdexcept.cc Tue Oct 21 10:19:45 2014 (r273381) +++ head/contrib/libcxxrt/stdexcept.cc Tue Oct 21 12:52:01 2014 (r273382) @@ -82,13 +82,23 @@ const char* bad_typeid::what() const thr return "std::bad_typeid"; } +__attribute__((weak)) bad_array_new_length::bad_array_new_length() throw() {} +__attribute__((weak)) bad_array_new_length::~bad_array_new_length() {} +__attribute__((weak)) bad_array_new_length::bad_array_new_length(const bad_array_new_length&) throw() {} +__attribute__((weak)) bad_array_new_length& bad_array_new_length::operator=(const bad_array_new_length&) throw() { return *this; } +__attribute__((weak)) +const char *bad_array_new_length::what() const throw() +{ + return "std::bad_array_new_length"; +} + } // namespace std From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 13:07:36 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CD3E2FFF; Tue, 21 Oct 2014 13:07:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B99BFA5C; Tue, 21 Oct 2014 13:07:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LD7a43058773; Tue, 21 Oct 2014 13:07:36 GMT (envelope-from brueffer@FreeBSD.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LD7a18058771; Tue, 21 Oct 2014 13:07:36 GMT (envelope-from brueffer@FreeBSD.org) Message-Id: <201410211307.s9LD7a18058771@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: brueffer set sender to brueffer@FreeBSD.org using -f From: Christian Brueffer Date: Tue, 21 Oct 2014 13:07:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273383 - stable/10/sys/dev/amdtemp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 13:07:36 -0000 Author: brueffer Date: Tue Oct 21 13:07:36 2014 New Revision: 273383 URL: https://svnweb.freebsd.org/changeset/base/273383 Log: MFC: r273034 Add one more AMD Kaveri APU device ID. Submitted by: Remy Nonnenmacher Modified: stable/10/sys/dev/amdtemp/amdtemp.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/amdtemp/amdtemp.c ============================================================================== --- stable/10/sys/dev/amdtemp/amdtemp.c Tue Oct 21 12:52:01 2014 (r273382) +++ stable/10/sys/dev/amdtemp/amdtemp.c Tue Oct 21 13:07:36 2014 (r273383) @@ -80,6 +80,7 @@ struct amdtemp_softc { #define DEVICEID_AMD_MISC14 0x1703 #define DEVICEID_AMD_MISC15 0x1603 #define DEVICEID_AMD_MISC16 0x1533 +#define DEVICEID_AMD_MISC17 0x141d static struct amdtemp_product { uint16_t amdtemp_vendorid; @@ -92,6 +93,7 @@ static struct amdtemp_product { { VENDORID_AMD, DEVICEID_AMD_MISC14 }, { VENDORID_AMD, DEVICEID_AMD_MISC15 }, { VENDORID_AMD, DEVICEID_AMD_MISC16 }, + { VENDORID_AMD, DEVICEID_AMD_MISC17 }, { 0, 0 } }; From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 13:09:53 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9503C205; Tue, 21 Oct 2014 13:09:53 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 80CC4A88; Tue, 21 Oct 2014 13:09:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LD9r5V059186; Tue, 21 Oct 2014 13:09:53 GMT (envelope-from brueffer@FreeBSD.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LD9rZx059185; Tue, 21 Oct 2014 13:09:53 GMT (envelope-from brueffer@FreeBSD.org) Message-Id: <201410211309.s9LD9rZx059185@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: brueffer set sender to brueffer@FreeBSD.org using -f From: Christian Brueffer Date: Tue, 21 Oct 2014 13:09:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r273384 - stable/9/sys/dev/amdtemp X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 13:09:53 -0000 Author: brueffer Date: Tue Oct 21 13:09:52 2014 New Revision: 273384 URL: https://svnweb.freebsd.org/changeset/base/273384 Log: MFC: r273034 Add one more AMD Kaveri APU device ID. Submitted by: Remy Nonnenmacher Modified: stable/9/sys/dev/amdtemp/amdtemp.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/amdtemp/amdtemp.c ============================================================================== --- stable/9/sys/dev/amdtemp/amdtemp.c Tue Oct 21 13:07:36 2014 (r273383) +++ stable/9/sys/dev/amdtemp/amdtemp.c Tue Oct 21 13:09:52 2014 (r273384) @@ -77,6 +77,7 @@ struct amdtemp_softc { #define DEVICEID_AMD_MISC10 0x1203 #define DEVICEID_AMD_MISC11 0x1303 #define DEVICEID_AMD_MISC16 0x1533 +#define DEVICEID_AMD_MISC17 0x141d static struct amdtemp_product { uint16_t amdtemp_vendorid; @@ -86,6 +87,7 @@ static struct amdtemp_product { { VENDORID_AMD, DEVICEID_AMD_MISC10 }, { VENDORID_AMD, DEVICEID_AMD_MISC11 }, { VENDORID_AMD, DEVICEID_AMD_MISC16 }, + { VENDORID_AMD, DEVICEID_AMD_MISC17 }, { 0, 0 } }; From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 14:47:27 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4BD1370D; Tue, 21 Oct 2014 14:47:27 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 36E5B854; Tue, 21 Oct 2014 14:47:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LElRkN005863; Tue, 21 Oct 2014 14:47:27 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LElQ7I005861; Tue, 21 Oct 2014 14:47:26 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201410211447.s9LElQ7I005861@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 21 Oct 2014 14:47:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273385 - stable/10/share/man/man8 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 14:47:27 -0000 Author: emaste Date: Tue Oct 21 14:47:26 2014 New Revision: 273385 URL: https://svnweb.freebsd.org/changeset/base/273385 Log: Add basic UEFI boot procedure manpage MFC of r273218 and r273235. Added: stable/10/share/man/man8/uefi.8 - copied, changed from r273218, head/share/man/man8/uefi.8 Modified: stable/10/share/man/man8/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man8/Makefile ============================================================================== --- stable/10/share/man/man8/Makefile Tue Oct 21 13:09:52 2014 (r273384) +++ stable/10/share/man/man8/Makefile Tue Oct 21 14:47:26 2014 (r273385) @@ -11,6 +11,7 @@ MAN= crash.8 \ rc.sendmail.8 \ rc.subr.8 \ rescue.8 \ + ${_uefi.8} \ yp.8 MLINKS= rc.8 rc.atm.8 \ @@ -25,4 +26,8 @@ MLINKS+=yp.8 NIS.8 \ yp.8 nis.8 \ yp.8 YP.8 +.if ${MACHINE_CPUARCH} == "amd64" +_uefi.8= uefi.8 +.endif + .include Copied and modified: stable/10/share/man/man8/uefi.8 (from r273218, head/share/man/man8/uefi.8) ============================================================================== --- head/share/man/man8/uefi.8 Fri Oct 17 13:50:37 2014 (r273218, copy source) +++ stable/10/share/man/man8/uefi.8 Tue Oct 21 14:47:26 2014 (r273385) @@ -31,10 +31,10 @@ .Nm UEFI .Nd Unified Extensible Firmware Interface bootstrapping procedures .Sh DESCRIPTION -The +The .Nm Unified Extensible Firmware Interface provides boot- and run-time services -services to operating systems. +to operating systems. .Nm is a replacement for the legacy BIOS on the i386 and amd64 CPU architectures, and is also used on arm64 and ia64. @@ -43,7 +43,7 @@ The .Nm boot process loads system bootstrap code located in an EFI System Partition (ESP). -The ESP is a GPT or MBR parition with a specific identifier that contains an +The ESP is a GPT or MBR partition with a specific identifier that contains an .Xr msdosfs 5 FAT file system with a specified file hierarchy. .Bl -column -offset indent ".Sy Partition Scheme" ".Sy ESP Identifier" @@ -100,7 +100,7 @@ FAT file system image containing for use by .Xr bsdinstall 8 and the -.Ar bootcode +.Ar bootcode argument to .Xr gpart 8 . .It Pa /boot/loader.efi @@ -110,26 +110,6 @@ default kernel .It Pa /boot/kernel.old/kernel typical non-default kernel (optional) .El -.Sh CAVEATS -EFI environment variables are not supported by -.Xr loader 8 -or the kernel. -.Pp -.Pa boot1.efi -loads -.Pa loader.efi -from the first FreeBSD-UFS file system it locates, even if it is on a -different disk. -.Pp -.Pa boot1.efi -cannot load -.Pa loader.efi -from a -.Xr ZFS 8 -file system. -As a result, -.Nm -does not support a typical root file system on ZFS configuration. .Sh SEE ALSO .Xr vt 4 , .Xr msdosfs 5 , @@ -150,3 +130,23 @@ and The .Fx Foundation sponsored portions of the work. +.Sh CAVEATS +EFI environment variables are not supported by +.Xr loader 8 +or the kernel. +.Pp +.Pa boot1.efi +loads +.Pa loader.efi +from the first FreeBSD-UFS file system it locates, even if it is on a +different disk. +.Pp +.Pa boot1.efi +cannot load +.Pa loader.efi +from a +.Xr ZFS 8 +file system. +As a result, +.Nm +does not support a typical root file system on ZFS configuration. From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 16:16:09 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4450EA2A; Tue, 21 Oct 2014 16:16:09 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D9856223; Tue, 21 Oct 2014 16:16:08 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id s9LGG2qS070638 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 21 Oct 2014 19:16:02 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua s9LGG2qS070638 Received: (from kostik@localhost) by tom.home (8.14.9/8.14.9/Submit) id s9LGG2HA070637; Tue, 21 Oct 2014 19:16:02 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 21 Oct 2014 19:16:02 +0300 From: Konstantin Belousov To: Hans Petter Selasky Subject: Re: svn commit: r273377 - in head: share/man/man9 sys/amd64/amd64 sys/arm/arm sys/cam/scsi sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/dev/dtrace sys/compat/ndis sys/dev/acpi_support sys/de... Message-ID: <20141021161602.GD1877@kib.kiev.ua> References: <201410210731.s9L7VMww096983@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201410210731.s9L7VMww096983@svn.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 16:16:09 -0000 On Tue, Oct 21, 2014 at 07:31:22AM +0000, Hans Petter Selasky wrote: > Author: hselasky > Date: Tue Oct 21 07:31:21 2014 > New Revision: 273377 > URL: https://svnweb.freebsd.org/changeset/base/273377 > > Log: > Fix multiple incorrect SYSCTL arguments in the kernel: > > - Wrong integer type was specified. > > - Wrong or missing "access" specifier. The "access" specifier > sometimes included the SYSCTL type, which it should not, except for > procedural SYSCTL nodes. > > - Logical OR where binary OR was expected. > > - Properly assert the "access" argument passed to all SYSCTL macros, > using the CTASSERT macro. This applies to both static- and dynamically > created SYSCTLs. > > - Properly assert the the data type for both static and dynamic > SYSCTLs. In the case of static SYSCTLs we only assert that the data > pointed to by the SYSCTL data pointer has the correct size, hence > there is no easy way to assert types in the C language outside a > C-function. > > - Rewrote some code which doesn't pass a constant "access" specifier > when creating dynamic SYSCTL nodes, which is now a requirement. > > - Updated "EXAMPLES" section in SYSCTL manual page. > > MFC after: 3 days > Sponsored by: Mellanox Technologies > > Modified: > head/share/man/man9/Makefile > head/share/man/man9/sysctl.9 > head/sys/amd64/amd64/fpu.c > head/sys/arm/arm/busdma_machdep-v6.c > head/sys/arm/arm/busdma_machdep.c > head/sys/cam/scsi/scsi_sa.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c > head/sys/cddl/dev/dtrace/dtrace_sysctl.c > head/sys/compat/ndis/kern_ndis.c > head/sys/dev/acpi_support/acpi_asus.c > head/sys/dev/acpi_support/acpi_asus_wmi.c > head/sys/dev/acpi_support/acpi_hp.c > head/sys/dev/acpi_support/acpi_ibm.c > head/sys/dev/acpi_support/acpi_rapidstart.c > head/sys/dev/acpi_support/acpi_sony.c > head/sys/dev/bxe/bxe.c > head/sys/dev/cxgb/cxgb_sge.c > head/sys/dev/cxgbe/t4_main.c > head/sys/dev/e1000/if_em.c > head/sys/dev/e1000/if_igb.c > head/sys/dev/e1000/if_lem.c > head/sys/dev/hatm/if_hatm.c > head/sys/dev/ixgbe/ixgbe.c > head/sys/dev/ixgbe/ixv.c > head/sys/dev/ixl/if_ixl.c > head/sys/dev/mpr/mpr.c > head/sys/dev/mps/mps.c > head/sys/dev/mrsas/mrsas.c > head/sys/dev/mrsas/mrsas.h > head/sys/dev/mxge/if_mxge.c > head/sys/dev/oce/oce_sysctl.c > head/sys/dev/qlxgb/qla_os.c > head/sys/dev/qlxgbe/ql_os.c > head/sys/dev/rt/if_rt.c > head/sys/dev/sound/pci/hda/hdaa.c > head/sys/dev/vxge/vxge.c > head/sys/dev/xen/netfront/netfront.c > head/sys/fs/devfs/devfs_devs.c > head/sys/fs/fuse/fuse_main.c > head/sys/fs/fuse/fuse_vfsops.c > head/sys/geom/geom_kern.c > head/sys/kern/kern_cpuset.c > head/sys/kern/kern_descrip.c > head/sys/kern/kern_mib.c > head/sys/kern/kern_synch.c > head/sys/kern/subr_devstat.c > head/sys/kern/subr_kdb.c > head/sys/kern/subr_uio.c > head/sys/kern/vfs_cache.c > head/sys/mips/mips/busdma_machdep.c > head/sys/net80211/ieee80211_ht.c > head/sys/net80211/ieee80211_hwmp.c > head/sys/net80211/ieee80211_mesh.c > head/sys/net80211/ieee80211_superg.c > head/sys/netgraph/bluetooth/common/ng_bluetooth.c > head/sys/netgraph/ng_base.c > head/sys/netgraph/ng_socket.c > head/sys/netinet/cc/cc_chd.c > head/sys/netinet/tcp_timer.c > head/sys/netipsec/ipsec.h > head/sys/netpfil/pf/pf.c > head/sys/ofed/drivers/net/mlx4/mlx4_en.h > head/sys/powerpc/powermac/fcu.c > head/sys/powerpc/powermac/smu.c > head/sys/powerpc/powerpc/cpu.c > head/sys/sys/sysctl.h > head/sys/vm/memguard.c > head/sys/vm/vm_kern.c > head/sys/x86/x86/busdma_bounce.c This seems to break at least PowerPC 64bit, or some bits were not committed. I have to add the following change to compile GENERIC64 kernel, otherwise I get cc1: warnings being treated as errors /usr/home/kostik/work/build/bsd/DEV/src/sys/powerpc/powerpc/busdma_machdep.c: In function 'alloc_bounce_zone': /usr/home/kostik/work/build/bsd/DEV/src/sys/powerpc/powerpc/busdma_machdep.c:1030: warning: initialization from incompatible pointer type *** [busdma_machdep.o] Error code 1 OTOH, I did not verified that 32bit PowerPC kernel is compilable with the change applied. diff --git a/sys/powerpc/powerpc/busdma_machdep.c b/sys/powerpc/powerpc/busdma_machdep.c index e35ecec..b58a91b 100644 --- a/sys/powerpc/powerpc/busdma_machdep.c +++ b/sys/powerpc/powerpc/busdma_machdep.c @@ -1027,9 +1027,9 @@ alloc_bounce_zone(bus_dma_tag_t dmat) SYSCTL_ADD_STRING(busdma_sysctl_tree(bz), SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO, "lowaddr", CTLFLAG_RD, bz->lowaddrid, 0, ""); - SYSCTL_ADD_INT(busdma_sysctl_tree(bz), + SYSCTL_ADD_ULONG(busdma_sysctl_tree(bz), SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO, - "alignment", CTLFLAG_RD, &bz->alignment, 0, ""); + "alignment", CTLFLAG_RD, &bz->alignment, ""); return (0); } From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 16:20:24 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CA3A7BB6; Tue, 21 Oct 2014 16:20:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AB3BE307; Tue, 21 Oct 2014 16:20:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LGKO2H048834; Tue, 21 Oct 2014 16:20:24 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LGKOWr048832; Tue, 21 Oct 2014 16:20:24 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201410211620.s9LGKOWr048832@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 21 Oct 2014 16:20:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r273386 - releng/10.1/share/man/man8 X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 16:20:25 -0000 Author: emaste Date: Tue Oct 21 16:20:23 2014 New Revision: 273386 URL: https://svnweb.freebsd.org/changeset/base/273386 Log: Add basic UEFI boot procedure manpage MFS10 of r273385 (r273218,r273235 in HEAD) Approved by: re (gjb) Added: releng/10.1/share/man/man8/uefi.8 - copied unchanged from r273385, stable/10/share/man/man8/uefi.8 Modified: releng/10.1/share/man/man8/Makefile Directory Properties: releng/10.1/ (props changed) Modified: releng/10.1/share/man/man8/Makefile ============================================================================== --- releng/10.1/share/man/man8/Makefile Tue Oct 21 14:47:26 2014 (r273385) +++ releng/10.1/share/man/man8/Makefile Tue Oct 21 16:20:23 2014 (r273386) @@ -11,6 +11,7 @@ MAN= crash.8 \ rc.sendmail.8 \ rc.subr.8 \ rescue.8 \ + ${_uefi.8} \ yp.8 MLINKS= rc.8 rc.atm.8 \ @@ -25,4 +26,8 @@ MLINKS+=yp.8 NIS.8 \ yp.8 nis.8 \ yp.8 YP.8 +.if ${MACHINE_CPUARCH} == "amd64" +_uefi.8= uefi.8 +.endif + .include Copied: releng/10.1/share/man/man8/uefi.8 (from r273385, stable/10/share/man/man8/uefi.8) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ releng/10.1/share/man/man8/uefi.8 Tue Oct 21 16:20:23 2014 (r273386, copy of r273385, stable/10/share/man/man8/uefi.8) @@ -0,0 +1,152 @@ +.\" Copyright (c) 2014 The FreeBSD Foundation +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS 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 AUTHORS 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 October 17, 2014 +.Dt UEFI 8 +.Os +.Sh NAME +.Nm UEFI +.Nd Unified Extensible Firmware Interface bootstrapping procedures +.Sh DESCRIPTION +The +.Nm +Unified Extensible Firmware Interface provides boot- and run-time services +to operating systems. +.Nm +is a replacement for the legacy BIOS on the i386 and amd64 CPU architectures, +and is also used on arm64 and ia64. +.Pp +The +.Nm +boot process loads system bootstrap code located in an EFI System Partition +(ESP). +The ESP is a GPT or MBR partition with a specific identifier that contains an +.Xr msdosfs 5 +FAT file system with a specified file hierarchy. +.Bl -column -offset indent ".Sy Partition Scheme" ".Sy ESP Identifier" +.It Sy "Partition Scheme" Ta Sy "ESP Identifier" +.It GPT Ta C12A7328-F81F-11D2-BA4B-00A0C93EC93B +.It MBR Ta 0xEF +.El +.Pp +The +.Nm +boot process proceeds as follows: +.Bl -enum -offset indent -compact +.It +.Nm +firmware runs at power up and searches for an OS loader in the EFI system +partition. +The path to the loader may be set by an EFI environment variable. +If not set, the default is +.Pa /EFI/BOOT/BOOTX64.EFI . +The default +.Nm +boot configuration for +.Fx +installs +.Pa boot1.efi +as +.Pa /EFI/BOOT/BOOTX64.EFI . +.It +.Pa boot1.efi +locates the first partition with the type +.Li freebsd-ufs , +and from it loads +.Pa loader.efi . +.It +.Pa loader.efi +loads and boots the kernel, as described in +.Xr loader 8 . +.El +.Pp +The +.Xr vt 4 +system console is automatically selected when booting via +.Nm . +.Sh FILES +.Bl -tag -width /boot/loader -compact +.It Pa /boot/boot1.efi +First stage +.Nm +bootstrap +.It Pa /boot/boot1.efifat +.Xr msdosfs 5 +FAT file system image containing +.Pa boot1.efi +for use by +.Xr bsdinstall 8 +and the +.Ar bootcode +argument to +.Xr gpart 8 . +.It Pa /boot/loader.efi +Final stage bootstrap +.It Pa /boot/kernel/kernel +default kernel +.It Pa /boot/kernel.old/kernel +typical non-default kernel (optional) +.El +.Sh SEE ALSO +.Xr vt 4 , +.Xr msdosfs 5 , +.Xr boot 8 , +.Xr gpart 8 +.Sh HISTORY +.Nm +boot support first appeared in +.Fx 10.1 . +.Sh AUTHORS +.An -nosplit +.Nm +boot support was developed by +.An Benno Rice Aq Mt benno@FreeBSD.org , +.An Ed Maste Aq Mt emaste@FreeBSD.org , +and +.An Nathan Whitehorn Aq Mt nwhitehorn@FreeBSD.org . +The +.Fx +Foundation sponsored portions of the work. +.Sh CAVEATS +EFI environment variables are not supported by +.Xr loader 8 +or the kernel. +.Pp +.Pa boot1.efi +loads +.Pa loader.efi +from the first FreeBSD-UFS file system it locates, even if it is on a +different disk. +.Pp +.Pa boot1.efi +cannot load +.Pa loader.efi +from a +.Xr ZFS 8 +file system. +As a result, +.Nm +does not support a typical root file system on ZFS configuration. From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 16:44:04 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3C8433B0; Tue, 21 Oct 2014 16:44:04 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1D0D3798; Tue, 21 Oct 2014 16:44:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LGi3Ct062985; Tue, 21 Oct 2014 16:44:03 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LGi3B7062984; Tue, 21 Oct 2014 16:44:03 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201410211644.s9LGi3B7062984@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 21 Oct 2014 16:44:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r273387 - stable/9/contrib/libc-vis X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 16:44:04 -0000 Author: brooks Date: Tue Oct 21 16:44:03 2014 New Revision: 273387 URL: https://svnweb.freebsd.org/changeset/base/273387 Log: MFC r271287: Merge from NetBSD: PR/49185: Conrad Meyer: strvisx: Handle zero-length input strings gracefully. (don't abuse 0 to mean compute string length internally) PR: 193447 Submitted by: Conrad Meyer Modified: stable/9/contrib/libc-vis/vis.c Directory Properties: stable/9/contrib/libc-vis/ (props changed) Modified: stable/9/contrib/libc-vis/vis.c ============================================================================== --- stable/9/contrib/libc-vis/vis.c Tue Oct 21 16:20:23 2014 (r273386) +++ stable/9/contrib/libc-vis/vis.c Tue Oct 21 16:44:03 2014 (r273387) @@ -1,4 +1,4 @@ -/* $NetBSD: vis.c,v 1.60 2013/02/21 16:21:20 joerg Exp $ */ +/* $NetBSD: vis.c,v 1.62 2014/09/08 17:35:01 christos Exp $ */ /*- * Copyright (c) 1989, 1993 @@ -57,7 +57,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: vis.c,v 1.60 2013/02/21 16:21:20 joerg Exp $"); +__RCSID("$NetBSD: vis.c,v 1.62 2014/09/08 17:35:01 christos Exp $"); #endif /* LIBC_SCCS and not lint */ #ifdef __FBSDID __FBSDID("$FreeBSD$"); @@ -357,7 +357,7 @@ istrsenvisx(char *mbdst, size_t *dlen, c ssize_t mbslength, maxolen; _DIAGASSERT(mbdst != NULL); - _DIAGASSERT(mbsrc != NULL); + _DIAGASSERT(mbsrc != NULL || mblength == 0); _DIAGASSERT(mbextra != NULL); /* @@ -375,8 +375,6 @@ istrsenvisx(char *mbdst, size_t *dlen, c /* Allocate space for the wide char strings */ psrc = pdst = extra = NULL; - if (!mblength) - mblength = strlen(mbsrc); if ((psrc = calloc(mblength + 1, sizeof(*psrc))) == NULL) return -1; if ((pdst = calloc((4 * mblength) + 1, sizeof(*pdst))) == NULL) @@ -528,6 +526,15 @@ out: free(psrc); return error; } + +static int +istrsenvisxl(char *mbdst, size_t *dlen, const char *mbsrc, + int flags, const char *mbextra, int *cerr_ptr) +{ + return istrsenvisx(mbdst, dlen, mbsrc, + mbsrc != NULL ? strlen(mbsrc) : 0, flags, mbextra, cerr_ptr); +} + #endif #if !HAVE_SVIS @@ -571,13 +578,13 @@ snvis(char *mbdst, size_t dlen, int c, i int strsvis(char *mbdst, const char *mbsrc, int flags, const char *mbextra) { - return istrsenvisx(mbdst, NULL, mbsrc, 0, flags, mbextra, NULL); + return istrsenvisxl(mbdst, NULL, mbsrc, flags, mbextra, NULL); } int strsnvis(char *mbdst, size_t dlen, const char *mbsrc, int flags, const char *mbextra) { - return istrsenvisx(mbdst, &dlen, mbsrc, 0, flags, mbextra, NULL); + return istrsenvisxl(mbdst, &dlen, mbsrc, flags, mbextra, NULL); } int @@ -646,13 +653,13 @@ nvis(char *mbdst, size_t dlen, int c, in int strvis(char *mbdst, const char *mbsrc, int flags) { - return istrsenvisx(mbdst, NULL, mbsrc, 0, flags, "", NULL); + return istrsenvisxl(mbdst, NULL, mbsrc, flags, "", NULL); } int strnvis(char *mbdst, size_t dlen, const char *mbsrc, int flags) { - return istrsenvisx(mbdst, &dlen, mbsrc, 0, flags, "", NULL); + return istrsenvisxl(mbdst, &dlen, mbsrc, flags, "", NULL); } /* From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 17:15:55 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 05F6FC36 for ; Tue, 21 Oct 2014 17:15:55 +0000 (UTC) Received: from mail-pd0-x22c.google.com (mail-pd0-x22c.google.com [IPv6:2607:f8b0:400e:c02::22c]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CE994AF7 for ; Tue, 21 Oct 2014 17:15:54 +0000 (UTC) Received: by mail-pd0-f172.google.com with SMTP id ft15so1729746pdb.17 for ; Tue, 21 Oct 2014 10:15:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=references:mime-version:in-reply-to:content-type :content-transfer-encoding:message-id:cc:from:subject:date:to; bh=+SnSnvLOKhBqHmckUs50WDuru3IUcRmsdW4SjEGyXLY=; b=h/g9aao8eX1jIknFrIm3FN1LEhBK5VBoVAgmSHDl6KK+OmXOqMXjmsHBfjwtBREW3H OSJh8CFGO+6lztWP6j45h7xY/exJbEpJyN7MkCESnvESw+3hzkNgBElYNQyKO8MkOZVH IkXi04m/TE1U+RykDZk95xvDILtAurjFmjVUX7/0y/Ee+WiwuXukKHyUJGvNzm+aHvMG 1Dz4tFYS2D81tpzkvIKPw75tux+sf7yVWKyGzlSnbMA2BeCxVzVU0CjugABOCbImQLbF 5GxLGDUarZyK+Ng2AfxS6RMu879S6uhUvhhYFDVhJWcrmgEZVTgHl9h7YDcced3aNS3h T9mw== X-Received: by 10.70.47.132 with SMTP id d4mr13254553pdn.59.1413911754446; Tue, 21 Oct 2014 10:15:54 -0700 (PDT) Received: from [192.168.20.11] (c-98-247-240-204.hsd1.wa.comcast.net. [98.247.240.204]) by mx.google.com with ESMTPSA id t11sm12374790pdj.89.2014.10.21.10.15.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 21 Oct 2014 10:15:53 -0700 (PDT) References: <201410130033.s9D0XxVu081401@svn.freebsd.org> <1B16315B-B1B2-48D4-94FA-FF92802F7A3F@gmail.com> Mime-Version: 1.0 (1.0) In-Reply-To: <1B16315B-B1B2-48D4-94FA-FF92802F7A3F@gmail.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Message-Id: <8C1C24C1-9BD7-4425-957F-DD96E83FE7CD@gmail.com> X-Mailer: iPhone Mail (11D257) From: Garrett Cooper Subject: Re: svn commit: r273017 - head/contrib/netbsd-tests/lib/libc/locale Date: Tue, 21 Oct 2014 10:15:51 -0700 To: Warner Losh Cc: svn-src-all@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 17:15:55 -0000 > On Oct 21, 2014, at 8:22, Warner Losh wrote: >=20 > Any reason you added #fidefs around this? It is needed on NetBSD too :) Agreed. NetBSD seems to work thanks to header pollution though. I opened several upstream PRs to fix #include issues. The #ifdefs make it cl= ear how the tests differ (and for me what needs to be pushed back). Thanks!= From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 17:17:41 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6DE72C9E; Tue, 21 Oct 2014 17:17:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 59DBFB10; Tue, 21 Oct 2014 17:17:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LHHfR9079284; Tue, 21 Oct 2014 17:17:41 GMT (envelope-from jmg@FreeBSD.org) Received: (from jmg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LHHfmF079283; Tue, 21 Oct 2014 17:17:41 GMT (envelope-from jmg@FreeBSD.org) Message-Id: <201410211717.s9LHHfmF079283@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jmg set sender to jmg@FreeBSD.org using -f From: John-Mark Gurney Date: Tue, 21 Oct 2014 17:17:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273388 - head/share/man/man9 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 17:17:41 -0000 Author: jmg Date: Tue Oct 21 17:17:40 2014 New Revision: 273388 URL: https://svnweb.freebsd.org/changeset/base/273388 Log: spell out the arguments.. the + *offsetp does not belong w/ the type, move it outside the .Fn macro... Modified: head/share/man/man9/mbuf.9 Modified: head/share/man/man9/mbuf.9 ============================================================================== --- head/share/man/man9/mbuf.9 Tue Oct 21 16:44:03 2014 (r273387) +++ head/share/man/man9/mbuf.9 Tue Oct 21 17:17:40 2014 (r273388) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 5, 2014 +.Dd October 21, 2014 .Dt MBUF 9 .Os .\" @@ -738,15 +738,16 @@ the offset in the data region of the to the data contained in the returned mbuf is stored in .Fa *offsetp . If -.Fa offp +.Fa offsetp is NULL, the region may be accessed using .Fn mtod mbuf type . If -.Fa offp +.Fa offsetp is non-NULL, the region may be accessed using -.Fn mtod mbuf uint8_t + *offsetp . +.Fn mtod mbuf uint8_t ++ *offsetp. The region of the mbuf chain between its beginning and -.Fa off +.Fa offset is not modified, therefore it is safe to hold pointers to data within this region before calling .Fn m_pulldown . From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 17:56:07 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3DE1178B; Tue, 21 Oct 2014 17:56:07 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0FAAFF14; Tue, 21 Oct 2014 17:56:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LHu64p098074; Tue, 21 Oct 2014 17:56:06 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LHu6Q9098073; Tue, 21 Oct 2014 17:56:06 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410211756.s9LHu6Q9098073@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Tue, 21 Oct 2014 17:56:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273389 - head/contrib/netbsd-tests/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 17:56:07 -0000 Author: ngie Date: Tue Oct 21 17:56:06 2014 New Revision: 273389 URL: https://svnweb.freebsd.org/changeset/base/273389 Log: Port lib/libc/gen/t_siginfo to FreeBSD - mcontext_t on FreeBSD doesn't have a __gregs field (it's split out on FreeBSD into separate fields). In order to avoid muddying the test code with MD code, the debugging trace info has not been implemented - FreeBSD does not implement the si_stime and si_utime fields in siginfo_t, so omit the debugging code that dumps the values - sys/inttypes.h doesn't exist on FreeBSD Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/gen/t_siginfo.c Modified: head/contrib/netbsd-tests/lib/libc/gen/t_siginfo.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/gen/t_siginfo.c Tue Oct 21 17:17:40 2014 (r273388) +++ head/contrib/netbsd-tests/lib/libc/gen/t_siginfo.c Tue Oct 21 17:56:06 2014 (r273389) @@ -29,7 +29,9 @@ #include #include +#if defined(__NetBSD__) #include +#endif #include #include #include @@ -86,9 +88,11 @@ sig_debug(int signo, siginfo_t *info, uc printf("uc_stack %p %lu 0x%x\n", ctx->uc_stack.ss_sp, (unsigned long)ctx->uc_stack.ss_size, ctx->uc_stack.ss_flags); +#if defined(__NetBSD__) for (i = 0; i < __arraycount(ctx->uc_mcontext.__gregs); i++) printf("uc_mcontext.greg[%d] 0x%lx\n", i, (long)ctx->uc_mcontext.__gregs[i]); +#endif } } @@ -141,8 +145,10 @@ sigchild_action(int signo, siginfo_t *in printf("si_uid=%d\n", info->si_uid); printf("si_pid=%d\n", info->si_pid); printf("si_status=%d\n", info->si_status); +#if defined(__NetBSD__) printf("si_utime=%lu\n", (unsigned long int)info->si_utime); printf("si_stime=%lu\n", (unsigned long int)info->si_stime); +#endif } ATF_REQUIRE_EQ(info->si_code, code); ATF_REQUIRE_EQ(info->si_signo, SIGCHLD); From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 17:57:13 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 358138DF; Tue, 21 Oct 2014 17:57:13 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 21843F2C; Tue, 21 Oct 2014 17:57:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LHvDOj098248; Tue, 21 Oct 2014 17:57:13 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LHvCMS098247; Tue, 21 Oct 2014 17:57:12 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410211757.s9LHvCMS098247@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Tue, 21 Oct 2014 17:57:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273390 - head/contrib/netbsd-tests/lib/libc/stdlib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 17:57:13 -0000 Author: ngie Date: Tue Oct 21 17:57:12 2014 New Revision: 273390 URL: https://svnweb.freebsd.org/changeset/base/273390 Log: libutil.h is required for fparseln on FreeBSD Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/stdlib/h_getopt.c Modified: head/contrib/netbsd-tests/lib/libc/stdlib/h_getopt.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/stdlib/h_getopt.c Tue Oct 21 17:56:06 2014 (r273389) +++ head/contrib/netbsd-tests/lib/libc/stdlib/h_getopt.c Tue Oct 21 17:57:12 2014 (r273390) @@ -34,6 +34,9 @@ #include #include #include +#if defined(__FreeBSD__) +#include +#endif #define WS "\t\n " #define debug 0 From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 17:58:54 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8F8BCA3A; Tue, 21 Oct 2014 17:58:54 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7BC4AF3C; Tue, 21 Oct 2014 17:58:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LHwsiM098479; Tue, 21 Oct 2014 17:58:54 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LHwsph098478; Tue, 21 Oct 2014 17:58:54 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410211758.s9LHwsph098478@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Tue, 21 Oct 2014 17:58:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273391 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 17:58:54 -0000 Author: ngie Date: Tue Oct 21 17:58:53 2014 New Revision: 273391 URL: https://svnweb.freebsd.org/changeset/base/273391 Log: Add missing #include for sys/stat.h for fchmod Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_access.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_access.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_access.c Tue Oct 21 17:57:12 2014 (r273390) +++ head/contrib/netbsd-tests/lib/libc/sys/t_access.c Tue Oct 21 17:58:53 2014 (r273391) @@ -40,6 +40,10 @@ __RCSID("$NetBSD: t_access.c,v 1.1 2011/ #include +#if defined(__FreeBSD__) +#include +#endif + static const char path[] = "access"; static const int mode[4] = { R_OK, W_OK, X_OK, F_OK }; From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 17:59:28 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9882AB74; Tue, 21 Oct 2014 17:59:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 84A23F3F; Tue, 21 Oct 2014 17:59:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LHxS8M098605; Tue, 21 Oct 2014 17:59:28 GMT (envelope-from jmg@FreeBSD.org) Received: (from jmg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LHxSqh098604; Tue, 21 Oct 2014 17:59:28 GMT (envelope-from jmg@FreeBSD.org) Message-Id: <201410211759.s9LHxSqh098604@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jmg set sender to jmg@FreeBSD.org using -f From: John-Mark Gurney Date: Tue, 21 Oct 2014 17:59:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273392 - head/share/man/man9 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 17:59:28 -0000 Author: jmg Date: Tue Oct 21 17:59:27 2014 New Revision: 273392 URL: https://svnweb.freebsd.org/changeset/base/273392 Log: it is not cast to a pointer of the specified type, it is cast to the specified type... mtod(m, uint8_t) does not work, mtod(m, uint8_t *) does work.. Modified: head/share/man/man9/mbuf.9 Modified: head/share/man/man9/mbuf.9 ============================================================================== --- head/share/man/man9/mbuf.9 Tue Oct 21 17:58:53 2014 (r273391) +++ head/share/man/man9/mbuf.9 Tue Oct 21 17:59:27 2014 (r273392) @@ -355,7 +355,7 @@ developer with common utilities. Convert an .Fa mbuf pointer to a data pointer. -The macro expands to the data pointer cast to the pointer of the specified +The macro expands to the data pointer cast to the specified .Fa type . .Sy Note : It is advisable to ensure that there is enough contiguous data in From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 18:00:56 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id ECCA2CD9; Tue, 21 Oct 2014 18:00:56 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BFC14FE2; Tue, 21 Oct 2014 18:00:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LI0unX002566; Tue, 21 Oct 2014 18:00:56 GMT (envelope-from jimharris@FreeBSD.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LI0uDe002565; Tue, 21 Oct 2014 18:00:56 GMT (envelope-from jimharris@FreeBSD.org) Message-Id: <201410211800.s9LI0uDe002565@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jimharris set sender to jimharris@FreeBSD.org using -f From: Jim Harris Date: Tue, 21 Oct 2014 18:00:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273394 - head/sys/dev/ixl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 18:00:57 -0000 Author: jimharris Date: Tue Oct 21 18:00:56 2014 New Revision: 273394 URL: https://svnweb.freebsd.org/changeset/base/273394 Log: ixl: remove i40e_register_x710_int.h This file is not used by the FreeBSD ixl driver. Submitted by: Eric Joyner MFC after: 3 days Deleted: head/sys/dev/ixl/i40e_register_x710_int.h From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 18:00:56 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 76AE2CD6; Tue, 21 Oct 2014 18:00:56 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 626D2FE1; Tue, 21 Oct 2014 18:00:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LI0uul002554; Tue, 21 Oct 2014 18:00:56 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LI0u5u002553; Tue, 21 Oct 2014 18:00:56 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410211800.s9LI0u5u002553@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Tue, 21 Oct 2014 18:00:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273393 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 18:00:56 -0000 Author: ngie Date: Tue Oct 21 18:00:55 2014 New Revision: 273393 URL: https://svnweb.freebsd.org/changeset/base/273393 Log: Port t_write to FreeBSD - Mark the signo variable for the signal handle __unused - Use limits.h instead of sys/syslimits.h (the latter does not exist on FreeBSD) Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_write.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_write.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_write.c Tue Oct 21 17:59:27 2014 (r273392) +++ head/contrib/netbsd-tests/lib/libc/sys/t_write.c Tue Oct 21 18:00:55 2014 (r273393) @@ -32,7 +32,9 @@ __COPYRIGHT("@(#) Copyright (c) 2008\ __RCSID("$NetBSD: t_write.c,v 1.2 2011/10/19 16:19:30 jruoho Exp $"); #include +#if defined(__NetBSD__) #include +#endif #include #include @@ -43,13 +45,21 @@ __RCSID("$NetBSD: t_write.c,v 1.2 2011/1 #include #include +#if defined(__FreeBSD__) +#include +#endif + static void sighandler(int); static bool fail = false; static const char *path = "write"; static void +#if defined(__FreeBSD__) +sighandler(int signo __unused) +#else sighandler(int signo) +#endif { fail = false; } From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 18:01:37 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E75C6F5E; Tue, 21 Oct 2014 18:01:37 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D3290FF3; Tue, 21 Oct 2014 18:01:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LI1bFq002731; Tue, 21 Oct 2014 18:01:37 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LI1bm8002730; Tue, 21 Oct 2014 18:01:37 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410211801.s9LI1bm8002730@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Tue, 21 Oct 2014 18:01:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273395 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 18:01:38 -0000 Author: ngie Date: Tue Oct 21 18:01:37 2014 New Revision: 273395 URL: https://svnweb.freebsd.org/changeset/base/273395 Log: Mark osi __unused so this compiles cleanly on FreeBSD Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_timer_create.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_timer_create.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_timer_create.c Tue Oct 21 18:00:56 2014 (r273394) +++ head/contrib/netbsd-tests/lib/libc/sys/t_timer_create.c Tue Oct 21 18:01:37 2014 (r273395) @@ -38,7 +38,11 @@ static timer_t t; static bool fail = true; static void +#if defined(__FreeBSD__) +timer_signal_handler(int signo, siginfo_t *si, void *osi __unused) +#else timer_signal_handler(int signo, siginfo_t *si, void *osi) +#endif { timer_t *tp; From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 18:06:04 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E5D6A1C3; Tue, 21 Oct 2014 18:06:04 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D1A51CB; Tue, 21 Oct 2014 18:06:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LI64OO003434; Tue, 21 Oct 2014 18:06:04 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LI64hf003433; Tue, 21 Oct 2014 18:06:04 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410211806.s9LI64hf003433@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Tue, 21 Oct 2014 18:06:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273396 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 18:06:05 -0000 Author: ngie Date: Tue Oct 21 18:06:04 2014 New Revision: 273396 URL: https://svnweb.freebsd.org/changeset/base/273396 Log: unlink("/") fails with EISDIR instead of EBUSY on FreeBSD; test for that instead Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_unlink.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_unlink.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_unlink.c Tue Oct 21 18:01:37 2014 (r273395) +++ head/contrib/netbsd-tests/lib/libc/sys/t_unlink.c Tue Oct 21 18:06:04 2014 (r273396) @@ -85,7 +85,11 @@ ATF_TC_BODY(unlink_err, tc) (void)memset(buf, 'x', sizeof(buf)); errno = 0; +#if defined(__FreeBSD__) + ATF_REQUIRE_ERRNO(EISDIR, unlink("/") == -1); +#else ATF_REQUIRE_ERRNO(EBUSY, unlink("/") == -1); +#endif errno = 0; ATF_REQUIRE_ERRNO(ENAMETOOLONG, unlink(buf) == -1); From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 18:10:05 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D6C4E4A7; Tue, 21 Oct 2014 18:10:05 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C2C4110A; Tue, 21 Oct 2014 18:10:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LIA516004253; Tue, 21 Oct 2014 18:10:05 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LIA5Mb004252; Tue, 21 Oct 2014 18:10:05 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410211810.s9LIA5Mb004252@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Tue, 21 Oct 2014 18:10:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273397 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 18:10:05 -0000 Author: ngie Date: Tue Oct 21 18:10:05 2014 New Revision: 273397 URL: https://svnweb.freebsd.org/changeset/base/273397 Log: Port t_chroot to FreeBSD - Add missing #include sys/stat.h for mkdir(2) - Omit the fchroot(2) tests because the support is not present on FreeBSD Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_chroot.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_chroot.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_chroot.c Tue Oct 21 18:06:04 2014 (r273396) +++ head/contrib/netbsd-tests/lib/libc/sys/t_chroot.c Tue Oct 21 18:10:05 2014 (r273397) @@ -42,6 +42,10 @@ __RCSID("$NetBSD: t_chroot.c,v 1.1 2011/ #include #include +#ifdef __FreeBSD__ +#include +#endif + ATF_TC(chroot_basic); ATF_TC_HEAD(chroot_basic, tc) { @@ -167,6 +171,7 @@ ATF_TC_BODY(chroot_perm, tc) atf_tc_fail("chroot(2) succeeded as unprivileged user"); } +#ifdef __NetBSD__ ATF_TC(fchroot_basic); ATF_TC_HEAD(fchroot_basic, tc) { @@ -298,6 +303,7 @@ ATF_TC_BODY(fchroot_perm, tc) if (WIFEXITED(sta) == 0 || WEXITSTATUS(sta) != EXIT_SUCCESS) atf_tc_fail("fchroot(2) succeeded as unprivileged user"); } +#endif ATF_TP_ADD_TCS(tp) { @@ -305,9 +311,11 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, chroot_basic); ATF_TP_ADD_TC(tp, chroot_err); ATF_TP_ADD_TC(tp, chroot_perm); +#ifdef __NetBSD__ ATF_TP_ADD_TC(tp, fchroot_basic); ATF_TP_ADD_TC(tp, fchroot_err); ATF_TP_ADD_TC(tp, fchroot_perm); +#endif return atf_no_error(); } From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 18:31:13 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E3B0BA93; Tue, 21 Oct 2014 18:31:12 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CC44635F; Tue, 21 Oct 2014 18:31:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LIVCvk016553; Tue, 21 Oct 2014 18:31:12 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LIV8Hh016529; Tue, 21 Oct 2014 18:31:08 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201410211831.s9LIV8Hh016529@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Tue, 21 Oct 2014 18:31:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r273398 - in stable/9/usr.sbin/bsdconfig: dot dot/include examples include includes share share/media share/packages X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 18:31:13 -0000 Author: dteske Date: Tue Oct 21 18:31:08 2014 New Revision: 273398 URL: https://svnweb.freebsd.org/changeset/base/273398 Log: MFC revisions 253175, 268999, 269027, 269351-269352, 269354, 269460, 270283, 270505, 270954, 270989, 273067, and 273068: r253175: Introduce f_which() to common.subr r268999: Add new bsdconfig example scripts; remove obsolete ones r269027: Update bsdconfig dot module; fixes and enhancements r269351: Add setvar() for non-FreeBSD platforms using bash as /bin/sh r269352: Fix syntax error when run under bash r269354: Update setvar() function introduced in r269351 r269460: Update f_xdialog_info() in bsdconfig's dialog.subr include r270283: Add `-A' flag to pkg-install(8) when installing dependencies r270505: Optimize f_which() to be slightly faster still (common.subr) r270954: Update f_dialog_init() for safer getopts usage (dialog.subr) r270989: Fix for previously mentioned r270954 r273067: Fix awk(1) asorti() implementation to work when called in a loop r273068: Rename awk(1) asorti() to prevent conflict with GNU awk(1) Added: stable/9/usr.sbin/bsdconfig/examples/add_some_packages.sh - copied unchanged from r268999, head/usr.sbin/bsdconfig/examples/add_some_packages.sh stable/9/usr.sbin/bsdconfig/share/packages/musthavepkg.subr - copied unchanged from r268999, head/usr.sbin/bsdconfig/share/packages/musthavepkg.subr Deleted: stable/9/usr.sbin/bsdconfig/examples/browse_packages_ftp.sh Modified: stable/9/usr.sbin/bsdconfig/dot/dot stable/9/usr.sbin/bsdconfig/dot/include/messages.subr stable/9/usr.sbin/bsdconfig/examples/Makefile stable/9/usr.sbin/bsdconfig/examples/browse_packages_http.sh stable/9/usr.sbin/bsdconfig/include/messages.subr stable/9/usr.sbin/bsdconfig/includes/includes stable/9/usr.sbin/bsdconfig/share/common.subr stable/9/usr.sbin/bsdconfig/share/device.subr stable/9/usr.sbin/bsdconfig/share/dialog.subr stable/9/usr.sbin/bsdconfig/share/media/http.subr stable/9/usr.sbin/bsdconfig/share/media/httpproxy.subr stable/9/usr.sbin/bsdconfig/share/packages/Makefile stable/9/usr.sbin/bsdconfig/share/packages/index.subr (contents, props changed) stable/9/usr.sbin/bsdconfig/share/packages/packages.subr (contents, props changed) Directory Properties: stable/9/usr.sbin/bsdconfig/ (props changed) stable/9/usr.sbin/bsdconfig/share/packages/categories.subr (props changed) Modified: stable/9/usr.sbin/bsdconfig/dot/dot ============================================================================== --- stable/9/usr.sbin/bsdconfig/dot/dot Tue Oct 21 18:10:05 2014 (r273397) +++ stable/9/usr.sbin/bsdconfig/dot/dot Tue Oct 21 18:31:08 2014 (r273398) @@ -249,6 +249,7 @@ if [ "$SHOW_INCLUDES" ]; then $menu_program_list \ $submenu_program_list \ $cmd_program_list \ + $BSDCFG_SHARE/script.subr \ ; do [ -e "$file" ] && echo $file done | sort -u @@ -299,12 +300,6 @@ if [ "$SHOW_INCLUDES" ]; then fi # -# Add script.subr to includes if it exists -# -[ -f $BSDCFG_SHARE/script.subr ] && - include_file_list="$include_file_list script.subr" - -# # Start the directional-graph (digraph) output # printf 'strict digraph "" { // Empty name to prevent SVG Auto-Tooltip\n' @@ -352,7 +347,7 @@ printf '\tnode [\n' printf '\t\tfontname = "Times-Roman",\n' printf '\t\tfontsize = 12,\n' printf '\t\twidth = 2.5, // arbitrary minimum width for all nodes\n' -printf '\t\tfixedsize, // turn minimum width into exact width\n' +printf '\t\tfixedsize = true, // turn minimum width into exact width\n' printf '\t];\n' # @@ -546,34 +541,36 @@ printf '\t\tbgcolor = "%s";\n' "$bgcolor printf '\t\tlabel = "bsdconfig(8)";\n' printf '\t\ttooltip = "bsdconfig(8)";\n' print_node "bsdconfig" +end_nodelist if [ "$SHOW_INCLUDES" ]; then - printf '\t\tsubgraph "cluster_includes" {\n' - printf '\t\t\tbgcolor = "%s";\n' "$bgcolor_includes" - printf '\t\t\tlabel = "%s";\n' "$msg_includes" - for include_file in $include_file_list; do echo $include_file - done | awk -v bgcolor="$bgcolor_bsdconfig" ' - BEGIN { created = 0 } - function end_subgraph() { printf "\t\t\t};\n" } - ( $0 !~ "/" ) { - if ( ! created ) - { - printf "\t\t\tsubgraph \"%s\" {\n", - "cluster_bsdconfig_includes" - printf "\t\t\t\tbgcolor = \"%s\";\n", bgcolor - printf "\t\t\t\tlabel = \"bsdconfig\";\n" - created++ + done | awk \ + -v bgcolor="$bgcolor_bsdconfig" \ + -v msg_subroutines="$msg_subroutines" \ + ' + BEGIN { created = 0 } + function end_subgraph() { printf "\t};\n" } + ( $0 !~ "/" ) { + if ( ! created ) + { + printf "\tsubgraph \"%s\" {\n", + "cluster_bsdconfig_includes" + printf "\t\tbgcolor = \"%s\";\n", bgcolor + printf "\t\tlabel = \"bsdconfig %s\";\n", + msg_subroutines + created++ + } + printf "\t\t\"%s\";\n", $1 } - printf "\t\t\t\t\"%s\";\n", $1 - } - END { created && end_subgraph() }' + END { created && end_subgraph() } + ' # END-QUOTE for include_file in $include_file_list; do echo $include_file - done | awk ' + done | awk -v msg_subroutines="$msg_subroutines" ' BEGIN { created = 0 } - function end_subgraph() { printf "\t\t\t};\n" } + function end_subgraph() { printf "\t};\n" } ( $0 ~ "/" ) { include_dir_tmp = $1 sub("/[^/]*$", "", include_dir_tmp) @@ -588,20 +585,18 @@ if [ "$SHOW_INCLUDES" ]; then if ( ! created ) { include_dir = include_dir_tmp - printf "\t\t\tsubgraph \"cluster_%s_includes\" {\n", + printf "\tsubgraph \"cluster_%s_includes\" {\n", include_dir - printf "\t\t\t\tbgcolor = \"white\";\n" - printf "\t\t\t\tlabel = \"%s\";\n", include_dir + printf "\t\tbgcolor = \"thistle\";\n" + printf "\t\tlabel = \"%s %s\";\n", include_dir, + msg_subroutines created++ } - printf "\t\t\t\t\"%s\";\n", $1 + printf "\t\t\"%s\";\n", $1 } END { created && end_subgraph() }' - - printf '\t\t};\n' fi -end_nodelist for INDEX in */INDEX; do menu_title= menu_help= @@ -676,7 +671,7 @@ for INDEX in */INDEX; do end_nodelist done -printf '\n};\n' +printf '\n}\n' ################################################################################ # END Modified: stable/9/usr.sbin/bsdconfig/dot/include/messages.subr ============================================================================== --- stable/9/usr.sbin/bsdconfig/dot/include/messages.subr Tue Oct 21 18:10:05 2014 (r273397) +++ stable/9/usr.sbin/bsdconfig/dot/include/messages.subr Tue Oct 21 18:31:08 2014 (r273398) @@ -28,3 +28,4 @@ msg_graph_label_with_command="bsdconfig( msg_graph_label_with_command_and_date="bsdconfig(8)\\\ndot(1) output generated by \`\`%s'' on\\\n%s" msg_includes="Includes" msg_shortcuts="Shortcuts" +msg_subroutines="Subroutines" Modified: stable/9/usr.sbin/bsdconfig/examples/Makefile ============================================================================== --- stable/9/usr.sbin/bsdconfig/examples/Makefile Tue Oct 21 18:10:05 2014 (r273397) +++ stable/9/usr.sbin/bsdconfig/examples/Makefile Tue Oct 21 18:31:08 2014 (r273398) @@ -3,7 +3,7 @@ NO_OBJ= FILESDIR= ${SHAREDIR}/examples/bsdconfig -FILES= browse_packages_ftp.sh browse_packages_http.sh bsdconfigrc +FILES= add_some_packages.sh browse_packages_http.sh bsdconfigrc beforeinstall: mkdir -p ${DESTDIR}${FILESDIR} Copied: stable/9/usr.sbin/bsdconfig/examples/add_some_packages.sh (from r268999, head/usr.sbin/bsdconfig/examples/add_some_packages.sh) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/usr.sbin/bsdconfig/examples/add_some_packages.sh Tue Oct 21 18:31:08 2014 (r273398, copy of r268999, head/usr.sbin/bsdconfig/examples/add_some_packages.sh) @@ -0,0 +1,13 @@ +#!/bin/sh +# $FreeBSD$ +# +# This sample installs a short list of packages from the main HTTP site. +# +[ "$_SCRIPT_SUBR" ] || . /usr/share/bsdconfig/script.subr || exit 1 +nonInteractive=1 +_httpPath=http://pkg.freebsd.org +mediaSetHTTP +mediaOpen +for package in wget bash rsync; do + packageAdd +done Modified: stable/9/usr.sbin/bsdconfig/examples/browse_packages_http.sh ============================================================================== --- stable/9/usr.sbin/bsdconfig/examples/browse_packages_http.sh Tue Oct 21 18:10:05 2014 (r273397) +++ stable/9/usr.sbin/bsdconfig/examples/browse_packages_http.sh Tue Oct 21 18:31:08 2014 (r273398) @@ -1,25 +1,32 @@ #!/bin/sh # $FreeBSD$ # -# This sample downloads the package INDEX file from HTTP to /tmp (if it doesn't -# already exist) and then displays the package configuration/management screen -# using the local INDEX file (results in faster browsing of packages from-start -# since the INDEX can be loaded from local media). +# This sample downloads the package digests.txz and packagesite.txz files from +# HTTP to /tmp (if they don't already exist) and then displays the package +# configuration/management screen using the local files (resulting in faster +# browsing of packages from-start since digests.txz/packagesite.txz can be +# loaded from local media). # -# NOTE: Packages cannot be installed unless staged to /tmp/packages/All +# NOTE: Packages cannot be installed unless staged to +# /tmp/packages/$PKG_ABI/All # -. /usr/share/bsdconfig/script.subr +[ "$_SCRIPT_SUBR" ] || . /usr/share/bsdconfig/script.subr || exit 1 nonInteractive=1 +f_musthavepkg_init # Make sure we have a usable pkg(8) with $PKG_ABI TMPDIR=/tmp -if [ ! -e "$TMPDIR/packages/INDEX" ]; then - [ -d "$TMPDIR/packages" ] || mkdir -p "$TMPDIR/packages" || exit 1 - _httpPath=http://ftp.freebsd.org - # For older releases, use http://ftp-archive.freebsd.org - mediaSetHTTP - mediaOpen - f_show_info "Downloading packages/INDEX from\n %s" "$_httpPath" - f_device_get device_media packages/INDEX > $TMPDIR/packages/INDEX -fi +PKGDIR=$TMPDIR/packages/$PKG_ABI +[ -d "$PKGDIR" ] || mkdir -p "$PKGDIR" || exit 1 +for file in digests.txz packagesite.txz; do + [ -s "$PKGDIR/$file" ] && continue + if [ ! "$HTTP_INITIALIZED" ]; then + _httpPath=http://pkg.freebsd.org + mediaSetHTTP + mediaOpen + fi + f_show_info "Downloading %s from\n %s" "$file" "$_httpPath" + f_device_get device_media "/$PKG_ABI/latest/$file" > $PKGDIR/$file || + exit 1 +done _directoryPath=$TMPDIR mediaSetDirectory configPackages Modified: stable/9/usr.sbin/bsdconfig/include/messages.subr ============================================================================== --- stable/9/usr.sbin/bsdconfig/include/messages.subr Tue Oct 21 18:10:05 2014 (r273397) +++ stable/9/usr.sbin/bsdconfig/include/messages.subr Tue Oct 21 18:31:08 2014 (r273398) @@ -57,6 +57,7 @@ msg_back="Back" msg_becoming_root_via_sudo="Becoming root via sudo(8)..." msg_benchmarks_desc="Utilities for measuring system performance." msg_biology_desc="Software related to biology." +msg_bootstrapping_pkg="Bootstrapping pkg(8)..." msg_brazil="Brazil" msg_building_package_menus="Building package menu(s)..." msg_cad_desc="Computer Aided Design utilities." @@ -142,8 +143,6 @@ msg_generating_index_from_pkg_database=" msg_geography_desc="Geography-related software." msg_german_desc="Ported software for Germanic countries." msg_germany="Germany" -msg_getting_package_categories_via_pkg_rquery="Getting package categories via pkg-rquery(8)..." -msg_getting_package_dependencies_via_pkg_rquery="Getting package dependencies via pkg-rquery(8)\n(this can take a while)..." msg_gnome_desc="Components of the Gnome Desktop environment." msg_gnustep_desc="Software for GNUstep desktop environment." msg_graphics_desc="Graphics libraries and utilities." @@ -219,6 +218,7 @@ msg_misc_desc="Miscellaneous utilities." msg_missing_ftp_host_or_directory="Missing FTP host or directory specification. FTP media not initialized." msg_multimedia_desc="Multimedia software." msg_must_be_root_to_execute="%s: must be root to execute" +msg_must_have_pkg_to_execute="%s: must have pkg(8) to execute" msg_must_specify_a_host_name_of_some_sort="Must specify a host name of some sort!" msg_name_server="Name server" msg_net_desc="Networking utilities." @@ -274,6 +274,7 @@ msg_perl5_desc="Utilities/modules for th msg_permission_denied="%s: %s: Permission denied" msg_pkg_delete_failed="Warning: pkg-delete(8) of %s failed.\n Run with debugging for details." msg_pkg_install_apparently_did_not_like_the_package="pkg-install(8) apparently did not like the %s package." +msg_pkg_not_yet_installed_install_now="pkg(8) not yet installed. Install now?" msg_plan9_desc="Software from the Plan9 operating system." msg_please_check_the_url_and_try_again="No such directory: %s\nplease check the URL and try again.\n" msg_please_enter_password="Please enter your password for sudo(8):" @@ -376,15 +377,13 @@ msg_unable_to_get_proper_ftp_path="Unabl msg_unable_to_initialize_media_type_for_package_extract="Unable to initialize media type for package extract." msg_unable_to_make_directory_mountpoint="Unable to make %s directory mountpoint for %s!" msg_unable_to_open="Unable to open %s" -msg_unable_to_pkg_rquery_package_categories="Unable to pkg-rquery(8) package categories!" -msg_unable_to_pkg_rquery_package_dependencies="Unable to pkg-rquery(8) package dependencies!" msg_unable_to_update_pkg_from_selected_media="Unable to update pkg(8) from selected media." msg_uninstall="Uninstall" msg_uninstall_desc="Mark this package for deletion" msg_uninstalling_package_waiting_for_pkg_delete="Uninstalling %s package - waiting for pkg-delete(8)" msg_unknown="unknown" msg_unknown_user="Unknown user: %s" -msg_url_was_not_found="%s was not found, maybe directory or release-version are wrong?" +msg_url_was_not_found="%s was not found,\nmaybe directory or release-version are wrong?" msg_usa="USA" msg_usage="Usage" msg_usb="USB" Modified: stable/9/usr.sbin/bsdconfig/includes/includes ============================================================================== --- stable/9/usr.sbin/bsdconfig/includes/includes Tue Oct 21 18:10:05 2014 (r273397) +++ stable/9/usr.sbin/bsdconfig/includes/includes Tue Oct 21 18:31:08 2014 (r273398) @@ -69,10 +69,12 @@ show_include() -v use_color=${USE_COLOR:-0} \ -v re="$pattern" \ -v show_desc=${SHOW_DESC:-0} ' - function asorti(src, dest) + function _asorti(src, dest) { + k = nitems = 0; + # Copy src indices to dest and calculate array length - nitems = 0; for (i in src) dest[++nitems] = i + for (i in src) dest[++nitems] = i # Sort the array of indices (dest) using insertion sort method for (i = 1; i <= nitems; k = i++) @@ -118,7 +120,7 @@ show_include() } } END { - n = asorti(syntax, sorted_indices) + n = _asorti(syntax, sorted_indices) for (i = 1; i <= n; i++) printf "%s", syntax[sorted_indices[i]] }' "$file" ) Modified: stable/9/usr.sbin/bsdconfig/share/common.subr ============================================================================== --- stable/9/usr.sbin/bsdconfig/share/common.subr Tue Oct 21 18:10:05 2014 (r273397) +++ stable/9/usr.sbin/bsdconfig/share/common.subr Tue Oct 21 18:31:08 2014 (r273398) @@ -62,12 +62,6 @@ export UNAME_S="$( uname -s )" # Operati export UNAME_P="$( uname -p )" # Processor Architecture (i.e. i386) export UNAME_M="$( uname -m )" # Machine platform (i.e. i386) export UNAME_R="$( uname -r )" # Release Level (i.e. X.Y-RELEASE) -if [ ! "${PKG_ABI+set}" ]; then - export PKG_ABI="$( - ASSUME_ALWAYS_YES=1 pkg -vv 2> /dev/null | - awk '$1=="ABI"{print $3;exit}' - )" -fi # # Default behavior is to call f_debug_init() automatically when loaded. @@ -226,6 +220,65 @@ f_have() f_quietly type "$@" } +# setvar $var_to_set [$value] +# +# Implement setvar for shells unlike FreeBSD sh(1). +# +if ! f_have setvar; then +setvar() +{ + [ $# -gt 0 ] || return $SUCCESS + local __setvar_var_to_set="$1" __setvar_right="$2" __setvar_left= + case $# in + 1) unset "$__setvar_var_to_set" + return $? ;; + 2) : fall through ;; + *) f_err "setvar: too many arguments\n" + return $FAILURE + esac + case "$__setvar_var_to_set" in *[!0-9A-Za-z_]*) + f_err "setvar: %s: bad variable name\n" "$__setvar_var_to_set" + return 2 + esac + while case "$__setvar_r" in *\'*) : ;; *) false ; esac + do + __setvar_left="$__setvar_left${__setvar_right%%\'*}'\\''" + __setvar_right="${__setvar_right#*\'}" + done + __setvar_left="$__setvar_left${__setvar_right#*\'}" + eval "$__setvar_var_to_set='$__setvar_left'" +} +fi + +# f_which $anything [$var_to_set] +# +# A fast built-in replacement for syntaxes such as foo=$( which bar ). In a +# comparison of 10,000 runs of this function versus which, this function +# completed in under 3 seconds, while `which' took almost a full minute. +# +# If $var_to_set is missing or NULL, output is (like which) to standard out. +# Returns success if a match was found, failure otherwise. +# +f_which() +{ + local __name="$1" __var_to_set="$2" + case "$__name" in */*|'') return $FAILURE; esac + local __p __exec IFS=":" __found= + for __p in $PATH; do + __exec="$__p/$__name" + [ -f "$__exec" -a -x "$__exec" ] && __found=1 break + done + if [ "$__found" ]; then + if [ "$__var_to_set" ]; then + setvar "$__var_to_set" "$__exec" + else + echo "$__exec" + fi + return $SUCCESS + fi + return $FAILURE +} + # f_getvar $var_to_get [$var_to_set] # # Utility function designed to go along with the already-builtin setvar. Modified: stable/9/usr.sbin/bsdconfig/share/device.subr ============================================================================== --- stable/9/usr.sbin/bsdconfig/share/device.subr Tue Oct 21 18:10:05 2014 (r273397) +++ stable/9/usr.sbin/bsdconfig/share/device.subr Tue Oct 21 18:31:08 2014 (r273398) @@ -1116,8 +1116,9 @@ f_device_shutdown() f_device_sort_by_awk=' # Variables that should be defined on the invocation line: # -v prop="property" -function asorti(src, dest) +function _asorti(src, dest) { + k = nitems = 0 for (i in src) dest[++nitems] = i for (i = 1; i <= nitems; k = i++) { idx = dest[i] @@ -1136,7 +1137,7 @@ function asorti(src, dest) } } END { - nitems = asorti(devices, devices_sorted) + nitems = _asorti(devices, devices_sorted) for (i = 1; i <= nitems; i++) print devices[devices_sorted[i]] } ' Modified: stable/9/usr.sbin/bsdconfig/share/dialog.subr ============================================================================== --- stable/9/usr.sbin/bsdconfig/share/dialog.subr Tue Oct 21 18:10:05 2014 (r273397) +++ stable/9/usr.sbin/bsdconfig/share/dialog.subr Tue Oct 21 18:31:08 2014 (r273398) @@ -1557,12 +1557,22 @@ f_dialog_info() # EOF. This implies that you must execute this either as an rvalue to a pipe, # lvalue to indirection or in a sub-shell that provides data on stdin. # +# To open an Xdialog(1) infobox that does not disappear until expeclitly dis- +# missed, use the following: +# +# f_xdialog_info "$info_text" < /dev/tty & +# pid=$! +# # Perform some lengthy actions +# kill $pid +# +# NB: Check $USE_XDIALOG if you need to support both dialog(1) and Xdialog(1). +# f_xdialog_info() { local info_text="$*" height width f_dialog_infobox_size height width \ "$DIALOG_TITLE" "$DIALOG_BACKTITLE" "$info_text" - $DIALOG \ + exec $DIALOG \ --title "$DIALOG_TITLE" \ --backtitle "$DIALOG_BACKTITLE" \ --no-close --no-buttons \ @@ -2099,9 +2109,14 @@ f_dialog_init() # # Process stored command-line arguments # + # NB: Using backticks instead of $(...) for portability since Linux + # bash(1) balks at the right parentheses encountered in the case- + # statement (incorrectly interpreting it as the close of $(...)). + # f_dprintf "f_dialog_init: ARGV=[%s] GETOPTS_STDARGS=[%s]" \ "$ARGV" "$GETOPTS_STDARGS" - SECURE=$( set -- $ARGV + SECURE=`set -- $ARGV + OPTIND=1 while getopts \ "$GETOPTS_STDARGS$GETOPTS_EXTRA$GETOPTS_ALLFLAGS" \ flag > /dev/null; do @@ -2109,8 +2124,9 @@ f_dialog_init() S) echo 1 ;; esac done - ) - USE_XDIALOG=$( set -- $ARGV + ` # END-BACKTICK + USE_XDIALOG=`set -- $ARGV + OPTIND=1 while getopts \ "$GETOPTS_STDARGS$GETOPTS_EXTRA$GETOPTS_ALLFLAGS" \ flag > /dev/null; do @@ -2118,7 +2134,7 @@ f_dialog_init() S|X) echo 1 ;; esac done - ) + ` # END-BACKTICK f_dprintf "f_dialog_init: SECURE=[%s] USE_XDIALOG=[%s]" \ "$SECURE" "$USE_XDIALOG" Modified: stable/9/usr.sbin/bsdconfig/share/media/http.subr ============================================================================== --- stable/9/usr.sbin/bsdconfig/share/media/http.subr Tue Oct 21 18:10:05 2014 (r273397) +++ stable/9/usr.sbin/bsdconfig/share/media/http.subr Tue Oct 21 18:31:08 2014 (r273398) @@ -515,10 +515,7 @@ f_media_init_http() fi esac - if [ $http_found -eq $SUCCESS ]; then - HTTP_INITIALIZED=YES - break - fi + [ $http_found -eq $SUCCESS ] && HTTP_INITIALIZED=YES break f_getvar $VAR_HTTP_PATH http_path f_show_msg "$msg_please_check_the_url_and_try_again" \ @@ -668,7 +665,7 @@ f_media_get_http() 44) f_show_msg "$msg_url_was_not_found" "$url" ;; 4) f_show_msg "$msg_client_error" ;; *) f_show_msg "$msg_error_when_requesting_url" "$url" ;; - esac + esac 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD return $FAILURE } Modified: stable/9/usr.sbin/bsdconfig/share/media/httpproxy.subr ============================================================================== --- stable/9/usr.sbin/bsdconfig/share/media/httpproxy.subr Tue Oct 21 18:10:05 2014 (r273397) +++ stable/9/usr.sbin/bsdconfig/share/media/httpproxy.subr Tue Oct 21 18:31:08 2014 (r273398) @@ -452,7 +452,7 @@ f_media_get_http_proxy() 44) f_show_msg "$msg_url_was_not_found" "$url" ;; 4) f_show_msg "$msg_client_error" ;; *) f_show_msg "$msg_error_when_requesting_url" "$url" ;; - esac + esac 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD return $FAILURE } Modified: stable/9/usr.sbin/bsdconfig/share/packages/Makefile ============================================================================== --- stable/9/usr.sbin/bsdconfig/share/packages/Makefile Tue Oct 21 18:10:05 2014 (r273397) +++ stable/9/usr.sbin/bsdconfig/share/packages/Makefile Tue Oct 21 18:31:08 2014 (r273398) @@ -3,7 +3,7 @@ NO_OBJ= FILESDIR= ${SHAREDIR}/bsdconfig/packages -FILES= categories.subr index.subr packages.subr +FILES= categories.subr index.subr musthavepkg.subr packages.subr beforeinstall: mkdir -p ${DESTDIR}${FILESDIR} Modified: stable/9/usr.sbin/bsdconfig/share/packages/index.subr ============================================================================== --- stable/9/usr.sbin/bsdconfig/share/packages/index.subr Tue Oct 21 18:10:05 2014 (r273397) +++ stable/9/usr.sbin/bsdconfig/share/packages/index.subr Tue Oct 21 18:31:08 2014 (r273398) @@ -33,6 +33,7 @@ BSDCFG_SHARE="/usr/share/bsdconfig" f_dprintf "%s: loading includes..." packages/index.subr f_include $BSDCFG_SHARE/device.subr f_include $BSDCFG_SHARE/media/common.subr +f_include $BSDCFG_SHARE/packages/musthavepkg.subr f_include $BSDCFG_SHARE/strings.subr BSDCFG_LIBE="/usr/libexec/bsdconfig" @@ -53,27 +54,6 @@ SQLITE_REPO="/var/db/pkg/repo-packagesit # PACKAGES_INDEX_CACHEFILE="/var/run/bsdconfig/packages_INDEX.cache" -# -# INDEX format for FreeBSD-6.0 or higher: -# -# package|port-origin|install-prefix|comment|port-desc-file|maintainer| -# categories|build-deps|run-deps|www-site|reserve|reserve|reserve|disc -# -INDEX_FORMAT="%n-%v" # package -INDEX_FORMAT="$INDEX_FORMAT|/usr/ports/%o" # port-origin -INDEX_FORMAT="$INDEX_FORMAT|%p" # install-prefix -INDEX_FORMAT="$INDEX_FORMAT|%c" # comment -INDEX_FORMAT="$INDEX_FORMAT|/usr/ports/%o/pkg-descr" # port-desc-file -INDEX_FORMAT="$INDEX_FORMAT|%m" # maintainer -INDEX_FORMAT="$INDEX_FORMAT|@CATEGORIES@" # place-holder -INDEX_FORMAT="$INDEX_FORMAT|" # build-deps -INDEX_FORMAT="$INDEX_FORMAT|@RUNDEPS@" # place-holder -INDEX_FORMAT="$INDEX_FORMAT|%w" # www-site -INDEX_FORMAT="$INDEX_FORMAT|" # reserved -INDEX_FORMAT="$INDEX_FORMAT|" # reserved -INDEX_FORMAT="$INDEX_FORMAT|" # reserved -INDEX_FORMAT="$INDEX_FORMAT|" # disc - ############################################################ FUNCTIONS # f_index_initialize [$var_to_set] @@ -87,13 +67,16 @@ INDEX_FORMAT="$INDEX_FORMAT|" # disc f_index_initialize() { local __funcname=f_index_initialize - local __var_to_set="${2:-PACKAGE_INDEX}" + local __var_to_set="${1:-PACKAGE_INDEX}" [ "$_INDEX_INITTED" ] && return $SUCCESS # Got any media? f_media_verify || return $FAILURE + # Make sure we have a usable pkg(8) with $PKG_ABI + f_musthavepkg_init + # Does it move when you kick it? f_device_init device_media || return $FAILURE @@ -126,9 +109,10 @@ f_index_initialize() __site="file://$MOUNTPOINT/packages/$PKG_ABI" esac - export PACKAGESITE="$__site" - f_dprintf "PACKAGESITE=[%s]" "$PACKAGESITE" - if ! f_eval_catch $__funcname pkg "pkg update"; then + f_dprintf "PACKAGESITE=[%s]" "$__site" + if ! f_eval_catch $__funcname pkg \ + 'PACKAGESITE="%s" pkg update' "$__site" + then f_show_err "$msg_unable_to_update_pkg_from_selected_media" f_device_shutdown device_media return $FAILURE @@ -195,53 +179,8 @@ f_index_initialize() # If we reach this point, we need to generate the data from scratch # - f_show_info "$msg_getting_package_categories_via_pkg_rquery" - if ! eval "$( pkg rquery "%n-%v %C" | awk ' - { categories[$1] = categories[$1] " " $2 } - END { - for (package in categories) - { - cats = categories[package] - sub(/^ /, "", cats) - gsub(/[^[:alnum:]_]/, "_", package) - printf "local _%s_categories=\"%s\";\n", package, cats - } - }' )"; then - f_show_err "$msg_unable_to_pkg_rquery_package_dependencies" - f_device_shutdown device_media - return $FAILURE - fi - - f_show_info "$msg_getting_package_dependencies_via_pkg_rquery" - if ! eval "$( pkg rquery "%n-%v %dn-%dv" | awk ' - { rundeps[$1] = rundeps[$1] " " $2 } - END { - for (package in rundeps) - { - deps = rundeps[package] - sub(/^ /, "", deps) - gsub(/[^[:alnum:]_]/, "_", package) - printf "local _%s_rundeps=\"%s\";\n", package, deps - } - }' )"; then - f_show_err "$msg_unable_to_pkg_rquery_package_dependencies" - f_device_shutdown device_media - return $FAILURE - fi - f_show_info "$msg_generating_index_from_pkg_database" - eval "$__var_to_set"='$( pkg rquery "$INDEX_FORMAT" | - while read LINE; do - package="${LINE%%|*}"; - f_str2varname "$package" varpkg; - eval f_replaceall \"\$LINE\" \"\|@CATEGORIES@\|\" \ - \"\|\$_${varpkg}_categories\|\" LINE - eval f_replaceall \"\$LINE\" \"\|@RUNDEPS@\|\" \ - \"\|\$_${varpkg}_rundeps\|\" LINE - echo "$LINE" - done - )' # always returns true (status of last item in pipe-chain) - eval "$__var_to_set"='$( debug= f_getvar "$__var_to_set" | sort )' + eval "$__var_to_set"='$( pkg rquery -I | sort )' # # Attempt to create the persistant on-disk cache @@ -302,10 +241,12 @@ f_index_read() export msg_packages eval "$( debug= f_getvar "$var_to_get" | awk -F'|' ' - function asorti(src, dest) + function _asorti(src, dest) { + k = nitems = 0 + # Copy src indices to dest and calculate array length - nitems = 0; for (i in src) dest[++nitems] = i + for (i in src) dest[++nitems] = i # Sort the array of indices (dest) using insertion sort method for (i = 1; i <= nitems; k = i++) @@ -351,7 +292,7 @@ f_index_read() END { print "_npkgs=" tpkgs # For convenience, total package count - n = asorti(categories, categories_sorted) + n = _asorti(categories, categories_sorted) # Produce package counts for each category for (i = 1; i <= n; i++) Copied: stable/9/usr.sbin/bsdconfig/share/packages/musthavepkg.subr (from r268999, head/usr.sbin/bsdconfig/share/packages/musthavepkg.subr) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/usr.sbin/bsdconfig/share/packages/musthavepkg.subr Tue Oct 21 18:31:08 2014 (r273398, copy of r268999, head/usr.sbin/bsdconfig/share/packages/musthavepkg.subr) @@ -0,0 +1,87 @@ +if [ ! "$_PACKAGES_MUSTHAVEPKG_SUBR" ]; then _PACKAGES_MUSTHAVEPKG_SUBR=1 +# +# Copyright (c) 2014 Devin Teske +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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$ +# +############################################################ INCLUDES + +BSDCFG_SHARE="/usr/share/bsdconfig" +. $BSDCFG_SHARE/common.subr || exit 1 +f_dprintf "%s: loading includes..." packages/musthavepkg.subr +f_include $BSDCFG_SHARE/dialog.subr +f_include $BSDCFG_SHARE/mustberoot.subr + +############################################################ FUNCTIONS + +# f_musthavepkg_init +# +# Validate pkg(8) is installed and set $PKG_ABI global if not already set. +# Returns success unless pkg(8) is not installed and user refuses to install +# it (upon prompt when running interactively). +# +f_musthavepkg_init() +{ + local funcname=f_musthavepkg_init + local pkg_abi_awk='$1~/^ABI/{print $NF; exit}' + + if [ "$PKG_ABI" ]; then # Already set + f_dprintf "PKG_ABI=[%s]" "$PKG_ABI" + export PKG_ABI + f_quietly pkg -N -vv # return status (pkg(8) functional?) + return $? + fi + + # Attempt to get PKG_ABI without prematurely bootstrapping pkg(8) + if f_eval_catch -k PKG_ABI $funcname pkg \ + "pkg -N -vv | awk '%s'" "$pkg_abi_awk" + then + f_dprintf "PKG_ABI=[%s]" "$PKG_ABI" + export PKG_ABI + return $SUCCESS + fi + + # pkg(8) not yet bootstrapped; ask for permission unless nonInteractive + f_dialog_yesno "$msg_pkg_not_yet_installed_install_now" || + f_die 1 "$msg_must_have_pkg_to_execute" "$pgm" + + f_mustberoot_init # Have to be root to install pkg(8) + + # Bootstrap pkg(8) + f_dialog_info "$msg_bootstrapping_pkg" + f_eval_catch -k PKG_ABI $funcname pkg \ + "ASSUME_ALWAYS_YES=1 pkg -vv | awk '%s'" "$pkg_abi_awk" || + f_die 1 "$msg_must_have_pkg_to_execute" "$pgm" + + f_dprintf "PKG_ABI=[%s]" "$PKG_ABI" + export PKG_ABI + return $SUCCESS +} + +############################################################ MAIN + +f_dprintf "%s: Successfully loaded." packages/musthavepkg.subr + +fi # ! $_PACKAGES_MUSTHAVEPKG_SUBR Modified: stable/9/usr.sbin/bsdconfig/share/packages/packages.subr ============================================================================== --- stable/9/usr.sbin/bsdconfig/share/packages/packages.subr Tue Oct 21 18:10:05 2014 (r273397) +++ stable/9/usr.sbin/bsdconfig/share/packages/packages.subr Tue Oct 21 18:31:08 2014 (r273398) @@ -36,6 +36,7 @@ f_include $BSDCFG_SHARE/device.subr f_include $BSDCFG_SHARE/media/common.subr f_include $BSDCFG_SHARE/packages/categories.subr f_include $BSDCFG_SHARE/packages/index.subr +f_include $BSDCFG_SHARE/packages/musthavepkg.subr f_include $BSDCFG_SHARE/strings.subr BSDCFG_LIBE="/usr/libexec/bsdconfig" @@ -662,7 +663,7 @@ f_package_review() f_package_config() { # Did we get an INDEX? - f_index_initialize packages/INDEX || return $FAILURE + f_index_initialize || return $FAILURE # Creates following variables (indirectly via f_index_read()) # CATEGORY_MENU_LIST _categories_{varpkg} _rundeps_{varpkg} # PACKAGE_CATEGORIES _npkgs @@ -839,7 +840,7 @@ f_package_add() { # Verify and initialize device media if-defined f_media_verify && f_device_init device_media && - f_index_initialize packages/INDEX + f_index_initialize } || return $FAILURE # Now we have (indirectly via f_index_read()): @@ -946,6 +947,8 @@ f_package_extract() local device="$1" name="$2" depended="$3" local devname= + f_musthavepkg_init # Make sure we have a usable pkg(8) with $PKG_ABI + $device get name devname f_dprintf "$funcname: device=[%s] name=[%s] depended=[%s]" \ "$devname" "$name" "$depended" @@ -1026,9 +1029,11 @@ f_package_extract() # Request the package be added via pkg-install(8) if f_debugging; then - f_eval_catch $funcname pkg 'pkg -d install -y "%s"' "$name" + f_eval_catch $funcname pkg \ + 'pkg -d install -${depended:+A}y "%s"' "$name" else - f_eval_catch $funcname pkg 'pkg install -y "%s"' "$name" + f_eval_catch $funcname pkg \ + 'pkg install -${depended:+A}y "%s"' "$name" fi if [ $? -ne $SUCCESS ]; then $alert "$msg_pkg_install_apparently_did_not_like_the_package" \ @@ -1065,7 +1070,7 @@ f_package_delete() { # Verify and initialize device media if-defined f_media_verify && f_device_init device_media && - f_index_initialize packages/INDEX + f_index_initialize } || return $FAILURE # Now we have (indirectly via f_index_read()): From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 19:00:38 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D4E9F4A0; Tue, 21 Oct 2014 19:00:38 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BB9428EC; Tue, 21 Oct 2014 19:00:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LJ0cSE030550; Tue, 21 Oct 2014 19:00:38 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LJ0XiD030248; Tue, 21 Oct 2014 19:00:33 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410211900.s9LJ0XiD030248@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 21 Oct 2014 19:00:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r273399 - in releng/10.1: . crypto/openssl crypto/openssl/apps crypto/openssl/crypto crypto/openssl/crypto/aes/asm crypto/openssl/crypto/asn1 crypto/openssl/crypto/bn crypto/openssl/cry... X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 19:00:39 -0000 Author: delphij Date: Tue Oct 21 19:00:32 2014 New Revision: 273399 URL: https://svnweb.freebsd.org/changeset/base/273399 Log: MFS r273149 (jkim): MFC: r273144, r273146 Merge OpenSSL 1.0.1j. This is part of an upcoming FreeBSD security advisory. Approved by: re (so@ blanket) Added: releng/10.1/crypto/openssl/crypto/constant_time_locl.h - copied unchanged from r273149, stable/10/crypto/openssl/crypto/constant_time_locl.h releng/10.1/crypto/openssl/crypto/constant_time_test.c - copied unchanged from r273149, stable/10/crypto/openssl/crypto/constant_time_test.c releng/10.1/crypto/openssl/doc/apps/c_rehash.pod - copied unchanged from r273149, stable/10/crypto/openssl/doc/apps/c_rehash.pod releng/10.1/crypto/openssl/doc/crypto/CMS_add1_signer.pod - copied unchanged from r273149, stable/10/crypto/openssl/doc/crypto/CMS_add1_signer.pod releng/10.1/secure/lib/libcrypto/man/CMS_add1_signer.3 - copied unchanged from r273149, stable/10/secure/lib/libcrypto/man/CMS_add1_signer.3 releng/10.1/secure/usr.bin/openssl/man/c_rehash.1 - copied unchanged from r273149, stable/10/secure/usr.bin/openssl/man/c_rehash.1 Deleted: releng/10.1/crypto/openssl/doc/crypto/CMS_sign_add1_signer.pod releng/10.1/secure/lib/libcrypto/man/CMS_sign_add1_signer.3 Modified: releng/10.1/ObsoleteFiles.inc releng/10.1/crypto/openssl/CHANGES releng/10.1/crypto/openssl/Configure releng/10.1/crypto/openssl/Makefile releng/10.1/crypto/openssl/NEWS releng/10.1/crypto/openssl/README releng/10.1/crypto/openssl/apps/s_client.c releng/10.1/crypto/openssl/crypto/Makefile releng/10.1/crypto/openssl/crypto/aes/asm/aesni-x86_64.pl releng/10.1/crypto/openssl/crypto/asn1/a_strex.c releng/10.1/crypto/openssl/crypto/bn/asm/x86_64-gcc.c releng/10.1/crypto/openssl/crypto/bn/bn_exp.c releng/10.1/crypto/openssl/crypto/bn/bn_nist.c releng/10.1/crypto/openssl/crypto/bn/exptest.c releng/10.1/crypto/openssl/crypto/dsa/dsa_ameth.c releng/10.1/crypto/openssl/crypto/ebcdic.h releng/10.1/crypto/openssl/crypto/ec/ec.h releng/10.1/crypto/openssl/crypto/ec/ec2_smpl.c releng/10.1/crypto/openssl/crypto/ec/ec_ameth.c releng/10.1/crypto/openssl/crypto/ec/ec_asn1.c releng/10.1/crypto/openssl/crypto/ec/ecp_mont.c releng/10.1/crypto/openssl/crypto/ec/ecp_nist.c releng/10.1/crypto/openssl/crypto/ec/ecp_smpl.c releng/10.1/crypto/openssl/crypto/ec/ectest.c releng/10.1/crypto/openssl/crypto/evp/Makefile releng/10.1/crypto/openssl/crypto/evp/e_aes.c releng/10.1/crypto/openssl/crypto/evp/evp_enc.c releng/10.1/crypto/openssl/crypto/md5/asm/md5-x86_64.pl releng/10.1/crypto/openssl/crypto/modes/modes.h releng/10.1/crypto/openssl/crypto/ocsp/ocsp_vfy.c releng/10.1/crypto/openssl/crypto/opensslconf.h releng/10.1/crypto/openssl/crypto/opensslv.h releng/10.1/crypto/openssl/crypto/ossl_typ.h releng/10.1/crypto/openssl/crypto/pkcs7/pkcs7.h releng/10.1/crypto/openssl/crypto/pqueue/pqueue.h releng/10.1/crypto/openssl/crypto/rsa/Makefile releng/10.1/crypto/openssl/crypto/rsa/rsa.h releng/10.1/crypto/openssl/crypto/rsa/rsa_err.c releng/10.1/crypto/openssl/crypto/rsa/rsa_oaep.c releng/10.1/crypto/openssl/crypto/rsa/rsa_pk1.c releng/10.1/crypto/openssl/crypto/rsa/rsa_sign.c releng/10.1/crypto/openssl/crypto/stack/safestack.h releng/10.1/crypto/openssl/doc/apps/dgst.pod releng/10.1/crypto/openssl/doc/crypto/BIO_s_accept.pod releng/10.1/crypto/openssl/doc/crypto/EVP_DigestInit.pod releng/10.1/crypto/openssl/doc/crypto/EVP_DigestVerifyInit.pod releng/10.1/crypto/openssl/doc/crypto/EVP_EncryptInit.pod releng/10.1/crypto/openssl/doc/crypto/EVP_PKEY_set1_RSA.pod releng/10.1/crypto/openssl/doc/crypto/EVP_PKEY_sign.pod releng/10.1/crypto/openssl/doc/ssl/SSL_CTX_set_tmp_dh_callback.pod releng/10.1/crypto/openssl/e_os.h releng/10.1/crypto/openssl/ssl/Makefile releng/10.1/crypto/openssl/ssl/d1_both.c releng/10.1/crypto/openssl/ssl/d1_lib.c releng/10.1/crypto/openssl/ssl/d1_srtp.c releng/10.1/crypto/openssl/ssl/dtls1.h releng/10.1/crypto/openssl/ssl/s23_clnt.c releng/10.1/crypto/openssl/ssl/s23_srvr.c releng/10.1/crypto/openssl/ssl/s2_lib.c releng/10.1/crypto/openssl/ssl/s3_cbc.c releng/10.1/crypto/openssl/ssl/s3_clnt.c releng/10.1/crypto/openssl/ssl/s3_enc.c releng/10.1/crypto/openssl/ssl/s3_lib.c releng/10.1/crypto/openssl/ssl/s3_pkt.c releng/10.1/crypto/openssl/ssl/s3_srvr.c releng/10.1/crypto/openssl/ssl/srtp.h releng/10.1/crypto/openssl/ssl/ssl.h releng/10.1/crypto/openssl/ssl/ssl3.h releng/10.1/crypto/openssl/ssl/ssl_err.c releng/10.1/crypto/openssl/ssl/ssl_lib.c releng/10.1/crypto/openssl/ssl/t1_enc.c releng/10.1/crypto/openssl/ssl/t1_lib.c releng/10.1/crypto/openssl/ssl/tls1.h releng/10.1/crypto/openssl/util/mk1mf.pl releng/10.1/crypto/openssl/util/mkdef.pl releng/10.1/crypto/openssl/util/ssleay.num releng/10.1/secure/lib/libcrypto/Makefile.inc releng/10.1/secure/lib/libcrypto/Makefile.man releng/10.1/secure/lib/libcrypto/man/ASN1_OBJECT_new.3 releng/10.1/secure/lib/libcrypto/man/ASN1_STRING_length.3 releng/10.1/secure/lib/libcrypto/man/ASN1_STRING_new.3 releng/10.1/secure/lib/libcrypto/man/ASN1_STRING_print_ex.3 releng/10.1/secure/lib/libcrypto/man/ASN1_generate_nconf.3 releng/10.1/secure/lib/libcrypto/man/BIO_ctrl.3 releng/10.1/secure/lib/libcrypto/man/BIO_f_base64.3 releng/10.1/secure/lib/libcrypto/man/BIO_f_buffer.3 releng/10.1/secure/lib/libcrypto/man/BIO_f_cipher.3 releng/10.1/secure/lib/libcrypto/man/BIO_f_md.3 releng/10.1/secure/lib/libcrypto/man/BIO_f_null.3 releng/10.1/secure/lib/libcrypto/man/BIO_f_ssl.3 releng/10.1/secure/lib/libcrypto/man/BIO_find_type.3 releng/10.1/secure/lib/libcrypto/man/BIO_new.3 releng/10.1/secure/lib/libcrypto/man/BIO_new_CMS.3 releng/10.1/secure/lib/libcrypto/man/BIO_push.3 releng/10.1/secure/lib/libcrypto/man/BIO_read.3 releng/10.1/secure/lib/libcrypto/man/BIO_s_accept.3 releng/10.1/secure/lib/libcrypto/man/BIO_s_bio.3 releng/10.1/secure/lib/libcrypto/man/BIO_s_connect.3 releng/10.1/secure/lib/libcrypto/man/BIO_s_fd.3 releng/10.1/secure/lib/libcrypto/man/BIO_s_file.3 releng/10.1/secure/lib/libcrypto/man/BIO_s_mem.3 releng/10.1/secure/lib/libcrypto/man/BIO_s_null.3 releng/10.1/secure/lib/libcrypto/man/BIO_s_socket.3 releng/10.1/secure/lib/libcrypto/man/BIO_set_callback.3 releng/10.1/secure/lib/libcrypto/man/BIO_should_retry.3 releng/10.1/secure/lib/libcrypto/man/BN_BLINDING_new.3 releng/10.1/secure/lib/libcrypto/man/BN_CTX_new.3 releng/10.1/secure/lib/libcrypto/man/BN_CTX_start.3 releng/10.1/secure/lib/libcrypto/man/BN_add.3 releng/10.1/secure/lib/libcrypto/man/BN_add_word.3 releng/10.1/secure/lib/libcrypto/man/BN_bn2bin.3 releng/10.1/secure/lib/libcrypto/man/BN_cmp.3 releng/10.1/secure/lib/libcrypto/man/BN_copy.3 releng/10.1/secure/lib/libcrypto/man/BN_generate_prime.3 releng/10.1/secure/lib/libcrypto/man/BN_mod_inverse.3 releng/10.1/secure/lib/libcrypto/man/BN_mod_mul_montgomery.3 releng/10.1/secure/lib/libcrypto/man/BN_mod_mul_reciprocal.3 releng/10.1/secure/lib/libcrypto/man/BN_new.3 releng/10.1/secure/lib/libcrypto/man/BN_num_bytes.3 releng/10.1/secure/lib/libcrypto/man/BN_rand.3 releng/10.1/secure/lib/libcrypto/man/BN_set_bit.3 releng/10.1/secure/lib/libcrypto/man/BN_swap.3 releng/10.1/secure/lib/libcrypto/man/BN_zero.3 releng/10.1/secure/lib/libcrypto/man/CMS_add0_cert.3 releng/10.1/secure/lib/libcrypto/man/CMS_add1_recipient_cert.3 releng/10.1/secure/lib/libcrypto/man/CMS_compress.3 releng/10.1/secure/lib/libcrypto/man/CMS_decrypt.3 releng/10.1/secure/lib/libcrypto/man/CMS_encrypt.3 releng/10.1/secure/lib/libcrypto/man/CMS_final.3 releng/10.1/secure/lib/libcrypto/man/CMS_get0_RecipientInfos.3 releng/10.1/secure/lib/libcrypto/man/CMS_get0_SignerInfos.3 releng/10.1/secure/lib/libcrypto/man/CMS_get0_type.3 releng/10.1/secure/lib/libcrypto/man/CMS_get1_ReceiptRequest.3 releng/10.1/secure/lib/libcrypto/man/CMS_sign.3 releng/10.1/secure/lib/libcrypto/man/CMS_sign_receipt.3 releng/10.1/secure/lib/libcrypto/man/CMS_uncompress.3 releng/10.1/secure/lib/libcrypto/man/CMS_verify.3 releng/10.1/secure/lib/libcrypto/man/CMS_verify_receipt.3 releng/10.1/secure/lib/libcrypto/man/CONF_modules_free.3 releng/10.1/secure/lib/libcrypto/man/CONF_modules_load_file.3 releng/10.1/secure/lib/libcrypto/man/CRYPTO_set_ex_data.3 releng/10.1/secure/lib/libcrypto/man/DH_generate_key.3 releng/10.1/secure/lib/libcrypto/man/DH_generate_parameters.3 releng/10.1/secure/lib/libcrypto/man/DH_get_ex_new_index.3 releng/10.1/secure/lib/libcrypto/man/DH_new.3 releng/10.1/secure/lib/libcrypto/man/DH_set_method.3 releng/10.1/secure/lib/libcrypto/man/DH_size.3 releng/10.1/secure/lib/libcrypto/man/DSA_SIG_new.3 releng/10.1/secure/lib/libcrypto/man/DSA_do_sign.3 releng/10.1/secure/lib/libcrypto/man/DSA_dup_DH.3 releng/10.1/secure/lib/libcrypto/man/DSA_generate_key.3 releng/10.1/secure/lib/libcrypto/man/DSA_generate_parameters.3 releng/10.1/secure/lib/libcrypto/man/DSA_get_ex_new_index.3 releng/10.1/secure/lib/libcrypto/man/DSA_new.3 releng/10.1/secure/lib/libcrypto/man/DSA_set_method.3 releng/10.1/secure/lib/libcrypto/man/DSA_sign.3 releng/10.1/secure/lib/libcrypto/man/DSA_size.3 releng/10.1/secure/lib/libcrypto/man/ERR_GET_LIB.3 releng/10.1/secure/lib/libcrypto/man/ERR_clear_error.3 releng/10.1/secure/lib/libcrypto/man/ERR_error_string.3 releng/10.1/secure/lib/libcrypto/man/ERR_get_error.3 releng/10.1/secure/lib/libcrypto/man/ERR_load_crypto_strings.3 releng/10.1/secure/lib/libcrypto/man/ERR_load_strings.3 releng/10.1/secure/lib/libcrypto/man/ERR_print_errors.3 releng/10.1/secure/lib/libcrypto/man/ERR_put_error.3 releng/10.1/secure/lib/libcrypto/man/ERR_remove_state.3 releng/10.1/secure/lib/libcrypto/man/ERR_set_mark.3 releng/10.1/secure/lib/libcrypto/man/EVP_BytesToKey.3 releng/10.1/secure/lib/libcrypto/man/EVP_DigestInit.3 releng/10.1/secure/lib/libcrypto/man/EVP_DigestSignInit.3 releng/10.1/secure/lib/libcrypto/man/EVP_DigestVerifyInit.3 releng/10.1/secure/lib/libcrypto/man/EVP_EncryptInit.3 releng/10.1/secure/lib/libcrypto/man/EVP_OpenInit.3 releng/10.1/secure/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3 releng/10.1/secure/lib/libcrypto/man/EVP_PKEY_CTX_new.3 releng/10.1/secure/lib/libcrypto/man/EVP_PKEY_cmp.3 releng/10.1/secure/lib/libcrypto/man/EVP_PKEY_decrypt.3 releng/10.1/secure/lib/libcrypto/man/EVP_PKEY_derive.3 releng/10.1/secure/lib/libcrypto/man/EVP_PKEY_encrypt.3 releng/10.1/secure/lib/libcrypto/man/EVP_PKEY_get_default_digest.3 releng/10.1/secure/lib/libcrypto/man/EVP_PKEY_keygen.3 releng/10.1/secure/lib/libcrypto/man/EVP_PKEY_new.3 releng/10.1/secure/lib/libcrypto/man/EVP_PKEY_print_private.3 releng/10.1/secure/lib/libcrypto/man/EVP_PKEY_set1_RSA.3 releng/10.1/secure/lib/libcrypto/man/EVP_PKEY_sign.3 releng/10.1/secure/lib/libcrypto/man/EVP_PKEY_verify.3 releng/10.1/secure/lib/libcrypto/man/EVP_PKEY_verify_recover.3 releng/10.1/secure/lib/libcrypto/man/EVP_SealInit.3 releng/10.1/secure/lib/libcrypto/man/EVP_SignInit.3 releng/10.1/secure/lib/libcrypto/man/EVP_VerifyInit.3 releng/10.1/secure/lib/libcrypto/man/OBJ_nid2obj.3 releng/10.1/secure/lib/libcrypto/man/OPENSSL_Applink.3 releng/10.1/secure/lib/libcrypto/man/OPENSSL_VERSION_NUMBER.3 releng/10.1/secure/lib/libcrypto/man/OPENSSL_config.3 releng/10.1/secure/lib/libcrypto/man/OPENSSL_ia32cap.3 releng/10.1/secure/lib/libcrypto/man/OPENSSL_load_builtin_modules.3 releng/10.1/secure/lib/libcrypto/man/OpenSSL_add_all_algorithms.3 releng/10.1/secure/lib/libcrypto/man/PEM_write_bio_CMS_stream.3 releng/10.1/secure/lib/libcrypto/man/PEM_write_bio_PKCS7_stream.3 releng/10.1/secure/lib/libcrypto/man/PKCS12_create.3 releng/10.1/secure/lib/libcrypto/man/PKCS12_parse.3 releng/10.1/secure/lib/libcrypto/man/PKCS7_decrypt.3 releng/10.1/secure/lib/libcrypto/man/PKCS7_encrypt.3 releng/10.1/secure/lib/libcrypto/man/PKCS7_sign.3 releng/10.1/secure/lib/libcrypto/man/PKCS7_sign_add_signer.3 releng/10.1/secure/lib/libcrypto/man/PKCS7_verify.3 releng/10.1/secure/lib/libcrypto/man/RAND_add.3 releng/10.1/secure/lib/libcrypto/man/RAND_bytes.3 releng/10.1/secure/lib/libcrypto/man/RAND_cleanup.3 releng/10.1/secure/lib/libcrypto/man/RAND_egd.3 releng/10.1/secure/lib/libcrypto/man/RAND_load_file.3 releng/10.1/secure/lib/libcrypto/man/RAND_set_rand_method.3 releng/10.1/secure/lib/libcrypto/man/RSA_blinding_on.3 releng/10.1/secure/lib/libcrypto/man/RSA_check_key.3 releng/10.1/secure/lib/libcrypto/man/RSA_generate_key.3 releng/10.1/secure/lib/libcrypto/man/RSA_get_ex_new_index.3 releng/10.1/secure/lib/libcrypto/man/RSA_new.3 releng/10.1/secure/lib/libcrypto/man/RSA_padding_add_PKCS1_type_1.3 releng/10.1/secure/lib/libcrypto/man/RSA_print.3 releng/10.1/secure/lib/libcrypto/man/RSA_private_encrypt.3 releng/10.1/secure/lib/libcrypto/man/RSA_public_encrypt.3 releng/10.1/secure/lib/libcrypto/man/RSA_set_method.3 releng/10.1/secure/lib/libcrypto/man/RSA_sign.3 releng/10.1/secure/lib/libcrypto/man/RSA_sign_ASN1_OCTET_STRING.3 releng/10.1/secure/lib/libcrypto/man/RSA_size.3 releng/10.1/secure/lib/libcrypto/man/SMIME_read_CMS.3 releng/10.1/secure/lib/libcrypto/man/SMIME_read_PKCS7.3 releng/10.1/secure/lib/libcrypto/man/SMIME_write_CMS.3 releng/10.1/secure/lib/libcrypto/man/SMIME_write_PKCS7.3 releng/10.1/secure/lib/libcrypto/man/X509_NAME_ENTRY_get_object.3 releng/10.1/secure/lib/libcrypto/man/X509_NAME_add_entry_by_txt.3 releng/10.1/secure/lib/libcrypto/man/X509_NAME_get_index_by_NID.3 releng/10.1/secure/lib/libcrypto/man/X509_NAME_print_ex.3 releng/10.1/secure/lib/libcrypto/man/X509_STORE_CTX_get_error.3 releng/10.1/secure/lib/libcrypto/man/X509_STORE_CTX_get_ex_new_index.3 releng/10.1/secure/lib/libcrypto/man/X509_STORE_CTX_new.3 releng/10.1/secure/lib/libcrypto/man/X509_STORE_CTX_set_verify_cb.3 releng/10.1/secure/lib/libcrypto/man/X509_STORE_set_verify_cb_func.3 releng/10.1/secure/lib/libcrypto/man/X509_VERIFY_PARAM_set_flags.3 releng/10.1/secure/lib/libcrypto/man/X509_new.3 releng/10.1/secure/lib/libcrypto/man/X509_verify_cert.3 releng/10.1/secure/lib/libcrypto/man/bio.3 releng/10.1/secure/lib/libcrypto/man/blowfish.3 releng/10.1/secure/lib/libcrypto/man/bn.3 releng/10.1/secure/lib/libcrypto/man/bn_internal.3 releng/10.1/secure/lib/libcrypto/man/buffer.3 releng/10.1/secure/lib/libcrypto/man/crypto.3 releng/10.1/secure/lib/libcrypto/man/d2i_ASN1_OBJECT.3 releng/10.1/secure/lib/libcrypto/man/d2i_DHparams.3 releng/10.1/secure/lib/libcrypto/man/d2i_DSAPublicKey.3 releng/10.1/secure/lib/libcrypto/man/d2i_PKCS8PrivateKey.3 releng/10.1/secure/lib/libcrypto/man/d2i_RSAPublicKey.3 releng/10.1/secure/lib/libcrypto/man/d2i_X509.3 releng/10.1/secure/lib/libcrypto/man/d2i_X509_ALGOR.3 releng/10.1/secure/lib/libcrypto/man/d2i_X509_CRL.3 releng/10.1/secure/lib/libcrypto/man/d2i_X509_NAME.3 releng/10.1/secure/lib/libcrypto/man/d2i_X509_REQ.3 releng/10.1/secure/lib/libcrypto/man/d2i_X509_SIG.3 releng/10.1/secure/lib/libcrypto/man/des.3 releng/10.1/secure/lib/libcrypto/man/dh.3 releng/10.1/secure/lib/libcrypto/man/dsa.3 releng/10.1/secure/lib/libcrypto/man/ecdsa.3 releng/10.1/secure/lib/libcrypto/man/engine.3 releng/10.1/secure/lib/libcrypto/man/err.3 releng/10.1/secure/lib/libcrypto/man/evp.3 releng/10.1/secure/lib/libcrypto/man/hmac.3 releng/10.1/secure/lib/libcrypto/man/i2d_CMS_bio_stream.3 releng/10.1/secure/lib/libcrypto/man/i2d_PKCS7_bio_stream.3 releng/10.1/secure/lib/libcrypto/man/lh_stats.3 releng/10.1/secure/lib/libcrypto/man/lhash.3 releng/10.1/secure/lib/libcrypto/man/md5.3 releng/10.1/secure/lib/libcrypto/man/mdc2.3 releng/10.1/secure/lib/libcrypto/man/pem.3 releng/10.1/secure/lib/libcrypto/man/rand.3 releng/10.1/secure/lib/libcrypto/man/rc4.3 releng/10.1/secure/lib/libcrypto/man/ripemd.3 releng/10.1/secure/lib/libcrypto/man/rsa.3 releng/10.1/secure/lib/libcrypto/man/sha.3 releng/10.1/secure/lib/libcrypto/man/threads.3 releng/10.1/secure/lib/libcrypto/man/ui.3 releng/10.1/secure/lib/libcrypto/man/ui_compat.3 releng/10.1/secure/lib/libcrypto/man/x509.3 releng/10.1/secure/lib/libssl/man/SSL_CIPHER_get_name.3 releng/10.1/secure/lib/libssl/man/SSL_COMP_add_compression_method.3 releng/10.1/secure/lib/libssl/man/SSL_CTX_add_extra_chain_cert.3 releng/10.1/secure/lib/libssl/man/SSL_CTX_add_session.3 releng/10.1/secure/lib/libssl/man/SSL_CTX_ctrl.3 releng/10.1/secure/lib/libssl/man/SSL_CTX_flush_sessions.3 releng/10.1/secure/lib/libssl/man/SSL_CTX_free.3 releng/10.1/secure/lib/libssl/man/SSL_CTX_get_ex_new_index.3 releng/10.1/secure/lib/libssl/man/SSL_CTX_get_verify_mode.3 releng/10.1/secure/lib/libssl/man/SSL_CTX_load_verify_locations.3 releng/10.1/secure/lib/libssl/man/SSL_CTX_new.3 releng/10.1/secure/lib/libssl/man/SSL_CTX_sess_number.3 releng/10.1/secure/lib/libssl/man/SSL_CTX_sess_set_cache_size.3 releng/10.1/secure/lib/libssl/man/SSL_CTX_sess_set_get_cb.3 releng/10.1/secure/lib/libssl/man/SSL_CTX_sessions.3 releng/10.1/secure/lib/libssl/man/SSL_CTX_set_cert_store.3 releng/10.1/secure/lib/libssl/man/SSL_CTX_set_cert_verify_callback.3 releng/10.1/secure/lib/libssl/man/SSL_CTX_set_cipher_list.3 releng/10.1/secure/lib/libssl/man/SSL_CTX_set_client_CA_list.3 releng/10.1/secure/lib/libssl/man/SSL_CTX_set_client_cert_cb.3 releng/10.1/secure/lib/libssl/man/SSL_CTX_set_default_passwd_cb.3 releng/10.1/secure/lib/libssl/man/SSL_CTX_set_generate_session_id.3 releng/10.1/secure/lib/libssl/man/SSL_CTX_set_info_callback.3 releng/10.1/secure/lib/libssl/man/SSL_CTX_set_max_cert_list.3 releng/10.1/secure/lib/libssl/man/SSL_CTX_set_mode.3 releng/10.1/secure/lib/libssl/man/SSL_CTX_set_msg_callback.3 releng/10.1/secure/lib/libssl/man/SSL_CTX_set_options.3 releng/10.1/secure/lib/libssl/man/SSL_CTX_set_psk_client_callback.3 releng/10.1/secure/lib/libssl/man/SSL_CTX_set_quiet_shutdown.3 releng/10.1/secure/lib/libssl/man/SSL_CTX_set_session_cache_mode.3 releng/10.1/secure/lib/libssl/man/SSL_CTX_set_session_id_context.3 releng/10.1/secure/lib/libssl/man/SSL_CTX_set_ssl_version.3 releng/10.1/secure/lib/libssl/man/SSL_CTX_set_timeout.3 releng/10.1/secure/lib/libssl/man/SSL_CTX_set_tlsext_ticket_key_cb.3 releng/10.1/secure/lib/libssl/man/SSL_CTX_set_tmp_dh_callback.3 releng/10.1/secure/lib/libssl/man/SSL_CTX_set_tmp_rsa_callback.3 releng/10.1/secure/lib/libssl/man/SSL_CTX_set_verify.3 releng/10.1/secure/lib/libssl/man/SSL_CTX_use_certificate.3 releng/10.1/secure/lib/libssl/man/SSL_CTX_use_psk_identity_hint.3 releng/10.1/secure/lib/libssl/man/SSL_SESSION_free.3 releng/10.1/secure/lib/libssl/man/SSL_SESSION_get_ex_new_index.3 releng/10.1/secure/lib/libssl/man/SSL_SESSION_get_time.3 releng/10.1/secure/lib/libssl/man/SSL_accept.3 releng/10.1/secure/lib/libssl/man/SSL_alert_type_string.3 releng/10.1/secure/lib/libssl/man/SSL_clear.3 releng/10.1/secure/lib/libssl/man/SSL_connect.3 releng/10.1/secure/lib/libssl/man/SSL_do_handshake.3 releng/10.1/secure/lib/libssl/man/SSL_free.3 releng/10.1/secure/lib/libssl/man/SSL_get_SSL_CTX.3 releng/10.1/secure/lib/libssl/man/SSL_get_ciphers.3 releng/10.1/secure/lib/libssl/man/SSL_get_client_CA_list.3 releng/10.1/secure/lib/libssl/man/SSL_get_current_cipher.3 releng/10.1/secure/lib/libssl/man/SSL_get_default_timeout.3 releng/10.1/secure/lib/libssl/man/SSL_get_error.3 releng/10.1/secure/lib/libssl/man/SSL_get_ex_data_X509_STORE_CTX_idx.3 releng/10.1/secure/lib/libssl/man/SSL_get_ex_new_index.3 releng/10.1/secure/lib/libssl/man/SSL_get_fd.3 releng/10.1/secure/lib/libssl/man/SSL_get_peer_cert_chain.3 releng/10.1/secure/lib/libssl/man/SSL_get_peer_certificate.3 releng/10.1/secure/lib/libssl/man/SSL_get_psk_identity.3 releng/10.1/secure/lib/libssl/man/SSL_get_rbio.3 releng/10.1/secure/lib/libssl/man/SSL_get_session.3 releng/10.1/secure/lib/libssl/man/SSL_get_verify_result.3 releng/10.1/secure/lib/libssl/man/SSL_get_version.3 releng/10.1/secure/lib/libssl/man/SSL_library_init.3 releng/10.1/secure/lib/libssl/man/SSL_load_client_CA_file.3 releng/10.1/secure/lib/libssl/man/SSL_new.3 releng/10.1/secure/lib/libssl/man/SSL_pending.3 releng/10.1/secure/lib/libssl/man/SSL_read.3 releng/10.1/secure/lib/libssl/man/SSL_rstate_string.3 releng/10.1/secure/lib/libssl/man/SSL_session_reused.3 releng/10.1/secure/lib/libssl/man/SSL_set_bio.3 releng/10.1/secure/lib/libssl/man/SSL_set_connect_state.3 releng/10.1/secure/lib/libssl/man/SSL_set_fd.3 releng/10.1/secure/lib/libssl/man/SSL_set_session.3 releng/10.1/secure/lib/libssl/man/SSL_set_shutdown.3 releng/10.1/secure/lib/libssl/man/SSL_set_verify_result.3 releng/10.1/secure/lib/libssl/man/SSL_shutdown.3 releng/10.1/secure/lib/libssl/man/SSL_state_string.3 releng/10.1/secure/lib/libssl/man/SSL_want.3 releng/10.1/secure/lib/libssl/man/SSL_write.3 releng/10.1/secure/lib/libssl/man/d2i_SSL_SESSION.3 releng/10.1/secure/lib/libssl/man/ssl.3 releng/10.1/secure/usr.bin/openssl/Makefile.man releng/10.1/secure/usr.bin/openssl/man/CA.pl.1 releng/10.1/secure/usr.bin/openssl/man/asn1parse.1 releng/10.1/secure/usr.bin/openssl/man/ca.1 releng/10.1/secure/usr.bin/openssl/man/ciphers.1 releng/10.1/secure/usr.bin/openssl/man/cms.1 releng/10.1/secure/usr.bin/openssl/man/crl.1 releng/10.1/secure/usr.bin/openssl/man/crl2pkcs7.1 releng/10.1/secure/usr.bin/openssl/man/dgst.1 releng/10.1/secure/usr.bin/openssl/man/dhparam.1 releng/10.1/secure/usr.bin/openssl/man/dsa.1 releng/10.1/secure/usr.bin/openssl/man/dsaparam.1 releng/10.1/secure/usr.bin/openssl/man/ec.1 releng/10.1/secure/usr.bin/openssl/man/ecparam.1 releng/10.1/secure/usr.bin/openssl/man/enc.1 releng/10.1/secure/usr.bin/openssl/man/errstr.1 releng/10.1/secure/usr.bin/openssl/man/gendsa.1 releng/10.1/secure/usr.bin/openssl/man/genpkey.1 releng/10.1/secure/usr.bin/openssl/man/genrsa.1 releng/10.1/secure/usr.bin/openssl/man/nseq.1 releng/10.1/secure/usr.bin/openssl/man/ocsp.1 releng/10.1/secure/usr.bin/openssl/man/openssl.1 releng/10.1/secure/usr.bin/openssl/man/passwd.1 releng/10.1/secure/usr.bin/openssl/man/pkcs12.1 releng/10.1/secure/usr.bin/openssl/man/pkcs7.1 releng/10.1/secure/usr.bin/openssl/man/pkcs8.1 releng/10.1/secure/usr.bin/openssl/man/pkey.1 releng/10.1/secure/usr.bin/openssl/man/pkeyparam.1 releng/10.1/secure/usr.bin/openssl/man/pkeyutl.1 releng/10.1/secure/usr.bin/openssl/man/rand.1 releng/10.1/secure/usr.bin/openssl/man/req.1 releng/10.1/secure/usr.bin/openssl/man/rsa.1 releng/10.1/secure/usr.bin/openssl/man/rsautl.1 releng/10.1/secure/usr.bin/openssl/man/s_client.1 releng/10.1/secure/usr.bin/openssl/man/s_server.1 releng/10.1/secure/usr.bin/openssl/man/s_time.1 releng/10.1/secure/usr.bin/openssl/man/sess_id.1 releng/10.1/secure/usr.bin/openssl/man/smime.1 releng/10.1/secure/usr.bin/openssl/man/speed.1 releng/10.1/secure/usr.bin/openssl/man/spkac.1 releng/10.1/secure/usr.bin/openssl/man/ts.1 releng/10.1/secure/usr.bin/openssl/man/tsget.1 releng/10.1/secure/usr.bin/openssl/man/verify.1 releng/10.1/secure/usr.bin/openssl/man/version.1 releng/10.1/secure/usr.bin/openssl/man/x509.1 releng/10.1/secure/usr.bin/openssl/man/x509v3_config.1 Directory Properties: releng/10.1/ (props changed) Modified: releng/10.1/ObsoleteFiles.inc ============================================================================== --- releng/10.1/ObsoleteFiles.inc Tue Oct 21 18:31:08 2014 (r273398) +++ releng/10.1/ObsoleteFiles.inc Tue Oct 21 19:00:32 2014 (r273399) @@ -38,6 +38,8 @@ # xargs -n1 | sort | uniq -d; # done +# 20141015: OpenSSL 1.0.1j import +OLD_FILES+=usr/share/openssl/man/man3/CMS_sign_add1_signer.3.gz # 20140917: hv_kvpd rc.d script removed in favor of devd configuration OLD_FILES+=etc/rc.d/hv_kvpd # 20140814: libopie version bump Modified: releng/10.1/crypto/openssl/CHANGES ============================================================================== --- releng/10.1/crypto/openssl/CHANGES Tue Oct 21 18:31:08 2014 (r273398) +++ releng/10.1/crypto/openssl/CHANGES Tue Oct 21 19:00:32 2014 (r273399) @@ -2,6 +2,57 @@ OpenSSL CHANGES _______________ + Changes between 1.0.1i and 1.0.1j [15 Oct 2014] + + *) SRTP Memory Leak. + + A flaw in the DTLS SRTP extension parsing code allows an attacker, who + sends a carefully crafted handshake message, to cause OpenSSL to fail + to free up to 64k of memory causing a memory leak. This could be + exploited in a Denial Of Service attack. This issue affects OpenSSL + 1.0.1 server implementations for both SSL/TLS and DTLS regardless of + whether SRTP is used or configured. Implementations of OpenSSL that + have been compiled with OPENSSL_NO_SRTP defined are not affected. + + The fix was developed by the OpenSSL team. + (CVE-2014-3513) + [OpenSSL team] + + *) Session Ticket Memory Leak. + + When an OpenSSL SSL/TLS/DTLS server receives a session ticket the + integrity of that ticket is first verified. In the event of a session + ticket integrity check failing, OpenSSL will fail to free memory + causing a memory leak. By sending a large number of invalid session + tickets an attacker could exploit this issue in a Denial Of Service + attack. + (CVE-2014-3567) + [Steve Henson] + + *) Build option no-ssl3 is incomplete. + + When OpenSSL is configured with "no-ssl3" as a build option, servers + could accept and complete a SSL 3.0 handshake, and clients could be + configured to send them. + (CVE-2014-3568) + [Akamai and the OpenSSL team] + + *) Add support for TLS_FALLBACK_SCSV. + Client applications doing fallback retries should call + SSL_set_mode(s, SSL_MODE_SEND_FALLBACK_SCSV). + (CVE-2014-3566) + [Adam Langley, Bodo Moeller] + + *) Add additional DigestInfo checks. + + Reencode DigestInto in DER and check against the original when + verifying RSA signature: this will reject any improperly encoded + DigestInfo structures. + + Note: this is a precautionary measure and no attacks are currently known. + + [Steve Henson] + Changes between 1.0.1h and 1.0.1i [6 Aug 2014] *) Fix SRP buffer overrun vulnerability. Invalid parameters passed to the Modified: releng/10.1/crypto/openssl/Configure ============================================================================== --- releng/10.1/crypto/openssl/Configure Tue Oct 21 18:31:08 2014 (r273398) +++ releng/10.1/crypto/openssl/Configure Tue Oct 21 19:00:32 2014 (r273399) @@ -1767,6 +1767,9 @@ open(OUT,'>crypto/opensslconf.h.new') || print OUT "/* opensslconf.h */\n"; print OUT "/* WARNING: Generated automatically from opensslconf.h.in by Configure. */\n\n"; +print OUT "#ifdef __cplusplus\n"; +print OUT "extern \"C\" {\n"; +print OUT "#endif\n"; print OUT "/* OpenSSL was configured with the following options: */\n"; my $openssl_algorithm_defines_trans = $openssl_algorithm_defines; $openssl_experimental_defines =~ s/^\s*#\s*define\s+OPENSSL_NO_(.*)/#ifndef OPENSSL_EXPERIMENTAL_$1\n# ifndef OPENSSL_NO_$1\n# define OPENSSL_NO_$1\n# endif\n#endif/mg; @@ -1871,6 +1874,9 @@ while () { print OUT $_; } } close(IN); +print OUT "#ifdef __cplusplus\n"; +print OUT "}\n"; +print OUT "#endif\n"; close(OUT); rename("crypto/opensslconf.h","crypto/opensslconf.h.bak") || die "unable to rename crypto/opensslconf.h\n" if -e "crypto/opensslconf.h"; rename("crypto/opensslconf.h.new","crypto/opensslconf.h") || die "unable to rename crypto/opensslconf.h.new\n"; Modified: releng/10.1/crypto/openssl/Makefile ============================================================================== --- releng/10.1/crypto/openssl/Makefile Tue Oct 21 18:31:08 2014 (r273398) +++ releng/10.1/crypto/openssl/Makefile Tue Oct 21 19:00:32 2014 (r273399) @@ -4,7 +4,7 @@ ## Makefile for OpenSSL ## -VERSION=1.0.1i +VERSION=1.0.1j MAJOR=1 MINOR=0.1 SHLIB_VERSION_NUMBER=1.0.0 Modified: releng/10.1/crypto/openssl/NEWS ============================================================================== --- releng/10.1/crypto/openssl/NEWS Tue Oct 21 18:31:08 2014 (r273398) +++ releng/10.1/crypto/openssl/NEWS Tue Oct 21 19:00:32 2014 (r273399) @@ -5,6 +5,13 @@ This file gives a brief overview of the major changes between each OpenSSL release. For more details please read the CHANGES file. + Major changes between OpenSSL 1.0.1i and OpenSSL 1.0.1j [15 Oct 2014] + + o Fix for CVE-2014-3513 + o Fix for CVE-2014-3567 + o Mitigation for CVE-2014-3566 (SSL protocol vulnerability) + o Fix for CVE-2014-3568 + Major changes between OpenSSL 1.0.1h and OpenSSL 1.0.1i [6 Aug 2014] o Fix for CVE-2014-3512 Modified: releng/10.1/crypto/openssl/README ============================================================================== --- releng/10.1/crypto/openssl/README Tue Oct 21 18:31:08 2014 (r273398) +++ releng/10.1/crypto/openssl/README Tue Oct 21 19:00:32 2014 (r273399) @@ -1,5 +1,5 @@ - OpenSSL 1.0.1i 6 Aug 2014 + OpenSSL 1.0.1j 15 Oct 2014 Copyright (c) 1998-2011 The OpenSSL Project Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson Modified: releng/10.1/crypto/openssl/apps/s_client.c ============================================================================== --- releng/10.1/crypto/openssl/apps/s_client.c Tue Oct 21 18:31:08 2014 (r273398) +++ releng/10.1/crypto/openssl/apps/s_client.c Tue Oct 21 19:00:32 2014 (r273399) @@ -337,6 +337,7 @@ static void sc_usage(void) BIO_printf(bio_err," -tls1_1 - just use TLSv1.1\n"); BIO_printf(bio_err," -tls1 - just use TLSv1\n"); BIO_printf(bio_err," -dtls1 - just use DTLSv1\n"); + BIO_printf(bio_err," -fallback_scsv - send TLS_FALLBACK_SCSV\n"); BIO_printf(bio_err," -mtu - set the link layer MTU\n"); BIO_printf(bio_err," -no_tls1_2/-no_tls1_1/-no_tls1/-no_ssl3/-no_ssl2 - turn off that protocol\n"); BIO_printf(bio_err," -bugs - Switch on all SSL implementation bug workarounds\n"); @@ -617,6 +618,7 @@ int MAIN(int argc, char **argv) char *sess_out = NULL; struct sockaddr peer; int peerlen = sizeof(peer); + int fallback_scsv = 0; int enable_timeouts = 0 ; long socket_mtu = 0; #ifndef OPENSSL_NO_JPAKE @@ -823,6 +825,10 @@ int MAIN(int argc, char **argv) meth=DTLSv1_client_method(); socket_type=SOCK_DGRAM; } + else if (strcmp(*argv,"-fallback_scsv") == 0) + { + fallback_scsv = 1; + } else if (strcmp(*argv,"-timeout") == 0) enable_timeouts=1; else if (strcmp(*argv,"-mtu") == 0) @@ -1235,6 +1241,10 @@ bad: SSL_set_session(con, sess); SSL_SESSION_free(sess); } + + if (fallback_scsv) + SSL_set_mode(con, SSL_MODE_SEND_FALLBACK_SCSV); + #ifndef OPENSSL_NO_TLSEXT if (servername != NULL) { Modified: releng/10.1/crypto/openssl/crypto/Makefile ============================================================================== --- releng/10.1/crypto/openssl/crypto/Makefile Tue Oct 21 18:31:08 2014 (r273398) +++ releng/10.1/crypto/openssl/crypto/Makefile Tue Oct 21 19:00:32 2014 (r273399) @@ -32,6 +32,7 @@ CPUID_OBJ=mem_clr.o LIBS= GENERAL=Makefile README crypto-lib.com install.com +TEST=constant_time_test.c LIB= $(TOP)/libcrypto.a SHARED_LIB= libcrypto$(SHLIB_EXT) @@ -44,7 +45,8 @@ SRC= $(LIBSRC) EXHEADER= crypto.h opensslv.h opensslconf.h ebcdic.h symhacks.h \ ossl_typ.h -HEADER= cryptlib.h buildinf.h md32_common.h o_time.h o_str.h o_dir.h $(EXHEADER) +HEADER= cryptlib.h buildinf.h md32_common.h o_time.h o_str.h o_dir.h \ + constant_time_locl.h $(EXHEADER) ALL= $(GENERAL) $(SRC) $(HEADER) Modified: releng/10.1/crypto/openssl/crypto/aes/asm/aesni-x86_64.pl ============================================================================== --- releng/10.1/crypto/openssl/crypto/aes/asm/aesni-x86_64.pl Tue Oct 21 18:31:08 2014 (r273398) +++ releng/10.1/crypto/openssl/crypto/aes/asm/aesni-x86_64.pl Tue Oct 21 19:00:32 2014 (r273399) @@ -525,6 +525,16 @@ $code.=<<___; .type aesni_ecb_encrypt,\@function,5 .align 16 aesni_ecb_encrypt: +___ +$code.=<<___ if ($win64); + lea -0x58(%rsp),%rsp + movaps %xmm6,(%rsp) + movaps %xmm7,0x10(%rsp) + movaps %xmm8,0x20(%rsp) + movaps %xmm9,0x30(%rsp) +.Lecb_enc_body: +___ +$code.=<<___; and \$-16,$len jz .Lecb_ret @@ -805,6 +815,16 @@ $code.=<<___; movups $inout5,0x50($out) .Lecb_ret: +___ +$code.=<<___ if ($win64); + movaps (%rsp),%xmm6 + movaps 0x10(%rsp),%xmm7 + movaps 0x20(%rsp),%xmm8 + movaps 0x30(%rsp),%xmm9 + lea 0x58(%rsp),%rsp +.Lecb_enc_ret: +___ +$code.=<<___; ret .size aesni_ecb_encrypt,.-aesni_ecb_encrypt ___ @@ -2730,28 +2750,9 @@ $code.=<<___; .extern __imp_RtlVirtualUnwind ___ $code.=<<___ if ($PREFIX eq "aesni"); -.type ecb_se_handler,\@abi-omnipotent -.align 16 -ecb_se_handler: - push %rsi - push %rdi - push %rbx - push %rbp - push %r12 - push %r13 - push %r14 - push %r15 - pushfq - sub \$64,%rsp - - mov 152($context),%rax # pull context->Rsp - - jmp .Lcommon_seh_tail -.size ecb_se_handler,.-ecb_se_handler - -.type ccm64_se_handler,\@abi-omnipotent +.type ecb_ccm64_se_handler,\@abi-omnipotent .align 16 -ccm64_se_handler: +ecb_ccm64_se_handler: push %rsi push %rdi push %rbx @@ -2788,7 +2789,7 @@ ccm64_se_handler: lea 0x58(%rax),%rax # adjust stack pointer jmp .Lcommon_seh_tail -.size ccm64_se_handler,.-ccm64_se_handler +.size ecb_ccm64_se_handler,.-ecb_ccm64_se_handler .type ctr32_se_handler,\@abi-omnipotent .align 16 @@ -2993,14 +2994,15 @@ ___ $code.=<<___ if ($PREFIX eq "aesni"); .LSEH_info_ecb: .byte 9,0,0,0 - .rva ecb_se_handler + .rva ecb_ccm64_se_handler + .rva .Lecb_enc_body,.Lecb_enc_ret # HandlerData[] .LSEH_info_ccm64_enc: .byte 9,0,0,0 - .rva ccm64_se_handler + .rva ecb_ccm64_se_handler .rva .Lccm64_enc_body,.Lccm64_enc_ret # HandlerData[] .LSEH_info_ccm64_dec: .byte 9,0,0,0 - .rva ccm64_se_handler + .rva ecb_ccm64_se_handler .rva .Lccm64_dec_body,.Lccm64_dec_ret # HandlerData[] .LSEH_info_ctr32: .byte 9,0,0,0 Modified: releng/10.1/crypto/openssl/crypto/asn1/a_strex.c ============================================================================== --- releng/10.1/crypto/openssl/crypto/asn1/a_strex.c Tue Oct 21 18:31:08 2014 (r273398) +++ releng/10.1/crypto/openssl/crypto/asn1/a_strex.c Tue Oct 21 19:00:32 2014 (r273399) @@ -568,6 +568,7 @@ int ASN1_STRING_to_UTF8(unsigned char ** mbflag |= MBSTRING_FLAG; stmp.data = NULL; stmp.length = 0; + stmp.flags = 0; ret = ASN1_mbstring_copy(&str, in->data, in->length, mbflag, B_ASN1_UTF8STRING); if(ret < 0) return ret; *out = stmp.data; Modified: releng/10.1/crypto/openssl/crypto/bn/asm/x86_64-gcc.c ============================================================================== --- releng/10.1/crypto/openssl/crypto/bn/asm/x86_64-gcc.c Tue Oct 21 18:31:08 2014 (r273398) +++ releng/10.1/crypto/openssl/crypto/bn/asm/x86_64-gcc.c Tue Oct 21 19:00:32 2014 (r273399) @@ -189,7 +189,7 @@ BN_ULONG bn_add_words (BN_ULONG *rp, con if (n <= 0) return 0; - asm ( + asm volatile ( " subq %2,%2 \n" ".p2align 4 \n" "1: movq (%4,%2,8),%0 \n" @@ -200,7 +200,7 @@ BN_ULONG bn_add_words (BN_ULONG *rp, con " sbbq %0,%0 \n" : "=&a"(ret),"+c"(n),"=&r"(i) : "r"(rp),"r"(ap),"r"(bp) - : "cc" + : "cc", "memory" ); return ret&1; @@ -212,7 +212,7 @@ BN_ULONG bn_sub_words (BN_ULONG *rp, con if (n <= 0) return 0; - asm ( + asm volatile ( " subq %2,%2 \n" ".p2align 4 \n" "1: movq (%4,%2,8),%0 \n" @@ -223,7 +223,7 @@ BN_ULONG bn_sub_words (BN_ULONG *rp, con " sbbq %0,%0 \n" : "=&a"(ret),"+c"(n),"=&r"(i) : "r"(rp),"r"(ap),"r"(bp) - : "cc" + : "cc", "memory" ); return ret&1; Modified: releng/10.1/crypto/openssl/crypto/bn/bn_exp.c ============================================================================== --- releng/10.1/crypto/openssl/crypto/bn/bn_exp.c Tue Oct 21 18:31:08 2014 (r273398) +++ releng/10.1/crypto/openssl/crypto/bn/bn_exp.c Tue Oct 21 19:00:32 2014 (r273399) @@ -874,7 +874,14 @@ int BN_mod_exp_mont_word(BIGNUM *rr, BN_ bits = BN_num_bits(p); if (bits == 0) { - ret = BN_one(rr); + /* x**0 mod 1 is still zero. */ + if (BN_is_one(m)) + { + ret = 1; + BN_zero(rr); + } + else + ret = BN_one(rr); return ret; } if (a == 0) Modified: releng/10.1/crypto/openssl/crypto/bn/bn_nist.c ============================================================================== --- releng/10.1/crypto/openssl/crypto/bn/bn_nist.c Tue Oct 21 18:31:08 2014 (r273398) +++ releng/10.1/crypto/openssl/crypto/bn/bn_nist.c Tue Oct 21 19:00:32 2014 (r273399) @@ -1088,9 +1088,9 @@ int BN_nist_mod_521(BIGNUM *r, const BIG /* ... and right shift */ for (val=t_d[0],i=0; i>BN_NIST_521_RSHIFT; - val = t_d[i+1]; - t_d[i] = (tmp | val<>BN_NIST_521_RSHIFT | + (tmp=t_d[i+1])<>BN_NIST_521_RSHIFT; /* lower 521 bits */ Modified: releng/10.1/crypto/openssl/crypto/bn/exptest.c ============================================================================== --- releng/10.1/crypto/openssl/crypto/bn/exptest.c Tue Oct 21 18:31:08 2014 (r273398) +++ releng/10.1/crypto/openssl/crypto/bn/exptest.c Tue Oct 21 19:00:32 2014 (r273399) @@ -71,6 +71,43 @@ static const char rnd_seed[] = "string to make the random number generator think it has entropy"; +/* test_exp_mod_zero tests that x**0 mod 1 == 0. It returns zero on success. */ +static int test_exp_mod_zero() { + BIGNUM a, p, m; + BIGNUM r; + BN_CTX *ctx = BN_CTX_new(); + int ret = 1; + + BN_init(&m); + BN_one(&m); + + BN_init(&a); + BN_one(&a); + + BN_init(&p); + BN_zero(&p); + + BN_init(&r); + BN_mod_exp(&r, &a, &p, &m, ctx); + BN_CTX_free(ctx); + + if (BN_is_zero(&r)) + ret = 0; + else + { + printf("1**0 mod 1 = "); + BN_print_fp(stdout, &r); + printf(", should be 0\n"); + } + + BN_free(&r); + BN_free(&a); + BN_free(&p); + BN_free(&m); + + return ret; +} + int main(int argc, char *argv[]) { BN_CTX *ctx; @@ -190,7 +227,13 @@ int main(int argc, char *argv[]) ERR_remove_thread_state(NULL); CRYPTO_mem_leaks(out); BIO_free(out); - printf(" done\n"); + printf("\n"); + + if (test_exp_mod_zero() != 0) + goto err; + + printf("done\n"); + EXIT(0); err: ERR_load_crypto_strings(); Copied: releng/10.1/crypto/openssl/crypto/constant_time_locl.h (from r273149, stable/10/crypto/openssl/crypto/constant_time_locl.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ releng/10.1/crypto/openssl/crypto/constant_time_locl.h Tue Oct 21 19:00:32 2014 (r273399, copy of r273149, stable/10/crypto/openssl/crypto/constant_time_locl.h) @@ -0,0 +1,216 @@ +/* crypto/constant_time_locl.h */ +/* + * Utilities for constant-time cryptography. + * + * Author: Emilia Kasper (emilia@openssl.org) + * Based on previous work by Bodo Moeller, Emilia Kasper, Adam Langley + * (Google). + * ==================================================================== + * Copyright (c) 2014 The OpenSSL Project. 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_CONSTANT_TIME_LOCL_H +#define HEADER_CONSTANT_TIME_LOCL_H + +#include "e_os.h" /* For 'inline' */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The boolean methods return a bitmask of all ones (0xff...f) for true + * and 0 for false. This is useful for choosing a value based on the result + * of a conditional in constant time. For example, + * + * if (a < b) { + * c = a; + * } else { + * c = b; + * } + * + * can be written as + * + * unsigned int lt = constant_time_lt(a, b); + * c = constant_time_select(lt, a, b); + */ + +/* + * Returns the given value with the MSB copied to all the other + * bits. Uses the fact that arithmetic shift shifts-in the sign bit. + * However, this is not ensured by the C standard so you may need to + * replace this with something else on odd CPUs. + */ +static inline unsigned int constant_time_msb(unsigned int a); + +/* + * Returns 0xff..f if a < b and 0 otherwise. + */ +static inline unsigned int constant_time_lt(unsigned int a, unsigned int b); +/* Convenience method for getting an 8-bit mask. */ +static inline unsigned char constant_time_lt_8(unsigned int a, unsigned int b); + +/* + * Returns 0xff..f if a >= b and 0 otherwise. + */ +static inline unsigned int constant_time_ge(unsigned int a, unsigned int b); +/* Convenience method for getting an 8-bit mask. */ +static inline unsigned char constant_time_ge_8(unsigned int a, unsigned int b); + +/* + * Returns 0xff..f if a == 0 and 0 otherwise. + */ +static inline unsigned int constant_time_is_zero(unsigned int a); +/* Convenience method for getting an 8-bit mask. */ +static inline unsigned char constant_time_is_zero_8(unsigned int a); + + +/* + * Returns 0xff..f if a == b and 0 otherwise. + */ +static inline unsigned int constant_time_eq(unsigned int a, unsigned int b); +/* Convenience method for getting an 8-bit mask. */ +static inline unsigned char constant_time_eq_8(unsigned int a, unsigned int b); +/* Signed integers. */ +static inline unsigned int constant_time_eq_int(int a, int b); +/* Convenience method for getting an 8-bit mask. */ +static inline unsigned char constant_time_eq_int_8(int a, int b); + + +/* + * Returns (mask & a) | (~mask & b). + * + * When |mask| is all 1s or all 0s (as returned by the methods above), + * the select methods return either |a| (if |mask| is nonzero) or |b| + * (if |mask| is zero). + */ +static inline unsigned int constant_time_select(unsigned int mask, + unsigned int a, unsigned int b); +/* Convenience method for unsigned chars. */ +static inline unsigned char constant_time_select_8(unsigned char mask, + unsigned char a, unsigned char b); +/* Convenience method for signed integers. */ +static inline int constant_time_select_int(unsigned int mask, int a, int b); + +static inline unsigned int constant_time_msb(unsigned int a) + { + return (unsigned int)((int)(a) >> (sizeof(int) * 8 - 1)); + } + +static inline unsigned int constant_time_lt(unsigned int a, unsigned int b) + { + unsigned int lt; + /* Case 1: msb(a) == msb(b). a < b iff the MSB of a - b is set.*/ + lt = ~(a ^ b) & (a - b); + /* Case 2: msb(a) != msb(b). a < b iff the MSB of b is set. */ + lt |= ~a & b; + return constant_time_msb(lt); + } + +static inline unsigned char constant_time_lt_8(unsigned int a, unsigned int b) + { + return (unsigned char)(constant_time_lt(a, b)); + } + +static inline unsigned int constant_time_ge(unsigned int a, unsigned int b) + { + unsigned int ge; + /* Case 1: msb(a) == msb(b). a >= b iff the MSB of a - b is not set.*/ + ge = ~((a ^ b) | (a - b)); + /* Case 2: msb(a) != msb(b). a >= b iff the MSB of a is set. */ + ge |= a & ~b; + return constant_time_msb(ge); + } + +static inline unsigned char constant_time_ge_8(unsigned int a, unsigned int b) + { + return (unsigned char)(constant_time_ge(a, b)); + } + +static inline unsigned int constant_time_is_zero(unsigned int a) + { + return constant_time_msb(~a & (a - 1)); + } + +static inline unsigned char constant_time_is_zero_8(unsigned int a) + { + return (unsigned char)(constant_time_is_zero(a)); + } + +static inline unsigned int constant_time_eq(unsigned int a, unsigned int b) + { + return constant_time_is_zero(a ^ b); + } + +static inline unsigned char constant_time_eq_8(unsigned int a, unsigned int b) + { + return (unsigned char)(constant_time_eq(a, b)); + } + +static inline unsigned int constant_time_eq_int(int a, int b) + { + return constant_time_eq((unsigned)(a), (unsigned)(b)); + } + +static inline unsigned char constant_time_eq_int_8(int a, int b) + { + return constant_time_eq_8((unsigned)(a), (unsigned)(b)); + } + +static inline unsigned int constant_time_select(unsigned int mask, + unsigned int a, unsigned int b) + { + return (mask & a) | (~mask & b); + } + +static inline unsigned char constant_time_select_8(unsigned char mask, + unsigned char a, unsigned char b) + { + return (unsigned char)(constant_time_select(mask, a, b)); + } + +inline int constant_time_select_int(unsigned int mask, int a, int b) + { + return (int)(constant_time_select(mask, (unsigned)(a), (unsigned)(b))); + } + +#ifdef __cplusplus +} +#endif + +#endif /* HEADER_CONSTANT_TIME_LOCL_H */ Copied: releng/10.1/crypto/openssl/crypto/constant_time_test.c (from r273149, stable/10/crypto/openssl/crypto/constant_time_test.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ releng/10.1/crypto/openssl/crypto/constant_time_test.c Tue Oct 21 19:00:32 2014 (r273399, copy of r273149, stable/10/crypto/openssl/crypto/constant_time_test.c) @@ -0,0 +1,330 @@ +/* crypto/constant_time_test.c */ +/* + * Utilities for constant-time cryptography. + * + * Author: Emilia Kasper (emilia@openssl.org) + * Based on previous work by Bodo Moeller, Emilia Kasper, Adam Langley + * (Google). + * ==================================================================== + * Copyright (c) 2014 The OpenSSL Project. 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 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include "../crypto/constant_time_locl.h" + +#include +#include +#include + +static const unsigned int CONSTTIME_TRUE = (unsigned)(~0); +static const unsigned int CONSTTIME_FALSE = 0; +static const unsigned char CONSTTIME_TRUE_8 = 0xff; +static const unsigned char CONSTTIME_FALSE_8 = 0; + +static int test_binary_op(unsigned int (*op)(unsigned int a, unsigned int b), + const char* op_name, unsigned int a, unsigned int b, int is_true) + { + unsigned c = op(a, b); + if (is_true && c != CONSTTIME_TRUE) + { + fprintf(stderr, "Test failed for %s(%du, %du): expected %du " + "(TRUE), got %du\n", op_name, a, b, CONSTTIME_TRUE, c); + return 1; + } + else if (!is_true && c != CONSTTIME_FALSE) + { + fprintf(stderr, "Test failed for %s(%du, %du): expected %du " + "(FALSE), got %du\n", op_name, a, b, CONSTTIME_FALSE, + c); + return 1; + } + return 0; + } + +static int test_binary_op_8(unsigned char (*op)(unsigned int a, unsigned int b), + const char* op_name, unsigned int a, unsigned int b, int is_true) + { + unsigned char c = op(a, b); + if (is_true && c != CONSTTIME_TRUE_8) + { + fprintf(stderr, "Test failed for %s(%du, %du): expected %u " + "(TRUE), got %u\n", op_name, a, b, CONSTTIME_TRUE_8, c); + return 1; + } + else if (!is_true && c != CONSTTIME_FALSE_8) + { + fprintf(stderr, "Test failed for %s(%du, %du): expected %u " + "(FALSE), got %u\n", op_name, a, b, CONSTTIME_FALSE_8, + c); + return 1; + } + return 0; + } + +static int test_is_zero(unsigned int a) + { + unsigned int c = constant_time_is_zero(a); + if (a == 0 && c != CONSTTIME_TRUE) + { + fprintf(stderr, "Test failed for constant_time_is_zero(%du): " + "expected %du (TRUE), got %du\n", a, CONSTTIME_TRUE, c); + return 1; + } + else if (a != 0 && c != CONSTTIME_FALSE) + { + fprintf(stderr, "Test failed for constant_time_is_zero(%du): " + "expected %du (FALSE), got %du\n", a, CONSTTIME_FALSE, + c); + return 1; + } + return 0; + } + +static int test_is_zero_8(unsigned int a) + { + unsigned char c = constant_time_is_zero_8(a); + if (a == 0 && c != CONSTTIME_TRUE_8) + { + fprintf(stderr, "Test failed for constant_time_is_zero(%du): " + "expected %u (TRUE), got %u\n", a, CONSTTIME_TRUE_8, c); + return 1; + } + else if (a != 0 && c != CONSTTIME_FALSE) + { + fprintf(stderr, "Test failed for constant_time_is_zero(%du): " + "expected %u (FALSE), got %u\n", a, CONSTTIME_FALSE_8, + c); + return 1; + } + return 0; + } + +static int test_select(unsigned int a, unsigned int b) + { + unsigned int selected = constant_time_select(CONSTTIME_TRUE, a, b); + if (selected != a) + { + fprintf(stderr, "Test failed for constant_time_select(%du, %du," + "%du): expected %du(first value), got %du\n", + CONSTTIME_TRUE, a, b, a, selected); + return 1; + } + selected = constant_time_select(CONSTTIME_FALSE, a, b); + if (selected != b) + { + fprintf(stderr, "Test failed for constant_time_select(%du, %du," + "%du): expected %du(second value), got %du\n", + CONSTTIME_FALSE, a, b, b, selected); + return 1; + } + return 0; + } + +static int test_select_8(unsigned char a, unsigned char b) + { + unsigned char selected = constant_time_select_8(CONSTTIME_TRUE_8, a, b); + if (selected != a) + { + fprintf(stderr, "Test failed for constant_time_select(%u, %u," + "%u): expected %u(first value), got %u\n", + CONSTTIME_TRUE, a, b, a, selected); + return 1; + } + selected = constant_time_select_8(CONSTTIME_FALSE_8, a, b); + if (selected != b) + { + fprintf(stderr, "Test failed for constant_time_select(%u, %u," + "%u): expected %u(second value), got %u\n", + CONSTTIME_FALSE, a, b, b, selected); + return 1; + } + return 0; + } + +static int test_select_int(int a, int b) + { + int selected = constant_time_select_int(CONSTTIME_TRUE, a, b); + if (selected != a) + { + fprintf(stderr, "Test failed for constant_time_select(%du, %d," + "%d): expected %d(first value), got %d\n", + CONSTTIME_TRUE, a, b, a, selected); + return 1; + } + selected = constant_time_select_int(CONSTTIME_FALSE, a, b); + if (selected != b) + { + fprintf(stderr, "Test failed for constant_time_select(%du, %d," + "%d): expected %d(second value), got %d\n", + CONSTTIME_FALSE, a, b, b, selected); + return 1; + } + return 0; + } + +static int test_eq_int(int a, int b) + { + unsigned int equal = constant_time_eq_int(a, b); + if (a == b && equal != CONSTTIME_TRUE) + { + fprintf(stderr, "Test failed for constant_time_eq_int(%d, %d): " + "expected %du(TRUE), got %du\n", + a, b, CONSTTIME_TRUE, equal); + return 1; + } + else if (a != b && equal != CONSTTIME_FALSE) + { + fprintf(stderr, "Test failed for constant_time_eq_int(%d, %d): " + "expected %du(FALSE), got %du\n", + a, b, CONSTTIME_FALSE, equal); + return 1; + } + return 0; + } + +static int test_eq_int_8(int a, int b) + { + unsigned char equal = constant_time_eq_int_8(a, b); + if (a == b && equal != CONSTTIME_TRUE_8) + { + fprintf(stderr, "Test failed for constant_time_eq_int_8(%d, %d): " + "expected %u(TRUE), got %u\n", + a, b, CONSTTIME_TRUE_8, equal); + return 1; + } + else if (a != b && equal != CONSTTIME_FALSE_8) + { + fprintf(stderr, "Test failed for constant_time_eq_int_8(%d, %d): " + "expected %u(FALSE), got %u\n", + a, b, CONSTTIME_FALSE_8, equal); + return 1; + } + return 0; + } + +static unsigned int test_values[] = {0, 1, 1024, 12345, 32000, UINT_MAX/2-1, + UINT_MAX/2, UINT_MAX/2+1, UINT_MAX-1, + UINT_MAX}; + +static unsigned char test_values_8[] = {0, 1, 2, 20, 32, 127, 128, 129, 255}; + +static int signed_test_values[] = {0, 1, -1, 1024, -1024, 12345, -12345, + 32000, -32000, INT_MAX, INT_MIN, INT_MAX-1, + INT_MIN+1}; + + +int main(int argc, char *argv[]) + { + unsigned int a, b, i, j; + int c, d; + unsigned char e, f; + int num_failed = 0, num_all = 0; + fprintf(stdout, "Testing constant time operations...\n"); + + for (i = 0; i < sizeof(test_values)/sizeof(int); ++i) + { + a = test_values[i]; + num_failed += test_is_zero(a); + num_failed += test_is_zero_8(a); + num_all += 2; + for (j = 0; j < sizeof(test_values)/sizeof(int); ++j) + { + b = test_values[j]; + num_failed += test_binary_op(&constant_time_lt, + "constant_time_lt", a, b, a < b); + num_failed += test_binary_op_8(&constant_time_lt_8, + "constant_time_lt_8", a, b, a < b); + num_failed += test_binary_op(&constant_time_lt, + "constant_time_lt_8", b, a, b < a); + num_failed += test_binary_op_8(&constant_time_lt_8, + "constant_time_lt_8", b, a, b < a); + num_failed += test_binary_op(&constant_time_ge, + "constant_time_ge", a, b, a >= b); + num_failed += test_binary_op_8(&constant_time_ge_8, + "constant_time_ge_8", a, b, a >= b); + num_failed += test_binary_op(&constant_time_ge, + "constant_time_ge", b, a, b >= a); + num_failed += test_binary_op_8(&constant_time_ge_8, + "constant_time_ge_8", b, a, b >= a); + num_failed += test_binary_op(&constant_time_eq, + "constant_time_eq", a, b, a == b); + num_failed += test_binary_op_8(&constant_time_eq_8, + "constant_time_eq_8", a, b, a == b); + num_failed += test_binary_op(&constant_time_eq, + "constant_time_eq", b, a, b == a); + num_failed += test_binary_op_8(&constant_time_eq_8, + "constant_time_eq_8", b, a, b == a); + num_failed += test_select(a, b); + num_all += 13; + } + } + + for (i = 0; i < sizeof(signed_test_values)/sizeof(int); ++i) + { + c = signed_test_values[i]; + for (j = 0; j < sizeof(signed_test_values)/sizeof(int); ++j) + { + d = signed_test_values[j]; + num_failed += test_select_int(c, d); + num_failed += test_eq_int(c, d); + num_failed += test_eq_int_8(c, d); + num_all += 3; + } + } + + for (i = 0; i < sizeof(test_values_8); ++i) + { + e = test_values_8[i]; + for (j = 0; j < sizeof(test_values_8); ++j) + { + f = test_values_8[j]; + num_failed += test_select_8(e, f); + num_all += 1; + } + } + + if (!num_failed) + { + fprintf(stdout, "ok (ran %d tests)\n", num_all); + return EXIT_SUCCESS; + } + else + { + fprintf(stdout, "%d of %d tests failed!\n", num_failed, num_all); + return EXIT_FAILURE; + } + } Modified: releng/10.1/crypto/openssl/crypto/dsa/dsa_ameth.c ============================================================================== --- releng/10.1/crypto/openssl/crypto/dsa/dsa_ameth.c Tue Oct 21 18:31:08 2014 (r273398) +++ releng/10.1/crypto/openssl/crypto/dsa/dsa_ameth.c Tue Oct 21 19:00:32 2014 (r273399) @@ -307,6 +307,12 @@ static int dsa_priv_encode(PKCS8_PRIV_KE unsigned char *dp = NULL; int dplen; + if (!pkey->pkey.dsa || !pkey->pkey.dsa->priv_key) + { + DSAerr(DSA_F_DSA_PRIV_ENCODE,DSA_R_MISSING_PARAMETERS); + goto err; + } + params = ASN1_STRING_new(); if (!params) @@ -701,4 +707,3 @@ const EVP_PKEY_ASN1_METHOD dsa_asn1_meth old_dsa_priv_encode } }; - Modified: releng/10.1/crypto/openssl/crypto/ebcdic.h ============================================================================== --- releng/10.1/crypto/openssl/crypto/ebcdic.h Tue Oct 21 18:31:08 2014 (r273398) +++ releng/10.1/crypto/openssl/crypto/ebcdic.h Tue Oct 21 19:00:32 2014 (r273399) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 19:02:28 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8A27161E; Tue, 21 Oct 2014 19:02:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6B32E987; Tue, 21 Oct 2014 19:02:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LJ2SvP031964; Tue, 21 Oct 2014 19:02:28 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LJ2RoA031960; Tue, 21 Oct 2014 19:02:27 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410211902.s9LJ2RoA031960@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 21 Oct 2014 19:02:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273400 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 19:02:28 -0000 Author: mjg Date: Tue Oct 21 19:02:26 2014 New Revision: 273400 URL: https://svnweb.freebsd.org/changeset/base/273400 Log: Rename sysctl_lock and _unlock to sysctl_xlock and _xunlock. Modified: head/sys/kern/kern_linker.c head/sys/kern/kern_sysctl.c head/sys/kern/vfs_init.c head/sys/sys/sysctl.h Modified: head/sys/kern/kern_linker.c ============================================================================== --- head/sys/kern/kern_linker.c Tue Oct 21 19:00:32 2014 (r273399) +++ head/sys/kern/kern_linker.c Tue Oct 21 19:02:26 2014 (r273400) @@ -292,10 +292,10 @@ linker_file_register_sysctls(linker_file return; sx_xunlock(&kld_sx); - sysctl_lock(); + sysctl_xlock(); for (oidp = start; oidp < stop; oidp++) sysctl_register_oid(*oidp); - sysctl_unlock(); + sysctl_xunlock(); sx_xlock(&kld_sx); } @@ -313,10 +313,10 @@ linker_file_unregister_sysctls(linker_fi return; sx_xunlock(&kld_sx); - sysctl_lock(); + sysctl_xlock(); for (oidp = start; oidp < stop; oidp++) sysctl_unregister_oid(*oidp); - sysctl_unlock(); + sysctl_xunlock(); sx_xlock(&kld_sx); } Modified: head/sys/kern/kern_sysctl.c ============================================================================== --- head/sys/kern/kern_sysctl.c Tue Oct 21 19:00:32 2014 (r273399) +++ head/sys/kern/kern_sysctl.c Tue Oct 21 19:02:26 2014 (r273400) @@ -126,14 +126,14 @@ sysctl_find_oidname(const char *name, st * Order by number in each list. */ void -sysctl_lock(void) +sysctl_xlock(void) { SYSCTL_XLOCK(); } void -sysctl_unlock(void) +sysctl_xunlock(void) { SYSCTL_XUNLOCK(); Modified: head/sys/kern/vfs_init.c ============================================================================== --- head/sys/kern/vfs_init.c Tue Oct 21 19:00:32 2014 (r273399) +++ head/sys/kern/vfs_init.c Tue Oct 21 19:02:26 2014 (r273400) @@ -291,7 +291,7 @@ vfs_register(struct vfsconf *vfc) * preserved by re-registering the oid after modifying its * number. */ - sysctl_lock(); + sysctl_xlock(); SLIST_FOREACH(oidp, SYSCTL_CHILDREN(&sysctl___vfs), oid_link) { if (strcmp(oidp->oid_name, vfc->vfc_name) == 0) { sysctl_unregister_oid(oidp); @@ -300,7 +300,7 @@ vfs_register(struct vfsconf *vfc) break; } } - sysctl_unlock(); + sysctl_xunlock(); return (0); } Modified: head/sys/sys/sysctl.h ============================================================================== --- head/sys/sys/sysctl.h Tue Oct 21 19:00:32 2014 (r273399) +++ head/sys/sys/sysctl.h Tue Oct 21 19:02:26 2014 (r273400) @@ -770,8 +770,8 @@ int userland_sysctl(struct thread *td, i size_t *retval, int flags); int sysctl_find_oid(int *name, u_int namelen, struct sysctl_oid **noid, int *nindx, struct sysctl_req *req); -void sysctl_lock(void); -void sysctl_unlock(void); +void sysctl_xlock(void); +void sysctl_xunlock(void); int sysctl_wire_old_buffer(struct sysctl_req *req, size_t len); struct sbuf; From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 19:05:45 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9B78179D; Tue, 21 Oct 2014 19:05:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 87B029A2; Tue, 21 Oct 2014 19:05:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LJ5jlf032493; Tue, 21 Oct 2014 19:05:45 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LJ5jDb032492; Tue, 21 Oct 2014 19:05:45 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410211905.s9LJ5jDb032492@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 21 Oct 2014 19:05:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273401 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 19:05:45 -0000 Author: mjg Date: Tue Oct 21 19:05:44 2014 New Revision: 273401 URL: https://svnweb.freebsd.org/changeset/base/273401 Log: Implement shared locking for sysctl. Modified: head/sys/kern/kern_sysctl.c Modified: head/sys/kern/kern_sysctl.c ============================================================================== --- head/sys/kern/kern_sysctl.c Tue Oct 21 19:02:26 2014 (r273400) +++ head/sys/kern/kern_sysctl.c Tue Oct 21 19:05:44 2014 (r273401) @@ -91,6 +91,10 @@ static struct sx sysctlmemlock; #define SYSCTL_XLOCK() sx_xlock(&sysctllock) #define SYSCTL_XUNLOCK() sx_xunlock(&sysctllock) +#define SYSCTL_SLOCK() sx_slock(&sysctllock) +#define SYSCTL_SUNLOCK() sx_sunlock(&sysctllock) +#define SYSCTL_XLOCKED() sx_xlocked(&sysctllock) +#define SYSCTL_ASSERT_LOCKED() sx_assert(&sysctllock, SA_LOCKED) #define SYSCTL_ASSERT_XLOCKED() sx_assert(&sysctllock, SA_XLOCKED) #define SYSCTL_INIT() sx_init(&sysctllock, "sysctl lock") #define SYSCTL_SLEEP(ch, wmesg, timo) \ @@ -106,12 +110,35 @@ static int sysctl_remove_oid_locked(stru static int sysctl_old_kernel(struct sysctl_req *, const void *, size_t); static int sysctl_new_kernel(struct sysctl_req *, void *, size_t); +static void +sysctl_lock(bool xlock) +{ + + if (xlock) + SYSCTL_XLOCK(); + else + SYSCTL_SLOCK(); +} + +static bool +sysctl_unlock(void) +{ + bool xlocked; + + xlocked = SYSCTL_XLOCKED(); + if (xlocked) + SYSCTL_XUNLOCK(); + else + SYSCTL_SUNLOCK(); + return (xlocked); +} + static struct sysctl_oid * sysctl_find_oidname(const char *name, struct sysctl_oid_list *list) { struct sysctl_oid *oidp; - SYSCTL_ASSERT_XLOCKED(); + SYSCTL_ASSERT_LOCKED(); SLIST_FOREACH(oidp, list, oid_link) { if (strcmp(oidp->oid_name, name) == 0) { return (oidp); @@ -144,9 +171,10 @@ sysctl_root_handler_locked(struct sysctl struct sysctl_req *req) { int error; + bool xlocked; - oid->oid_running++; - SYSCTL_XUNLOCK(); + atomic_add_int(&oid->oid_running, 1); + xlocked = sysctl_unlock(); if (!(oid->oid_kind & CTLFLAG_MPSAFE)) mtx_lock(&Giant); @@ -154,9 +182,9 @@ sysctl_root_handler_locked(struct sysctl if (!(oid->oid_kind & CTLFLAG_MPSAFE)) mtx_unlock(&Giant); - SYSCTL_XLOCK(); - oid->oid_running--; - if (oid->oid_running == 0 && (oid->oid_kind & CTLFLAG_DYING) != 0) + sysctl_lock(xlocked); + if (atomic_fetchadd_int(&oid->oid_running, -1) == 1 && + (oid->oid_kind & CTLFLAG_DYING) != 0) wakeup(&oid->oid_running); return (error); @@ -852,7 +880,7 @@ sysctl_sysctl_next_ls(struct sysctl_oid_ { struct sysctl_oid *oidp; - SYSCTL_ASSERT_XLOCKED(); + SYSCTL_ASSERT_LOCKED(); *len = level; SLIST_FOREACH(oidp, lsp, oid_link) { *next = oidp->oid_number; @@ -939,7 +967,7 @@ name2oid(char *name, int *oid, int *len, struct sysctl_oid_list *lsp = &sysctl__children; char *p; - SYSCTL_ASSERT_XLOCKED(); + SYSCTL_ASSERT_LOCKED(); for (*len = 0; *len < CTL_MAXNAME;) { p = strsep(&name, "."); @@ -1364,9 +1392,9 @@ kernel_sysctl(struct thread *td, int *na req.newfunc = sysctl_new_kernel; req.lock = REQ_UNWIRED; - SYSCTL_XLOCK(); + SYSCTL_SLOCK(); error = sysctl_root(0, name, namelen, &req); - SYSCTL_XUNLOCK(); + SYSCTL_SUNLOCK(); if (req.lock == REQ_WIRED && req.validlen > 0) vsunlock(req.oldptr, req.validlen); @@ -1498,7 +1526,7 @@ sysctl_find_oid(int *name, u_int namelen struct sysctl_oid *oid; int indx; - SYSCTL_ASSERT_XLOCKED(); + SYSCTL_ASSERT_LOCKED(); lsp = &sysctl__children; indx = 0; while (indx < CTL_MAXNAME) { @@ -1545,7 +1573,7 @@ sysctl_root(SYSCTL_HANDLER_ARGS) struct sysctl_oid *oid; int error, indx, lvl; - SYSCTL_ASSERT_XLOCKED(); + SYSCTL_ASSERT_LOCKED(); error = sysctl_find_oid(arg1, arg2, &oid, &indx, req); if (error) @@ -1729,9 +1757,9 @@ userland_sysctl(struct thread *td, int * for (;;) { req.oldidx = 0; req.newidx = 0; - SYSCTL_XLOCK(); + SYSCTL_SLOCK(); error = sysctl_root(0, name, namelen, &req); - SYSCTL_XUNLOCK(); + SYSCTL_SUNLOCK(); if (error != EAGAIN) break; kern_yield(PRI_USER); From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 19:36:21 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 084CD1AB; Tue, 21 Oct 2014 19:36:21 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E87E7CB9; Tue, 21 Oct 2014 19:36:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LJaKVp047639; Tue, 21 Oct 2014 19:36:20 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LJaKjq047638; Tue, 21 Oct 2014 19:36:20 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201410211936.s9LJaKjq047638@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 21 Oct 2014 19:36:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273402 - head/sys/dev/hyperv/storvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 19:36:21 -0000 Author: gjb Date: Tue Oct 21 19:36:20 2014 New Revision: 273402 URL: https://svnweb.freebsd.org/changeset/base/273402 Log: Fix an issue where a FreeBSD virtual machine provisioned in the Microsoft Azure service does not recognize the second attached disk on the system. Submitted by: kyliel@Microsoft Patched by: weh@Microsoft PR: 194376 MFC after: 3 days X-MFC-10.1: yes, ASAP Sponsored by: The FreeBSD Foundation 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.c Tue Oct 21 19:05:44 2014 (r273401) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Oct 21 19:36:20 2014 (r273402) @@ -75,7 +75,7 @@ __FBSDID("$FreeBSD$"); #define STORVSC_MAX_IO_REQUESTS (STORVSC_MAX_LUNS_PER_TARGET * 2) #define BLKVSC_MAX_IDE_DISKS_PER_TARGET (1) #define BLKVSC_MAX_IO_REQUESTS STORVSC_MAX_IO_REQUESTS -#define STORVSC_MAX_TARGETS (1) +#define STORVSC_MAX_TARGETS (2) struct storvsc_softc; @@ -584,7 +584,6 @@ hv_storvsc_on_iocompletion(struct storvs vm_srb = &vstor_packet->u.vm_srb; - request->sense_info_len = 0; if (((vm_srb->scsi_status & 0xFF) == SCSI_STATUS_CHECK_COND) && (vm_srb->srb_status & SRB_STATUS_AUTOSENSE_VALID)) { /* Autosense data available */ From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 19:40:35 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C326549C; Tue, 21 Oct 2014 19:40:35 +0000 (UTC) Received: from frv153.fwdcdn.com (frv153.fwdcdn.com [212.42.77.153]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8018ACFF; Tue, 21 Oct 2014 19:40:34 +0000 (UTC) Received: from [10.10.10.28] (helo=frv154.fwdcdn.com) by frv153.fwdcdn.com QID:1Xgf30-00057Y-IN/RC:5; Tue, 21 Oct 2014 22:24:46 +0300 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ukr.net; s=fsm; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date; bh=4uUHO+fg6YevOw+ZvbjXChnnhYemMY0eQNK6sEWldHc=; b=EIZMGIGQTWsVL5pcVi38ZymD+FDScs27VdgH82kHyAJPFuQnHnWH61JDbAPwzDw6WEQEut5MC2C+7hS/E/IeO7Zc5EpWrqTU4bQfzumEJSQzVjfWV028/voYxK+JYU8kCysyMo4wam8QnbbbLMQsGig4V5aRfMuN1NXVn77OKyw=; Received: from [5.248.240.192] (helo=nonamehost.local) by frv154.fwdcdn.com with esmtpsa ID 1Xgf2k-0001tN-Of ; Tue, 21 Oct 2014 22:24:30 +0300 Date: Tue, 21 Oct 2014 22:24:29 +0300 From: Ivan Klymenko To: Alexander Motin Subject: Re: svn commit: r273372 - stable/10/share/man/man4 Message-ID: <20141021222429.215400ca@nonamehost.local> In-Reply-To: <201410210623.s9L6NFUh067150@svn.freebsd.org> References: <201410210623.s9L6NFUh067150@svn.freebsd.org> X-Mailer: Claws Mail 3.10.1 (GTK+ 2.24.22; amd64-portbld-freebsd10.1) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Authentication-Result: IP=5.248.240.192; mail.from=fidaj@ukr.net; dkim=pass; header.d=ukr.net X-Ukrnet-Yellow: 0 Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-10@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 19:40:35 -0000 =D0=92 Tue, 21 Oct 2014 06:23:15 +0000 (UTC) Alexander Motin =D0=BF=D0=B8=D1=88=D0=B5=D1=82: > Author: mav > Date: Tue Oct 21 06:23:14 2014 > New Revision: 273372 > URL: https://svnweb.freebsd.org/changeset/base/273372 >=20 > Log: > MFC r262294 (by ivoras): > Explain how and where kern.cam.ada.write_cache can be set in > practical situations. >=20 > Modified: > stable/10/share/man/man4/ada.4 > Directory Properties: > stable/10/ (props changed) Please document the SYSCTL VARIABLE kern.cam.ada.X.sort_io_queue Thanks. From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 19:45:09 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6775973B; Tue, 21 Oct 2014 19:45:09 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 53A27DC2; Tue, 21 Oct 2014 19:45:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LJj9mu052534; Tue, 21 Oct 2014 19:45:09 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LJj9Y3052533; Tue, 21 Oct 2014 19:45:09 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410211945.s9LJj9Y3052533@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 21 Oct 2014 19:45:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273403 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 19:45:09 -0000 Author: mjg Date: Tue Oct 21 19:45:08 2014 New Revision: 273403 URL: https://svnweb.freebsd.org/changeset/base/273403 Log: Make sysctl name2oid shared-locked as well. This is a follow-up to r273401. Modified: head/sys/kern/kern_sysctl.c Modified: head/sys/kern/kern_sysctl.c ============================================================================== --- head/sys/kern/kern_sysctl.c Tue Oct 21 19:36:20 2014 (r273402) +++ head/sys/kern/kern_sysctl.c Tue Oct 21 19:45:08 2014 (r273403) @@ -1021,9 +1021,9 @@ sysctl_sysctl_name2oid(SYSCTL_HANDLER_AR p [req->newlen] = '\0'; - SYSCTL_XLOCK(); + SYSCTL_SLOCK(); error = name2oid(p, oid, &len, &op); - SYSCTL_XUNLOCK(); + SYSCTL_SUNLOCK(); free(p, M_SYSCTL); From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 19:56:46 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 054D8BC1; Tue, 21 Oct 2014 19:56:46 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E2919EF5; Tue, 21 Oct 2014 19:56:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LJujwT057778; Tue, 21 Oct 2014 19:56:45 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LJujEY057776; Tue, 21 Oct 2014 19:56:45 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410211956.s9LJujEY057776@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 21 Oct 2014 19:56:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273404 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 19:56:46 -0000 Author: bapt Date: Tue Oct 21 19:56:45 2014 New Revision: 273404 URL: https://svnweb.freebsd.org/changeset/base/273404 Log: The dependencies are computed with CC even if sources are C++, when building when building with an external gcc, we want to be able to pass the path to the libc++ headers so dependencies are correctly computed for C++ source files. Add a DEPFLAGS for that purpose Reviewed by: imp Modified: head/share/mk/bsd.dep.mk Modified: head/share/mk/bsd.dep.mk ============================================================================== --- head/share/mk/bsd.dep.mk Tue Oct 21 19:45:08 2014 (r273403) +++ head/share/mk/bsd.dep.mk Tue Oct 21 19:56:45 2014 (r273404) @@ -49,7 +49,7 @@ GTAGSFLAGS?= -o HTAGSFLAGS?= .if ${CC} != "cc" -MKDEPCMD?= CC='${CC}' mkdep +MKDEPCMD?= CC='${CC} ${DEPFLAGS}' mkdep .else MKDEPCMD?= mkdep .endif From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 19:58:24 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5DD71DFF; Tue, 21 Oct 2014 19:58:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4A327F15; Tue, 21 Oct 2014 19:58:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LJwOWw058062; Tue, 21 Oct 2014 19:58:24 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LJwOX4058061; Tue, 21 Oct 2014 19:58:24 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410211958.s9LJwOX4058061@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 21 Oct 2014 19:58:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273405 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 19:58:24 -0000 Author: bapt Date: Tue Oct 21 19:58:23 2014 New Revision: 273405 URL: https://svnweb.freebsd.org/changeset/base/273405 Log: When using an external toolchain note that gcc 4.8+ supports C++11 Submitted by: imp Modified: head/share/mk/bsd.compiler.mk Modified: head/share/mk/bsd.compiler.mk ============================================================================== --- head/share/mk/bsd.compiler.mk Tue Oct 21 19:56:45 2014 (r273404) +++ head/share/mk/bsd.compiler.mk Tue Oct 21 19:58:23 2014 (r273405) @@ -42,7 +42,8 @@ COMPILER_VERSION!=echo ${_v:M[1-9].[0-9] .endif .undef _v -.if ${COMPILER_TYPE} == "clang" +.if ${COMPILER_TYPE} == "clang" || \ + (${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 40800) COMPILER_FEATURES= c++11 .else COMPILER_FEATURES= From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 20:00:50 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5C224F61; Tue, 21 Oct 2014 20:00:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 483C9FB8; Tue, 21 Oct 2014 20:00:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LK0oao061586; Tue, 21 Oct 2014 20:00:50 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LK0oQn061585; Tue, 21 Oct 2014 20:00:50 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410212000.s9LK0oQn061585@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 21 Oct 2014 20:00:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273406 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 20:00:50 -0000 Author: bapt Date: Tue Oct 21 20:00:49 2014 New Revision: 273406 URL: https://svnweb.freebsd.org/changeset/base/273406 Log: Always use libc++ as the default c++ stack when building with an external gcc 4.8+ While here disable building gcc from base when using gcc 4.8+ Reviewed by: imp Modified: head/share/mk/src.opts.mk Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Tue Oct 21 19:58:23 2014 (r273405) +++ head/share/mk/src.opts.mk Tue Oct 21 20:00:49 2014 (r273406) @@ -358,4 +358,12 @@ MK_${vv:H}:= ${MK_${vv:T}} MK_LLDB:= no .endif +# gcc 4.8 and newer supports libc++, so suppress gnuc++ in that case. +# while in theory we could build it with that, we don't want to do +# that since it creates too much confusion for too little gain. +.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 40800 +MK_GNUCXX:=no +MK_GCC:=no .endif + +.endif # !target(____) From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 20:04:05 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D83BF198; Tue, 21 Oct 2014 20:04:05 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C48ABFD5; Tue, 21 Oct 2014 20:04:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LK45wx062616; Tue, 21 Oct 2014 20:04:05 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LK45Hc062615; Tue, 21 Oct 2014 20:04:05 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410212004.s9LK45Hc062615@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 21 Oct 2014 20:04:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273407 - head/lib/libc++ X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 20:04:06 -0000 Author: bapt Date: Tue Oct 21 20:04:05 2014 New Revision: 273407 URL: https://svnweb.freebsd.org/changeset/base/273407 Log: When using an external gcc 4.8+ and not building libstdc++ then create in the objectdir a fake libstdc++.so and libstdc++.a which is a symlink on libc++ that allow g++ to satisfy its links dependencies in the least hackish way. Please note that this hacky libstds++ never get installed on the final system Reviewed by: imp Modified: head/lib/libc++/Makefile Modified: head/lib/libc++/Makefile ============================================================================== --- head/lib/libc++/Makefile Tue Oct 21 20:00:49 2014 (r273406) +++ head/lib/libc++/Makefile Tue Oct 21 20:04:05 2014 (r273407) @@ -1,5 +1,7 @@ # $FreeBSD$ +.include + LIBCXXRTDIR= ${.CURDIR}/../../contrib/libcxxrt HDRDIR= ${.CURDIR}/../../contrib/libc++/include SRCDIR= ${.CURDIR}/../../contrib/libc++/src @@ -192,4 +194,14 @@ EXT+= ${HDRDIR}/ext/${hdr} .endfor EXTDIR= ${CXXINCLUDEDIR}/ext +.if ${MK_GNUCXX} == "no" && ${COMPILER_TYPE} == "gcc" +CLEANFILES+= libstdc++.so libstdc++.a + +afterinstall: + ln -sf ${DESTDIR}${LIBDIR}/lib${LIB}.so \ + ${.OBJDIR}/libstdc++.so + ln -sf ${DESTDIR}${LIBDIR}/lib${LIB}.a \ + ${.OBJDIR}/libstdc++.a +.endif + .include From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 20:07:15 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C96D732D; Tue, 21 Oct 2014 20:07:15 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B5E722B; Tue, 21 Oct 2014 20:07:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LK7F1r063116; Tue, 21 Oct 2014 20:07:15 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LK7F5F063115; Tue, 21 Oct 2014 20:07:15 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410212007.s9LK7F5F063115@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 21 Oct 2014 20:07:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273408 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 20:07:15 -0000 Author: bapt Date: Tue Oct 21 20:07:15 2014 New Revision: 273408 URL: https://svnweb.freebsd.org/changeset/base/273408 Log: Make the external toolchain support grows to the knowleged of XXFLAGS for C++ dedicated flags and DEPFLAGS for mkdep flags Pass the path to the libc++ headers in both, enforce the gnu++11 standard in the XXFLAGS to satisfy libc++ requirements pass the libc++ objectdir as a location where to find libraries so it can find libstdc++.so and libstdc++.A Reviewed by: imp Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Tue Oct 21 20:04:05 2014 (r273407) +++ head/Makefile.inc1 Tue Oct 21 20:07:15 2014 (r273408) @@ -323,7 +323,8 @@ X${BINUTIL}?= ${CROSS_BINUTILS_PREFIX}${ X${BINUTIL}?= ${${BINUTIL}} .endif .endfor -WMAKEENV+= CC="${XCC} ${XFLAGS}" CXX="${XCXX} ${XFLAGS}" \ +WMAKEENV+= CC="${XCC} ${XFLAGS}" CXX="${XCXX} ${XFLAGS} ${XXFLAGS}" \ + DEPFLAGS="${DEPFLAGS}" \ CPP="${XCPP} ${XFLAGS}" \ AS="${XAS}" AR="${XAR}" LD="${XLD}" NM=${XNM} \ OBJDUMP=${XOBJDUMP} OBJCOPY="${XOBJCOPY}" \ @@ -351,6 +352,8 @@ TARGET_ABI= gnueabi .endif .if defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc XFLAGS+= -isystem ${WORLDTMP}/usr/include -L${WORLDTMP}/usr/lib +XXFLAGS+= -I${WORLDTMP}/usr/include/c++/v1 -std=gnu++11 -L${WORLDTMP}/../lib/libc++ +DEPFLAGS+= -I${WORLDTMP}/usr/include/c++/v1 .else TARGET_ABI?= unknown TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0 From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 20:11:05 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D904B5AC; Tue, 21 Oct 2014 20:11:05 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C548CC3; Tue, 21 Oct 2014 20:11:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LKB5q3066442; Tue, 21 Oct 2014 20:11:05 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LKB58Y066441; Tue, 21 Oct 2014 20:11:05 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410212011.s9LKB58Y066441@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 21 Oct 2014 20:11:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273409 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 20:11:06 -0000 Author: bapt Date: Tue Oct 21 20:11:05 2014 New Revision: 273409 URL: https://svnweb.freebsd.org/changeset/base/273409 Log: Do not make ld(1) warnings fatal anymore, binutils behaviour has changed over the time and gnu.warnings.symbol are now being fatal preventing building world. in the futur we want to investigate only making the gnu.warning.symbol non fatal Reviewed by: imp Modified: head/share/mk/bsd.lib.mk Modified: head/share/mk/bsd.lib.mk ============================================================================== --- head/share/mk/bsd.lib.mk Tue Oct 21 20:07:15 2014 (r273408) +++ head/share/mk/bsd.lib.mk Tue Oct 21 20:11:05 2014 (r273409) @@ -207,7 +207,7 @@ _LIBS+= ${SHLIB_NAME} SOLINKOPTS= -shared -Wl,-x .if !defined(ALLOW_SHARED_TEXTREL) -SOLINKOPTS+= -Wl,--fatal-warnings -Wl,--warn-shared-textrel +SOLINKOPTS+= -Wl,--no-fatal-warnings -Wl,--warn-shared-textrel .endif .if target(beforelinking) From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 20:17:05 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C16C1743; Tue, 21 Oct 2014 20:17:05 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ADBB1191; Tue, 21 Oct 2014 20:17:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LKH5T3068451; Tue, 21 Oct 2014 20:17:05 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LKH5Ic068450; Tue, 21 Oct 2014 20:17:05 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410212017.s9LKH5Ic068450@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Tue, 21 Oct 2014 20:17:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273410 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 20:17:05 -0000 Author: ngie Date: Tue Oct 21 20:17:05 2014 New Revision: 273410 URL: https://svnweb.freebsd.org/changeset/base/273410 Log: Add sys/socket.h #include for bind(2), et al Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_connect.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_connect.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_connect.c Tue Oct 21 20:11:05 2014 (r273409) +++ head/contrib/netbsd-tests/lib/libc/sys/t_connect.c Tue Oct 21 20:17:05 2014 (r273410) @@ -36,6 +36,10 @@ #include +#ifdef __FreeBSD__ +#include +#endif + ATF_TC(connect_low_port); ATF_TC_HEAD(connect_low_port, tc) { From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 20:20:08 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 95B0B993; Tue, 21 Oct 2014 20:20:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 80BE11BD; Tue, 21 Oct 2014 20:20:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LKK85m069007; Tue, 21 Oct 2014 20:20:08 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LKK89k069005; Tue, 21 Oct 2014 20:20:08 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410212020.s9LKK89k069005@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 21 Oct 2014 20:20:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273411 - in stable/10: sys/kern usr.sbin/rtsold X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 20:20:08 -0000 Author: delphij Date: Tue Oct 21 20:20:07 2014 New Revision: 273411 URL: https://svnweb.freebsd.org/changeset/base/273411 Log: Fix rtsold(8) remote buffer overflow vulnerability. [SA-14:20] Fix memory leak in sandboxed namei lookup. [SA-14:22] Modified: stable/10/sys/kern/vfs_lookup.c stable/10/usr.sbin/rtsold/rtsol.c Modified: stable/10/sys/kern/vfs_lookup.c ============================================================================== --- stable/10/sys/kern/vfs_lookup.c Tue Oct 21 20:17:05 2014 (r273410) +++ stable/10/sys/kern/vfs_lookup.c Tue Oct 21 20:20:07 2014 (r273411) @@ -121,6 +121,16 @@ TUNABLE_INT("vfs.lookup_shared", &lookup * if symbolic link, massage name in buffer and continue * } */ +static void +namei_cleanup_cnp(struct componentname *cnp) +{ + uma_zfree(namei_zone, cnp->cn_pnbuf); +#ifdef DIAGNOSTIC + cnp->cn_pnbuf = NULL; + cnp->cn_nameptr = NULL; +#endif +} + int namei(struct nameidata *ndp) { @@ -185,11 +195,7 @@ namei(struct nameidata *ndp) } #endif if (error) { - uma_zfree(namei_zone, cnp->cn_pnbuf); -#ifdef DIAGNOSTIC - cnp->cn_pnbuf = NULL; - cnp->cn_nameptr = NULL; -#endif + namei_cleanup_cnp(cnp); ndp->ni_vp = NULL; return (error); } @@ -256,11 +262,7 @@ namei(struct nameidata *ndp) } } if (error) { - uma_zfree(namei_zone, cnp->cn_pnbuf); -#ifdef DIAGNOSTIC - cnp->cn_pnbuf = NULL; - cnp->cn_nameptr = NULL; -#endif + namei_cleanup_cnp(cnp); return (error); } } @@ -286,6 +288,7 @@ namei(struct nameidata *ndp) if (KTRPOINT(curthread, KTR_CAPFAIL)) ktrcapfail(CAPFAIL_LOOKUP, NULL, NULL); #endif + namei_cleanup_cnp(cnp); return (ENOTCAPABLE); } while (*(cnp->cn_nameptr) == '/') { @@ -298,11 +301,7 @@ namei(struct nameidata *ndp) ndp->ni_startdir = dp; error = lookup(ndp); if (error) { - uma_zfree(namei_zone, cnp->cn_pnbuf); -#ifdef DIAGNOSTIC - cnp->cn_pnbuf = NULL; - cnp->cn_nameptr = NULL; -#endif + namei_cleanup_cnp(cnp); SDT_PROBE(vfs, namei, lookup, return, error, NULL, 0, 0, 0); return (error); @@ -312,11 +311,7 @@ namei(struct nameidata *ndp) */ if ((cnp->cn_flags & ISSYMLINK) == 0) { if ((cnp->cn_flags & (SAVENAME | SAVESTART)) == 0) { - uma_zfree(namei_zone, cnp->cn_pnbuf); -#ifdef DIAGNOSTIC - cnp->cn_pnbuf = NULL; - cnp->cn_nameptr = NULL; -#endif + namei_cleanup_cnp(cnp); } else cnp->cn_flags |= HASBUF; @@ -378,11 +373,7 @@ namei(struct nameidata *ndp) vput(ndp->ni_vp); dp = ndp->ni_dvp; } - uma_zfree(namei_zone, cnp->cn_pnbuf); -#ifdef DIAGNOSTIC - cnp->cn_pnbuf = NULL; - cnp->cn_nameptr = NULL; -#endif + namei_cleanup_cnp(cnp); vput(ndp->ni_vp); ndp->ni_vp = NULL; vrele(ndp->ni_dvp); Modified: stable/10/usr.sbin/rtsold/rtsol.c ============================================================================== --- stable/10/usr.sbin/rtsold/rtsol.c Tue Oct 21 20:17:05 2014 (r273410) +++ stable/10/usr.sbin/rtsold/rtsol.c Tue Oct 21 20:20:07 2014 (r273411) @@ -933,7 +933,8 @@ dname_labeldec(char *dst, size_t dlen, c dst_origin = dst; memset(dst, '\0', dlen); while (src && (len = (uint8_t)(*src++) & 0x3f) && - (src + len) <= src_last) { + (src + len) <= src_last && + (dst - dst_origin < (ssize_t)dlen)) { if (dst != dst_origin) *dst++ = '.'; warnmsg(LOG_DEBUG, __func__, "labellen = %zd", len); From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 20:20:18 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A554EABD; Tue, 21 Oct 2014 20:20:18 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9093E24A; Tue, 21 Oct 2014 20:20:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LKKIgl069338; Tue, 21 Oct 2014 20:20:18 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LKKHrj069253; Tue, 21 Oct 2014 20:20:17 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410212020.s9LKKHrj069253@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 21 Oct 2014 20:20:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r273412 - in stable/9: sbin/routed sys/kern usr.sbin/rtsold X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 20:20:18 -0000 Author: delphij Date: Tue Oct 21 20:20:17 2014 New Revision: 273412 URL: https://svnweb.freebsd.org/changeset/base/273412 Log: Fix rtsold(8) remote buffer overflow vulnerability. [SA-14:20] Fix routed(8) remote denial of service vulnerability. [SA-14:21] Fix memory leak in sandboxed namei lookup. [SA-14:22] Modified: stable/9/sbin/routed/input.c stable/9/sys/kern/vfs_lookup.c stable/9/usr.sbin/rtsold/rtsol.c Modified: stable/9/sbin/routed/input.c ============================================================================== --- stable/9/sbin/routed/input.c Tue Oct 21 20:20:07 2014 (r273411) +++ stable/9/sbin/routed/input.c Tue Oct 21 20:20:17 2014 (r273412) @@ -288,6 +288,10 @@ input(struct sockaddr_in *from, /* rece /* Answer a query from a utility program * with all we know. */ + if (aifp == NULL) { + trace_pkt("ignore remote query"); + return; + } if (from->sin_port != htons(RIP_PORT)) { supply(from, aifp, OUT_QUERY, 0, rip->rip_vers, ap != 0); Modified: stable/9/sys/kern/vfs_lookup.c ============================================================================== --- stable/9/sys/kern/vfs_lookup.c Tue Oct 21 20:20:07 2014 (r273411) +++ stable/9/sys/kern/vfs_lookup.c Tue Oct 21 20:20:17 2014 (r273412) @@ -121,6 +121,16 @@ TUNABLE_INT("vfs.lookup_shared", &lookup * if symbolic link, massage name in buffer and continue * } */ +static void +namei_cleanup_cnp(struct componentname *cnp) +{ + uma_zfree(namei_zone, cnp->cn_pnbuf); +#ifdef DIAGNOSTIC + cnp->cn_pnbuf = NULL; + cnp->cn_nameptr = NULL; +#endif +} + int namei(struct nameidata *ndp) { @@ -182,11 +192,7 @@ namei(struct nameidata *ndp) } #endif if (error) { - uma_zfree(namei_zone, cnp->cn_pnbuf); -#ifdef DIAGNOSTIC - cnp->cn_pnbuf = NULL; - cnp->cn_nameptr = NULL; -#endif + namei_cleanup_cnp(cnp); ndp->ni_vp = NULL; return (error); } @@ -248,11 +254,7 @@ namei(struct nameidata *ndp) } } if (error) { - uma_zfree(namei_zone, cnp->cn_pnbuf); -#ifdef DIAGNOSTIC - cnp->cn_pnbuf = NULL; - cnp->cn_nameptr = NULL; -#endif + namei_cleanup_cnp(cnp); return (error); } } @@ -278,8 +280,10 @@ namei(struct nameidata *ndp) if (*(cnp->cn_nameptr) == '/') { vrele(dp); VFS_UNLOCK_GIANT(vfslocked); - if (ndp->ni_strictrelative != 0) + if (ndp->ni_strictrelative != 0) { + namei_cleanup_cnp(cnp); return (ENOTCAPABLE); + } while (*(cnp->cn_nameptr) == '/') { cnp->cn_nameptr++; ndp->ni_pathlen--; @@ -293,11 +297,7 @@ namei(struct nameidata *ndp) ndp->ni_startdir = dp; error = lookup(ndp); if (error) { - uma_zfree(namei_zone, cnp->cn_pnbuf); -#ifdef DIAGNOSTIC - cnp->cn_pnbuf = NULL; - cnp->cn_nameptr = NULL; -#endif + namei_cleanup_cnp(cnp); SDT_PROBE(vfs, namei, lookup, return, error, NULL, 0, 0, 0); return (error); @@ -309,11 +309,7 @@ namei(struct nameidata *ndp) */ if ((cnp->cn_flags & ISSYMLINK) == 0) { if ((cnp->cn_flags & (SAVENAME | SAVESTART)) == 0) { - uma_zfree(namei_zone, cnp->cn_pnbuf); -#ifdef DIAGNOSTIC - cnp->cn_pnbuf = NULL; - cnp->cn_nameptr = NULL; -#endif + namei_cleanup_cnp(cnp); } else cnp->cn_flags |= HASBUF; @@ -379,11 +375,7 @@ namei(struct nameidata *ndp) vput(ndp->ni_vp); dp = ndp->ni_dvp; } - uma_zfree(namei_zone, cnp->cn_pnbuf); -#ifdef DIAGNOSTIC - cnp->cn_pnbuf = NULL; - cnp->cn_nameptr = NULL; -#endif + namei_cleanup_cnp(cnp); vput(ndp->ni_vp); ndp->ni_vp = NULL; vrele(ndp->ni_dvp); Modified: stable/9/usr.sbin/rtsold/rtsol.c ============================================================================== --- stable/9/usr.sbin/rtsold/rtsol.c Tue Oct 21 20:20:07 2014 (r273411) +++ stable/9/usr.sbin/rtsold/rtsol.c Tue Oct 21 20:20:17 2014 (r273412) @@ -933,7 +933,8 @@ dname_labeldec(char *dst, size_t dlen, c dst_origin = dst; memset(dst, '\0', dlen); while (src && (len = (uint8_t)(*src++) & 0x3f) && - (src + len) <= src_last) { + (src + len) <= src_last && + (dst - dst_origin < (ssize_t)dlen)) { if (dst != dst_origin) *dst++ = '.'; warnmsg(LOG_DEBUG, __func__, "labellen = %zd", len); From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 20:20:26 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D6187BE9; Tue, 21 Oct 2014 20:20:26 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C23CA24D; Tue, 21 Oct 2014 20:20:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LKKQde069599; Tue, 21 Oct 2014 20:20:26 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LKKQUb069598; Tue, 21 Oct 2014 20:20:26 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410212020.s9LKKQUb069598@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 21 Oct 2014 20:20:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r273413 - stable/8/sbin/routed X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 20:20:27 -0000 Author: delphij Date: Tue Oct 21 20:20:26 2014 New Revision: 273413 URL: https://svnweb.freebsd.org/changeset/base/273413 Log: Fix routed(8) remote denial of service vulnerability. [SA-14:21] Modified: stable/8/sbin/routed/input.c Modified: stable/8/sbin/routed/input.c ============================================================================== --- stable/8/sbin/routed/input.c Tue Oct 21 20:20:17 2014 (r273412) +++ stable/8/sbin/routed/input.c Tue Oct 21 20:20:26 2014 (r273413) @@ -288,6 +288,10 @@ input(struct sockaddr_in *from, /* rece /* Answer a query from a utility program * with all we know. */ + if (aifp == NULL) { + trace_pkt("ignore remote query"); + return; + } if (from->sin_port != htons(RIP_PORT)) { supply(from, aifp, OUT_QUERY, 0, rip->rip_vers, ap != 0); From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 20:20:37 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DDBDAD17; Tue, 21 Oct 2014 20:20:37 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C95AA250; Tue, 21 Oct 2014 20:20:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LKKboA069687; Tue, 21 Oct 2014 20:20:37 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LKKbwR069684; Tue, 21 Oct 2014 20:20:37 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410212020.s9LKKbwR069684@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 21 Oct 2014 20:20:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r273414 - in releng/10.1: sbin/routed sys/kern usr.sbin/rtsold X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 20:20:38 -0000 Author: delphij Date: Tue Oct 21 20:20:36 2014 New Revision: 273414 URL: https://svnweb.freebsd.org/changeset/base/273414 Log: Fix rtsold(8) remote buffer overflow vulnerability. [SA-14:20] Fix routed(8) remote denial of service vulnerability. [SA-14:21] Fix memory leak in sandboxed namei lookup. [SA-14:22] Approved by: re (so@ blanket) Modified: releng/10.1/sbin/routed/input.c releng/10.1/sys/kern/vfs_lookup.c releng/10.1/usr.sbin/rtsold/rtsol.c Modified: releng/10.1/sbin/routed/input.c ============================================================================== --- releng/10.1/sbin/routed/input.c Tue Oct 21 20:20:26 2014 (r273413) +++ releng/10.1/sbin/routed/input.c Tue Oct 21 20:20:36 2014 (r273414) @@ -288,6 +288,10 @@ input(struct sockaddr_in *from, /* rece /* Answer a query from a utility program * with all we know. */ + if (aifp == NULL) { + trace_pkt("ignore remote query"); + return; + } if (from->sin_port != htons(RIP_PORT)) { supply(from, aifp, OUT_QUERY, 0, rip->rip_vers, ap != 0); Modified: releng/10.1/sys/kern/vfs_lookup.c ============================================================================== --- releng/10.1/sys/kern/vfs_lookup.c Tue Oct 21 20:20:26 2014 (r273413) +++ releng/10.1/sys/kern/vfs_lookup.c Tue Oct 21 20:20:36 2014 (r273414) @@ -121,6 +121,16 @@ TUNABLE_INT("vfs.lookup_shared", &lookup * if symbolic link, massage name in buffer and continue * } */ +static void +namei_cleanup_cnp(struct componentname *cnp) +{ + uma_zfree(namei_zone, cnp->cn_pnbuf); +#ifdef DIAGNOSTIC + cnp->cn_pnbuf = NULL; + cnp->cn_nameptr = NULL; +#endif +} + int namei(struct nameidata *ndp) { @@ -185,11 +195,7 @@ namei(struct nameidata *ndp) } #endif if (error) { - uma_zfree(namei_zone, cnp->cn_pnbuf); -#ifdef DIAGNOSTIC - cnp->cn_pnbuf = NULL; - cnp->cn_nameptr = NULL; -#endif + namei_cleanup_cnp(cnp); ndp->ni_vp = NULL; return (error); } @@ -256,11 +262,7 @@ namei(struct nameidata *ndp) } } if (error) { - uma_zfree(namei_zone, cnp->cn_pnbuf); -#ifdef DIAGNOSTIC - cnp->cn_pnbuf = NULL; - cnp->cn_nameptr = NULL; -#endif + namei_cleanup_cnp(cnp); return (error); } } @@ -286,6 +288,7 @@ namei(struct nameidata *ndp) if (KTRPOINT(curthread, KTR_CAPFAIL)) ktrcapfail(CAPFAIL_LOOKUP, NULL, NULL); #endif + namei_cleanup_cnp(cnp); return (ENOTCAPABLE); } while (*(cnp->cn_nameptr) == '/') { @@ -298,11 +301,7 @@ namei(struct nameidata *ndp) ndp->ni_startdir = dp; error = lookup(ndp); if (error) { - uma_zfree(namei_zone, cnp->cn_pnbuf); -#ifdef DIAGNOSTIC - cnp->cn_pnbuf = NULL; - cnp->cn_nameptr = NULL; -#endif + namei_cleanup_cnp(cnp); SDT_PROBE(vfs, namei, lookup, return, error, NULL, 0, 0, 0); return (error); @@ -312,11 +311,7 @@ namei(struct nameidata *ndp) */ if ((cnp->cn_flags & ISSYMLINK) == 0) { if ((cnp->cn_flags & (SAVENAME | SAVESTART)) == 0) { - uma_zfree(namei_zone, cnp->cn_pnbuf); -#ifdef DIAGNOSTIC - cnp->cn_pnbuf = NULL; - cnp->cn_nameptr = NULL; -#endif + namei_cleanup_cnp(cnp); } else cnp->cn_flags |= HASBUF; @@ -378,11 +373,7 @@ namei(struct nameidata *ndp) vput(ndp->ni_vp); dp = ndp->ni_dvp; } - uma_zfree(namei_zone, cnp->cn_pnbuf); -#ifdef DIAGNOSTIC - cnp->cn_pnbuf = NULL; - cnp->cn_nameptr = NULL; -#endif + namei_cleanup_cnp(cnp); vput(ndp->ni_vp); ndp->ni_vp = NULL; vrele(ndp->ni_dvp); Modified: releng/10.1/usr.sbin/rtsold/rtsol.c ============================================================================== --- releng/10.1/usr.sbin/rtsold/rtsol.c Tue Oct 21 20:20:26 2014 (r273413) +++ releng/10.1/usr.sbin/rtsold/rtsol.c Tue Oct 21 20:20:36 2014 (r273414) @@ -933,7 +933,8 @@ dname_labeldec(char *dst, size_t dlen, c dst_origin = dst; memset(dst, '\0', dlen); while (src && (len = (uint8_t)(*src++) & 0x3f) && - (src + len) <= src_last) { + (src + len) <= src_last && + (dst - dst_origin < (ssize_t)dlen)) { if (dst != dst_origin) *dst++ = '.'; warnmsg(LOG_DEBUG, __func__, "labellen = %zd", len); From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 20:21:19 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6E1B3E3F; Tue, 21 Oct 2014 20:21:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5685B256; Tue, 21 Oct 2014 20:21:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LKLJp9072813; Tue, 21 Oct 2014 20:21:19 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LKLBhE072729; Tue, 21 Oct 2014 20:21:11 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410212021.s9LKLBhE072729@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 21 Oct 2014 20:21:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r273415 - in releng: 10.0 10.0/crypto/openssl/apps 10.0/crypto/openssl/ssl 10.0/sbin/routed 10.0/sys/conf 10.0/sys/kern 10.0/usr.sbin/rtsold 9.1 9.1/crypto/openssl/apps 9.1/crypto/opens... X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 20:21:19 -0000 Author: delphij Date: Tue Oct 21 20:21:10 2014 New Revision: 273415 URL: https://svnweb.freebsd.org/changeset/base/273415 Log: Fix rtsold(8) remote buffer overflow vulnerability. [SA-14:20] Fix routed(8) remote denial of service vulnerability. [SA-14:21] Fix memory leak in sandboxed namei lookup. [SA-14:22] Fix OpenSSL multiple vulnerabilities. [SA-14:23] Approved by: so Modified: releng/10.0/UPDATING releng/10.0/crypto/openssl/apps/s_client.c releng/10.0/crypto/openssl/ssl/d1_lib.c releng/10.0/crypto/openssl/ssl/d1_srtp.c releng/10.0/crypto/openssl/ssl/dtls1.h releng/10.0/crypto/openssl/ssl/s23_clnt.c releng/10.0/crypto/openssl/ssl/s23_srvr.c releng/10.0/crypto/openssl/ssl/s2_lib.c releng/10.0/crypto/openssl/ssl/s3_enc.c releng/10.0/crypto/openssl/ssl/s3_lib.c releng/10.0/crypto/openssl/ssl/ssl.h releng/10.0/crypto/openssl/ssl/ssl3.h releng/10.0/crypto/openssl/ssl/ssl_err.c releng/10.0/crypto/openssl/ssl/ssl_lib.c releng/10.0/crypto/openssl/ssl/t1_enc.c releng/10.0/crypto/openssl/ssl/t1_lib.c releng/10.0/crypto/openssl/ssl/tls1.h releng/10.0/sbin/routed/input.c releng/10.0/sys/conf/newvers.sh releng/10.0/sys/kern/vfs_lookup.c releng/10.0/usr.sbin/rtsold/rtsol.c releng/9.1/UPDATING releng/9.1/crypto/openssl/apps/s_cb.c releng/9.1/crypto/openssl/apps/s_client.c releng/9.1/crypto/openssl/crypto/err/openssl.ec releng/9.1/crypto/openssl/doc/apps/s_client.pod releng/9.1/crypto/openssl/doc/ssl/SSL_CTX_set_mode.pod releng/9.1/crypto/openssl/ssl/d1_lib.c releng/9.1/crypto/openssl/ssl/dtls1.h releng/9.1/crypto/openssl/ssl/s23_clnt.c releng/9.1/crypto/openssl/ssl/s23_srvr.c releng/9.1/crypto/openssl/ssl/s2_lib.c releng/9.1/crypto/openssl/ssl/s3_enc.c releng/9.1/crypto/openssl/ssl/s3_lib.c releng/9.1/crypto/openssl/ssl/ssl.h releng/9.1/crypto/openssl/ssl/ssl3.h releng/9.1/crypto/openssl/ssl/ssl_err.c releng/9.1/crypto/openssl/ssl/ssl_lib.c releng/9.1/crypto/openssl/ssl/ssl_stat.c releng/9.1/crypto/openssl/ssl/t1_enc.c releng/9.1/crypto/openssl/ssl/t1_lib.c releng/9.1/crypto/openssl/ssl/tls1.h releng/9.1/sbin/routed/input.c releng/9.1/sys/conf/newvers.sh releng/9.1/sys/kern/vfs_lookup.c releng/9.1/usr.sbin/rtsold/rtsol.c releng/9.2/UPDATING releng/9.2/crypto/openssl/apps/s_cb.c releng/9.2/crypto/openssl/apps/s_client.c releng/9.2/crypto/openssl/crypto/err/openssl.ec releng/9.2/crypto/openssl/doc/apps/s_client.pod releng/9.2/crypto/openssl/doc/ssl/SSL_CTX_set_mode.pod releng/9.2/crypto/openssl/ssl/d1_lib.c releng/9.2/crypto/openssl/ssl/dtls1.h releng/9.2/crypto/openssl/ssl/s23_clnt.c releng/9.2/crypto/openssl/ssl/s23_srvr.c releng/9.2/crypto/openssl/ssl/s2_lib.c releng/9.2/crypto/openssl/ssl/s3_enc.c releng/9.2/crypto/openssl/ssl/s3_lib.c releng/9.2/crypto/openssl/ssl/ssl.h releng/9.2/crypto/openssl/ssl/ssl3.h releng/9.2/crypto/openssl/ssl/ssl_err.c releng/9.2/crypto/openssl/ssl/ssl_lib.c releng/9.2/crypto/openssl/ssl/ssl_stat.c releng/9.2/crypto/openssl/ssl/t1_enc.c releng/9.2/crypto/openssl/ssl/t1_lib.c releng/9.2/crypto/openssl/ssl/tls1.h releng/9.2/sbin/routed/input.c releng/9.2/sys/conf/newvers.sh releng/9.2/sys/kern/vfs_lookup.c releng/9.2/usr.sbin/rtsold/rtsol.c releng/9.3/UPDATING releng/9.3/crypto/openssl/apps/s_client.c releng/9.3/crypto/openssl/crypto/err/openssl.ec releng/9.3/crypto/openssl/doc/apps/s_client.pod releng/9.3/crypto/openssl/doc/ssl/SSL_CTX_set_mode.pod releng/9.3/crypto/openssl/ssl/d1_lib.c releng/9.3/crypto/openssl/ssl/dtls1.h releng/9.3/crypto/openssl/ssl/s23_clnt.c releng/9.3/crypto/openssl/ssl/s23_srvr.c releng/9.3/crypto/openssl/ssl/s2_lib.c releng/9.3/crypto/openssl/ssl/s3_enc.c releng/9.3/crypto/openssl/ssl/s3_lib.c releng/9.3/crypto/openssl/ssl/ssl.h releng/9.3/crypto/openssl/ssl/ssl3.h releng/9.3/crypto/openssl/ssl/ssl_err.c releng/9.3/crypto/openssl/ssl/ssl_lib.c releng/9.3/crypto/openssl/ssl/t1_enc.c releng/9.3/crypto/openssl/ssl/t1_lib.c releng/9.3/crypto/openssl/ssl/tls1.h releng/9.3/sbin/routed/input.c releng/9.3/sys/conf/newvers.sh releng/9.3/sys/kern/vfs_lookup.c releng/9.3/usr.sbin/rtsold/rtsol.c Modified: releng/10.0/UPDATING ============================================================================== --- releng/10.0/UPDATING Tue Oct 21 20:20:36 2014 (r273414) +++ releng/10.0/UPDATING Tue Oct 21 20:21:10 2014 (r273415) @@ -16,6 +16,19 @@ from older versions of FreeBSD, try WITH stable/10, and then rebuild without this option. The bootstrap process from older version of current is a bit fragile. +20141021: p10 FreeBSD-SA-14:20.rtsold + FreeBSD-SA-14:21.routed + FreeBSD-SA-14:22.namei + FreeBSD-SA-14:23.openssl + + Fix rtsold(8) remote buffer overflow vulnerability. [SA-14:20] + + Fix routed(8) remote denial of service vulnerability. [SA-14:21] + + Fix memory leak in sandboxed namei lookup. [SA-14:22] + + Fix OpenSSL multiple vulnerabilities. [SA-14:23] + 20140916: p9 FreeBSD-SA-14:19.tcp Fix Denial of Service in TCP packet processing. [SA-14:19] Modified: releng/10.0/crypto/openssl/apps/s_client.c ============================================================================== --- releng/10.0/crypto/openssl/apps/s_client.c Tue Oct 21 20:20:36 2014 (r273414) +++ releng/10.0/crypto/openssl/apps/s_client.c Tue Oct 21 20:21:10 2014 (r273415) @@ -335,6 +335,7 @@ static void sc_usage(void) BIO_printf(bio_err," -tls1_1 - just use TLSv1.1\n"); BIO_printf(bio_err," -tls1 - just use TLSv1\n"); BIO_printf(bio_err," -dtls1 - just use DTLSv1\n"); + BIO_printf(bio_err," -fallback_scsv - send TLS_FALLBACK_SCSV\n"); BIO_printf(bio_err," -mtu - set the link layer MTU\n"); BIO_printf(bio_err," -no_tls1_2/-no_tls1_1/-no_tls1/-no_ssl3/-no_ssl2 - turn off that protocol\n"); BIO_printf(bio_err," -bugs - Switch on all SSL implementation bug workarounds\n"); @@ -615,6 +616,7 @@ int MAIN(int argc, char **argv) char *sess_out = NULL; struct sockaddr peer; int peerlen = sizeof(peer); + int fallback_scsv = 0; int enable_timeouts = 0 ; long socket_mtu = 0; #ifndef OPENSSL_NO_JPAKE @@ -821,6 +823,10 @@ int MAIN(int argc, char **argv) meth=DTLSv1_client_method(); socket_type=SOCK_DGRAM; } + else if (strcmp(*argv,"-fallback_scsv") == 0) + { + fallback_scsv = 1; + } else if (strcmp(*argv,"-timeout") == 0) enable_timeouts=1; else if (strcmp(*argv,"-mtu") == 0) @@ -1233,6 +1239,10 @@ bad: SSL_set_session(con, sess); SSL_SESSION_free(sess); } + + if (fallback_scsv) + SSL_set_mode(con, SSL_MODE_SEND_FALLBACK_SCSV); + #ifndef OPENSSL_NO_TLSEXT if (servername != NULL) { Modified: releng/10.0/crypto/openssl/ssl/d1_lib.c ============================================================================== --- releng/10.0/crypto/openssl/ssl/d1_lib.c Tue Oct 21 20:20:36 2014 (r273414) +++ releng/10.0/crypto/openssl/ssl/d1_lib.c Tue Oct 21 20:21:10 2014 (r273415) @@ -262,6 +262,16 @@ long dtls1_ctrl(SSL *s, int cmd, long la case DTLS_CTRL_LISTEN: ret = dtls1_listen(s, parg); break; + case SSL_CTRL_CHECK_PROTO_VERSION: + /* For library-internal use; checks that the current protocol + * is the highest enabled version (according to s->ctx->method, + * as version negotiation may have changed s->method). */ +#if DTLS_MAX_VERSION != DTLS1_VERSION +# error Code needs update for DTLS_method() support beyond DTLS1_VERSION. +#endif + /* Just one protocol version is supported so far; + * fail closed if the version is not as expected. */ + return s->version == DTLS_MAX_VERSION; default: ret = ssl3_ctrl(s, cmd, larg, parg); Modified: releng/10.0/crypto/openssl/ssl/d1_srtp.c ============================================================================== --- releng/10.0/crypto/openssl/ssl/d1_srtp.c Tue Oct 21 20:20:36 2014 (r273414) +++ releng/10.0/crypto/openssl/ssl/d1_srtp.c Tue Oct 21 20:21:10 2014 (r273415) @@ -168,25 +168,6 @@ static int find_profile_by_name(char *pr return 1; } -static int find_profile_by_num(unsigned profile_num, - SRTP_PROTECTION_PROFILE **pptr) - { - SRTP_PROTECTION_PROFILE *p; - - p=srtp_known_profiles; - while(p->name) - { - if(p->id == profile_num) - { - *pptr=p; - return 0; - } - p++; - } - - return 1; - } - static int ssl_ctx_make_profiles(const char *profiles_string,STACK_OF(SRTP_PROTECTION_PROFILE) **out) { STACK_OF(SRTP_PROTECTION_PROFILE) *profiles; @@ -209,11 +190,19 @@ static int ssl_ctx_make_profiles(const c if(!find_profile_by_name(ptr,&p, col ? col-ptr : (int)strlen(ptr))) { + if (sk_SRTP_PROTECTION_PROFILE_find(profiles,p) >= 0) + { + SSLerr(SSL_F_SSL_CTX_MAKE_PROFILES,SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST); + sk_SRTP_PROTECTION_PROFILE_free(profiles); + return 1; + } + sk_SRTP_PROTECTION_PROFILE_push(profiles,p); } else { SSLerr(SSL_F_SSL_CTX_MAKE_PROFILES,SSL_R_SRTP_UNKNOWN_PROTECTION_PROFILE); + sk_SRTP_PROTECTION_PROFILE_free(profiles); return 1; } @@ -305,13 +294,12 @@ int ssl_add_clienthello_use_srtp_ext(SSL int ssl_parse_clienthello_use_srtp_ext(SSL *s, unsigned char *d, int len,int *al) { - SRTP_PROTECTION_PROFILE *cprof,*sprof; - STACK_OF(SRTP_PROTECTION_PROFILE) *clnt=0,*srvr; + SRTP_PROTECTION_PROFILE *sprof; + STACK_OF(SRTP_PROTECTION_PROFILE) *srvr; int ct; int mki_len; - int i,j; - int id; - int ret; + int i, srtp_pref; + unsigned int id; /* Length value + the MKI length */ if(len < 3) @@ -341,22 +329,32 @@ int ssl_parse_clienthello_use_srtp_ext(S return 1; } + srvr=SSL_get_srtp_profiles(s); + s->srtp_profile = NULL; + /* Search all profiles for a match initially */ + srtp_pref = sk_SRTP_PROTECTION_PROFILE_num(srvr); - clnt=sk_SRTP_PROTECTION_PROFILE_new_null(); - while(ct) { n2s(d,id); ct-=2; len-=2; - if(!find_profile_by_num(id,&cprof)) - { - sk_SRTP_PROTECTION_PROFILE_push(clnt,cprof); - } - else + /* + * Only look for match in profiles of higher preference than + * current match. + * If no profiles have been have been configured then this + * does nothing. + */ + for (i = 0; i < srtp_pref; i++) { - ; /* Ignore */ + sprof = sk_SRTP_PROTECTION_PROFILE_value(srvr, i); + if (sprof->id == id) + { + s->srtp_profile = sprof; + srtp_pref = i; + break; + } } } @@ -371,36 +369,7 @@ int ssl_parse_clienthello_use_srtp_ext(S return 1; } - srvr=SSL_get_srtp_profiles(s); - - /* Pick our most preferred profile. If no profiles have been - configured then the outer loop doesn't run - (sk_SRTP_PROTECTION_PROFILE_num() = -1) - and so we just return without doing anything */ - for(i=0;iid==sprof->id) - { - s->srtp_profile=sprof; - *al=0; - ret=0; - goto done; - } - } - } - - ret=0; - -done: - if(clnt) sk_SRTP_PROTECTION_PROFILE_free(clnt); - - return ret; + return 0; } int ssl_add_serverhello_use_srtp_ext(SSL *s, unsigned char *p, int *len, int maxlen) Modified: releng/10.0/crypto/openssl/ssl/dtls1.h ============================================================================== --- releng/10.0/crypto/openssl/ssl/dtls1.h Tue Oct 21 20:20:36 2014 (r273414) +++ releng/10.0/crypto/openssl/ssl/dtls1.h Tue Oct 21 20:21:10 2014 (r273415) @@ -84,6 +84,8 @@ extern "C" { #endif #define DTLS1_VERSION 0xFEFF +#define DTLS_MAX_VERSION DTLS1_VERSION + #define DTLS1_BAD_VER 0x0100 #if 0 @@ -284,4 +286,3 @@ typedef struct dtls1_record_data_st } #endif #endif - Modified: releng/10.0/crypto/openssl/ssl/s23_clnt.c ============================================================================== --- releng/10.0/crypto/openssl/ssl/s23_clnt.c Tue Oct 21 20:20:36 2014 (r273414) +++ releng/10.0/crypto/openssl/ssl/s23_clnt.c Tue Oct 21 20:21:10 2014 (r273415) @@ -125,9 +125,11 @@ static const SSL_METHOD *ssl23_get_clien if (ver == SSL2_VERSION) return(SSLv2_client_method()); #endif +#ifndef OPENSSL_NO_SSL3 if (ver == SSL3_VERSION) return(SSLv3_client_method()); - else if (ver == TLS1_VERSION) +#endif + if (ver == TLS1_VERSION) return(TLSv1_client_method()); else if (ver == TLS1_1_VERSION) return(TLSv1_1_client_method()); @@ -677,6 +679,7 @@ static int ssl23_get_server_hello(SSL *s { /* we have sslv3 or tls1 (server hello or alert) */ +#ifndef OPENSSL_NO_SSL3 if ((p[2] == SSL3_VERSION_MINOR) && !(s->options & SSL_OP_NO_SSLv3)) { @@ -691,7 +694,9 @@ static int ssl23_get_server_hello(SSL *s s->version=SSL3_VERSION; s->method=SSLv3_client_method(); } - else if ((p[2] == TLS1_VERSION_MINOR) && + else +#endif + if ((p[2] == TLS1_VERSION_MINOR) && !(s->options & SSL_OP_NO_TLSv1)) { s->version=TLS1_VERSION; @@ -715,6 +720,9 @@ static int ssl23_get_server_hello(SSL *s goto err; } + /* ensure that TLS_MAX_VERSION is up-to-date */ + OPENSSL_assert(s->version <= TLS_MAX_VERSION); + if (p[0] == SSL3_RT_ALERT && p[5] != SSL3_AL_WARNING) { /* fatal alert */ Modified: releng/10.0/crypto/openssl/ssl/s23_srvr.c ============================================================================== --- releng/10.0/crypto/openssl/ssl/s23_srvr.c Tue Oct 21 20:20:36 2014 (r273414) +++ releng/10.0/crypto/openssl/ssl/s23_srvr.c Tue Oct 21 20:21:10 2014 (r273415) @@ -127,9 +127,11 @@ static const SSL_METHOD *ssl23_get_serve if (ver == SSL2_VERSION) return(SSLv2_server_method()); #endif +#ifndef OPENSSL_NO_SSL3 if (ver == SSL3_VERSION) return(SSLv3_server_method()); - else if (ver == TLS1_VERSION) +#endif + if (ver == TLS1_VERSION) return(TLSv1_server_method()); else if (ver == TLS1_1_VERSION) return(TLSv1_1_server_method()); @@ -421,6 +423,9 @@ int ssl23_get_client_hello(SSL *s) } } + /* ensure that TLS_MAX_VERSION is up-to-date */ + OPENSSL_assert(s->version <= TLS_MAX_VERSION); + #ifdef OPENSSL_FIPS if (FIPS_mode() && (s->version < TLS1_VERSION)) { @@ -597,6 +602,12 @@ int ssl23_get_client_hello(SSL *s) if ((type == 2) || (type == 3)) { /* we have SSLv3/TLSv1 (type 2: SSL2 style, type 3: SSL3/TLS style) */ + s->method = ssl23_get_server_method(s->version); + if (s->method == NULL) + { + SSLerr(SSL_F_SSL23_GET_CLIENT_HELLO,SSL_R_UNSUPPORTED_PROTOCOL); + goto err; + } if (!ssl_init_wbio_buffer(s,1)) goto err; @@ -624,14 +635,6 @@ int ssl23_get_client_hello(SSL *s) s->s3->rbuf.left=0; s->s3->rbuf.offset=0; } - if (s->version == TLS1_2_VERSION) - s->method = TLSv1_2_server_method(); - else if (s->version == TLS1_1_VERSION) - s->method = TLSv1_1_server_method(); - else if (s->version == TLS1_VERSION) - s->method = TLSv1_server_method(); - else - s->method = SSLv3_server_method(); #if 0 /* ssl3_get_client_hello does this */ s->client_version=(v[0]<<8)|v[1]; #endif Modified: releng/10.0/crypto/openssl/ssl/s2_lib.c ============================================================================== --- releng/10.0/crypto/openssl/ssl/s2_lib.c Tue Oct 21 20:20:36 2014 (r273414) +++ releng/10.0/crypto/openssl/ssl/s2_lib.c Tue Oct 21 20:21:10 2014 (r273415) @@ -391,6 +391,8 @@ long ssl2_ctrl(SSL *s, int cmd, long lar case SSL_CTRL_GET_SESSION_REUSED: ret=s->hit; break; + case SSL_CTRL_CHECK_PROTO_VERSION: + return ssl3_ctrl(s, SSL_CTRL_CHECK_PROTO_VERSION, larg, parg); default: break; } @@ -437,7 +439,7 @@ int ssl2_put_cipher_by_char(const SSL_CI if (p != NULL) { l=c->id; - if ((l & 0xff000000) != 0x02000000) return(0); + if ((l & 0xff000000) != 0x02000000 && l != SSL3_CK_FALLBACK_SCSV) return(0); p[0]=((unsigned char)(l>>16L))&0xFF; p[1]=((unsigned char)(l>> 8L))&0xFF; p[2]=((unsigned char)(l ))&0xFF; Modified: releng/10.0/crypto/openssl/ssl/s3_enc.c ============================================================================== --- releng/10.0/crypto/openssl/ssl/s3_enc.c Tue Oct 21 20:20:36 2014 (r273414) +++ releng/10.0/crypto/openssl/ssl/s3_enc.c Tue Oct 21 20:21:10 2014 (r273415) @@ -892,7 +892,7 @@ int ssl3_alert_code(int code) case SSL_AD_BAD_CERTIFICATE_STATUS_RESPONSE: return(SSL3_AD_HANDSHAKE_FAILURE); case SSL_AD_BAD_CERTIFICATE_HASH_VALUE: return(SSL3_AD_HANDSHAKE_FAILURE); case SSL_AD_UNKNOWN_PSK_IDENTITY:return(TLS1_AD_UNKNOWN_PSK_IDENTITY); + case SSL_AD_INAPPROPRIATE_FALLBACK:return(TLS1_AD_INAPPROPRIATE_FALLBACK); default: return(-1); } } - Modified: releng/10.0/crypto/openssl/ssl/s3_lib.c ============================================================================== --- releng/10.0/crypto/openssl/ssl/s3_lib.c Tue Oct 21 20:20:36 2014 (r273414) +++ releng/10.0/crypto/openssl/ssl/s3_lib.c Tue Oct 21 20:21:10 2014 (r273415) @@ -3350,6 +3350,33 @@ long ssl3_ctrl(SSL *s, int cmd, long lar #endif #endif /* !OPENSSL_NO_TLSEXT */ + + case SSL_CTRL_CHECK_PROTO_VERSION: + /* For library-internal use; checks that the current protocol + * is the highest enabled version (according to s->ctx->method, + * as version negotiation may have changed s->method). */ + if (s->version == s->ctx->method->version) + return 1; + /* Apparently we're using a version-flexible SSL_METHOD + * (not at its highest protocol version). */ + if (s->ctx->method->version == SSLv23_method()->version) + { +#if TLS_MAX_VERSION != TLS1_2_VERSION +# error Code needs update for SSLv23_method() support beyond TLS1_2_VERSION. +#endif + if (!(s->options & SSL_OP_NO_TLSv1_2)) + return s->version == TLS1_2_VERSION; + if (!(s->options & SSL_OP_NO_TLSv1_1)) + return s->version == TLS1_1_VERSION; + if (!(s->options & SSL_OP_NO_TLSv1)) + return s->version == TLS1_VERSION; + if (!(s->options & SSL_OP_NO_SSLv3)) + return s->version == SSL3_VERSION; + if (!(s->options & SSL_OP_NO_SSLv2)) + return s->version == SSL2_VERSION; + } + return 0; /* Unexpected state; fail closed. */ + default: break; } @@ -3709,6 +3736,7 @@ long ssl3_ctx_callback_ctrl(SSL_CTX *ctx break; #endif #endif + default: return(0); } @@ -4279,4 +4307,3 @@ long ssl_get_algorithm2(SSL *s) return SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256; return alg2; } - Modified: releng/10.0/crypto/openssl/ssl/ssl.h ============================================================================== --- releng/10.0/crypto/openssl/ssl/ssl.h Tue Oct 21 20:20:36 2014 (r273414) +++ releng/10.0/crypto/openssl/ssl/ssl.h Tue Oct 21 20:21:10 2014 (r273415) @@ -642,6 +642,10 @@ struct ssl_session_st * TLS only.) "Released" buffers are put onto a free-list in the context * or just freed (depending on the context's setting for freelist_max_len). */ #define SSL_MODE_RELEASE_BUFFERS 0x00000010L +/* Send TLS_FALLBACK_SCSV in the ClientHello. + * To be set by applications that reconnect with a downgraded protocol + * version; see draft-ietf-tls-downgrade-scsv-00 for details. */ +#define SSL_MODE_SEND_FALLBACK_SCSV 0x00000080L /* Note: SSL[_CTX]_set_{options,mode} use |= op on the previous value, * they cannot be used to clear bits. */ @@ -1500,6 +1504,7 @@ DECLARE_PEM_rw(SSL_SESSION, SSL_SESSION) #define SSL_AD_BAD_CERTIFICATE_STATUS_RESPONSE TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE #define SSL_AD_BAD_CERTIFICATE_HASH_VALUE TLS1_AD_BAD_CERTIFICATE_HASH_VALUE #define SSL_AD_UNKNOWN_PSK_IDENTITY TLS1_AD_UNKNOWN_PSK_IDENTITY /* fatal */ +#define SSL_AD_INAPPROPRIATE_FALLBACK TLS1_AD_INAPPROPRIATE_FALLBACK /* fatal */ #define SSL_ERROR_NONE 0 #define SSL_ERROR_SSL 1 @@ -1610,6 +1615,8 @@ DECLARE_PEM_rw(SSL_SESSION, SSL_SESSION) #define SSL_CTRL_GET_EXTRA_CHAIN_CERTS 82 #define SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS 83 +#define SSL_CTRL_CHECK_PROTO_VERSION 119 + #define DTLSv1_get_timeout(ssl, arg) \ SSL_ctrl(ssl,DTLS_CTRL_GET_TIMEOUT,0, (void *)arg) #define DTLSv1_handle_timeout(ssl) \ @@ -2364,6 +2371,7 @@ void ERR_load_SSL_strings(void); #define SSL_R_HTTPS_PROXY_REQUEST 155 #define SSL_R_HTTP_REQUEST 156 #define SSL_R_ILLEGAL_PADDING 283 +#define SSL_R_INAPPROPRIATE_FALLBACK 373 #define SSL_R_INCONSISTENT_COMPRESSION 340 #define SSL_R_INVALID_CHALLENGE_LENGTH 158 #define SSL_R_INVALID_COMMAND 280 @@ -2510,6 +2518,7 @@ void ERR_load_SSL_strings(void); #define SSL_R_TLSV1_ALERT_DECRYPTION_FAILED 1021 #define SSL_R_TLSV1_ALERT_DECRYPT_ERROR 1051 #define SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION 1060 +#define SSL_R_TLSV1_ALERT_INAPPROPRIATE_FALLBACK 1086 #define SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY 1071 #define SSL_R_TLSV1_ALERT_INTERNAL_ERROR 1080 #define SSL_R_TLSV1_ALERT_NO_RENEGOTIATION 1100 Modified: releng/10.0/crypto/openssl/ssl/ssl3.h ============================================================================== --- releng/10.0/crypto/openssl/ssl/ssl3.h Tue Oct 21 20:20:36 2014 (r273414) +++ releng/10.0/crypto/openssl/ssl/ssl3.h Tue Oct 21 20:21:10 2014 (r273415) @@ -128,9 +128,14 @@ extern "C" { #endif -/* Signalling cipher suite value: from draft-ietf-tls-renegotiation-03.txt */ +/* Signalling cipher suite value from RFC 5746 + * (TLS_EMPTY_RENEGOTIATION_INFO_SCSV) */ #define SSL3_CK_SCSV 0x030000FF +/* Signalling cipher suite value from draft-ietf-tls-downgrade-scsv-00 + * (TLS_FALLBACK_SCSV) */ +#define SSL3_CK_FALLBACK_SCSV 0x03005600 + #define SSL3_CK_RSA_NULL_MD5 0x03000001 #define SSL3_CK_RSA_NULL_SHA 0x03000002 #define SSL3_CK_RSA_RC4_40_MD5 0x03000003 Modified: releng/10.0/crypto/openssl/ssl/ssl_err.c ============================================================================== --- releng/10.0/crypto/openssl/ssl/ssl_err.c Tue Oct 21 20:20:36 2014 (r273414) +++ releng/10.0/crypto/openssl/ssl/ssl_err.c Tue Oct 21 20:21:10 2014 (r273415) @@ -383,6 +383,7 @@ static ERR_STRING_DATA SSL_str_reasons[] {ERR_REASON(SSL_R_HTTPS_PROXY_REQUEST) ,"https proxy request"}, {ERR_REASON(SSL_R_HTTP_REQUEST) ,"http request"}, {ERR_REASON(SSL_R_ILLEGAL_PADDING) ,"illegal padding"}, +{ERR_REASON(SSL_R_INAPPROPRIATE_FALLBACK),"inappropriate fallback"}, {ERR_REASON(SSL_R_INCONSISTENT_COMPRESSION),"inconsistent compression"}, {ERR_REASON(SSL_R_INVALID_CHALLENGE_LENGTH),"invalid challenge length"}, {ERR_REASON(SSL_R_INVALID_COMMAND) ,"invalid command"}, @@ -529,6 +530,7 @@ static ERR_STRING_DATA SSL_str_reasons[] {ERR_REASON(SSL_R_TLSV1_ALERT_DECRYPTION_FAILED),"tlsv1 alert decryption failed"}, {ERR_REASON(SSL_R_TLSV1_ALERT_DECRYPT_ERROR),"tlsv1 alert decrypt error"}, {ERR_REASON(SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION),"tlsv1 alert export restriction"}, +{ERR_REASON(SSL_R_TLSV1_ALERT_INAPPROPRIATE_FALLBACK),"tlsv1 alert inappropriate fallback"}, {ERR_REASON(SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY),"tlsv1 alert insufficient security"}, {ERR_REASON(SSL_R_TLSV1_ALERT_INTERNAL_ERROR),"tlsv1 alert internal error"}, {ERR_REASON(SSL_R_TLSV1_ALERT_NO_RENEGOTIATION),"tlsv1 alert no renegotiation"}, Modified: releng/10.0/crypto/openssl/ssl/ssl_lib.c ============================================================================== --- releng/10.0/crypto/openssl/ssl/ssl_lib.c Tue Oct 21 20:20:36 2014 (r273414) +++ releng/10.0/crypto/openssl/ssl/ssl_lib.c Tue Oct 21 20:21:10 2014 (r273415) @@ -1383,6 +1383,8 @@ int ssl_cipher_list_to_bytes(SSL *s,STAC if (sk == NULL) return(0); q=p; + if (put_cb == NULL) + put_cb = s->method->put_cipher_by_char; for (i=0; isrp_ctx.srp_Mask & SSL_kSRP)) continue; #endif /* OPENSSL_NO_SRP */ - j = put_cb ? put_cb(c,p) : ssl_put_cipher_by_char(s,c,p); + j = put_cb(c,p); p+=j; } - /* If p == q, no ciphers and caller indicates an error. Otherwise - * add SCSV if not renegotiating. - */ - if (p != q && !s->renegotiate) + /* If p == q, no ciphers; caller indicates an error. + * Otherwise, add applicable SCSVs. */ + if (p != q) { - static SSL_CIPHER scsv = + if (!s->renegotiate) { - 0, NULL, SSL3_CK_SCSV, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }; - j = put_cb ? put_cb(&scsv,p) : ssl_put_cipher_by_char(s,&scsv,p); - p+=j; + static SSL_CIPHER scsv = + { + 0, NULL, SSL3_CK_SCSV, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }; + j = put_cb(&scsv,p); + p+=j; #ifdef OPENSSL_RI_DEBUG - fprintf(stderr, "SCSV sent by client\n"); + fprintf(stderr, "TLS_EMPTY_RENEGOTIATION_INFO_SCSV sent by client\n"); #endif - } + } + + if (s->mode & SSL_MODE_SEND_FALLBACK_SCSV) + { + static SSL_CIPHER scsv = + { + 0, NULL, SSL3_CK_FALLBACK_SCSV, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }; + j = put_cb(&scsv,p); + p+=j; + } + } return(p-q); } @@ -1435,11 +1449,12 @@ STACK_OF(SSL_CIPHER) *ssl_bytes_to_ciphe const SSL_CIPHER *c; STACK_OF(SSL_CIPHER) *sk; int i,n; + if (s->s3) s->s3->send_connection_binding = 0; n=ssl_put_cipher_by_char(s,NULL,NULL); - if ((num%n) != 0) + if (n == 0 || (num%n) != 0) { SSLerr(SSL_F_SSL_BYTES_TO_CIPHER_LIST,SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST); return(NULL); @@ -1454,7 +1469,7 @@ STACK_OF(SSL_CIPHER) *ssl_bytes_to_ciphe for (i=0; is3 && (n != 3 || !p[0]) && (p[n-2] == ((SSL3_CK_SCSV >> 8) & 0xff)) && (p[n-1] == (SSL3_CK_SCSV & 0xff))) @@ -1474,6 +1489,23 @@ STACK_OF(SSL_CIPHER) *ssl_bytes_to_ciphe continue; } + /* Check for TLS_FALLBACK_SCSV */ + if ((n != 3 || !p[0]) && + (p[n-2] == ((SSL3_CK_FALLBACK_SCSV >> 8) & 0xff)) && + (p[n-1] == (SSL3_CK_FALLBACK_SCSV & 0xff))) + { + /* The SCSV indicates that the client previously tried a higher version. + * Fail if the current version is an unexpected downgrade. */ + if (!SSL_ctrl(s, SSL_CTRL_CHECK_PROTO_VERSION, 0, NULL)) + { + SSLerr(SSL_F_SSL_BYTES_TO_CIPHER_LIST,SSL_R_INAPPROPRIATE_FALLBACK); + if (s->s3) + ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_INAPPROPRIATE_FALLBACK); + goto err; + } + continue; + } + c=ssl_get_cipher_by_char(s,p); p+=n; if (c != NULL) Modified: releng/10.0/crypto/openssl/ssl/t1_enc.c ============================================================================== --- releng/10.0/crypto/openssl/ssl/t1_enc.c Tue Oct 21 20:20:36 2014 (r273414) +++ releng/10.0/crypto/openssl/ssl/t1_enc.c Tue Oct 21 20:21:10 2014 (r273415) @@ -1243,6 +1243,7 @@ int tls1_alert_code(int code) case SSL_AD_BAD_CERTIFICATE_STATUS_RESPONSE: return(TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE); case SSL_AD_BAD_CERTIFICATE_HASH_VALUE: return(TLS1_AD_BAD_CERTIFICATE_HASH_VALUE); case SSL_AD_UNKNOWN_PSK_IDENTITY:return(TLS1_AD_UNKNOWN_PSK_IDENTITY); + case SSL_AD_INAPPROPRIATE_FALLBACK:return(TLS1_AD_INAPPROPRIATE_FALLBACK); #if 0 /* not appropriate for TLS, not used for DTLS */ case DTLS1_AD_MISSING_HANDSHAKE_MESSAGE: return (DTLS1_AD_MISSING_HANDSHAKE_MESSAGE); Modified: releng/10.0/crypto/openssl/ssl/t1_lib.c ============================================================================== --- releng/10.0/crypto/openssl/ssl/t1_lib.c Tue Oct 21 20:20:36 2014 (r273414) +++ releng/10.0/crypto/openssl/ssl/t1_lib.c Tue Oct 21 20:21:10 2014 (r273415) @@ -650,7 +650,7 @@ unsigned char *ssl_add_clienthello_tlsex #endif #ifndef OPENSSL_NO_SRTP - if(SSL_get_srtp_profiles(s)) + if(SSL_IS_DTLS(s) && SSL_get_srtp_profiles(s)) { int el; @@ -784,7 +784,7 @@ unsigned char *ssl_add_serverhello_tlsex #endif #ifndef OPENSSL_NO_SRTP - if(s->srtp_profile) + if(SSL_IS_DTLS(s) && s->srtp_profile) { int el; @@ -1334,7 +1334,8 @@ int ssl_parse_clienthello_tlsext(SSL *s, /* session ticket processed earlier */ #ifndef OPENSSL_NO_SRTP - else if (type == TLSEXT_TYPE_use_srtp) + else if (SSL_IS_DTLS(s) && SSL_get_srtp_profiles(s) + && type == TLSEXT_TYPE_use_srtp) { if(ssl_parse_clienthello_use_srtp_ext(s, data, size, al)) @@ -1589,7 +1590,7 @@ int ssl_parse_serverhello_tlsext(SSL *s, } #endif #ifndef OPENSSL_NO_SRTP - else if (type == TLSEXT_TYPE_use_srtp) + else if (SSL_IS_DTLS(s) && type == TLSEXT_TYPE_use_srtp) { if(ssl_parse_serverhello_use_srtp_ext(s, data, size, al)) @@ -2238,7 +2239,10 @@ static int tls_decrypt_ticket(SSL *s, co HMAC_Final(&hctx, tick_hmac, NULL); HMAC_CTX_cleanup(&hctx); if (CRYPTO_memcmp(tick_hmac, etick + eticklen, mlen)) + { + EVP_CIPHER_CTX_cleanup(&ctx); return 2; + } /* Attempt to decrypt session data */ /* Move p after IV to start of encrypted ticket, update length */ p = etick + 16 + EVP_CIPHER_CTX_iv_length(&ctx); Modified: releng/10.0/crypto/openssl/ssl/tls1.h ============================================================================== --- releng/10.0/crypto/openssl/ssl/tls1.h Tue Oct 21 20:20:36 2014 (r273414) +++ releng/10.0/crypto/openssl/ssl/tls1.h Tue Oct 21 20:21:10 2014 (r273415) @@ -159,17 +159,19 @@ extern "C" { #define TLS1_ALLOW_EXPERIMENTAL_CIPHERSUITES 0 +#define TLS1_VERSION 0x0301 +#define TLS1_1_VERSION 0x0302 #define TLS1_2_VERSION 0x0303 -#define TLS1_2_VERSION_MAJOR 0x03 -#define TLS1_2_VERSION_MINOR 0x03 +#define TLS_MAX_VERSION TLS1_2_VERSION + +#define TLS1_VERSION_MAJOR 0x03 +#define TLS1_VERSION_MINOR 0x01 -#define TLS1_1_VERSION 0x0302 #define TLS1_1_VERSION_MAJOR 0x03 #define TLS1_1_VERSION_MINOR 0x02 -#define TLS1_VERSION 0x0301 -#define TLS1_VERSION_MAJOR 0x03 -#define TLS1_VERSION_MINOR 0x01 +#define TLS1_2_VERSION_MAJOR 0x03 +#define TLS1_2_VERSION_MINOR 0x03 #define TLS1_get_version(s) \ ((s->version >> 8) == TLS1_VERSION_MAJOR ? s->version : 0) @@ -187,6 +189,7 @@ extern "C" { #define TLS1_AD_PROTOCOL_VERSION 70 /* fatal */ #define TLS1_AD_INSUFFICIENT_SECURITY 71 /* fatal */ #define TLS1_AD_INTERNAL_ERROR 80 /* fatal */ +#define TLS1_AD_INAPPROPRIATE_FALLBACK 86 /* fatal */ #define TLS1_AD_USER_CANCELLED 90 #define TLS1_AD_NO_RENEGOTIATION 100 /* codes 110-114 are from RFC3546 */ Modified: releng/10.0/sbin/routed/input.c ============================================================================== --- releng/10.0/sbin/routed/input.c Tue Oct 21 20:20:36 2014 (r273414) +++ releng/10.0/sbin/routed/input.c Tue Oct 21 20:21:10 2014 (r273415) @@ -288,6 +288,10 @@ input(struct sockaddr_in *from, /* rece /* Answer a query from a utility program * with all we know. */ + if (aifp == NULL) { + trace_pkt("ignore remote query"); + return; + } if (from->sin_port != htons(RIP_PORT)) { supply(from, aifp, OUT_QUERY, 0, rip->rip_vers, ap != 0); Modified: releng/10.0/sys/conf/newvers.sh ============================================================================== --- releng/10.0/sys/conf/newvers.sh Tue Oct 21 20:20:36 2014 (r273414) +++ releng/10.0/sys/conf/newvers.sh Tue Oct 21 20:21:10 2014 (r273415) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="10.0" -BRANCH="RELEASE-p9" +BRANCH="RELEASE-p10" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi Modified: releng/10.0/sys/kern/vfs_lookup.c ============================================================================== --- releng/10.0/sys/kern/vfs_lookup.c Tue Oct 21 20:20:36 2014 (r273414) +++ releng/10.0/sys/kern/vfs_lookup.c Tue Oct 21 20:21:10 2014 (r273415) @@ -121,6 +121,16 @@ TUNABLE_INT("vfs.lookup_shared", &lookup * if symbolic link, massage name in buffer and continue * } */ +static void +namei_cleanup_cnp(struct componentname *cnp) +{ + uma_zfree(namei_zone, cnp->cn_pnbuf); +#ifdef DIAGNOSTIC + cnp->cn_pnbuf = NULL; + cnp->cn_nameptr = NULL; +#endif +} + int namei(struct nameidata *ndp) { @@ -185,11 +195,7 @@ namei(struct nameidata *ndp) } #endif if (error) { - uma_zfree(namei_zone, cnp->cn_pnbuf); -#ifdef DIAGNOSTIC - cnp->cn_pnbuf = NULL; - cnp->cn_nameptr = NULL; -#endif + namei_cleanup_cnp(cnp); ndp->ni_vp = NULL; return (error); } @@ -256,11 +262,7 @@ namei(struct nameidata *ndp) } } if (error) { - uma_zfree(namei_zone, cnp->cn_pnbuf); -#ifdef DIAGNOSTIC - cnp->cn_pnbuf = NULL; - cnp->cn_nameptr = NULL; -#endif + namei_cleanup_cnp(cnp); return (error); } } @@ -286,6 +288,7 @@ namei(struct nameidata *ndp) if (KTRPOINT(curthread, KTR_CAPFAIL)) ktrcapfail(CAPFAIL_LOOKUP, NULL, NULL); #endif + namei_cleanup_cnp(cnp); return (ENOTCAPABLE); } while (*(cnp->cn_nameptr) == '/') { @@ -298,11 +301,7 @@ namei(struct nameidata *ndp) ndp->ni_startdir = dp; error = lookup(ndp); if (error) { - uma_zfree(namei_zone, cnp->cn_pnbuf); -#ifdef DIAGNOSTIC - cnp->cn_pnbuf = NULL; - cnp->cn_nameptr = NULL; -#endif + namei_cleanup_cnp(cnp); SDT_PROBE(vfs, namei, lookup, return, error, NULL, 0, 0, 0); return (error); @@ -312,11 +311,7 @@ namei(struct nameidata *ndp) */ if ((cnp->cn_flags & ISSYMLINK) == 0) { if ((cnp->cn_flags & (SAVENAME | SAVESTART)) == 0) { - uma_zfree(namei_zone, cnp->cn_pnbuf); -#ifdef DIAGNOSTIC - cnp->cn_pnbuf = NULL; - cnp->cn_nameptr = NULL; -#endif + namei_cleanup_cnp(cnp); } else cnp->cn_flags |= HASBUF; @@ -378,11 +373,7 @@ namei(struct nameidata *ndp) vput(ndp->ni_vp); dp = ndp->ni_dvp; } - uma_zfree(namei_zone, cnp->cn_pnbuf); -#ifdef DIAGNOSTIC - cnp->cn_pnbuf = NULL; - cnp->cn_nameptr = NULL; -#endif + namei_cleanup_cnp(cnp); vput(ndp->ni_vp); ndp->ni_vp = NULL; vrele(ndp->ni_dvp); Modified: releng/10.0/usr.sbin/rtsold/rtsol.c ============================================================================== --- releng/10.0/usr.sbin/rtsold/rtsol.c Tue Oct 21 20:20:36 2014 (r273414) +++ releng/10.0/usr.sbin/rtsold/rtsol.c Tue Oct 21 20:21:10 2014 (r273415) @@ -933,7 +933,8 @@ dname_labeldec(char *dst, size_t dlen, c dst_origin = dst; memset(dst, '\0', dlen); while (src && (len = (uint8_t)(*src++) & 0x3f) && - (src + len) <= src_last) { + (src + len) <= src_last && + (dst - dst_origin < (ssize_t)dlen)) { if (dst != dst_origin) *dst++ = '.'; warnmsg(LOG_DEBUG, __func__, "labellen = %zd", len); Modified: releng/9.1/UPDATING ============================================================================== --- releng/9.1/UPDATING Tue Oct 21 20:20:36 2014 (r273414) +++ releng/9.1/UPDATING Tue Oct 21 20:21:10 2014 (r273415) @@ -9,6 +9,19 @@ handbook. Items affecting the ports and packages system can be found in /usr/ports/UPDATING. Please read that file before running portupgrade. +20141021: p20 FreeBSD-SA-14:20.rtsold + FreeBSD-SA-14:21.routed + FreeBSD-SA-14:22.namei + FreeBSD-SA-14:23.openssl + + Fix rtsold(8) remote buffer overflow vulnerability. [SA-14:20] + + Fix routed(8) remote denial of service vulnerability. [SA-14:21] + + Fix memory leak in sandboxed namei lookup. [SA-14:22] + + Fix OpenSSL multiple vulnerabilities. [SA-14:23] + 20140916: p19 FreeBSD-SA-14:19.tcp Fix Denial of Service in TCP packet processing. [SA-14:19] Modified: releng/9.1/crypto/openssl/apps/s_cb.c ============================================================================== --- releng/9.1/crypto/openssl/apps/s_cb.c Tue Oct 21 20:20:36 2014 (r273414) +++ releng/9.1/crypto/openssl/apps/s_cb.c Tue Oct 21 20:21:10 2014 (r273415) @@ -518,6 +518,24 @@ void MS_CALLBACK msg_cb(int write_p, int case 100: str_details2 = " no_renegotiation"; break; + case 110: + str_details2 = " unsupported_extension"; + break; + case 111: + str_details2 = " certificate_unobtainable"; + break; + case 112: + str_details2 = " unrecognized_name"; + break; + case 113: + str_details2 = " bad_certificate_status_response"; + break; + case 114: + str_details2 = " bad_certificate_hash_value"; + break; + case 115: + str_details2 = " unknown_psk_identity"; + break; } } } Modified: releng/9.1/crypto/openssl/apps/s_client.c ============================================================================== --- releng/9.1/crypto/openssl/apps/s_client.c Tue Oct 21 20:20:36 2014 (r273414) +++ releng/9.1/crypto/openssl/apps/s_client.c Tue Oct 21 20:21:10 2014 (r273415) @@ -226,6 +226,7 @@ static void sc_usage(void) BIO_printf(bio_err," -ssl3 - just use SSLv3\n"); BIO_printf(bio_err," -tls1 - just use TLSv1\n"); BIO_printf(bio_err," -dtls1 - just use DTLSv1\n"); + BIO_printf(bio_err," -fallback_scsv - send TLS_FALLBACK_SCSV\n"); BIO_printf(bio_err," -mtu - set the link layer MTU\n"); BIO_printf(bio_err," -no_tls1/-no_ssl3/-no_ssl2 - turn off that protocol\n"); BIO_printf(bio_err," -bugs - Switch on all SSL implementation bug workarounds\n"); @@ -339,6 +340,7 @@ int MAIN(int argc, char **argv) char *sess_out = NULL; struct sockaddr peer; int peerlen = sizeof(peer); + int fallback_scsv = 0; int enable_timeouts = 0 ; long socket_mtu = 0; #ifndef OPENSSL_NO_JPAKE @@ -488,6 +490,10 @@ int MAIN(int argc, char **argv) socket_mtu = atol(*(++argv)); } #endif + else if (strcmp(*argv,"-fallback_scsv") == 0) + { + fallback_scsv = 1; + } else if (strcmp(*argv,"-bugs") == 0) bugs=1; else if (strcmp(*argv,"-keyform") == 0) @@ -778,6 +784,10 @@ bad: SSL_set_session(con, sess); SSL_SESSION_free(sess); } + + if (fallback_scsv) + SSL_set_mode(con, SSL_MODE_SEND_FALLBACK_SCSV); + #ifndef OPENSSL_NO_TLSEXT if (servername != NULL) { Modified: releng/9.1/crypto/openssl/crypto/err/openssl.ec ============================================================================== --- releng/9.1/crypto/openssl/crypto/err/openssl.ec Tue Oct 21 20:20:36 2014 (r273414) +++ releng/9.1/crypto/openssl/crypto/err/openssl.ec Tue Oct 21 20:21:10 2014 (r273415) @@ -69,8 +69,14 @@ R SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION R SSL_R_TLSV1_ALERT_PROTOCOL_VERSION 1070 R SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY 1071 R SSL_R_TLSV1_ALERT_INTERNAL_ERROR 1080 +R SSL_R_TLSV1_ALERT_INAPPROPRIATE_FALLBACK 1086 R SSL_R_TLSV1_ALERT_USER_CANCELLED 1090 R SSL_R_TLSV1_ALERT_NO_RENEGOTIATION 1100 +R SSL_R_TLSV1_UNSUPPORTED_EXTENSION 1110 +R SSL_R_TLSV1_CERTIFICATE_UNOBTAINABLE 1111 +R SSL_R_TLSV1_UNRECOGNIZED_NAME 1112 +R SSL_R_TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE 1113 +R SSL_R_TLSV1_BAD_CERTIFICATE_HASH_VALUE 1114 R RSAREF_R_CONTENT_ENCODING 0x0400 R RSAREF_R_DATA 0x0401 Modified: releng/9.1/crypto/openssl/doc/apps/s_client.pod ============================================================================== --- releng/9.1/crypto/openssl/doc/apps/s_client.pod Tue Oct 21 20:20:36 2014 (r273414) +++ releng/9.1/crypto/openssl/doc/apps/s_client.pod Tue Oct 21 20:21:10 2014 (r273415) @@ -34,6 +34,7 @@ B B [B<-no_ssl2>] [B<-no_ssl3>] [B<-no_tls1>] +[B<-fallback_scsv>] [B<-bugs>] [B<-cipher cipherlist>] [B<-starttls protocol>] @@ -167,10 +168,13 @@ these options disable the use of certain the initial handshake uses a method which should be compatible with all servers and permit them to use SSL v3, SSL v2 or TLS as appropriate. -Unfortunately there are a lot of ancient and broken servers in use which +Unfortunately there are still ancient and broken servers in use which cannot handle this technique and will fail to connect. Some servers only -work if TLS is turned off with the B<-no_tls> option others will only -support SSL v2 and may need the B<-ssl2> option. +work if TLS is turned off. + +=item B<-fallback_scsv> + +Send TLS_FALLBACK_SCSV in the ClientHello. =item B<-bugs> Modified: releng/9.1/crypto/openssl/doc/ssl/SSL_CTX_set_mode.pod ============================================================================== --- releng/9.1/crypto/openssl/doc/ssl/SSL_CTX_set_mode.pod Tue Oct 21 20:20:36 2014 (r273414) +++ releng/9.1/crypto/openssl/doc/ssl/SSL_CTX_set_mode.pod Tue Oct 21 20:21:10 2014 (r273415) @@ -61,6 +61,12 @@ deal with read/write operations returnin flag SSL_MODE_AUTO_RETRY will cause read/write operations to only return after the handshake and successful completion. +=item SSL_MODE_FALLBACK_SCSV + +Send TLS_FALLBACK_SCSV in the ClientHello. +To be set by applications that reconnect with a downgraded protocol +version; see draft-ietf-tls-downgrade-scsv-00 for details. + =back =head1 RETURN VALUES Modified: releng/9.1/crypto/openssl/ssl/d1_lib.c ============================================================================== --- releng/9.1/crypto/openssl/ssl/d1_lib.c Tue Oct 21 20:20:36 2014 (r273414) +++ releng/9.1/crypto/openssl/ssl/d1_lib.c Tue Oct 21 20:21:10 2014 (r273415) @@ -301,6 +301,16 @@ long dtls1_ctrl(SSL *s, int cmd, long la case DTLS_CTRL_LISTEN: ret = dtls1_listen(s, parg); break; + case SSL_CTRL_CHECK_PROTO_VERSION: + /* For library-internal use; checks that the current protocol + * is the highest enabled version (according to s->ctx->method, + * as version negotiation may have changed s->method). */ +#if DTLS_MAX_VERSION != DTLS1_VERSION +# error Code needs update for DTLS_method() support beyond DTLS1_VERSION. +#endif + /* Just one protocol version is supported so far; + * fail closed if the version is not as expected. */ + return s->version == DTLS_MAX_VERSION; default: ret = ssl3_ctrl(s, cmd, larg, parg); Modified: releng/9.1/crypto/openssl/ssl/dtls1.h ============================================================================== --- releng/9.1/crypto/openssl/ssl/dtls1.h Tue Oct 21 20:20:36 2014 (r273414) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 20:21:34 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A1AF7F66; Tue, 21 Oct 2014 20:21:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8B1B025D; Tue, 21 Oct 2014 20:21:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LKLYMJ072982; Tue, 21 Oct 2014 20:21:34 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LKLS4D072930; Tue, 21 Oct 2014 20:21:28 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410212021.s9LKLS4D072930@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 21 Oct 2014 20:21:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r273416 - in releng/8.4: . crypto/openssl/apps crypto/openssl/crypto/err crypto/openssl/doc/apps crypto/openssl/doc/ssl crypto/openssl/ssl sbin/routed sys/conf X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 20:21:34 -0000 Author: delphij Date: Tue Oct 21 20:21:27 2014 New Revision: 273416 URL: https://svnweb.freebsd.org/changeset/base/273416 Log: Fix routed(8) remote denial of service vulnerability. [SA-14:21] Fix OpenSSL multiple vulnerabilities. [SA-14:23] Approved by: so Modified: releng/8.4/UPDATING releng/8.4/crypto/openssl/apps/s_cb.c releng/8.4/crypto/openssl/apps/s_client.c releng/8.4/crypto/openssl/crypto/err/openssl.ec releng/8.4/crypto/openssl/doc/apps/s_client.pod releng/8.4/crypto/openssl/doc/ssl/SSL_CTX_set_mode.pod releng/8.4/crypto/openssl/ssl/d1_lib.c releng/8.4/crypto/openssl/ssl/dtls1.h releng/8.4/crypto/openssl/ssl/s23_clnt.c releng/8.4/crypto/openssl/ssl/s23_srvr.c releng/8.4/crypto/openssl/ssl/s2_lib.c releng/8.4/crypto/openssl/ssl/s3_enc.c releng/8.4/crypto/openssl/ssl/s3_lib.c releng/8.4/crypto/openssl/ssl/ssl.h releng/8.4/crypto/openssl/ssl/ssl3.h releng/8.4/crypto/openssl/ssl/ssl_err.c releng/8.4/crypto/openssl/ssl/ssl_lib.c releng/8.4/crypto/openssl/ssl/ssl_stat.c releng/8.4/crypto/openssl/ssl/t1_enc.c releng/8.4/crypto/openssl/ssl/t1_lib.c releng/8.4/crypto/openssl/ssl/tls1.h releng/8.4/sbin/routed/input.c releng/8.4/sys/conf/newvers.sh Modified: releng/8.4/UPDATING ============================================================================== --- releng/8.4/UPDATING Tue Oct 21 20:21:10 2014 (r273415) +++ releng/8.4/UPDATING Tue Oct 21 20:21:27 2014 (r273416) @@ -15,6 +15,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. debugging tools present in HEAD were left in place because sun4v support still needs work to become production ready. +20141021: p17 FreeBSD-SA-14:21.routed + FreeBSD-SA-14:23.openssl + + Fix routed(8) remote denial of service vulnerability. [SA-14:21] + + Fix OpenSSL multiple vulnerabilities. [SA-14:23] + 20140916: p16 FreeBSD-SA-14:19.tcp Fix Denial of Service in TCP packet processing. [SA-14:19] Modified: releng/8.4/crypto/openssl/apps/s_cb.c ============================================================================== --- releng/8.4/crypto/openssl/apps/s_cb.c Tue Oct 21 20:21:10 2014 (r273415) +++ releng/8.4/crypto/openssl/apps/s_cb.c Tue Oct 21 20:21:27 2014 (r273416) @@ -518,6 +518,24 @@ void MS_CALLBACK msg_cb(int write_p, int case 100: str_details2 = " no_renegotiation"; break; + case 110: + str_details2 = " unsupported_extension"; + break; + case 111: + str_details2 = " certificate_unobtainable"; + break; + case 112: + str_details2 = " unrecognized_name"; + break; + case 113: + str_details2 = " bad_certificate_status_response"; + break; + case 114: + str_details2 = " bad_certificate_hash_value"; + break; + case 115: + str_details2 = " unknown_psk_identity"; + break; } } } Modified: releng/8.4/crypto/openssl/apps/s_client.c ============================================================================== --- releng/8.4/crypto/openssl/apps/s_client.c Tue Oct 21 20:21:10 2014 (r273415) +++ releng/8.4/crypto/openssl/apps/s_client.c Tue Oct 21 20:21:27 2014 (r273416) @@ -226,6 +226,7 @@ static void sc_usage(void) BIO_printf(bio_err," -ssl3 - just use SSLv3\n"); BIO_printf(bio_err," -tls1 - just use TLSv1\n"); BIO_printf(bio_err," -dtls1 - just use DTLSv1\n"); + BIO_printf(bio_err," -fallback_scsv - send TLS_FALLBACK_SCSV\n"); BIO_printf(bio_err," -mtu - set the link layer MTU\n"); BIO_printf(bio_err," -no_tls1/-no_ssl3/-no_ssl2 - turn off that protocol\n"); BIO_printf(bio_err," -bugs - Switch on all SSL implementation bug workarounds\n"); @@ -339,6 +340,7 @@ int MAIN(int argc, char **argv) char *sess_out = NULL; struct sockaddr peer; int peerlen = sizeof(peer); + int fallback_scsv = 0; int enable_timeouts = 0 ; long socket_mtu = 0; #ifndef OPENSSL_NO_JPAKE @@ -488,6 +490,10 @@ int MAIN(int argc, char **argv) socket_mtu = atol(*(++argv)); } #endif + else if (strcmp(*argv,"-fallback_scsv") == 0) + { + fallback_scsv = 1; + } else if (strcmp(*argv,"-bugs") == 0) bugs=1; else if (strcmp(*argv,"-keyform") == 0) @@ -778,6 +784,10 @@ bad: SSL_set_session(con, sess); SSL_SESSION_free(sess); } + + if (fallback_scsv) + SSL_set_mode(con, SSL_MODE_SEND_FALLBACK_SCSV); + #ifndef OPENSSL_NO_TLSEXT if (servername != NULL) { Modified: releng/8.4/crypto/openssl/crypto/err/openssl.ec ============================================================================== --- releng/8.4/crypto/openssl/crypto/err/openssl.ec Tue Oct 21 20:21:10 2014 (r273415) +++ releng/8.4/crypto/openssl/crypto/err/openssl.ec Tue Oct 21 20:21:27 2014 (r273416) @@ -69,8 +69,14 @@ R SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION R SSL_R_TLSV1_ALERT_PROTOCOL_VERSION 1070 R SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY 1071 R SSL_R_TLSV1_ALERT_INTERNAL_ERROR 1080 +R SSL_R_TLSV1_ALERT_INAPPROPRIATE_FALLBACK 1086 R SSL_R_TLSV1_ALERT_USER_CANCELLED 1090 R SSL_R_TLSV1_ALERT_NO_RENEGOTIATION 1100 +R SSL_R_TLSV1_UNSUPPORTED_EXTENSION 1110 +R SSL_R_TLSV1_CERTIFICATE_UNOBTAINABLE 1111 +R SSL_R_TLSV1_UNRECOGNIZED_NAME 1112 +R SSL_R_TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE 1113 +R SSL_R_TLSV1_BAD_CERTIFICATE_HASH_VALUE 1114 R RSAREF_R_CONTENT_ENCODING 0x0400 R RSAREF_R_DATA 0x0401 Modified: releng/8.4/crypto/openssl/doc/apps/s_client.pod ============================================================================== --- releng/8.4/crypto/openssl/doc/apps/s_client.pod Tue Oct 21 20:21:10 2014 (r273415) +++ releng/8.4/crypto/openssl/doc/apps/s_client.pod Tue Oct 21 20:21:27 2014 (r273416) @@ -34,6 +34,7 @@ B B [B<-no_ssl2>] [B<-no_ssl3>] [B<-no_tls1>] +[B<-fallback_scsv>] [B<-bugs>] [B<-cipher cipherlist>] [B<-starttls protocol>] @@ -167,10 +168,13 @@ these options disable the use of certain the initial handshake uses a method which should be compatible with all servers and permit them to use SSL v3, SSL v2 or TLS as appropriate. -Unfortunately there are a lot of ancient and broken servers in use which +Unfortunately there are still ancient and broken servers in use which cannot handle this technique and will fail to connect. Some servers only -work if TLS is turned off with the B<-no_tls> option others will only -support SSL v2 and may need the B<-ssl2> option. +work if TLS is turned off. + +=item B<-fallback_scsv> + +Send TLS_FALLBACK_SCSV in the ClientHello. =item B<-bugs> Modified: releng/8.4/crypto/openssl/doc/ssl/SSL_CTX_set_mode.pod ============================================================================== --- releng/8.4/crypto/openssl/doc/ssl/SSL_CTX_set_mode.pod Tue Oct 21 20:21:10 2014 (r273415) +++ releng/8.4/crypto/openssl/doc/ssl/SSL_CTX_set_mode.pod Tue Oct 21 20:21:27 2014 (r273416) @@ -61,6 +61,12 @@ deal with read/write operations returnin flag SSL_MODE_AUTO_RETRY will cause read/write operations to only return after the handshake and successful completion. +=item SSL_MODE_FALLBACK_SCSV + +Send TLS_FALLBACK_SCSV in the ClientHello. +To be set by applications that reconnect with a downgraded protocol +version; see draft-ietf-tls-downgrade-scsv-00 for details. + =back =head1 RETURN VALUES Modified: releng/8.4/crypto/openssl/ssl/d1_lib.c ============================================================================== --- releng/8.4/crypto/openssl/ssl/d1_lib.c Tue Oct 21 20:21:10 2014 (r273415) +++ releng/8.4/crypto/openssl/ssl/d1_lib.c Tue Oct 21 20:21:27 2014 (r273416) @@ -301,6 +301,16 @@ long dtls1_ctrl(SSL *s, int cmd, long la case DTLS_CTRL_LISTEN: ret = dtls1_listen(s, parg); break; + case SSL_CTRL_CHECK_PROTO_VERSION: + /* For library-internal use; checks that the current protocol + * is the highest enabled version (according to s->ctx->method, + * as version negotiation may have changed s->method). */ +#if DTLS_MAX_VERSION != DTLS1_VERSION +# error Code needs update for DTLS_method() support beyond DTLS1_VERSION. +#endif + /* Just one protocol version is supported so far; + * fail closed if the version is not as expected. */ + return s->version == DTLS_MAX_VERSION; default: ret = ssl3_ctrl(s, cmd, larg, parg); Modified: releng/8.4/crypto/openssl/ssl/dtls1.h ============================================================================== --- releng/8.4/crypto/openssl/ssl/dtls1.h Tue Oct 21 20:21:10 2014 (r273415) +++ releng/8.4/crypto/openssl/ssl/dtls1.h Tue Oct 21 20:21:27 2014 (r273416) @@ -80,6 +80,8 @@ extern "C" { #endif #define DTLS1_VERSION 0xFEFF +#define DTLS_MAX_VERSION DTLS1_VERSION + #define DTLS1_BAD_VER 0x0100 #if 0 @@ -262,4 +264,3 @@ typedef struct dtls1_record_data_st } #endif #endif - Modified: releng/8.4/crypto/openssl/ssl/s23_clnt.c ============================================================================== --- releng/8.4/crypto/openssl/ssl/s23_clnt.c Tue Oct 21 20:21:10 2014 (r273415) +++ releng/8.4/crypto/openssl/ssl/s23_clnt.c Tue Oct 21 20:21:27 2014 (r273416) @@ -72,9 +72,11 @@ static SSL_METHOD *ssl23_get_client_meth if (ver == SSL2_VERSION) return(SSLv2_client_method()); #endif +#ifndef OPENSSL_NO_SSL3 if (ver == SSL3_VERSION) return(SSLv3_client_method()); - else if (ver == TLS1_VERSION) +#endif + if (ver == TLS1_VERSION) return(TLSv1_client_method()); else return(NULL); @@ -509,7 +511,7 @@ static int ssl23_get_server_hello(SSL *s /* use special padding (SSL 3.0 draft/RFC 2246, App. E.2) */ s->s2->ssl2_rollback=1; - /* setup the 5 bytes we have read so we get them from + /* setup the 7 bytes we have read so we get them from * the sslv2 buffer */ s->rstate=SSL_ST_READ_HEADER; s->packet_length=n; @@ -525,28 +527,15 @@ static int ssl23_get_server_hello(SSL *s s->handshake_func=s->method->ssl_connect; #endif } - else if ((p[0] == SSL3_RT_HANDSHAKE) && - (p[1] == SSL3_VERSION_MAJOR) && - ((p[2] == SSL3_VERSION_MINOR) || - (p[2] == TLS1_VERSION_MINOR)) && - (p[5] == SSL3_MT_SERVER_HELLO)) + else if (p[1] == SSL3_VERSION_MAJOR && + ((p[2] == SSL3_VERSION_MINOR) || + (p[2] == TLS1_VERSION_MINOR)) && + ((p[0] == SSL3_RT_HANDSHAKE && p[5] == SSL3_MT_SERVER_HELLO) || + (p[0] == SSL3_RT_ALERT && p[3] == 0 && p[4] == 2))) { - /* we have sslv3 or tls1 */ - - if (!ssl_init_wbio_buffer(s,1)) goto err; - - /* we are in this state */ - s->state=SSL3_ST_CR_SRVR_HELLO_A; - - /* put the 5 bytes we have read into the input buffer - * for SSLv3 */ - s->rstate=SSL_ST_READ_HEADER; - s->packet_length=n; - s->packet= &(s->s3->rbuf.buf[0]); - memcpy(s->packet,buf,n); - s->s3->rbuf.left=n; - s->s3->rbuf.offset=0; + /* we have sslv3 or tls1 (server hello or alert) */ +#ifndef OPENSSL_NO_SSL3 if ((p[2] == SSL3_VERSION_MINOR) && !(s->options & SSL_OP_NO_SSLv3)) { @@ -561,7 +550,9 @@ static int ssl23_get_server_hello(SSL *s s->version=SSL3_VERSION; s->method=SSLv3_client_method(); } - else if ((p[2] == TLS1_VERSION_MINOR) && + else +#endif + if ((p[2] == TLS1_VERSION_MINOR) && !(s->options & SSL_OP_NO_TLSv1)) { s->version=TLS1_VERSION; @@ -572,35 +563,55 @@ static int ssl23_get_server_hello(SSL *s SSLerr(SSL_F_SSL23_GET_SERVER_HELLO,SSL_R_UNSUPPORTED_PROTOCOL); goto err; } - - s->handshake_func=s->method->ssl_connect; - } - else if ((p[0] == SSL3_RT_ALERT) && - (p[1] == SSL3_VERSION_MAJOR) && - ((p[2] == SSL3_VERSION_MINOR) || - (p[2] == TLS1_VERSION_MINOR)) && - (p[3] == 0) && - (p[4] == 2)) - { - void (*cb)(const SSL *ssl,int type,int val)=NULL; - int j; - /* An alert */ - if (s->info_callback != NULL) - cb=s->info_callback; - else if (s->ctx->info_callback != NULL) - cb=s->ctx->info_callback; - - i=p[5]; - if (cb != NULL) + /* ensure that TLS_MAX_VERSION is up-to-date */ + OPENSSL_assert(s->version <= TLS_MAX_VERSION); + + if (p[0] == SSL3_RT_ALERT && p[5] != SSL3_AL_WARNING) { - j=(i<<8)|p[6]; - cb(s,SSL_CB_READ_ALERT,j); + /* fatal alert */ + + void (*cb)(const SSL *ssl,int type,int val)=NULL; + int j; + + if (s->info_callback != NULL) + cb=s->info_callback; + else if (s->ctx->info_callback != NULL) + cb=s->ctx->info_callback; + + i=p[5]; + if (cb != NULL) + { + j=(i<<8)|p[6]; + cb(s,SSL_CB_READ_ALERT,j); + } + + if (s->msg_callback) + s->msg_callback(0, s->version, SSL3_RT_ALERT, p+5, 2, s, s->msg_callback_arg); + + s->rwstate=SSL_NOTHING; + SSLerr(SSL_F_SSL23_GET_SERVER_HELLO,SSL_AD_REASON_OFFSET+p[6]); + goto err; } - s->rwstate=SSL_NOTHING; - SSLerr(SSL_F_SSL23_GET_SERVER_HELLO,SSL_AD_REASON_OFFSET+p[6]); - goto err; + if (!ssl_init_wbio_buffer(s,1)) goto err; + + /* we are in this state */ + s->state=SSL3_ST_CR_SRVR_HELLO_A; + + /* put the 7 bytes we have read into the input buffer + * for SSLv3 */ + s->rstate=SSL_ST_READ_HEADER; + s->packet_length=n; + if (s->s3->rbuf.buf == NULL) + if (!ssl3_setup_buffers(s)) + goto err; + s->packet= &(s->s3->rbuf.buf[0]); + memcpy(s->packet,buf,n); + s->s3->rbuf.left=n; + s->s3->rbuf.offset=0; + + s->handshake_func=s->method->ssl_connect; } else { Modified: releng/8.4/crypto/openssl/ssl/s23_srvr.c ============================================================================== --- releng/8.4/crypto/openssl/ssl/s23_srvr.c Tue Oct 21 20:21:10 2014 (r273415) +++ releng/8.4/crypto/openssl/ssl/s23_srvr.c Tue Oct 21 20:21:27 2014 (r273416) @@ -124,9 +124,11 @@ static SSL_METHOD *ssl23_get_server_meth if (ver == SSL2_VERSION) return(SSLv2_server_method()); #endif +#ifndef OPENSSL_NO_SSL3 if (ver == SSL3_VERSION) return(SSLv3_server_method()); - else if (ver == TLS1_VERSION) +#endif + if (ver == TLS1_VERSION) return(TLSv1_server_method()); else return(NULL); @@ -398,6 +400,9 @@ int ssl23_get_client_hello(SSL *s) } #endif + /* ensure that TLS_MAX_VERSION is up-to-date */ + OPENSSL_assert(s->version <= TLS_MAX_VERSION); + if (s->state == SSL23_ST_SR_CLNT_HELLO_B) { /* we have SSLv3/TLSv1 in an SSLv2 header @@ -554,6 +559,12 @@ int ssl23_get_client_hello(SSL *s) if ((type == 2) || (type == 3)) { /* we have SSLv3/TLSv1 (type 2: SSL2 style, type 3: SSL3/TLS style) */ + s->method = ssl23_get_server_method(s->version); + if (s->method == NULL) + { + SSLerr(SSL_F_SSL23_GET_CLIENT_HELLO,SSL_R_UNSUPPORTED_PROTOCOL); + goto err; + } if (!ssl_init_wbio_buffer(s,1)) goto err; @@ -577,11 +588,6 @@ int ssl23_get_client_hello(SSL *s) s->s3->rbuf.left=0; s->s3->rbuf.offset=0; } - - if (s->version == TLS1_VERSION) - s->method = TLSv1_server_method(); - else - s->method = SSLv3_server_method(); #if 0 /* ssl3_get_client_hello does this */ s->client_version=(v[0]<<8)|v[1]; #endif Modified: releng/8.4/crypto/openssl/ssl/s2_lib.c ============================================================================== --- releng/8.4/crypto/openssl/ssl/s2_lib.c Tue Oct 21 20:21:10 2014 (r273415) +++ releng/8.4/crypto/openssl/ssl/s2_lib.c Tue Oct 21 20:21:27 2014 (r273416) @@ -314,6 +314,8 @@ long ssl2_ctrl(SSL *s, int cmd, long lar case SSL_CTRL_GET_SESSION_REUSED: ret=s->hit; break; + case SSL_CTRL_CHECK_PROTO_VERSION: + return ssl3_ctrl(s, SSL_CTRL_CHECK_PROTO_VERSION, larg, parg); default: break; } @@ -362,7 +364,7 @@ int ssl2_put_cipher_by_char(const SSL_CI if (p != NULL) { l=c->id; - if ((l & 0xff000000) != 0x02000000) return(0); + if ((l & 0xff000000) != 0x02000000 && l != SSL3_CK_FALLBACK_SCSV) return(0); p[0]=((unsigned char)(l>>16L))&0xFF; p[1]=((unsigned char)(l>> 8L))&0xFF; p[2]=((unsigned char)(l ))&0xFF; Modified: releng/8.4/crypto/openssl/ssl/s3_enc.c ============================================================================== --- releng/8.4/crypto/openssl/ssl/s3_enc.c Tue Oct 21 20:21:10 2014 (r273415) +++ releng/8.4/crypto/openssl/ssl/s3_enc.c Tue Oct 21 20:21:27 2014 (r273416) @@ -758,7 +758,13 @@ int ssl3_alert_code(int code) case SSL_AD_INTERNAL_ERROR: return(SSL3_AD_HANDSHAKE_FAILURE); case SSL_AD_USER_CANCELLED: return(SSL3_AD_HANDSHAKE_FAILURE); case SSL_AD_NO_RENEGOTIATION: return(-1); /* Don't send it :-) */ + case SSL_AD_UNSUPPORTED_EXTENSION: return(SSL3_AD_HANDSHAKE_FAILURE); + case SSL_AD_CERTIFICATE_UNOBTAINABLE: return(SSL3_AD_HANDSHAKE_FAILURE); + case SSL_AD_UNRECOGNIZED_NAME: return(SSL3_AD_HANDSHAKE_FAILURE); + case SSL_AD_BAD_CERTIFICATE_STATUS_RESPONSE: return(SSL3_AD_HANDSHAKE_FAILURE); + case SSL_AD_BAD_CERTIFICATE_HASH_VALUE: return(SSL3_AD_HANDSHAKE_FAILURE); + case SSL_AD_UNKNOWN_PSK_IDENTITY:return(TLS1_AD_UNKNOWN_PSK_IDENTITY); + case SSL_AD_INAPPROPRIATE_FALLBACK:return(TLS1_AD_INAPPROPRIATE_FALLBACK); default: return(-1); } } - Modified: releng/8.4/crypto/openssl/ssl/s3_lib.c ============================================================================== --- releng/8.4/crypto/openssl/ssl/s3_lib.c Tue Oct 21 20:21:10 2014 (r273415) +++ releng/8.4/crypto/openssl/ssl/s3_lib.c Tue Oct 21 20:21:27 2014 (r273416) @@ -1981,6 +1981,29 @@ long ssl3_ctrl(SSL *s, int cmd, long lar break; #endif /* !OPENSSL_NO_TLSEXT */ + + case SSL_CTRL_CHECK_PROTO_VERSION: + /* For library-internal use; checks that the current protocol + * is the highest enabled version (according to s->ctx->method, + * as version negotiation may have changed s->method). */ + if (s->version == s->ctx->method->version) + return 1; + /* Apparently we're using a version-flexible SSL_METHOD + * (not at its highest protocol version). */ + if (s->ctx->method->version == SSLv23_method()->version) + { +#if TLS_MAX_VERSION != TLS1_VERSION +# error Code needs update for SSLv23_method() support beyond TLS1_VERSION. +#endif + if (!(s->options & SSL_OP_NO_TLSv1)) + return s->version == TLS1_VERSION; + if (!(s->options & SSL_OP_NO_SSLv3)) + return s->version == SSL3_VERSION; + if (!(s->options & SSL_OP_NO_SSLv2)) + return s->version == SSL2_VERSION; + } + return 0; /* Unexpected state; fail closed. */ + default: break; } @@ -2269,6 +2292,7 @@ long ssl3_ctx_callback_ctrl(SSL_CTX *ctx break; #endif + default: return(0); } Modified: releng/8.4/crypto/openssl/ssl/ssl.h ============================================================================== --- releng/8.4/crypto/openssl/ssl/ssl.h Tue Oct 21 20:21:10 2014 (r273415) +++ releng/8.4/crypto/openssl/ssl/ssl.h Tue Oct 21 20:21:27 2014 (r273416) @@ -560,6 +560,10 @@ typedef struct ssl_session_st #define SSL_MODE_AUTO_RETRY 0x00000004L /* Don't attempt to automatically build certificate chain */ #define SSL_MODE_NO_AUTO_CHAIN 0x00000008L +/* Send TLS_FALLBACK_SCSV in the ClientHello. + * To be set by applications that reconnect with a downgraded protocol + * version; see draft-ietf-tls-downgrade-scsv-00 for details. */ +#define SSL_MODE_SEND_FALLBACK_SCSV 0x00000080L /* Note: SSL[_CTX]_set_{options,mode} use |= op on the previous value, @@ -1204,6 +1208,9 @@ size_t SSL_get_peer_finished(const SSL * #define SSL_AD_CERTIFICATE_UNOBTAINABLE TLS1_AD_CERTIFICATE_UNOBTAINABLE #define SSL_AD_UNRECOGNIZED_NAME TLS1_AD_UNRECOGNIZED_NAME #define SSL_AD_BAD_CERTIFICATE_STATUS_RESPONSE TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE +#define SSL_AD_BAD_CERTIFICATE_HASH_VALUE TLS1_AD_BAD_CERTIFICATE_HASH_VALUE +#define SSL_AD_UNKNOWN_PSK_IDENTITY TLS1_AD_UNKNOWN_PSK_IDENTITY /* fatal */ +#define SSL_AD_INAPPROPRIATE_FALLBACK TLS1_AD_INAPPROPRIATE_FALLBACK /* fatal */ #define SSL_ERROR_NONE 0 #define SSL_ERROR_SSL 1 @@ -1293,6 +1300,8 @@ size_t SSL_get_peer_finished(const SSL * #define SSL_CTRL_CLEAR_OPTIONS 77 #define SSL_CTRL_CLEAR_MODE 78 +#define SSL_CTRL_CHECK_PROTO_VERSION 119 + #define DTLSv1_get_timeout(ssl, arg) \ SSL_ctrl(ssl,DTLS_CTRL_GET_TIMEOUT,0, (void *)arg) #define DTLSv1_handle_timeout(ssl) \ @@ -1940,6 +1949,7 @@ void ERR_load_SSL_strings(void); #define SSL_R_HTTPS_PROXY_REQUEST 155 #define SSL_R_HTTP_REQUEST 156 #define SSL_R_ILLEGAL_PADDING 283 +#define SSL_R_INAPPROPRIATE_FALLBACK 373 #define SSL_R_INVALID_CHALLENGE_LENGTH 158 #define SSL_R_INVALID_COMMAND 280 #define SSL_R_INVALID_PURPOSE 278 @@ -2067,6 +2077,7 @@ void ERR_load_SSL_strings(void); #define SSL_R_TLSV1_ALERT_DECRYPTION_FAILED 1021 #define SSL_R_TLSV1_ALERT_DECRYPT_ERROR 1051 #define SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION 1060 +#define SSL_R_TLSV1_ALERT_INAPPROPRIATE_FALLBACK 1086 #define SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY 1071 #define SSL_R_TLSV1_ALERT_INTERNAL_ERROR 1080 #define SSL_R_TLSV1_ALERT_NO_RENEGOTIATION 1100 @@ -2074,6 +2085,11 @@ void ERR_load_SSL_strings(void); #define SSL_R_TLSV1_ALERT_RECORD_OVERFLOW 1022 #define SSL_R_TLSV1_ALERT_UNKNOWN_CA 1048 #define SSL_R_TLSV1_ALERT_USER_CANCELLED 1090 +#define SSL_R_TLSV1_BAD_CERTIFICATE_HASH_VALUE 1114 +#define SSL_R_TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE 1113 +#define SSL_R_TLSV1_CERTIFICATE_UNOBTAINABLE 1111 +#define SSL_R_TLSV1_UNRECOGNIZED_NAME 1112 +#define SSL_R_TLSV1_UNSUPPORTED_EXTENSION 1110 #define SSL_R_TLS_CLIENT_CERT_REQ_WITH_ANON_CIPHER 232 #define SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST 227 #define SSL_R_TLS_PEER_DID_NOT_RESPOND_WITH_CERTIFICATE_LIST 233 Modified: releng/8.4/crypto/openssl/ssl/ssl3.h ============================================================================== --- releng/8.4/crypto/openssl/ssl/ssl3.h Tue Oct 21 20:21:10 2014 (r273415) +++ releng/8.4/crypto/openssl/ssl/ssl3.h Tue Oct 21 20:21:27 2014 (r273416) @@ -129,9 +129,14 @@ extern "C" { #endif -/* Signalling cipher suite value: from draft-ietf-tls-renegotiation-03.txt */ +/* Signalling cipher suite value from RFC 5746 + * (TLS_EMPTY_RENEGOTIATION_INFO_SCSV) */ #define SSL3_CK_SCSV 0x030000FF +/* Signalling cipher suite value from draft-ietf-tls-downgrade-scsv-00 + * (TLS_FALLBACK_SCSV) */ +#define SSL3_CK_FALLBACK_SCSV 0x03005600 + #define SSL3_CK_RSA_NULL_MD5 0x03000001 #define SSL3_CK_RSA_NULL_SHA 0x03000002 #define SSL3_CK_RSA_RC4_40_MD5 0x03000003 Modified: releng/8.4/crypto/openssl/ssl/ssl_err.c ============================================================================== --- releng/8.4/crypto/openssl/ssl/ssl_err.c Tue Oct 21 20:21:10 2014 (r273415) +++ releng/8.4/crypto/openssl/ssl/ssl_err.c Tue Oct 21 20:21:27 2014 (r273416) @@ -341,6 +341,7 @@ static ERR_STRING_DATA SSL_str_reasons[] {ERR_REASON(SSL_R_HTTPS_PROXY_REQUEST) ,"https proxy request"}, {ERR_REASON(SSL_R_HTTP_REQUEST) ,"http request"}, {ERR_REASON(SSL_R_ILLEGAL_PADDING) ,"illegal padding"}, +{ERR_REASON(SSL_R_INAPPROPRIATE_FALLBACK),"inappropriate fallback"}, {ERR_REASON(SSL_R_INVALID_CHALLENGE_LENGTH),"invalid challenge length"}, {ERR_REASON(SSL_R_INVALID_COMMAND) ,"invalid command"}, {ERR_REASON(SSL_R_INVALID_PURPOSE) ,"invalid purpose"}, @@ -468,6 +469,7 @@ static ERR_STRING_DATA SSL_str_reasons[] {ERR_REASON(SSL_R_TLSV1_ALERT_DECRYPTION_FAILED),"tlsv1 alert decryption failed"}, {ERR_REASON(SSL_R_TLSV1_ALERT_DECRYPT_ERROR),"tlsv1 alert decrypt error"}, {ERR_REASON(SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION),"tlsv1 alert export restriction"}, +{ERR_REASON(SSL_R_TLSV1_ALERT_INAPPROPRIATE_FALLBACK),"tlsv1 alert inappropriate fallback"}, {ERR_REASON(SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY),"tlsv1 alert insufficient security"}, {ERR_REASON(SSL_R_TLSV1_ALERT_INTERNAL_ERROR),"tlsv1 alert internal error"}, {ERR_REASON(SSL_R_TLSV1_ALERT_NO_RENEGOTIATION),"tlsv1 alert no renegotiation"}, @@ -475,6 +477,11 @@ static ERR_STRING_DATA SSL_str_reasons[] {ERR_REASON(SSL_R_TLSV1_ALERT_RECORD_OVERFLOW),"tlsv1 alert record overflow"}, {ERR_REASON(SSL_R_TLSV1_ALERT_UNKNOWN_CA),"tlsv1 alert unknown ca"}, {ERR_REASON(SSL_R_TLSV1_ALERT_USER_CANCELLED),"tlsv1 alert user cancelled"}, +{ERR_REASON(SSL_R_TLSV1_BAD_CERTIFICATE_HASH_VALUE),"tlsv1 bad certificate hash value"}, +{ERR_REASON(SSL_R_TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE),"tlsv1 bad certificate status response"}, +{ERR_REASON(SSL_R_TLSV1_CERTIFICATE_UNOBTAINABLE),"tlsv1 certificate unobtainable"}, +{ERR_REASON(SSL_R_TLSV1_UNRECOGNIZED_NAME),"tlsv1 unrecognized name"}, +{ERR_REASON(SSL_R_TLSV1_UNSUPPORTED_EXTENSION),"tlsv1 unsupported extension"}, {ERR_REASON(SSL_R_TLS_CLIENT_CERT_REQ_WITH_ANON_CIPHER),"tls client cert req with anon cipher"}, {ERR_REASON(SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST),"tls invalid ecpointformat list"}, {ERR_REASON(SSL_R_TLS_PEER_DID_NOT_RESPOND_WITH_CERTIFICATE_LIST),"tls peer did not respond with certificate list"}, Modified: releng/8.4/crypto/openssl/ssl/ssl_lib.c ============================================================================== --- releng/8.4/crypto/openssl/ssl/ssl_lib.c Tue Oct 21 20:21:10 2014 (r273415) +++ releng/8.4/crypto/openssl/ssl/ssl_lib.c Tue Oct 21 20:21:27 2014 (r273416) @@ -1292,6 +1292,8 @@ int ssl_cipher_list_to_bytes(SSL *s,STAC if (sk == NULL) return(0); q=p; + if (put_cb == NULL) + put_cb = s->method->put_cipher_by_char; for (i=0; inew_session) + /* If p == q, no ciphers; caller indicates an error. + * Otherwise, add applicable SCSVs. */ + if (p != q) { - static SSL_CIPHER scsv = + if (!s->new_session) { - 0, NULL, SSL3_CK_SCSV, 0, 0, 0, 0, 0, 0, 0, - }; - j = put_cb ? put_cb(&scsv,p) : ssl_put_cipher_by_char(s,&scsv,p); - p+=j; + static SSL_CIPHER scsv = + { + 0, NULL, SSL3_CK_SCSV, 0, 0, 0, 0, 0, 0, 0, + }; + j = put_cb(&scsv,p); + p+=j; #ifdef OPENSSL_RI_DEBUG - fprintf(stderr, "SCSV sent by client\n"); + fprintf(stderr, "TLS_EMPTY_RENEGOTIATION_INFO_SCSV sent by client\n"); #endif - } + } + + if (s->mode & SSL_MODE_SEND_FALLBACK_SCSV) + { + static SSL_CIPHER scsv = + { + 0, NULL, SSL3_CK_FALLBACK_SCSV, 0, 0, 0, 0, 0, 0, 0, + }; + j = put_cb(&scsv,p); + p+=j; + } + } return(p-q); } @@ -1329,11 +1343,12 @@ STACK_OF(SSL_CIPHER) *ssl_bytes_to_ciphe SSL_CIPHER *c; STACK_OF(SSL_CIPHER) *sk; int i,n; + if (s->s3) s->s3->send_connection_binding = 0; n=ssl_put_cipher_by_char(s,NULL,NULL); - if ((num%n) != 0) + if (n == 0 || (num%n) != 0) { SSLerr(SSL_F_SSL_BYTES_TO_CIPHER_LIST,SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST); return(NULL); @@ -1348,7 +1363,7 @@ STACK_OF(SSL_CIPHER) *ssl_bytes_to_ciphe for (i=0; is3 && (n != 3 || !p[0]) && (p[n-2] == ((SSL3_CK_SCSV >> 8) & 0xff)) && (p[n-1] == (SSL3_CK_SCSV & 0xff))) @@ -1368,6 +1383,23 @@ STACK_OF(SSL_CIPHER) *ssl_bytes_to_ciphe continue; } + /* Check for TLS_FALLBACK_SCSV */ + if ((n != 3 || !p[0]) && + (p[n-2] == ((SSL3_CK_FALLBACK_SCSV >> 8) & 0xff)) && + (p[n-1] == (SSL3_CK_FALLBACK_SCSV & 0xff))) + { + /* The SCSV indicates that the client previously tried a higher version. + * Fail if the current version is an unexpected downgrade. */ + if (!SSL_ctrl(s, SSL_CTRL_CHECK_PROTO_VERSION, 0, NULL)) + { + SSLerr(SSL_F_SSL_BYTES_TO_CIPHER_LIST,SSL_R_INAPPROPRIATE_FALLBACK); + if (s->s3) + ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_INAPPROPRIATE_FALLBACK); + goto err; + } + continue; + } + c=ssl_get_cipher_by_char(s,p); p+=n; if (c != NULL) Modified: releng/8.4/crypto/openssl/ssl/ssl_stat.c ============================================================================== --- releng/8.4/crypto/openssl/ssl/ssl_stat.c Tue Oct 21 20:21:10 2014 (r273415) +++ releng/8.4/crypto/openssl/ssl/ssl_stat.c Tue Oct 21 20:21:27 2014 (r273416) @@ -414,6 +414,12 @@ const char *SSL_alert_desc_string(int va case TLS1_AD_INTERNAL_ERROR: str="IE"; break; case TLS1_AD_USER_CANCELLED: str="US"; break; case TLS1_AD_NO_RENEGOTIATION: str="NR"; break; + case TLS1_AD_UNSUPPORTED_EXTENSION: str="UE"; break; + case TLS1_AD_CERTIFICATE_UNOBTAINABLE: str="CO"; break; + case TLS1_AD_UNRECOGNIZED_NAME: str="UN"; break; + case TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE: str="BR"; break; + case TLS1_AD_BAD_CERTIFICATE_HASH_VALUE: str="BH"; break; + case TLS1_AD_UNKNOWN_PSK_IDENTITY: str="UP"; break; default: str="UK"; break; } return(str); @@ -497,6 +503,24 @@ const char *SSL_alert_desc_string_long(i case TLS1_AD_NO_RENEGOTIATION: str="no renegotiation"; break; + case TLS1_AD_UNSUPPORTED_EXTENSION: + str="unsupported extension"; + break; + case TLS1_AD_CERTIFICATE_UNOBTAINABLE: + str="certificate unobtainable"; + break; + case TLS1_AD_UNRECOGNIZED_NAME: + str="unrecognized name"; + break; + case TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE: + str="bad certificate status response"; + break; + case TLS1_AD_BAD_CERTIFICATE_HASH_VALUE: + str="bad certificate hash value"; + break; + case TLS1_AD_UNKNOWN_PSK_IDENTITY: + str="unknown PSK identity"; + break; default: str="unknown"; break; } return(str); Modified: releng/8.4/crypto/openssl/ssl/t1_enc.c ============================================================================== --- releng/8.4/crypto/openssl/ssl/t1_enc.c Tue Oct 21 20:21:10 2014 (r273415) +++ releng/8.4/crypto/openssl/ssl/t1_enc.c Tue Oct 21 20:21:27 2014 (r273416) @@ -853,6 +853,13 @@ int tls1_alert_code(int code) case SSL_AD_INTERNAL_ERROR: return(TLS1_AD_INTERNAL_ERROR); case SSL_AD_USER_CANCELLED: return(TLS1_AD_USER_CANCELLED); case SSL_AD_NO_RENEGOTIATION: return(TLS1_AD_NO_RENEGOTIATION); + case SSL_AD_UNSUPPORTED_EXTENSION: return(TLS1_AD_UNSUPPORTED_EXTENSION); + case SSL_AD_CERTIFICATE_UNOBTAINABLE: return(TLS1_AD_CERTIFICATE_UNOBTAINABLE); + case SSL_AD_UNRECOGNIZED_NAME: return(TLS1_AD_UNRECOGNIZED_NAME); + case SSL_AD_BAD_CERTIFICATE_STATUS_RESPONSE: return(TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE); + case SSL_AD_BAD_CERTIFICATE_HASH_VALUE: return(TLS1_AD_BAD_CERTIFICATE_HASH_VALUE); + case SSL_AD_UNKNOWN_PSK_IDENTITY:return(TLS1_AD_UNKNOWN_PSK_IDENTITY); + case SSL_AD_INAPPROPRIATE_FALLBACK:return(TLS1_AD_INAPPROPRIATE_FALLBACK); #ifdef DTLS1_AD_MISSING_HANDSHAKE_MESSAGE case DTLS1_AD_MISSING_HANDSHAKE_MESSAGE: return (DTLS1_AD_MISSING_HANDSHAKE_MESSAGE); @@ -860,4 +867,3 @@ int tls1_alert_code(int code) default: return(-1); } } - Modified: releng/8.4/crypto/openssl/ssl/t1_lib.c ============================================================================== --- releng/8.4/crypto/openssl/ssl/t1_lib.c Tue Oct 21 20:21:10 2014 (r273415) +++ releng/8.4/crypto/openssl/ssl/t1_lib.c Tue Oct 21 20:21:27 2014 (r273416) @@ -1013,7 +1013,10 @@ static int tls_decrypt_ticket(SSL *s, co HMAC_Final(&hctx, tick_hmac, NULL); HMAC_CTX_cleanup(&hctx); if (CRYPTO_memcmp(tick_hmac, etick + eticklen, mlen)) + { + EVP_CIPHER_CTX_cleanup(&ctx); goto tickerr; + } /* Attempt to decrypt session data */ /* Move p after IV to start of encrypted ticket, update length */ p = etick + 16 + EVP_CIPHER_CTX_iv_length(&ctx); Modified: releng/8.4/crypto/openssl/ssl/tls1.h ============================================================================== --- releng/8.4/crypto/openssl/ssl/tls1.h Tue Oct 21 20:21:10 2014 (r273415) +++ releng/8.4/crypto/openssl/ssl/tls1.h Tue Oct 21 20:21:27 2014 (r273416) @@ -81,6 +81,15 @@ extern "C" { #define TLS1_ALLOW_EXPERIMENTAL_CIPHERSUITES 0 #define TLS1_VERSION 0x0301 +#define TLS1_1_VERSION 0x0302 +#define TLS1_2_VERSION 0x0303 +/* TLS 1.1 and 1.2 are not supported by this version of OpenSSL, so + * TLS_MAX_VERSION indicates TLS 1.0 regardless of the above + * definitions. (s23_clnt.c and s23_srvr.c have an OPENSSL_assert() + * check that would catch the error if TLS_MAX_VERSION was too low.) + */ +#define TLS_MAX_VERSION TLS1_VERSION + #define TLS1_VERSION_MAJOR 0x03 #define TLS1_VERSION_MINOR 0x01 @@ -94,6 +103,7 @@ extern "C" { #define TLS1_AD_PROTOCOL_VERSION 70 /* fatal */ #define TLS1_AD_INSUFFICIENT_SECURITY 71 /* fatal */ #define TLS1_AD_INTERNAL_ERROR 80 /* fatal */ +#define TLS1_AD_INAPPROPRIATE_FALLBACK 86 /* fatal */ #define TLS1_AD_USER_CANCELLED 90 #define TLS1_AD_NO_RENEGOTIATION 100 /* codes 110-114 are from RFC3546 */ @@ -405,6 +415,3 @@ SSL_CTX_callback_ctrl(ssl,SSL_CTRL_SET_T } #endif #endif - - - Modified: releng/8.4/sbin/routed/input.c ============================================================================== --- releng/8.4/sbin/routed/input.c Tue Oct 21 20:21:10 2014 (r273415) +++ releng/8.4/sbin/routed/input.c Tue Oct 21 20:21:27 2014 (r273416) @@ -288,6 +288,10 @@ input(struct sockaddr_in *from, /* rece /* Answer a query from a utility program * with all we know. */ + if (aifp == NULL) { + trace_pkt("ignore remote query"); + return; + } if (from->sin_port != htons(RIP_PORT)) { supply(from, aifp, OUT_QUERY, 0, rip->rip_vers, ap != 0); Modified: releng/8.4/sys/conf/newvers.sh ============================================================================== --- releng/8.4/sys/conf/newvers.sh Tue Oct 21 20:21:10 2014 (r273415) +++ releng/8.4/sys/conf/newvers.sh Tue Oct 21 20:21:27 2014 (r273416) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="8.4" -BRANCH="RELEASE-p16" +BRANCH="RELEASE-p17" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 20:29:43 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9C71021A; Tue, 21 Oct 2014 20:29:43 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 892972E6; Tue, 21 Oct 2014 20:29:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LKThdi074338; Tue, 21 Oct 2014 20:29:43 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LKThT2074337; Tue, 21 Oct 2014 20:29:43 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201410212029.s9LKThT2074337@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 21 Oct 2014 20:29:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273417 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 20:29:43 -0000 Author: imp Date: Tue Oct 21 20:29:42 2014 New Revision: 273417 URL: https://svnweb.freebsd.org/changeset/base/273417 Log: You aren't allowed to test WITH_xxx or WITHOUT_xxx here, so remove it. Even if you were allowed to test for it, the test makes no sense as it always results in adding -DWITH_ATF unless WITH_ATF was already defined. But if MK_ATF != no, then we know it was defined. This, in turn, caused tools/build/options/makemake always think WITH_ATF is the default, which removed control of that from sys.conf.mk. To get the intent of the deleted comment, another mechanism is required, assuming that the intent of that comment is desirable. Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Tue Oct 21 20:21:27 2014 (r273416) +++ head/Makefile.inc1 Tue Oct 21 20:29:42 2014 (r273417) @@ -1561,12 +1561,7 @@ gnu/lib/libsupc++__L: gnu/lib/libstdc++_ lib/libgeom__L: lib/libexpat__L -.if defined(WITH_ATF) || ${MK_TESTS} != "no" -.if !defined(WITH_ATF) -# Ensure that the ATF libraries will be built during make libraries, even -# though they will have WITHOUT_TESTS -MAKE+= -DWITH_ATF -.endif +.if ${MK_TESTS} != "no" _lib_atf= lib/atf .endif From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 20:29:52 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F38DC3DD; Tue, 21 Oct 2014 20:29:51 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E03662E7; Tue, 21 Oct 2014 20:29:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LKTp71074410; Tue, 21 Oct 2014 20:29:51 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LKTpP5074409; Tue, 21 Oct 2014 20:29:51 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201410212029.s9LKTpP5074409@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 21 Oct 2014 20:29:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273418 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 20:29:52 -0000 Author: imp Date: Tue Oct 21 20:29:51 2014 New Revision: 273418 URL: https://svnweb.freebsd.org/changeset/base/273418 Log: Generate both userland and kernel option settings for showconfig. PR: 191920 Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Tue Oct 21 20:29:42 2014 (r273417) +++ head/Makefile.inc1 Tue Oct 21 20:29:51 2014 (r273418) @@ -1886,7 +1886,8 @@ check-old: check-old-files check-old-lib # showconfig - show build configuration. # showconfig: - @${MAKE} -n -f src.opts.mk -V dummy -dg1 2>&1 | grep ^MK_ | sort + @(${MAKE} -n -f ${.CURDIR}/sys/conf/kern.opts.mk -V dummy -dg1; \ + ${MAKE} -n -f ${.CURDIR}/share/mk/src.opts.mk -V dummy -dg1) 2>&1 | grep ^MK_ | sort -u .if !empty(KRNLOBJDIR) && !empty(KERNCONF) DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/ From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 20:29:53 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CDE574B4; Tue, 21 Oct 2014 20:29:53 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BAE362EA; Tue, 21 Oct 2014 20:29:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LKTrQg074467; Tue, 21 Oct 2014 20:29:53 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LKTrNp074466; Tue, 21 Oct 2014 20:29:53 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201410212029.s9LKTrNp074466@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 21 Oct 2014 20:29:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273419 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 20:29:53 -0000 Author: imp Date: Tue Oct 21 20:29:53 2014 New Revision: 273419 URL: https://svnweb.freebsd.org/changeset/base/273419 Log: For the kernel, we have USB_GADGET_EXAMPLES as defaults to yes. For userland defaults to no. This caused issues for the automated option documenation script. Turns out, this isn't used in userland at all, so just remove it from here. Modified: head/share/mk/src.opts.mk Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Tue Oct 21 20:29:51 2014 (r273418) +++ head/share/mk/src.opts.mk Tue Oct 21 20:29:53 2014 (r273419) @@ -169,8 +169,7 @@ __DEFAULT_NO_OPTIONS = \ OPENSSH_NONE_CIPHER \ SHARED_TOOLCHAIN \ SORT_THREADS \ - SVN \ - USB_GADGET_EXAMPLES + SVN # # Default behaviour of some options depends on the architecture. Unfortunately From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 20:41:20 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C179489D; Tue, 21 Oct 2014 20:41:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AD2B75F9; Tue, 21 Oct 2014 20:41:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LKfKod082079; Tue, 21 Oct 2014 20:41:20 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LKfKWr082078; Tue, 21 Oct 2014 20:41:20 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201410212041.s9LKfKWr082078@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 21 Oct 2014 20:41:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273420 - head/share/man/man5 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 20:41:21 -0000 Author: emaste Date: Tue Oct 21 20:41:19 2014 New Revision: 273420 URL: https://svnweb.freebsd.org/changeset/base/273420 Log: Regenerate after r273418 Modified: head/share/man/man5/src.conf.5 Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Tue Oct 21 20:29:53 2014 (r273419) +++ head/share/man/man5/src.conf.5 Tue Oct 21 20:41:19 2014 (r273420) @@ -1,7 +1,7 @@ .\" DO NOT EDIT-- this file is automatically generated. .\" from FreeBSD: head/tools/build/options/makeman 255964 2013-10-01 07:22:04Z des .\" $FreeBSD$ -.Dd October 16, 2014 +.Dd October 21, 2014 .Dt SRC.CONF 5 .Os .Sh NAME @@ -211,10 +211,10 @@ Set to build the Clang C/C++ compiler du It is a default setting on amd64/amd64, arm/arm, arm/armv6, arm/armv6hf, i386/i386, pc98/i386, powerpc/powerpc and powerpc/powerpc64. .It Va WITHOUT_CLANG_BOOTSTRAP -.\" from FreeBSD: head/tools/build/options/WITHOUT_CLANG_BOOTSTRAP 264660 2014-04-18 17:03:58Z imp +.\" from FreeBSD: head/tools/build/options/WITHOUT_CLANG_BOOTSTRAP 273177 2014-10-16 18:28:11Z skreuzer Set to not build the Clang C/C++ compiler during the bootstrap phase of the build. -You must enable wither gcc or clang bootstrap to be able to build the system, -unless an alternative compiiler is provided via +You must enable either gcc or clang bootstrap to be able to build the system, +unless an alternative compiler is provided via XCC. .Pp It is a default setting on @@ -404,6 +404,12 @@ program to be built and installed as fma .\" from FreeBSD: head/tools/build/options/WITHOUT_FMTREE 261299 2014-01-30 21:37:43Z brooks Set to not build and install .Pa /usr/sbin/fmtree . +.It Va WITHOUT_FORMAT_EXTENSIONS +.\" from FreeBSD: head/tools/build/options/WITHOUT_FORMAT_EXTENSIONS 250658 2013-05-15 13:04:10Z brooks +Set to not enable +.Fl fformat-extensions +when compiling the kernel. +Also disables all format checking. .It Va WITHOUT_FORTH .\" from FreeBSD: head/tools/build/options/WITHOUT_FORTH 156932 2006-03-21 07:50:50Z ru Set to build bootloaders without Forth support. @@ -432,10 +438,10 @@ Set to build and install gcc and g++. It is a default setting on arm/armeb, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, powerpc/powerpc, powerpc/powerpc64 and sparc64/sparc64. .It Va WITHOUT_GCC_BOOTSTRAP -.\" from FreeBSD: head/tools/build/options/WITHOUT_GCC_BOOTSTRAP 264660 2014-04-18 17:03:58Z imp +.\" from FreeBSD: head/tools/build/options/WITHOUT_GCC_BOOTSTRAP 273177 2014-10-16 18:28:11Z skreuzer Set to not build gcc and g++ as part of the bootstrap process. -You must enable wither gcc or clang bootstrap to be able to build the system, -unless an alternative compiiler is provided via +You must enable either gcc or clang bootstrap to be able to build the system, +unless an alternative compiler is provided via XCC. .Pp It is a default setting on @@ -613,6 +619,12 @@ Set to build some programs without Kerbe .Xr sshd 8 , and .Xr telnetd 8 . +.It Va WITHOUT_KERNEL_SYMBOLS +.\" from FreeBSD: head/tools/build/options/WITHOUT_KERNEL_SYMBOLS 222189 2011-05-22 18:23:17Z imp +Set to not install kernel symbol files. +.Bf -symbolic +This option is recommended for those people who have small root partitions. +.Ef .It Va WITHOUT_KVM .\" from FreeBSD: head/tools/build/options/WITHOUT_KVM 174550 2007-12-12 16:43:17Z ru Set to not build the @@ -1077,9 +1089,6 @@ and related programs. .It Va WITHOUT_USB .\" from FreeBSD: head/tools/build/options/WITHOUT_USB 156932 2006-03-21 07:50:50Z ru Set to not build USB-related programs and libraries. -.It Va WITH_USB_GADGET_EXAMPLES -.\" from FreeBSD: head/tools/build/options/WITH_USB_GADGET_EXAMPLES 254919 2013-08-26 17:15:56Z antoine -Set to build USB gadget kernel modules. .It Va WITHOUT_UTMPX .\" from FreeBSD: head/tools/build/options/WITHOUT_UTMPX 231530 2012-02-11 20:28:42Z ed Set to not build user accounting tools such as From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 20:44:33 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E0AE1B66; Tue, 21 Oct 2014 20:44:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CCF2F6B2; Tue, 21 Oct 2014 20:44:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LKiX0n083656; Tue, 21 Oct 2014 20:44:33 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LKiXNk083655; Tue, 21 Oct 2014 20:44:33 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201410212044.s9LKiXNk083655@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 21 Oct 2014 20:44:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273421 - head/tools/build/options X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 20:44:34 -0000 Author: emaste Date: Tue Oct 21 20:44:33 2014 New Revision: 273421 URL: https://svnweb.freebsd.org/changeset/base/273421 Log: Fix typo in src option description Modified: head/tools/build/options/WITHOUT_GNU_GREP_COMPAT Modified: head/tools/build/options/WITHOUT_GNU_GREP_COMPAT ============================================================================== --- head/tools/build/options/WITHOUT_GNU_GREP_COMPAT Tue Oct 21 20:41:19 2014 (r273420) +++ head/tools/build/options/WITHOUT_GNU_GREP_COMPAT Tue Oct 21 20:44:33 2014 (r273421) @@ -1,3 +1,3 @@ .\" $FreeBSD$ -Set this option to omit the gnu extentions to grep from being included in +Set this option to omit the gnu extensions to grep from being included in BSD grep. From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 20:44:54 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9E6FDCA4; Tue, 21 Oct 2014 20:44:54 +0000 (UTC) Received: from mail.turbocat.net (mail.turbocat.net [IPv6:2a01:4f8:d16:4514::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 44D7D6BC; Tue, 21 Oct 2014 20:44:54 +0000 (UTC) Received: from laptop015.home.selasky.org (cm-176.74.213.204.customer.telag.net [176.74.213.204]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id C3B6D1FE023; Tue, 21 Oct 2014 22:44:42 +0200 (CEST) Message-ID: <5446C5BF.6080508@selasky.org> Date: Tue, 21 Oct 2014 22:44:47 +0200 From: Hans Petter Selasky User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.1.2 MIME-Version: 1.0 To: Konstantin Belousov Subject: Re: svn commit: r273377 - in head: share/man/man9 sys/amd64/amd64 sys/arm/arm sys/cam/scsi sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/dev/dtrace sys/compat/ndis sys/dev/acpi_support sys/de... References: <201410210731.s9L7VMww096983@svn.freebsd.org> <20141021161602.GD1877@kib.kiev.ua> In-Reply-To: <20141021161602.GD1877@kib.kiev.ua> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 20:44:54 -0000 On 10/21/14 18:16, Konstantin Belousov wrote: > On Tue, Oct 21, 2014 at 07:31:22AM +0000, Hans Petter Selasky wrote: >> Author: hselasky >> Date: Tue Oct 21 07:31:21 2014 >> New Revision: 273377 >> URL: https://svnweb.freebsd.org/changeset/base/273377 >> >> Log: >> Fix multiple incorrect SYSCTL arguments in the kernel: >> >> - Wrong integer type was specified. >> >> - Wrong or missing "access" specifier. The "access" specifier >> sometimes included the SYSCTL type, which it should not, except for >> procedural SYSCTL nodes. >> >> - Logical OR where binary OR was expected. >> >> - Properly assert the "access" argument passed to all SYSCTL macros, >> using the CTASSERT macro. This applies to both static- and dynamically >> created SYSCTLs. >> >> - Properly assert the the data type for both static and dynamic >> SYSCTLs. In the case of static SYSCTLs we only assert that the data >> pointed to by the SYSCTL data pointer has the correct size, hence >> there is no easy way to assert types in the C language outside a >> C-function. >> >> - Rewrote some code which doesn't pass a constant "access" specifier >> when creating dynamic SYSCTL nodes, which is now a requirement. >> >> - Updated "EXAMPLES" section in SYSCTL manual page. >> >> MFC after: 3 days >> Sponsored by: Mellanox Technologies >> >> Modified: >> head/share/man/man9/Makefile >> head/share/man/man9/sysctl.9 >> head/sys/amd64/amd64/fpu.c >> head/sys/arm/arm/busdma_machdep-v6.c >> head/sys/arm/arm/busdma_machdep.c >> head/sys/cam/scsi/scsi_sa.c >> head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c >> head/sys/cddl/dev/dtrace/dtrace_sysctl.c >> head/sys/compat/ndis/kern_ndis.c >> head/sys/dev/acpi_support/acpi_asus.c >> head/sys/dev/acpi_support/acpi_asus_wmi.c >> head/sys/dev/acpi_support/acpi_hp.c >> head/sys/dev/acpi_support/acpi_ibm.c >> head/sys/dev/acpi_support/acpi_rapidstart.c >> head/sys/dev/acpi_support/acpi_sony.c >> head/sys/dev/bxe/bxe.c >> head/sys/dev/cxgb/cxgb_sge.c >> head/sys/dev/cxgbe/t4_main.c >> head/sys/dev/e1000/if_em.c >> head/sys/dev/e1000/if_igb.c >> head/sys/dev/e1000/if_lem.c >> head/sys/dev/hatm/if_hatm.c >> head/sys/dev/ixgbe/ixgbe.c >> head/sys/dev/ixgbe/ixv.c >> head/sys/dev/ixl/if_ixl.c >> head/sys/dev/mpr/mpr.c >> head/sys/dev/mps/mps.c >> head/sys/dev/mrsas/mrsas.c >> head/sys/dev/mrsas/mrsas.h >> head/sys/dev/mxge/if_mxge.c >> head/sys/dev/oce/oce_sysctl.c >> head/sys/dev/qlxgb/qla_os.c >> head/sys/dev/qlxgbe/ql_os.c >> head/sys/dev/rt/if_rt.c >> head/sys/dev/sound/pci/hda/hdaa.c >> head/sys/dev/vxge/vxge.c >> head/sys/dev/xen/netfront/netfront.c >> head/sys/fs/devfs/devfs_devs.c >> head/sys/fs/fuse/fuse_main.c >> head/sys/fs/fuse/fuse_vfsops.c >> head/sys/geom/geom_kern.c >> head/sys/kern/kern_cpuset.c >> head/sys/kern/kern_descrip.c >> head/sys/kern/kern_mib.c >> head/sys/kern/kern_synch.c >> head/sys/kern/subr_devstat.c >> head/sys/kern/subr_kdb.c >> head/sys/kern/subr_uio.c >> head/sys/kern/vfs_cache.c >> head/sys/mips/mips/busdma_machdep.c >> head/sys/net80211/ieee80211_ht.c >> head/sys/net80211/ieee80211_hwmp.c >> head/sys/net80211/ieee80211_mesh.c >> head/sys/net80211/ieee80211_superg.c >> head/sys/netgraph/bluetooth/common/ng_bluetooth.c >> head/sys/netgraph/ng_base.c >> head/sys/netgraph/ng_socket.c >> head/sys/netinet/cc/cc_chd.c >> head/sys/netinet/tcp_timer.c >> head/sys/netipsec/ipsec.h >> head/sys/netpfil/pf/pf.c >> head/sys/ofed/drivers/net/mlx4/mlx4_en.h >> head/sys/powerpc/powermac/fcu.c >> head/sys/powerpc/powermac/smu.c >> head/sys/powerpc/powerpc/cpu.c >> head/sys/sys/sysctl.h >> head/sys/vm/memguard.c >> head/sys/vm/vm_kern.c >> head/sys/x86/x86/busdma_bounce.c > > This seems to break at least PowerPC 64bit, or some bits were not > committed. I have to add the following change to compile GENERIC64 > kernel, otherwise I get > > cc1: warnings being treated as errors > /usr/home/kostik/work/build/bsd/DEV/src/sys/powerpc/powerpc/busdma_machdep.c: In function 'alloc_bounce_zone': > /usr/home/kostik/work/build/bsd/DEV/src/sys/powerpc/powerpc/busdma_machdep.c:1030: warning: initialization from incompatible pointer type > *** [busdma_machdep.o] Error code 1 > > OTOH, I did not verified that 32bit PowerPC kernel is compilable with > the change applied. > > diff --git a/sys/powerpc/powerpc/busdma_machdep.c b/sys/powerpc/powerpc/busdma_machdep.c > index e35ecec..b58a91b 100644 > --- a/sys/powerpc/powerpc/busdma_machdep.c > +++ b/sys/powerpc/powerpc/busdma_machdep.c > @@ -1027,9 +1027,9 @@ alloc_bounce_zone(bus_dma_tag_t dmat) > SYSCTL_ADD_STRING(busdma_sysctl_tree(bz), > SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO, > "lowaddr", CTLFLAG_RD, bz->lowaddrid, 0, ""); > - SYSCTL_ADD_INT(busdma_sysctl_tree(bz), > + SYSCTL_ADD_ULONG(busdma_sysctl_tree(bz), > SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO, > - "alignment", CTLFLAG_RD, &bz->alignment, 0, ""); > + "alignment", CTLFLAG_RD, &bz->alignment, ""); > > return (0); > } > > It think it is better to have it UAUTO, so that the macro will choose 32-bit or 64-bit. Sorry for the breakage. Thought that universe had passed. Will fix it shortly. --HPS From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 21:03:50 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5B79E166; Tue, 21 Oct 2014 21:03:50 +0000 (UTC) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 15AAD8E2; Tue, 21 Oct 2014 21:03:50 +0000 (UTC) Received: from slw by zxy.spb.ru with local (Exim 4.82 (FreeBSD)) (envelope-from ) id 1Xggai-0000nD-JK; Wed, 22 Oct 2014 01:03:40 +0400 Date: Wed, 22 Oct 2014 01:03:40 +0400 From: Slawa Olhovchenkov To: Mateusz Guzik Subject: Re: svn commit: r273335 - head/sys/fs/unionfs Message-ID: <20141021210340.GA2178@zxy.spb.ru> References: <201410201753.s9KHrnaG009500@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201410201753.s9KHrnaG009500@svn.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 21:03:50 -0000 On Mon, Oct 20, 2014 at 05:53:49PM +0000, Mateusz Guzik wrote: > Author: mjg > Date: Mon Oct 20 17:53:49 2014 > New Revision: 273335 > URL: https://svnweb.freebsd.org/changeset/base/273335 > > Log: > unionfs: hold mount interlock while manipulating mnt_flag > > This is for consistency with other filesystems. Can you check interoperability unionfs with zfs and devfs? I have crashed unionfs with zfs. unionfs with devfs need double devfs mount. > Modified: > head/sys/fs/unionfs/union_vfsops.c > > Modified: head/sys/fs/unionfs/union_vfsops.c > ============================================================================== > --- head/sys/fs/unionfs/union_vfsops.c Mon Oct 20 17:04:03 2014 (r273334) > +++ head/sys/fs/unionfs/union_vfsops.c Mon Oct 20 17:53:49 2014 (r273335) > @@ -290,12 +290,14 @@ unionfs_domount(struct mount *mp) > return (error); > } > > + MNT_ILOCK(mp); > /* > * Check mnt_flag > */ > if ((ump->um_lowervp->v_mount->mnt_flag & MNT_LOCAL) && > (ump->um_uppervp->v_mount->mnt_flag & MNT_LOCAL)) > mp->mnt_flag |= MNT_LOCAL; > + MNT_IUNLOCK(mp); > > /* > * Get new fsid > _______________________________________________ > svn-src-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 21:04:45 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 149042A4; Tue, 21 Oct 2014 21:04:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 00A038E7; Tue, 21 Oct 2014 21:04:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LL4iKR093313; Tue, 21 Oct 2014 21:04:44 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LL4iaZ093312; Tue, 21 Oct 2014 21:04:44 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201410212104.s9LL4iaZ093312@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 21 Oct 2014 21:04:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273423 - head/sys/powerpc/powerpc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 21:04:45 -0000 Author: hselasky Date: Tue Oct 21 21:04:44 2014 New Revision: 273423 URL: https://svnweb.freebsd.org/changeset/base/273423 Log: Use the UAUTO SYSCTL type for exporting the bounce zone alignment, because the variable size depends on the build type. Reported by: kib @ MFC after: 3 days Modified: head/sys/powerpc/powerpc/busdma_machdep.c Modified: head/sys/powerpc/powerpc/busdma_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/busdma_machdep.c Tue Oct 21 20:51:22 2014 (r273422) +++ head/sys/powerpc/powerpc/busdma_machdep.c Tue Oct 21 21:04:44 2014 (r273423) @@ -1027,9 +1027,9 @@ alloc_bounce_zone(bus_dma_tag_t dmat) SYSCTL_ADD_STRING(busdma_sysctl_tree(bz), SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO, "lowaddr", CTLFLAG_RD, bz->lowaddrid, 0, ""); - SYSCTL_ADD_INT(busdma_sysctl_tree(bz), + SYSCTL_ADD_UAUTO(busdma_sysctl_tree(bz), SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO, - "alignment", CTLFLAG_RD, &bz->alignment, 0, ""); + "alignment", CTLFLAG_RD, &bz->alignment, ""); return (0); } From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 21:08:46 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B807044C; Tue, 21 Oct 2014 21:08:46 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A4FD591B; Tue, 21 Oct 2014 21:08:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LL8kxU093928; Tue, 21 Oct 2014 21:08:46 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LL8kIa093927; Tue, 21 Oct 2014 21:08:46 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410212108.s9LL8kIa093927@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 21 Oct 2014 21:08:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273424 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 21:08:46 -0000 Author: mjg Date: Tue Oct 21 21:08:45 2014 New Revision: 273424 URL: https://svnweb.freebsd.org/changeset/base/273424 Log: Mark some more sysctl stuff shared-locked and MPSAFE. Modified: head/sys/kern/kern_sysctl.c Modified: head/sys/kern/kern_sysctl.c ============================================================================== --- head/sys/kern/kern_sysctl.c Tue Oct 21 21:04:44 2014 (r273423) +++ head/sys/kern/kern_sysctl.c Tue Oct 21 21:08:45 2014 (r273424) @@ -755,7 +755,7 @@ sysctl_sysctl_debug_dump_node(struct sys int k; struct sysctl_oid *oidp; - SYSCTL_ASSERT_XLOCKED(); + SYSCTL_ASSERT_LOCKED(); SLIST_FOREACH(oidp, l, oid_link) { for (k=0; ktd, PRIV_SYSCTL_DEBUG); if (error) return (error); - SYSCTL_XLOCK(); + SYSCTL_SLOCK(); sysctl_sysctl_debug_dump_node(&sysctl__children, 0); - SYSCTL_XUNLOCK(); + SYSCTL_SUNLOCK(); return (ENOENT); } -SYSCTL_PROC(_sysctl, 0, debug, CTLTYPE_STRING|CTLFLAG_RD, +SYSCTL_PROC(_sysctl, 0, debug, CTLTYPE_STRING|CTLFLAG_RD|CTLFLAG_MPSAFE, 0, 0, sysctl_sysctl_debug, "-", ""); #endif @@ -820,7 +820,7 @@ sysctl_sysctl_name(SYSCTL_HANDLER_ARGS) struct sysctl_oid_list *lsp = &sysctl__children, *lsp2; char buf[10]; - SYSCTL_XLOCK(); + SYSCTL_SLOCK(); while (namelen) { if (!lsp) { snprintf(buf,sizeof(buf),"%d",*name); @@ -863,7 +863,7 @@ sysctl_sysctl_name(SYSCTL_HANDLER_ARGS) } error = SYSCTL_OUT(req, "", 1); out: - SYSCTL_XUNLOCK(); + SYSCTL_SUNLOCK(); return (error); } @@ -871,7 +871,7 @@ sysctl_sysctl_name(SYSCTL_HANDLER_ARGS) * XXXRW/JA: Shouldn't return name data for nodes that we don't permit in * capability mode. */ -static SYSCTL_NODE(_sysctl, 1, name, CTLFLAG_RD | CTLFLAG_CAPRD, +static SYSCTL_NODE(_sysctl, 1, name, CTLFLAG_RD | CTLFLAG_MPSAFE | CTLFLAG_CAPRD, sysctl_sysctl_name, ""); static int @@ -944,9 +944,9 @@ sysctl_sysctl_next(SYSCTL_HANDLER_ARGS) struct sysctl_oid_list *lsp = &sysctl__children; int newoid[CTL_MAXNAME]; - SYSCTL_XLOCK(); + SYSCTL_SLOCK(); i = sysctl_sysctl_next_ls(lsp, name, namelen, newoid, &j, 1, &oid); - SYSCTL_XUNLOCK(); + SYSCTL_SUNLOCK(); if (i) return (ENOENT); error = SYSCTL_OUT(req, newoid, j * sizeof (int)); @@ -957,7 +957,7 @@ sysctl_sysctl_next(SYSCTL_HANDLER_ARGS) * XXXRW/JA: Shouldn't return next data for nodes that we don't permit in * capability mode. */ -static SYSCTL_NODE(_sysctl, 2, next, CTLFLAG_RD | CTLFLAG_CAPRD, +static SYSCTL_NODE(_sysctl, 2, next, CTLFLAG_RD | CTLFLAG_MPSAFE | CTLFLAG_CAPRD, sysctl_sysctl_next, ""); static int @@ -1048,7 +1048,7 @@ sysctl_sysctl_oidfmt(SYSCTL_HANDLER_ARGS struct sysctl_oid *oid; int error; - SYSCTL_XLOCK(); + SYSCTL_SLOCK(); error = sysctl_find_oid(arg1, arg2, &oid, NULL, req); if (error) goto out; @@ -1062,7 +1062,7 @@ sysctl_sysctl_oidfmt(SYSCTL_HANDLER_ARGS goto out; error = SYSCTL_OUT(req, oid->oid_fmt, strlen(oid->oid_fmt) + 1); out: - SYSCTL_XUNLOCK(); + SYSCTL_SUNLOCK(); return (error); } @@ -1076,7 +1076,7 @@ sysctl_sysctl_oiddescr(SYSCTL_HANDLER_AR struct sysctl_oid *oid; int error; - SYSCTL_XLOCK(); + SYSCTL_SLOCK(); error = sysctl_find_oid(arg1, arg2, &oid, NULL, req); if (error) goto out; @@ -1087,11 +1087,11 @@ sysctl_sysctl_oiddescr(SYSCTL_HANDLER_AR } error = SYSCTL_OUT(req, oid->oid_descr, strlen(oid->oid_descr) + 1); out: - SYSCTL_XUNLOCK(); + SYSCTL_SUNLOCK(); return (error); } -static SYSCTL_NODE(_sysctl, 5, oiddescr, CTLFLAG_RD|CTLFLAG_CAPRD, +static SYSCTL_NODE(_sysctl, 5, oiddescr, CTLFLAG_RD|CTLFLAG_MPSAFE|CTLFLAG_CAPRD, sysctl_sysctl_oiddescr, ""); /* From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 21:09:55 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 32067599; Tue, 21 Oct 2014 21:09:55 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 03F88928; Tue, 21 Oct 2014 21:09:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LL9sHB094326; Tue, 21 Oct 2014 21:09:54 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LL9s3g094325; Tue, 21 Oct 2014 21:09:54 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410212109.s9LL9s3g094325@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 21 Oct 2014 21:09:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r273425 - stable/9/lib/libcrypt X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 21:09:55 -0000 Author: delphij Date: Tue Oct 21 21:09:54 2014 New Revision: 273425 URL: https://svnweb.freebsd.org/changeset/base/273425 Log: MFC r272830 (des): Change the hardcoded default back from SHA512 to DES. This will become EN-14:11.crypt. PR: 192277 Modified: stable/9/lib/libcrypt/crypt.c Directory Properties: stable/9/lib/libcrypt/ (props changed) Modified: stable/9/lib/libcrypt/crypt.c ============================================================================== --- stable/9/lib/libcrypt/crypt.c Tue Oct 21 21:08:45 2014 (r273424) +++ stable/9/lib/libcrypt/crypt.c Tue Oct 21 21:09:54 2014 (r273425) @@ -37,24 +37,26 @@ __FBSDID("$FreeBSD$"); #include "crypt.h" /* - * List of supported crypt(3) formats. The first element in the list will - * be the default. + * List of supported crypt(3) formats. + * + * The default algorithm is the last entry in the list (second-to-last + * array element since the last is a sentinel). The reason for placing + * the default last rather than first is that DES needs to be at the + * bottom for the algorithm guessing logic in crypt(3) to work correctly, + * and it needs to be the default for backward compatibility. */ static const struct crypt_format { const char *const name; char *(*const func)(const char *, const char *); const char *const magic; } crypt_formats[] = { - /* default format */ - { "sha512", crypt_sha512, "$6$" }, - - /* other supported formats */ { "md5", crypt_md5, "$1$" }, #ifdef HAS_BLOWFISH { "blf", crypt_blowfish, "$2" }, #endif { "nth", crypt_nthash, "$3$" }, { "sha256", crypt_sha256, "$5$" }, + { "sha512", crypt_sha512, "$6$" }, #ifdef HAS_DES { "des", crypt_des, "_" }, #endif @@ -63,7 +65,8 @@ static const struct crypt_format { { NULL, NULL, NULL } }; -static const struct crypt_format *crypt_format = &crypt_formats[0]; +static const struct crypt_format *crypt_format = + &crypt_formats[(sizeof crypt_formats / sizeof *crypt_formats) - 2]; #define DES_SALT_ALPHABET \ "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 21:09:55 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4952A59A; Tue, 21 Oct 2014 21:09:55 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 364F292A; Tue, 21 Oct 2014 21:09:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LL9td9094347; Tue, 21 Oct 2014 21:09:55 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LL9tCB094346; Tue, 21 Oct 2014 21:09:55 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410212109.s9LL9tCB094346@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 21 Oct 2014 21:09:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273426 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 21:09:55 -0000 Author: bapt Date: Tue Oct 21 21:09:54 2014 New Revision: 273426 URL: https://svnweb.freebsd.org/changeset/base/273426 Log: older binutils does not know about --no-fatal-warnings Modified: head/share/mk/bsd.lib.mk Modified: head/share/mk/bsd.lib.mk ============================================================================== --- head/share/mk/bsd.lib.mk Tue Oct 21 21:09:54 2014 (r273425) +++ head/share/mk/bsd.lib.mk Tue Oct 21 21:09:54 2014 (r273426) @@ -207,7 +207,7 @@ _LIBS+= ${SHLIB_NAME} SOLINKOPTS= -shared -Wl,-x .if !defined(ALLOW_SHARED_TEXTREL) -SOLINKOPTS+= -Wl,--no-fatal-warnings -Wl,--warn-shared-textrel +SOLINKOPTS+= -Wl,--warn-shared-textrel .endif .if target(beforelinking) From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 21:11:26 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 24EA784C; Tue, 21 Oct 2014 21:11:26 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 10BE59CA; Tue, 21 Oct 2014 21:11:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LLBPgQ095231; Tue, 21 Oct 2014 21:11:25 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LLBPho095230; Tue, 21 Oct 2014 21:11:25 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410212111.s9LLBPho095230@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 21 Oct 2014 21:11:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r273427 - stable/9/usr.sbin/pw X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 21:11:26 -0000 Author: delphij Date: Tue Oct 21 21:11:25 2014 New Revision: 273427 URL: https://svnweb.freebsd.org/changeset/base/273427 Log: MFC r272833 (des): Two more places where login_setcryptfmt() defaults to MD5 were missed in r252688. Modified: stable/9/usr.sbin/pw/pw_user.c Directory Properties: stable/9/usr.sbin/pw/ (props changed) Modified: stable/9/usr.sbin/pw/pw_user.c ============================================================================== --- stable/9/usr.sbin/pw/pw_user.c Tue Oct 21 21:09:54 2014 (r273426) +++ stable/9/usr.sbin/pw/pw_user.c Tue Oct 21 21:11:25 2014 (r273427) @@ -586,7 +586,7 @@ pw_user(struct userconf * cnf, int mode, pwd->pw_dir = pw_homepolicy(cnf, args, pwd->pw_name); pwd->pw_shell = pw_shellpolicy(cnf, args, NULL); lc = login_getpwclass(pwd); - if (lc == NULL || login_setcryptfmt(lc, "md5", NULL) == NULL) + if (lc == NULL || login_setcryptfmt(lc, "sha512", NULL) == NULL) warn("setting crypt(3) format"); login_close(lc); pwd->pw_passwd = pw_password(cnf, args, pwd->pw_name); @@ -661,7 +661,7 @@ pw_user(struct userconf * cnf, int mode, } else { lc = login_getpwclass(pwd); if (lc == NULL || - login_setcryptfmt(lc, "md5", NULL) == NULL) + login_setcryptfmt(lc, "sha512", NULL) == NULL) warn("setting crypt(3) format"); login_close(lc); pwd->pw_passwd = pw_pwcrypt(line); From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 21:17:45 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1FCD6A4; Tue, 21 Oct 2014 21:17:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0CB11C87; Tue, 21 Oct 2014 21:17:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LLHiCw099030; Tue, 21 Oct 2014 21:17:44 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LLHis1099029; Tue, 21 Oct 2014 21:17:44 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410212117.s9LLHis1099029@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 21 Oct 2014 21:17:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273428 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 21:17:45 -0000 Author: bapt Date: Tue Oct 21 21:17:44 2014 New Revision: 273428 URL: https://svnweb.freebsd.org/changeset/base/273428 Log: Revert r273426 r273409 A solution that work with both new and old binutils should be investigated Modified: head/share/mk/bsd.lib.mk Modified: head/share/mk/bsd.lib.mk ============================================================================== --- head/share/mk/bsd.lib.mk Tue Oct 21 21:11:25 2014 (r273427) +++ head/share/mk/bsd.lib.mk Tue Oct 21 21:17:44 2014 (r273428) @@ -207,7 +207,7 @@ _LIBS+= ${SHLIB_NAME} SOLINKOPTS= -shared -Wl,-x .if !defined(ALLOW_SHARED_TEXTREL) -SOLINKOPTS+= -Wl,--warn-shared-textrel +SOLINKOPTS+= -Wl,--fatal-warnings -Wl,--warn-shared-textrel .endif .if target(beforelinking) From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 21:27:14 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A517361D; Tue, 21 Oct 2014 21:27:14 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 917E9F4F; Tue, 21 Oct 2014 21:27:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LLREto003940; Tue, 21 Oct 2014 21:27:14 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LLREDw003939; Tue, 21 Oct 2014 21:27:14 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410212127.s9LLREDw003939@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 21 Oct 2014 21:27:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273430 - head/sys/fs/tmpfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 21:27:14 -0000 Author: mjg Date: Tue Oct 21 21:27:13 2014 New Revision: 273430 URL: https://svnweb.freebsd.org/changeset/base/273430 Log: tmpfs: allow shared file lookups Tested by: pho Modified: head/sys/fs/tmpfs/tmpfs_vfsops.c Modified: head/sys/fs/tmpfs/tmpfs_vfsops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vfsops.c Tue Oct 21 21:27:13 2014 (r273429) +++ head/sys/fs/tmpfs/tmpfs_vfsops.c Tue Oct 21 21:27:13 2014 (r273430) @@ -255,7 +255,7 @@ tmpfs_mount(struct mount *mp) MNT_ILOCK(mp); mp->mnt_flag |= MNT_LOCAL; - mp->mnt_kern_flag |= MNTK_SUSPENDABLE; + mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_SUSPENDABLE; MNT_IUNLOCK(mp); mp->mnt_data = tmp; From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 21:27:14 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9C23861A; Tue, 21 Oct 2014 21:27:14 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 87D36F4E; Tue, 21 Oct 2014 21:27:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LLREDK003938; Tue, 21 Oct 2014 21:27:14 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LLREot003937; Tue, 21 Oct 2014 21:27:14 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201410212127.s9LLREot003937@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 21 Oct 2014 21:27:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273429 - stable/10/sys/dev/hyperv/storvsc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 21:27:14 -0000 Author: gjb Date: Tue Oct 21 21:27:13 2014 New Revision: 273429 URL: https://svnweb.freebsd.org/changeset/base/273429 Log: MFC r273402: Fix an issue where a FreeBSD virtual machine provisioned in the Microsoft Azure service does not recognize the second attached disk on the system. PR: 194376 Insta-MFC OK: re (rodrigc) Sponsored by: The FreeBSD Foundation Modified: stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Oct 21 21:17:44 2014 (r273428) +++ stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Oct 21 21:27:13 2014 (r273429) @@ -75,7 +75,7 @@ __FBSDID("$FreeBSD$"); #define STORVSC_MAX_IO_REQUESTS (STORVSC_MAX_LUNS_PER_TARGET * 2) #define BLKVSC_MAX_IDE_DISKS_PER_TARGET (1) #define BLKVSC_MAX_IO_REQUESTS STORVSC_MAX_IO_REQUESTS -#define STORVSC_MAX_TARGETS (1) +#define STORVSC_MAX_TARGETS (2) struct storvsc_softc; @@ -584,7 +584,6 @@ hv_storvsc_on_iocompletion(struct storvs vm_srb = &vstor_packet->u.vm_srb; - request->sense_info_len = 0; if (((vm_srb->scsi_status & 0xFF) == SCSI_STATUS_CHECK_COND) && (vm_srb->srb_status & SRB_STATUS_AUTOSENSE_VALID)) { /* Autosense data available */ From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 21:29:21 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 82AC58CC; Tue, 21 Oct 2014 21:29:21 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6F248F6C; Tue, 21 Oct 2014 21:29:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LLTLWA004326; Tue, 21 Oct 2014 21:29:21 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LLTL7Y004325; Tue, 21 Oct 2014 21:29:21 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410212129.s9LLTL7Y004325@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 21 Oct 2014 21:29:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273431 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 21:29:21 -0000 Author: mjg Date: Tue Oct 21 21:29:20 2014 New Revision: 273431 URL: https://svnweb.freebsd.org/changeset/base/273431 Log: Take the lock shared in linker_search_symbol_name. This helps sysctl kern.proc.stack. Modified: head/sys/kern/kern_linker.c Modified: head/sys/kern/kern_linker.c ============================================================================== --- head/sys/kern/kern_linker.c Tue Oct 21 21:27:13 2014 (r273430) +++ head/sys/kern/kern_linker.c Tue Oct 21 21:29:20 2014 (r273431) @@ -986,9 +986,9 @@ linker_search_symbol_name(caddr_t value, { int error; - sx_xlock(&kld_sx); + sx_slock(&kld_sx); error = linker_debug_search_symbol_name(value, buf, buflen, offset); - sx_xunlock(&kld_sx); + sx_sunlock(&kld_sx); return (error); } From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 21:32:44 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7EF14B6B; Tue, 21 Oct 2014 21:32:44 +0000 (UTC) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.59.238]) by mx1.freebsd.org (Postfix) with ESMTP id 3F764C4; Tue, 21 Oct 2014 21:32:42 +0000 (UTC) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id 4D9057300B; Tue, 21 Oct 2014 23:36:21 +0200 (CEST) Date: Tue, 21 Oct 2014 23:36:21 +0200 From: Luigi Rizzo To: Andriy Gapon Subject: Re: svn commit: r273274 - head/sys/netpfil/ipfw Message-ID: <20141021213621.GA70907@onelab2.iet.unipi.it> References: <201410191115.s9JBFJxA058370@svn.freebsd.org> <5443A83F.5090807@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5443A83F.5090807@FreeBSD.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, "Alexander V. Chernikov" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 21:32:44 -0000 On Sun, Oct 19, 2014 at 03:02:07PM +0300, Andriy Gapon wrote: > On 19/10/2014 14:15, Alexander V. Chernikov wrote: > > +static uint32_t > > +roundup2p(uint32_t v) > > +{ > > + > > + v--; > > + v |= v >> 1; > > + v |= v >> 2; > > + v |= v >> 4; > > + v |= v >> 8; > > + v |= v >> 16; > > + v++; > > + > > + return (v); > > +} > > I think that on platforms where an optimized version of fls() is available that > would work faster than this cool piece of bit magic. This code is not performance critical. I wouldn't bother optimizing it. Rather, since this code must be platform independent, I'd like to give it a name that does not conflict with any builtin. cheers luigi > From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 21:37:55 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2BA39F56; Tue, 21 Oct 2014 21:37:55 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 16285139; Tue, 21 Oct 2014 21:37:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LLbsuJ008909; Tue, 21 Oct 2014 21:37:54 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LLbskG008908; Tue, 21 Oct 2014 21:37:54 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201410212137.s9LLbskG008908@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 21 Oct 2014 21:37:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273432 - head/sys/sys stable/10/sys/sys stable/8/sys/sys stable/9/sys/sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 21:37:55 -0000 Author: gjb Date: Tue Oct 21 21:37:53 2014 New Revision: 273432 URL: https://svnweb.freebsd.org/changeset/base/273432 Log: Bump __FreeBSD_version to track SA-14:20, SA-14:21, SA-14:22, SA-14:23 Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: stable/10/sys/sys/param.h Changes in other areas also in this revision: Modified: head/sys/sys/param.h stable/8/sys/sys/param.h stable/9/sys/sys/param.h Modified: stable/10/sys/sys/param.h ============================================================================== --- stable/10/sys/sys/param.h Tue Oct 21 21:29:20 2014 (r273431) +++ stable/10/sys/sys/param.h Tue Oct 21 21:37:53 2014 (r273432) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1001500 /* Master, propagated to newvers */ +#define __FreeBSD_version 1001501 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 21:37:54 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A208CF55; Tue, 21 Oct 2014 21:37:54 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8D0D7138; Tue, 21 Oct 2014 21:37:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LLbsWf008902; Tue, 21 Oct 2014 21:37:54 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LLbsaH008901; Tue, 21 Oct 2014 21:37:54 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201410212137.s9LLbsaH008901@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 21 Oct 2014 21:37:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r273432 - head/sys/sys stable/10/sys/sys stable/8/sys/sys stable/9/sys/sys X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 21:37:54 -0000 Author: gjb Date: Tue Oct 21 21:37:53 2014 New Revision: 273432 URL: https://svnweb.freebsd.org/changeset/base/273432 Log: Bump __FreeBSD_version to track SA-14:20, SA-14:21, SA-14:22, SA-14:23 Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: stable/8/sys/sys/param.h Changes in other areas also in this revision: Modified: head/sys/sys/param.h stable/10/sys/sys/param.h stable/9/sys/sys/param.h Modified: stable/8/sys/sys/param.h ============================================================================== --- stable/8/sys/sys/param.h Tue Oct 21 21:29:20 2014 (r273431) +++ stable/8/sys/sys/param.h Tue Oct 21 21:37:53 2014 (r273432) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 804505 /* Master, propagated to newvers */ +#define __FreeBSD_version 804506 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 21:37:55 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9CFBBF57; Tue, 21 Oct 2014 21:37:55 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 869D813A; Tue, 21 Oct 2014 21:37:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LLbtY4008919; Tue, 21 Oct 2014 21:37:55 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LLbtvb008918; Tue, 21 Oct 2014 21:37:55 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201410212137.s9LLbtvb008918@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 21 Oct 2014 21:37:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273432 - head/sys/sys stable/10/sys/sys stable/8/sys/sys stable/9/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 21:37:55 -0000 Author: gjb Date: Tue Oct 21 21:37:53 2014 New Revision: 273432 URL: https://svnweb.freebsd.org/changeset/base/273432 Log: Bump __FreeBSD_version to track SA-14:20, SA-14:21, SA-14:22, SA-14:23 Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: head/sys/sys/param.h Changes in other areas also in this revision: Modified: stable/10/sys/sys/param.h stable/8/sys/sys/param.h stable/9/sys/sys/param.h Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Tue Oct 21 21:29:20 2014 (r273431) +++ head/sys/sys/param.h Tue Oct 21 21:37:53 2014 (r273432) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1100039 /* Master, propagated to newvers */ +#define __FreeBSD_version 1100040 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 21:37:56 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 55E60A8; Tue, 21 Oct 2014 21:37:56 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2690413B; Tue, 21 Oct 2014 21:37:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LLbu8s008928; Tue, 21 Oct 2014 21:37:56 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LLbuxZ008927; Tue, 21 Oct 2014 21:37:56 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201410212137.s9LLbuxZ008927@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 21 Oct 2014 21:37:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r273432 - head/sys/sys stable/10/sys/sys stable/8/sys/sys stable/9/sys/sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 21:37:56 -0000 Author: gjb Date: Tue Oct 21 21:37:53 2014 New Revision: 273432 URL: https://svnweb.freebsd.org/changeset/base/273432 Log: Bump __FreeBSD_version to track SA-14:20, SA-14:21, SA-14:22, SA-14:23 Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: stable/9/sys/sys/param.h Changes in other areas also in this revision: Modified: head/sys/sys/param.h stable/10/sys/sys/param.h stable/8/sys/sys/param.h Modified: stable/9/sys/sys/param.h ============================================================================== --- stable/9/sys/sys/param.h Tue Oct 21 21:29:20 2014 (r273431) +++ stable/9/sys/sys/param.h Tue Oct 21 21:37:53 2014 (r273432) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 903504 /* Master, propagated to newvers */ +#define __FreeBSD_version 903505 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 21:40:48 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C1F61548; Tue, 21 Oct 2014 21:40:48 +0000 (UTC) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 6CDBA1F7; Tue, 21 Oct 2014 21:40:48 +0000 (UTC) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 059AA25D3A91; Tue, 21 Oct 2014 21:40:44 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 30386C76FD8; Tue, 21 Oct 2014 21:40:44 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id CCBEGO7UnBRc; Tue, 21 Oct 2014 21:40:42 +0000 (UTC) Received: from [IPv6:fde9:577b:c1a9:4420:cabc:c8ff:fe8b:4fe6] (orange-tun0-ula.sbone.de [IPv6:fde9:577b:c1a9:4420:cabc:c8ff:fe8b:4fe6]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id E11BDC76FD0; Tue, 21 Oct 2014 21:40:40 +0000 (UTC) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: svn commit: r273400 - in head/sys: kern sys From: "Bjoern A. Zeeb" In-Reply-To: <201410211902.s9LJ2RoA031960@svn.freebsd.org> Date: Tue, 21 Oct 2014 21:40:38 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <50143173-0319-45C0-A00E-AD2AA303C65D@FreeBSD.org> References: <201410211902.s9LJ2RoA031960@svn.freebsd.org> To: Mateusz Guzik X-Mailer: Apple Mail (2.1878.6) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 21:40:48 -0000 On 21 Oct 2014, at 19:02 , Mateusz Guzik wrote: > Author: mjg > Date: Tue Oct 21 19:02:26 2014 > New Revision: 273400 > URL: https://svnweb.freebsd.org/changeset/base/273400 >=20 > Log: > Rename sysctl_lock and _unlock to sysctl_xlock and _xunlock. You are perfectly describing what you are doing, but I=92d also like to = understand the =93why?=94 >=20 > Modified: > head/sys/kern/kern_linker.c > head/sys/kern/kern_sysctl.c > head/sys/kern/vfs_init.c > head/sys/sys/sysctl.h >=20 > Modified: head/sys/kern/kern_linker.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/kern/kern_linker.c Tue Oct 21 19:00:32 2014 = (r273399) > +++ head/sys/kern/kern_linker.c Tue Oct 21 19:02:26 2014 = (r273400) > @@ -292,10 +292,10 @@ linker_file_register_sysctls(linker_file > return; >=20 > sx_xunlock(&kld_sx); > - sysctl_lock(); > + sysctl_xlock(); > for (oidp =3D start; oidp < stop; oidp++) > sysctl_register_oid(*oidp); > - sysctl_unlock(); > + sysctl_xunlock(); > sx_xlock(&kld_sx); > } >=20 > @@ -313,10 +313,10 @@ linker_file_unregister_sysctls(linker_fi > return; >=20 > sx_xunlock(&kld_sx); > - sysctl_lock(); > + sysctl_xlock(); > for (oidp =3D start; oidp < stop; oidp++) > sysctl_unregister_oid(*oidp); > - sysctl_unlock(); > + sysctl_xunlock(); > sx_xlock(&kld_sx); > } >=20 >=20 > Modified: head/sys/kern/kern_sysctl.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/kern/kern_sysctl.c Tue Oct 21 19:00:32 2014 = (r273399) > +++ head/sys/kern/kern_sysctl.c Tue Oct 21 19:02:26 2014 = (r273400) > @@ -126,14 +126,14 @@ sysctl_find_oidname(const char *name, st > * Order by number in each list. > */ > void > -sysctl_lock(void) > +sysctl_xlock(void) > { >=20 > SYSCTL_XLOCK(); > } >=20 > void > -sysctl_unlock(void) > +sysctl_xunlock(void) > { >=20 > SYSCTL_XUNLOCK(); >=20 > Modified: head/sys/kern/vfs_init.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/kern/vfs_init.c Tue Oct 21 19:00:32 2014 = (r273399) > +++ head/sys/kern/vfs_init.c Tue Oct 21 19:02:26 2014 = (r273400) > @@ -291,7 +291,7 @@ vfs_register(struct vfsconf *vfc) > * preserved by re-registering the oid after modifying its > * number. > */ > - sysctl_lock(); > + sysctl_xlock(); > SLIST_FOREACH(oidp, SYSCTL_CHILDREN(&sysctl___vfs), oid_link) { > if (strcmp(oidp->oid_name, vfc->vfc_name) =3D=3D 0) { > sysctl_unregister_oid(oidp); > @@ -300,7 +300,7 @@ vfs_register(struct vfsconf *vfc) > break; > } > } > - sysctl_unlock(); > + sysctl_xunlock(); >=20 > return (0); > } >=20 > Modified: head/sys/sys/sysctl.h > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/sys/sysctl.h Tue Oct 21 19:00:32 2014 = (r273399) > +++ head/sys/sys/sysctl.h Tue Oct 21 19:02:26 2014 = (r273400) > @@ -770,8 +770,8 @@ int userland_sysctl(struct thread *td, i > size_t *retval, int flags); > int sysctl_find_oid(int *name, u_int namelen, struct sysctl_oid = **noid, > int *nindx, struct sysctl_req *req); > -void sysctl_lock(void); > -void sysctl_unlock(void); > +void sysctl_xlock(void); > +void sysctl_xunlock(void); > int sysctl_wire_old_buffer(struct sysctl_req *req, size_t len); >=20 > struct sbuf; >=20 =97=20 Bjoern A. Zeeb "Come on. Learn, goddamn it.", WarGames, 1983 From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 21:44:25 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D3F8772A; Tue, 21 Oct 2014 21:44:25 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A515422C; Tue, 21 Oct 2014 21:44:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LLiPmx013214; Tue, 21 Oct 2014 21:44:25 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LLiPaN013213; Tue, 21 Oct 2014 21:44:25 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201410212144.s9LLiPaN013213@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 21 Oct 2014 21:44:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r273433 - releng/10.1/release/doc/en_US.ISO8859-1/relnotes stable/9/release/doc/en_US.ISO8859-1/errata X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 21:44:25 -0000 Author: gjb Date: Tue Oct 21 21:44:24 2014 New Revision: 273433 URL: https://svnweb.freebsd.org/changeset/base/273433 Log: Document the following security advisories: FreeBSD-SA-14:20.rtsold FreeBSD-SA-14:21.routed FreeBSD-SA-14:22.namei FreeBSD-SA-14:23.openssl Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: releng/10.1/release/doc/en_US.ISO8859-1/relnotes/article.xml Changes in other areas also in this revision: Modified: stable/9/release/doc/en_US.ISO8859-1/errata/article.xml Modified: releng/10.1/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- releng/10.1/release/doc/en_US.ISO8859-1/relnotes/article.xml Tue Oct 21 21:37:53 2014 (r273432) +++ releng/10.1/release/doc/en_US.ISO8859-1/relnotes/article.xml Tue Oct 21 21:44:24 2014 (r273433) @@ -287,6 +287,33 @@ Denial of Service in TCP packet processing. + + + SA-14:20.rtsold + 21 October 2014 + Remote buffer overflow + vulnerability. + + + + SA-14:21.routed + 21 October 2014 + Remote denial of service + vulnerability. + + + + SA-14:22.namei + 21 October 2014 + Memory leak in sandboxed namei + lookup. + + + + SA-14:23.openssl + 21 October 2014 + Multiple vulerabilities. + From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 21:44:26 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 73AD172B; Tue, 21 Oct 2014 21:44:26 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 446F622D; Tue, 21 Oct 2014 21:44:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LLiQEg013222; Tue, 21 Oct 2014 21:44:26 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LLiQuv013221; Tue, 21 Oct 2014 21:44:26 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201410212144.s9LLiQuv013221@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 21 Oct 2014 21:44:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r273433 - releng/10.1/release/doc/en_US.ISO8859-1/relnotes stable/9/release/doc/en_US.ISO8859-1/errata X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 21:44:26 -0000 Author: gjb Date: Tue Oct 21 21:44:24 2014 New Revision: 273433 URL: https://svnweb.freebsd.org/changeset/base/273433 Log: Document the following security advisories: FreeBSD-SA-14:20.rtsold FreeBSD-SA-14:21.routed FreeBSD-SA-14:22.namei FreeBSD-SA-14:23.openssl Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: stable/9/release/doc/en_US.ISO8859-1/errata/article.xml Changes in other areas also in this revision: Modified: releng/10.1/release/doc/en_US.ISO8859-1/relnotes/article.xml Modified: stable/9/release/doc/en_US.ISO8859-1/errata/article.xml ============================================================================== --- stable/9/release/doc/en_US.ISO8859-1/errata/article.xml Tue Oct 21 21:37:53 2014 (r273432) +++ stable/9/release/doc/en_US.ISO8859-1/errata/article.xml Tue Oct 21 21:44:24 2014 (r273433) @@ -112,6 +112,33 @@ Denial of Service in TCP packet processing. + + + SA-14:20.rtsold + 21 October 2014 + Remote buffer overflow + vulnerability. + + + + SA-14:21.routed + 21 October 2014 + Remote denial of service + vulnerability. + + + + SA-14:22.namei + 21 October 2014 + Memory leak in sandboxed namei + lookup. + + + + SA-14:23.openssl + 21 October 2014 + Multiple vulerabilities. + From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 21:45:51 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DAB0E9AB; Tue, 21 Oct 2014 21:45:51 +0000 (UTC) Received: from mail-wi0-x234.google.com (mail-wi0-x234.google.com [IPv6:2a00:1450:400c:c05::234]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D8A06243; Tue, 21 Oct 2014 21:45:50 +0000 (UTC) Received: by mail-wi0-f180.google.com with SMTP id em10so3014790wid.7 for ; Tue, 21 Oct 2014 14:45:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=RkOG8y7w89EITJN7pOIqRao8Lhk+iGtje5MJ9SYLDn8=; b=e2IQyItaotFkBgSgLKA5taJaGWkUSxTU+G8MjKDeEZPj58JyMqRshH3IJCpjy17dNo 2DmJSNhGpEWLRysPhKUQmYVnIhZEPJ6O4p/R2y1kDvxiGzd9h11Dpb/IgNkb/vbrcXaQ 7qPjXqqA6G0A3HCNSL2fh1jVYEYA2PzcFvwsoOIliUCIlqxC8m9iHA7+q3l+AWAWfF+7 9d6hS321HeYGibrVD7NDXh0UYWVpsBm+Y7N2+tx/q4AhY2qzhDYheY2FJk1mrIiha8gh Srp6o5awIolTjJz5+s5vpGErAlo4jX1sDZRkOTkd9ZmhPFhL1Gd2Nq/sCvOV3nOezeGY 68Ng== X-Received: by 10.194.246.230 with SMTP id xz6mr44920235wjc.3.1413927949156; Tue, 21 Oct 2014 14:45:49 -0700 (PDT) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPSA id h8sm371235wjs.43.2014.10.21.14.45.47 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 21 Oct 2014 14:45:48 -0700 (PDT) Date: Tue, 21 Oct 2014 23:45:45 +0200 From: Mateusz Guzik To: "Bjoern A. Zeeb" Subject: Re: svn commit: r273400 - in head/sys: kern sys Message-ID: <20141021214545.GC28763@dft-labs.eu> References: <201410211902.s9LJ2RoA031960@svn.freebsd.org> <50143173-0319-45C0-A00E-AD2AA303C65D@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <50143173-0319-45C0-A00E-AD2AA303C65D@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Mateusz Guzik X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 21:45:52 -0000 On Tue, Oct 21, 2014 at 09:40:38PM +0000, Bjoern A. Zeeb wrote: > > On 21 Oct 2014, at 19:02 , Mateusz Guzik wrote: > > > Author: mjg > > Date: Tue Oct 21 19:02:26 2014 > > New Revision: 273400 > > URL: https://svnweb.freebsd.org/changeset/base/273400 > > > > Log: > > Rename sysctl_lock and _unlock to sysctl_xlock and _xunlock. > > You are perfectly describing what you are doing, but I’d also like to understand the “why?†> First off, these function do lock sysctl exclusively, so I find this to be a better suited name. In https://svnweb.freebsd.org/base?view=revision&revision=273401 I added shared locking to sysctl and this change "coincidently" freed up a nice name for a functions which remember previous lock type and lock it the same way later. -- Mateusz Guzik From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 21:47:36 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A215DC47; Tue, 21 Oct 2014 21:47:36 +0000 (UTC) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id 62E24269; Tue, 21 Oct 2014 21:47:36 +0000 (UTC) Received: from nine.des.no (smtp.des.no [194.63.250.102]) by smtp-int.des.no (Postfix) with ESMTP id 82730A252; Tue, 21 Oct 2014 21:47:35 +0000 (UTC) Received: by nine.des.no (Postfix, from userid 1001) id 8E3EE548B; Tue, 21 Oct 2014 23:47:23 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Luigi Rizzo Subject: Re: svn commit: r273274 - head/sys/netpfil/ipfw References: <201410191115.s9JBFJxA058370@svn.freebsd.org> <5443A83F.5090807@FreeBSD.org> <20141021213621.GA70907@onelab2.iet.unipi.it> Date: Tue, 21 Oct 2014 23:47:23 +0200 In-Reply-To: <20141021213621.GA70907@onelab2.iet.unipi.it> (Luigi Rizzo's message of "Tue, 21 Oct 2014 23:36:21 +0200") Message-ID: <86lho914es.fsf@nine.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, "Alexander V. Chernikov" , Andriy Gapon X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 21:47:36 -0000 Luigi Rizzo writes: > This code is not performance critical. I wouldn't bother optimizing it. So just use fls() or flsl(). DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 21:49:07 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CB5DEDDD; Tue, 21 Oct 2014 21:49:07 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B774627B; Tue, 21 Oct 2014 21:49:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LLn74r014072; Tue, 21 Oct 2014 21:49:07 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LLn7HU014071; Tue, 21 Oct 2014 21:49:07 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410212149.s9LLn7HU014071@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 21 Oct 2014 21:49:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273434 - head/contrib/libc++/src X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 21:49:07 -0000 Author: bapt Date: Tue Oct 21 21:49:06 2014 New Revision: 273434 URL: https://svnweb.freebsd.org/changeset/base/273434 Log: Do not define bad_array_new_length::bad_array_new_length in libc++ anymore when used in combinaison with libcxxrt since it is now defined there already. This fixes building world Modified: head/contrib/libc++/src/new.cpp Modified: head/contrib/libc++/src/new.cpp ============================================================================== --- head/contrib/libc++/src/new.cpp Tue Oct 21 21:44:24 2014 (r273433) +++ head/contrib/libc++/src/new.cpp Tue Oct 21 21:49:06 2014 (r273434) @@ -192,8 +192,6 @@ bad_alloc::what() const _NOEXCEPT #endif // !__GLIBCXX__ -#endif //LIBCXXRT - bad_array_new_length::bad_array_new_length() _NOEXCEPT { } @@ -202,6 +200,8 @@ bad_array_new_length::~bad_array_new_len { } +#endif //LIBCXXRT + const char* bad_array_length::what() const _NOEXCEPT { From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 23:07:31 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6739BECC; Tue, 21 Oct 2014 23:07:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 52CAEC56; Tue, 21 Oct 2014 23:07:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LN7Vao051784; Tue, 21 Oct 2014 23:07:31 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LN7VCO051783; Tue, 21 Oct 2014 23:07:31 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201410212307.s9LN7VCO051783@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 21 Oct 2014 23:07:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r273435 - releng/10.1/sys/dev/hyperv/storvsc X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 23:07:31 -0000 Author: gjb Date: Tue Oct 21 23:07:30 2014 New Revision: 273435 URL: https://svnweb.freebsd.org/changeset/base/273435 Log: MFstable10 r273429: MFC r273402: Fix an issue where a FreeBSD virtual machine provisioned in the Microsoft Azure service does not recognize the second attached disk on the system. PR: 194376 Approved by: re (delphij) Sponsored by: The FreeBSD Foundation Modified: releng/10.1/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Directory Properties: releng/10.1/ (props changed) Modified: releng/10.1/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- releng/10.1/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Oct 21 21:49:06 2014 (r273434) +++ releng/10.1/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Oct 21 23:07:30 2014 (r273435) @@ -75,7 +75,7 @@ __FBSDID("$FreeBSD$"); #define STORVSC_MAX_IO_REQUESTS (STORVSC_MAX_LUNS_PER_TARGET * 2) #define BLKVSC_MAX_IDE_DISKS_PER_TARGET (1) #define BLKVSC_MAX_IO_REQUESTS STORVSC_MAX_IO_REQUESTS -#define STORVSC_MAX_TARGETS (1) +#define STORVSC_MAX_TARGETS (2) struct storvsc_softc; @@ -584,7 +584,6 @@ hv_storvsc_on_iocompletion(struct storvs vm_srb = &vstor_packet->u.vm_srb; - request->sense_info_len = 0; if (((vm_srb->scsi_status & 0xFF) == SCSI_STATUS_CHECK_COND) && (vm_srb->srb_status & SRB_STATUS_AUTOSENSE_VALID)) { /* Autosense data available */ From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 23:08:48 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1A7A7C7; Tue, 21 Oct 2014 23:08:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 04183C66; Tue, 21 Oct 2014 23:08:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LN8lku052002; Tue, 21 Oct 2014 23:08:47 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LN8lm6051999; Tue, 21 Oct 2014 23:08:47 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410212308.s9LN8lm6051999@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 21 Oct 2014 23:08:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273436 - in head/sys: i386/ibcs2 kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 23:08:48 -0000 Author: mjg Date: Tue Oct 21 23:08:46 2014 New Revision: 273436 URL: https://svnweb.freebsd.org/changeset/base/273436 Log: Eliminate unnecessary memory allocation in sys_getgroups and its ibcs2 counterpart. Modified: head/sys/i386/ibcs2/ibcs2_misc.c head/sys/kern/kern_prot.c head/sys/sys/syscallsubr.h Modified: head/sys/i386/ibcs2/ibcs2_misc.c ============================================================================== --- head/sys/i386/ibcs2/ibcs2_misc.c Tue Oct 21 23:07:30 2014 (r273435) +++ head/sys/i386/ibcs2/ibcs2_misc.c Tue Oct 21 23:08:46 2014 (r273436) @@ -659,33 +659,28 @@ ibcs2_getgroups(td, uap) struct thread *td; struct ibcs2_getgroups_args *uap; { + struct ucred *cred; ibcs2_gid_t *iset; - gid_t *gp; u_int i, ngrp; int error; - if (uap->gidsetsize < td->td_ucred->cr_ngroups) { - if (uap->gidsetsize == 0) - ngrp = 0; - else - return (EINVAL); - } else - ngrp = td->td_ucred->cr_ngroups; - gp = malloc(ngrp * sizeof(*gp), M_TEMP, M_WAITOK); - error = kern_getgroups(td, &ngrp, gp); - if (error) + cred = td->td_ucred; + ngrp = cred->cr_ngroups; + + if (uap->gidsetsize == 0) { + error = 0; goto out; - if (uap->gidsetsize > 0) { - iset = malloc(ngrp * sizeof(*iset), M_TEMP, M_WAITOK); - for (i = 0; i < ngrp; i++) - iset[i] = (ibcs2_gid_t)gp[i]; - error = copyout(iset, uap->gidset, ngrp * sizeof(ibcs2_gid_t)); - free(iset, M_TEMP); } - if (error == 0) - td->td_retval[0] = ngrp; + if (uap->gidsetsize < ngrp) + return (EINVAL); + + iset = malloc(ngrp * sizeof(*iset), M_TEMP, M_WAITOK); + for (i = 0; i < ngrp; i++) + iset[i] = (ibcs2_gid_t)cred->cr_groups[i]; + error = copyout(iset, uap->gidset, ngrp * sizeof(ibcs2_gid_t)); + free(iset, M_TEMP); out: - free(gp, M_TEMP); + td->td_retval[0] = ngrp; return (error); } Modified: head/sys/kern/kern_prot.c ============================================================================== --- head/sys/kern/kern_prot.c Tue Oct 21 23:07:30 2014 (r273435) +++ head/sys/kern/kern_prot.c Tue Oct 21 23:08:46 2014 (r273436) @@ -303,45 +303,24 @@ struct getgroups_args { int sys_getgroups(struct thread *td, register struct getgroups_args *uap) { - gid_t *groups; + struct ucred *cred; u_int ngrp; int error; - if (uap->gidsetsize < td->td_ucred->cr_ngroups) { - if (uap->gidsetsize == 0) - ngrp = 0; - else - return (EINVAL); - } else - ngrp = td->td_ucred->cr_ngroups; - groups = malloc(ngrp * sizeof(*groups), M_TEMP, M_WAITOK); - error = kern_getgroups(td, &ngrp, groups); - if (error) - goto out; - if (uap->gidsetsize > 0) - error = copyout(groups, uap->gidset, ngrp * sizeof(gid_t)); - if (error == 0) - td->td_retval[0] = ngrp; -out: - free(groups, M_TEMP); - return (error); -} - -int -kern_getgroups(struct thread *td, u_int *ngrp, gid_t *groups) -{ - struct ucred *cred; - cred = td->td_ucred; - if (*ngrp == 0) { - *ngrp = cred->cr_ngroups; - return (0); + ngrp = cred->cr_ngroups; + + if (uap->gidsetsize == 0) { + error = 0; + goto out; } - if (*ngrp < cred->cr_ngroups) + if (uap->gidsetsize < ngrp) return (EINVAL); - *ngrp = cred->cr_ngroups; - bcopy(cred->cr_groups, groups, *ngrp * sizeof(gid_t)); - return (0); + + error = copyout(cred->cr_groups, uap->gidset, ngrp * sizeof(gid_t)); +out: + td->td_retval[0] = ngrp; + return (error); } #ifndef _SYS_SYSPROTO_H_ Modified: head/sys/sys/syscallsubr.h ============================================================================== --- head/sys/sys/syscallsubr.h Tue Oct 21 23:07:30 2014 (r273435) +++ head/sys/sys/syscallsubr.h Tue Oct 21 23:08:46 2014 (r273436) @@ -109,7 +109,6 @@ int kern_getdirentries(struct thread *td long *basep, ssize_t *residp, enum uio_seg bufseg); int kern_getfsstat(struct thread *td, struct statfs **buf, size_t bufsize, enum uio_seg bufseg, int flags); -int kern_getgroups(struct thread *td, u_int *ngrp, gid_t *groups); int kern_getitimer(struct thread *, u_int, struct itimerval *); int kern_getppid(struct thread *); int kern_getpeername(struct thread *td, int fd, struct sockaddr **sa, From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 23:09:10 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 37A9C201; Tue, 21 Oct 2014 23:09:10 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 21990C69; Tue, 21 Oct 2014 23:09:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LN9ANX052195; Tue, 21 Oct 2014 23:09:10 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LN99hx052194; Tue, 21 Oct 2014 23:09:09 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201410212309.s9LN99hx052194@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 21 Oct 2014 23:09:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r273437 - releng/10.1/sys/conf X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 23:09:10 -0000 Author: gjb Date: Tue Oct 21 23:09:09 2014 New Revision: 273437 URL: https://svnweb.freebsd.org/changeset/base/273437 Log: Update releng/10.1 to -RC3 as part of the 10.1-RELEASE cycle. Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: releng/10.1/sys/conf/newvers.sh Modified: releng/10.1/sys/conf/newvers.sh ============================================================================== --- releng/10.1/sys/conf/newvers.sh Tue Oct 21 23:08:46 2014 (r273436) +++ releng/10.1/sys/conf/newvers.sh Tue Oct 21 23:09:09 2014 (r273437) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="10.1" -BRANCH="RC2" +BRANCH="RC3" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 23:50:48 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 53F38863; Tue, 21 Oct 2014 23:50:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3D39EA; Tue, 21 Oct 2014 23:50:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LNolbZ073360; Tue, 21 Oct 2014 23:50:47 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LNokjs073355; Tue, 21 Oct 2014 23:50:46 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410212350.s9LNokjs073355@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 21 Oct 2014 23:50:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r273438 - in releng/9.3: . contrib/tzdata lib/libcrypt sys/conf X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 23:50:48 -0000 Author: delphij Date: Tue Oct 21 23:50:46 2014 New Revision: 273438 URL: https://svnweb.freebsd.org/changeset/base/273438 Log: Time zone data file update. [EN-14:10] Change crypt(3) default hashing algorithm back to DES. [EN-14:11] Approved by: so Added: releng/9.3/contrib/tzdata/zone1970.tab Modified: releng/9.3/UPDATING releng/9.3/contrib/tzdata/africa releng/9.3/contrib/tzdata/antarctica releng/9.3/contrib/tzdata/asia releng/9.3/contrib/tzdata/australasia releng/9.3/contrib/tzdata/backward releng/9.3/contrib/tzdata/etcetera releng/9.3/contrib/tzdata/europe releng/9.3/contrib/tzdata/factory releng/9.3/contrib/tzdata/leap-seconds.list releng/9.3/contrib/tzdata/northamerica releng/9.3/contrib/tzdata/pacificnew releng/9.3/contrib/tzdata/southamerica releng/9.3/contrib/tzdata/systemv releng/9.3/contrib/tzdata/yearistype.sh releng/9.3/contrib/tzdata/zone.tab releng/9.3/lib/libcrypt/crypt.c releng/9.3/sys/conf/newvers.sh Modified: releng/9.3/UPDATING ============================================================================== --- releng/9.3/UPDATING Tue Oct 21 23:09:09 2014 (r273437) +++ releng/9.3/UPDATING Tue Oct 21 23:50:46 2014 (r273438) @@ -11,6 +11,13 @@ handbook: Items affecting the ports and packages system can be found in /usr/ports/UPDATING. Please read that file before running portupgrade. +20141022: p4 FreeBSD-EN-14:10.tzdata + FreeBSD-EN-14:11.crypt + + Time zone data file update. [EN-14:10] + + Change crypt(3) default hashing algorithm back to DES. [EN-14:11] + 20141021: p3 FreeBSD-SA-14:20.rtsold FreeBSD-SA-14:21.routed FreeBSD-SA-14:22.namei Modified: releng/9.3/contrib/tzdata/africa ============================================================================== --- releng/9.3/contrib/tzdata/africa Tue Oct 21 23:09:09 2014 (r273437) +++ releng/9.3/contrib/tzdata/africa Tue Oct 21 23:50:46 2014 (r273438) @@ -1,4 +1,3 @@ -#
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -35,13 +34,13 @@
 # Previous editions of this database used WAT, CAT, SAT, and EAT
 # for +0:00 through +3:00, respectively,
 # but Mark R V Murray reports that
-# `SAST' is the official abbreviation for +2:00 in the country of South Africa,
-# `CAT' is commonly used for +2:00 in countries north of South Africa, and
-# `WAT' is probably the best name for +1:00, as the common phrase for
-# the area that includes Nigeria is ``West Africa''.
-# He has heard of ``Western Sahara Time'' for +0:00 but can find no reference.
+# 'SAST' is the official abbreviation for +2:00 in the country of South Africa,
+# 'CAT' is commonly used for +2:00 in countries north of South Africa, and
+# 'WAT' is probably the best name for +1:00, as the common phrase for
+# the area that includes Nigeria is "West Africa".
+# He has heard of "Western Sahara Time" for +0:00 but can find no reference.
 #
-# To make things confusing, `WAT' seems to have been used for -1:00 long ago;
+# To make things confusing, 'WAT' seems to have been used for -1:00 long ago;
 # I'd guess that this was because people needed _some_ name for -1:00,
 # and at the time, far west Africa was the only major land area in -1:00.
 # This usage is now obsolete, as the last use of -1:00 on the African
@@ -54,7 +53,7 @@
 #	 2:00	SAST	South Africa Standard Time
 # and Murray suggests the following abbreviation:
 #	 1:00	WAT	West Africa Time
-# I realize that this leads to `WAT' being used for both -1:00 and 1:00
+# I realize that this leads to 'WAT' being used for both -1:00 and 1:00
 # for times before 1976, but this is the best I can think of
 # until we get more information.
 #
@@ -131,9 +130,7 @@ Zone	Africa/Gaborone	1:43:40 -	LMT	1885
 			2:00	-	CAT
 
 # Burkina Faso
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Africa/Ouagadougou	-0:06:04 -	LMT	1912
-			 0:00	-	GMT
+# See Africa/Abidjan.
 
 # Burundi
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -161,7 +158,7 @@ Zone	Africa/Bangui	1:14:20	-	LMT	1912
 
 # Chad
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Ndjamena	1:00:12 -	LMT	1912
+Zone	Africa/Ndjamena	1:00:12 -	LMT	1912 # N'Djamena
 			1:00	-	WAT	1979 Oct 14
 			1:00	1:00	WAST	1980 Mar  8
 			1:00	-	WAT
@@ -183,10 +180,20 @@ Zone Africa/Lubumbashi	1:49:52 -	LMT	189
 Zone Africa/Brazzaville	1:01:08 -	LMT	1912
 			1:00	-	WAT
 
-# Cote D'Ivoire
+# Côte D'Ivoire / Ivory Coast
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Africa/Abidjan	-0:16:08 -	LMT	1912
 			 0:00	-	GMT
+Link Africa/Abidjan Africa/Bamako	# Mali
+Link Africa/Abidjan Africa/Banjul	# Gambia
+Link Africa/Abidjan Africa/Conakry	# Guinea
+Link Africa/Abidjan Africa/Dakar	# Senegal
+Link Africa/Abidjan Africa/Freetown	# Sierra Leone
+Link Africa/Abidjan Africa/Lome		# Togo
+Link Africa/Abidjan Africa/Nouakchott	# Mauritania
+Link Africa/Abidjan Africa/Ouagadougou	# Burkina Faso
+Link Africa/Abidjan Africa/Sao_Tome	# São Tomé and Príncipe
+Link Africa/Abidjan Atlantic/St_Helena	# St Helena
 
 # Djibouti
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -231,13 +238,9 @@ Rule	Egypt	1990	1994	-	May	 1	1:00	1:00	
 # Egyptians would approve the cancellation."
 #
 # Egypt to cancel daylight saving time
-# 
 # http://www.almasryalyoum.com/en/node/407168
-# 
 # or
-# 
 # http://www.worldtimezone.com/dst_news/dst_news_egypt04.html
-# 
 Rule	Egypt	1995	2010	-	Apr	lastFri	 0:00s	1:00	S
 Rule	Egypt	1995	2005	-	Sep	lastThu	24:00	0	-
 # From Steffen Thorsen (2006-09-19):
@@ -249,7 +252,7 @@ Rule	Egypt	2006	only	-	Sep	21	24:00	0	-
 # From Dirk Losch (2007-08-14):
 # I received a mail from an airline which says that the daylight
 # saving time in Egypt will end in the night of 2007-09-06 to 2007-09-07.
-# From Jesper Norgaard Welen (2007-08-15): [The following agree:]
+# From Jesper Nørgaard Welen (2007-08-15): [The following agree:]
 # http://www.nentjes.info/Bill/bill5.htm
 # http://www.timeanddate.com/worldclock/city.html?n=53
 # From Steffen Thorsen (2007-09-04): The official information...:
@@ -288,15 +291,9 @@ Rule	Egypt	2007	only	-	Sep	Thu>=1	24:00	
 #
 # timeanddate[2] and another site I've found[3] also support that.
 #
-# [1] 
-# https://bugzilla.redhat.com/show_bug.cgi?id=492263
-# 
-# [2] 
-# http://www.timeanddate.com/worldclock/clockchange.html?n=53
-# 
-# [3] 
-# http://wwp.greenwichmeantime.com/time-zone/africa/egypt/
-# 
+# [1] https://bugzilla.redhat.com/show_bug.cgi?id=492263
+# [2] http://www.timeanddate.com/worldclock/clockchange.html?n=53
+# [3] http://wwp.greenwichmeantime.com/time-zone/africa/egypt/
 
 # From Arthur David Olson (2009-04-20):
 # In 2009 (and for the next several years), Ramadan ends before the fourth
@@ -306,14 +303,10 @@ Rule	Egypt	2007	only	-	Sep	Thu>=1	24:00	
 # From Steffen Thorsen (2009-08-11):
 # We have been able to confirm the August change with the Egyptian Cabinet
 # Information and Decision Support Center:
-# 
 # http://www.timeanddate.com/news/time/egypt-dst-ends-2009.html
-# 
 #
 # The Middle East News Agency
-# 
 # http://www.mena.org.eg/index.aspx
-# 
 # also reports "Egypt starts winter time on August 21"
 # today in article numbered "71, 11/08/2009 12:25 GMT."
 # Only the title above is available without a subscription to their service,
@@ -321,19 +314,14 @@ Rule	Egypt	2007	only	-	Sep	Thu>=1	24:00	
 # (at least today).
 
 # From Alexander Krivenyshev (2010-07-20):
-# According to News from Egypt -  Al-Masry Al-Youm Egypt's cabinet has
+# According to News from Egypt - Al-Masry Al-Youm Egypt's cabinet has
 # decided that Daylight Saving Time will not be used in Egypt during
 # Ramadan.
 #
 # Arabic translation:
-# "Clocks to go back during Ramadan--and then forward again"
-# 
+# "Clocks to go back during Ramadan - and then forward again"
 # http://www.almasryalyoum.com/en/news/clocks-go-back-during-ramadan-and-then-forward-again
-# 
-# or
-# 
 # http://www.worldtimezone.com/dst_news/dst_news_egypt02.html
-# 
 
 # From Ahmad El-Dardiry (2014-05-07):
 # Egypt is to change back to Daylight system on May 15
@@ -433,10 +421,15 @@ Zone	Africa/Asmara	2:35:32 -	LMT	1870
 			3:00	-	EAT
 
 # Ethiopia
-# From Paul Eggert (2006-03-22):
-# Shanks & Pottenger write that Ethiopia had six narrowly-spaced time zones
-# between 1870 and 1890, and that they merged to 38E50 (2:35:20) in 1890.
-# We'll guess that 38E50 is for Adis Dera.
+# From Paul Eggert (2014-07-31):
+# Like the Swahili of Kenya and Tanzania, many Ethiopians keep a
+# 12-hour clock starting at our 06:00, so their "8 o'clock" is our
+# 02:00 or 14:00.  Keep this in mind when you ask the time in Amharic.
+#
+# Shanks & Pottenger write that Ethiopia had six narrowly-spaced time
+# zones between 1870 and 1890, that they merged to 38E50 (2:35:20) in
+# 1890, and that they switched to 3:00 on 1936-05-05.  Perhaps 38E50
+# was for Adis Dera.  Quite likely the Shanks data are wrong anyway.
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Africa/Addis_Ababa	2:34:48 -	LMT	1870
 			2:35:20	-	ADMT	1936 May 5    # Adis Dera MT
@@ -448,28 +441,24 @@ Zone Africa/Libreville	0:37:48 -	LMT	191
 			1:00	-	WAT
 
 # Gambia
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Banjul	-1:06:36 -	LMT	1912
-			-1:06:36 -	BMT	1935	# Banjul Mean Time
-			-1:00	-	WAT	1964
-			 0:00	-	GMT
+# See Africa/Abidjan.
 
 # Ghana
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
-# Whitman says DST was observed from 1931 to ``the present'';
-# go with Shanks & Pottenger.
-Rule	Ghana	1936	1942	-	Sep	 1	0:00	0:20	GHST
-Rule	Ghana	1936	1942	-	Dec	31	0:00	0	GMT
+# Whitman says DST was observed from 1931 to "the present";
+# Shanks & Pottenger say 1936 to 1942;
+# and September 1 to January 1 is given by:
+# Scott Keltie J, Epstein M (eds), The Statesman's Year-Book,
+# 57th ed. Macmillan, London (1920), OCLC 609408015, pp xxviii.
+# For lack of better info, assume DST was observed from 1920 to 1942.
+Rule	Ghana	1920	1942	-	Sep	 1	0:00	0:20	GHST
+Rule	Ghana	1920	1942	-	Dec	31	0:00	0	GMT
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Africa/Accra	-0:00:52 -	LMT	1918
 			 0:00	Ghana	%s
 
 # Guinea
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Conakry	-0:54:52 -	LMT	1912
-			 0:00	-	GMT	1934 Feb 26
-			-1:00	-	WAT	1960
-			 0:00	-	GMT
+# See Africa/Abidjan.
 
 # Guinea-Bissau
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -577,18 +566,8 @@ Zone	Africa/Blantyre	2:20:00 -	LMT	1903 
 			2:00	-	CAT
 
 # Mali
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Bamako	-0:32:00 -	LMT	1912
-			 0:00	-	GMT	1934 Feb 26
-			-1:00	-	WAT	1960 Jun 20
-			 0:00	-	GMT
-
 # Mauritania
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Africa/Nouakchott	-1:03:48 -	LMT	1912
-			 0:00	-	GMT	1934 Feb 26
-			-1:00	-	WAT	1960 Nov 28
-			 0:00	-	GMT
+# See Africa/Abidjan.
 
 # Mauritius
 
@@ -612,9 +591,7 @@ Zone Africa/Nouakchott	-1:03:48 -	LMT	19
 
 # From Steffen Thorsen (2008-07-10):
 # According to
-# 
 # http://www.lexpress.mu/display_article.php?news_id=111216
-# 
 # (in French), Mauritius will start and end their DST a few days earlier
 # than previously announced (2008-11-01 to 2009-03-31).  The new start
 # date is 2008-10-26 at 02:00 and the new end date is 2009-03-27 (no time
@@ -633,18 +610,13 @@ Zone Africa/Nouakchott	-1:03:48 -	LMT	19
 # published on Monday, June 30, 2008...
 #
 # I guess that article in French "Le gouvernement avance l'introduction
-# de l'heure d'ete" stating that DST in Mauritius starting on October 26
-# and ending on March 27, 2009 is the most recent one.
-# ...
-# 
+# de l'heure d'été" stating that DST in Mauritius starting on October 26
+# and ending on March 27, 2009 is the most recent one....
 # http://www.worldtimezone.com/dst_news/dst_news_mauritius02.html
-# 
 
 # From Riad M. Hossen Ally (2008-08-03):
 # The Government of Mauritius weblink
-# 
 # http://www.gov.mu/portal/site/pmosite/menuitem.4ca0efdee47462e7440a600248a521ca/?content_id=4728ca68b2a5b110VgnVCM1000000a04a8c0RCRD
-# 
 # Cabinet Decision of July 18th, 2008 states as follows:
 #
 # 4. ...Cabinet has agreed to the introduction into the National Assembly
@@ -654,33 +626,25 @@ Zone Africa/Nouakchott	-1:03:48 -	LMT	19
 # States of America. It will start at two o'clock in the morning on the
 # last Sunday of October and will end at two o'clock in the morning on
 # the last Sunday of March the following year. The summer time for the
-# year 2008 - 2009 will, therefore, be effective as from 26 October 2008
+# year 2008-2009 will, therefore, be effective as from 26 October 2008
 # and end on 29 March 2009.
 
 # From Ed Maste (2008-10-07):
 # THE TIME BILL (No. XXVII of 2008) Explanatory Memorandum states the
 # beginning / ending of summer time is 2 o'clock standard time in the
 # morning of the last Sunday of October / last Sunday of March.
-# 
 # http://www.gov.mu/portal/goc/assemblysite/file/bill2708.pdf
-# 
 
 # From Steffen Thorsen (2009-06-05):
 # According to several sources, Mauritius will not continue to observe
 # DST the coming summer...
 #
 # Some sources, in French:
-# 
 # http://www.defimedia.info/news/946/Rashid-Beebeejaun-:-%C2%AB-L%E2%80%99heure-d%E2%80%99%C3%A9t%C3%A9-ne-sera-pas-appliqu%C3%A9e-cette-ann%C3%A9e-%C2%BB
-# 
-# 
 # http://lexpress.mu/Story/3398~Beebeejaun---Les-objectifs-d-%C3%A9conomie-d-%C3%A9nergie-de-l-heure-d-%C3%A9t%C3%A9-ont-%C3%A9t%C3%A9-atteints-
-# 
 #
 # Our wrap-up:
-# 
 # http://www.timeanddate.com/news/time/mauritius-dst-will-not-repeat.html
-# 
 
 # From Arthur David Olson (2009-07-11):
 # The "mauritius-dst-will-not-repeat" wrapup includes this:
@@ -704,7 +668,7 @@ Zone	Indian/Mayotte	3:00:56 -	LMT	1911 J
 			3:00	-	EAT
 
 # Morocco
-# See the `europe' file for Spanish Morocco (Africa/Ceuta).
+# See the 'europe' file for Spanish Morocco (Africa/Ceuta).
 
 # From Alex Krivenyshev (2008-05-09):
 # Here is an article that Morocco plan to introduce Daylight Saving Time between
@@ -712,60 +676,43 @@ Zone	Indian/Mayotte	3:00:56 -	LMT	1911 J
 #
 # "... Morocco is to save energy by adjusting its clock during summer so it will
 # be one hour ahead of GMT between 1 June and 27 September, according to
-# Communication Minister and Gov ernment Spokesman, Khalid Naciri...."
+# Communication Minister and Government Spokesman, Khalid Naciri...."
 #
-# 
 # http://www.worldtimezone.net/dst_news/dst_news_morocco01.html
-# 
-# OR
-# 
 # http://en.afrik.com/news11892.html
-# 
 
 # From Alex Krivenyshev (2008-05-09):
 # The Morocco time change can be confirmed on Morocco web site Maghreb Arabe Presse:
-# 
 # http://www.map.ma/eng/sections/box3/morocco_shifts_to_da/view
-# 
 #
 # Morocco shifts to daylight time on June 1st through September 27, Govt.
 # spokesman.
 
 # From Patrice Scattolin (2008-05-09):
 # According to this article:
-# 
 # http://www.avmaroc.com/actualite/heure-dete-comment-a127896.html
-# 
-# (and republished here:
-# 
-# http://www.actu.ma/heure-dete-comment_i127896_0.html
-# 
-# )
-# the changes occurs at midnight:
-#
-# saturday night may 31st at midnight (which in french is to be
-# intrepreted as the night between saturday and sunday)
-# sunday night the 28th  at midnight
-#
-# Seeing that the 28th is monday, I am guessing that she intends to say
-# the midnight of the 28th which is the midnight between sunday and
-# monday, which jives with other sources that say that it's inclusive
-# june1st to sept 27th.
+# (and republished here: )
+# the changes occur at midnight:
+#
+# Saturday night May 31st at midnight (which in French is to be
+# interpreted as the night between Saturday and Sunday)
+# Sunday night the 28th at midnight
+#
+# Seeing that the 28th is Monday, I am guessing that she intends to say
+# the midnight of the 28th which is the midnight between Sunday and
+# Monday, which jives with other sources that say that it's inclusive
+# June 1st to Sept 27th.
 #
 # The decision was taken by decree *2-08-224 *but I can't find the decree
 # published on the web.
 #
 # It's also confirmed here:
-# 
 # http://www.maroc.ma/NR/exeres/FACF141F-D910-44B0-B7FA-6E03733425D1.htm
-# 
-# on a government portal as being  between june 1st and sept 27th (not yet
-# posted in english).
+# on a government portal as being between June 1st and Sept 27th (not yet
+# posted in English).
 #
-# The following google query will generate many relevant hits:
-# 
+# The following Google query will generate many relevant hits:
 # http://www.google.com/search?hl=en&q=Conseil+de+gouvernement+maroc+heure+avance&btnG=Search
-# 
 
 # From Steffen Thorsen (2008-08-27):
 # Morocco will change the clocks back on the midnight between August 31
@@ -773,47 +720,32 @@ Zone	Indian/Mayotte	3:00:56 -	LMT	1911 J
 # of September:
 #
 # One article about it (in French):
-# 
 # http://www.menara.ma/fr/Actualites/Maroc/Societe/ci.retour_a_l_heure_gmt_a_partir_du_dimanche_31_aout_a_minuit_officiel_.default
-# 
 #
 # We have some further details posted here:
-# 
 # http://www.timeanddate.com/news/time/morocco-ends-dst-early-2008.html
-# 
 
 # From Steffen Thorsen (2009-03-17):
 # Morocco will observe DST from 2009-06-01 00:00 to 2009-08-21 00:00 according
 # to many sources, such as
-# 
 # http://news.marweb.com/morocco/entertainment/morocco-daylight-saving.html
-# 
-# 
 # http://www.medi1sat.ma/fr/depeche.aspx?idp=2312
-# 
 # (French)
 #
 # Our summary:
-# 
 # http://www.timeanddate.com/news/time/morocco-starts-dst-2009.html
-# 
 
 # From Alexander Krivenyshev (2009-03-17):
 # Here is a link to official document from Royaume du Maroc Premier Ministre,
-# Ministere de la Modernisation des Secteurs Publics
+# Ministère de la Modernisation des Secteurs Publics
 #
 # Under Article 1 of Royal Decree No. 455-67 of Act 23 safar 1387 (2 june 1967)
 # concerning the amendment of the legal time, the Ministry of Modernization of
 # Public Sectors announced that the official time in the Kingdom will be
 # advanced 60 minutes from Sunday 31 May 2009 at midnight.
 #
-# 
 # http://www.mmsp.gov.ma/francais/Actualites_fr/PDF_Actualites_Fr/HeureEte_FR.pdf
-# 
-#
-# 
 # http://www.worldtimezone.com/dst_news/dst_news_morocco03.html
-# 
 
 # From Steffen Thorsen (2010-04-13):
 # Several news media in Morocco report that the Ministry of Modernization
@@ -821,14 +753,10 @@ Zone	Indian/Mayotte	3:00:56 -	LMT	1911 J
 # 2010-05-02 to 2010-08-08.
 #
 # Example:
-# 
 # http://www.lavieeco.com/actualites/4099-le-maroc-passera-a-l-heure-d-ete-gmt1-le-2-mai.html
-# 
 # (French)
 # Our page:
-# 
 # http://www.timeanddate.com/news/time/morocco-starts-dst-2010.html
-# 
 
 # From Dan Abitol (2011-03-30):
 # ...Rules for Africa/Casablanca are the following (24h format)
@@ -838,34 +766,20 @@ Zone	Indian/Mayotte	3:00:56 -	LMT	1911 J
 # The change was broadcast on the FM Radio
 # I ve called ANRT (telecom regulations in Morocco) at
 # +212.537.71.84.00
-# 
 # http://www.anrt.net.ma/fr/
-# 
 # They said that
-# 
 # http://www.map.ma/fr/sections/accueil/l_heure_legale_au_ma/view
-# 
 # is the official publication to look at.
 # They said that the decision was already taken.
 #
 # More articles in the press
-# 
-# http://www.yabiladi.com/articles/details/5058/secret-l-heure-d-ete-maroc-lev
-# 
-# e.html
-# 
+# http://www.yabiladi.com/articles/details/5058/secret-l-heure-d-ete-maroc-leve.html
 # http://www.lematin.ma/Actualite/Express/Article.asp?id=148923
-# 
-# 
 # http://www.lavieeco.com/actualite/Le-Maroc-passe-sur-GMT%2B1-a-partir-de-dim
-# anche-prochain-5538.html
-# 
 
 # From Petr Machata (2011-03-30):
 # They have it written in English here:
-# 
 # http://www.map.ma/eng/sections/home/morocco_to_spring_fo/view
-# 
 #
 # It says there that "Morocco will resume its standard time on July 31,
 # 2011 at midnight." Now they don't say whether they mean midnight of
@@ -873,20 +787,16 @@ Zone	Indian/Mayotte	3:00:56 -	LMT	1911 J
 # also been like that in the past.
 
 # From Alexander Krivenyshev (2012-03-09):
-# According to Infomédiaire web site from Morocco (infomediaire.ma),
-# on March 9, 2012, (in French) Heure légale:
-# Le Maroc adopte officiellement l'heure d'été
-# 
+# According to Infomédiaire web site from Morocco (infomediaire.ma),
+# on March 9, 2012, (in French) Heure légale:
+# Le Maroc adopte officiellement l'heure d'été
 # http://www.infomediaire.ma/news/maroc/heure-l%C3%A9gale-le-maroc-adopte-officiellement-lheure-d%C3%A9t%C3%A9
-# 
 # Governing Council adopted draft decree, that Morocco DST starts on
 # the last Sunday of March (March 25, 2012) and ends on
 # last Sunday of September (September 30, 2012)
 # except the month of Ramadan.
 # or (brief)
-# 
 # http://www.worldtimezone.com/dst_news/dst_news_morocco06.html
-# 
 
 # From Arthur David Olson (2012-03-10):
 # The infomediaire.ma source indicates that the system is to be in
@@ -897,17 +807,13 @@ Zone	Indian/Mayotte	3:00:56 -	LMT	1911 J
 
 # From Christophe Tropamer (2012-03-16):
 # Seen Morocco change again:
-# 
 # http://www.le2uminutes.com/actualite.php
-# 
-# "...à partir du dernier dimance d'avril et non fins mars,
-# comme annoncé précédemment."
+# "...à partir du dernier dimanche d'avril et non fins mars,
+# comme annoncé précédemment."
 
 # From Milamber Space Network (2012-07-17):
 # The official return to GMT is announced by the Moroccan government:
-# 
 # http://www.mmsp.gov.ma/fr/actualites.aspx?id=288 [in French]
-# 
 #
 # Google translation, lightly edited:
 # Back to the standard time of the Kingdom (GMT)
@@ -1052,7 +958,7 @@ Zone Africa/Casablanca	-0:30:20 -	LMT	19
 # Assume that this has been true since Western Sahara switched to GMT,
 # since most of it was then controlled by Morocco.
 
-Zone Africa/El_Aaiun	-0:52:48 -	LMT	1934 Jan
+Zone Africa/El_Aaiun	-0:52:48 -	LMT	1934 Jan # El Aaiún
 			-1:00	-	WAT	1976 Apr 14
 			 0:00	Morocco	WE%sT
 
@@ -1102,15 +1008,17 @@ Zone	Africa/Niamey	 0:08:28 -	LMT	1912
 Zone	Africa/Lagos	0:13:36 -	LMT	1919 Sep
 			1:00	-	WAT
 
-# Reunion
+# Réunion
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Indian/Reunion	3:41:52 -	LMT	1911 Jun	# Saint-Denis
-			4:00	-	RET	# Reunion Time
+			4:00	-	RET	# Réunion Time
 #
-# Scattered Islands (Iles Eparses) administered from Reunion are as follows.
+# Crozet Islands also observes Réunion time; see the 'antarctica' file.
+#
+# Scattered Islands (Îles Éparses) administered from Réunion are as follows.
 # The following information about them is taken from
-# Iles Eparses (www.outre-mer.gouv.fr/domtom/ile.htm, 1997-07-22, in French;
-# no longer available as of 1999-08-17).
+# Îles Éparses (, 1997-07-22,
+# in French; no longer available as of 1999-08-17).
 # We have no info about their time zone histories.
 #
 # Bassas da India - uninhabited
@@ -1125,28 +1033,17 @@ Zone	Africa/Kigali	2:00:16 -	LMT	1935 Ju
 			2:00	-	CAT
 
 # St Helena
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Atlantic/St_Helena	-0:22:48 -	LMT	1890		# Jamestown
-			-0:22:48 -	JMT	1951	# Jamestown Mean Time
-			 0:00	-	GMT
+# See Africa/Abidjan.
 # The other parts of the St Helena territory are similar:
 #	Tristan da Cunha: on GMT, say Whitman and the CIA
-#	Ascension: on GMT, says usno1995 and the CIA
+#	Ascension: on GMT, say the USNO (1995-12-21) and the CIA
 #	Gough (scientific station since 1955; sealers wintered previously):
 #		on GMT, says the CIA
-#	Inaccessible, Nightingale: no information, but probably GMT
-
-# Sao Tome and Principe
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Sao_Tome	 0:26:56 -	LMT	1884
-			-0:36:32 -	LMT	1912	# Lisbon Mean Time
-			 0:00	-	GMT
+#	Inaccessible, Nightingale: uninhabited
 
+# São Tomé and Príncipe
 # Senegal
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Dakar	-1:09:44 -	LMT	1912
-			-1:00	-	WAT	1941 Jun
-			 0:00	-	GMT
+# See Africa/Abidjan.
 
 # Seychelles
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -1160,17 +1057,7 @@ Zone	Indian/Mahe	3:41:48 -	LMT	1906 Jun	
 # Possibly the islands were uninhabited.
 
 # Sierra Leone
-# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
-# Whitman gives Mar 31 - Aug 31 for 1931 on; go with Shanks & Pottenger.
-Rule	SL	1935	1942	-	Jun	 1	0:00	0:40	SLST
-Rule	SL	1935	1942	-	Oct	 1	0:00	0	WAT
-Rule	SL	1957	1962	-	Jun	 1	0:00	1:00	SLST
-Rule	SL	1957	1962	-	Sep	 1	0:00	0	GMT
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Freetown	-0:53:00 -	LMT	1882
-			-0:53:00 -	FMT	1913 Jun # Freetown Mean Time
-			-1:00	SL	%s	1957
-			 0:00	SL	%s
+# See Africa/Abidjan.
 
 # Somalia
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -1193,9 +1080,9 @@ Zone Africa/Johannesburg 1:52:00 -	LMT	1
 
 # Sudan
 #
-# From 
-# Sudan News Agency (2000-01-13)
-# , also reported by Michael De Beukelaer-Dossche via Steffen Thorsen:
+# From 
+# Sudan News Agency (2000-01-13),
+# also reported by Michaël De Beukelaer-Dossche via Steffen Thorsen:
 # Clocks will be moved ahead for 60 minutes all over the Sudan as of noon
 # Saturday....  This was announced Thursday by Caretaker State Minister for
 # Manpower Abdul-Rahman Nur-Eddin.
@@ -1226,14 +1113,12 @@ Zone Africa/Dar_es_Salaam 2:37:08 -	LMT	
 			3:00	-	EAT
 
 # Togo
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Lome	0:04:52 -	LMT	1893
-			0:00	-	GMT
+# See Africa/Abidjan.
 
 # Tunisia
 
 # From Gwillim Law (2005-04-30):
-# My correspondent, Risto Nykanen, has alerted me to another adoption of DST,
+# My correspondent, Risto Nykänen, has alerted me to another adoption of DST,
 # this time in Tunisia.  According to Yahoo France News
 # , in a story attributed to AP
 # and dated 2005-04-26, "Tunisia has decided to advance its official time by
@@ -1242,7 +1127,7 @@ Zone	Africa/Lome	0:04:52 -	LMT	1893
 # Saturday."  (My translation)
 #
 # From Oscar van Vlijmen (2005-05-02):
-# LaPresse, the first national daily newspaper ...
+# La Presse, the first national daily newspaper ...
 # 
 # ... DST for 2005: on: Sun May 1 0h standard time, off: Fri Sept. 30,
 # 1h standard time.
@@ -1256,18 +1141,12 @@ Zone	Africa/Lome	0:04:52 -	LMT	1893
 # From Steffen Thorsen (2009-03-16):
 # According to several news sources, Tunisia will not observe DST this year.
 # (Arabic)
-# 
 # http://www.elbashayer.com/?page=viewn&nid=42546
-# 
-# 
 # http://www.babnet.net/kiwidetail-15295.asp
-# 
 #
 # We have also confirmed this with the US embassy in Tunisia.
 # We have a wrap-up about this on the following page:
-# 
 # http://www.timeanddate.com/news/time/tunisia-cancels-dst-2009.html
-# 
 
 # From Alexander Krivenyshev (2009-03-17):
 # Here is a link to Tunis Afrique Presse News Agency
@@ -1275,20 +1154,17 @@ Zone	Africa/Lome	0:04:52 -	LMT	1893
 # Standard time to be kept the whole year long (tap.info.tn):
 #
 # (in English)
-# 
 # http://www.tap.info.tn/en/index.php?option=com_content&task=view&id=26813&Itemid=157
-# 
 #
 # (in Arabic)
-# 
 # http://www.tap.info.tn/ar/index.php?option=com_content&task=view&id=61240&Itemid=1
-# 
 
-# From Arthur David Olson (2009--3-18):
-# The Tunis Afrique Presse News Agency notice contains this: "This measure is due to the fact
-# that the fasting month of ramadan coincides with the period concerned by summer time.
-# Therefore, the standard time will be kept unchanged the whole year long."
-# So foregoing DST seems to be an exception (albeit one that may be repeated in the  future).
+# From Arthur David Olson (2009-03-18):
+# The Tunis Afrique Presse News Agency notice contains this: "This measure is
+# due to the fact that the fasting month of Ramadan coincides with the period
+# concerned by summer time.  Therefore, the standard time will be kept
+# unchanged the whole year long."  So foregoing DST seems to be an exception
+# (albeit one that may be repeated in the future).
 
 # From Alexander Krivenyshev (2010-03-27):
 # According to some news reports Tunis confirmed not to use DST in 2010
@@ -1300,12 +1176,8 @@ Zone	Africa/Lome	0:04:52 -	LMT	1893
 # coincided with the month of Ramadan..."
 #
 # (in Arabic)
-# 
 # http://www.moheet.com/show_news.aspx?nid=358861&pg=1
-# 
 # http://www.almadenahnews.com/newss/news.php?c=118&id=38036
-# or
-# 
 # http://www.worldtimezone.com/dst_news/dst_news_tunis02.html
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S

Modified: releng/9.3/contrib/tzdata/antarctica
==============================================================================
--- releng/9.3/contrib/tzdata/antarctica	Tue Oct 21 23:09:09 2014	(r273437)
+++ releng/9.3/contrib/tzdata/antarctica	Tue Oct 21 23:50:46 2014	(r273438)
@@ -1,16 +1,13 @@
-# 
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
 # From Paul Eggert (1999-11-15):
 # To keep things manageable, we list only locations occupied year-round; see
-# 
 # COMNAP - Stations and Bases
-# 
+# 
 # and
-# 
 # Summary of the Peri-Antarctic Islands (1998-07-23)
-# 
+# 
 # for information.
 # Unless otherwise specified, we have no time zone information.
 #
@@ -55,19 +52,19 @@ Rule	ChileAQ	2012	max	-	Sep	Sun>=2	4:00u
 
 # Argentina - year-round bases
 # Belgrano II, Confin Coast, -770227-0343737, since 1972-02-05
-# Esperanza, San Martin Land, -6323-05659, since 1952-12-17
-# Jubany, Potter Peninsula, King George Island, -6414-0602320, since 1982-01
-# Marambio, Seymour I, -6414-05637, since 1969-10-29
+# Carlini, Potter Cove, King George Island, -6414-0602320, since 1982-01
+# Esperanza, Hope Bay, -6323-05659, since 1952-12-17
+# Marambio, -6414-05637, since 1969-10-29
 # Orcadas, Laurie I, -6016-04444, since 1904-02-22
-# San Martin, Debenham I, -6807-06708, since 1951-03-21
+# San Martín, Barry I, -6808-06706, since 1951-03-21
 #	(except 1960-03 / 1976-03-21)
 
 # Australia - territories
 # Heard Island, McDonald Islands (uninhabited)
 #	previously sealers and scientific personnel wintered
-#	
 #	Margaret Turner reports
-#	 (1999-09-30) that they're UTC+5, with no DST;
+#	
+#	(1999-09-30) that they're UTC+5, with no DST;
 #	presumably this is when they have visitors.
 #
 # year-round bases
@@ -84,14 +81,10 @@ Rule	ChileAQ	2012	max	-	Sep	Sun>=2	4:00u
 # The changes occurred on 2009-10-18 at 02:00 (local times).
 #
 # Government source: (Australian Antarctic Division)
-# 
 # http://www.aad.gov.au/default.asp?casid=37079
-# 
 #
 # We have more background information here:
-# 
 # http://www.timeanddate.com/news/time/antarctica-new-times.html
-# 
 
 # From Steffen Thorsen (2010-03-10):
 # We got these changes from the Australian Antarctic Division: ...
@@ -106,19 +99,17 @@ Rule	ChileAQ	2012	max	-	Sep	Sun>=2	4:00u
 # - Mawson station stays on UTC+5.
 #
 # Background:
-# 
 # http://www.timeanddate.com/news/time/antartica-time-changes-2010.html
-# 
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Antarctica/Casey	0	-	zzz	1969
-			8:00	-	WST	2009 Oct 18 2:00
-						# Western (Aus) Standard Time
+			8:00	-	AWST	2009 Oct 18 2:00
+						# Australian Western Std Time
 			11:00	-	CAST	2010 Mar 5 2:00
 						# Casey Time
-			8:00	-	WST	2011 Oct 28 2:00
+			8:00	-	AWST	2011 Oct 28 2:00
 			11:00	-	CAST	2012 Feb 21 17:00u
-			8:00	-	WST
+			8:00	-	AWST
 Zone Antarctica/Davis	0	-	zzz	1957 Jan 13
 			7:00	-	DAVT	1964 Nov # Davis Time
 			0	-	zzz	1969 Feb
@@ -132,24 +123,27 @@ Zone Antarctica/Mawson	0	-	zzz	1954 Feb 
 						# Mawson Time
 			5:00	-	MAWT
 # References:
-# 
 # Casey Weather (1998-02-26)
-# 
-# 
+# 
 # Davis Station, Antarctica (1998-02-26)
-# 
-# 
+# 
 # Mawson Station, Antarctica (1998-02-25)
-# 
+# 
+
+# Belgium - year-round base
+# Princess Elisabeth, Queen Maud Land, -713412+0231200, since 2007
 
 # Brazil - year-round base
-# Comandante Ferraz, King George Island, -6205+05824, since 1983/4
+# Ferraz, King George Island, -6205+05824, since 1983/4
+
+# Bulgaria - year-round base
+# St. Kliment Ohridski, Livingston Island, -623829-0602153, since 1988
 
 # Chile - year-round bases and towns
 # Escudero, South Shetland Is, -621157-0585735, since 1994
-# Presidente Eduadro Frei, King George Island, -6214-05848, since 1969-03-07
-# General Bernardo O'Higgins, Antarctic Peninsula, -6319-05704, since 1948-02
-# Capitan Arturo Prat, -6230-05941
+# Frei Montalva, King George Island, -6214-05848, since 1969-03-07
+# O'Higgins, Antarctic Peninsula, -6319-05704, since 1948-02
+# Prat, -6230-05941
 # Villa Las Estrellas (a town), around the Frei base, since 1984-04-09
 # These locations have always used Santiago time; use TZ='America/Santiago'.
 
@@ -157,31 +151,35 @@ Zone Antarctica/Mawson	0	-	zzz	1954 Feb 
 # Great Wall, King George Island, -6213-05858, since 1985-02-20
 # Zhongshan, Larsemann Hills, Prydz Bay, -6922+07623, since 1989-02-26
 
-# France - year-round bases
+# France - year-round bases (also see "France & Italy")
 #
 # From Antoine Leca (1997-01-20):
 # Time data are from Nicole Pailleau at the IFRTP
 # (French Institute for Polar Research and Technology).
-# She confirms that French Southern Territories and Terre Adelie bases
-# don't observe daylight saving time, even if Terre Adelie supplies came
+# She confirms that French Southern Territories and Terre Adélie bases
+# don't observe daylight saving time, even if Terre Adélie supplies came
 # from Tasmania.
 #
 # French Southern Territories with year-round inhabitants
 #
-# Martin-de-Vivies Base, Amsterdam Island, -374105+0773155, since 1950
-# Alfred-Faure Base, Crozet Islands, -462551+0515152, since 1964
-# Port-aux-Francais, Kerguelen Islands, -492110+0701303, since 1951;
+# Alfred Faure, Possession Island, Crozet Islands, -462551+0515152, since 1964;
+#	sealing & whaling stations operated variously 1802/1911+;
+#	see Indian/Reunion.
+#
+# Martin-de-Viviès, Amsterdam Island, -374105+0773155, since 1950
+# Port-aux-Français, Kerguelen Islands, -492110+0701303, since 1951;
 #	whaling & sealing station operated 1908/1914, 1920/1929, and 1951/1956
 #
 # St Paul Island - near Amsterdam, uninhabited
 #	fishing stations operated variously 1819/1931
 #
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Indian/Kerguelen	0	-	zzz	1950	# Port-aux-Francais
+Zone Indian/Kerguelen	0	-	zzz	1950	# Port-aux-Français
 			5:00	-	TFT	# ISO code TF Time
 #
 # year-round base in the main continent
-# Dumont-d'Urville, Ile des Petrels, -6640+14001, since 1956-11
+# Dumont d'Urville, Île des Pétrels, -6640+14001, since 1956-11
+#  (2005-12-05)
 #
 # Another base at Port-Martin, 50km east, began operation in 1947.
 # It was destroyed by fire on 1952-01-14.
@@ -191,20 +189,22 @@ Zone Antarctica/DumontDUrville 0 -	zzz	1
 			10:00	-	PMT	1952 Jan 14 # Port-Martin Time
 			0	-	zzz	1956 Nov
 			10:00	-	DDUT	# Dumont-d'Urville Time
-# Reference:
-# 
-# Dumont d'Urville Station (2005-12-05)
-# 
+
+# France & Italy - year-round base
+# Concordia, -750600+1232000, since 2005
 
 # Germany - year-round base
-# Georg von Neumayer, -7039-00815
+# Neumayer III, -704080-0081602, since 2009
 
-# India - year-round base
-# Dakshin Gangotri, -7005+01200
+# India - year-round bases
+# Bharati, -692428+0761114, since 2012
+# Maitri, -704558+0114356, since 1989
+
+# Italy - year-round base (also see "France & Italy")
+# Zuchelli, Terra Nova Bay, -744140+1640647, since 1986
 
 # Japan - year-round bases
-# Dome Fuji, -7719+03942
-# Syowa, -690022+0393524
+# Syowa (also known as Showa), -690022+0393524, since 1957
 #
 # From Hideyuki Suzuki (1999-02-06):
 # In all Japanese stations, +0300 is used as the standard time.
@@ -216,11 +216,11 @@ Zone Antarctica/DumontDUrville 0 -	zzz	1
 Zone Antarctica/Syowa	0	-	zzz	1957 Jan 29
 			3:00	-	SYOT	# Syowa Time
 # See:
-# 
 # NIPR Antarctic Research Activities (1999-08-17)
-# 
+# 
 
 # S Korea - year-round base
+# Jang Bogo, Terra Nova Bay, -743700+1641205 since 2014
 # King Sejong, King George Island, -6213-05847, since 1988
 
 # New Zealand - claims
@@ -269,6 +269,9 @@ Zone Antarctica/Troll	0	-	zzz	2005 Feb 1
 # Poland - year-round base
 # Arctowski, King George Island, -620945-0582745, since 1977
 
+# Romania - year-bound base
+# Law-Racoviță, Larsemann Hills, -692319+0762251, since 1986
+
 # Russia - year-round bases
 # Bellingshausen, King George Island, -621159-0585337, since 1968-02-22
 # Mirny, Davis coast, -6633+09301, since 1956-02
@@ -278,8 +281,8 @@ Zone Antarctica/Troll	0	-	zzz	2005 Feb 1
 #	year-round from 1960/61 to 1992
 
 # Vostok, since 1957-12-16, temporarily closed 1994-02/1994-11
-# 
-# From Craig Mundell (1994-12-15):
+# From Craig Mundell (1994-12-15)
+# :
 # Vostok, which is one of the Russian stations, is set on the same
 # time as Moscow, Russia.
 #
@@ -294,7 +297,7 @@ Zone Antarctica/Troll	0	-	zzz	2005 Feb 1
 #
 # From Paul Eggert (2001-05-04):
 # This seems to be hopelessly confusing, so I asked Lee Hotz about it
-# in person.  He said that some Antartic locations set their local
+# in person.  He said that some Antarctic locations set their local
 # time so that noon is the warmest part of the day, and that this
 # changes during the year and does not necessarily correspond to mean
 # solar noon.  So the Vostok time might have been whatever the clocks
@@ -306,9 +309,12 @@ Zone Antarctica/Vostok	0	-	zzz	1957 Dec 
 
 # S Africa - year-round bases
 # Marion Island, -4653+03752
-# Sanae, -7141-00250
+# SANAE IV, Vesleskarvet, Queen Maud Land, -714022-0025026, since 1997
+
+# Ukraine - year-round base
+# Vernadsky (formerly Faraday), Galindez Island, -651445-0641526, since 1954
 
-# UK
+# United Kingdom
 #
 # British Antarctic Territories (BAT) claims
 # South Orkney Islands
@@ -364,7 +370,7 @@ Zone Antarctica/Palmer	0	-	zzz	1965
 # but that he found it more convenient to keep GMT+12
 # as supplies for the station were coming from McMurdo Sound,
 # which was on GMT+12 because New Zealand was on GMT+12 all year
-# at that time (1957).  (Source: Siple's book 90 degrees SOUTH.)
+# at that time (1957).  (Source: Siple's book 90 Degrees South.)
 #
 # From Susan Smith
 # http://www.cybertours.com/whs/pole10.html

Modified: releng/9.3/contrib/tzdata/asia
==============================================================================
--- releng/9.3/contrib/tzdata/asia	Tue Oct 21 23:09:09 2014	(r273437)
+++ releng/9.3/contrib/tzdata/asia	Tue Oct 21 23:50:46 2014	(r273438)

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-all@FreeBSD.ORG  Tue Oct 21 23:52:27 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 2DF0C99F;
 Tue, 21 Oct 2014 23:52:27 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 1596D12A;
 Tue, 21 Oct 2014 23:52:27 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LNqRON074690;
 Tue, 21 Oct 2014 23:52:27 GMT (envelope-from delphij@FreeBSD.org)
Received: (from delphij@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LNqQRN074686;
 Tue, 21 Oct 2014 23:52:26 GMT (envelope-from delphij@FreeBSD.org)
Message-Id: <201410212352.s9LNqQRN074686@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: delphij set sender to
 delphij@FreeBSD.org using -f
From: Xin LI 
Date: Tue, 21 Oct 2014 23:52:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-releng@freebsd.org
Subject: svn commit: r273439 - in releng: 10.0 10.0/contrib/tzdata
 10.0/sys/conf 8.4 8.4/share/zoneinfo 8.4/sys/conf 9.1 9.1/contrib/tzdata
 9.1/sys/conf 9.2 9.2/contrib/tzdata 9.2/sys/conf
X-SVN-Group: releng
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Tue, 21 Oct 2014 23:52:27 -0000

Author: delphij
Date: Tue Oct 21 23:52:25 2014
New Revision: 273439
URL: https://svnweb.freebsd.org/changeset/base/273439

Log:
  Time zone data file update. [EN-14:10]
  
  Approved by:	so

Added:
  releng/10.0/contrib/tzdata/zone1970.tab
  releng/8.4/share/zoneinfo/leap-seconds.list   (contents, props changed)
  releng/8.4/share/zoneinfo/zone1970.tab   (contents, props changed)
  releng/9.1/contrib/tzdata/leap-seconds.list
  releng/9.1/contrib/tzdata/zone1970.tab
  releng/9.2/contrib/tzdata/leap-seconds.list
  releng/9.2/contrib/tzdata/zone1970.tab
Modified:
  releng/10.0/UPDATING
  releng/10.0/contrib/tzdata/africa
  releng/10.0/contrib/tzdata/antarctica
  releng/10.0/contrib/tzdata/asia
  releng/10.0/contrib/tzdata/australasia
  releng/10.0/contrib/tzdata/backward
  releng/10.0/contrib/tzdata/etcetera
  releng/10.0/contrib/tzdata/europe
  releng/10.0/contrib/tzdata/factory
  releng/10.0/contrib/tzdata/leap-seconds.list
  releng/10.0/contrib/tzdata/northamerica
  releng/10.0/contrib/tzdata/pacificnew
  releng/10.0/contrib/tzdata/southamerica
  releng/10.0/contrib/tzdata/systemv
  releng/10.0/contrib/tzdata/yearistype.sh
  releng/10.0/contrib/tzdata/zone.tab
  releng/10.0/sys/conf/newvers.sh
  releng/8.4/UPDATING
  releng/8.4/share/zoneinfo/africa
  releng/8.4/share/zoneinfo/antarctica
  releng/8.4/share/zoneinfo/asia
  releng/8.4/share/zoneinfo/australasia
  releng/8.4/share/zoneinfo/backward
  releng/8.4/share/zoneinfo/etcetera
  releng/8.4/share/zoneinfo/europe
  releng/8.4/share/zoneinfo/factory
  releng/8.4/share/zoneinfo/northamerica
  releng/8.4/share/zoneinfo/pacificnew
  releng/8.4/share/zoneinfo/southamerica
  releng/8.4/share/zoneinfo/systemv
  releng/8.4/share/zoneinfo/yearistype.sh
  releng/8.4/share/zoneinfo/zone.tab
  releng/8.4/sys/conf/newvers.sh
  releng/9.1/UPDATING
  releng/9.1/contrib/tzdata/africa
  releng/9.1/contrib/tzdata/antarctica
  releng/9.1/contrib/tzdata/asia
  releng/9.1/contrib/tzdata/australasia
  releng/9.1/contrib/tzdata/backward
  releng/9.1/contrib/tzdata/etcetera
  releng/9.1/contrib/tzdata/europe
  releng/9.1/contrib/tzdata/factory
  releng/9.1/contrib/tzdata/leapseconds
  releng/9.1/contrib/tzdata/northamerica
  releng/9.1/contrib/tzdata/pacificnew
  releng/9.1/contrib/tzdata/southamerica
  releng/9.1/contrib/tzdata/systemv
  releng/9.1/contrib/tzdata/yearistype.sh
  releng/9.1/contrib/tzdata/zone.tab
  releng/9.1/sys/conf/newvers.sh
  releng/9.2/UPDATING
  releng/9.2/contrib/tzdata/africa
  releng/9.2/contrib/tzdata/antarctica
  releng/9.2/contrib/tzdata/asia
  releng/9.2/contrib/tzdata/australasia
  releng/9.2/contrib/tzdata/backward
  releng/9.2/contrib/tzdata/etcetera
  releng/9.2/contrib/tzdata/europe
  releng/9.2/contrib/tzdata/factory
  releng/9.2/contrib/tzdata/northamerica
  releng/9.2/contrib/tzdata/pacificnew
  releng/9.2/contrib/tzdata/southamerica
  releng/9.2/contrib/tzdata/systemv
  releng/9.2/contrib/tzdata/yearistype.sh
  releng/9.2/contrib/tzdata/zone.tab
  releng/9.2/sys/conf/newvers.sh

Modified: releng/10.0/UPDATING
==============================================================================
--- releng/10.0/UPDATING	Tue Oct 21 23:50:46 2014	(r273438)
+++ releng/10.0/UPDATING	Tue Oct 21 23:52:25 2014	(r273439)
@@ -16,6 +16,10 @@ from older versions of FreeBSD, try WITH
 stable/10, and then rebuild without this option. The bootstrap process from
 older version of current is a bit fragile.
 
+20141022:	p11	FreeBSD-EN-14:10.tzdata
+
+	Time zone data file update. [EN-14:10]
+
 20141021:	p10	FreeBSD-SA-14:20.rtsold
 			FreeBSD-SA-14:21.routed
 			FreeBSD-SA-14:22.namei

Modified: releng/10.0/contrib/tzdata/africa
==============================================================================
--- releng/10.0/contrib/tzdata/africa	Tue Oct 21 23:50:46 2014	(r273438)
+++ releng/10.0/contrib/tzdata/africa	Tue Oct 21 23:52:25 2014	(r273439)
@@ -1,4 +1,3 @@
-# 
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -35,13 +34,13 @@
 # Previous editions of this database used WAT, CAT, SAT, and EAT
 # for +0:00 through +3:00, respectively,
 # but Mark R V Murray reports that
-# `SAST' is the official abbreviation for +2:00 in the country of South Africa,
-# `CAT' is commonly used for +2:00 in countries north of South Africa, and
-# `WAT' is probably the best name for +1:00, as the common phrase for
-# the area that includes Nigeria is ``West Africa''.
-# He has heard of ``Western Sahara Time'' for +0:00 but can find no reference.
+# 'SAST' is the official abbreviation for +2:00 in the country of South Africa,
+# 'CAT' is commonly used for +2:00 in countries north of South Africa, and
+# 'WAT' is probably the best name for +1:00, as the common phrase for
+# the area that includes Nigeria is "West Africa".
+# He has heard of "Western Sahara Time" for +0:00 but can find no reference.
 #
-# To make things confusing, `WAT' seems to have been used for -1:00 long ago;
+# To make things confusing, 'WAT' seems to have been used for -1:00 long ago;
 # I'd guess that this was because people needed _some_ name for -1:00,
 # and at the time, far west Africa was the only major land area in -1:00.
 # This usage is now obsolete, as the last use of -1:00 on the African
@@ -54,7 +53,7 @@
 #	 2:00	SAST	South Africa Standard Time
 # and Murray suggests the following abbreviation:
 #	 1:00	WAT	West Africa Time
-# I realize that this leads to `WAT' being used for both -1:00 and 1:00
+# I realize that this leads to 'WAT' being used for both -1:00 and 1:00
 # for times before 1976, but this is the best I can think of
 # until we get more information.
 #
@@ -131,9 +130,7 @@ Zone	Africa/Gaborone	1:43:40 -	LMT	1885
 			2:00	-	CAT
 
 # Burkina Faso
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Africa/Ouagadougou	-0:06:04 -	LMT	1912
-			 0:00	-	GMT
+# See Africa/Abidjan.
 
 # Burundi
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -161,7 +158,7 @@ Zone	Africa/Bangui	1:14:20	-	LMT	1912
 
 # Chad
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Ndjamena	1:00:12 -	LMT	1912
+Zone	Africa/Ndjamena	1:00:12 -	LMT	1912 # N'Djamena
 			1:00	-	WAT	1979 Oct 14
 			1:00	1:00	WAST	1980 Mar  8
 			1:00	-	WAT
@@ -183,10 +180,20 @@ Zone Africa/Lubumbashi	1:49:52 -	LMT	189
 Zone Africa/Brazzaville	1:01:08 -	LMT	1912
 			1:00	-	WAT
 
-# Cote D'Ivoire
+# Côte D'Ivoire / Ivory Coast
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Africa/Abidjan	-0:16:08 -	LMT	1912
 			 0:00	-	GMT
+Link Africa/Abidjan Africa/Bamako	# Mali
+Link Africa/Abidjan Africa/Banjul	# Gambia
+Link Africa/Abidjan Africa/Conakry	# Guinea
+Link Africa/Abidjan Africa/Dakar	# Senegal
+Link Africa/Abidjan Africa/Freetown	# Sierra Leone
+Link Africa/Abidjan Africa/Lome		# Togo
+Link Africa/Abidjan Africa/Nouakchott	# Mauritania
+Link Africa/Abidjan Africa/Ouagadougou	# Burkina Faso
+Link Africa/Abidjan Africa/Sao_Tome	# São Tomé and Príncipe
+Link Africa/Abidjan Atlantic/St_Helena	# St Helena
 
 # Djibouti
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -231,30 +238,26 @@ Rule	Egypt	1990	1994	-	May	 1	1:00	1:00	
 # Egyptians would approve the cancellation."
 #
 # Egypt to cancel daylight saving time
-# 
 # http://www.almasryalyoum.com/en/node/407168
-# 
 # or
-# 
 # http://www.worldtimezone.com/dst_news/dst_news_egypt04.html
-# 
 Rule	Egypt	1995	2010	-	Apr	lastFri	 0:00s	1:00	S
-Rule	Egypt	1995	2005	-	Sep	lastThu	23:00s	0	-
+Rule	Egypt	1995	2005	-	Sep	lastThu	24:00	0	-
 # From Steffen Thorsen (2006-09-19):
 # The Egyptian Gazette, issue 41,090 (2006-09-18), page 1, reports:
 # Egypt will turn back clocks by one hour at the midnight of Thursday
 # after observing the daylight saving time since May.
 # http://news.gom.com.eg/gazette/pdf/2006/09/18/01.pdf
-Rule	Egypt	2006	only	-	Sep	21	23:00s	0	-
+Rule	Egypt	2006	only	-	Sep	21	24:00	0	-
 # From Dirk Losch (2007-08-14):
 # I received a mail from an airline which says that the daylight
 # saving time in Egypt will end in the night of 2007-09-06 to 2007-09-07.
-# From Jesper Norgaard Welen (2007-08-15): [The following agree:]
+# From Jesper Nørgaard Welen (2007-08-15): [The following agree:]
 # http://www.nentjes.info/Bill/bill5.htm
 # http://www.timeanddate.com/worldclock/city.html?n=53
 # From Steffen Thorsen (2007-09-04): The official information...:
 # http://www.sis.gov.eg/En/EgyptOnline/Miscellaneous/000002/0207000000000000001580.htm
-Rule	Egypt	2007	only	-	Sep	Thu>=1	23:00s	0	-
+Rule	Egypt	2007	only	-	Sep	Thu>=1	24:00	0	-
 # From Abdelrahman Hassan (2007-09-06):
 # Due to the Hijri (lunar Islamic calendar) year being 11 days shorter
 # than the year of the Gregorian calendar, Ramadan shifts earlier each
@@ -288,15 +291,9 @@ Rule	Egypt	2007	only	-	Sep	Thu>=1	23:00s
 #
 # timeanddate[2] and another site I've found[3] also support that.
 #
-# [1] 
-# https://bugzilla.redhat.com/show_bug.cgi?id=492263
-# 
-# [2] 
-# http://www.timeanddate.com/worldclock/clockchange.html?n=53
-# 
-# [3] 
-# http://wwp.greenwichmeantime.com/time-zone/africa/egypt/
-# 
+# [1] https://bugzilla.redhat.com/show_bug.cgi?id=492263
+# [2] http://www.timeanddate.com/worldclock/clockchange.html?n=53
+# [3] http://wwp.greenwichmeantime.com/time-zone/africa/egypt/
 
 # From Arthur David Olson (2009-04-20):
 # In 2009 (and for the next several years), Ramadan ends before the fourth
@@ -306,14 +303,10 @@ Rule	Egypt	2007	only	-	Sep	Thu>=1	23:00s
 # From Steffen Thorsen (2009-08-11):
 # We have been able to confirm the August change with the Egyptian Cabinet
 # Information and Decision Support Center:
-# 
 # http://www.timeanddate.com/news/time/egypt-dst-ends-2009.html
-# 
 #
 # The Middle East News Agency
-# 
 # http://www.mena.org.eg/index.aspx
-# 
 # also reports "Egypt starts winter time on August 21"
 # today in article numbered "71, 11/08/2009 12:25 GMT."
 # Only the title above is available without a subscription to their service,
@@ -321,25 +314,94 @@ Rule	Egypt	2007	only	-	Sep	Thu>=1	23:00s
 # (at least today).
 
 # From Alexander Krivenyshev (2010-07-20):
-# According to News from Egypt -  Al-Masry Al-Youm Egypt's cabinet has
+# According to News from Egypt - Al-Masry Al-Youm Egypt's cabinet has
 # decided that Daylight Saving Time will not be used in Egypt during
 # Ramadan.
 #
 # Arabic translation:
-# "Clocks to go back during Ramadan--and then forward again"
-# 
+# "Clocks to go back during Ramadan - and then forward again"
 # http://www.almasryalyoum.com/en/news/clocks-go-back-during-ramadan-and-then-forward-again
-# 
-# or
-# 
 # http://www.worldtimezone.com/dst_news/dst_news_egypt02.html
-# 
 
-Rule	Egypt	2008	only	-	Aug	lastThu	23:00s	0	-
-Rule	Egypt	2009	only	-	Aug	20	23:00s	0	-
-Rule	Egypt	2010	only	-	Aug	11	0:00	0	-
-Rule	Egypt	2010	only	-	Sep	10	0:00	1:00	S
-Rule	Egypt	2010	only	-	Sep	lastThu	23:00s	0	-
+# From Ahmad El-Dardiry (2014-05-07):
+# Egypt is to change back to Daylight system on May 15
+# http://english.ahram.org.eg/NewsContent/1/64/100735/Egypt/Politics-/Egypts-government-to-reapply-daylight-saving-time-.aspx
+
+# From Gunther Vermier (2015-05-13):
+# our Egypt office confirms that the change will be at 15 May "midnight" (24:00)
+
+# From Imed Chihi (2014-06-04):
+# We have finally "located" a precise official reference about the DST changes
+# in Egypt.  The Ministers Cabinet decision is explained at
+# http://www.cabinet.gov.eg/Media/CabinetMeetingsDetails.aspx?id=347 ...
+# [T]his (Arabic) site is not accessible outside Egypt, but the page ...
+# translates into: "With regard to daylight saving time, it is scheduled to
+# take effect at exactly twelve o'clock this evening, Thursday, 15 MAY 2014,
+# to be suspended by twelve o'clock on the evening of Thursday, 26 JUN 2014,
+# and re-established again at the end of the month of Ramadan, at twelve
+# o'clock on the evening of Thursday, 31 JUL 2014."  This statement has been
+# reproduced by other (more accessible) sites[, e.g.,]...
+# http://elgornal.net/news/news.aspx?id=4699258
+
+# From Paul Eggert (2014-06-04):
+# Sarah El Deeb and Lee Keath of AP report that the Egyptian government says
+# the change is because of blackouts in Cairo, even though Ahram Online (cited
+# above) says DST had no affect on electricity consumption.  There is
+# no information about when DST will end this fall.  See:
+# http://abcnews.go.com/International/wireStory/el-sissi-pushes-egyptians-line-23614833
+#
+# For now, guess that later spring and fall transitions will use
+# 2010's rules, and guess that Egypt will switch to standard time at
+# 24:00 the last Thursday before Ramadan, and back to DST at 00:00 the
+# first Friday after Ramadan.  To implement this,
+# transition dates for 2015 through 2037 were determined by running
+# the following program under GNU Emacs 24.3, with the results integrated
+# by hand into the table below.  Ramadan again intrudes on the guessed
+# DST starting in 2038, but that's beyond our somewhat-arbitrary cutoff.
+# (let ((islamic-year 1436))
+#   (while (< islamic-year 1460)
+#     (let ((a (calendar-islamic-to-absolute (list 9 1 islamic-year)))
+#           (b (calendar-islamic-to-absolute (list 10 1 islamic-year)))
+#           (friday 5))
+#       (while (/= friday (mod a 7))
+#         (setq a (1- a)))
+#       (while (/= friday (mod b 7))
+#         (setq b (1+ b)))
+#       (setq a (1- a))
+#       (setq b (1- b))
+#       (setq a (calendar-gregorian-from-absolute a))
+#       (setq b (calendar-gregorian-from-absolute b))
+#       (insert
+#        (format
+#         (concat "Rule\tEgypt\t%d\tonly\t-\t%s\t%2d\t24:00\t0\t-\n"
+#                 "Rule\tEgypt\t%d\tonly\t-\t%s\t%2d\t24:00\t1:00\tS\n")
+#         (car (cdr (cdr a))) (calendar-month-name (car a) t) (car (cdr a))
+#         (car (cdr (cdr b))) (calendar-month-name (car b) t) (car (cdr b)))))
+#     (setq islamic-year (+ 1 islamic-year))))
+Rule	Egypt	2008	only	-	Aug	lastThu	24:00	0	-
+Rule	Egypt	2009	only	-	Aug	20	24:00	0	-
+Rule	Egypt	2010	only	-	Aug	10	24:00	0	-
+Rule	Egypt	2010	only	-	Sep	 9	24:00	1:00	S
+Rule	Egypt	2010	only	-	Sep	lastThu	24:00	0	-
+Rule	Egypt	2014	only	-	May	15	24:00	1:00	S
+Rule	Egypt	2014	only	-	Jun	26	24:00	0	-
+Rule	Egypt	2014	only	-	Jul	31	24:00	1:00	S
+Rule	Egypt	2014	max	-	Sep	lastThu	24:00	0	-
+Rule	Egypt	2015	2019	-	Apr	lastFri	 0:00s	1:00	S
+Rule	Egypt	2015	only	-	Jun	11	24:00	0	-
+Rule	Egypt	2015	only	-	Jul	23	24:00	1:00	S
+Rule	Egypt	2016	only	-	Jun	 2	24:00	0	-
+Rule	Egypt	2016	only	-	Jul	 7	24:00	1:00	S
+Rule	Egypt	2017	only	-	May	25	24:00	0	-
+Rule	Egypt	2017	only	-	Jun	29	24:00	1:00	S
+Rule	Egypt	2018	only	-	May	10	24:00	0	-
+Rule	Egypt	2018	only	-	Jun	14	24:00	1:00	S
+Rule	Egypt	2019	only	-	May	 2	24:00	0	-
+Rule	Egypt	2019	only	-	Jun	 6	24:00	1:00	S
+Rule	Egypt	2020	only	-	May	28	24:00	1:00	S
+Rule	Egypt	2021	only	-	May	13	24:00	1:00	S
+Rule	Egypt	2022	only	-	May	 5	24:00	1:00	S
+Rule	Egypt	2023	max	-	Apr	lastFri	 0:00s	1:00	S
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Africa/Cairo	2:05:09 -	LMT	1900 Oct
@@ -359,10 +421,15 @@ Zone	Africa/Asmara	2:35:32 -	LMT	1870
 			3:00	-	EAT
 
 # Ethiopia
-# From Paul Eggert (2006-03-22):
-# Shanks & Pottenger write that Ethiopia had six narrowly-spaced time zones
-# between 1870 and 1890, and that they merged to 38E50 (2:35:20) in 1890.
-# We'll guess that 38E50 is for Adis Dera.
+# From Paul Eggert (2014-07-31):
+# Like the Swahili of Kenya and Tanzania, many Ethiopians keep a
+# 12-hour clock starting at our 06:00, so their "8 o'clock" is our
+# 02:00 or 14:00.  Keep this in mind when you ask the time in Amharic.
+#
+# Shanks & Pottenger write that Ethiopia had six narrowly-spaced time
+# zones between 1870 and 1890, that they merged to 38E50 (2:35:20) in
+# 1890, and that they switched to 3:00 on 1936-05-05.  Perhaps 38E50
+# was for Adis Dera.  Quite likely the Shanks data are wrong anyway.
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Africa/Addis_Ababa	2:34:48 -	LMT	1870
 			2:35:20	-	ADMT	1936 May 5    # Adis Dera MT
@@ -374,28 +441,24 @@ Zone Africa/Libreville	0:37:48 -	LMT	191
 			1:00	-	WAT
 
 # Gambia
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Banjul	-1:06:36 -	LMT	1912
-			-1:06:36 -	BMT	1935	# Banjul Mean Time
-			-1:00	-	WAT	1964
-			 0:00	-	GMT
+# See Africa/Abidjan.
 
 # Ghana
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
-# Whitman says DST was observed from 1931 to ``the present'';
-# go with Shanks & Pottenger.
-Rule	Ghana	1936	1942	-	Sep	 1	0:00	0:20	GHST
-Rule	Ghana	1936	1942	-	Dec	31	0:00	0	GMT
+# Whitman says DST was observed from 1931 to "the present";
+# Shanks & Pottenger say 1936 to 1942;
+# and September 1 to January 1 is given by:
+# Scott Keltie J, Epstein M (eds), The Statesman's Year-Book,
+# 57th ed. Macmillan, London (1920), OCLC 609408015, pp xxviii.
+# For lack of better info, assume DST was observed from 1920 to 1942.
+Rule	Ghana	1920	1942	-	Sep	 1	0:00	0:20	GHST
+Rule	Ghana	1920	1942	-	Dec	31	0:00	0	GMT
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Africa/Accra	-0:00:52 -	LMT	1918
 			 0:00	Ghana	%s
 
 # Guinea
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Conakry	-0:54:52 -	LMT	1912
-			 0:00	-	GMT	1934 Feb 26
-			-1:00	-	WAT	1960
-			 0:00	-	GMT
+# See Africa/Abidjan.
 
 # Guinea-Bissau
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -503,18 +566,8 @@ Zone	Africa/Blantyre	2:20:00 -	LMT	1903 
 			2:00	-	CAT
 
 # Mali
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Bamako	-0:32:00 -	LMT	1912
-			 0:00	-	GMT	1934 Feb 26
-			-1:00	-	WAT	1960 Jun 20
-			 0:00	-	GMT
-
 # Mauritania
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Africa/Nouakchott	-1:03:48 -	LMT	1912
-			 0:00	-	GMT	1934 Feb 26
-			-1:00	-	WAT	1960 Nov 28
-			 0:00	-	GMT
+# See Africa/Abidjan.
 
 # Mauritius
 
@@ -538,9 +591,7 @@ Zone Africa/Nouakchott	-1:03:48 -	LMT	19
 
 # From Steffen Thorsen (2008-07-10):
 # According to
-# 
 # http://www.lexpress.mu/display_article.php?news_id=111216
-# 
 # (in French), Mauritius will start and end their DST a few days earlier
 # than previously announced (2008-11-01 to 2009-03-31).  The new start
 # date is 2008-10-26 at 02:00 and the new end date is 2009-03-27 (no time
@@ -559,18 +610,13 @@ Zone Africa/Nouakchott	-1:03:48 -	LMT	19
 # published on Monday, June 30, 2008...
 #
 # I guess that article in French "Le gouvernement avance l'introduction
-# de l'heure d'ete" stating that DST in Mauritius starting on October 26
-# and ending on March 27, 2009 is the most recent one.
-# ...
-# 
+# de l'heure d'été" stating that DST in Mauritius starting on October 26
+# and ending on March 27, 2009 is the most recent one....
 # http://www.worldtimezone.com/dst_news/dst_news_mauritius02.html
-# 
 
 # From Riad M. Hossen Ally (2008-08-03):
 # The Government of Mauritius weblink
-# 
 # http://www.gov.mu/portal/site/pmosite/menuitem.4ca0efdee47462e7440a600248a521ca/?content_id=4728ca68b2a5b110VgnVCM1000000a04a8c0RCRD
-# 
 # Cabinet Decision of July 18th, 2008 states as follows:
 #
 # 4. ...Cabinet has agreed to the introduction into the National Assembly
@@ -580,33 +626,25 @@ Zone Africa/Nouakchott	-1:03:48 -	LMT	19
 # States of America. It will start at two o'clock in the morning on the
 # last Sunday of October and will end at two o'clock in the morning on
 # the last Sunday of March the following year. The summer time for the
-# year 2008 - 2009 will, therefore, be effective as from 26 October 2008
+# year 2008-2009 will, therefore, be effective as from 26 October 2008
 # and end on 29 March 2009.
 
 # From Ed Maste (2008-10-07):
 # THE TIME BILL (No. XXVII of 2008) Explanatory Memorandum states the
 # beginning / ending of summer time is 2 o'clock standard time in the
 # morning of the last Sunday of October / last Sunday of March.
-# 
 # http://www.gov.mu/portal/goc/assemblysite/file/bill2708.pdf
-# 
 
 # From Steffen Thorsen (2009-06-05):
 # According to several sources, Mauritius will not continue to observe
 # DST the coming summer...
 #
 # Some sources, in French:
-# 
 # http://www.defimedia.info/news/946/Rashid-Beebeejaun-:-%C2%AB-L%E2%80%99heure-d%E2%80%99%C3%A9t%C3%A9-ne-sera-pas-appliqu%C3%A9e-cette-ann%C3%A9e-%C2%BB
-# 
-# 
 # http://lexpress.mu/Story/3398~Beebeejaun---Les-objectifs-d-%C3%A9conomie-d-%C3%A9nergie-de-l-heure-d-%C3%A9t%C3%A9-ont-%C3%A9t%C3%A9-atteints-
-# 
 #
 # Our wrap-up:
-# 
 # http://www.timeanddate.com/news/time/mauritius-dst-will-not-repeat.html
-# 
 
 # From Arthur David Olson (2009-07-11):
 # The "mauritius-dst-will-not-repeat" wrapup includes this:
@@ -630,7 +668,7 @@ Zone	Indian/Mayotte	3:00:56 -	LMT	1911 J
 			3:00	-	EAT
 
 # Morocco
-# See the `europe' file for Spanish Morocco (Africa/Ceuta).
+# See the 'europe' file for Spanish Morocco (Africa/Ceuta).
 
 # From Alex Krivenyshev (2008-05-09):
 # Here is an article that Morocco plan to introduce Daylight Saving Time between
@@ -638,60 +676,43 @@ Zone	Indian/Mayotte	3:00:56 -	LMT	1911 J
 #
 # "... Morocco is to save energy by adjusting its clock during summer so it will
 # be one hour ahead of GMT between 1 June and 27 September, according to
-# Communication Minister and Gov ernment Spokesman, Khalid Naciri...."
+# Communication Minister and Government Spokesman, Khalid Naciri...."
 #
-# 
 # http://www.worldtimezone.net/dst_news/dst_news_morocco01.html
-# 
-# OR
-# 
 # http://en.afrik.com/news11892.html
-# 
 
 # From Alex Krivenyshev (2008-05-09):
 # The Morocco time change can be confirmed on Morocco web site Maghreb Arabe Presse:
-# 
 # http://www.map.ma/eng/sections/box3/morocco_shifts_to_da/view
-# 
 #
 # Morocco shifts to daylight time on June 1st through September 27, Govt.
 # spokesman.
 
 # From Patrice Scattolin (2008-05-09):
 # According to this article:
-# 
 # http://www.avmaroc.com/actualite/heure-dete-comment-a127896.html
-# 
-# (and republished here:
-# 
-# http://www.actu.ma/heure-dete-comment_i127896_0.html
-# 
-# )
-# the changes occurs at midnight:
-#
-# saturday night may 31st at midnight (which in french is to be
-# intrepreted as the night between saturday and sunday)
-# sunday night the 28th  at midnight
-#
-# Seeing that the 28th is monday, I am guessing that she intends to say
-# the midnight of the 28th which is the midnight between sunday and
-# monday, which jives with other sources that say that it's inclusive
-# june1st to sept 27th.
+# (and republished here: )
+# the changes occur at midnight:
+#
+# Saturday night May 31st at midnight (which in French is to be
+# interpreted as the night between Saturday and Sunday)
+# Sunday night the 28th at midnight
+#
+# Seeing that the 28th is Monday, I am guessing that she intends to say
+# the midnight of the 28th which is the midnight between Sunday and
+# Monday, which jives with other sources that say that it's inclusive
+# June 1st to Sept 27th.
 #
 # The decision was taken by decree *2-08-224 *but I can't find the decree
 # published on the web.
 #
 # It's also confirmed here:
-# 
 # http://www.maroc.ma/NR/exeres/FACF141F-D910-44B0-B7FA-6E03733425D1.htm
-# 
-# on a government portal as being  between june 1st and sept 27th (not yet
-# posted in english).
+# on a government portal as being between June 1st and Sept 27th (not yet
+# posted in English).
 #
-# The following google query will generate many relevant hits:
-# 
+# The following Google query will generate many relevant hits:
 # http://www.google.com/search?hl=en&q=Conseil+de+gouvernement+maroc+heure+avance&btnG=Search
-# 
 
 # From Steffen Thorsen (2008-08-27):
 # Morocco will change the clocks back on the midnight between August 31
@@ -699,47 +720,32 @@ Zone	Indian/Mayotte	3:00:56 -	LMT	1911 J
 # of September:
 #
 # One article about it (in French):
-# 
 # http://www.menara.ma/fr/Actualites/Maroc/Societe/ci.retour_a_l_heure_gmt_a_partir_du_dimanche_31_aout_a_minuit_officiel_.default
-# 
 #
 # We have some further details posted here:
-# 
 # http://www.timeanddate.com/news/time/morocco-ends-dst-early-2008.html
-# 
 
 # From Steffen Thorsen (2009-03-17):
 # Morocco will observe DST from 2009-06-01 00:00 to 2009-08-21 00:00 according
 # to many sources, such as
-# 
 # http://news.marweb.com/morocco/entertainment/morocco-daylight-saving.html
-# 
-# 
 # http://www.medi1sat.ma/fr/depeche.aspx?idp=2312
-# 
 # (French)
 #
 # Our summary:
-# 
 # http://www.timeanddate.com/news/time/morocco-starts-dst-2009.html
-# 
 
 # From Alexander Krivenyshev (2009-03-17):
 # Here is a link to official document from Royaume du Maroc Premier Ministre,
-# Ministere de la Modernisation des Secteurs Publics
+# Ministère de la Modernisation des Secteurs Publics
 #
 # Under Article 1 of Royal Decree No. 455-67 of Act 23 safar 1387 (2 june 1967)
 # concerning the amendment of the legal time, the Ministry of Modernization of
 # Public Sectors announced that the official time in the Kingdom will be
 # advanced 60 minutes from Sunday 31 May 2009 at midnight.
 #
-# 
 # http://www.mmsp.gov.ma/francais/Actualites_fr/PDF_Actualites_Fr/HeureEte_FR.pdf
-# 
-#
-# 
 # http://www.worldtimezone.com/dst_news/dst_news_morocco03.html
-# 
 
 # From Steffen Thorsen (2010-04-13):
 # Several news media in Morocco report that the Ministry of Modernization
@@ -747,14 +753,10 @@ Zone	Indian/Mayotte	3:00:56 -	LMT	1911 J
 # 2010-05-02 to 2010-08-08.
 #
 # Example:
-# 
 # http://www.lavieeco.com/actualites/4099-le-maroc-passera-a-l-heure-d-ete-gmt1-le-2-mai.html
-# 
 # (French)
 # Our page:
-# 
 # http://www.timeanddate.com/news/time/morocco-starts-dst-2010.html
-# 
 
 # From Dan Abitol (2011-03-30):
 # ...Rules for Africa/Casablanca are the following (24h format)
@@ -764,34 +766,20 @@ Zone	Indian/Mayotte	3:00:56 -	LMT	1911 J
 # The change was broadcast on the FM Radio
 # I ve called ANRT (telecom regulations in Morocco) at
 # +212.537.71.84.00
-# 
 # http://www.anrt.net.ma/fr/
-# 
 # They said that
-# 
 # http://www.map.ma/fr/sections/accueil/l_heure_legale_au_ma/view
-# 
 # is the official publication to look at.
 # They said that the decision was already taken.
 #
 # More articles in the press
-# 
-# http://www.yabiladi.com/articles/details/5058/secret-l-heure-d-ete-maroc-lev
-# 
-# e.html
-# 
+# http://www.yabiladi.com/articles/details/5058/secret-l-heure-d-ete-maroc-leve.html
 # http://www.lematin.ma/Actualite/Express/Article.asp?id=148923
-# 
-# 
 # http://www.lavieeco.com/actualite/Le-Maroc-passe-sur-GMT%2B1-a-partir-de-dim
-# anche-prochain-5538.html
-# 
 
 # From Petr Machata (2011-03-30):
 # They have it written in English here:
-# 
 # http://www.map.ma/eng/sections/home/morocco_to_spring_fo/view
-# 
 #
 # It says there that "Morocco will resume its standard time on July 31,
 # 2011 at midnight." Now they don't say whether they mean midnight of
@@ -799,20 +787,16 @@ Zone	Indian/Mayotte	3:00:56 -	LMT	1911 J
 # also been like that in the past.
 
 # From Alexander Krivenyshev (2012-03-09):
-# According to Infomédiaire web site from Morocco (infomediaire.ma),
-# on March 9, 2012, (in French) Heure légale:
-# Le Maroc adopte officiellement l'heure d'été
-# 
+# According to Infomédiaire web site from Morocco (infomediaire.ma),
+# on March 9, 2012, (in French) Heure légale:
+# Le Maroc adopte officiellement l'heure d'été
 # http://www.infomediaire.ma/news/maroc/heure-l%C3%A9gale-le-maroc-adopte-officiellement-lheure-d%C3%A9t%C3%A9
-# 
 # Governing Council adopted draft decree, that Morocco DST starts on
 # the last Sunday of March (March 25, 2012) and ends on
 # last Sunday of September (September 30, 2012)
 # except the month of Ramadan.
 # or (brief)
-# 
 # http://www.worldtimezone.com/dst_news/dst_news_morocco06.html
-# 
 
 # From Arthur David Olson (2012-03-10):
 # The infomediaire.ma source indicates that the system is to be in
@@ -823,17 +807,13 @@ Zone	Indian/Mayotte	3:00:56 -	LMT	1911 J
 
 # From Christophe Tropamer (2012-03-16):
 # Seen Morocco change again:
-# 
 # http://www.le2uminutes.com/actualite.php
-# 
-# "...à partir du dernier dimance d'avril et non fins mars,
-# comme annoncé précédemment."
+# "...à partir du dernier dimanche d'avril et non fins mars,
+# comme annoncé précédemment."
 
 # From Milamber Space Network (2012-07-17):
 # The official return to GMT is announced by the Moroccan government:
-# 
 # http://www.mmsp.gov.ma/fr/actualites.aspx?id=288 [in French]
-# 
 #
 # Google translation, lightly edited:
 # Back to the standard time of the Kingdom (GMT)
@@ -868,39 +848,39 @@ Zone	Indian/Mayotte	3:00:56 -	LMT	1911 J
 # Another source (specifying the time for start and end in the decree):
 # http://www.lemag.ma/Heure-d-ete-au-Maroc-jusqu-au-27-octobre_a75620.html
 
-# From Paul Eggert (2013-10-03):
-# To estimate what the Moroccan government will do in future years,
-# transition dates for 2014 through 2038 were determined by running
-# the following program under GNU Emacs 24.3:
-#
-# (let ((islamic-year 1435))
-#   (while (< islamic-year 1461)
-#     (let ((a
-#	     (calendar-gregorian-from-absolute
-#	      (calendar-islamic-to-absolute (list 9 1 islamic-year))))
-#	    (b
-#	     (calendar-gregorian-from-absolute
-#	      (calendar-islamic-to-absolute (list 10 1 islamic-year)))))
-#	(insert
-#	 (format
-#	  (concat "Rule\tMorocco\t%d\tonly\t-\t%s\t %2d\t 3:00\t0\t-\n"
-#		  "Rule\tMorocco\t%d\tonly\t-\t%s\t %2d\t 2:00\t1:00\tS\n")
-#	  (car (cdr (cdr a))) (calendar-month-name (car a) t) (car (cdr a))
-#	  (car (cdr (cdr b))) (calendar-month-name (car b) t) (car (cdr b)))))
+# From Sebastien Willemijns (2014-03-18):
+# http://www.afriquinfos.com/articles/2014/3/18/maroc-heure-dete-avancez-tous-horloges-247891.asp
+
+# From Milamber Space Network (2014-06-05):
+# The Moroccan government has recently announced that the country will return
+# to standard time at 03:00 on Saturday, June 28, 2014 local time....  DST
+# will resume again at 02:00 on Saturday, August 2, 2014....
+# http://www.mmsp.gov.ma/fr/actualites.aspx?id=586
+
+# From Paul Eggert (2014-06-05):
+# For now, guess that later spring and fall transitions will use 2014's rules,
+# and guess that Morocco will switch to standard time at 03:00 the last
+# Saturday before Ramadan, and back to DST at 02:00 the first Saturday after
+# Ramadan.  To implement this, transition dates for 2015 through 2037 were
+# determined by running the following program under GNU Emacs 24.3, with the
+# results integrated by hand into the table below.
+# (let ((islamic-year 1436))
+#   (while (< islamic-year 1460)
+#     (let ((a (calendar-islamic-to-absolute (list 9 1 islamic-year)))
+#           (b (calendar-islamic-to-absolute (list 10 1 islamic-year)))
+#           (saturday 6))
+#       (while (/= saturday (mod (setq a (1- a)) 7)))
+#       (while (/= saturday (mod b 7))
+#         (setq b (1+ b)))
+#       (setq a (calendar-gregorian-from-absolute a))
+#       (setq b (calendar-gregorian-from-absolute b))
+#       (insert
+#        (format
+#         (concat "Rule\tMorocco\t%d\tonly\t-\t%s\t%2d\t 3:00\t0\t-\n"
+#                 "Rule\tMorocco\t%d\tonly\t-\t%s\t%2d\t 2:00\t1:00\tS\n")
+#         (car (cdr (cdr a))) (calendar-month-name (car a) t) (car (cdr a))
+#         (car (cdr (cdr b))) (calendar-month-name (car b) t) (car (cdr b)))))
 #     (setq islamic-year (+ 1 islamic-year))))
-#
-# with spring-forward transitions removed for 2023-2025, when the
-# normal spring-forward date falls during the estimated Ramadan; with
-# all transitions removed for 2026-2035, where the estimated Ramadan
-# falls entirely outside daylight-saving time; and with fall-back
-# transitions removed for 2036-2037, where the normal fall-back
-# date falls during the estimated Ramadan.  Normally, the table would
-# stop after 2037 because 32-bit time_t values roll around early in 2038,
-# but that would imply a prediction of perpetual DST after March 2038
-# due to the year-2037 glitches.  So, this table instead stops after
-# 2038, the first non-glitchy year after the 32-bit rollover.
-# An advantage of stopping after 2038 is that it lets zic guess
-# TZ='WET0WEST,M3.5.0,M10.5.0/3' for time stamps far in the future.
 
 # RULE	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 
@@ -922,46 +902,44 @@ Rule	Morocco	1978	only	-	Aug	 4	 0:00	0	
 Rule	Morocco	2008	only	-	Jun	 1	 0:00	1:00	S
 Rule	Morocco	2008	only	-	Sep	 1	 0:00	0	-
 Rule	Morocco	2009	only	-	Jun	 1	 0:00	1:00	S
-Rule	Morocco	2009	only	-	Aug	 21	 0:00	0	-
+Rule	Morocco	2009	only	-	Aug	21	 0:00	0	-
 Rule	Morocco	2010	only	-	May	 2	 0:00	1:00	S
 Rule	Morocco	2010	only	-	Aug	 8	 0:00	0	-
 Rule	Morocco	2011	only	-	Apr	 3	 0:00	1:00	S
-Rule	Morocco	2011	only	-	Jul	 31	 0	0	-
-Rule	Morocco	2012	2013	-	Apr	 lastSun 2:00	1:00	S
-Rule	Morocco	2012	only	-	Sep	 30	 3:00	0	-
-Rule	Morocco	2012	only	-	Jul	 20	 3:00	0	-
-Rule	Morocco	2012	only	-	Aug	 20	 2:00	1:00	S
-Rule	Morocco	2013	only	-	Jul	  7	 3:00	0	-
-Rule	Morocco	2013	only	-	Aug	 10	 2:00	1:00	S
-Rule	Morocco	2013	2035	-	Oct	 lastSun 3:00	0	-
-Rule	Morocco	2014	2022	-	Mar	 lastSun 2:00	1:00	S
-Rule	Morocco	2014	only	-	Jun	 29	 3:00	0	-
-Rule	Morocco	2014	only	-	Jul	 29	 2:00	1:00	S
-Rule	Morocco	2015	only	-	Jun	 18	 3:00	0	-
-Rule	Morocco	2015	only	-	Jul	 18	 2:00	1:00	S
-Rule	Morocco	2016	only	-	Jun	  7	 3:00	0	-
-Rule	Morocco	2016	only	-	Jul	  7	 2:00	1:00	S
-Rule	Morocco	2017	only	-	May	 27	 3:00	0	-
-Rule	Morocco	2017	only	-	Jun	 26	 2:00	1:00	S
-Rule	Morocco	2018	only	-	May	 16	 3:00	0	-
-Rule	Morocco	2018	only	-	Jun	 15	 2:00	1:00	S
-Rule	Morocco	2019	only	-	May	  6	 3:00	0	-
-Rule	Morocco	2019	only	-	Jun	  5	 2:00	1:00	S
-Rule	Morocco	2020	only	-	Apr	 24	 3:00	0	-
-Rule	Morocco	2020	only	-	May	 24	 2:00	1:00	S
-Rule	Morocco	2021	only	-	Apr	 13	 3:00	0	-
-Rule	Morocco	2021	only	-	May	 13	 2:00	1:00	S
-Rule	Morocco	2022	only	-	Apr	  3	 3:00	0	-
-Rule	Morocco	2022	only	-	May	  3	 2:00	1:00	S
-Rule	Morocco	2023	only	-	Apr	 22	 2:00	1:00	S
-Rule	Morocco	2024	only	-	Apr	 10	 2:00	1:00	S
-Rule	Morocco	2025	only	-	Mar	 31	 2:00	1:00	S
-Rule	Morocco	2026	max	-	Mar	 lastSun 2:00	1:00	S
-Rule	Morocco	2036	only	-	Oct	 21	 3:00	0	-
-Rule	Morocco	2037	only	-	Oct	 11	 3:00	0	-
-Rule	Morocco	2038	only	-	Sep	 30	 3:00	0	-
-Rule	Morocco	2038	only	-	Oct	 30	 2:00	1:00	S
-Rule	Morocco	2038	max	-	Oct	 lastSun 3:00	0	-
+Rule	Morocco	2011	only	-	Jul	31	 0	0	-
+Rule	Morocco	2012	2013	-	Apr	lastSun	 2:00	1:00	S
+Rule	Morocco	2012	only	-	Sep	30	 3:00	0	-
+Rule	Morocco	2012	only	-	Jul	20	 3:00	0	-
+Rule	Morocco	2012	only	-	Aug	20	 2:00	1:00	S
+Rule	Morocco	2013	only	-	Jul	 7	 3:00	0	-
+Rule	Morocco	2013	only	-	Aug	10	 2:00	1:00	S
+Rule	Morocco	2013	max	-	Oct	lastSun	 3:00	0	-
+Rule	Morocco	2014	2022	-	Mar	lastSun	 2:00	1:00	S
+Rule	Morocco	2014	only	-	Jun	28	 3:00	0	-
+Rule	Morocco	2014	only	-	Aug	 2	 2:00	1:00	S
+Rule	Morocco	2015	only	-	Jun	13	 3:00	0	-
+Rule	Morocco	2015	only	-	Jul	18	 2:00	1:00	S
+Rule	Morocco	2016	only	-	Jun	 4	 3:00	0	-
+Rule	Morocco	2016	only	-	Jul	 9	 2:00	1:00	S
+Rule	Morocco	2017	only	-	May	20	 3:00	0	-
+Rule	Morocco	2017	only	-	Jul	 1	 2:00	1:00	S
+Rule	Morocco	2018	only	-	May	12	 3:00	0	-
+Rule	Morocco	2018	only	-	Jun	16	 2:00	1:00	S
+Rule	Morocco	2019	only	-	May	 4	 3:00	0	-
+Rule	Morocco	2019	only	-	Jun	 8	 2:00	1:00	S
+Rule	Morocco	2020	only	-	Apr	18	 3:00	0	-
+Rule	Morocco	2020	only	-	May	30	 2:00	1:00	S
+Rule	Morocco	2021	only	-	Apr	10	 3:00	0	-
+Rule	Morocco	2021	only	-	May	15	 2:00	1:00	S
+Rule	Morocco	2022	only	-	Apr	 2	 3:00	0	-
+Rule	Morocco	2022	only	-	May	 7	 2:00	1:00	S
+Rule	Morocco	2023	only	-	Apr	22	 2:00	1:00	S
+Rule	Morocco	2024	only	-	Apr	13	 2:00	1:00	S
+Rule	Morocco	2025	only	-	Apr	 5	 2:00	1:00	S
+Rule	Morocco	2026	max	-	Mar	lastSun	 2:00	1:00	S
+Rule	Morocco	2035	only	-	Oct	27	 3:00	0	-
+Rule	Morocco	2036	only	-	Oct	18	 3:00	0	-
+Rule	Morocco	2037	only	-	Oct	10	 3:00	0	-
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Africa/Casablanca	-0:30:20 -	LMT	1913 Oct 26
@@ -980,7 +958,7 @@ Zone Africa/Casablanca	-0:30:20 -	LMT	19
 # Assume that this has been true since Western Sahara switched to GMT,
 # since most of it was then controlled by Morocco.
 
-Zone Africa/El_Aaiun	-0:52:48 -	LMT	1934 Jan
+Zone Africa/El_Aaiun	-0:52:48 -	LMT	1934 Jan # El Aaiún
 			-1:00	-	WAT	1976 Apr 14
 			 0:00	Morocco	WE%sT
 
@@ -1030,15 +1008,17 @@ Zone	Africa/Niamey	 0:08:28 -	LMT	1912
 Zone	Africa/Lagos	0:13:36 -	LMT	1919 Sep
 			1:00	-	WAT
 
-# Reunion
+# Réunion
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Indian/Reunion	3:41:52 -	LMT	1911 Jun	# Saint-Denis
-			4:00	-	RET	# Reunion Time
+			4:00	-	RET	# Réunion Time
 #
-# Scattered Islands (Iles Eparses) administered from Reunion are as follows.
+# Crozet Islands also observes Réunion time; see the 'antarctica' file.
+#
+# Scattered Islands (Îles Éparses) administered from Réunion are as follows.
 # The following information about them is taken from
-# Iles Eparses (www.outre-mer.gouv.fr/domtom/ile.htm, 1997-07-22, in French;
-# no longer available as of 1999-08-17).
+# Îles Éparses (, 1997-07-22,
+# in French; no longer available as of 1999-08-17).
 # We have no info about their time zone histories.
 #
 # Bassas da India - uninhabited
@@ -1053,28 +1033,17 @@ Zone	Africa/Kigali	2:00:16 -	LMT	1935 Ju
 			2:00	-	CAT
 
 # St Helena
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Atlantic/St_Helena	-0:22:48 -	LMT	1890		# Jamestown
-			-0:22:48 -	JMT	1951	# Jamestown Mean Time
-			 0:00	-	GMT
+# See Africa/Abidjan.
 # The other parts of the St Helena territory are similar:
 #	Tristan da Cunha: on GMT, say Whitman and the CIA
-#	Ascension: on GMT, says usno1995 and the CIA
+#	Ascension: on GMT, say the USNO (1995-12-21) and the CIA
 #	Gough (scientific station since 1955; sealers wintered previously):
 #		on GMT, says the CIA
-#	Inaccessible, Nightingale: no information, but probably GMT
-
-# Sao Tome and Principe
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Sao_Tome	 0:26:56 -	LMT	1884
-			-0:36:32 -	LMT	1912	# Lisbon Mean Time
-			 0:00	-	GMT
+#	Inaccessible, Nightingale: uninhabited
 
+# São Tomé and Príncipe
 # Senegal
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Dakar	-1:09:44 -	LMT	1912
-			-1:00	-	WAT	1941 Jun
-			 0:00	-	GMT
+# See Africa/Abidjan.
 
 # Seychelles
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -1088,17 +1057,7 @@ Zone	Indian/Mahe	3:41:48 -	LMT	1906 Jun	
 # Possibly the islands were uninhabited.
 
 # Sierra Leone
-# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
-# Whitman gives Mar 31 - Aug 31 for 1931 on; go with Shanks & Pottenger.
-Rule	SL	1935	1942	-	Jun	 1	0:00	0:40	SLST
-Rule	SL	1935	1942	-	Oct	 1	0:00	0	WAT
-Rule	SL	1957	1962	-	Jun	 1	0:00	1:00	SLST
-Rule	SL	1957	1962	-	Sep	 1	0:00	0	GMT
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Freetown	-0:53:00 -	LMT	1882
-			-0:53:00 -	FMT	1913 Jun # Freetown Mean Time
-			-1:00	SL	%s	1957
-			 0:00	SL	%s
+# See Africa/Abidjan.
 
 # Somalia
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -1121,9 +1080,9 @@ Zone Africa/Johannesburg 1:52:00 -	LMT	1
 
 # Sudan
 #
-# From 
-# Sudan News Agency (2000-01-13)
-# , also reported by Michael De Beukelaer-Dossche via Steffen Thorsen:
+# From 
+# Sudan News Agency (2000-01-13),
+# also reported by Michaël De Beukelaer-Dossche via Steffen Thorsen:
 # Clocks will be moved ahead for 60 minutes all over the Sudan as of noon
 # Saturday....  This was announced Thursday by Caretaker State Minister for
 # Manpower Abdul-Rahman Nur-Eddin.
@@ -1154,14 +1113,12 @@ Zone Africa/Dar_es_Salaam 2:37:08 -	LMT	
 			3:00	-	EAT
 
 # Togo
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Lome	0:04:52 -	LMT	1893
-			0:00	-	GMT
+# See Africa/Abidjan.
 
 # Tunisia
 
 # From Gwillim Law (2005-04-30):
-# My correspondent, Risto Nykanen, has alerted me to another adoption of DST,
+# My correspondent, Risto Nykänen, has alerted me to another adoption of DST,
 # this time in Tunisia.  According to Yahoo France News
 # , in a story attributed to AP
 # and dated 2005-04-26, "Tunisia has decided to advance its official time by
@@ -1170,7 +1127,7 @@ Zone	Africa/Lome	0:04:52 -	LMT	1893
 # Saturday."  (My translation)
 #
 # From Oscar van Vlijmen (2005-05-02):
-# LaPresse, the first national daily newspaper ...
+# La Presse, the first national daily newspaper ...
 # 
 # ... DST for 2005: on: Sun May 1 0h standard time, off: Fri Sept. 30,
 # 1h standard time.
@@ -1184,18 +1141,12 @@ Zone	Africa/Lome	0:04:52 -	LMT	1893
 # From Steffen Thorsen (2009-03-16):
 # According to several news sources, Tunisia will not observe DST this year.
 # (Arabic)
-# 
 # http://www.elbashayer.com/?page=viewn&nid=42546
-# 
-# 
 # http://www.babnet.net/kiwidetail-15295.asp
-# 
 #
 # We have also confirmed this with the US embassy in Tunisia.
 # We have a wrap-up about this on the following page:
-# 
 # http://www.timeanddate.com/news/time/tunisia-cancels-dst-2009.html
-# 
 
 # From Alexander Krivenyshev (2009-03-17):
 # Here is a link to Tunis Afrique Presse News Agency
@@ -1203,20 +1154,17 @@ Zone	Africa/Lome	0:04:52 -	LMT	1893
 # Standard time to be kept the whole year long (tap.info.tn):
 #
 # (in English)
-# 
 # http://www.tap.info.tn/en/index.php?option=com_content&task=view&id=26813&Itemid=157
-# 
 #
 # (in Arabic)
-# 
 # http://www.tap.info.tn/ar/index.php?option=com_content&task=view&id=61240&Itemid=1
-# 
 
-# From Arthur David Olson (2009--3-18):
-# The Tunis Afrique Presse News Agency notice contains this: "This measure is due to the fact
-# that the fasting month of ramadan coincides with the period concerned by summer time.
-# Therefore, the standard time will be kept unchanged the whole year long."
-# So foregoing DST seems to be an exception (albeit one that may be repeated in the  future).
+# From Arthur David Olson (2009-03-18):
+# The Tunis Afrique Presse News Agency notice contains this: "This measure is
+# due to the fact that the fasting month of Ramadan coincides with the period
+# concerned by summer time.  Therefore, the standard time will be kept
+# unchanged the whole year long."  So foregoing DST seems to be an exception
+# (albeit one that may be repeated in the future).
 
 # From Alexander Krivenyshev (2010-03-27):
 # According to some news reports Tunis confirmed not to use DST in 2010
@@ -1228,12 +1176,8 @@ Zone	Africa/Lome	0:04:52 -	LMT	1893
 # coincided with the month of Ramadan..."
 #
 # (in Arabic)
-# 
 # http://www.moheet.com/show_news.aspx?nid=358861&pg=1
-# 
 # http://www.almadenahnews.com/newss/news.php?c=118&id=38036
-# or
-# 
 # http://www.worldtimezone.com/dst_news/dst_news_tunis02.html
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S

Modified: releng/10.0/contrib/tzdata/antarctica
==============================================================================
--- releng/10.0/contrib/tzdata/antarctica	Tue Oct 21 23:50:46 2014	(r273438)
+++ releng/10.0/contrib/tzdata/antarctica	Tue Oct 21 23:52:25 2014	(r273439)
@@ -1,16 +1,13 @@
-# 
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
 # From Paul Eggert (1999-11-15):
 # To keep things manageable, we list only locations occupied year-round; see
-# 
 # COMNAP - Stations and Bases
-# 
+# 
 # and
-# 
 # Summary of the Peri-Antarctic Islands (1998-07-23)
-# 
+# 
 # for information.
 # Unless otherwise specified, we have no time zone information.
 #
@@ -55,19 +52,19 @@ Rule	ChileAQ	2012	max	-	Sep	Sun>=2	4:00u

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 00:07:06 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 9C7DDE9D;
 Wed, 22 Oct 2014 00:07:06 +0000 (UTC)
Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu
 [128.95.76.21])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client CN "troutmask.apl.washington.edu",
 Issuer "troutmask.apl.washington.edu" (not verified))
 by mx1.freebsd.org (Postfix) with ESMTPS id 7A41025F;
 Wed, 22 Oct 2014 00:07:06 +0000 (UTC)
Received: from troutmask.apl.washington.edu (localhost.apl.washington.edu
 [127.0.0.1])
 by troutmask.apl.washington.edu (8.14.9/8.14.9) with ESMTP id s9M070P8093931
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO);
 Tue, 21 Oct 2014 17:07:00 -0700 (PDT)
 (envelope-from sgk@troutmask.apl.washington.edu)
Received: (from sgk@localhost)
 by troutmask.apl.washington.edu (8.14.9/8.14.9/Submit) id s9M070BA093930;
 Tue, 21 Oct 2014 17:07:00 -0700 (PDT) (envelope-from sgk)
Date: Tue, 21 Oct 2014 17:07:00 -0700
From: Steve Kargl 
To: Baptiste Daroussin 
Subject: Re: svn commit: r273406 - head/share/mk
Message-ID: <20141022000700.GA93912@troutmask.apl.washington.edu>
References: <201410212000.s9LK0oQn061585@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <201410212000.s9LK0oQn061585@svn.freebsd.org>
User-Agent: Mutt/1.5.23 (2014-03-12)
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
 src-committers@freebsd.org
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 00:07:06 -0000

On Tue, Oct 21, 2014 at 08:00:50PM +0000, Baptiste Daroussin wrote:
> Author: bapt
> Date: Tue Oct 21 20:00:49 2014
> New Revision: 273406
> URL: https://svnweb.freebsd.org/changeset/base/273406
> 
> Log:
>   Always use libc++ as the default c++ stack when building with an external gcc 4.8+
>   While here disable building gcc from base when using gcc 4.8+
>   
>   Reviewed by:	imp


Are you sure that this works?  There are some (well-known?)
incompatibilities between libc++ and libstdc++.  By work,
I mean a resulting binary actually functions as expected. 

-- 
steve


From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 00:23:45 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 100292A5;
 Wed, 22 Oct 2014 00:23:45 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id EFF6E62D;
 Wed, 22 Oct 2014 00:23:44 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M0Nild089977;
 Wed, 22 Oct 2014 00:23:44 GMT (envelope-from mjg@FreeBSD.org)
Received: (from mjg@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M0NiBX089974;
 Wed, 22 Oct 2014 00:23:44 GMT (envelope-from mjg@FreeBSD.org)
Message-Id: <201410220023.s9M0NiBX089974@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org
 using -f
From: Mateusz Guzik 
Date: Wed, 22 Oct 2014 00:23:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273441 - in head/sys: kern sys
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 00:23:45 -0000

Author: mjg
Date: Wed Oct 22 00:23:43 2014
New Revision: 273441
URL: https://svnweb.freebsd.org/changeset/base/273441

Log:
  filedesc: cleanup setugidsafety a little
  
  Rename it to fdsetugidsafety for consistency with other functions.
  
  There is no need to take filedesc lock if not closing any files.
  
  The loop has to verify each file and we are guaranteed fdtable has space
  for at least 20 fds. As such there is no need to check fd_lastfile.
  
  While here tidy up is_unsafe.

Modified:
  head/sys/kern/kern_descrip.c
  head/sys/kern/kern_exec.c
  head/sys/sys/filedesc.h

Modified: head/sys/kern/kern_descrip.c
==============================================================================
--- head/sys/kern/kern_descrip.c	Tue Oct 21 23:57:31 2014	(r273440)
+++ head/sys/kern/kern_descrip.c	Wed Oct 22 00:23:43 2014	(r273441)
@@ -2078,23 +2078,23 @@ fdescfree(struct thread *td)
  * Since setugidsafety calls this only for fd 0, 1 and 2, this check is
  * sufficient.  We also don't check for setugidness since we know we are.
  */
-static int
+static bool
 is_unsafe(struct file *fp)
 {
-	if (fp->f_type == DTYPE_VNODE) {
-		struct vnode *vp = fp->f_vnode;
+	struct vnode *vp;
 
-		if ((vp->v_vflag & VV_PROCDEP) != 0)
-			return (1);
-	}
-	return (0);
+	if (fp->f_type != DTYPE_VNODE)
+		return (false);
+
+	vp = fp->f_vnode;
+	return ((vp->v_vflag & VV_PROCDEP) != 0);
 }
 
 /*
  * Make this setguid thing safe, if at all possible.
  */
 void
-setugidsafety(struct thread *td)
+fdsetugidsafety(struct thread *td)
 {
 	struct filedesc *fdp;
 	struct file *fp;
@@ -2102,12 +2102,10 @@ setugidsafety(struct thread *td)
 
 	fdp = td->td_proc->p_fd;
 	KASSERT(fdp->fd_refcnt == 1, ("the fdtable should not be shared"));
-	FILEDESC_XLOCK(fdp);
-	for (i = 0; i <= fdp->fd_lastfile; i++) {
-		if (i > 2)
-			break;
+	for (i = 0; i <= 2; i++) {
 		fp = fdp->fd_ofiles[i].fde_file;
 		if (fp != NULL && is_unsafe(fp)) {
+			FILEDESC_XLOCK(fdp);
 			knote_fdclose(td, i);
 			/*
 			 * NULL-out descriptor prior to close to avoid
@@ -2116,10 +2114,8 @@ setugidsafety(struct thread *td)
 			fdfree(fdp, i);
 			FILEDESC_XUNLOCK(fdp);
 			(void) closef(fp, td);
-			FILEDESC_XLOCK(fdp);
 		}
 	}
-	FILEDESC_XUNLOCK(fdp);
 }
 
 /*

Modified: head/sys/kern/kern_exec.c
==============================================================================
--- head/sys/kern/kern_exec.c	Tue Oct 21 23:57:31 2014	(r273440)
+++ head/sys/kern/kern_exec.c	Wed Oct 22 00:23:43 2014	(r273441)
@@ -695,7 +695,7 @@ interpret:
 		 */
 		PROC_UNLOCK(p);
 		VOP_UNLOCK(imgp->vp, 0);
-		setugidsafety(td);
+		fdsetugidsafety(td);
 		error = fdcheckstd(td);
 		if (error != 0)
 			goto done1;

Modified: head/sys/sys/filedesc.h
==============================================================================
--- head/sys/sys/filedesc.h	Tue Oct 21 23:57:31 2014	(r273440)
+++ head/sys/sys/filedesc.h	Wed Oct 22 00:23:43 2014	(r273441)
@@ -148,6 +148,7 @@ int	fdallocn(struct thread *td, int minf
 int	fdcheckstd(struct thread *td);
 void	fdclose(struct filedesc *fdp, struct file *fp, int idx, struct thread *td);
 void	fdcloseexec(struct thread *td);
+void	fdsetugidsafety(struct thread *td);
 struct	filedesc *fdcopy(struct filedesc *fdp);
 void	fdunshare(struct thread *td);
 void	fdescfree(struct thread *td);
@@ -159,7 +160,6 @@ struct filedesc_to_leader *
 int	getvnode(struct filedesc *fdp, int fd, cap_rights_t *rightsp,
 	    struct file **fpp);
 void	mountcheckdirs(struct vnode *olddp, struct vnode *newdp);
-void	setugidsafety(struct thread *td);
 
 /* Return a referenced file from an unlocked descriptor. */
 int	fget_unlocked(struct filedesc *fdp, int fd, cap_rights_t *needrightsp,

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 00:58:51 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 77FEB6CE;
 Wed, 22 Oct 2014 00:58:51 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 638A9912;
 Wed, 22 Oct 2014 00:58:51 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M0wpUg004577;
 Wed, 22 Oct 2014 00:58:51 GMT (envelope-from marcel@FreeBSD.org)
Received: (from marcel@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M0wpug004576;
 Wed, 22 Oct 2014 00:58:51 GMT (envelope-from marcel@FreeBSD.org)
Message-Id: <201410220058.s9M0wpug004576@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: marcel set sender to
 marcel@FreeBSD.org using -f
From: Marcel Moolenaar 
Date: Wed, 22 Oct 2014 00:58:51 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273442 - head/contrib/elftoolchain/libelf
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 00:58:51 -0000

Author: marcel
Date: Wed Oct 22 00:58:50 2014
New Revision: 273442
URL: https://svnweb.freebsd.org/changeset/base/273442

Log:
  GCC for PowerPC does not align  .note sections to 4 bytes.  When
  running ctfmerge on its objects, libelf asserts as it expects
  .note sections to be 4-byte aligned.  Change that expectation.
  
  Approved by:	jkoshy@
  Obtained from:	Juniper Networks, Inc.

Modified:
  head/contrib/elftoolchain/libelf/libelf_align.c

Modified: head/contrib/elftoolchain/libelf/libelf_align.c
==============================================================================
--- head/contrib/elftoolchain/libelf/libelf_align.c	Wed Oct 22 00:23:43 2014	(r273441)
+++ head/contrib/elftoolchain/libelf/libelf_align.c	Wed Oct 22 00:58:50 2014	(r273442)
@@ -109,7 +109,7 @@ static struct align falign[ELF_T_NUM] = 
 	[ELF_T_LWORD]	= FALIGN(8,8),
 	[ELF_T_MOVE]	= FALIGN(8,8),
 	[ELF_T_MOVEP] 	= UNSUPPORTED(),
-	[ELF_T_NOTE]	= FALIGN(4,4),
+	[ELF_T_NOTE]	= FALIGN(1,1),
 	[ELF_T_OFF]	= FALIGN(4,8),
 	[ELF_T_PHDR]	= FALIGN(4,8),
 	[ELF_T_REL]	= FALIGN(4,8),

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 01:04:17 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 00956897;
 Wed, 22 Oct 2014 01:04:16 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id E05779DF;
 Wed, 22 Oct 2014 01:04:16 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M14G6f008814;
 Wed, 22 Oct 2014 01:04:16 GMT (envelope-from marcel@FreeBSD.org)
Received: (from marcel@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M14Gq8008813;
 Wed, 22 Oct 2014 01:04:16 GMT (envelope-from marcel@FreeBSD.org)
Message-Id: <201410220104.s9M14Gq8008813@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: marcel set sender to
 marcel@FreeBSD.org using -f
From: Marcel Moolenaar 
Date: Wed, 22 Oct 2014 01:04:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273443 - head/contrib/elftoolchain/libelf
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 01:04:17 -0000

Author: marcel
Date: Wed Oct 22 01:04:16 2014
New Revision: 273443
URL: https://svnweb.freebsd.org/changeset/base/273443

Log:
  Fix the conversion macro for .note sections, broken in the case
  the ELF file's byte order is not the native byte order.  The
  bug is that the variables holding the name and description size
  are used (natively) after having been byte-swapped.  The fix is
  to calculate sz from them just prior to byte-swapping.
  
  Approved by:	jkoshy@
  Obtained from:	Juniper Networks, Inc.

Modified:
  head/contrib/elftoolchain/libelf/libelf_convert.m4

Modified: head/contrib/elftoolchain/libelf/libelf_convert.m4
==============================================================================
--- head/contrib/elftoolchain/libelf/libelf_convert.m4	Wed Oct 22 00:58:50 2014	(r273442)
+++ head/contrib/elftoolchain/libelf/libelf_convert.m4	Wed Oct 22 01:04:16 2014	(r273443)
@@ -947,6 +947,11 @@ _libelf_cvt_NOTE_tom(char *dst, size_t d
 		READ_WORD(src, descsz);
 		READ_WORD(src, type);
 
+		sz = namesz;
+		ROUNDUP2(sz, 4);
+		sz += descsz;
+		ROUNDUP2(sz, 4);
+
 		/* Translate. */
 		SWAP_WORD(namesz);
 		SWAP_WORD(descsz);
@@ -962,11 +967,6 @@ _libelf_cvt_NOTE_tom(char *dst, size_t d
 		dst += sizeof(Elf_Note);
 		count -= hdrsz;
 
-		ROUNDUP2(namesz, 4);
-		ROUNDUP2(descsz, 4);
-
-		sz = namesz + descsz;
-
 		if (count < sz || dsz < sz)	/* Buffers are too small. */
 			return (0);
 

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 01:09:08 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 45D89A87;
 Wed, 22 Oct 2014 01:09:08 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 1849AA0A;
 Wed, 22 Oct 2014 01:09:08 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M197og009522;
 Wed, 22 Oct 2014 01:09:07 GMT (envelope-from mjg@FreeBSD.org)
Received: (from mjg@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M197wU009521;
 Wed, 22 Oct 2014 01:09:07 GMT (envelope-from mjg@FreeBSD.org)
Message-Id: <201410220109.s9M197wU009521@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org
 using -f
From: Mateusz Guzik 
Date: Wed, 22 Oct 2014 01:09:07 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273444 - head/sys/kern
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 01:09:08 -0000

Author: mjg
Date: Wed Oct 22 01:09:07 2014
New Revision: 273444
URL: https://svnweb.freebsd.org/changeset/base/273444

Log:
  Avoid crdup when possible in kern_accessat.
  
  While here tidy up a little.

Modified:
  head/sys/kern/vfs_syscalls.c

Modified: head/sys/kern/vfs_syscalls.c
==============================================================================
--- head/sys/kern/vfs_syscalls.c	Wed Oct 22 01:04:16 2014	(r273443)
+++ head/sys/kern/vfs_syscalls.c	Wed Oct 22 01:09:07 2014	(r273444)
@@ -2064,7 +2064,7 @@ int
 kern_accessat(struct thread *td, int fd, char *path, enum uio_seg pathseg,
     int flag, int amode)
 {
-	struct ucred *cred, *tmpcred;
+	struct ucred *cred, *usecred;
 	struct vnode *vp;
 	struct nameidata nd;
 	cap_rights_t rights;
@@ -2075,31 +2075,33 @@ kern_accessat(struct thread *td, int fd,
 
 	/*
 	 * Create and modify a temporary credential instead of one that
-	 * is potentially shared.
+	 * is potentially shared (if we need one).
 	 */
-	if (!(flag & AT_EACCESS)) {
-		cred = td->td_ucred;
-		tmpcred = crdup(cred);
-		tmpcred->cr_uid = cred->cr_ruid;
-		tmpcred->cr_groups[0] = cred->cr_rgid;
-		td->td_ucred = tmpcred;
+	cred = td->td_ucred;
+	if ((flag & AT_EACCESS) == 0 &&
+	    ((cred->cr_uid != cred->cr_ruid ||
+	    cred->cr_rgid != cred->cr_groups[0]))) {
+		usecred = crdup(cred);
+		usecred->cr_uid = cred->cr_ruid;
+		usecred->cr_groups[0] = cred->cr_rgid;
+		td->td_ucred = usecred;
 	} else
-		cred = tmpcred = td->td_ucred;
+		usecred = cred;
 	AUDIT_ARG_VALUE(amode);
 	NDINIT_ATRIGHTS(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF |
 	    AUDITVNODE1, pathseg, path, fd, cap_rights_init(&rights, CAP_FSTAT),
 	    td);
 	if ((error = namei(&nd)) != 0)
-		goto out1;
+		goto out;
 	vp = nd.ni_vp;
 
-	error = vn_access(vp, amode, tmpcred, td);
+	error = vn_access(vp, amode, usecred, td);
 	NDFREE(&nd, NDF_ONLY_PNBUF);
 	vput(vp);
-out1:
-	if (!(flag & AT_EACCESS)) {
+out:
+	if (usecred != cred) {
 		td->td_ucred = cred;
-		crfree(tmpcred);
+		crfree(usecred);
 	}
 	return (error);
 }

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 01:25:17 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 4174CD93;
 Wed, 22 Oct 2014 01:25:17 +0000 (UTC)
Received: from smtp.des.no (smtp.des.no [194.63.250.102])
 by mx1.freebsd.org (Postfix) with ESMTP id 01594B8F;
 Wed, 22 Oct 2014 01:25:16 +0000 (UTC)
Received: from nine.des.no (smtp.des.no [194.63.250.102])
 by smtp-int.des.no (Postfix) with ESMTP id C5BEDA5C8;
 Wed, 22 Oct 2014 01:25:14 +0000 (UTC)
Received: by nine.des.no (Postfix, from userid 1001)
 id DB6FE54BC; Wed, 22 Oct 2014 03:25:02 +0200 (CEST)
From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= 
To: Warner Losh 
Subject: Re: svn commit: r273417 - head
References: <201410212029.s9LKThT2074337@svn.freebsd.org>
Date: Wed, 22 Oct 2014 03:25:02 +0200
In-Reply-To: <201410212029.s9LKThT2074337@svn.freebsd.org> (Warner Losh's
 message of "Tue, 21 Oct 2014 20:29:43 +0000 (UTC)")
Message-ID: <86d29k28wh.fsf@nine.des.no>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (berkeley-unix)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
 src-committers@freebsd.org
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 01:25:17 -0000

Warner Losh  writes:
> Author: imp
> Date: Tue Oct 21 20:29:42 2014
> New Revision: 273417
> URL: https://svnweb.freebsd.org/changeset/base/273417
>
> Log:
>   You aren't allowed to test WITH_xxx or WITHOUT_xxx here, so remove it.
>   Even if you were allowed to test for it, the test makes no sense as it
>   always results in adding -DWITH_ATF unless WITH_ATF was already
>   defined. But if MK_ATF !=3D no, then we know it was defined. This, in
>   turn, caused tools/build/options/makemake always think WITH_ATF is the
>   default, which removed control of that from sys.conf.mk.
>=20=20=20
>   To get the intent of the deleted comment, another mechanism is
>   required, assuming that the intent of that comment is desirable.

This broke the paralell build.  It prevents building lib/atf entirely in
stage 4.3, so the programs in libexec/atf have nothing to link against
unless lib/atf just happens to get built before libexec/atf.  That
almost never happens: lib and libexec are built in paralell, and lib/atf
is one of the last items in lib whereas libexec/atf is one of the first
items in libexec.

(on a side note, libatf doesn't need to be in _prebuild_libs, since no
other library depend on it)

DES
--=20
Dag-Erling Sm=C3=B8rgrav - des@des.no

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 01:35:31 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 0FCD117A;
 Wed, 22 Oct 2014 01:35:31 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id F086AC79;
 Wed, 22 Oct 2014 01:35:30 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M1ZU8q022934;
 Wed, 22 Oct 2014 01:35:30 GMT (envelope-from imp@FreeBSD.org)
Received: (from imp@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M1ZUfR022933;
 Wed, 22 Oct 2014 01:35:30 GMT (envelope-from imp@FreeBSD.org)
Message-Id: <201410220135.s9M1ZUfR022933@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: imp set sender to imp@FreeBSD.org
 using -f
From: Warner Losh 
Date: Wed, 22 Oct 2014 01:35:30 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273445 - head/sys/sys
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 01:35:31 -0000

Author: imp
Date: Wed Oct 22 01:35:30 2014
New Revision: 273445
URL: https://svnweb.freebsd.org/changeset/base/273445

Log:
  Add defines for various FIRST PARTY DMA SEND subcommands.

Modified:
  head/sys/sys/ata.h

Modified: head/sys/sys/ata.h
==============================================================================
--- head/sys/sys/ata.h	Wed Oct 22 01:09:07 2014	(r273444)
+++ head/sys/sys/ata.h	Wed Oct 22 01:35:30 2014	(r273445)
@@ -372,6 +372,10 @@ struct ata_params {
 #define ATA_WRITE_FPDMA_QUEUED          0x61    /* write DMA NCQ */
 #define ATA_NCQ_NON_DATA		0x63	/* NCQ non-data command */
 #define ATA_SEND_FPDMA_QUEUED           0x64    /* send DMA NCQ */
+#define		ATA_SFPDMA_DSM		0x00	/* Data set management */
+#define			ATA_SFPDMA_DSM_TRIM	0x01	/* Set trim bit in auxilary */
+#define		ATA_SFPDMA_HYBRID_EVICT	0x01	/* Hybrid Evict */
+#define		ATA_SFPDMA_WLDMA	0x02	/* Write Log DMA EXT */
 #define ATA_RECV_FPDMA_QUEUED           0x65    /* recieve DMA NCQ */
 #define ATA_SEP_ATTN                    0x67    /* SEP request */
 #define ATA_SEEK                        0x70    /* seek */

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 01:37:33 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 8642B302;
 Wed, 22 Oct 2014 01:37:33 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 7244BC9B;
 Wed, 22 Oct 2014 01:37:33 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M1bXVg023210;
 Wed, 22 Oct 2014 01:37:33 GMT (envelope-from marcel@FreeBSD.org)
Received: (from marcel@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M1bXuh023209;
 Wed, 22 Oct 2014 01:37:33 GMT (envelope-from marcel@FreeBSD.org)
Message-Id: <201410220137.s9M1bXuh023209@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: marcel set sender to
 marcel@FreeBSD.org using -f
From: Marcel Moolenaar 
Date: Wed, 22 Oct 2014 01:37:33 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273446 - head/sys/x86/isa
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 01:37:33 -0000

Author: marcel
Date: Wed Oct 22 01:37:32 2014
New Revision: 273446
URL: https://svnweb.freebsd.org/changeset/base/273446

Log:
  Virtual machines can easily have more than 16 option ROMs and
  when that happens, we happily access our resource array out of
  bounds. Make sure we stay within the MAX_ROMS limit.
  While here, bump MAX_ROMS from 16 to 32 to minimize the chance
  of leaving option ROMs unaccounted for.
  
  Obtained from:	Juniper Networks, Inc.

Modified:
  head/sys/x86/isa/orm.c

Modified: head/sys/x86/isa/orm.c
==============================================================================
--- head/sys/x86/isa/orm.c	Wed Oct 22 01:35:30 2014	(r273445)
+++ head/sys/x86/isa/orm.c	Wed Oct 22 01:37:32 2014	(r273446)
@@ -58,7 +58,7 @@ static struct isa_pnp_id orm_ids[] = {
 	{ 0,		NULL },
 };
 
-#define MAX_ROMS	16
+#define MAX_ROMS	32
 
 struct orm_softc {
 	int		rnum;
@@ -97,7 +97,7 @@ orm_identify(driver_t* driver, device_t 
 	isa_set_vendorid(child, ORM_ID);
 	sc = device_get_softc(child);
 	sc->rnum = 0;
-	while (chunk < IOMEM_END) {
+	while (sc->rnum < MAX_ROMS && chunk < IOMEM_END) {
 		bus_set_resource(child, SYS_RES_MEMORY, sc->rnum, chunk,
 		    IOMEM_STEP);
 		rid = sc->rnum;

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 01:53:01 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id C7C1A5C7;
 Wed, 22 Oct 2014 01:53:01 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id B4014E13;
 Wed, 22 Oct 2014 01:53:01 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M1r1X9031828;
 Wed, 22 Oct 2014 01:53:01 GMT (envelope-from mjg@FreeBSD.org)
Received: (from mjg@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M1r14B031827;
 Wed, 22 Oct 2014 01:53:01 GMT (envelope-from mjg@FreeBSD.org)
Message-Id: <201410220153.s9M1r14B031827@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org
 using -f
From: Mateusz Guzik 
Date: Wed, 22 Oct 2014 01:53:01 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273447 - head/sys/kern
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 01:53:01 -0000

Author: mjg
Date: Wed Oct 22 01:53:00 2014
New Revision: 273447
URL: https://svnweb.freebsd.org/changeset/base/273447

Log:
  Reduce nesting in vn_access.
  
  No functional changes.

Modified:
  head/sys/kern/vfs_syscalls.c

Modified: head/sys/kern/vfs_syscalls.c
==============================================================================
--- head/sys/kern/vfs_syscalls.c	Wed Oct 22 01:37:32 2014	(r273446)
+++ head/sys/kern/vfs_syscalls.c	Wed Oct 22 01:53:00 2014	(r273447)
@@ -1994,23 +1994,23 @@ vn_access(vp, user_flags, cred, td)
 	int error;
 
 	/* Flags == 0 means only check for existence. */
-	error = 0;
-	if (user_flags) {
-		accmode = 0;
-		if (user_flags & R_OK)
-			accmode |= VREAD;
-		if (user_flags & W_OK)
-			accmode |= VWRITE;
-		if (user_flags & X_OK)
-			accmode |= VEXEC;
+	if (user_flags == 0)
+		return (0);
+
+	accmode = 0;
+	if (user_flags & R_OK)
+		accmode |= VREAD;
+	if (user_flags & W_OK)
+		accmode |= VWRITE;
+	if (user_flags & X_OK)
+		accmode |= VEXEC;
 #ifdef MAC
-		error = mac_vnode_check_access(cred, vp, accmode);
-		if (error != 0)
-			return (error);
+	error = mac_vnode_check_access(cred, vp, accmode);
+	if (error != 0)
+		return (error);
 #endif
-		if ((accmode & VWRITE) == 0 || (error = vn_writechk(vp)) == 0)
-			error = VOP_ACCESS(vp, accmode, cred, td);
-	}
+	if ((accmode & VWRITE) == 0 || (error = vn_writechk(vp)) == 0)
+		error = VOP_ACCESS(vp, accmode, cred, td);
 	return (error);
 }
 

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 01:55:54 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 346CE720
 for ; Wed, 22 Oct 2014 01:55:54 +0000 (UTC)
Received: from mail-pd0-f170.google.com (mail-pd0-f170.google.com
 [209.85.192.170])
 (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits))
 (Client CN "smtp.gmail.com",
 Issuer "Google Internet Authority G2" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 01B98E25
 for ; Wed, 22 Oct 2014 01:55:53 +0000 (UTC)
Received: by mail-pd0-f170.google.com with SMTP id z10so2506387pdj.15
 for ; Tue, 21 Oct 2014 18:55:53 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:sender:content-type:mime-version:subject:from
 :in-reply-to:date:cc:message-id:references:to;
 bh=4hjhXCq9e8nyFHZB5fXIi0xJ0bKWonGe8lPSTyvctRc=;
 b=VIKFkKJqxydIr3WMnGV/caDt2Gm8WPRxph4DSFLrQ09mcnMpU0mdNrBW8XuHLUtIJb
 xjctNAM/asS6miiKOH4td4jTGukJIMQPchw6xw+KbYU3EzLpQK0NeBQ5r3ZEikb4kZeG
 avCbZJwmM2j1WcPJSgu2VcfDEPygYB0V3z188Bb7UiynrwhdXUaAr/eFfYD8+Hshn1Fu
 toKTJHZmu9rXr1uREY8SqA53/6xubnchiiNkzls5xylM9VnQ23P0gpLWXLBC6k7wqEZx
 G4b2oQqLg1PLyCJIsVGgc2hLo0Xux5qsnlJkFrjE1EDiTAyfqHr4hauzUXq9c7J1G0rG
 EsoQ==
X-Gm-Message-State: ALoCoQn1n7uYyCjRpSKJchC2Z0KNM1IXd+rIhni1NoGgrEre2yo48y2xcqMk4+oC2cS/VQ9eV9FS
X-Received: by 10.66.139.106 with SMTP id qx10mr466599pab.138.1413942578011;
 Tue, 21 Oct 2014 18:49:38 -0700 (PDT)
Received: from macintosh-c42c033c0b73.corp.netflix.com (dc1-prod.netflix.com.
 [69.53.236.251])
 by mx.google.com with ESMTPSA id kv10sm636385pab.23.2014.10.21.18.49.36
 for 
 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
 Tue, 21 Oct 2014 18:49:37 -0700 (PDT)
Sender: Warner Losh 
Content-Type: multipart/signed;
 boundary="Apple-Mail=_DB67DB47-1D9A-4BF9-97CB-4EFE6631F24D";
 protocol="application/pgp-signature"; micalg=pgp-sha512
Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\))
Subject: Re: svn commit: r273417 - head
From: Warner Losh 
In-Reply-To: <86d29k28wh.fsf@nine.des.no>
Date: Tue, 21 Oct 2014 19:49:33 -0600
Message-Id: <22788EC4-3BDF-40F3-ACAC-FA686ED21154@bsdimp.com>
References: <201410212029.s9LKThT2074337@svn.freebsd.org>
 <86d29k28wh.fsf@nine.des.no>
To: =?iso-8859-1?Q?Dag-Erling_Sm=F8rgrav?= 
X-Mailer: Apple Mail (2.1878.6)
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
 src-committers 
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 01:55:54 -0000


--Apple-Mail=_DB67DB47-1D9A-4BF9-97CB-4EFE6631F24D
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=windows-1252


On Oct 21, 2014, at 7:25 PM, Dag-Erling Sm=F8rgrav  wrote:

> Warner Losh  writes:
>> Author: imp
>> Date: Tue Oct 21 20:29:42 2014
>> New Revision: 273417
>> URL: https://svnweb.freebsd.org/changeset/base/273417
>>=20
>> Log:
>>  You aren't allowed to test WITH_xxx or WITHOUT_xxx here, so remove =
it.
>>  Even if you were allowed to test for it, the test makes no sense as =
it
>>  always results in adding -DWITH_ATF unless WITH_ATF was already
>>  defined. But if MK_ATF !=3D no, then we know it was defined. This, =
in
>>  turn, caused tools/build/options/makemake always think WITH_ATF is =
the
>>  default, which removed control of that from sys.conf.mk.
>>=20
>>  To get the intent of the deleted comment, another mechanism is
>>  required, assuming that the intent of that comment is desirable.
>=20
> This broke the paralell build.  It prevents building lib/atf entirely =
in
> stage 4.3, so the programs in libexec/atf have nothing to link against
> unless lib/atf just happens to get built before libexec/atf.  That
> almost never happens: lib and libexec are built in paralell, and =
lib/atf
> is one of the last items in lib whereas libexec/atf is one of the =
first
> items in libexec.
>=20
> (on a side note, libatf doesn't need to be in _prebuild_libs, since no
> other library depend on it)

Yea, it was AFU. I=92ll fix this. I think we need to have a  =
MK_TESTS_SUPPORT
that builds the libatf stuff when yes, and omits it when no, since we =
don=92t want the
tests building when we=92re building the 4.3 stage.

Warner

> DES
> --=20
> Dag-Erling Sm=F8rgrav - des@des.no


--Apple-Mail=_DB67DB47-1D9A-4BF9-97CB-4EFE6631F24D
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP using GPGMail

-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - https://gpgtools.org

iQIcBAEBCgAGBQJURw0uAAoJEGwc0Sh9sBEAkrgP/R5+U6/6T8k04jHhvPK8FKxy
kwJ2yJcGpO3jCo0ky9xDLmtdA5bu0mSkSnG9peCE4pYhRZsWpBptXHOyf8Wd45m1
qnHLci3uPAyW7qy2RqZuQN/XNMr274wtbS3J1O2HURGi17pUT2PNJaJagP0ppZ2Y
vP/923VRA9TuyuPifYXEO+QdmuEExrJy2ATfzqI40nulFXahGsm0BEY1+RqhBP6o
tUu1S8ZrsXKKZBsSclFHync+WIDntPHSMMYQDmhiTNvqoLWFhBMKcNuEGSiOd1J7
6DgdBuGn+BmcjXovpGysZYMqaahz8+OFbEDEfPh4ADv1sL/JGEauDV5/kY12kOLX
Ds9arPAbdAyi6xbLSZf4heTQ7Cc4oB3R08DqD0ATWb5bF7/gDXxR4MgVsNUq4hiH
gnYmoBwsc0OKr5r83FjWSabUnPqvSLlNDqdhXY8YDMmbTVsep9VKQ8zHXoAcL+37
fk/QR/UU2llEy9hhDj1/0LBLMxz449w8ybQmIqRLz7Ghe3HYC2VSVIl9Z4KecGxG
CF2/uTF9yU4TzToB+GBe8Tlc6qdziiERge6k8rNp9KArXz1fb0Cjq36HakGbUFNu
5KqzZ3pbWfNwcIRmMmhp5cfFWZx183VNxNsWY6FeCz8yItOfdOjek0gmkY8yBSmY
BTKVIY7Hls7i1AcERrow
=Rt/o
-----END PGP SIGNATURE-----

--Apple-Mail=_DB67DB47-1D9A-4BF9-97CB-4EFE6631F24D--

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 03:32:27 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id DE5A9321;
 Wed, 22 Oct 2014 03:32:27 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id CA984A3C;
 Wed, 22 Oct 2014 03:32:27 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M3WREp078883;
 Wed, 22 Oct 2014 03:32:27 GMT (envelope-from kevlo@FreeBSD.org)
Received: (from kevlo@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M3WRhf078882;
 Wed, 22 Oct 2014 03:32:27 GMT (envelope-from kevlo@FreeBSD.org)
Message-Id: <201410220332.s9M3WRhf078882@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: kevlo set sender to
 kevlo@FreeBSD.org using -f
From: Kevin Lo 
Date: Wed, 22 Oct 2014 03:32:27 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273448 - head/sys/dev/usb/wlan
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 03:32:28 -0000

Author: kevlo
Date: Wed Oct 22 03:32:27 2014
New Revision: 273448
URL: https://svnweb.freebsd.org/changeset/base/273448

Log:
  Fix the kernel panic in hostap mode.
  rvp->beacon_mbuf was NULL in run_update_beacon().
  
  PR:	189405
  Submitted by:	Gabor Simon 
  MFC after:	3 days

Modified:
  head/sys/dev/usb/wlan/if_run.c

Modified: head/sys/dev/usb/wlan/if_run.c
==============================================================================
--- head/sys/dev/usb/wlan/if_run.c	Wed Oct 22 01:53:00 2014	(r273447)
+++ head/sys/dev/usb/wlan/if_run.c	Wed Oct 22 03:32:27 2014	(r273448)
@@ -4913,6 +4913,12 @@ run_update_beacon(struct ieee80211vap *v
 	}
 
 	setbit(rvp->bo.bo_flags, item);
+	if (rvp->beacon_mbuf == NULL) {
+		rvp->beacon_mbuf = ieee80211_beacon_alloc(vap->iv_bss,
+		    &rvp->bo);
+		if (rvp->beacon_mbuf == NULL)
+			return;
+	}
 	ieee80211_beacon_update(vap->iv_bss, &rvp->bo, rvp->beacon_mbuf, mcast);
 
 	i = RUN_CMDQ_GET(&sc->cmdq_store);

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 03:39:13 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id E55B64F8;
 Wed, 22 Oct 2014 03:39:12 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id C6B05A75;
 Wed, 22 Oct 2014 03:39:12 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M3dC35079736;
 Wed, 22 Oct 2014 03:39:12 GMT (envelope-from imp@FreeBSD.org)
Received: (from imp@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M3dCKZ079733;
 Wed, 22 Oct 2014 03:39:12 GMT (envelope-from imp@FreeBSD.org)
Message-Id: <201410220339.s9M3dCKZ079733@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: imp set sender to imp@FreeBSD.org
 using -f
From: Warner Losh 
Date: Wed, 22 Oct 2014 03:39:12 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273449 - in head: . lib share/mk
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 03:39:13 -0000

Author: imp
Date: Wed Oct 22 03:39:11 2014
New Revision: 273449
URL: https://svnweb.freebsd.org/changeset/base/273449

Log:
  My previous commit exposed an issue as it fixed a different
  issue. lib/atf isn't a prereq_lib, since it isn't required for other
  libraries to build. Remove it. The old kludge of always building it
  had effectively been retired. Since we don't want to build the
  libraries with the tests when we're bootstrapping, invent
  MK_TESTS_SUPPORT which normally defaults to the current MK_TESTS
  value, except when explicitly defined. Make lib/atf depend on it being
  yes. When building the libraries set MK_TESTS to no, and
  MK_TESTS_SUPPORT to the current value of MK_TESTS so that later stages
  of the build work correctly. This should fix (and does for me)
  people's issues with parallel builds racing between lib/atf and
  libexec/atf. Since lib/atf is built during the libraries phase, the
  race disappears.

Modified:
  head/Makefile.inc1
  head/lib/Makefile
  head/share/mk/src.opts.mk

Modified: head/Makefile.inc1
==============================================================================
--- head/Makefile.inc1	Wed Oct 22 03:32:27 2014	(r273448)
+++ head/Makefile.inc1	Wed Oct 22 03:39:11 2014	(r273449)
@@ -574,7 +574,7 @@ _libraries:
 	@echo "--------------------------------------------------------------"
 	${_+_}cd ${.CURDIR}; \
 	    ${WMAKE} -DNO_FSCHG MK_HTML=no MK_INFO=no -DNO_LINT MK_MAN=no \
-	    MK_PROFILE=no  MK_TESTS=no libraries
+	    MK_PROFILE=no MK_TESTS=no MK_TESTS_SUPPORT=${MK_TESTS} libraries
 _depend:
 	@echo
 	@echo "--------------------------------------------------------------"
@@ -1535,7 +1535,6 @@ _prebuild_libs=	${_kerberos5_lib_libasn1
 		${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \
 		${_kerberos5_lib_libroken} \
 		${_kerberos5_lib_libwind} \
-		${_lib_atf} \
 		lib/libbz2 ${_libcom_err} lib/libcrypt \
 		lib/libelf lib/libexpat \
 		${_lib_libgssapi} \
@@ -1561,10 +1560,6 @@ gnu/lib/libsupc++__L: gnu/lib/libstdc++_
 
 lib/libgeom__L: lib/libexpat__L
 
-.if ${MK_TESTS} != "no"
-_lib_atf=	lib/atf
-.endif
-
 .if ${MK_LIBTHR} != "no"
 _lib_libthr=	lib/libthr
 .endif

Modified: head/lib/Makefile
==============================================================================
--- head/lib/Makefile	Wed Oct 22 03:32:27 2014	(r273448)
+++ head/lib/Makefile	Wed Oct 22 03:39:11 2014	(r273449)
@@ -276,8 +276,10 @@ _libsmutil=	libsmutil
 _libtelnet=	libtelnet
 .endif
 
-.if ${MK_TESTS} != "no"
+.if ${MK_TESTS_SUPPORT} != "no"
 _atf=		atf
+.endif
+.if ${MK_TESTS} != "no"
 _tests=		tests
 .endif
 

Modified: head/share/mk/src.opts.mk
==============================================================================
--- head/share/mk/src.opts.mk	Wed Oct 22 03:32:27 2014	(r273448)
+++ head/share/mk/src.opts.mk	Wed Oct 22 03:39:11 2014	(r273449)
@@ -330,6 +330,7 @@ MK_CLANG_FULL:= no
     KVM \
     NETGRAPH \
     PAM \
+    TESTS \
     WIRELESS
 .if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} == "no"
 MK_${var}_SUPPORT:= no

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 04:01:27 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id C8FA288B;
 Wed, 22 Oct 2014 04:01:27 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id B4B42CCB;
 Wed, 22 Oct 2014 04:01:27 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M41RlW090851;
 Wed, 22 Oct 2014 04:01:27 GMT (envelope-from bryanv@FreeBSD.org)
Received: (from bryanv@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M41RRY090850;
 Wed, 22 Oct 2014 04:01:27 GMT (envelope-from bryanv@FreeBSD.org)
Message-Id: <201410220401.s9M41RRY090850@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: bryanv set sender to
 bryanv@FreeBSD.org using -f
From: Bryan Venteicher 
Date: Wed, 22 Oct 2014 04:01:27 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject: svn commit: r273450 - stable/10/sys/sys
X-SVN-Group: stable-10
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 04:01:27 -0000

Author: bryanv
Date: Wed Oct 22 04:01:27 2014
New Revision: 273450
URL: https://svnweb.freebsd.org/changeset/base/273450

Log:
  MFC r272796:
  
  Add M_FLOWID to M_COPYFLAGS
  
  The M_FLOWID flag should be propagated to the new mbuf pkthdr in
  m_move_pkthdr() and m_dup_pkthdr(). The new mbuf already got the
  existing flowid value, but would be ignored since the flag was
  not set.

Modified:
  stable/10/sys/sys/mbuf.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/sys/mbuf.h
==============================================================================
--- stable/10/sys/sys/mbuf.h	Wed Oct 22 03:39:11 2014	(r273449)
+++ stable/10/sys/sys/mbuf.h	Wed Oct 22 04:01:27 2014	(r273450)
@@ -247,7 +247,7 @@ struct mbuf {
  * Flags preserved when copying m_pkthdr.
  */
 #define M_COPYFLAGS \
-    (M_PKTHDR|M_EOR|M_RDONLY|M_BCAST|M_MCAST|M_VLANTAG|M_PROMISC| \
+    (M_PKTHDR|M_EOR|M_RDONLY|M_BCAST|M_MCAST|M_PROMISC|M_VLANTAG|M_FLOWID| \
      M_PROTOFLAGS)
 
 /*

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 04:03:09 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id A562C9CA
 for ; Wed, 22 Oct 2014 04:03:09 +0000 (UTC)
Received: from mail-pa0-f53.google.com (mail-pa0-f53.google.com
 [209.85.220.53])
 (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits))
 (Client CN "smtp.gmail.com",
 Issuer "Google Internet Authority G2" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 754C6CD7
 for ; Wed, 22 Oct 2014 04:03:09 +0000 (UTC)
Received: by mail-pa0-f53.google.com with SMTP id kq14so2781613pab.26
 for ; Tue, 21 Oct 2014 21:03:08 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:sender:from:content-type:mime-version:subject
 :in-reply-to:date:cc:content-transfer-encoding:message-id:references
 :to; bh=UKL7Pw1CooRwnsAwCAIZKCCN1lxStyopluZRRHuuWfg=;
 b=bkLo49H56U0qif56RJMtJZSXXG0RiN8bwzEy4vzrwom9Z4nMKr4kDhrIppFfrhBUSa
 N3hV6woCW1AIIwrv4P4SULsnJ9bKw2xeXFEWNv679x3fnLbZxK/kPBCorwBzGMp4m0m1
 2fR31vD7wjx1UtbjgUsI95cBKD4lgqXHTOtVsqAsbdObzGSnalvPekERpmImuEPVCd7+
 HSVWkU/V4e+tpL1V9aJrZbR5INeCcE2ndYFuyhUZbwqbMduFlRS6Bf3OrnKGzqcYD4D9
 C9W6bAWtzQ0PkmDaHK+aT5kegKFownZNd5ak00Ra2/e6ezeYW/127dXAkpcWROvBg1Hn
 hJGA==
X-Gm-Message-State: ALoCoQkdA68yU50pjce+kMYeNZm5m4ggKb7vG3Gx+hyP2HlQLKC1JMEb+YRQ17DIl+jz1BLxUoYq
X-Received: by 10.68.135.33 with SMTP id pp1mr16069593pbb.120.1413950233498;
 Tue, 21 Oct 2014 20:57:13 -0700 (PDT)
Received: from macintosh-c42c033c0b73.corp.netflix.com (dc1-prod.netflix.com.
 [69.53.236.251])
 by mx.google.com with ESMTPSA id nz1sm785819pdb.11.2014.10.21.20.57.12
 for 
 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
 Tue, 21 Oct 2014 20:57:12 -0700 (PDT)
Sender: Warner Losh 
From: Warner Losh 
X-Google-Original-From: Warner Losh 
Content-Type: text/plain; charset=us-ascii
Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\))
Subject: Re: svn commit: r273406 - head/share/mk
In-Reply-To: <20141022000700.GA93912@troutmask.apl.washington.edu>
Date: Tue, 21 Oct 2014 21:57:10 -0600
Content-Transfer-Encoding: quoted-printable
Message-Id: <0F22C339-BE2C-42ED-805C-559744F30684@gmail.com>
References: <201410212000.s9LK0oQn061585@svn.freebsd.org>
 <20141022000700.GA93912@troutmask.apl.washington.edu>
To: Steve Kargl 
X-Mailer: Apple Mail (2.1878.6)
Cc: svn-src-head@freebsd.org, Baptiste Daroussin ,
 src-committers , svn-src-all@freebsd.org
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 04:03:09 -0000


On Oct 21, 2014, at 6:07 PM, Steve Kargl =
 wrote:

> On Tue, Oct 21, 2014 at 08:00:50PM +0000, Baptiste Daroussin wrote:
>> Author: bapt
>> Date: Tue Oct 21 20:00:49 2014
>> New Revision: 273406
>> URL: https://svnweb.freebsd.org/changeset/base/273406
>>=20
>> Log:
>>  Always use libc++ as the default c++ stack when building with an =
external gcc 4.8+
>>  While here disable building gcc from base when using gcc 4.8+
>>=20
>>  Reviewed by:	imp
>=20
>=20
> Are you sure that this works?  There are some (well-known?)
> incompatibilities between libc++ and libstdc++.  By work,
> I mean a resulting binary actually functions as expected.

This is just for the build. And just to work around hard coded library =
names in g++.
The ABIs that are used turn out to be the same since all the headers are =
from libc++
not libstdc++.

Warner


From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 04:09:48 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 2CA06A90;
 Wed, 22 Oct 2014 04:09:48 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 0DC3FD02;
 Wed, 22 Oct 2014 04:09:48 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M49llE093816;
 Wed, 22 Oct 2014 04:09:47 GMT (envelope-from bryanv@FreeBSD.org)
Received: (from bryanv@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M49lWH093815;
 Wed, 22 Oct 2014 04:09:47 GMT (envelope-from bryanv@FreeBSD.org)
Message-Id: <201410220409.s9M49lWH093815@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: bryanv set sender to
 bryanv@FreeBSD.org using -f
From: Bryan Venteicher 
Date: Wed, 22 Oct 2014 04:09:47 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject: svn commit: r273451 - stable/10/sys/vm
X-SVN-Group: stable-10
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 04:09:48 -0000

Author: bryanv
Date: Wed Oct 22 04:09:47 2014
New Revision: 273451
URL: https://svnweb.freebsd.org/changeset/base/273451

Log:
  MFC r272573:
  
    Change the UMA mutex into a rwlock
  
    Acquire the lock in read mode when just needed to ensure the stability
    of the keg list. The UMA lock may be held for a long time (relatively
    speaking) in uma_reclaim() on machines with lots of zones/kegs. If the
    uma_timeout() would fire during that period, subsequent callouts on that
    CPU may be significantly delayed.

Modified:
  stable/10/sys/vm/uma_core.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/vm/uma_core.c
==============================================================================
--- stable/10/sys/vm/uma_core.c	Wed Oct 22 04:01:27 2014	(r273450)
+++ stable/10/sys/vm/uma_core.c	Wed Oct 22 04:09:47 2014	(r273451)
@@ -135,8 +135,8 @@ static LIST_HEAD(,uma_keg) uma_kegs = LI
 static LIST_HEAD(,uma_zone) uma_cachezones =
     LIST_HEAD_INITIALIZER(uma_cachezones);
 
-/* This mutex protects the keg list */
-static struct mtx_padalign uma_mtx;
+/* This RW lock protects the keg list */
+static struct rwlock_padalign uma_rwlock;
 
 /* Linked list of boot time pages */
 static LIST_HEAD(,uma_slab) uma_boot_pages =
@@ -905,7 +905,7 @@ zone_drain_wait(uma_zone_t zone, int wai
 	ZONE_UNLOCK(zone);
 	/*
 	 * The DRAINING flag protects us from being freed while
-	 * we're running.  Normally the uma_mtx would protect us but we
+	 * we're running.  Normally the uma_rwlock would protect us but we
 	 * must be able to release and acquire the right lock for each keg.
 	 */
 	zone_foreach_keg(zone, &keg_drain);
@@ -1541,9 +1541,9 @@ keg_ctor(void *mem, int size, void *udat
 
 	LIST_INSERT_HEAD(&keg->uk_zones, zone, uz_link);
 
-	mtx_lock(&uma_mtx);
+	rw_wlock(&uma_rwlock);
 	LIST_INSERT_HEAD(&uma_kegs, keg, uk_link);
-	mtx_unlock(&uma_mtx);
+	rw_wunlock(&uma_rwlock);
 	return (0);
 }
 
@@ -1593,9 +1593,9 @@ zone_ctor(void *mem, int size, void *uda
 		zone->uz_release = arg->release;
 		zone->uz_arg = arg->arg;
 		zone->uz_lockptr = &zone->uz_lock;
-		mtx_lock(&uma_mtx);
+		rw_wlock(&uma_rwlock);
 		LIST_INSERT_HEAD(&uma_cachezones, zone, uz_link);
-		mtx_unlock(&uma_mtx);
+		rw_wunlock(&uma_rwlock);
 		goto out;
 	}
 
@@ -1612,7 +1612,7 @@ zone_ctor(void *mem, int size, void *uda
 		zone->uz_fini = arg->fini;
 		zone->uz_lockptr = &keg->uk_lock;
 		zone->uz_flags |= UMA_ZONE_SECONDARY;
-		mtx_lock(&uma_mtx);
+		rw_wlock(&uma_rwlock);
 		ZONE_LOCK(zone);
 		LIST_FOREACH(z, &keg->uk_zones, uz_link) {
 			if (LIST_NEXT(z, uz_link) == NULL) {
@@ -1621,7 +1621,7 @@ zone_ctor(void *mem, int size, void *uda
 			}
 		}
 		ZONE_UNLOCK(zone);
-		mtx_unlock(&uma_mtx);
+		rw_wunlock(&uma_rwlock);
 	} else if (keg == NULL) {
 		if ((keg = uma_kcreate(zone, arg->size, arg->uminit, arg->fini,
 		    arg->align, arg->flags)) == NULL)
@@ -1719,9 +1719,9 @@ zone_dtor(void *arg, int size, void *uda
 	if (!(zone->uz_flags & UMA_ZFLAG_INTERNAL))
 		cache_drain(zone);
 
-	mtx_lock(&uma_mtx);
+	rw_wlock(&uma_rwlock);
 	LIST_REMOVE(zone, uz_link);
-	mtx_unlock(&uma_mtx);
+	rw_wunlock(&uma_rwlock);
 	/*
 	 * XXX there are some races here where
 	 * the zone can be drained but zone lock
@@ -1743,9 +1743,9 @@ zone_dtor(void *arg, int size, void *uda
 	 * We only destroy kegs from non secondary zones.
 	 */
 	if (keg != NULL && (zone->uz_flags & UMA_ZONE_SECONDARY) == 0)  {
-		mtx_lock(&uma_mtx);
+		rw_wlock(&uma_rwlock);
 		LIST_REMOVE(keg, uk_link);
-		mtx_unlock(&uma_mtx);
+		rw_wunlock(&uma_rwlock);
 		zone_free_item(kegs, keg, NULL, SKIP_NONE);
 	}
 	ZONE_LOCK_FINI(zone);
@@ -1767,12 +1767,12 @@ zone_foreach(void (*zfunc)(uma_zone_t))
 	uma_keg_t keg;
 	uma_zone_t zone;
 
-	mtx_lock(&uma_mtx);
+	rw_rlock(&uma_rwlock);
 	LIST_FOREACH(keg, &uma_kegs, uk_link) {
 		LIST_FOREACH(zone, &keg->uk_zones, uz_link)
 			zfunc(zone);
 	}
-	mtx_unlock(&uma_mtx);
+	rw_runlock(&uma_rwlock);
 }
 
 /* Public functions */
@@ -1788,7 +1788,7 @@ uma_startup(void *bootmem, int boot_page
 #ifdef UMA_DEBUG
 	printf("Creating uma keg headers zone and keg.\n");
 #endif
-	mtx_init(&uma_mtx, "UMA lock", NULL, MTX_DEF);
+	rw_init(&uma_rwlock, "UMA lock");
 
 	/* "manually" create the initial zone */
 	memset(&args, 0, sizeof(args));
@@ -3363,12 +3363,12 @@ sysctl_vm_zone_count(SYSCTL_HANDLER_ARGS
 	int count;
 
 	count = 0;
-	mtx_lock(&uma_mtx);
+	rw_rlock(&uma_rwlock);
 	LIST_FOREACH(kz, &uma_kegs, uk_link) {
 		LIST_FOREACH(z, &kz->uk_zones, uz_link)
 			count++;
 	}
-	mtx_unlock(&uma_mtx);
+	rw_runlock(&uma_rwlock);
 	return (sysctl_handle_int(oidp, &count, 0, req));
 }
 
@@ -3393,7 +3393,7 @@ sysctl_vm_zone_stats(SYSCTL_HANDLER_ARGS
 	sbuf_new_for_sysctl(&sbuf, NULL, 128, req);
 
 	count = 0;
-	mtx_lock(&uma_mtx);
+	rw_rlock(&uma_rwlock);
 	LIST_FOREACH(kz, &uma_kegs, uk_link) {
 		LIST_FOREACH(z, &kz->uk_zones, uz_link)
 			count++;
@@ -3469,7 +3469,7 @@ skip:
 			ZONE_UNLOCK(z);
 		}
 	}
-	mtx_unlock(&uma_mtx);
+	rw_runlock(&uma_rwlock);
 	error = sbuf_finish(&sbuf);
 	sbuf_delete(&sbuf);
 	return (error);

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 04:16:10 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id A9838C58;
 Wed, 22 Oct 2014 04:16:10 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 964D4DBA;
 Wed, 22 Oct 2014 04:16:10 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M4GAN1098113;
 Wed, 22 Oct 2014 04:16:10 GMT (envelope-from mjg@FreeBSD.org)
Received: (from mjg@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M4GAJA098112;
 Wed, 22 Oct 2014 04:16:10 GMT (envelope-from mjg@FreeBSD.org)
Message-Id: <201410220416.s9M4GAJA098112@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org
 using -f
From: Mateusz Guzik 
Date: Wed, 22 Oct 2014 04:16:10 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273452 - head/sys/kern
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 04:16:10 -0000

Author: mjg
Date: Wed Oct 22 04:16:09 2014
New Revision: 273452
URL: https://svnweb.freebsd.org/changeset/base/273452

Log:
  Plug unnecessary PRS_NEW check in kern_procctl.
  
  pfind does not return processes in such state.

Modified:
  head/sys/kern/sys_process.c

Modified: head/sys/kern/sys_process.c
==============================================================================
--- head/sys/kern/sys_process.c	Wed Oct 22 04:09:47 2014	(r273451)
+++ head/sys/kern/sys_process.c	Wed Oct 22 04:16:09 2014	(r273452)
@@ -1373,10 +1373,7 @@ kern_procctl(struct thread *td, idtype_t
 			error = ESRCH;
 			break;
 		}
-		if (p->p_state == PRS_NEW)
-			error = ESRCH;
-		else
-			error = p_cansee(td, p);
+		error = p_cansee(td, p);
 		if (error == 0)
 			error = kern_procctl_single(td, p, com, data);
 		PROC_UNLOCK(p);

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 05:21:38 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 3B7CF21D;
 Wed, 22 Oct 2014 05:21:38 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 1CE5D3D7;
 Wed, 22 Oct 2014 05:21:38 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M5LbuR029340;
 Wed, 22 Oct 2014 05:21:37 GMT (envelope-from luigi@FreeBSD.org)
Received: (from luigi@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M5LbGK029337;
 Wed, 22 Oct 2014 05:21:37 GMT (envelope-from luigi@FreeBSD.org)
Message-Id: <201410220521.s9M5LbGK029337@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: luigi set sender to
 luigi@FreeBSD.org using -f
From: Luigi Rizzo 
Date: Wed, 22 Oct 2014 05:21:37 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273453 - head/sys/netpfil/ipfw
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 05:21:38 -0000

Author: luigi
Date: Wed Oct 22 05:21:36 2014
New Revision: 273453
URL: https://svnweb.freebsd.org/changeset/base/273453

Log:
  remove/fix old code for building ipfw and dummynet in userspace

Modified:
  head/sys/netpfil/ipfw/ip_dn_io.c
  head/sys/netpfil/ipfw/ip_fw_private.h
  head/sys/netpfil/ipfw/ip_fw_sockopt.c

Modified: head/sys/netpfil/ipfw/ip_dn_io.c
==============================================================================
--- head/sys/netpfil/ipfw/ip_dn_io.c	Wed Oct 22 04:16:09 2014	(r273452)
+++ head/sys/netpfil/ipfw/ip_dn_io.c	Wed Oct 22 05:21:36 2014	(r273453)
@@ -283,7 +283,7 @@ mq_append(struct mq *q, struct mbuf *m)
 		*m_new = *m;	// copy
 		m_new->m_flags &= ~M_STACK;
 		m_new->__m_extbuf = p; // point to new buffer
-		pkt_copy(m->__m_extbuf, p, m->__m_extlen);
+		_pkt_copy(m->__m_extbuf, p, m->__m_extlen);
 		m_new->m_data = p + ofs;
 		m = m_new;
 	}

Modified: head/sys/netpfil/ipfw/ip_fw_private.h
==============================================================================
--- head/sys/netpfil/ipfw/ip_fw_private.h	Wed Oct 22 04:16:09 2014	(r273452)
+++ head/sys/netpfil/ipfw/ip_fw_private.h	Wed Oct 22 05:21:36 2014	(r273453)
@@ -354,29 +354,6 @@ struct ipfw_ifc {
 };
 
 /* Macro for working with various counters */
-#ifdef USERSPACE
-#define	IPFW_INC_RULE_COUNTER(_cntr, _bytes)	do {	\
-	(_cntr)->pcnt++;				\
-	(_cntr)->bcnt += _bytes;			\
-	(_cntr)->timestamp = time_uptime;		\
-	} while (0)
-
-#define	IPFW_INC_DYN_COUNTER(_cntr, _bytes)	do {		\
-	(_cntr)->pcnt++;				\
-	(_cntr)->bcnt += _bytes;			\
-	} while (0)
-
-#define	IPFW_ZERO_RULE_COUNTER(_cntr) do {		\
-	(_cntr)->pcnt = 0;				\
-	(_cntr)->bcnt = 0;				\
-	(_cntr)->timestamp = 0;				\
-	} while (0)
-
-#define	IPFW_ZERO_DYN_COUNTER(_cntr) do {		\
-	(_cntr)->pcnt = 0;				\
-	(_cntr)->bcnt = 0;				\
-	} while (0)
-#else
 #define	IPFW_INC_RULE_COUNTER(_cntr, _bytes)	do {	\
 	counter_u64_add((_cntr)->cntr, 1);		\
 	counter_u64_add((_cntr)->cntr + 1, _bytes);	\
@@ -399,7 +376,6 @@ struct ipfw_ifc {
 	(_cntr)->pcnt = 0;				\
 	(_cntr)->bcnt = 0;				\
 	} while (0)
-#endif
 
 #define	TARG_VAL(ch, k, f)	((struct table_value *)((ch)->valuestate))[k].f
 #define	IP_FW_ARG_TABLEARG(ch, a, f)	\

Modified: head/sys/netpfil/ipfw/ip_fw_sockopt.c
==============================================================================
--- head/sys/netpfil/ipfw/ip_fw_sockopt.c	Wed Oct 22 04:16:09 2014	(r273452)
+++ head/sys/netpfil/ipfw/ip_fw_sockopt.c	Wed Oct 22 05:21:36 2014	(r273453)
@@ -152,8 +152,6 @@ static struct ipfw_sopt_handler	scodes[]
  * static variables followed by global ones
  */
 
-#ifndef USERSPACE
-
 static VNET_DEFINE(uma_zone_t, ipfw_cntr_zone);
 #define	V_ipfw_cntr_zone		VNET(ipfw_cntr_zone)
 
@@ -191,35 +189,6 @@ free_rule(struct ip_fw *rule)
 	uma_zfree(V_ipfw_cntr_zone, rule->cntr);
 	free(rule, M_IPFW);
 }
-#else
-void
-ipfw_init_counters()
-{
-}
-
-void
-ipfw_destroy_counters()
-{
-}
-
-struct ip_fw *
-ipfw_alloc_rule(struct ip_fw_chain *chain, size_t rulesize)
-{
-	struct ip_fw *rule;
-
-	rule = malloc(rulesize, M_IPFW, M_WAITOK | M_ZERO);
-
-	return (rule);
-}
-
-static void
-free_rule(struct ip_fw *rule)
-{
-
-	free(rule, M_IPFW);
-}
-
-#endif
 
 
 /*

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 06:53:56 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 32162F02;
 Wed, 22 Oct 2014 06:53:56 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 1ED30DB2;
 Wed, 22 Oct 2014 06:53:56 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M6rtnD072118;
 Wed, 22 Oct 2014 06:53:55 GMT (envelope-from jmg@FreeBSD.org)
Received: (from jmg@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M6rt7b072117;
 Wed, 22 Oct 2014 06:53:55 GMT (envelope-from jmg@FreeBSD.org)
Message-Id: <201410220653.s9M6rt7b072117@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: jmg set sender to jmg@FreeBSD.org
 using -f
From: John-Mark Gurney 
Date: Wed, 22 Oct 2014 06:53:55 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273454 - head/share/mk
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 06:53:56 -0000

Author: jmg
Date: Wed Oct 22 06:53:55 2014
New Revision: 273454
URL: https://svnweb.freebsd.org/changeset/base/273454

Log:
  fix spelling of DEFAULT in comments...

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

Modified: head/share/mk/bsd.mkopt.mk
==============================================================================
--- head/share/mk/bsd.mkopt.mk	Wed Oct 22 05:21:36 2014	(r273453)
+++ head/share/mk/bsd.mkopt.mk	Wed Oct 22 06:53:55 2014	(r273454)
@@ -4,11 +4,11 @@
 # Generic mechanism to deal with WITH and WITHOUT options and turn
 # them into MK_ options.
 #
-# For each option FOO in __DEFUALT_YES_OPTIONS, MK_FOO is set to
+# For each option FOO in __DEFAULT_YES_OPTIONS, MK_FOO is set to
 # "yes", unless WITHOUT_FOO is defined, in which case it is set to
 # "no".
 #
-# For each option FOO in __DEFUALT_NO_OPTIONS, MK_FOO is set to "no",
+# For each option FOO in __DEFAULT_NO_OPTIONS, MK_FOO is set to "no",
 # unless WITH_FOO is defined, in which case it is set to "yes".
 #
 # If both WITH_FOO and WITHOUT_FOO are defined, WITHOUT_FOO wins and

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 07:16:47 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 5A0C13CA;
 Wed, 22 Oct 2014 07:16:47 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 45BA3F9F;
 Wed, 22 Oct 2014 07:16:47 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M7GlWN082134;
 Wed, 22 Oct 2014 07:16:47 GMT (envelope-from hselasky@FreeBSD.org)
Received: (from hselasky@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M7GleB082133;
 Wed, 22 Oct 2014 07:16:47 GMT (envelope-from hselasky@FreeBSD.org)
Message-Id: <201410220716.s9M7GleB082133@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: hselasky set sender to
 hselasky@FreeBSD.org using -f
From: Hans Petter Selasky 
Date: Wed, 22 Oct 2014 07:16:47 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273455 - head/sys/sys
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 07:16:47 -0000

Author: hselasky
Date: Wed Oct 22 07:16:46 2014
New Revision: 273455
URL: https://svnweb.freebsd.org/changeset/base/273455

Log:
  Allow overspecification of SYSCTL type in external kernel modules.
  
  PR:		194523
  MFC after:	3 days

Modified:
  head/sys/sys/sysctl.h

Modified: head/sys/sys/sysctl.h
==============================================================================
--- head/sys/sys/sysctl.h	Wed Oct 22 06:53:55 2014	(r273454)
+++ head/sys/sys/sysctl.h	Wed Oct 22 07:16:46 2014	(r273455)
@@ -123,6 +123,13 @@ struct ctlname {
 #ifdef _KERNEL
 #include 
 
+#ifdef KLD_MODULE
+/* XXX allow overspecification of type in external kernel modules */
+#define	SYSCTL_CT_ASSERT_MASK CTLTYPE
+#else
+#define	SYSCTL_CT_ASSERT_MASK 0
+#endif
+
 #define	SYSCTL_HANDLER_ARGS struct sysctl_oid *oidp, void *arg1,	\
 	intptr_t arg2, struct sysctl_req *req
 
@@ -268,24 +275,28 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e
 	SYSCTL_OID_RAW(sysctl___##name, &sysctl__children,	\
 	    nbr, #name, CTLTYPE_NODE|(access), NULL, 0,		\
 	    handler, "N", descr);				\
-	CTASSERT(((access) & CTLTYPE) == 0)
+	CTASSERT(((access) & CTLTYPE) == 0 ||			\
+	    ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_NODE)
 
 /* This constructs a node from which other oids can hang. */
 #define	SYSCTL_NODE(parent, nbr, name, access, handler, descr)		\
 	SYSCTL_OID_GLOBAL(parent, nbr, name, CTLTYPE_NODE|(access),	\
 	    NULL, 0, handler, "N", descr);				\
-	CTASSERT(((access) & CTLTYPE) == 0)
+	CTASSERT(((access) & CTLTYPE) == 0 ||				\
+	    ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_NODE)
 
 #define	SYSCTL_ADD_NODE(ctx, parent, nbr, name, access, handler, descr)	\
 ({									\
-	CTASSERT(((access) & CTLTYPE) == 0);				\
+	CTASSERT(((access) & CTLTYPE) == 0 ||				\
+	    ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_NODE);	\
 	sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_NODE|(access),	\
 	    NULL, 0, handler, "N", __DESCR(descr));			\
 })
 
 #define	SYSCTL_ADD_ROOT_NODE(ctx, nbr, name, access, handler, descr)	\
 ({									\
-	CTASSERT(((access) & CTLTYPE) == 0);				\
+	CTASSERT(((access) & CTLTYPE) == 0 ||				\
+	    ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_NODE);	\
 	sysctl_add_oid(ctx, &sysctl__children, nbr, name,		\
 	    CTLTYPE_NODE|(access),					\
 	    NULL, 0, handler, "N", __DESCR(descr));			\
@@ -295,12 +306,14 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e
 #define	SYSCTL_STRING(parent, nbr, name, access, arg, len, descr)	\
 	SYSCTL_OID(parent, nbr, name, CTLTYPE_STRING|(access),		\
 	    arg, len, sysctl_handle_string, "A", descr);		\
-	CTASSERT(((access) & CTLTYPE) == 0)
+	CTASSERT(((access) & CTLTYPE) == 0 ||				\
+	    ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_STRING)
 
 #define	SYSCTL_ADD_STRING(ctx, parent, nbr, name, access, arg, len, descr) \
 ({									\
 	char *__arg = (arg);						\
-	CTASSERT(((access) & CTLTYPE) == 0);				\
+	CTASSERT(((access) & CTLTYPE) == 0 ||				\
+	    ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_STRING);	\
 	sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_STRING|(access),	\
 	    __arg, len, sysctl_handle_string, "A", __DESCR(descr));	\
 })
@@ -311,13 +324,15 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e
 	SYSCTL_OID(parent, nbr, name,				\
 	    CTLTYPE_INT | CTLFLAG_MPSAFE | (access),		\
 	    ptr, val, sysctl_handle_int, "I", descr);		\
-	CTASSERT(((access) & CTLTYPE) == 0);			\
+	CTASSERT(((access) & CTLTYPE) == 0 ||			\
+	    ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_INT);	\
 	CTASSERT(sizeof(int) == sizeof(*(ptr)))
 
 #define	SYSCTL_ADD_INT(ctx, parent, nbr, name, access, ptr, val, descr)	\
 ({									\
 	int *__ptr = (ptr);						\
-	CTASSERT(((access) & CTLTYPE) == 0);				\
+	CTASSERT(((access) & CTLTYPE) == 0 ||				\
+	    ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_INT);		\
 	sysctl_add_oid(ctx, parent, nbr, name,				\
 	    CTLTYPE_INT | CTLFLAG_MPSAFE | (access),			\
 	    __ptr, val, sysctl_handle_int, "I", __DESCR(descr));	\
@@ -329,13 +344,15 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e
 	SYSCTL_OID(parent, nbr, name,				\
 	    CTLTYPE_UINT | CTLFLAG_MPSAFE | (access),		\
 	    ptr, val, sysctl_handle_int, "IU", descr);		\
-	CTASSERT(((access) & CTLTYPE) == 0);			\
+	CTASSERT(((access) & CTLTYPE) == 0 ||			\
+	    ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_UINT);\
 	CTASSERT(sizeof(unsigned) == sizeof(*(ptr)))
 
 #define	SYSCTL_ADD_UINT(ctx, parent, nbr, name, access, ptr, val, descr) \
 ({									\
 	unsigned *__ptr = (ptr);					\
-	CTASSERT(((access) & CTLTYPE) == 0);				\
+	CTASSERT(((access) & CTLTYPE) == 0 ||				\
+	    ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_UINT);	\
 	sysctl_add_oid(ctx, parent, nbr, name,				\
 	    CTLTYPE_UINT | CTLFLAG_MPSAFE | (access),			\
 	    __ptr, val, sysctl_handle_int, "IU", __DESCR(descr));	\
@@ -347,13 +364,15 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e
 	SYSCTL_OID(parent, nbr, name,				\
 	    CTLTYPE_LONG | CTLFLAG_MPSAFE | (access),		\
 	    ptr, val, sysctl_handle_long, "L", descr);		\
-	CTASSERT(((access) & CTLTYPE) == 0);			\
+	CTASSERT(((access) & CTLTYPE) == 0 ||			\
+	    ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_LONG);\
 	CTASSERT(sizeof(long) == sizeof(*(ptr)))
 
 #define	SYSCTL_ADD_LONG(ctx, parent, nbr, name, access, ptr, descr)	\
 ({									\
 	long *__ptr = (ptr);						\
-	CTASSERT(((access) & CTLTYPE) == 0);				\
+	CTASSERT(((access) & CTLTYPE) == 0 ||				\
+	    ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_LONG);	\
 	sysctl_add_oid(ctx, parent, nbr, name,				\
 	    CTLTYPE_LONG | CTLFLAG_MPSAFE | (access),			\
 	    __ptr, 0, sysctl_handle_long, "L", __DESCR(descr));		\
@@ -365,13 +384,15 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e
 	SYSCTL_OID(parent, nbr, name,					\
 	    CTLTYPE_ULONG | CTLFLAG_MPSAFE | (access),			\
 	    ptr, val, sysctl_handle_long, "LU", descr);			\
-	CTASSERT(((access) & CTLTYPE) == 0);				\
+	CTASSERT(((access) & CTLTYPE) == 0 ||				\
+	    ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_ULONG);	\
 	CTASSERT(sizeof(unsigned long) == sizeof(*(ptr)))
 
 #define	SYSCTL_ADD_ULONG(ctx, parent, nbr, name, access, ptr, descr)	\
 ({									\
 	unsigned long *__ptr = (ptr);					\
-	CTASSERT(((access) & CTLTYPE) == 0);				\
+	CTASSERT(((access) & CTLTYPE) == 0 ||				\
+	    ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_ULONG);	\
 	sysctl_add_oid(ctx, parent, nbr, name,				\
 	    CTLTYPE_ULONG | CTLFLAG_MPSAFE | (access),			\
 	    __ptr, 0, sysctl_handle_long, "LU", __DESCR(descr));	\
@@ -383,13 +404,15 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e
 	SYSCTL_OID(parent, nbr, name,				\
 	    CTLTYPE_S64 | CTLFLAG_MPSAFE | (access),		\
 	    ptr, val, sysctl_handle_64, "Q", descr);		\
-	CTASSERT(((access) & CTLTYPE) == 0);			\
+	CTASSERT(((access) & CTLTYPE) == 0 ||			\
+	    ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_S64);	\
 	CTASSERT(sizeof(int64_t) == sizeof(*(ptr)))
 
 #define	SYSCTL_ADD_QUAD(ctx, parent, nbr, name, access, ptr, descr)	\
 ({									\
 	int64_t *__ptr = (ptr);						\
-	CTASSERT(((access) & CTLTYPE) == 0);				\
+	CTASSERT(((access) & CTLTYPE) == 0 ||				\
+	    ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_S64);		\
 	sysctl_add_oid(ctx, parent, nbr, name,				\
 	    CTLTYPE_S64 | CTLFLAG_MPSAFE | (access),			\
 	    __ptr, 0, sysctl_handle_64, "Q", __DESCR(descr));		\
@@ -400,13 +423,15 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e
 	SYSCTL_OID(parent, nbr, name,					\
 	    CTLTYPE_U64 | CTLFLAG_MPSAFE | (access),			\
 	     ptr, val, sysctl_handle_64, "QU", descr);			\
-	CTASSERT(((access) & CTLTYPE) == 0);				\
+	CTASSERT(((access) & CTLTYPE) == 0 ||				\
+	    ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U64);		\
 	CTASSERT(sizeof(uint64_t) == sizeof(*(ptr)))
 
 #define	SYSCTL_ADD_UQUAD(ctx, parent, nbr, name, access, ptr, descr)	\
 ({									\
 	uint64_t *__ptr = (ptr);					\
-	CTASSERT(((access) & CTLTYPE) == 0);				\
+	CTASSERT(((access) & CTLTYPE) == 0 ||				\
+	    ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U64);		\
 	sysctl_add_oid(ctx, parent, nbr, name,				\
 	    CTLTYPE_U64 | CTLFLAG_MPSAFE | (access),			\
 	    __ptr, 0, sysctl_handle_64, "QU", __DESCR(descr));		\
@@ -438,14 +463,16 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e
 	SYSCTL_OID(parent, nbr, name,					\
 	    CTLTYPE_U64 | CTLFLAG_MPSAFE | (access),			\
 	    (ptr), 0, sysctl_handle_counter_u64, "QU", descr);		\
-	CTASSERT(((access) & CTLTYPE) == 0);				\
+	CTASSERT(((access) & CTLTYPE) == 0 ||				\
+	    ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U64);		\
 	CTASSERT(sizeof(counter_u64_t) == sizeof(*(ptr)));		\
 	CTASSERT(sizeof(uint64_t) == sizeof(**(ptr)))
 
 #define	SYSCTL_ADD_COUNTER_U64(ctx, parent, nbr, name, access, ptr, descr) \
 ({									\
 	counter_u64_t *__ptr = (ptr);					\
-	CTASSERT(((access) & CTLTYPE) == 0);				\
+	CTASSERT(((access) & CTLTYPE) == 0 ||				\
+	    ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U64);		\
 	sysctl_add_oid(ctx, parent, nbr, name,				\
 	    CTLTYPE_U64 | CTLFLAG_MPSAFE | (access),			\
 	    __ptr, 0, sysctl_handle_counter_u64, "QU", __DESCR(descr));	\
@@ -455,11 +482,13 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e
 #define	SYSCTL_OPAQUE(parent, nbr, name, access, ptr, len, fmt, descr)	\
 	SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|(access),		\
 	    ptr, len, sysctl_handle_opaque, fmt, descr);		\
-	CTASSERT(((access) & CTLTYPE) == 0)
+	CTASSERT(((access) & CTLTYPE) == 0 ||				\
+	    ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE)
 
 #define	SYSCTL_ADD_OPAQUE(ctx, parent, nbr, name, access, ptr, len, fmt, descr)	\
 ({									\
-	CTASSERT(((access) & CTLTYPE) == 0);				\
+	CTASSERT(((access) & CTLTYPE) == 0 ||				\
+	    ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE);	\
 	sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_OPAQUE|(access),	\
 	    ptr, len, sysctl_handle_opaque, fmt, __DESCR(descr));	\
 })
@@ -469,11 +498,13 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e
 	SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|(access),		\
 	    ptr, sizeof(struct type), sysctl_handle_opaque,		\
 	    "S," #type, descr);						\
-	CTASSERT(((access) & CTLTYPE) == 0)
+	CTASSERT(((access) & CTLTYPE) == 0 ||				\
+	    ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE)
 
 #define	SYSCTL_ADD_STRUCT(ctx, parent, nbr, name, access, ptr, type, descr) \
 ({									\
-	CTASSERT(((access) & CTLTYPE) == 0);				\
+	CTASSERT(((access) & CTLTYPE) == 0 ||				\
+	    ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE);	\
 	sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_OPAQUE|(access),	\
 	    (ptr), sizeof(struct type),					\
 	    sysctl_handle_opaque, "S," #type, __DESCR(descr));		\
@@ -497,12 +528,14 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e
 	SYSCTL_OID(parent, nbr, name,				\
 	    CTLTYPE_INT | CTLFLAG_MPSAFE | (access),		\
 	    (ptr), 0, sysctl_handle_uma_zone_max, "I", descr);	\
-	CTASSERT(((access) & CTLTYPE) == 0)
+	CTASSERT(((access) & CTLTYPE) == 0 ||			\
+	    ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_INT)
 
 #define	SYSCTL_ADD_UMA_MAX(ctx, parent, nbr, name, access, ptr, descr)	\
 ({									\
-	uma_zone_t __ptr = (ptr);						\
-	CTASSERT(((access) & CTLTYPE) == 0);				\
+	uma_zone_t __ptr = (ptr);					\
+	CTASSERT(((access) & CTLTYPE) == 0 ||				\
+	    ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_INT);		\
 	sysctl_add_oid(ctx, parent, nbr, name,				\
 	    CTLTYPE_INT | CTLFLAG_MPSAFE | (access),			\
 	    __ptr, 0, sysctl_handle_uma_zone_max, "I", __DESCR(descr));	\
@@ -513,12 +546,14 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e
 	SYSCTL_OID(parent, nbr, name,					\
 	    CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RD | (access),	\
 	    (ptr), 0, sysctl_handle_uma_zone_cur, "I", descr);		\
-	CTASSERT(((access) & CTLTYPE) == 0)
+	CTASSERT(((access) & CTLTYPE) == 0 ||				\
+	    ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_INT)
 
 #define	SYSCTL_ADD_UMA_CUR(ctx, parent, nbr, name, access, ptr, descr)	\
 ({									\
 	uma_zone_t __ptr = (ptr);					\
-	CTASSERT(((access) & CTLTYPE) == 0);				\
+	CTASSERT(((access) & CTLTYPE) == 0 ||				\
+	    ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_INT);		\
 	sysctl_add_oid(ctx, parent, nbr, name,				\
 	    CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RD | (access),	\
 	    __ptr, 0, sysctl_handle_uma_zone_cur, "I", __DESCR(descr));	\

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 07:50:20 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id B05EECFC;
 Wed, 22 Oct 2014 07:50:20 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 9D096364;
 Wed, 22 Oct 2014 07:50:20 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M7oKGS097488;
 Wed, 22 Oct 2014 07:50:20 GMT (envelope-from hselasky@FreeBSD.org)
Received: (from hselasky@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M7oKDw097487;
 Wed, 22 Oct 2014 07:50:20 GMT (envelope-from hselasky@FreeBSD.org)
Message-Id: <201410220750.s9M7oKDw097487@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: hselasky set sender to
 hselasky@FreeBSD.org using -f
From: Hans Petter Selasky 
Date: Wed, 22 Oct 2014 07:50:20 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273456 - head/sys/dev/usb
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 07:50:20 -0000

Author: hselasky
Date: Wed Oct 22 07:50:19 2014
New Revision: 273456
URL: https://svnweb.freebsd.org/changeset/base/273456

Log:
  Actually change the USB_PORT_ROOT_RESET_DELAY definition as stated in
  the r241987 commit message, instead of having users locally overriding
  the value using tunables in /boot/loader.conf .
  
  Found by:	Adam Parco
  Discussed with:	Nick Hibma

Modified:
  head/sys/dev/usb/usb.h

Modified: head/sys/dev/usb/usb.h
==============================================================================
--- head/sys/dev/usb/usb.h	Wed Oct 22 07:16:46 2014	(r273455)
+++ head/sys/dev/usb/usb.h	Wed Oct 22 07:50:19 2014	(r273456)
@@ -113,7 +113,7 @@ MALLOC_DECLARE(M_USBHC);
 
 /* Allow for marginal and non-conforming devices. */
 #define	USB_PORT_RESET_DELAY		50	/* ms */
-#define	USB_PORT_ROOT_RESET_DELAY	250	/* ms */
+#define	USB_PORT_ROOT_RESET_DELAY	200	/* ms */
 #define	USB_PORT_RESET_RECOVERY		250	/* ms */
 #define	USB_PORT_POWERUP_DELAY		300	/* ms */
 #define	USB_PORT_RESUME_DELAY		(20*2)	/* ms */

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 07:51:38 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id BBA56E5D;
 Wed, 22 Oct 2014 07:51:38 +0000 (UTC)
Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1])
 (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 48A085F0;
 Wed, 22 Oct 2014 07:51:38 +0000 (UTC)
Received: from tom.home (kostik@localhost [127.0.0.1])
 by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id s9M7pWvW087002
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
 Wed, 22 Oct 2014 10:51:32 +0300 (EEST)
 (envelope-from kostikbel@gmail.com)
DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua s9M7pWvW087002
Received: (from kostik@localhost)
 by tom.home (8.14.9/8.14.9/Submit) id s9M7pVku087001;
 Wed, 22 Oct 2014 10:51:31 +0300 (EEST)
 (envelope-from kostikbel@gmail.com)
X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com
 using -f
Date: Wed, 22 Oct 2014 10:51:31 +0300
From: Konstantin Belousov 
To: Mateusz Guzik 
Subject: Re: svn commit: r273441 - in head/sys: kern sys
Message-ID: <20141022075131.GG1877@kib.kiev.ua>
References: <201410220023.s9M0NiBX089974@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <201410220023.s9M0NiBX089974@svn.freebsd.org>
User-Agent: Mutt/1.5.23 (2014-03-12)
X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00,
 DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no
 autolearn_force=no version=3.4.0
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
 src-committers@freebsd.org
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 07:51:38 -0000

On Wed, Oct 22, 2014 at 12:23:44AM +0000, Mateusz Guzik wrote:
> Author: mjg
> Date: Wed Oct 22 00:23:43 2014
> New Revision: 273441
> URL: https://svnweb.freebsd.org/changeset/base/273441
> 
> Log:
>   filedesc: cleanup setugidsafety a little
>   
>   Rename it to fdsetugidsafety for consistency with other functions.
>   
>   There is no need to take filedesc lock if not closing any files.
>   
>   The loop has to verify each file and we are guaranteed fdtable has space
>   for at least 20 fds. As such there is no need to check fd_lastfile.
^^^^^^^^^^^^^^^^^^^^^^^^ *

>   
>   While here tidy up is_unsafe.
> 
> Modified:
>   head/sys/kern/kern_descrip.c
>   head/sys/kern/kern_exec.c
>   head/sys/sys/filedesc.h
> 
> Modified: head/sys/kern/kern_descrip.c
> ==============================================================================
> --- head/sys/kern/kern_descrip.c	Tue Oct 21 23:57:31 2014	(r273440)
> +++ head/sys/kern/kern_descrip.c	Wed Oct 22 00:23:43 2014	(r273441)
> @@ -2078,23 +2078,23 @@ fdescfree(struct thread *td)
>   * Since setugidsafety calls this only for fd 0, 1 and 2, this check is
>   * sufficient.  We also don't check for setugidness since we know we are.
>   */
> -static int
> +static bool
>  is_unsafe(struct file *fp)
>  {
> -	if (fp->f_type == DTYPE_VNODE) {
> -		struct vnode *vp = fp->f_vnode;
> +	struct vnode *vp;
>  
> -		if ((vp->v_vflag & VV_PROCDEP) != 0)
> -			return (1);
> -	}
> -	return (0);
> +	if (fp->f_type != DTYPE_VNODE)
> +		return (false);
> +
> +	vp = fp->f_vnode;
> +	return ((vp->v_vflag & VV_PROCDEP) != 0);
>  }
>  
>  /*
>   * Make this setguid thing safe, if at all possible.
>   */
>  void
> -setugidsafety(struct thread *td)
> +fdsetugidsafety(struct thread *td)
>  {
>  	struct filedesc *fdp;
>  	struct file *fp;
> @@ -2102,12 +2102,10 @@ setugidsafety(struct thread *td)
>  
>  	fdp = td->td_proc->p_fd;
>  	KASSERT(fdp->fd_refcnt == 1, ("the fdtable should not be shared"));
> -	FILEDESC_XLOCK(fdp);
> -	for (i = 0; i <= fdp->fd_lastfile; i++) {
> -		if (i > 2)
> -			break;
> +	for (i = 0; i <= 2; i++) {
[*] This requires an assert.

>  		fp = fdp->fd_ofiles[i].fde_file;
>  		if (fp != NULL && is_unsafe(fp)) {
> +			FILEDESC_XLOCK(fdp);
>  			knote_fdclose(td, i);
>  			/*
>  			 * NULL-out descriptor prior to close to avoid

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 08:26:28 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id ADBBD77F;
 Wed, 22 Oct 2014 08:26:28 +0000 (UTC)
Received: from mail-wi0-x236.google.com (mail-wi0-x236.google.com
 [IPv6:2a00:1450:400c:c05::236])
 (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits))
 (Client CN "smtp.gmail.com",
 Issuer "Google Internet Authority G2" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id C03779DF;
 Wed, 22 Oct 2014 08:26:27 +0000 (UTC)
Received: by mail-wi0-f182.google.com with SMTP id bs8so615336wib.15
 for ; Wed, 22 Oct 2014 01:26:25 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=date:from:to:cc:subject:message-id:references:mime-version
 :content-type:content-disposition:in-reply-to:user-agent;
 bh=dRixs16r4CTRcqYSSFqe3Zms82+v2/8ly47PwkAxYYQ=;
 b=K6GHpcag/TOVzbNjyHccSoyge1t6ZvLFZbh6waqoTQ4H+tDq1k9ReXAAUWAw76d8xB
 +zoWGeLKV+VZGKlSK43YLKcW7D8N/+K+b4WYZwtbV+vE7AUlhuQqplyaX69IXMW3kfEz
 2DrA/7M0bdO0S/KcQkXrI8yShMZrlk/C+06gpfUrz9W9TEtviqMlkCzmJm5LqT6mSJs3
 wFsXV/tu8WqbGALEAoz2YHyJL8utV7RzLY0MLOilCdUmS8i90crZTBE5i/p1NDIplavT
 v61X9Eaxqeo2vHjPgLQjOaRV9TBbldK3ZecfiObKnq4gGZR2ZjxcPZltpfAquQfGlVEJ
 ZziQ==
X-Received: by 10.194.76.70 with SMTP id i6mr49953380wjw.13.1413966385112;
 Wed, 22 Oct 2014 01:26:25 -0700 (PDT)
Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net.
 [2001:470:1f08:1f7::2])
 by mx.google.com with ESMTPSA id bi7sm1055877wib.17.2014.10.22.01.26.23
 for 
 (version=TLSv1.2 cipher=RC4-SHA bits=128/128);
 Wed, 22 Oct 2014 01:26:24 -0700 (PDT)
Date: Wed, 22 Oct 2014 10:26:21 +0200
From: Mateusz Guzik 
To: Konstantin Belousov 
Subject: Re: svn commit: r273441 - in head/sys: kern sys
Message-ID: <20141022082621.GB4393@dft-labs.eu>
References: <201410220023.s9M0NiBX089974@svn.freebsd.org>
 <20141022075131.GG1877@kib.kiev.ua>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
In-Reply-To: <20141022075131.GG1877@kib.kiev.ua>
User-Agent: Mutt/1.5.21 (2010-09-15)
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
 src-committers@freebsd.org, Mateusz Guzik 
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 08:26:28 -0000

On Wed, Oct 22, 2014 at 10:51:31AM +0300, Konstantin Belousov wrote:
> On Wed, Oct 22, 2014 at 12:23:44AM +0000, Mateusz Guzik wrote:
> > Author: mjg
> > Date: Wed Oct 22 00:23:43 2014
> > New Revision: 273441
> > URL: https://svnweb.freebsd.org/changeset/base/273441
> > 
> > Log:
> >   filedesc: cleanup setugidsafety a little
> >   
> >   Rename it to fdsetugidsafety for consistency with other functions.
> >   
> >   There is no need to take filedesc lock if not closing any files.
> >   
> >   The loop has to verify each file and we are guaranteed fdtable has space
> >   for at least 20 fds. As such there is no need to check fd_lastfile.
> ^^^^^^^^^^^^^^^^^^^^^^^^ *
> 
[..]
> >  	fdp = td->td_proc->p_fd;
> >  	KASSERT(fdp->fd_refcnt == 1, ("the fdtable should not be shared"));
> > -	FILEDESC_XLOCK(fdp);
> > -	for (i = 0; i <= fdp->fd_lastfile; i++) {
> > -		if (i > 2)
> > -			break;
> > +	for (i = 0; i <= 2; i++) {
> [*] This requires an assert.
> 

I was considering adding one, but failed to come up with anything good.

Ideally we would compile-time assert that NDFILE is at least 3, but that
seems weirdly circumventable by sufficient accident.

MPASS(fdp->fd_nfiles > 3) does not guarantee we wont run into trouble,
has a potential to help.

Any suggestions?

-- 
Mateusz Guzik 

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 08:41:44 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 47DC6C1C;
 Wed, 22 Oct 2014 08:41:44 +0000 (UTC)
Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1])
 (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id AD40EB77;
 Wed, 22 Oct 2014 08:41:43 +0000 (UTC)
Received: from tom.home (kostik@localhost [127.0.0.1])
 by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id s9M8fcYp002654
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
 Wed, 22 Oct 2014 11:41:38 +0300 (EEST)
 (envelope-from kostikbel@gmail.com)
DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua s9M8fcYp002654
Received: (from kostik@localhost)
 by tom.home (8.14.9/8.14.9/Submit) id s9M8fca1002653;
 Wed, 22 Oct 2014 11:41:38 +0300 (EEST)
 (envelope-from kostikbel@gmail.com)
X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com
 using -f
Date: Wed, 22 Oct 2014 11:41:38 +0300
From: Konstantin Belousov 
To: Mateusz Guzik 
Subject: Re: svn commit: r273441 - in head/sys: kern sys
Message-ID: <20141022084138.GI1877@kib.kiev.ua>
References: <201410220023.s9M0NiBX089974@svn.freebsd.org>
 <20141022075131.GG1877@kib.kiev.ua>
 <20141022082621.GB4393@dft-labs.eu>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20141022082621.GB4393@dft-labs.eu>
User-Agent: Mutt/1.5.23 (2014-03-12)
X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00,
 DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no
 autolearn_force=no version=3.4.0
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
 src-committers@freebsd.org, Mateusz Guzik 
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 08:41:44 -0000

On Wed, Oct 22, 2014 at 10:26:21AM +0200, Mateusz Guzik wrote:
> On Wed, Oct 22, 2014 at 10:51:31AM +0300, Konstantin Belousov wrote:
> > On Wed, Oct 22, 2014 at 12:23:44AM +0000, Mateusz Guzik wrote:
> > > Author: mjg
> > > Date: Wed Oct 22 00:23:43 2014
> > > New Revision: 273441
> > > URL: https://svnweb.freebsd.org/changeset/base/273441
> > > 
> > > Log:
> > >   filedesc: cleanup setugidsafety a little
> > >   
> > >   Rename it to fdsetugidsafety for consistency with other functions.
> > >   
> > >   There is no need to take filedesc lock if not closing any files.
> > >   
> > >   The loop has to verify each file and we are guaranteed fdtable has space
> > >   for at least 20 fds. As such there is no need to check fd_lastfile.
> > ^^^^^^^^^^^^^^^^^^^^^^^^ *
> > 
> [..]
> > >  	fdp = td->td_proc->p_fd;
> > >  	KASSERT(fdp->fd_refcnt == 1, ("the fdtable should not be shared"));
> > > -	FILEDESC_XLOCK(fdp);
> > > -	for (i = 0; i <= fdp->fd_lastfile; i++) {
> > > -		if (i > 2)
> > > -			break;
> > > +	for (i = 0; i <= 2; i++) {
> > [*] This requires an assert.
> > 
> 
> I was considering adding one, but failed to come up with anything good.
> 
> Ideally we would compile-time assert that NDFILE is at least 3, but that
> seems weirdly circumventable by sufficient accident.
> 
> MPASS(fdp->fd_nfiles > 3) does not guarantee we wont run into trouble,
> has a potential to help.
What troubles do you mean ?  Also, why > 3, and not >= 3 ?
Old code used fd_lastfile, which, for purpose of the assert, is also
fine.

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 08:54:11 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 9E4F6F08;
 Wed, 22 Oct 2014 08:54:11 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 71311D4D;
 Wed, 22 Oct 2014 08:54:11 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M8sBTI028913;
 Wed, 22 Oct 2014 08:54:11 GMT (envelope-from mav@FreeBSD.org)
Received: (from mav@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M8sBXx028911;
 Wed, 22 Oct 2014 08:54:11 GMT (envelope-from mav@FreeBSD.org)
Message-Id: <201410220854.s9M8sBXx028911@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org
 using -f
From: Alexander Motin 
Date: Wed, 22 Oct 2014 08:54:11 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273457 - head/share/man/man4
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 08:54:11 -0000

Author: mav
Date: Wed Oct 22 08:54:10 2014
New Revision: 273457
URL: https://svnweb.freebsd.org/changeset/base/273457

Log:
  Document sort_io_queue sysctls/tunables.
  
  MFC after:	1 week

Modified:
  head/share/man/man4/ada.4
  head/share/man/man4/da.4

Modified: head/share/man/man4/ada.4
==============================================================================
--- head/share/man/man4/ada.4	Wed Oct 22 07:50:19 2014	(r273456)
+++ head/share/man/man4/ada.4	Wed Oct 22 08:54:10 2014	(r273457)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 21, 2014
+.Dd October 22, 2014
 .Dt ADA 4
 .Os
 .Sh NAME
@@ -123,6 +123,13 @@ seconds.
 This variable determines whether to spin-down disks when shutting down.
 Set to 1 to enable spin-down, 0 to disable.
 The default is currently enabled.
+.It Va kern.cam.sort_io_queue
+.It Va kern.cam.ada. Ns Ar X Ns Va .sort_io_queue
+.Pp
+These variables determine whether request queue should be sorted trying
+to optimize head seeks.
+Set to 1 to enable sorting, 0 to disable, -1 to leave it as-is.
+The default is sorting enabled for HDDs and disabled SSDs.
 .It Va kern.cam.ada.read_ahead
 .It Va kern.cam.ada. Ns Ar X Ns Va .read_ahead
 .It Va kern.cam.ada.write_cache

Modified: head/share/man/man4/da.4
==============================================================================
--- head/share/man/man4/da.4	Wed Oct 22 07:50:19 2014	(r273456)
+++ head/share/man/man4/da.4	Wed Oct 22 08:54:10 2014	(r273457)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 8, 2012
+.Dd October 22, 2014
 .Dt DA 4
 .Os
 .Sh NAME
@@ -150,6 +150,13 @@ This variable determines how long the
 driver will wait before timing out an outstanding command.
 The units for this value are seconds, and the default is currently 60
 seconds.
+.It Va kern.cam.sort_io_queue
+.It Va kern.cam.da. Ns Ar X Ns Va .sort_io_queue
+.Pp
+These variables determine whether request queue should be sorted trying
+to optimize head seeks.
+Set to 1 to enable sorting, 0 to disable, -1 to leave it as-is.
+The default is sorting enabled for HDDs and disabled for SSDs.
 .It kern.cam.da.%d.minimum_cmd_size
 .Pp
 This variable determines what the minimum READ/WRITE CDB size is for a

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 08:56:58 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 3C1E1303;
 Wed, 22 Oct 2014 08:56:58 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 29368D8D;
 Wed, 22 Oct 2014 08:56:58 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M8uwQC029560;
 Wed, 22 Oct 2014 08:56:58 GMT (envelope-from mjg@FreeBSD.org)
Received: (from mjg@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M8uwqI029559;
 Wed, 22 Oct 2014 08:56:58 GMT (envelope-from mjg@FreeBSD.org)
Message-Id: <201410220856.s9M8uwqI029559@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org
 using -f
From: Mateusz Guzik 
Date: Wed, 22 Oct 2014 08:56:58 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273458 - head/sys/kern
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 08:56:58 -0000

Author: mjg
Date: Wed Oct 22 08:56:57 2014
New Revision: 273458
URL: https://svnweb.freebsd.org/changeset/base/273458

Log:
  filedesc assert that table size is at least 3 in fdsetugidsafety
  
  Requested by: kib

Modified:
  head/sys/kern/kern_descrip.c

Modified: head/sys/kern/kern_descrip.c
==============================================================================
--- head/sys/kern/kern_descrip.c	Wed Oct 22 08:54:10 2014	(r273457)
+++ head/sys/kern/kern_descrip.c	Wed Oct 22 08:56:57 2014	(r273458)
@@ -2102,6 +2102,7 @@ fdsetugidsafety(struct thread *td)
 
 	fdp = td->td_proc->p_fd;
 	KASSERT(fdp->fd_refcnt == 1, ("the fdtable should not be shared"));
+	MPASS(fdp->fd_nfiles >= 3);
 	for (i = 0; i <= 2; i++) {
 		fp = fdp->fd_ofiles[i].fde_file;
 		if (fp != NULL && is_unsafe(fp)) {

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 08:58:28 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id A68FA4C7;
 Wed, 22 Oct 2014 08:58:28 +0000 (UTC)
Received: from mail-wg0-x22c.google.com (mail-wg0-x22c.google.com
 [IPv6:2a00:1450:400c:c00::22c])
 (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits))
 (Client CN "smtp.gmail.com",
 Issuer "Google Internet Authority G2" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id C23DBDB5;
 Wed, 22 Oct 2014 08:58:27 +0000 (UTC)
Received: by mail-wg0-f44.google.com with SMTP id y10so3156071wgg.27
 for ; Wed, 22 Oct 2014 01:58:25 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=date:from:to:cc:subject:message-id:references:mime-version
 :content-type:content-disposition:in-reply-to:user-agent;
 bh=DOX3P5uD40Taj1iZ9KXr+TMZ2hOfO02rwENraiQWRr0=;
 b=NPGmGAShXbEDknhyHDqippbxxzvryWpnmkT+476SYVZicosYiTF0hs12CDNjT6gAHR
 dsNdEQqY5nN4bH9LNbHWrDlfAH3I2JHKyhLmhDIKffwdspO32SHipDp+xCayT2KPO6vk
 GnCqLXAdoegytz3sOygVi0mXg2HRySm7rXbLo4LHXAB32E96XQINSxC+Roxpsv/3RhH/
 DHHtD/xy7Heg2bnM6kCI+y+swDzMpJukLPSHjwpjya3HuT2c4KEpGoVnKWUohu2OEIXT
 hi1FMNP4wl/n3z5+MP6jbIH6ox8+i3+IFO7ysPctTTfY+Ydl4w0DLeU9k3fW0GBvP119
 FD2A==
X-Received: by 10.180.88.68 with SMTP id be4mr4125727wib.36.1413968305812;
 Wed, 22 Oct 2014 01:58:25 -0700 (PDT)
Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net.
 [2001:470:1f08:1f7::2])
 by mx.google.com with ESMTPSA id j20sm11947570wjn.0.2014.10.22.01.58.24
 for 
 (version=TLSv1.2 cipher=RC4-SHA bits=128/128);
 Wed, 22 Oct 2014 01:58:25 -0700 (PDT)
Date: Wed, 22 Oct 2014 10:58:21 +0200
From: Mateusz Guzik 
To: Konstantin Belousov 
Subject: Re: svn commit: r273441 - in head/sys: kern sys
Message-ID: <20141022085821.GC4393@dft-labs.eu>
References: <201410220023.s9M0NiBX089974@svn.freebsd.org>
 <20141022075131.GG1877@kib.kiev.ua>
 <20141022082621.GB4393@dft-labs.eu>
 <20141022084138.GI1877@kib.kiev.ua>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
In-Reply-To: <20141022084138.GI1877@kib.kiev.ua>
User-Agent: Mutt/1.5.21 (2010-09-15)
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
 src-committers@freebsd.org, Mateusz Guzik 
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 08:58:28 -0000

On Wed, Oct 22, 2014 at 11:41:38AM +0300, Konstantin Belousov wrote:
> On Wed, Oct 22, 2014 at 10:26:21AM +0200, Mateusz Guzik wrote:
> > On Wed, Oct 22, 2014 at 10:51:31AM +0300, Konstantin Belousov wrote:
> > > On Wed, Oct 22, 2014 at 12:23:44AM +0000, Mateusz Guzik wrote:
> > > > Author: mjg
> > > > Date: Wed Oct 22 00:23:43 2014
> > > > New Revision: 273441
> > > > URL: https://svnweb.freebsd.org/changeset/base/273441
> > > > 
> > > > Log:
> > > >   filedesc: cleanup setugidsafety a little
> > > >   
> > > >   Rename it to fdsetugidsafety for consistency with other functions.
> > > >   
> > > >   There is no need to take filedesc lock if not closing any files.
> > > >   
> > > >   The loop has to verify each file and we are guaranteed fdtable has space
> > > >   for at least 20 fds. As such there is no need to check fd_lastfile.
> > > ^^^^^^^^^^^^^^^^^^^^^^^^ *
> > > 
> > [..]
> > > >  	fdp = td->td_proc->p_fd;
> > > >  	KASSERT(fdp->fd_refcnt == 1, ("the fdtable should not be shared"));
> > > > -	FILEDESC_XLOCK(fdp);
> > > > -	for (i = 0; i <= fdp->fd_lastfile; i++) {
> > > > -		if (i > 2)
> > > > -			break;
> > > > +	for (i = 0; i <= 2; i++) {
> > > [*] This requires an assert.
> > > 
> > 
> > I was considering adding one, but failed to come up with anything good.
> > 
> > Ideally we would compile-time assert that NDFILE is at least 3, but that
> > seems weirdly circumventable by sufficient accident.
> > 
> > MPASS(fdp->fd_nfiles > 3) does not guarantee we wont run into trouble,
> > has a potential to help.
> What troubles do you mean ?  Also, why > 3, and not >= 3 ?

Oops, yeah, that should have been >= 3.

I mean this kind of assertion is standard "will catch offenders, if they
happen to execute it" as opposed to making sure such offenders are not
possible to exist in the first place.

I committed this MAPSS, if I come up with something better I'll update
the code.

> Old code used fd_lastfile, which, for purpose of the assert, is also
> fine.

fd_lastfile denotes the biggest fd currently in use, so it cannot be used
in an assertion.

-- 
Mateusz Guzik 

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 08:59:25 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id B7E5C61D;
 Wed, 22 Oct 2014 08:59:25 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id A2EAADC8;
 Wed, 22 Oct 2014 08:59:25 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M8xPg3029905;
 Wed, 22 Oct 2014 08:59:25 GMT (envelope-from trasz@FreeBSD.org)
Received: (from trasz@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M8xOBO029895;
 Wed, 22 Oct 2014 08:59:24 GMT (envelope-from trasz@FreeBSD.org)
Message-Id: <201410220859.s9M8xOBO029895@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: trasz set sender to
 trasz@FreeBSD.org using -f
From: Edward Tomasz Napierala 
Date: Wed, 22 Oct 2014 08:59:24 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273459 - in head/usr.sbin: ctld iscsid
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 08:59:25 -0000

Author: trasz
Date: Wed Oct 22 08:59:23 2014
New Revision: 273459
URL: https://svnweb.freebsd.org/changeset/base/273459

Log:
  Untangle iSCSI authentication code by splitting off the CHAP
  implementation.
  
  Reviewed by:	mav@
  MFC after:	1 month
  Sponsored by:	The FreeBSD Foundation

Added:
  head/usr.sbin/ctld/chap.c   (contents, props changed)
  head/usr.sbin/iscsid/chap.c   (contents, props changed)
Modified:
  head/usr.sbin/ctld/Makefile
  head/usr.sbin/ctld/ctld.h
  head/usr.sbin/ctld/login.c
  head/usr.sbin/iscsid/Makefile
  head/usr.sbin/iscsid/iscsid.h
  head/usr.sbin/iscsid/login.c

Modified: head/usr.sbin/ctld/Makefile
==============================================================================
--- head/usr.sbin/ctld/Makefile	Wed Oct 22 08:56:57 2014	(r273458)
+++ head/usr.sbin/ctld/Makefile	Wed Oct 22 08:59:23 2014	(r273459)
@@ -1,7 +1,7 @@
 # $FreeBSD$
 
 PROG=		ctld
-SRCS=		ctld.c discovery.c kernel.c keys.c log.c login.c parse.y pdu.c token.l y.tab.h
+SRCS=		chap.c ctld.c discovery.c kernel.c keys.c log.c login.c parse.y pdu.c token.l y.tab.h
 CFLAGS+=	-I${.CURDIR}
 CFLAGS+=	-I${.CURDIR}/../../sys
 CFLAGS+=	-I${.CURDIR}/../../sys/cam/ctl

Added: head/usr.sbin/ctld/chap.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.sbin/ctld/chap.c	Wed Oct 22 08:59:23 2014	(r273459)
@@ -0,0 +1,386 @@
+/*-
+ * Copyright (c) 2014 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Edward Tomasz Napierala under sponsorship
+ * from the FreeBSD Foundation.
+ *
+ * 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.
+ *
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "ctld.h"
+
+static void
+chap_compute_md5(const char id, const char *secret,
+    const void *challenge, size_t challenge_len, void *response,
+    size_t response_len)
+{
+	MD5_CTX ctx;
+	int rv;
+
+	assert(response_len == MD5_DIGEST_LENGTH);
+
+	MD5_Init(&ctx);
+	MD5_Update(&ctx, &id, sizeof(id));
+	MD5_Update(&ctx, secret, strlen(secret));
+	MD5_Update(&ctx, challenge, challenge_len);
+	rv = MD5_Final(response, &ctx);
+	if (rv != 1)
+		log_errx(1, "MD5_Final");
+}
+
+static int
+chap_hex2int(const char hex)
+{
+	switch (hex) {
+	case '0':
+		return (0x00);
+	case '1':
+		return (0x01);
+	case '2':
+		return (0x02);
+	case '3':
+		return (0x03);
+	case '4':
+		return (0x04);
+	case '5':
+		return (0x05);
+	case '6':
+		return (0x06);
+	case '7':
+		return (0x07);
+	case '8':
+		return (0x08);
+	case '9':
+		return (0x09);
+	case 'a':
+	case 'A':
+		return (0x0a);
+	case 'b':
+	case 'B':
+		return (0x0b);
+	case 'c':
+	case 'C':
+		return (0x0c);
+	case 'd':
+	case 'D':
+		return (0x0d);
+	case 'e':
+	case 'E':
+		return (0x0e);
+	case 'f':
+	case 'F':
+		return (0x0f);
+	default:
+		return (-1);
+	}
+}
+
+/*
+ * XXX: Review this _carefully_.
+ */
+static int
+chap_hex2bin(const char *hex, void **binp, size_t *bin_lenp)
+{
+	int i, hex_len, nibble;
+	bool lo = true; /* As opposed to 'hi'. */
+	char *bin;
+	size_t bin_off, bin_len;
+
+	if (strncasecmp(hex, "0x", strlen("0x")) != 0) {
+		log_warnx("malformed variable, should start with \"0x\"");
+		return (-1);
+	}
+
+	hex += strlen("0x");
+	hex_len = strlen(hex);
+	if (hex_len < 1) {
+		log_warnx("malformed variable; doesn't contain anything "
+		    "but \"0x\"");
+		return (-1);
+	}
+
+	bin_len = hex_len / 2 + hex_len % 2;
+	bin = calloc(bin_len, 1);
+	if (bin == NULL)
+		log_err(1, "calloc");
+
+	bin_off = bin_len - 1;
+	for (i = hex_len - 1; i >= 0; i--) {
+		nibble = chap_hex2int(hex[i]);
+		if (nibble < 0) {
+			log_warnx("malformed variable, invalid char \"%c\"",
+			    hex[i]);
+			free(bin);
+			return (-1);
+		}
+
+		assert(bin_off < bin_len);
+		if (lo) {
+			bin[bin_off] = nibble;
+			lo = false;
+		} else {
+			bin[bin_off] |= nibble << 4;
+			bin_off--;
+			lo = true;
+		}
+	}
+
+	*binp = bin;
+	*bin_lenp = bin_len;
+	return (0);
+}
+
+static char *
+chap_bin2hex(const char *bin, size_t bin_len)
+{
+	unsigned char *hex, *tmp, ch;
+	size_t hex_len;
+	size_t i;
+
+	hex_len = bin_len * 2 + 3; /* +2 for "0x", +1 for '\0'. */
+	hex = malloc(hex_len);
+	if (hex == NULL)
+		log_err(1, "malloc");
+
+	tmp = hex;
+	tmp += sprintf(tmp, "0x");
+	for (i = 0; i < bin_len; i++) {
+		ch = bin[i];
+		tmp += sprintf(tmp, "%02x", ch);
+	}
+
+	return (hex);
+}
+
+struct chap *
+chap_new(void)
+{
+	struct chap *chap;
+	int rv;
+
+	chap = calloc(sizeof(*chap), 1);
+	if (chap == NULL)
+		log_err(1, "calloc");
+
+	/*
+	 * Generate the challenge.
+	 */
+	rv = RAND_bytes(chap->chap_challenge, sizeof(chap->chap_challenge));
+	if (rv != 1) {
+		log_errx(1, "RAND_bytes failed: %s",
+		    ERR_error_string(ERR_get_error(), NULL));
+	}
+	rv = RAND_bytes(&chap->chap_id, sizeof(chap->chap_id));
+	if (rv != 1) {
+		log_errx(1, "RAND_bytes failed: %s",
+		    ERR_error_string(ERR_get_error(), NULL));
+	}
+
+	return (chap);
+}
+
+char *
+chap_get_id(const struct chap *chap)
+{
+	char *chap_i;
+	int ret;
+
+	ret = asprintf(&chap_i, "%d", chap->chap_id);
+	if (ret < 0)
+		log_err(1, "asprintf");
+
+	return (chap_i);
+}
+
+char *
+chap_get_challenge(const struct chap *chap)
+{
+	char *chap_c;
+
+	chap_c = chap_bin2hex(chap->chap_challenge,
+	    sizeof(chap->chap_challenge));
+
+	return (chap_c);
+}
+
+static int
+chap_receive_bin(struct chap *chap, void *response, size_t response_len)
+{
+
+	if (response_len != sizeof(chap->chap_response)) {
+		log_debugx("got CHAP response with invalid length; "
+		    "got %zd, should be %zd",
+		    response_len, sizeof(chap->chap_response));
+		return (1);
+	}
+
+	memcpy(chap->chap_response, response, response_len);
+	return (0);
+}
+
+int
+chap_receive(struct chap *chap, const char *response)
+{
+	void *response_bin;
+	size_t response_bin_len;
+	int error;
+
+	error = chap_hex2bin(response, &response_bin, &response_bin_len);
+	if (error != 0) {
+		log_debugx("got incorrectly encoded CHAP response \"%s\"",
+		    response);
+		return (1);
+	}
+
+	error = chap_receive_bin(chap, response_bin, response_bin_len);
+	free(response_bin);
+
+	return (error);
+}
+
+int
+chap_authenticate(struct chap *chap, const char *secret)
+{
+	char expected_response[MD5_DIGEST_LENGTH];
+
+	chap_compute_md5(chap->chap_id, secret,
+	    chap->chap_challenge, sizeof(chap->chap_challenge),
+	    expected_response, sizeof(expected_response));
+
+	if (memcmp(chap->chap_response,
+	    expected_response, sizeof(expected_response)) != 0) {
+		return (-1);
+	}
+
+	return (0);
+}
+
+void
+chap_delete(struct chap *chap)
+{
+
+	free(chap);
+}
+
+struct rchap *
+rchap_new(const char *secret)
+{
+	struct rchap *rchap;
+
+	rchap = calloc(sizeof(*rchap), 1);
+	if (rchap == NULL)
+		log_err(1, "calloc");
+
+	rchap->rchap_secret = checked_strdup(secret);
+
+	return (rchap);
+}
+
+static void
+rchap_receive_bin(struct rchap *rchap, const unsigned char id,
+    const void *challenge, size_t challenge_len)
+{
+
+	rchap->rchap_id = id;
+	rchap->rchap_challenge = calloc(challenge_len, 1);
+	if (rchap->rchap_challenge == NULL)
+		log_err(1, "calloc");
+	memcpy(rchap->rchap_challenge, challenge, challenge_len);
+	rchap->rchap_challenge_len = challenge_len;
+}
+
+int
+rchap_receive(struct rchap *rchap, const char *id, const char *challenge)
+{
+	unsigned char id_bin;
+	void *challenge_bin;
+	size_t challenge_bin_len;
+
+	int error;
+
+	id_bin = strtoul(id, NULL, 10);
+
+	error = chap_hex2bin(challenge, &challenge_bin, &challenge_bin_len);
+	if (error != 0) {
+		log_debugx("got incorrectly encoded CHAP challenge \"%s\"",
+		    challenge);
+		return (1);
+	}
+
+	rchap_receive_bin(rchap, id_bin, challenge_bin, challenge_bin_len);
+	free(challenge_bin);
+
+	return (0);
+}
+
+static void
+rchap_get_response_bin(struct rchap *rchap,
+    void **responsep, size_t *response_lenp)
+{
+	void *response_bin;
+	size_t response_bin_len = MD5_DIGEST_LENGTH;
+
+	response_bin = calloc(response_bin_len, 1);
+	if (response_bin == NULL)
+		log_err(1, "calloc");
+
+	chap_compute_md5(rchap->rchap_id, rchap->rchap_secret,
+	    rchap->rchap_challenge, rchap->rchap_challenge_len,
+	    response_bin, response_bin_len);
+
+	*responsep = response_bin;
+	*response_lenp = response_bin_len;
+}
+
+char *
+rchap_get_response(struct rchap *rchap)
+{
+	void *response;
+	size_t response_len;
+	char *chap_r;
+
+	rchap_get_response_bin(rchap, &response, &response_len);
+	chap_r = chap_bin2hex(response, response_len);
+	free(response);
+
+	return (chap_r);
+}
+
+void
+rchap_delete(struct rchap *rchap)
+{
+
+	free(rchap->rchap_secret);
+	free(rchap->rchap_challenge);
+	free(rchap);
+}

Modified: head/usr.sbin/ctld/ctld.h
==============================================================================
--- head/usr.sbin/ctld/ctld.h	Wed Oct 22 08:56:57 2014	(r273458)
+++ head/usr.sbin/ctld/ctld.h	Wed Oct 22 08:59:23 2014	(r273459)
@@ -39,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define	DEFAULT_CONFIG_PATH		"/etc/ctl.conf"
 #define	DEFAULT_PIDFILE			"/var/run/ctld.pid"
@@ -207,6 +208,35 @@ struct keys {
 	size_t		keys_data_len;
 };
 
+#define	CHAP_CHALLENGE_LEN	1024
+
+struct chap {
+	unsigned char	chap_id;
+	char		chap_challenge[CHAP_CHALLENGE_LEN];
+	char		chap_response[MD5_DIGEST_LENGTH];
+};
+
+struct rchap {
+	char		*rchap_secret;
+	unsigned char	rchap_id;
+	void		*rchap_challenge;
+	size_t		rchap_challenge_len;
+};
+
+struct chap		*chap_new(void);
+char			*chap_get_id(const struct chap *chap);
+char			*chap_get_challenge(const struct chap *chap);
+int			chap_receive(struct chap *chap, const char *response);
+int			chap_authenticate(struct chap *chap,
+			    const char *secret);
+void			chap_delete(struct chap *chap);
+
+struct rchap		*rchap_new(const char *secret);
+int			rchap_receive(struct rchap *rchap,
+			    const char *id, const char *challenge);
+char			*rchap_get_response(struct rchap *rchap);
+void			rchap_delete(struct rchap *rchap);
+
 struct conf		*conf_new(void);
 struct conf		*conf_new_from_file(const char *path);
 struct conf		*conf_new_from_kernel(void);

Modified: head/usr.sbin/ctld/login.c
==============================================================================
--- head/usr.sbin/ctld/login.c	Wed Oct 22 08:56:57 2014	(r273458)
+++ head/usr.sbin/ctld/login.c	Wed Oct 22 08:59:23 2014	(r273459)
@@ -39,9 +39,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
-#include 
-#include 
 
 #include "ctld.h"
 #include "iscsi_proto.h"
@@ -229,150 +226,6 @@ login_list_prefers(const char *list,
 	return (-1);
 }
 
-static int
-login_hex2int(const char hex)
-{
-	switch (hex) {
-	case '0':
-		return (0x00);
-	case '1':
-		return (0x01);
-	case '2':
-		return (0x02);
-	case '3':
-		return (0x03);
-	case '4':
-		return (0x04);
-	case '5':
-		return (0x05);
-	case '6':
-		return (0x06);
-	case '7':
-		return (0x07);
-	case '8':
-		return (0x08);
-	case '9':
-		return (0x09);
-	case 'a':
-	case 'A':
-		return (0x0a);
-	case 'b':
-	case 'B':
-		return (0x0b);
-	case 'c':
-	case 'C':
-		return (0x0c);
-	case 'd':
-	case 'D':
-		return (0x0d);
-	case 'e':
-	case 'E':
-		return (0x0e);
-	case 'f':
-	case 'F':
-		return (0x0f);
-	default:
-		return (-1);
-	}
-}
-
-/*
- * XXX: Review this _carefully_.
- */
-static int
-login_hex2bin(const char *hex, char **binp, size_t *bin_lenp)
-{
-	int i, hex_len, nibble;
-	bool lo = true; /* As opposed to 'hi'. */
-	char *bin;
-	size_t bin_off, bin_len;
-
-	if (strncasecmp(hex, "0x", strlen("0x")) != 0) {
-		log_warnx("malformed variable, should start with \"0x\"");
-		return (-1);
-	}
-
-	hex += strlen("0x");
-	hex_len = strlen(hex);
-	if (hex_len < 1) {
-		log_warnx("malformed variable; doesn't contain anything "
-		    "but \"0x\"");
-		return (-1);
-	}
-
-	bin_len = hex_len / 2 + hex_len % 2;
-	bin = calloc(bin_len, 1);
-	if (bin == NULL)
-		log_err(1, "calloc");
-
-	bin_off = bin_len - 1;
-	for (i = hex_len - 1; i >= 0; i--) {
-		nibble = login_hex2int(hex[i]);
-		if (nibble < 0) {
-			log_warnx("malformed variable, invalid char \"%c\"",
-			    hex[i]);
-			return (-1);
-		}
-
-		assert(bin_off < bin_len);
-		if (lo) {
-			bin[bin_off] = nibble;
-			lo = false;
-		} else {
-			bin[bin_off] |= nibble << 4;
-			bin_off--;
-			lo = true;
-		}
-	}
-
-	*binp = bin;
-	*bin_lenp = bin_len;
-	return (0);
-}
-
-static char *
-login_bin2hex(const char *bin, size_t bin_len)
-{
-	unsigned char *hex, *tmp, ch;
-	size_t hex_len;
-	size_t i;
-
-	hex_len = bin_len * 2 + 3; /* +2 for "0x", +1 for '\0'. */
-	hex = malloc(hex_len);
-	if (hex == NULL)
-		log_err(1, "malloc");
-
-	tmp = hex;
-	tmp += sprintf(tmp, "0x");
-	for (i = 0; i < bin_len; i++) {
-		ch = bin[i];
-		tmp += sprintf(tmp, "%02x", ch);
-	}
-
-	return (hex);
-}
-
-static void
-login_compute_md5(const char id, const char *secret,
-    const void *challenge, size_t challenge_len, void *response,
-    size_t response_len)
-{
-	MD5_CTX ctx;
-	int rv;
-
-	assert(response_len == MD5_DIGEST_LENGTH);
-
-	MD5_Init(&ctx);
-	MD5_Update(&ctx, &id, sizeof(id));
-	MD5_Update(&ctx, secret, strlen(secret));
-	MD5_Update(&ctx, challenge, challenge_len);
-	rv = MD5_Final(response, &ctx);
-	if (rv != 1)
-		log_errx(1, "MD5_Final");
-}
-
-#define	LOGIN_CHALLENGE_LEN	1024
-
 static struct pdu *
 login_receive_chap_a(struct connection *conn)
 {
@@ -400,21 +253,21 @@ login_receive_chap_a(struct connection *
 }
 
 static void
-login_send_chap_c(struct pdu *request, const unsigned char id,
-    const void *challenge, const size_t challenge_len)
+login_send_chap_c(struct pdu *request, struct chap *chap)
 {
 	struct pdu *response;
 	struct keys *response_keys;
-	char *chap_c, chap_i[4];
+	char *chap_c, *chap_i;
 
-	chap_c = login_bin2hex(challenge, challenge_len);
-	snprintf(chap_i, sizeof(chap_i), "%d", id);
+	chap_c = chap_get_challenge(chap);
+	chap_i = chap_get_id(chap);
 
 	response = login_new_response(request);
 	response_keys = keys_new();
 	keys_add(response_keys, "CHAP_A", "5");
 	keys_add(response_keys, "CHAP_I", chap_i);
 	keys_add(response_keys, "CHAP_C", chap_c);
+	free(chap_i);
 	free(chap_c);
 	keys_save(response_keys, response);
 	pdu_send(response);
@@ -423,15 +276,12 @@ login_send_chap_c(struct pdu *request, c
 }
 
 static struct pdu *
-login_receive_chap_r(struct connection *conn,
-    struct auth_group *ag, const unsigned char id, const void *challenge,
-    const size_t challenge_len, const struct auth **cap)
+login_receive_chap_r(struct connection *conn, struct auth_group *ag,
+    struct chap *chap, const struct auth **authp)
 {
 	struct pdu *request;
 	struct keys *request_keys;
 	const char *chap_n, *chap_r;
-	char *response_bin, expected_response_bin[MD5_DIGEST_LENGTH];
-	size_t response_bin_len;
 	const struct auth *auth;
 	int error;
 
@@ -449,7 +299,7 @@ login_receive_chap_r(struct connection *
 		login_send_error(request, 0x02, 0x07);
 		log_errx(1, "received CHAP Login PDU without CHAP_R");
 	}
-	error = login_hex2bin(chap_r, &response_bin, &response_bin_len);
+	error = chap_receive(chap, chap_r);
 	if (error != 0) {
 		login_send_error(request, 0x02, 0x07);
 		log_errx(1, "received CHAP Login PDU with malformed CHAP_R");
@@ -469,21 +319,17 @@ login_receive_chap_r(struct connection *
 
 	assert(auth->a_secret != NULL);
 	assert(strlen(auth->a_secret) > 0);
-	login_compute_md5(id, auth->a_secret, challenge,
-	    challenge_len, expected_response_bin,
-	    sizeof(expected_response_bin));
 
-	if (memcmp(response_bin, expected_response_bin,
-	    sizeof(expected_response_bin)) != 0) {
+	error = chap_authenticate(chap, auth->a_secret);
+	if (error != 0) {
 		login_send_error(request, 0x02, 0x01);
 		log_errx(1, "CHAP authentication failed for user \"%s\"",
 		    auth->a_user);
 	}
 
 	keys_delete(request_keys);
-	free(response_bin);
 
-	*cap = auth;
+	*authp = auth;
 	return (request);
 }
 
@@ -494,10 +340,9 @@ login_send_chap_success(struct pdu *requ
 	struct pdu *response;
 	struct keys *request_keys, *response_keys;
 	struct iscsi_bhs_login_response *bhslr2;
+	struct rchap *rchap;
 	const char *chap_i, *chap_c;
-	char *chap_r, *challenge, response_bin[MD5_DIGEST_LENGTH];
-	size_t challenge_len;
-	unsigned char id;
+	char *chap_r;
 	int error;
 
 	response = login_new_response(request);
@@ -530,21 +375,18 @@ login_send_chap_success(struct pdu *requ
 			    "is not set", auth->a_user);
 		}
 
-		id = strtoul(chap_i, NULL, 10);
-		error = login_hex2bin(chap_c, &challenge, &challenge_len);
+		log_debugx("performing mutual authentication as user \"%s\"",
+		    auth->a_mutual_user);
+
+		rchap = rchap_new(auth->a_mutual_secret);
+		error = rchap_receive(rchap, chap_i, chap_c);
 		if (error != 0) {
 			login_send_error(request, 0x02, 0x07);
 			log_errx(1, "received CHAP Login PDU with malformed "
-			    "CHAP_C");
+			    "CHAP_I or CHAP_C");
 		}
-
-		log_debugx("performing mutual authentication as user \"%s\"",
-		    auth->a_mutual_user);
-		login_compute_md5(id, auth->a_mutual_secret, challenge,
-		    challenge_len, response_bin, sizeof(response_bin));
-
-		chap_r = login_bin2hex(response_bin,
-		    sizeof(response_bin));
+		chap_r = rchap_get_response(rchap);
+		rchap_delete(rchap);
 		response_keys = keys_new();
 		keys_add(response_keys, "CHAP_N", auth->a_mutual_user);
 		keys_add(response_keys, "CHAP_R", chap_r);
@@ -564,10 +406,8 @@ static void
 login_chap(struct connection *conn, struct auth_group *ag)
 {
 	const struct auth *auth;
+	struct chap *chap;
 	struct pdu *request;
-	char challenge_bin[LOGIN_CHALLENGE_LEN];
-	unsigned char id;
-	int rv;
 
 	/*
 	 * Receive CHAP_A PDU.
@@ -578,34 +418,21 @@ login_chap(struct connection *conn, stru
 	/*
 	 * Generate the challenge.
 	 */
-	rv = RAND_bytes(challenge_bin, sizeof(challenge_bin));
-	if (rv != 1) {
-		login_send_error(request, 0x03, 0x02);
-		log_errx(1, "RAND_bytes failed: %s",
-		    ERR_error_string(ERR_get_error(), NULL));
-	}
-	rv = RAND_bytes(&id, sizeof(id));
-	if (rv != 1) {
-		login_send_error(request, 0x03, 0x02);
-		log_errx(1, "RAND_bytes failed: %s",
-		    ERR_error_string(ERR_get_error(), NULL));
-	}
+	chap = chap_new();
 
 	/*
 	 * Send the challenge.
 	 */
 	log_debugx("sending CHAP_C, binary challenge size is %zd bytes",
-	    sizeof(challenge_bin));
-	login_send_chap_c(request, id, challenge_bin,
-	    sizeof(challenge_bin));
+	    sizeof(chap->chap_challenge));
+	login_send_chap_c(request, chap);
 	pdu_delete(request);
 
 	/*
 	 * Receive CHAP_N/CHAP_R PDU and authenticate.
 	 */
 	log_debugx("waiting for CHAP_N/CHAP_R");
-	request = login_receive_chap_r(conn, ag, id, challenge_bin,
-	    sizeof(challenge_bin), &auth);
+	request = login_receive_chap_r(conn, ag, chap, &auth);
 
 	/*
 	 * Yay, authentication succeeded!
@@ -614,6 +441,7 @@ login_chap(struct connection *conn, stru
 	    "transitioning to Negotiation Phase", auth->a_user);
 	login_send_chap_success(request, auth);
 	pdu_delete(request);
+	chap_delete(chap);
 }
 
 static void

Modified: head/usr.sbin/iscsid/Makefile
==============================================================================
--- head/usr.sbin/iscsid/Makefile	Wed Oct 22 08:56:57 2014	(r273458)
+++ head/usr.sbin/iscsid/Makefile	Wed Oct 22 08:59:23 2014	(r273459)
@@ -1,7 +1,7 @@
 # $FreeBSD$
 
 PROG=		iscsid
-SRCS=		discovery.c iscsid.c keys.c log.c login.c pdu.c
+SRCS=		chap.c discovery.c iscsid.c keys.c log.c login.c pdu.c
 CFLAGS+=	-I${.CURDIR}
 CFLAGS+=	-I${.CURDIR}/../../sys/cam
 CFLAGS+=	-I${.CURDIR}/../../sys/dev/iscsi

Added: head/usr.sbin/iscsid/chap.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.sbin/iscsid/chap.c	Wed Oct 22 08:59:23 2014	(r273459)
@@ -0,0 +1,386 @@
+/*-
+ * Copyright (c) 2014 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Edward Tomasz Napierala under sponsorship
+ * from the FreeBSD Foundation.
+ *
+ * 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.
+ *
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "iscsid.h"
+
+static void
+chap_compute_md5(const char id, const char *secret,
+    const void *challenge, size_t challenge_len, void *response,
+    size_t response_len)
+{
+	MD5_CTX ctx;
+	int rv;
+
+	assert(response_len == MD5_DIGEST_LENGTH);
+
+	MD5_Init(&ctx);
+	MD5_Update(&ctx, &id, sizeof(id));
+	MD5_Update(&ctx, secret, strlen(secret));
+	MD5_Update(&ctx, challenge, challenge_len);
+	rv = MD5_Final(response, &ctx);
+	if (rv != 1)
+		log_errx(1, "MD5_Final");
+}
+
+static int
+chap_hex2int(const char hex)
+{
+	switch (hex) {
+	case '0':
+		return (0x00);
+	case '1':
+		return (0x01);
+	case '2':
+		return (0x02);
+	case '3':
+		return (0x03);
+	case '4':
+		return (0x04);
+	case '5':
+		return (0x05);
+	case '6':
+		return (0x06);
+	case '7':
+		return (0x07);
+	case '8':
+		return (0x08);
+	case '9':
+		return (0x09);
+	case 'a':
+	case 'A':
+		return (0x0a);
+	case 'b':
+	case 'B':
+		return (0x0b);
+	case 'c':
+	case 'C':
+		return (0x0c);
+	case 'd':
+	case 'D':
+		return (0x0d);
+	case 'e':
+	case 'E':
+		return (0x0e);
+	case 'f':
+	case 'F':
+		return (0x0f);
+	default:
+		return (-1);
+	}
+}
+
+/*
+ * XXX: Review this _carefully_.
+ */
+static int
+chap_hex2bin(const char *hex, void **binp, size_t *bin_lenp)
+{
+	int i, hex_len, nibble;
+	bool lo = true; /* As opposed to 'hi'. */
+	char *bin;
+	size_t bin_off, bin_len;
+
+	if (strncasecmp(hex, "0x", strlen("0x")) != 0) {
+		log_warnx("malformed variable, should start with \"0x\"");
+		return (-1);
+	}
+
+	hex += strlen("0x");
+	hex_len = strlen(hex);
+	if (hex_len < 1) {
+		log_warnx("malformed variable; doesn't contain anything "
+		    "but \"0x\"");
+		return (-1);
+	}
+
+	bin_len = hex_len / 2 + hex_len % 2;
+	bin = calloc(bin_len, 1);
+	if (bin == NULL)
+		log_err(1, "calloc");
+
+	bin_off = bin_len - 1;
+	for (i = hex_len - 1; i >= 0; i--) {
+		nibble = chap_hex2int(hex[i]);
+		if (nibble < 0) {
+			log_warnx("malformed variable, invalid char \"%c\"",
+			    hex[i]);
+			free(bin);
+			return (-1);
+		}
+
+		assert(bin_off < bin_len);
+		if (lo) {
+			bin[bin_off] = nibble;
+			lo = false;
+		} else {
+			bin[bin_off] |= nibble << 4;
+			bin_off--;
+			lo = true;
+		}
+	}
+
+	*binp = bin;
+	*bin_lenp = bin_len;
+	return (0);
+}
+
+static char *
+chap_bin2hex(const char *bin, size_t bin_len)
+{
+	unsigned char *hex, *tmp, ch;
+	size_t hex_len;
+	size_t i;
+
+	hex_len = bin_len * 2 + 3; /* +2 for "0x", +1 for '\0'. */
+	hex = malloc(hex_len);
+	if (hex == NULL)
+		log_err(1, "malloc");
+
+	tmp = hex;
+	tmp += sprintf(tmp, "0x");
+	for (i = 0; i < bin_len; i++) {
+		ch = bin[i];
+		tmp += sprintf(tmp, "%02x", ch);
+	}
+
+	return (hex);
+}
+
+struct chap *
+chap_new(void)
+{
+	struct chap *chap;
+	int rv;
+
+	chap = calloc(sizeof(*chap), 1);
+	if (chap == NULL)
+		log_err(1, "calloc");
+
+	/*
+	 * Generate the challenge.

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 09:04:56 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id D696A8C9;
 Wed, 22 Oct 2014 09:04:56 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id C2BF8EA2;
 Wed, 22 Oct 2014 09:04:56 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M94uHl034078;
 Wed, 22 Oct 2014 09:04:56 GMT (envelope-from kib@FreeBSD.org)
Received: (from kib@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M94uUH034077;
 Wed, 22 Oct 2014 09:04:56 GMT (envelope-from kib@FreeBSD.org)
Message-Id: <201410220904.s9M94uUH034077@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org
 using -f
From: Konstantin Belousov 
Date: Wed, 22 Oct 2014 09:04:56 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject: svn commit: r273460 - stable/10/sys/kern
X-SVN-Group: stable-10
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 09:04:57 -0000

Author: kib
Date: Wed Oct 22 09:04:56 2014
New Revision: 273460
URL: https://svnweb.freebsd.org/changeset/base/273460

Log:
  MFC r273129:
  Implement FIODTYPE for master ptys.

Modified:
  stable/10/sys/kern/tty_pts.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/tty_pts.c
==============================================================================
--- stable/10/sys/kern/tty_pts.c	Wed Oct 22 08:59:23 2014	(r273459)
+++ stable/10/sys/kern/tty_pts.c	Wed Oct 22 09:04:56 2014	(r273460)
@@ -269,6 +269,9 @@ ptsdev_ioctl(struct file *fp, u_long cmd
 	int error = 0, sig;
 
 	switch (cmd) {
+	case FIODTYPE:
+		*(int *)data = D_TTY;
+		return (0);
 	case FIONBIO:
 		/* This device supports non-blocking operation. */
 		return (0);

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 09:06:37 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 042BDA12;
 Wed, 22 Oct 2014 09:06:37 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id E490EEB8;
 Wed, 22 Oct 2014 09:06:36 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M96af3034388;
 Wed, 22 Oct 2014 09:06:36 GMT (envelope-from kib@FreeBSD.org)
Received: (from kib@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M96aS7034387;
 Wed, 22 Oct 2014 09:06:36 GMT (envelope-from kib@FreeBSD.org)
Message-Id: <201410220906.s9M96aS7034387@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org
 using -f
From: Konstantin Belousov 
Date: Wed, 22 Oct 2014 09:06:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject: svn commit: r273461 - stable/10/sys/fs/deadfs
X-SVN-Group: stable-10
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 09:06:37 -0000

Author: kib
Date: Wed Oct 22 09:06:36 2014
New Revision: 273461
URL: https://svnweb.freebsd.org/changeset/base/273461

Log:
  MFC r273130:
  Change the deadfs poll VOP to return POLLIN|POLLRDNORM if the caller
  is interested in i/o state.  Return POLLNVAL for invalid bits, similar
  to poll_no_poll().

Modified:
  stable/10/sys/fs/deadfs/dead_vnops.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/deadfs/dead_vnops.c
==============================================================================
--- stable/10/sys/fs/deadfs/dead_vnops.c	Wed Oct 22 09:04:56 2014	(r273460)
+++ stable/10/sys/fs/deadfs/dead_vnops.c	Wed Oct 22 09:06:36 2014	(r273461)
@@ -163,16 +163,19 @@ dead_write(ap)
 	return (EIO);
 }
 
-/*
- * Trivial poll routine that always returns POLLHUP.
- * This is necessary so that a process which is polling a file
- * gets notified when that file is revoke()d.
- */
 static int
 dead_poll(ap)
 	struct vop_poll_args *ap;
 {
-	return (POLLHUP);
+
+	if (ap->a_events & ~POLLSTANDARD)
+		return (POLLNVAL);
+
+	/*
+	 * Let the user find out that the descriptor is gone.
+	 */
+	return (POLLHUP | ((POLLIN | POLLRDNORM) & ap->a_events));
+
 }
 
 static int

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 09:09:43 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 392D6BA2;
 Wed, 22 Oct 2014 09:09:43 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 24DB4EEB;
 Wed, 22 Oct 2014 09:09:43 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M99hl6034925;
 Wed, 22 Oct 2014 09:09:43 GMT (envelope-from kib@FreeBSD.org)
Received: (from kib@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M99g7f034920;
 Wed, 22 Oct 2014 09:09:42 GMT (envelope-from kib@FreeBSD.org)
Message-Id: <201410220909.s9M99g7f034920@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org
 using -f
From: Konstantin Belousov 
Date: Wed, 22 Oct 2014 09:09:42 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject: svn commit: r273462 - in stable/10/sys: fs/deadfs fs/devfs sys
X-SVN-Group: stable-10
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 09:09:43 -0000

Author: kib
Date: Wed Oct 22 09:09:41 2014
New Revision: 273462
URL: https://svnweb.freebsd.org/changeset/base/273462

Log:
  MFC r273131:
  When vnode bypass cannot be performed on the cdev file descriptor for
  read/write/poll/ioctl, call standard vnode filedescriptor fop.

Modified:
  stable/10/sys/fs/deadfs/dead_vnops.c
  stable/10/sys/fs/devfs/devfs_vnops.c
  stable/10/sys/sys/vnode.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/deadfs/dead_vnops.c
==============================================================================
--- stable/10/sys/fs/deadfs/dead_vnops.c	Wed Oct 22 09:06:36 2014	(r273461)
+++ stable/10/sys/fs/deadfs/dead_vnops.c	Wed Oct 22 09:09:41 2014	(r273462)
@@ -43,9 +43,6 @@
  */
 static vop_lookup_t	dead_lookup;
 static vop_open_t	dead_open;
-static vop_poll_t	dead_poll;
-static vop_read_t	dead_read;
-static vop_write_t	dead_write;
 static vop_getwritemount_t dead_getwritemount;
 static vop_rename_t	dead_rename;
 
@@ -130,7 +127,7 @@ dead_open(ap)
  * Vnode op for read
  */
 /* ARGSUSED */
-static int
+int
 dead_read(ap)
 	struct vop_read_args /* {
 		struct vnode *a_vp;
@@ -151,7 +148,7 @@ dead_read(ap)
  * Vnode op for write
  */
 /* ARGSUSED */
-static int
+int
 dead_write(ap)
 	struct vop_write_args /* {
 		struct vnode *a_vp;
@@ -163,7 +160,7 @@ dead_write(ap)
 	return (EIO);
 }
 
-static int
+int
 dead_poll(ap)
 	struct vop_poll_args *ap;
 {

Modified: stable/10/sys/fs/devfs/devfs_vnops.c
==============================================================================
--- stable/10/sys/fs/devfs/devfs_vnops.c	Wed Oct 22 09:06:36 2014	(r273461)
+++ stable/10/sys/fs/devfs/devfs_vnops.c	Wed Oct 22 09:09:41 2014	(r273462)
@@ -734,8 +734,10 @@ devfs_ioctl_f(struct file *fp, u_long co
 
 	fpop = td->td_fpop;
 	error = devfs_fp_check(fp, &dev, &dsw, &ref);
-	if (error)
+	if (error != 0) {
+		error = vnops.fo_ioctl(fp, com, data, cred, td);
 		return (error);
+	}
 
 	if (com == FIODTYPE) {
 		*(int *)data = dsw->d_flags & D_TYPEMASK;
@@ -1149,8 +1151,10 @@ devfs_poll_f(struct file *fp, int events
 
 	fpop = td->td_fpop;
 	error = devfs_fp_check(fp, &dev, &dsw, &ref);
-	if (error)
-		return (poll_no_poll(events));
+	if (error != 0) {
+		error = vnops.fo_poll(fp, events, cred, td);
+		return (error);
+	}
 	error = dsw->d_poll(dev, events, td);
 	td->td_fpop = fpop;
 	dev_relthread(dev, ref);
@@ -1182,8 +1186,10 @@ devfs_read_f(struct file *fp, struct uio
 		return (EINVAL);
 	fpop = td->td_fpop;
 	error = devfs_fp_check(fp, &dev, &dsw, &ref);
-	if (error)
+	if (error != 0) {
+		error = vnops.fo_read(fp, uio, cred, flags, td);
 		return (error);
+	}
 	resid = uio->uio_resid;
 	ioflag = fp->f_flag & (O_NONBLOCK | O_DIRECT);
 	if (ioflag & O_DIRECT)
@@ -1657,8 +1663,10 @@ devfs_write_f(struct file *fp, struct ui
 		return (EINVAL);
 	fpop = td->td_fpop;
 	error = devfs_fp_check(fp, &dev, &dsw, &ref);
-	if (error)
+	if (error != 0) {
+		error = vnops.fo_write(fp, uio, cred, flags, td);
 		return (error);
+	}
 	KASSERT(uio->uio_td == td, ("uio_td %p is not td %p", uio->uio_td, td));
 	ioflag = fp->f_flag & (O_NONBLOCK | O_DIRECT | O_FSYNC);
 	if (ioflag & O_DIRECT)
@@ -1740,8 +1748,9 @@ static struct vop_vector devfs_specops =
 	.vop_mknod =		VOP_PANIC,
 	.vop_open =		devfs_open,
 	.vop_pathconf =		devfs_pathconf,
+	.vop_poll =		dead_poll,
 	.vop_print =		devfs_print,
-	.vop_read =		VOP_PANIC,
+	.vop_read =		dead_read,
 	.vop_readdir =		VOP_PANIC,
 	.vop_readlink =		VOP_PANIC,
 	.vop_reallocblks =	VOP_PANIC,
@@ -1757,7 +1766,7 @@ static struct vop_vector devfs_specops =
 	.vop_strategy =		VOP_PANIC,
 	.vop_symlink =		VOP_PANIC,
 	.vop_vptocnp =		devfs_vptocnp,
-	.vop_write =		VOP_PANIC,
+	.vop_write =		dead_write,
 };
 
 /*

Modified: stable/10/sys/sys/vnode.h
==============================================================================
--- stable/10/sys/sys/vnode.h	Wed Oct 22 09:06:36 2014	(r273461)
+++ stable/10/sys/sys/vnode.h	Wed Oct 22 09:09:41 2014	(r273462)
@@ -756,6 +756,9 @@ int	vop_enoent(struct vop_generic_args *
 int	vop_enotty(struct vop_generic_args *ap);
 int	vop_null(struct vop_generic_args *ap);
 int	vop_panic(struct vop_generic_args *ap);
+int	dead_poll(struct vop_poll_args *ap);
+int	dead_read(struct vop_read_args *ap);
+int	dead_write(struct vop_write_args *ap);
 
 /* These are called from within the actual VOPS. */
 void	vop_create_post(void *a, int rc);

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 09:12:21 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 79812D25;
 Wed, 22 Oct 2014 09:12:21 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 4C154FA4;
 Wed, 22 Oct 2014 09:12:21 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M9CLKr038764;
 Wed, 22 Oct 2014 09:12:21 GMT (envelope-from kib@FreeBSD.org)
Received: (from kib@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M9CL9R038763;
 Wed, 22 Oct 2014 09:12:21 GMT (envelope-from kib@FreeBSD.org)
Message-Id: <201410220912.s9M9CL9R038763@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org
 using -f
From: Konstantin Belousov 
Date: Wed, 22 Oct 2014 09:12:21 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject: svn commit: r273463 - stable/10/sys/fs/deadfs
X-SVN-Group: stable-10
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 09:12:21 -0000

Author: kib
Date: Wed Oct 22 09:12:20 2014
New Revision: 273463
URL: https://svnweb.freebsd.org/changeset/base/273463

Log:
  MFC r273132:
  Style changes for deadfs.

Modified:
  stable/10/sys/fs/deadfs/dead_vnops.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/deadfs/dead_vnops.c
==============================================================================
--- stable/10/sys/fs/deadfs/dead_vnops.c	Wed Oct 22 09:09:41 2014	(r273462)
+++ stable/10/sys/fs/deadfs/dead_vnops.c	Wed Oct 22 09:12:20 2014	(r273463)
@@ -77,14 +77,10 @@ struct vop_vector dead_vnodeops = {
 	.vop_write =		dead_write,
 };
 
-/* ARGSUSED */
 static int
-dead_getwritemount(ap)
-	struct vop_getwritemount_args /* {
-		struct vnode *a_vp;
-		struct mount **a_mpp;
-	} */ *ap;
+dead_getwritemount(struct vop_getwritemount_args *ap)
 {
+
 	*(ap->a_mpp) = NULL;
 	return (0);
 }
@@ -92,14 +88,8 @@ dead_getwritemount(ap)
 /*
  * Trivial lookup routine that always fails.
  */
-/* ARGSUSED */
 static int
-dead_lookup(ap)
-	struct vop_lookup_args /* {
-		struct vnode * a_dvp;
-		struct vnode ** a_vpp;
-		struct componentname * a_cnp;
-	} */ *ap;
+dead_lookup(struct vop_lookup_args *ap)
 {
 
 	*ap->a_vpp = NULL;
@@ -109,33 +99,17 @@ dead_lookup(ap)
 /*
  * Open always fails as if device did not exist.
  */
-/* ARGSUSED */
 static int
-dead_open(ap)
-	struct vop_open_args /* {
-		struct vnode *a_vp;
-		int  a_mode;
-		struct ucred *a_cred;
-		struct proc *a_p;
-	} */ *ap;
+dead_open(struct vop_open_args *ap)
 {
 
 	return (ENXIO);
 }
 
-/*
- * Vnode op for read
- */
-/* ARGSUSED */
 int
-dead_read(ap)
-	struct vop_read_args /* {
-		struct vnode *a_vp;
-		struct uio *a_uio;
-		int  a_ioflag;
-		struct ucred *a_cred;
-	} */ *ap;
+dead_read(struct vop_read_args *ap)
 {
+
 	/*
 	 * Return EOF for tty devices, EIO for others
 	 */
@@ -144,25 +118,15 @@ dead_read(ap)
 	return (0);
 }
 
-/*
- * Vnode op for write
- */
-/* ARGSUSED */
 int
-dead_write(ap)
-	struct vop_write_args /* {
-		struct vnode *a_vp;
-		struct uio *a_uio;
-		int  a_ioflag;
-		struct ucred *a_cred;
-	} */ *ap;
+dead_write(struct vop_write_args *ap)
 {
+
 	return (EIO);
 }
 
 int
-dead_poll(ap)
-	struct vop_poll_args *ap;
+dead_poll(struct vop_poll_args *ap)
 {
 
 	if (ap->a_events & ~POLLSTANDARD)
@@ -176,15 +140,7 @@ dead_poll(ap)
 }
 
 static int
-dead_rename(ap)
-	struct vop_rename_args  /* {
-		struct vnode *a_fdvp;
-		struct vnode *a_fvp;
-		struct componentname *a_fcnp;
-		struct vnode *a_tdvp;
-		struct vnode *a_tvp;
-		struct componentname *a_tcnp;
-	} */ *ap;
+dead_rename(struct vop_rename_args *ap)
 {
 
 	vop_rename_fail(ap);

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 09:17:20 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id AC1D1EDE;
 Wed, 22 Oct 2014 09:17:20 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 969FEFEC;
 Wed, 22 Oct 2014 09:17:20 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M9HKES039433;
 Wed, 22 Oct 2014 09:17:20 GMT (envelope-from trasz@FreeBSD.org)
Received: (from trasz@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M9HHUo039414;
 Wed, 22 Oct 2014 09:17:17 GMT (envelope-from trasz@FreeBSD.org)
Message-Id: <201410220917.s9M9HHUo039414@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: trasz set sender to
 trasz@FreeBSD.org using -f
From: Edward Tomasz Napierala 
Date: Wed, 22 Oct 2014 09:17:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273464 - in head: usr.bin/iscsictl usr.sbin/ctladm
 usr.sbin/ctld usr.sbin/iscsid
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 09:17:20 -0000

Author: trasz
Date: Wed Oct 22 09:17:17 2014
New Revision: 273464
URL: https://svnweb.freebsd.org/changeset/base/273464

Log:
  Whitespace fixes.
  
  MFC after:	1 month
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/usr.bin/iscsictl/Makefile
  head/usr.bin/iscsictl/iscsictl.c
  head/usr.sbin/ctladm/Makefile
  head/usr.sbin/ctladm/ctladm.c
  head/usr.sbin/ctld/ctld.c
  head/usr.sbin/ctld/kernel.c
  head/usr.sbin/ctld/keys.c
  head/usr.sbin/ctld/login.c
  head/usr.sbin/ctld/parse.y
  head/usr.sbin/iscsid/keys.c
  head/usr.sbin/iscsid/login.c

Modified: head/usr.bin/iscsictl/Makefile
==============================================================================
--- head/usr.bin/iscsictl/Makefile	Wed Oct 22 09:12:20 2014	(r273463)
+++ head/usr.bin/iscsictl/Makefile	Wed Oct 22 09:17:17 2014	(r273464)
@@ -6,7 +6,7 @@ CFLAGS+=	-I${.CURDIR}
 CFLAGS+=	-I${.CURDIR}/../../sys/dev/iscsi
 MAN=		iscsictl.8
 
-DPADD=		${LIBCAM} ${LIBUTIL} 
+DPADD=		${LIBCAM} ${LIBUTIL}
 LDADD=		-lcam -lutil
 
 YFLAGS+=	-v

Modified: head/usr.bin/iscsictl/iscsictl.c
==============================================================================
--- head/usr.bin/iscsictl/iscsictl.c	Wed Oct 22 09:12:20 2014	(r273463)
+++ head/usr.bin/iscsictl/iscsictl.c	Wed Oct 22 09:17:17 2014	(r273464)
@@ -172,7 +172,7 @@ valid_iscsi_name(const char *name)
 		for (i = strlen("iqn."); name[i] != '\0'; i++) {
 			/*
 			 * XXX: We should verify UTF-8 normalisation, as defined
-			 * 	by 3.2.6.2: iSCSI Name Encoding.
+			 *      by 3.2.6.2: iSCSI Name Encoding.
 			 */
 			if (isalnum(name[i]))
 				continue;

Modified: head/usr.sbin/ctladm/Makefile
==============================================================================
--- head/usr.sbin/ctladm/Makefile	Wed Oct 22 09:12:20 2014	(r273463)
+++ head/usr.sbin/ctladm/Makefile	Wed Oct 22 09:17:17 2014	(r273464)
@@ -2,12 +2,12 @@
 
 PROG=		ctladm
 SRCS=		ctladm.c util.c ctl_util.c ctl_scsi_all.c
-.PATH:		${.CURDIR}/../../sys/cam/ctl 
+.PATH:		${.CURDIR}/../../sys/cam/ctl
 SDIR=		${.CURDIR}/../../sys
 CFLAGS+=	-I${SDIR}
 # This is necessary because of these warnings:
 # warning: cast increases required alignment of target type
-# The solution is to either upgrade the compiler (preferred), or do void 
+# The solution is to either upgrade the compiler (preferred), or do void
 # pointer gymnastics to get around the warning.  For now, disable the
 # warning instead of doing the void pointer workaround.
 .if ${MACHINE_CPUARCH} == "arm"

Modified: head/usr.sbin/ctladm/ctladm.c
==============================================================================
--- head/usr.sbin/ctladm/ctladm.c	Wed Oct 22 09:12:20 2014	(r273463)
+++ head/usr.sbin/ctladm/ctladm.c	Wed Oct 22 09:17:17 2014	(r273464)
@@ -148,7 +148,7 @@ typedef enum {
 	CTLADM_ARG_ONOFFLINE	= 0x0080000,
 	CTLADM_ARG_ONESHOT	= 0x0100000,
 	CTLADM_ARG_TIMEOUT	= 0x0200000,
-	CTLADM_ARG_INITIATOR 	= 0x0400000,
+	CTLADM_ARG_INITIATOR	= 0x0400000,
 	CTLADM_ARG_NOCOPY	= 0x0800000,
 	CTLADM_ARG_NEED_TL	= 0x1000000
 } ctladm_cmdargs;
@@ -237,7 +237,7 @@ static int cctl_sync_cache(int fd, int t
 			   int argc, char **argv, char *combinedopt);
 static int cctl_start_stop(int fd, int target, int lun, int iid, int retries,
 			   int start, int argc, char **argv, char *combinedopt);
-static int cctl_mode_sense(int fd, int target, int lun, int iid, int retries, 
+static int cctl_mode_sense(int fd, int target, int lun, int iid, int retries,
 			   int argc, char **argv, char *combinedopt);
 static int cctl_read_capacity(int fd, int target, int lun, int iid,
 			      int retries, int argc, char **argv,
@@ -258,7 +258,7 @@ static int cctl_req_sense(int fd, int ta
 static int cctl_persistent_reserve_in(int fd, int target, int lun,
 				      int initiator, int argc, char **argv,
 				      char *combinedopt, int retry_count);
-static int cctl_persistent_reserve_out(int fd, int target, int lun, 
+static int cctl_persistent_reserve_out(int fd, int target, int lun,
 				       int initiator, int argc, char **argv,
 				       char *combinedopt, int retry_count);
 static int cctl_create_lun(int fd, int argc, char **argv, char *combinedopt);
@@ -394,7 +394,7 @@ retry:
 		cmd_latency = ts.tv_sec * 1000;
 		if (ts.tv_nsec > 0)
 			cmd_latency += ts.tv_nsec / 1000000;
-		
+
 		fprintf(stdout, "LUN %jd tag 0x%04x%s%s%s%s%s: %s. CDB: %s "
 			"(%0.0Lf ms)\n",
 			(intmax_t)entry->lun_num, entry->tag_num,
@@ -622,7 +622,7 @@ cctl_port(int fd, int argc, char **argv,
 		case 'o':
 			if (port_mode != CCTL_PORT_MODE_NONE)
 				goto bailout_badarg;
-			
+
 			if (strcasecmp(optarg, "on") == 0)
 				port_mode = CCTL_PORT_MODE_ON;
 			else if (strcasecmp(optarg, "off") == 0)
@@ -1041,7 +1041,7 @@ static struct ctladm_opts cctl_err_patte
 };
 
 static int
-cctl_error_inject(int fd, uint32_t target, uint32_t lun, int argc, char **argv, 
+cctl_error_inject(int fd, uint32_t target, uint32_t lun, int argc, char **argv,
 		  char *combinedopt)
 {
 	int retval = 0;
@@ -1206,12 +1206,12 @@ cctl_error_inject(int fd, uint32_t targe
         if (fd_sense == 1) {
 		ssize_t amt_read;
 		int amt_to_read = sense_len;
- 		u_int8_t *buf_ptr = (uint8_t *)&err_desc.custom_sense;
+		u_int8_t *buf_ptr = (uint8_t *)&err_desc.custom_sense;
 
 		for (amt_read = 0; amt_to_read > 0;
 		     amt_read = read(STDIN_FILENO, buf_ptr, amt_to_read)) {
 			if (amt_read == -1) {
-         			warn("error reading sense data from stdin");
+				warn("error reading sense data from stdin");
 				retval = 1;
 				goto bailout;
 			}
@@ -1617,7 +1617,7 @@ cctl_startup_shutdown(int fd, int target
 			}
 
 			if (ooa_info.status != CTL_OOA_SUCCESS) {
-				printf("%s CTL_CHECK_OOA returned status %d\n", 
+				printf("%s CTL_CHECK_OOA returned status %d\n",
 				       scsi_path, ooa_info.status);
 				continue;
 			}
@@ -1629,7 +1629,7 @@ cctl_startup_shutdown(int fd, int target
 				continue;
 			}
 		}
-		
+
 		ctl_scsi_start_stop(/*io*/ io,
 				    /*start*/(command == CTLADM_CMD_STARTUP) ?
 					      1 : 0,
@@ -1682,7 +1682,7 @@ cctl_sync_cache(int fd, int target, int 
 	int retval;
 	uint64_t our_lba = 0;
 	uint32_t our_block_count = 0;
-	int reladr = 0, immed = 0; 
+	int reladr = 0, immed = 0;
 	int c;
 
 	id.id = iid;
@@ -1830,7 +1830,7 @@ bailout:
 }
 
 static int
-cctl_mode_sense(int fd, int target, int lun, int iid, int retries, 
+cctl_mode_sense(int fd, int target, int lun, int iid, int retries,
 		int argc, char **argv, char *combinedopt)
 {
 	union ctl_io *io;
@@ -2048,8 +2048,8 @@ bailout:
 }
 
 static int
-cctl_read_capacity(int fd, int target, int lun, int iid, int retries, 
-           	   int argc, char **argv, char *combinedopt)
+cctl_read_capacity(int fd, int target, int lun, int iid, int retries,
+		   int argc, char **argv, char *combinedopt)
 {
 	union ctl_io *io;
 	struct ctl_id id;
@@ -2518,7 +2518,7 @@ cctl_tur(int fd, int target, int lun, in
 }
 
 static int
-cctl_get_inquiry(int fd, int target, int lun, int iid, int retries, 
+cctl_get_inquiry(int fd, int target, int lun, int iid, int retries,
 		 char *path_str, int path_len,
 		 struct scsi_inquiry_data *inq_data)
 {
@@ -2669,7 +2669,7 @@ cctl_report_target_port_group(int fd, in
 	dataptr = (uint8_t *)malloc(datalen);
 	if (dataptr == NULL) {
 		warn("%s: can't allocate %d bytes", __func__, datalen);
-	    	retval = 1;
+		retval = 1;
 		goto bailout;
 	}
 
@@ -2737,7 +2737,7 @@ cctl_inquiry_vpd_devid(int fd, int targe
 	dataptr = (uint8_t *)malloc(datalen);
 	if (dataptr == NULL) {
 		warn("%s: can't allocate %d bytes", __func__, datalen);
-	    	retval = 1;
+		retval = 1;
 		goto bailout;
 	}
 
@@ -2784,7 +2784,7 @@ bailout:
 }
 
 static int
-cctl_persistent_reserve_in(int fd, int target, int lun, int initiator, 
+cctl_persistent_reserve_in(int fd, int target, int lun, int initiator,
                            int argc, char **argv, char *combinedopt,
 			   int retry_count)
 {
@@ -2827,7 +2827,7 @@ cctl_persistent_reserve_in(int fd, int t
 	dataptr = (uint8_t *)malloc(datalen);
 	if (dataptr == NULL) {
 		warn("%s: can't allocate %d bytes", __func__, datalen);
-	    	retval = 1;
+		retval = 1;
 		goto bailout;
 	}
 
@@ -2890,8 +2890,8 @@ bailout:
 }
 
 static int
-cctl_persistent_reserve_out(int fd, int target, int lun, int initiator, 
-			    int argc, char **argv, char *combinedopt, 
+cctl_persistent_reserve_out(int fd, int target, int lun, int initiator,
+			    int argc, char **argv, char *combinedopt,
 			    int retry_count)
 {
 	union ctl_io *io;
@@ -3835,7 +3835,7 @@ struct cctl_lun_nv {
 };
 
 /*
- * Backend LUN information.  
+ * Backend LUN information.
  */
 struct cctl_lun {
 	uint64_t lun_id;
@@ -3951,7 +3951,7 @@ cctl_end_element(void *user_data, const 
 	} else if (strcmp(name, "lun") == 0) {
 		devlist->cur_lun = NULL;
 	} else if (strcmp(name, "ctllunlist") == 0) {
-		
+		/* Nothing. */
 	} else {
 		struct cctl_lun_nv *nv;
 
@@ -4216,7 +4216,7 @@ cctl_end_pelement(void *user_data, const
 	} else if (strcmp(name, "targ_port") == 0) {
 		portlist->cur_port = NULL;
 	} else if (strcmp(name, "ctlportlist") == 0) {
-		
+		/* Nothing. */
 	} else {
 		struct cctl_lun_nv *nv;
 
@@ -4575,7 +4575,7 @@ main(int argc, char **argv)
 	}
 
 	if (cmdargs & CTLADM_ARG_NEED_TL) {
-	 	if ((argc < 3)
+		if ((argc < 3)
 		 || (!isdigit(argv[2][0]))) {
 			warnx("option %s requires a target:lun argument",
 			      argv[1]);
@@ -4802,12 +4802,12 @@ main(int argc, char **argv)
 		retval = cctl_dump_structs(fd, cmdargs);
 		break;
 	case CTLADM_CMD_PRES_IN:
-		retval = cctl_persistent_reserve_in(fd, target, lun, initid, 
+		retval = cctl_persistent_reserve_in(fd, target, lun, initid,
 		                                    argc, argv, combinedopt,
 						    retries);
 		break;
 	case CTLADM_CMD_PRES_OUT:
-		retval = cctl_persistent_reserve_out(fd, target, lun, initid, 
+		retval = cctl_persistent_reserve_out(fd, target, lun, initid,
 						     argc, argv, combinedopt,
 						     retries);
 		break;

Modified: head/usr.sbin/ctld/ctld.c
==============================================================================
--- head/usr.sbin/ctld/ctld.c	Wed Oct 22 09:12:20 2014	(r273463)
+++ head/usr.sbin/ctld/ctld.c	Wed Oct 22 09:17:17 2014	(r273464)
@@ -255,7 +255,7 @@ auth_new_chap_mutual(struct auth_group *
 		if (ag->ag_name != NULL)
 			log_warnx("cannot mix \"chap-mutual\" authentication "
 			    "with other types for auth-group \"%s\"",
-			    ag->ag_name); 
+			    ag->ag_name);
 		else
 			log_warnx("cannot mix \"chap-mutual\" authentication "
 			    "with other types for target \"%s\"",
@@ -754,7 +754,7 @@ valid_iscsi_name(const char *name)
 		for (i = strlen("iqn."); name[i] != '\0'; i++) {
 			/*
 			 * XXX: We should verify UTF-8 normalisation, as defined
-			 * 	by 3.2.6.2: iSCSI Name Encoding.
+			 *      by 3.2.6.2: iSCSI Name Encoding.
 			 */
 			if (isalnum(name[i]))
 				continue;
@@ -1281,10 +1281,10 @@ conf_apply(struct conf *oldconf, struct 
 
 	/*
 	 * XXX: If target or lun removal fails, we should somehow "move"
-	 * 	the old lun or target into newconf, so that subsequent
-	 * 	conf_apply() would try to remove them again.  That would
-	 * 	be somewhat hairy, though, and lun deletion failures don't
-	 * 	really happen, so leave it as it is for now.
+	 *      the old lun or target into newconf, so that subsequent
+	 *      conf_apply() would try to remove them again.  That would
+	 *      be somewhat hairy, though, and lun deletion failures don't
+	 *      really happen, so leave it as it is for now.
 	 */
 	TAILQ_FOREACH_SAFE(oldtarg, &oldconf->conf_targets, t_next, tmptarg) {
 		/*

Modified: head/usr.sbin/ctld/kernel.c
==============================================================================
--- head/usr.sbin/ctld/kernel.c	Wed Oct 22 09:12:20 2014	(r273463)
+++ head/usr.sbin/ctld/kernel.c	Wed Oct 22 09:17:17 2014	(r273464)
@@ -105,7 +105,7 @@ struct cctl_lun_nv {
 };
 
 /*
- * Backend LUN information.  
+ * Backend LUN information.
  */
 struct cctl_lun {
 	uint64_t lun_id;
@@ -237,7 +237,7 @@ cctl_end_element(void *user_data, const 
 	} else if (strcmp(name, "lun") == 0) {
 		devlist->cur_lun = NULL;
 	} else if (strcmp(name, "ctllunlist") == 0) {
-		
+		/* Nothing. */
 	} else {
 		struct cctl_lun_nv *nv;
 
@@ -342,7 +342,7 @@ cctl_end_pelement(void *user_data, const
 	} else if (strcmp(name, "targ_port") == 0) {
 		devlist->cur_port = NULL;
 	} else if (strcmp(name, "ctlportlist") == 0) {
-		
+		/* Nothing. */
 	} else {
 		struct cctl_lun_nv *nv;
 

Modified: head/usr.sbin/ctld/keys.c
==============================================================================
--- head/usr.sbin/ctld/keys.c	Wed Oct 22 09:12:20 2014	(r273463)
+++ head/usr.sbin/ctld/keys.c	Wed Oct 22 09:17:17 2014	(r273464)
@@ -116,7 +116,7 @@ keys_save(struct keys *keys, struct pdu 
 	for (i = 0; i < KEYS_MAX; i++) {
 		if (keys->keys_names[i] == NULL)
 			break;
- 		/*
+		/*
 		 * +1 for '=', +1 for '\0'.
 		 */
 		len += strlen(keys->keys_names[i]) +

Modified: head/usr.sbin/ctld/login.c
==============================================================================
--- head/usr.sbin/ctld/login.c	Wed Oct 22 09:12:20 2014	(r273463)
+++ head/usr.sbin/ctld/login.c	Wed Oct 22 09:17:17 2014	(r273464)
@@ -640,7 +640,7 @@ login_negotiate(struct connection *conn,
 		if (conn->conn_target->t_alias != NULL)
 			keys_add(response_keys,
 			    "TargetAlias", conn->conn_target->t_alias);
-		keys_add_int(response_keys, "TargetPortalGroupTag", 
+		keys_add_int(response_keys, "TargetPortalGroupTag",
 		    conn->conn_portal->p_portal_group->pg_tag);
 	}
 
@@ -852,7 +852,7 @@ login(struct connection *conn)
 			if (conn->conn_target->t_alias != NULL)
 				keys_add(response_keys,
 				    "TargetAlias", conn->conn_target->t_alias);
-			keys_add_int(response_keys, "TargetPortalGroupTag", 
+			keys_add_int(response_keys, "TargetPortalGroupTag",
 			    conn->conn_portal->p_portal_group->pg_tag);
 		}
 		keys_save(response_keys, response);
@@ -903,7 +903,7 @@ login(struct connection *conn)
 		if (conn->conn_target->t_alias != NULL)
 			keys_add(response_keys,
 			    "TargetAlias", conn->conn_target->t_alias);
-		keys_add_int(response_keys, "TargetPortalGroupTag", 
+		keys_add_int(response_keys, "TargetPortalGroupTag",
 		    conn->conn_portal->p_portal_group->pg_tag);
 	}
 	keys_save(response_keys, response);

Modified: head/usr.sbin/ctld/parse.y
==============================================================================
--- head/usr.sbin/ctld/parse.y	Wed Oct 22 09:12:20 2014	(r273463)
+++ head/usr.sbin/ctld/parse.y	Wed Oct 22 09:17:17 2014	(r273464)
@@ -625,7 +625,7 @@ lun_device_id:	DEVICE_ID STR
 lun_option:	OPTION STR STR
 	{
 		struct lun_option *clo;
-		
+
 		clo = lun_option_new(lun, $2, $3);
 		free($2);
 		free($3);

Modified: head/usr.sbin/iscsid/keys.c
==============================================================================
--- head/usr.sbin/iscsid/keys.c	Wed Oct 22 09:12:20 2014	(r273463)
+++ head/usr.sbin/iscsid/keys.c	Wed Oct 22 09:17:17 2014	(r273464)
@@ -117,7 +117,7 @@ keys_save(struct keys *keys, struct pdu 
 	for (i = 0; i < KEYS_MAX; i++) {
 		if (keys->keys_names[i] == NULL)
 			break;
- 		/*
+		/*
 		 * +1 for '=', +1 for '\0'.
 		 */
 		len += strlen(keys->keys_names[i]) +

Modified: head/usr.sbin/iscsid/login.c
==============================================================================
--- head/usr.sbin/iscsid/login.c	Wed Oct 22 09:12:20 2014	(r273463)
+++ head/usr.sbin/iscsid/login.c	Wed Oct 22 09:17:17 2014	(r273464)
@@ -182,7 +182,7 @@ kernel_modify(const struct connection *c
  *	be much more complicated: we would need to keep "dependencies"
  *	for sessions, so that, in case described in draft and using draft
  *	terminology, we would have three sessions: one for discovery,
- *	one for initial target portal, and one for redirect portal.  
+ *	one for initial target portal, and one for redirect portal.
  *	This would allow us to "backtrack" on connection failure,
  *	as described in draft.
  */
@@ -756,8 +756,8 @@ login(struct connection *conn)
 		 * to parse things such as TargetAlias.
 		 *
 		 * XXX: This is somewhat ugly.  We should have a way to apply
-		 * 	all the keys to the session and use that by default
-		 * 	instead of discarding them.
+		 *      all the keys to the session and use that by default
+		 *      instead of discarding them.
 		 */
 		if (strcmp(response_keys->keys_names[i], "AuthMethod") == 0)
 			continue;

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 09:40:47 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 7BE76411;
 Wed, 22 Oct 2014 09:40:47 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 4F4B5378;
 Wed, 22 Oct 2014 09:40:47 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M9elYL051412;
 Wed, 22 Oct 2014 09:40:47 GMT (envelope-from trasz@FreeBSD.org)
Received: (from trasz@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M9el6V051411;
 Wed, 22 Oct 2014 09:40:47 GMT (envelope-from trasz@FreeBSD.org)
Message-Id: <201410220940.s9M9el6V051411@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: trasz set sender to
 trasz@FreeBSD.org using -f
From: Edward Tomasz Napierala 
Date: Wed, 22 Oct 2014 09:40:47 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273465 - head/usr.sbin/ctld
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 09:40:47 -0000

Author: trasz
Date: Wed Oct 22 09:40:46 2014
New Revision: 273465
URL: https://svnweb.freebsd.org/changeset/base/273465

Log:
  Fix ctld(8) to not show the "auth-group  not assigned to any target"
  warning for auth-groups assigned to a portal-group.
  
  MFC after:	1 month
  Sponsored by:	The FreeBSD Foundation

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

Modified: head/usr.sbin/ctld/ctld.c
==============================================================================
--- head/usr.sbin/ctld/ctld.c	Wed Oct 22 09:17:17 2014	(r273464)
+++ head/usr.sbin/ctld/ctld.c	Wed Oct 22 09:40:46 2014	(r273465)
@@ -1164,7 +1164,7 @@ conf_verify(struct conf *conf)
 	struct portal_group *pg;
 	struct target *targ;
 	struct lun *lun;
-	bool found_lun;
+	bool found;
 	int error;
 
 	if (conf->conf_pidfile_path == NULL)
@@ -1181,14 +1181,14 @@ conf_verify(struct conf *conf)
 			    "default");
 			assert(targ->t_portal_group != NULL);
 		}
-		found_lun = false;
+		found = false;
 		TAILQ_FOREACH(lun, &targ->t_luns, l_next) {
 			error = conf_verify_lun(lun);
 			if (error != 0)
 				return (error);
-			found_lun = true;
+			found = true;
 		}
-		if (!found_lun) {
+		if (!found) {
 			log_warnx("no LUNs defined for target \"%s\"",
 			    targ->t_name);
 		}
@@ -1219,11 +1219,20 @@ conf_verify(struct conf *conf)
 		else
 			assert(ag->ag_target == NULL);
 
+		found = false;
 		TAILQ_FOREACH(targ, &conf->conf_targets, t_next) {
-			if (targ->t_auth_group == ag)
+			if (targ->t_auth_group == ag) {
+				found = true;
 				break;
+			}
+		}
+		TAILQ_FOREACH(pg, &conf->conf_portal_groups, pg_next) {
+			if (pg->pg_discovery_auth_group == ag) {
+				found = true;
+				break;
+			}
 		}
-		if (targ == NULL && ag->ag_name != NULL &&
+		if (!found && ag->ag_name != NULL &&
 		    strcmp(ag->ag_name, "default") != 0 &&
 		    strcmp(ag->ag_name, "no-authentication") != 0 &&
 		    strcmp(ag->ag_name, "no-access") != 0) {

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 09:48:44 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 98364644;
 Wed, 22 Oct 2014 09:48:44 +0000 (UTC)
Received: from smtp.des.no (smtp.des.no [194.63.250.102])
 by mx1.freebsd.org (Postfix) with ESMTP id 5AFF43FD;
 Wed, 22 Oct 2014 09:48:44 +0000 (UTC)
Received: from nine.des.no (smtp.des.no [194.63.250.102])
 by smtp-int.des.no (Postfix) with ESMTP id AD366AC72;
 Wed, 22 Oct 2014 09:48:42 +0000 (UTC)
Received: by nine.des.no (Postfix, from userid 1001)
 id 0431654FD; Wed, 22 Oct 2014 11:48:31 +0200 (CEST)
From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= 
To: Warner Losh 
Subject: Re: svn commit: r273417 - head
References: <201410212029.s9LKThT2074337@svn.freebsd.org>
 <86d29k28wh.fsf@nine.des.no>
 <22788EC4-3BDF-40F3-ACAC-FA686ED21154@bsdimp.com>
Date: Wed, 22 Oct 2014 11:48:30 +0200
In-Reply-To: <22788EC4-3BDF-40F3-ACAC-FA686ED21154@bsdimp.com> (Warner Losh's
 message of "Tue, 21 Oct 2014 19:49:33 -0600")
Message-ID: <86iojco2oh.fsf@nine.des.no>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (berkeley-unix)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
 src-committers 
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 09:48:44 -0000

Warner Losh  writes:
> I=E2=80=99ll fix this. I think we need to have a MK_TESTS_SUPPORT that bu=
ilds
> the libatf stuff when yes, and omits it when no, since we don=E2=80=99t w=
ant
> the tests building when we=E2=80=99re building the 4.3 stage.

I agree, bundling everything under MK_TESTS does not make much sense.
Automake has the same bug ("make check" will both build the tests and
run them, and while you can rerun the tests without rebuilding them
("make recheck"), there is no way to build them without running them.

I would prefer calling this MK_ATF than MK_TESTS_SUPPORT, though.  The
test framework is probably useful on its own.

DES
--=20
Dag-Erling Sm=C3=B8rgrav - des@des.no

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 10:05:03 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 51168D20
 for ; Wed, 22 Oct 2014 10:05:03 +0000 (UTC)
Received: from mail-qa0-f53.google.com (mail-qa0-f53.google.com
 [209.85.216.53])
 (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits))
 (Client CN "smtp.gmail.com",
 Issuer "Google Internet Authority G2" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 101D08BA
 for ; Wed, 22 Oct 2014 10:05:02 +0000 (UTC)
Received: by mail-qa0-f53.google.com with SMTP id v10so2185391qac.12
 for ; Wed, 22 Oct 2014 03:05:02 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:mime-version:sender:in-reply-to:references:from
 :date:message-id:subject:to:cc:content-type;
 bh=X8LxzuTyJZMOHbM0feoqjQVZd3eBQRKy7anwcIDsmwk=;
 b=EG0wZeZSnuuNJMcoqUMj3jER/E5hExjNNx8ES3/6ZIz0kkBfoV0aDbmM0r4ekOQfRe
 C8rWXkgdRPJR42BSaurgw8x0EEjLvMilJYfISh2a+dnct+SaZrZouGt3g8aytjlldktE
 2LqDgtvZ+sVhnL54+pKxvQe15yYc16hiUSGZaEa78vUvQZi2wkX5D/DnjAKRBRtVPQHf
 HR6MeoAz6ggBJN5j8cksVhGbjiOhiBC/VNXQA0mnqNbCqrpM1fpVRghIwD1Yx8sbnRsz
 7JeqsGzUhTTaDHH/3ZQwq55GAGLS/qbpvK8u/zWuye8YYHtnbYMJiAOnhkjNZRVCT9Gu
 JgEg==
X-Gm-Message-State: ALoCoQlZMaR5ohqDQamI+qFAsK30ko62GiGdK7jkI8w+gWwZP3ZbMjzYifSCTLGWEdf5+oD6CAz6
X-Received: by 10.224.61.7 with SMTP id r7mr54975239qah.9.1413971921057; Wed,
 22 Oct 2014 02:58:41 -0700 (PDT)
MIME-Version: 1.0
Sender: jmmv@meroh.net
Received: by 10.96.75.134 with HTTP; Wed, 22 Oct 2014 02:58:20 -0700 (PDT)
X-Originating-IP: [2620:0:1040:404:e8f9:fd1a:c493:d286]
In-Reply-To: <201410211756.s9LHu6Q9098073@svn.freebsd.org>
References: <201410211756.s9LHu6Q9098073@svn.freebsd.org>
From: Julio Merino 
Date: Wed, 22 Oct 2014 10:58:20 +0100
X-Google-Sender-Auth: Z4gI8vO2UrPvJvPbDf5C6eIrruA
Message-ID: 
Subject: Re: svn commit: r273389 - head/contrib/netbsd-tests/lib/libc/gen
To: Garrett Cooper 
Content-Type: text/plain; charset=UTF-8
Cc: "svn-src-head@freebsd.org" ,
 "svn-src-all@freebsd.org" ,
 "src-committers@freebsd.org" 
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 10:05:03 -0000

On Tue, Oct 21, 2014 at 6:56 PM, Garrett Cooper  wrote:
> Modified: head/contrib/netbsd-tests/lib/libc/gen/t_siginfo.c
> ==============================================================================
> --- head/contrib/netbsd-tests/lib/libc/gen/t_siginfo.c  Tue Oct 21 17:17:40 2014        (r273388)
> +++ head/contrib/netbsd-tests/lib/libc/gen/t_siginfo.c  Tue Oct 21 17:56:06 2014        (r273389)
> @@ -29,7 +29,9 @@
>  #include 
>  #include 
>
> +#if defined(__NetBSD__)

Every time I see this (and checks for __FreeBSD__ as well), I can't
stop wondering... "why bother?"

This codebase lives in the FreeBSD source tree so it should be able to
assume it is being built on FreeBSD. The only thing these ifdefs
achieve is bloat, because there is no way their code paths will ever
be executed (and thus it's guaranteed that they will rot over time).
The differences between NetBSD and FreeBSD can easily be checked by
diffing the vendor branch with the contrib tree.

(Plus #ifdefs based on __*BSD__ macros are usually wrong because they
don't account for OS release differences and thus they will certainly
also break over time.)

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 10:53:26 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 05B42612;
 Wed, 22 Oct 2014 10:53:26 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id E6045E6D;
 Wed, 22 Oct 2014 10:53:25 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MArPfl085918;
 Wed, 22 Oct 2014 10:53:25 GMT (envelope-from trasz@FreeBSD.org)
Received: (from trasz@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MArPrd085917;
 Wed, 22 Oct 2014 10:53:25 GMT (envelope-from trasz@FreeBSD.org)
Message-Id: <201410221053.s9MArPrd085917@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: trasz set sender to
 trasz@FreeBSD.org using -f
From: Edward Tomasz Napierala 
Date: Wed, 22 Oct 2014 10:53:25 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273466 - head/usr.sbin/ctld
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 10:53:26 -0000

Author: trasz
Date: Wed Oct 22 10:53:25 2014
New Revision: 273466
URL: https://svnweb.freebsd.org/changeset/base/273466

Log:
  Remove spurious empty line.
  
  MFC after:	1 month
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/usr.sbin/ctld/ctl.conf.5

Modified: head/usr.sbin/ctld/ctl.conf.5
==============================================================================
--- head/usr.sbin/ctld/ctl.conf.5	Wed Oct 22 09:40:46 2014	(r273465)
+++ head/usr.sbin/ctld/ctl.conf.5	Wed Oct 22 10:53:25 2014	(r273466)
@@ -109,7 +109,6 @@ A setting of 0 disables the timeout.
 .El
 .Ss auth-group Context
 .Bl -tag -width indent
-
 .It Ic auth-type Ar type
 Sets the authentication type.
 Type can be either

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 11:06:06 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 11E1B9B7;
 Wed, 22 Oct 2014 11:06:06 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id F1C09F94;
 Wed, 22 Oct 2014 11:06:05 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MB65rm091060;
 Wed, 22 Oct 2014 11:06:05 GMT (envelope-from trasz@FreeBSD.org)
Received: (from trasz@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MB65bq091059;
 Wed, 22 Oct 2014 11:06:05 GMT (envelope-from trasz@FreeBSD.org)
Message-Id: <201410221106.s9MB65bq091059@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: trasz set sender to
 trasz@FreeBSD.org using -f
From: Edward Tomasz Napierala 
Date: Wed, 22 Oct 2014 11:06:05 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273467 - head/usr.sbin/ctld
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 11:06:06 -0000

Author: trasz
Date: Wed Oct 22 11:06:05 2014
New Revision: 273467
URL: https://svnweb.freebsd.org/changeset/base/273467

Log:
  Comment out parts about iSER; it's not implemented.
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/usr.sbin/ctld/ctl.conf.5

Modified: head/usr.sbin/ctld/ctl.conf.5
==============================================================================
--- head/usr.sbin/ctld/ctl.conf.5	Wed Oct 22 10:53:25 2014	(r273466)
+++ head/usr.sbin/ctld/ctl.conf.5	Wed Oct 22 11:06:05 2014	(r273467)
@@ -55,7 +55,7 @@ file is:
 
 .No portal-group Ar name No {
 .Dl listen Ar address
-.Dl listen-iser Ar address
+.\".Dl listen-iser Ar address
 .Dl discovery-auth-group Ar name
 .Dl ...
 }
@@ -174,9 +174,9 @@ may be used
 to permit discovery without authentication.
 .It Ic listen Ar address
 An IPv4 or IPv6 address and port to listen on for incoming connections.
-.It Ic listen-iser Ar address
-An IPv4 or IPv6 address and port to listen on for incoming connections
-using iSER (iSCSI over RDMA) protocol.
+.\".It Ic listen-iser Ar address
+.\"An IPv4 or IPv6 address and port to listen on for incoming connections
+.\"using iSER (iSCSI over RDMA) protocol.
 .El
 .Ss target Context
 .Bl -tag -width indent

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 11:09:04 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 6A8FAB4D;
 Wed, 22 Oct 2014 11:09:04 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 56FADFBA;
 Wed, 22 Oct 2014 11:09:04 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MB94KE091570;
 Wed, 22 Oct 2014 11:09:04 GMT (envelope-from trasz@FreeBSD.org)
Received: (from trasz@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MB94br091569;
 Wed, 22 Oct 2014 11:09:04 GMT (envelope-from trasz@FreeBSD.org)
Message-Id: <201410221109.s9MB94br091569@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: trasz set sender to
 trasz@FreeBSD.org using -f
From: Edward Tomasz Napierala 
Date: Wed, 22 Oct 2014 11:09:04 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273468 - head/usr.sbin/ctld
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 11:09:04 -0000

Author: trasz
Date: Wed Oct 22 11:09:03 2014
New Revision: 273468
URL: https://svnweb.freebsd.org/changeset/base/273468

Log:
  Remove misleading statement.  Bump date.
  
  MFC after:	1 month
  Sponsored by:	FreeBSD Foundation

Modified:
  head/usr.sbin/ctld/ctl.conf.5

Modified: head/usr.sbin/ctld/ctl.conf.5
==============================================================================
--- head/usr.sbin/ctld/ctl.conf.5	Wed Oct 22 11:06:05 2014	(r273467)
+++ head/usr.sbin/ctld/ctl.conf.5	Wed Oct 22 11:09:03 2014	(r273468)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 14, 2014
+.Dd October 22, 2014
 .Dt CTL.CONF 5
 .Os
 .Sh NAME
@@ -157,13 +157,7 @@ address.
 .It Ic discovery-auth-group Ar name
 Assign a previously defined authentication group to the portal group,
 to be used for target discovery.
-By default, portal groups that do not specify their own auth settings,
-using clauses such as
-.Sy chap
-or
-.Sy initiator-name ,
-are assigned
-predefined
+By default, portal groups are assigned predefined
 .Sy auth-group
 .Qq Ar default ,
 which denies discovery.

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 11:30:05 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 7D6421CB;
 Wed, 22 Oct 2014 11:30:05 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 68B2B299;
 Wed, 22 Oct 2014 11:30:05 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MBU5sA001469;
 Wed, 22 Oct 2014 11:30:05 GMT (envelope-from br@FreeBSD.org)
Received: (from br@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MBU4bB001380;
 Wed, 22 Oct 2014 11:30:04 GMT (envelope-from br@FreeBSD.org)
Message-Id: <201410221130.s9MBU4bB001380@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: br set sender to br@FreeBSD.org
 using -f
From: Ruslan Bukin 
Date: Wed, 22 Oct 2014 11:30:04 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273469 - in head/sys: arm/altera/socfpga arm/conf
 boot/fdt/dts/arm dev/beri
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 11:30:05 -0000

Author: br
Date: Wed Oct 22 11:30:03 2014
New Revision: 273469
URL: https://svnweb.freebsd.org/changeset/base/273469

Log:
  Provide a character device allowing us to access BERI memory regions.
  
  Sponsored by:	DARPA, AFRL

Added:
  head/sys/dev/beri/beri_mem.c   (contents, props changed)
Modified:
  head/sys/arm/altera/socfpga/files.socfpga
  head/sys/arm/conf/SOCKIT-BERI
  head/sys/boot/fdt/dts/arm/socfpga-sockit-beri.dts

Modified: head/sys/arm/altera/socfpga/files.socfpga
==============================================================================
--- head/sys/arm/altera/socfpga/files.socfpga	Wed Oct 22 11:09:03 2014	(r273468)
+++ head/sys/arm/altera/socfpga/files.socfpga	Wed Oct 22 11:30:03 2014	(r273469)
@@ -22,4 +22,7 @@ arm/altera/socfpga/socfpga_mp.c			option
 dev/dwc/if_dwc.c				optional dwc
 dev/mii/micphy.c				optional micphy
 dev/mmc/host/dwmmc.c				optional dwmmc
+
+# BERI specific
 dev/beri/beri_ring.c				optional beri_ring
+dev/beri/beri_mem.c				optional beri_mem

Modified: head/sys/arm/conf/SOCKIT-BERI
==============================================================================
--- head/sys/arm/conf/SOCKIT-BERI	Wed Oct 22 11:09:03 2014	(r273468)
+++ head/sys/arm/conf/SOCKIT-BERI	Wed Oct 22 11:30:03 2014	(r273469)
@@ -121,6 +121,7 @@ device		spibus
 
 # BERI specific
 device		beri_ring
+device		beri_mem
 
 # Ethernet
 device		ether

Modified: head/sys/boot/fdt/dts/arm/socfpga-sockit-beri.dts
==============================================================================
--- head/sys/boot/fdt/dts/arm/socfpga-sockit-beri.dts	Wed Oct 22 11:09:03 2014	(r273468)
+++ head/sys/boot/fdt/dts/arm/socfpga-sockit-beri.dts	Wed Oct 22 11:30:03 2014	(r273469)
@@ -81,6 +81,12 @@
 			};
 		};
 
+		beri_mem: mem@d0000000 {
+			compatible = "sri-cambridge,beri-mem";
+			reg = <0xd0000000 0x10000000>;
+			status = "okay";
+		};
+
 		beri_debug: ring@c0000000 {
 			compatible = "sri-cambridge,beri-ring";
 			reg = <0xc0000000 0x3000>;

Added: head/sys/dev/beri/beri_mem.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/dev/beri/beri_mem.c	Wed Oct 22 11:30:03 2014	(r273469)
@@ -0,0 +1,186 @@
+/*-
+ * Copyright (c) 2014 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.
+ */
+
+/*
+ * BERI memory interface.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+struct beri_mem_softc {
+	struct resource		*res[1];
+	struct cdev		*mem_cdev;
+	device_t		dev;
+	int			mem_size;
+	int			mem_start;
+};
+
+static struct resource_spec beri_mem_spec[] = {
+	{ SYS_RES_MEMORY,	0,	RF_ACTIVE },
+	{ -1, 0 }
+};
+
+static int
+mem_open(struct cdev *dev, int flags __unused,
+    int fmt __unused, struct thread *td __unused)
+{
+	struct beri_mem_softc *sc;
+
+	sc = dev->si_drv1;
+
+	return (0);
+}
+
+static int
+mem_close(struct cdev *dev, int flags __unused,
+    int fmt __unused, struct thread *td __unused)
+{
+	struct beri_mem_softc *sc;
+
+	sc = dev->si_drv1;
+
+	return (0);
+}
+
+static int
+mem_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags,
+    struct thread *td)
+{
+
+	return (0);
+}
+
+static int
+mem_mmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, int nprot,
+    vm_memattr_t *memattr)
+{
+	struct beri_mem_softc *sc;
+
+	sc = dev->si_drv1;
+
+	if (offset < sc->mem_size) {
+		*paddr = sc->mem_start + offset;
+		return (0);
+        }
+
+	return (EINVAL);
+}
+
+static struct cdevsw mem_cdevsw = {
+	.d_version =	D_VERSION,
+	.d_open =	mem_open,
+	.d_close =	mem_close,
+	.d_ioctl =	mem_ioctl,
+	.d_mmap =	mem_mmap,
+	.d_name =	"BERI memory",
+};
+
+static int
+beri_mem_probe(device_t dev)
+{
+
+	if (!ofw_bus_status_okay(dev))
+		return (ENXIO);
+
+	if (!ofw_bus_is_compatible(dev, "sri-cambridge,beri-mem"))
+		return (ENXIO);
+
+	device_set_desc(dev, "BERI memory");
+	return (BUS_PROBE_DEFAULT);
+}
+
+static int
+beri_mem_attach(device_t dev)
+{
+	struct beri_mem_softc *sc;
+
+	sc = device_get_softc(dev);
+	sc->dev = dev;
+
+	if (bus_alloc_resources(dev, beri_mem_spec, sc->res)) {
+		device_printf(dev, "could not allocate resources\n");
+		return (ENXIO);
+	}
+
+	/* Memory info */
+	sc->mem_size = rman_get_size(sc->res[0]);
+	sc->mem_start = rman_get_start(sc->res[0]);
+
+	sc->mem_cdev = make_dev(&mem_cdevsw, 0, UID_ROOT, GID_WHEEL,
+	    0600, "beri_mem");
+
+	if (sc->mem_cdev == NULL) {
+		device_printf(dev, "Failed to create character device.\n");
+		return (ENXIO);
+	}
+
+	sc->mem_cdev->si_drv1 = sc;
+
+	return (0);
+}
+
+static device_method_t beri_mem_methods[] = {
+	DEVMETHOD(device_probe,		beri_mem_probe),
+	DEVMETHOD(device_attach,	beri_mem_attach),
+	{ 0, 0 }
+};
+
+static driver_t beri_mem_driver = {
+	"beri_mem",
+	beri_mem_methods,
+	sizeof(struct beri_mem_softc),
+};
+
+static devclass_t beri_mem_devclass;
+
+DRIVER_MODULE(beri_mem, simplebus, beri_mem_driver, beri_mem_devclass, 0, 0);

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 11:30:57 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id C7F0E3FA;
 Wed, 22 Oct 2014 11:30:57 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id B4423359;
 Wed, 22 Oct 2014 11:30:57 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MBUvfZ002608;
 Wed, 22 Oct 2014 11:30:57 GMT (envelope-from trasz@FreeBSD.org)
Received: (from trasz@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MBUv4B002607;
 Wed, 22 Oct 2014 11:30:57 GMT (envelope-from trasz@FreeBSD.org)
Message-Id: <201410221130.s9MBUv4B002607@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: trasz set sender to
 trasz@FreeBSD.org using -f
From: Edward Tomasz Napierala 
Date: Wed, 22 Oct 2014 11:30:57 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273470 - head/usr.sbin/ctld
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 11:30:57 -0000

Author: trasz
Date: Wed Oct 22 11:30:56 2014
New Revision: 273470
URL: https://svnweb.freebsd.org/changeset/base/273470

Log:
  Fix ctl.conf example to use proper paths to ZVOLs.
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/usr.sbin/ctld/ctl.conf.5

Modified: head/usr.sbin/ctld/ctl.conf.5
==============================================================================
--- head/usr.sbin/ctld/ctl.conf.5	Wed Oct 22 11:30:03 2014	(r273469)
+++ head/usr.sbin/ctld/ctl.conf.5	Wed Oct 22 11:30:56 2014	(r273470)
@@ -313,7 +313,7 @@ target iqn.2012-06.com.example:target0 {
 	alias "Example target"
 	auth-group no-authentication
 	lun 0 {
-		path /dev/zvol/example_0
+		path /dev/zvol/tank/example_0
 		blocksize 4096
 		size 4G
 	}
@@ -322,7 +322,7 @@ target iqn.2012-06.com.example:target0 {
 target iqn.2012-06.com.example:target3 {
 	chap chapuser chapsecret
 	lun 0 {
-		path /dev/zvol/example_3
+		path /dev/zvol/tank/example_3
 	}
 }
 
@@ -330,10 +330,10 @@ target iqn.2012-06.com.example:target2 {
 	auth-group example2
 	portal-group example2
 	lun 0 {
-		path /dev/zvol/example2_0
+		path /dev/zvol/tank/example2_0
 	}
 	lun 1 {
-		path /dev/zvol/example2_1
+		path /dev/zvol/tank/example2_1
 		option foo bar
 	}
 }

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 13:50:41 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 46650800;
 Wed, 22 Oct 2014 13:50:41 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 2FE7DAE8;
 Wed, 22 Oct 2014 13:50:41 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MDofov069045;
 Wed, 22 Oct 2014 13:50:41 GMT (envelope-from andrew@FreeBSD.org)
Received: (from andrew@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MDodek069036;
 Wed, 22 Oct 2014 13:50:39 GMT (envelope-from andrew@FreeBSD.org)
Message-Id: <201410221350.s9MDodek069036@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: andrew set sender to
 andrew@FreeBSD.org using -f
From: Andrew Turner 
Date: Wed, 22 Oct 2014 13:50:39 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject: svn commit: r273471 - stable/10/lib/libc/arm/aeabi
X-SVN-Group: stable-10
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 13:50:41 -0000

Author: andrew
Date: Wed Oct 22 13:50:38 2014
New Revision: 273471
URL: https://svnweb.freebsd.org/changeset/base/273471

Log:
  MFC r273088:
  
  Add support for the __aeabi_c*cmp* functions. These are similar to the
  existing functions with the exception they use the condition flags to
  store the result.

Added:
  stable/10/lib/libc/arm/aeabi/aeabi_asm_double.S
     - copied unchanged from r273088, head/lib/libc/arm/aeabi/aeabi_asm_double.S
  stable/10/lib/libc/arm/aeabi/aeabi_asm_float.S
     - copied unchanged from r273088, head/lib/libc/arm/aeabi/aeabi_asm_float.S
Modified:
  stable/10/lib/libc/arm/aeabi/Makefile.inc
  stable/10/lib/libc/arm/aeabi/Symbol.map
  stable/10/lib/libc/arm/aeabi/aeabi_double.c
  stable/10/lib/libc/arm/aeabi/aeabi_float.c
  stable/10/lib/libc/arm/aeabi/aeabi_vfp_double.S
  stable/10/lib/libc/arm/aeabi/aeabi_vfp_float.S
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libc/arm/aeabi/Makefile.inc
==============================================================================
--- stable/10/lib/libc/arm/aeabi/Makefile.inc	Wed Oct 22 11:30:56 2014	(r273470)
+++ stable/10/lib/libc/arm/aeabi/Makefile.inc	Wed Oct 22 13:50:38 2014	(r273471)
@@ -2,7 +2,9 @@
 
 .PATH: ${.CURDIR}/arm/aeabi
 
-SRCS+=	aeabi_atexit.c		\
+SRCS+=	aeabi_asm_double.S	\
+	aeabi_asm_float.S	\
+	aeabi_atexit.c		\
 	aeabi_double.c		\
 	aeabi_float.c		\
 	aeabi_unwind_cpp.c	\

Modified: stable/10/lib/libc/arm/aeabi/Symbol.map
==============================================================================
--- stable/10/lib/libc/arm/aeabi/Symbol.map	Wed Oct 22 11:30:56 2014	(r273470)
+++ stable/10/lib/libc/arm/aeabi/Symbol.map	Wed Oct 22 13:50:38 2014	(r273471)
@@ -17,6 +17,10 @@ FBSDprivate_1.0 {
 	__aeabi_dcmpgt;
 	__aeabi_dcmpun;
 
+	__aeabi_cdcmpeq;
+	__aeabi_cdcmple;
+	__aeabi_cdrcmple;
+
 	__aeabi_d2iz;
 	__aeabi_d2f;
 
@@ -33,6 +37,10 @@ FBSDprivate_1.0 {
 	__aeabi_fcmpgt;
 	__aeabi_fcmpun;
 
+	__aeabi_cfcmpeq;
+	__aeabi_cfcmple;
+	__aeabi_cfrcmple;
+
 	__aeabi_f2iz;
 	__aeabi_f2d;
 

Copied: stable/10/lib/libc/arm/aeabi/aeabi_asm_double.S (from r273088, head/lib/libc/arm/aeabi/aeabi_asm_double.S)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/10/lib/libc/arm/aeabi/aeabi_asm_double.S	Wed Oct 22 13:50:38 2014	(r273471, copy of r273088, head/lib/libc/arm/aeabi/aeabi_asm_double.S)
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2014 Andrew Turner
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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.
+ *
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#define	PCR_Z	(1 << 30)
+#define	PCR_C	(1 << 29)
+
+/*
+ * These functions return the result in the CPSR register.
+ *
+ * For __aeabi_cdcmple:
+ *      Z C
+ *   LT 0 0
+ *   EQ 1 1
+ * else 0 1
+ *
+ * __aeabi_cdrcmple is the same as __aeabi_cdcmple, however the arguments
+ * have been swapped.
+ */
+ENTRY(__aeabi_cdcmple)
+	push	{r4, r5, r6, r7, ip, lr}
+
+	/* Backup the input registers */
+	mov	r4, r0
+	mov	r5, r1
+	mov	r6, r2
+	mov	r7, r3
+	/* Is it less than? */
+	bl	__aeabi_dcmplt
+	cmp	r0, #1
+	bne	1f
+	/* Yes, clear Z and C */
+	msr	cpsr_c, #(0)
+	b	99f
+
+1:
+	/* Restore the input regsters for the next function call */
+	mov	r0, r4
+	mov	r1, r5
+	mov	r2, r6
+	mov	r3, r7
+	/* Is it equal? */
+	bl	__aeabi_dcmpeq
+	cmp	r0, #1
+	bne	2f
+	/* Yes, set Z and C */
+	msr	cpsr_c, #(PCR_Z | PCR_C)
+	b 99f
+
+2:
+	/* Not less than or equal, set C and clear Z */
+	msr	cpsr_c, #(PCR_C)
+
+99:
+	pop	{r4, r5, r6, r7, ip, pc}
+END(__aeabi_cdcmple)
+
+ENTRY(__aeabi_cdrcmple)
+	/* Swap the first half of the arguments */
+	mov	ip, r0
+	mov	r0, r2
+	mov	r2, ip
+
+	/* And the second half */
+	mov	ip, r1
+	mov	r1, r3
+	mov	r3, ip
+
+	b	__aeabi_cdcmple
+END(__aeabi_cdrcmple)
+
+/*
+ * This is just like __aeabi_cdcmple except it will not throw an exception
+ * in the presence of a quiet NaN. If either argument is a signalling NaN we
+ * will still signal.
+ */
+ENTRY(__aeabi_cdcmpeq)
+	/* Check if we can call __aeabi_cfcmple safely */
+	push	{r0, r1, r2, r3, r4, lr}
+	bl	__aeabi_cdcmpeq_helper
+	cmp	r0, #1
+	pop	{r0, r1, r2, r3, r4, lr}
+	beq	1f
+
+	bl	__aeabi_cdcmple
+	RET
+
+1:
+	msr	cpsr_c, #(PCR_C)
+	RET
+END(__aeabi_cdcmpeq)

Copied: stable/10/lib/libc/arm/aeabi/aeabi_asm_float.S (from r273088, head/lib/libc/arm/aeabi/aeabi_asm_float.S)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/10/lib/libc/arm/aeabi/aeabi_asm_float.S	Wed Oct 22 13:50:38 2014	(r273471, copy of r273088, head/lib/libc/arm/aeabi/aeabi_asm_float.S)
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2014 Andrew Turner
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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.
+ *
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#define	PCR_Z	(1 << 30)
+#define	PCR_C	(1 << 29)
+
+/*
+ * These functions return the result in the CPSR register.
+ *
+ * For __aeabi_cfcmple:
+ *      Z C
+ *   LT 0 0
+ *   EQ 1 1
+ * else 0 1
+ *
+ * __aeabi_cfrcmple is the same as __aeabi_cfcmple, however the arguments
+ * have been swapped.
+ */
+ENTRY(__aeabi_cfcmple)
+	push	{r4, r5, ip, lr}
+
+	/* Backup the input registers */
+	mov	r4, r0
+	mov	r5, r1
+	/* Is it less than? */
+	bl	__aeabi_fcmplt
+	cmp	r0, #1
+	bne	1f
+	/* Yes, clear Z and C */
+	msr	cpsr_c, #(0)
+	b	99f
+
+1:
+	/* Restore the input regsters for the next function call */
+	mov	r0, r4
+	mov	r1, r5
+	/* Is it equal? */
+	bl	__aeabi_fcmpeq
+	cmp	r0, #1
+	bne	2f
+	/* Yes, set Z and C */
+	msr	cpsr_c, #(PCR_Z | PCR_C)
+	b 99f
+
+2:
+	/* Not less than or equal, set C and clear Z */
+	msr	cpsr_c, #(PCR_C)
+
+99:
+	pop	{r4, r5, ip, pc}
+END(__aeabi_cfcmple)
+
+ENTRY(__aeabi_cfrcmple)
+	/* Swap the arguments */
+	mov	ip, r0
+	mov	r0, r1
+	mov	r1, ip
+
+	b	__aeabi_cfcmple
+END(__aeabi_cfrcmple)
+
+/*
+ * This is just like __aeabi_cfcmple except it will not throw an exception
+ * in the presence of a quiet NaN. If either argument is a signalling NaN we
+ * will still signal.
+ */
+ENTRY(__aeabi_cfcmpeq)
+	/* Check if we can call __aeabi_cfcmple safely */
+	push	{r0, r1, r2, lr}
+	bl	__aeabi_cfcmpeq_helper
+	cmp	r0, #1
+	pop	{r0, r1, r2, lr}
+	beq	1f
+
+	bl	__aeabi_cfcmple
+	RET
+
+1:
+	msreq	cpsr_c, #(PCR_C)
+	RET
+END(__aeabi_cfcmpeq)

Modified: stable/10/lib/libc/arm/aeabi/aeabi_double.c
==============================================================================
--- stable/10/lib/libc/arm/aeabi/aeabi_double.c	Wed Oct 22 11:30:56 2014	(r273470)
+++ stable/10/lib/libc/arm/aeabi/aeabi_double.c	Wed Oct 22 13:50:38 2014	(r273471)
@@ -74,3 +74,28 @@ float64 AEABI_FUNC2(ddiv, float64, float
 float64 AEABI_FUNC2(dmul, float64, float64_mul)
 float64 AEABI_FUNC2(dsub, float64, float64_sub)
 
+int
+__aeabi_cdcmpeq_helper(float64 a, float64 b)
+{
+	int quiet = 0;
+
+	/* Check if a is a NaN */
+	if ((a << 1) > 0xffe0000000000000ull) {
+		/* If it's a signalling NaN we will always signal */
+		if ((a & 0x0008000000000000ull) == 0)
+			return (0);
+
+		quiet = 1;
+	}
+
+	/* Check if b is a NaN */
+	if ((b << 1) > 0xffe0000000000000ull) {
+		/* If it's a signalling NaN we will always signal */
+		if ((b & 0x0008000000000000ull) == 0)
+			return (0);
+
+		quiet = 1;
+	}
+
+	return (quiet);
+}

Modified: stable/10/lib/libc/arm/aeabi/aeabi_float.c
==============================================================================
--- stable/10/lib/libc/arm/aeabi/aeabi_float.c	Wed Oct 22 11:30:56 2014	(r273470)
+++ stable/10/lib/libc/arm/aeabi/aeabi_float.c	Wed Oct 22 13:50:38 2014	(r273471)
@@ -74,3 +74,28 @@ float32 AEABI_FUNC2(fdiv, float32, float
 float32 AEABI_FUNC2(fmul, float32, float32_mul)
 float32 AEABI_FUNC2(fsub, float32, float32_sub)
 
+int
+__aeabi_cfcmpeq_helper(float32 a, float32 b)
+{
+	int quiet = 0;
+
+	/* Check if a is a NaN */
+	if ((a << 1) > 0xff000000u) {
+		/* If it's a signalling NaN we will always signal */
+		if ((a & 0x00400000u) == 0)
+			return (0);
+
+		quiet = 1;
+	}
+
+	/* Check if b is a NaN */
+	if ((b << 1) > 0xff000000u) {
+		/* If it's a signalling NaN we will always signal */
+		if ((b & 0x00400000u) == 0)
+			return (0);
+
+		quiet = 1;
+	}
+
+	return (quiet);
+}

Modified: stable/10/lib/libc/arm/aeabi/aeabi_vfp_double.S
==============================================================================
--- stable/10/lib/libc/arm/aeabi/aeabi_vfp_double.S	Wed Oct 22 11:30:56 2014	(r273470)
+++ stable/10/lib/libc/arm/aeabi/aeabi_vfp_double.S	Wed Oct 22 13:50:38 2014	(r273471)
@@ -33,6 +33,33 @@ __FBSDID("$FreeBSD$");
 .fpu	vfp
 .syntax	unified
 
+/* void __aeabi_cdcmpeq(double, double) */
+AEABI_ENTRY(cdcmpeq)
+	LOAD_DREG(d0, r0, r1)
+	LOAD_DREG(d1, r2, r3)
+	vcmp.f64	d0, d1
+	vmrs		APSR_nzcv, fpscr
+	RET
+AEABI_END(cdcmpeq)
+
+/* void __aeabi_cdcmple(double, double) */
+AEABI_ENTRY(cdcmple)
+	LOAD_DREG(d0, r0, r1)
+	LOAD_DREG(d1, r2, r3)
+	vcmpe.f64	d0, d1
+	vmrs		APSR_nzcv, fpscr
+	RET
+AEABI_END(cdcmple)
+
+/* void __aeabi_cdrcmple(double, double) */
+AEABI_ENTRY(cdrcmple)
+	LOAD_DREG(d0, r0, r1)
+	LOAD_DREG(d1, r2, r3)
+	vcmpe.f64	d1, d0
+	vmrs		APSR_nzcv, fpscr
+	RET
+AEABI_END(cdrcmple)
+
 /* int __aeabi_dcmpeq(double, double) */
 AEABI_ENTRY(dcmpeq)
 	LOAD_DREG(d0, r0, r1)

Modified: stable/10/lib/libc/arm/aeabi/aeabi_vfp_float.S
==============================================================================
--- stable/10/lib/libc/arm/aeabi/aeabi_vfp_float.S	Wed Oct 22 11:30:56 2014	(r273470)
+++ stable/10/lib/libc/arm/aeabi/aeabi_vfp_float.S	Wed Oct 22 13:50:38 2014	(r273471)
@@ -33,6 +33,30 @@ __FBSDID("$FreeBSD$");
 .fpu	vfp
 .syntax	unified
 
+/* void __aeabi_cfcmpeq(float, float) */
+AEABI_ENTRY(cfcmpeq)
+	LOAD_SREGS(s0, s1, r0, r1)
+	vcmp.f32	s0, s1
+	vmrs     	APSR_nzcv, fpscr
+	RET
+AEABI_END(cfcmpeq)
+
+/* void __aeabi_cfcmple(float, float) */
+AEABI_ENTRY(cfcmple)
+	LOAD_SREGS(s0, s1, r0, r1)
+	vcmpe.f32	s0, s1
+	vmrs     	APSR_nzcv, fpscr
+	RET
+AEABI_END(cfcmple)
+
+/* void __aeabi_cfrcmple(float, float) */
+AEABI_ENTRY(cfrcmple)
+	LOAD_SREGS(s0, s1, r0, r1)
+	vcmpe.f32	s1, s0
+	vmrs     	APSR_nzcv, fpscr
+	RET
+AEABI_END(cfrcmple)
+
 /* int __aeabi_fcmpeq(float, float) */
 AEABI_ENTRY(fcmpeq)
 	LOAD_SREGS(s0, s1, r0, r1)

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 14:02:55 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 468E4BA8
 for ; Wed, 22 Oct 2014 14:02:55 +0000 (UTC)
Received: from mail-pa0-f45.google.com (mail-pa0-f45.google.com
 [209.85.220.45])
 (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits))
 (Client CN "smtp.gmail.com",
 Issuer "Google Internet Authority G2" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 12FDFCF8
 for ; Wed, 22 Oct 2014 14:02:54 +0000 (UTC)
Received: by mail-pa0-f45.google.com with SMTP id lj1so3752480pab.4
 for ; Wed, 22 Oct 2014 07:02:53 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:sender:content-type:mime-version:subject:from
 :in-reply-to:date:cc:message-id:references:to;
 bh=sat6zkkGpXLQy7xiyndxI8Ds3eZ3JbviEt+jaT+Egl8=;
 b=XvHG1jlicIL+/FBukE26yxJFcGWfokLg/Dx+V9lXRWP9JYawZ8+gAPGobBEJKevHuc
 zgY2eRgdn9Q1CU0lvByX5mxuZMNYz9HFlldPOiGjQ3woO63ftLsikzbUix5Gaxy6oSjb
 AuOYPC0PeBteJVeAYKj3epLSUxxX02p9ETYjDBQlasQYFfdlz+YNN9u7wfvAiNOzI/n6
 /xdwDlTVDvKT1/zyWmMDOYbPyKQ6X11zVdkbUwxm16P/XMPj9Nrm2BEIS14sCY86pTVK
 2smjBA7KeVvioaTSItIKanUhOYIX8pt86Cxc62nb/BfbQ/TG7TXkVN2U08abRqt5m2vu
 Qmag==
X-Gm-Message-State: ALoCoQnWSYTOfVFGB5pbsw+Zc3Y9P965Kgvb/dqmD1PqKzJfH1+6cx4eeUwL1ErdnSK5ZR80iHBM
X-Received: by 10.70.109.139 with SMTP id hs11mr23218016pdb.83.1413986573849; 
 Wed, 22 Oct 2014 07:02:53 -0700 (PDT)
Received: from macintosh-c42c033c0b73.corp.netflix.com (dc1-prod.netflix.com.
 [69.53.236.251])
 by mx.google.com with ESMTPSA id ps7sm14315509pbb.73.2014.10.22.07.02.52
 for 
 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
 Wed, 22 Oct 2014 07:02:53 -0700 (PDT)
Sender: Warner Losh 
Content-Type: multipart/signed;
 boundary="Apple-Mail=_4C5EC1F4-95DC-4993-BAC2-200E4D0B9CA3";
 protocol="application/pgp-signature"; micalg=pgp-sha512
Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\))
Subject: Re: svn commit: r273417 - head
From: Warner Losh 
In-Reply-To: <86iojco2oh.fsf@nine.des.no>
Date: Wed, 22 Oct 2014 08:02:49 -0600
Message-Id: <6287010D-9C54-4167-9784-84134080A419@bsdimp.com>
References: <201410212029.s9LKThT2074337@svn.freebsd.org>
 <86d29k28wh.fsf@nine.des.no>
 <22788EC4-3BDF-40F3-ACAC-FA686ED21154@bsdimp.com>
 <86iojco2oh.fsf@nine.des.no>
To: =?iso-8859-1?Q?Dag-Erling_Sm=F8rgrav?= 
X-Mailer: Apple Mail (2.1878.6)
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
 src-committers 
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 14:02:55 -0000


--Apple-Mail=_4C5EC1F4-95DC-4993-BAC2-200E4D0B9CA3
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=windows-1252


On Oct 22, 2014, at 3:48 AM, Dag-Erling Sm=F8rgrav  wrote:

> Warner Losh  writes:
>> I=92ll fix this. I think we need to have a MK_TESTS_SUPPORT that =
builds
>> the libatf stuff when yes, and omits it when no, since we don=92t =
want
>> the tests building when we=92re building the 4.3 stage.
>=20
> I agree, bundling everything under MK_TESTS does not make much sense.
> Automake has the same bug ("make check" will both build the tests and
> run them, and while you can rerun the tests without rebuilding them
> ("make recheck"), there is no way to build them without running them.
>=20
> I would prefer calling this MK_ATF than MK_TESTS_SUPPORT, though.  The
> test framework is probably useful on its own.

That would be a nicer name, but then we=92d lose the automatic setting =
when MK_TESTS
is enabled (unless we add another special case, which is the opposite =
direction that
I want to go in). How strongly do you feel that=92s a better name?

Warner


--Apple-Mail=_4C5EC1F4-95DC-4993-BAC2-200E4D0B9CA3
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP using GPGMail

-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - https://gpgtools.org

iQIcBAEBCgAGBQJUR7kKAAoJEGwc0Sh9sBEAK9MP/A/zrxF7PUIfpQq98M9UM2ky
K/0Vjjc/mOPBNCBirkE2HG+J+QRmjZ5O23+J9E+AWCCz7+ucPVT3T0vanx8pHm4W
x3bTAJvE76W8KKpPQyCQEgN7ZiK/PdNIB9mqWwOqExLzZ7MCUdIDQK7Bi01WnPbs
aMYFEMP9md/cu7HX90TkAhzjn0awK6zOYeHx1fGonTce0WhQvSsPHeUX0IobVwbP
85TuLXOiEKezC1wJn1MhzW6XfplVY2kPNgfQ6oAw0U0pqBghUQpymbFemezScqOG
ELPMUlNLvchyrL8T0rlIpYeuOX9zlCLBsu3jWMkwSNqVBFktl+eD/SwWOOu1Bj8X
xBcH50sD7Me4bITsaUZ9nHcdKpXdThqlGwzfop/b1fuYgBUsXiNUebBtYuL8gQKP
HVL4wCTBy2levCqd0rm0G4WLXq2hsmCEpBASPhkR4K6L1m5mKw2DWAXnWieOnX8S
snXuJ5h3cULEST8fZqbdh6/u23/ka+mFRh4FRIk+5sjjMHQ2IMpdyJC8Yz/D1GEI
795T4bpFm6MIyD0JeZ6eNYS1PMq2Zp/qXoUYGgcA97kiseQLYoUqiOpUKd24AVqX
R1PbhO/QTrkf8J5O763DIH6ABTrdO0Uhhbl8FqZBLW1YA6vHkV3jNTfiJscvM7uV
M6yA9ztaAJXOp1suyvia
=smAw
-----END PGP SIGNATURE-----

--Apple-Mail=_4C5EC1F4-95DC-4993-BAC2-200E4D0B9CA3--

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 14:57:45 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 20C1596B;
 Wed, 22 Oct 2014 14:57:45 +0000 (UTC)
Received: from smtp.des.no (smtp.des.no [194.63.250.102])
 by mx1.freebsd.org (Postfix) with ESMTP id D3774391;
 Wed, 22 Oct 2014 14:57:44 +0000 (UTC)
Received: from nine.des.no (smtp.des.no [194.63.250.102])
 by smtp-int.des.no (Postfix) with ESMTP id 2D13DA104;
 Wed, 22 Oct 2014 14:57:43 +0000 (UTC)
Received: by nine.des.no (Postfix, from userid 1001)
 id 9351B5540; Wed, 22 Oct 2014 16:57:31 +0200 (CEST)
From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= 
To: Warner Losh 
Subject: Re: svn commit: r273417 - head
References: <201410212029.s9LKThT2074337@svn.freebsd.org>
 <86d29k28wh.fsf@nine.des.no>
 <22788EC4-3BDF-40F3-ACAC-FA686ED21154@bsdimp.com>
 <86iojco2oh.fsf@nine.des.no>
 <6287010D-9C54-4167-9784-84134080A419@bsdimp.com>
Date: Wed, 22 Oct 2014 16:57:31 +0200
In-Reply-To: <6287010D-9C54-4167-9784-84134080A419@bsdimp.com> (Warner Losh's
 message of "Wed, 22 Oct 2014 08:02:49 -0600")
Message-ID: <86mw8ocftw.fsf@nine.des.no>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (berkeley-unix)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
 src-committers 
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 14:57:45 -0000

Warner Losh  writes:
> Dag-Erling Sm=C3=B8rgrav  writes:
> > I would prefer calling this MK_ATF than MK_TESTS_SUPPORT, though.
> > The test framework is probably useful on its own.
> That would be a nicer name, but then we=E2=80=99d lose the automatic sett=
ing
> when MK_TESTS is enabled (unless we add another special case, which is
> the opposite direction that I want to go in). How strongly do you feel
> that=E2=80=99s a better name?

Is _SUPPORT magic?  I didn't know.  I guess MK_TESTS_SUPPORT is good
enough, especially if it's on by default.

DES
--=20
Dag-Erling Sm=C3=B8rgrav - des@des.no

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 15:00:08 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 0F2ACAE9;
 Wed, 22 Oct 2014 15:00:08 +0000 (UTC)
Received: from mail-pa0-x231.google.com (mail-pa0-x231.google.com
 [IPv6:2607:f8b0:400e:c03::231])
 (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits))
 (Client CN "smtp.gmail.com",
 Issuer "Google Internet Authority G2" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id CC4003C7;
 Wed, 22 Oct 2014 15:00:07 +0000 (UTC)
Received: by mail-pa0-f49.google.com with SMTP id hz1so3841304pad.36
 for ; Wed, 22 Oct 2014 08:00:07 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=mime-version:in-reply-to:references:date:message-id:subject:from:to
 :cc:content-type;
 bh=9//D4wVFweLOhmwC9MuhOTrwyP4o/yEAGs66bPDundQ=;
 b=X4eOwZUsTXL0+3ij+p9SLW/Ml3Dbp8/rOpVtnqaPi9WoHR2j/uakki4JsXrbBY3GHU
 vxuyjHQ8U1JdsndgRcN39kmepyrqXYae4qmY2CTjU4vAcw/FA/iW7ZL0Ot/QBn1GJ29V
 fm4sxXTktcrgybhuVhRShk8o8NBEUrPkFzNlQEQM3c1BEp/SB3ps6h6YWGF8HAVvZzgX
 4Xdq/k6vdjj/oLZpO1CTDhx/eqfiKnuphoonsHugDVN6cKX9I7UogJ9d8bGYYp8b2ZQD
 XudOqtiFYvJ99XaoxpyJVc7vGJIGtSU/Kv6iPASuSr8sW92PDPU/Ig+YNbhwMdX36E3M
 xhbA==
MIME-Version: 1.0
X-Received: by 10.66.66.229 with SMTP id i5mr4290688pat.137.1413990007308;
 Wed, 22 Oct 2014 08:00:07 -0700 (PDT)
Received: by 10.70.9.132 with HTTP; Wed, 22 Oct 2014 08:00:07 -0700 (PDT)
In-Reply-To: <86mw8ocftw.fsf@nine.des.no>
References: <201410212029.s9LKThT2074337@svn.freebsd.org>
 <86d29k28wh.fsf@nine.des.no>
 <22788EC4-3BDF-40F3-ACAC-FA686ED21154@bsdimp.com>
 <86iojco2oh.fsf@nine.des.no>
 <6287010D-9C54-4167-9784-84134080A419@bsdimp.com>
 <86mw8ocftw.fsf@nine.des.no>
Date: Wed, 22 Oct 2014 11:00:07 -0400
Message-ID: 
Subject: Re: svn commit: r273417 - head
From: Benjamin Kaduk 
To: =?UTF-8?Q?Dag=2DErling_Sm=C3=B8rgrav?= 
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1
Cc: "svn-src-head@freebsd.org" ,
 "svn-src-all@freebsd.org" ,
 src-committers , Warner Losh 
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 15:00:08 -0000

On Wed, Oct 22, 2014 at 10:57 AM, Dag-Erling Sm=C3=B8rgrav  wro=
te:

> Is _SUPPORT magic?  I didn't know.  I guess MK_TESTS_SUPPORT is good
> enough, especially if it's on by default.


Even if it is magic, is that really the kind of magic we want to be keeping
around?

-Ben

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 15:34:56 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 48B3E4D6;
 Wed, 22 Oct 2014 15:34:56 +0000 (UTC)
Received: from mho-02-ewr.mailhop.org (mho-02-ewr.mailhop.org [204.13.248.72])
 (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 1535CA0D;
 Wed, 22 Oct 2014 15:34:55 +0000 (UTC)
Received: from [73.34.117.227] (helo=ilsoft.org)
 by mho-02-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256)
 (Exim 4.72) (envelope-from )
 id 1Xgxw0-000GVl-V9; Wed, 22 Oct 2014 15:34:49 +0000
Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240])
 by ilsoft.org (8.14.9/8.14.9) with ESMTP id s9MFYlEr065775;
 Wed, 22 Oct 2014 09:34:47 -0600 (MDT) (envelope-from ian@FreeBSD.org)
X-Mail-Handler: Dyn Standard SMTP by Dyn
X-Originating-IP: 73.34.117.227
X-Report-Abuse-To: abuse@dyndns.com (see
 http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse
 reporting information)
X-MHO-User: U2FsdGVkX18G2GRRiDn9pPSKqPgeI0D8
X-Authentication-Warning: paranoia.hippie.lan: Host revolution.hippie.lan
 [172.22.42.240] claimed to be [172.22.42.240]
Subject: Re: svn commit: r273417 - head
From: Ian Lepore 
To: Benjamin Kaduk 
In-Reply-To: 
References: <201410212029.s9LKThT2074337@svn.freebsd.org>
 <86d29k28wh.fsf@nine.des.no>
 <22788EC4-3BDF-40F3-ACAC-FA686ED21154@bsdimp.com>
 <86iojco2oh.fsf@nine.des.no>
 <6287010D-9C54-4167-9784-84134080A419@bsdimp.com>
 <86mw8ocftw.fsf@nine.des.no>
 
Content-Type: text/plain; charset="ISO-8859-1"
Date: Wed, 22 Oct 2014 09:34:46 -0600
Message-ID: <1413992086.12052.548.camel@revolution.hippie.lan>
Mime-Version: 1.0
X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port 
Content-Transfer-Encoding: quoted-printable
X-MIME-Autoconverted: from 8bit to quoted-printable by ilsoft.org id
 s9MFYlEr065775
Cc: "svn-src-head@freebsd.org" ,
 Dag-Erling =?ISO-8859-1?Q?Sm=F8rgrav?= ,
 "svn-src-all@freebsd.org" ,
 src-committers , Warner Losh 
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 15:34:56 -0000

On Wed, 2014-10-22 at 11:00 -0400, Benjamin Kaduk wrote:
> On Wed, Oct 22, 2014 at 10:57 AM, Dag-Erling Sm=F8rgrav  wr=
ote:
>=20
> > Is _SUPPORT magic?  I didn't know.  I guess MK_TESTS_SUPPORT is good
> > enough, especially if it's on by default.
>=20
>=20
> Even if it is magic, is that really the kind of magic we want to be kee=
ping
> around?
>=20
> -Ben

I didn't really think of it as magic so much as analogous to INVARIANTS
vs INVARIANTS_SUPPORT in kernel config.

-- Ian



From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 15:37:33 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 7B5466C3;
 Wed, 22 Oct 2014 15:37:33 +0000 (UTC)
Received: from mail-pd0-x22a.google.com (mail-pd0-x22a.google.com
 [IPv6:2607:f8b0:400e:c02::22a])
 (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits))
 (Client CN "smtp.gmail.com",
 Issuer "Google Internet Authority G2" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 3DF17A35;
 Wed, 22 Oct 2014 15:37:33 +0000 (UTC)
Received: by mail-pd0-f170.google.com with SMTP id z10so3762573pdj.1
 for ; Wed, 22 Oct 2014 08:37:32 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=mime-version:in-reply-to:references:date:message-id:subject:from:to
 :cc:content-type;
 bh=WnTsoWhQEyHnDEzuddaW1UO5JBSTDlaBcJM5o4zuPiU=;
 b=GyY2+Y91Y+zO1YMULBK5Th7xiprMQxvoOlvbawH8tKizg6yWkayQa/xwGXQJJHkqem
 eOWv0+nhEX52wNOZJPhDsF99cFDHCHoY6VXnzZGL0YWL0Lm0zrcQbKdmArRnxNerlLyX
 NAnVssQ2ZA2LGae07QUnJlBvoZHwxOcPTI6MhYupicGYA8+SoJaUXkoqGXOC6IOyqW48
 pYVKeLFICtv5xVUNmtnLvkTevHnk4yFc7P/2Pq4tVSLIkj/tF6DIev0UUFtgOGZX6swi
 6CKk2ifZnVBfRwLZ/dtdwEuFg6bbQC1S53za1W9ZypKQi2ZWls0LZK4030CyEqDkXMHF
 yVcw==
MIME-Version: 1.0
X-Received: by 10.66.66.167 with SMTP id g7mr43773201pat.66.1413992252915;
 Wed, 22 Oct 2014 08:37:32 -0700 (PDT)
Received: by 10.70.9.132 with HTTP; Wed, 22 Oct 2014 08:37:32 -0700 (PDT)
In-Reply-To: <1413992086.12052.548.camel@revolution.hippie.lan>
References: <201410212029.s9LKThT2074337@svn.freebsd.org>
 <86d29k28wh.fsf@nine.des.no>
 <22788EC4-3BDF-40F3-ACAC-FA686ED21154@bsdimp.com>
 <86iojco2oh.fsf@nine.des.no>
 <6287010D-9C54-4167-9784-84134080A419@bsdimp.com>
 <86mw8ocftw.fsf@nine.des.no>
 
 <1413992086.12052.548.camel@revolution.hippie.lan>
Date: Wed, 22 Oct 2014 11:37:32 -0400
Message-ID: 
Subject: Re: svn commit: r273417 - head
From: Benjamin Kaduk 
To: Ian Lepore 
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1
Cc: "svn-src-head@freebsd.org" ,
 "svn-src-all@freebsd.org" ,
 src-committers , Warner Losh 
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 15:37:33 -0000

On Wed, Oct 22, 2014 at 11:34 AM, Ian Lepore  wrote:

> On Wed, 2014-10-22 at 11:00 -0400, Benjamin Kaduk wrote:
> > On Wed, Oct 22, 2014 at 10:57 AM, Dag-Erling Sm=C3=B8rgrav 
> wrote:
> >
> > > Is _SUPPORT magic?  I didn't know.  I guess MK_TESTS_SUPPORT is good
> > > enough, especially if it's on by default.
> >
> >
> > Even if it is magic, is that really the kind of magic we want to be
> keeping
> > around?
> >
> > -Ben
>
> I didn't really think of it as magic so much as analogous to INVARIANTS
> vs INVARIANTS_SUPPORT in kernel config.
>

I can put INVARIANTS but not INVARIANTS_SUPPORT in my kernel config ... and
it gives me a somewhat inscrutable build error.  I didn't get the
impression that's what's going on with MK_TESTS...

-Ben

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 16:39:39 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 8E83D470
 for ; Wed, 22 Oct 2014 16:39:39 +0000 (UTC)
Received: from mail-pa0-f41.google.com (mail-pa0-f41.google.com
 [209.85.220.41])
 (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits))
 (Client CN "smtp.gmail.com",
 Issuer "Google Internet Authority G2" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 5A4F516D
 for ; Wed, 22 Oct 2014 16:39:39 +0000 (UTC)
Received: by mail-pa0-f41.google.com with SMTP id rd3so2042980pab.28
 for ; Wed, 22 Oct 2014 09:39:38 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:sender:content-type:mime-version:subject:from
 :in-reply-to:date:cc:message-id:references:to;
 bh=3+ux8ZSz7IquOYVSr2XrpQpyJoG8YhoRBVnc0PLKEKw=;
 b=lw+cZbWW4EtJUjwIW+vPp0YKX4SxxO5qWOkAp45+zdKMuXtlXuOfhFKgK+Yb6+Okgq
 t3g2gqkVmkQ0sOP/B/OEBrG1UPVCd5M6lvhS8JpktcCHCGPiGXeTobH//TvCAF1pO143
 bl64LwKxi+O+6YGtgbbcXOfX7JB0Txy1ZaYE20DwllVegtUcz+pml/xAHGTbAW8eXng2
 tpIFmYksm+CT28a3Xd+raBvkjpSDj6wjzFaGBsNMCBaUge37JdyB3aq59Xc4aNc27NxR
 9+ZXnS22lYbiLiIQEq9n8lurhUJeDdG7TI83rNevpU5JeSF2BBHLDefQl2ntnaPtlSyc
 x/uw==
X-Gm-Message-State: ALoCoQkdsoLIK5uRDYOxFiAIkYjIt7EkjLKC7ryC9AfEzeZ2rnyV6bpvLl6/e+j0XqeqmrcHy1MH
X-Received: by 10.70.109.139 with SMTP id hs11mr24129565pdb.83.1413995978305; 
 Wed, 22 Oct 2014 09:39:38 -0700 (PDT)
Received: from macintosh-c42c033c0b73.corp.netflix.com (dc1-prod.netflix.com.
 [69.53.236.251])
 by mx.google.com with ESMTPSA id wr8sm14596553pbc.52.2014.10.22.09.39.36
 for 
 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
 Wed, 22 Oct 2014 09:39:37 -0700 (PDT)
Sender: Warner Losh 
Content-Type: multipart/signed;
 boundary="Apple-Mail=_686944A9-1466-4C08-B7C8-5669BA822739";
 protocol="application/pgp-signature"; micalg=pgp-sha512
Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\))
Subject: Re: svn commit: r273417 - head
From: Warner Losh 
In-Reply-To: <86mw8ocftw.fsf@nine.des.no>
Date: Wed, 22 Oct 2014 10:39:33 -0600
Message-Id: <37EBD040-32F3-4096-B036-E93B51FCDBBD@bsdimp.com>
References: <201410212029.s9LKThT2074337@svn.freebsd.org>
 <86d29k28wh.fsf@nine.des.no>
 <22788EC4-3BDF-40F3-ACAC-FA686ED21154@bsdimp.com>
 <86iojco2oh.fsf@nine.des.no>
 <6287010D-9C54-4167-9784-84134080A419@bsdimp.com>
 <86mw8ocftw.fsf@nine.des.no>
To: =?iso-8859-1?Q?Dag-Erling_Sm=F8rgrav?= 
X-Mailer: Apple Mail (2.1878.6)
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
 src-committers 
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 16:39:39 -0000


--Apple-Mail=_686944A9-1466-4C08-B7C8-5669BA822739
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=windows-1252


On Oct 22, 2014, at 8:57 AM, Dag-Erling Sm=F8rgrav  wrote:

> Warner Losh  writes:
>> Dag-Erling Sm=F8rgrav  writes:
>>> I would prefer calling this MK_ATF than MK_TESTS_SUPPORT, though.
>>> The test framework is probably useful on its own.
>> That would be a nicer name, but then we=92d lose the automatic =
setting
>> when MK_TESTS is enabled (unless we add another special case, which =
is
>> the opposite direction that I want to go in). How strongly do you =
feel
>> that=92s a better name?
>=20
> Is _SUPPORT magic?  I didn't know.  I guess MK_TESTS_SUPPORT is good
> enough, especially if it's on by default.

It is magic.  Though one can replicate similar magic with MK_TESTS and =
MK_ATF
if one wanted to do so (there=92s a second list of defaults based on =
settings that have
unrelated names), though that list is much smaller and used in much more =
obscure
areas of the system.

Warner


--Apple-Mail=_686944A9-1466-4C08-B7C8-5669BA822739
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP using GPGMail

-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - https://gpgtools.org

iQIcBAEBCgAGBQJUR93FAAoJEGwc0Sh9sBEAmMIP/28CtvJpbHmSxaHSti+ZXvHW
pB7uxlUVFDWq84qY9OQXSwsBNx4oSHnZUc9Q9p+f8WYLJ1j5/4Q63mPA+yxA8aPq
/L/o5IS/D/asbYTKqzaCYfSlE9tDCzshDHgrGl1WJjFckw6NvW0p4MH0/ZFJIEO+
jPgarWruiurxPRybjY8mlX7ZwcJEpkclGcH9aVHsIxFy5ZpBC+3UfrwyFjm1lUhU
bPmlXlGzLi14cSuWvRDqhyBx9+N33/KRzSE+DX4V78oj7uaU+kJ4Z3qVzdRt5pfB
+D+KgJgWrc1uLB9hIpUCLWTjczFJTp0mrB7oeBxa5dZreglF+5bomMP1iVFeY0mJ
Ycr0VqCz8SSyOncqODD11iNhZkxgELdX3SA58L2FUFL8JuXCr/L8DR6X30z2KVC8
qkZjhfg5vimbXitF8jUyNfdAv3lne5QciAgpYzebXQF6f3zxTZ8ZFkB3wBJerbVN
1OfaLeHR+puZL46DH5Igzh90Lf1eHCcCzRir8PJVG7kYO6skHB4MJ5aoyYfLJJhL
hD0ZBvGd+GLhlsKFbx7x2EXeYrsLufm3WcTxNlsLzn1p2ODjjhGK3vPotqdC8gnb
ExexFfXJYJASZryic3IZhlSoqi8w+Zb5ni7cfKJr/6Hj3MKge9bpdwy8aBUxX9Qh
S70P3fLoUfbrYMMcWa22
=8RsM
-----END PGP SIGNATURE-----

--Apple-Mail=_686944A9-1466-4C08-B7C8-5669BA822739--

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 16:42:57 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 7EE557EA
 for ; Wed, 22 Oct 2014 16:42:57 +0000 (UTC)
Received: from mail-pd0-f171.google.com (mail-pd0-f171.google.com
 [209.85.192.171])
 (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits))
 (Client CN "smtp.gmail.com",
 Issuer "Google Internet Authority G2" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 3DC83233
 for ; Wed, 22 Oct 2014 16:42:56 +0000 (UTC)
Received: by mail-pd0-f171.google.com with SMTP id ft15so3846341pdb.2
 for ; Wed, 22 Oct 2014 09:42:50 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:sender:content-type:mime-version:subject:from
 :in-reply-to:date:cc:message-id:references:to;
 bh=IjZYzXCQjMl8oyI2tn4PXeln+f8v+UEAKeosrIYo3UU=;
 b=HUrFu/HUTE8TUY7EKTjZZW5b4XkEPSaGS/K6aQ+fnQmiy33/gtMjkB0YDxZWsQnEFI
 zVX4LF+UxOC15j8XEYaiStEu3dIJR+ye/n+c7LxB0tULMCC/+eymuLSeHyvhyVRKs7zV
 s95PSwtmU0ZxMPviOMK+W9o0cEhIu/gFwGRCz+WHX3gXSJJj7POOtrDj9FvywPnE+go7
 /GSwVyCSHipc3bx13V7ewuaIZ9y14cWIZzThEuVXOb4JBvOr9zHQqEMOHp1Fbsy8FAr9
 qP92Qqv22wJ49uXsdKUO4njS8DiQ64G9XuRrYUHM7oYMsz0ZDAui1Sv5tMj7ExDna0C2
 Jzfw==
X-Gm-Message-State: ALoCoQk6FNOZxD4zsRojk81AYz3VLNq6W0UUKQchZVK3T26rzbXhcN4XaAlpB0P0+IvVP0aCGNuK
X-Received: by 10.70.65.37 with SMTP id u5mr43590455pds.93.1413996170034;
 Wed, 22 Oct 2014 09:42:50 -0700 (PDT)
Received: from macintosh-c42c033c0b73.corp.netflix.com (dc1-prod.netflix.com.
 [69.53.236.251])
 by mx.google.com with ESMTPSA id df1sm14637176pbb.2.2014.10.22.09.42.48
 for 
 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
 Wed, 22 Oct 2014 09:42:49 -0700 (PDT)
Sender: Warner Losh 
Content-Type: multipart/signed;
 boundary="Apple-Mail=_4CE33535-E98D-46AA-82B4-1FC49EA960BA";
 protocol="application/pgp-signature"; micalg=pgp-sha512
Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\))
Subject: Re: svn commit: r273417 - head
From: Warner Losh 
In-Reply-To: 
Date: Wed, 22 Oct 2014 10:42:45 -0600
Message-Id: <0B9A1629-8DE1-4798-B4C7-8CE4A02C187F@bsdimp.com>
References: <201410212029.s9LKThT2074337@svn.freebsd.org>
 <86d29k28wh.fsf@nine.des.no>
 <22788EC4-3BDF-40F3-ACAC-FA686ED21154@bsdimp.com>
 <86iojco2oh.fsf@nine.des.no>
 <6287010D-9C54-4167-9784-84134080A419@bsdimp.com>
 <86mw8ocftw.fsf@nine.des.no>
 
To: Benjamin Kaduk 
X-Mailer: Apple Mail (2.1878.6)
Cc: "svn-src-head@freebsd.org" ,
 =?iso-8859-1?Q?Dag-Erling_Sm=F8rgrav?= ,
 "svn-src-all@freebsd.org" ,
 src-committers 
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 16:42:57 -0000


--Apple-Mail=_4CE33535-E98D-46AA-82B4-1FC49EA960BA
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=windows-1252


On Oct 22, 2014, at 9:00 AM, Benjamin Kaduk  wrote:

> On Wed, Oct 22, 2014 at 10:57 AM, Dag-Erling Sm=F8rgrav  =
wrote:
> Is _SUPPORT magic?  I didn't know.  I guess MK_TESTS_SUPPORT is good
> enough, especially if it's on by default.
>=20
> Even if it is magic, is that really the kind of magic we want to be =
keeping around?

We have it for about a dozen other areas that are very similar to this =
case:
	BZIP2 GNU INET INET6 KERBEROS KVM NETGRAPH PAM TESTS WIRELESS
It is a regularized part of the system. By contrast we have only two =
cases where the names
aren=92t related in a regular way:
    GSSAPI/KERBEROS MAN_UTILS/MAN

So if you=92d like to propose a better framework for dealing, please be =
my guest. Hell, I may
even support that because I didn=92t come up with the current system. =
However, inventing
something new vs using the current convention dictates that we follow =
the current conventions.

Warner


--Apple-Mail=_4CE33535-E98D-46AA-82B4-1FC49EA960BA
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP using GPGMail

-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - https://gpgtools.org

iQIcBAEBCgAGBQJUR96FAAoJEGwc0Sh9sBEAYmIQAJTbmHRPYgbtEEsqETRfgzow
Tg6+ToQyfcAZCq9azeaFwxx7j7nlJvl7hR/irw/wWOJK0UXcjvqsYJFovKVH1nkQ
mkQHn+WcRgyQvK+tyqbWhjxH8WpVnLLXQaOuRff7/ph9P2OS+pKSmzNnPdY7Hwkk
n5VMoK65F5wBkp8G/kalpMIk+jGfohNFiSnb4e+DwYv/O68n7hWmCzxrPGFFW0Mi
gHT+4777VWp/jRC8ITWMyXU/Rh8VWHmxEdyJBUldUKJq7BI9QbP5ZW5Ir442V6oO
DOq4Ncf7amSQq10jSHA1Jg8TBmGLmSOyicjq00o4lM4DGg8wwiHq4/3hTiw200ho
uam2BKak0ncnaFU4yNT7q3YDQ8Uly0Zs/xCeHUIAwkd7bz4k1HyDWLGaVN8o1Jdl
nmqEA/3MBMbU+VzDFYBmKw4KjESh5klsLbiVIcXCB03we9WA/kelbbyvDnMMwI/g
R8l3NB332rAPa3vBNdj+Kfp8QOb1iO1EmctWCQUeu5/LI56nnxbCFA/B/oELXGiE
y9qWyN1tDNswzoWmK30MoauRCvTtuJqHZCcfqfZOpI4E+71HAamILrzFubsCYuNx
iIiNYup+sR0sX2E2h478oyDbBNylZgbPh3TvF3J7uCi/+d3Fn7xwideBJDkBu4Qh
tIvg2A0xe05zpSAoAkh1
=eoFX
-----END PGP SIGNATURE-----

--Apple-Mail=_4CE33535-E98D-46AA-82B4-1FC49EA960BA--

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 16:49:01 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id B87F292A;
 Wed, 22 Oct 2014 16:49:01 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id A51DE281;
 Wed, 22 Oct 2014 16:49:01 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MGn1s8050313;
 Wed, 22 Oct 2014 16:49:01 GMT (envelope-from royger@FreeBSD.org)
Received: (from royger@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MGn1Sf050311;
 Wed, 22 Oct 2014 16:49:01 GMT (envelope-from royger@FreeBSD.org)
Message-Id: <201410221649.s9MGn1Sf050311@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: royger set sender to
 royger@FreeBSD.org using -f
From: Roger Pau Monné 
Date: Wed, 22 Oct 2014 16:49:01 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273472 - head/sys/x86/xen
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 16:49:01 -0000

Author: royger
Date: Wed Oct 22 16:49:00 2014
New Revision: 273472
URL: https://svnweb.freebsd.org/changeset/base/273472

Log:
  xen: fix usage of kern_getenv in PVH code
  
  The value returned by kern_getenv should be freed using freeenv.
  
  Reported by:	Coverity
  CID:		1248852
  Sponsored by: Citrix Systems R&D

Modified:
  head/sys/x86/xen/pv.c

Modified: head/sys/x86/xen/pv.c
==============================================================================
--- head/sys/x86/xen/pv.c	Wed Oct 22 13:50:38 2014	(r273471)
+++ head/sys/x86/xen/pv.c	Wed Oct 22 16:49:00 2014	(r273472)
@@ -306,11 +306,14 @@ static void
 xen_pv_set_boothowto(void)
 {
 	int i;
+	char *env;
 
 	/* get equivalents from the environment */
 	for (i = 0; howto_names[i].ev != NULL; i++) {
-		if (kern_getenv(howto_names[i].ev) != NULL)
+		if ((env = kern_getenv(howto_names[i].ev)) != NULL) {
 			boothowto |= howto_names[i].mask;
+			freeenv(env);
+		}
 	}
 }
 

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 16:51:53 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 27EDEAA3;
 Wed, 22 Oct 2014 16:51:53 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 1468F2BF;
 Wed, 22 Oct 2014 16:51:53 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MGpqoj053476;
 Wed, 22 Oct 2014 16:51:52 GMT (envelope-from royger@FreeBSD.org)
Received: (from royger@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MGpq0b053474;
 Wed, 22 Oct 2014 16:51:52 GMT (envelope-from royger@FreeBSD.org)
Message-Id: <201410221651.s9MGpq0b053474@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: royger set sender to
 royger@FreeBSD.org using -f
From: Roger Pau Monné 
Date: Wed, 22 Oct 2014 16:51:52 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273473 - in head/sys: x86/xen xen
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 16:51:53 -0000

Author: royger
Date: Wed Oct 22 16:51:52 2014
New Revision: 273473
URL: https://svnweb.freebsd.org/changeset/base/273473

Log:
  xen: allow to register event channels without handlers
  
  This is needed by the event channel user-space device, that requires
  registering event channels without unmasking them. intr_add_handler
  will unconditionally unmask the event channel, so we avoid calling it
  if no filter/handler is provided, and then the user will be in charge
  of calling it when ready.
  
  In order to do this, we need to change the opaque type
  xen_intr_handle_t to contain the event channel port instead of the
  opaque cookie returned by intr_add_handler, since now registration of
  event channels without handlers are allowed. The cookie will now be
  stored inside of the private xenisrc struct. Also, introduce a new
  function called xen_intr_add_handler that allows adding a
  filter/handler after the event channel has been registered.
  
  Sponsored by: Citrix Systems R&D
  
  x86/xen/xen_intr.c:
   - Leave the event channel without a handler if no filter/handler is
     provided to xen_intr_bind_isrc.
   - Don't perform an evtchn_mask_port, intr_add_handler will already do
     it.
   - Change the opaque type xen_intr_handle_t to contain a pointer to
     the event channel port number, and make the necessary changes to
     related functions.
   - Introduce a new function called xen_intr_add_handler that can be
     used to add filter/handlers to an event channel after registration.
  
  xen/xen_intr.h:
   - Add prototype of xen_intr_add_handler.

Modified:
  head/sys/x86/xen/xen_intr.c
  head/sys/xen/xen_intr.h

Modified: head/sys/x86/xen/xen_intr.c
==============================================================================
--- head/sys/x86/xen/xen_intr.c	Wed Oct 22 16:49:00 2014	(r273472)
+++ head/sys/x86/xen/xen_intr.c	Wed Oct 22 16:51:52 2014	(r273473)
@@ -110,10 +110,11 @@ DPCPU_DEFINE(struct xen_intr_pcpu_data, 
 
 DPCPU_DECLARE(struct vcpu_info *, vcpu_info);
 
-#define is_valid_evtchn(x)	((x) != 0)
-
 #define	XEN_EEXIST		17 /* Xen "already exists" error */
 #define	XEN_ALLOCATE_VECTOR	0 /* Allocate a vector for this event channel */
+#define	XEN_INVALID_EVTCHN	0 /* Invalid event channel */
+
+#define	is_valid_evtchn(x)	((x) != XEN_INVALID_EVTCHN)
 
 struct xenisrc {
 	struct intsrc	xi_intsrc;
@@ -123,6 +124,7 @@ struct xenisrc {
 	evtchn_port_t	xi_port;
 	int		xi_pirq;
 	int		xi_virq;
+	void		*xi_cookie;
 	u_int		xi_close:1;	/* close on unbind? */
 	u_int		xi_shared:1;	/* Shared with other domains. */
 	u_int		xi_activehi:1;
@@ -365,6 +367,7 @@ xen_intr_release_isrc(struct xenisrc *is
 	isrc->xi_cpu = 0;
 	isrc->xi_type = EVTCHN_TYPE_UNBOUND;
 	isrc->xi_port = 0;
+	isrc->xi_cookie = NULL;
 	mtx_unlock(&xen_intr_isrc_lock);
 	return (0);
 }
@@ -419,17 +422,26 @@ xen_intr_bind_isrc(struct xenisrc **isrc
 	xen_intr_port_to_isrc[local_port] = isrc;
 	mtx_unlock(&xen_intr_isrc_lock);
 
-	error = intr_add_handler(device_get_nameunit(intr_owner),
-				 isrc->xi_vector, filter, handler, arg,
-				 flags|INTR_EXCL, port_handlep);
+	/* Assign the opaque handler (the event channel port) */
+	*port_handlep = &isrc->xi_port;
+
+	if (filter == NULL && handler == NULL) {
+		/*
+		 * No filter/handler provided, leave the event channel
+		 * masked and without a valid handler, the caller is
+		 * in charge of setting that up.
+		 */
+		*isrcp = isrc;
+		return (0);
+	}
+
+	error = xen_intr_add_handler(intr_owner, filter, handler, arg, flags,
+	    *port_handlep);
 	if (error != 0) {
-		device_printf(intr_owner,
-			      "xen_intr_bind_irq: intr_add_handler failed\n");
 		xen_intr_release_isrc(isrc);
 		return (error);
 	}
 	*isrcp = isrc;
-	evtchn_unmask_port(local_port);
 	return (0);
 }
 
@@ -446,13 +458,16 @@ xen_intr_bind_isrc(struct xenisrc **isrc
 static struct xenisrc *
 xen_intr_isrc(xen_intr_handle_t handle)
 {
-	struct intr_handler *ih;
+	evtchn_port_t port;
+
+	if (handle == NULL)
+		return (NULL);
 
-	ih = handle;
-	if (ih == NULL || ih->ih_event == NULL)
+	port = *(evtchn_port_t *)handle;
+	if (!is_valid_evtchn(port) || port >= NR_EVENT_CHANNELS)
 		return (NULL);
 
-	return (ih->ih_event->ie_source);
+	return (xen_intr_port_to_isrc[port]);
 }
 
 /**
@@ -1446,22 +1461,24 @@ xen_intr_describe(xen_intr_handle_t port
 	va_start(ap, fmt);
 	vsnprintf(descr, sizeof(descr), fmt, ap);
 	va_end(ap);
-	return (intr_describe(isrc->xi_vector, port_handle, descr));
+	return (intr_describe(isrc->xi_vector, isrc->xi_cookie, descr));
 }
 
 void
 xen_intr_unbind(xen_intr_handle_t *port_handlep)
 {
-	struct intr_handler *handler;
 	struct xenisrc *isrc;
 
-	handler = *port_handlep;
+	KASSERT(port_handlep != NULL,
+	    ("NULL xen_intr_handle_t passed to xen_intr_unbind"));
+
+	isrc = xen_intr_isrc(*port_handlep);
 	*port_handlep = NULL;
-	isrc = xen_intr_isrc(handler);
 	if (isrc == NULL)
 		return;
 
-	intr_remove_handler(handler);
+	if (isrc->xi_cookie != NULL)
+		intr_remove_handler(isrc->xi_cookie);
 	xen_intr_release_isrc(isrc);
 }
 
@@ -1492,6 +1509,29 @@ xen_intr_port(xen_intr_handle_t handle)
 	return (isrc->xi_port);
 }
 
+int
+xen_intr_add_handler(device_t dev, driver_filter_t filter,
+    driver_intr_t handler, void *arg, enum intr_type flags,
+    xen_intr_handle_t handle)
+{
+	struct xenisrc *isrc;
+	int error;
+
+	isrc = xen_intr_isrc(handle);
+	if (isrc == NULL || isrc->xi_cookie != NULL)
+		return (EINVAL);
+
+	error = intr_add_handler(device_get_nameunit(dev), isrc->xi_vector,
+	    filter, handler, arg, flags|INTR_EXCL, &isrc->xi_cookie);
+	if (error != 0) {
+		device_printf(dev,
+		    "xen_intr_add_handler: intr_add_handler failed: %d\n",
+		    error);
+	}
+
+	return (error);
+}
+
 #ifdef DDB
 static const char *
 xen_intr_print_type(enum evtchn_type type)

Modified: head/sys/xen/xen_intr.h
==============================================================================
--- head/sys/xen/xen_intr.h	Wed Oct 22 16:49:00 2014	(r273472)
+++ head/sys/xen/xen_intr.h	Wed Oct 22 16:51:52 2014	(r273473)
@@ -246,4 +246,23 @@ int xen_register_msi(device_t dev, int v
  */
 int xen_release_msi(int vector);
 
+/**
+ * Bind an event channel port with a handler
+ *
+ * \param dev       The device making this bind request.
+ * \param filter    An interrupt filter handler.  Specify NULL
+ *                  to always dispatch to the ithread handler.
+ * \param handler   An interrupt ithread handler.  Optional (can
+ *                  specify NULL) if all necessary event actions
+ *                  are performed by filter.
+ * \param arg       Argument to present to both filter and handler.
+ * \param irqflags  Interrupt handler flags.  See sys/bus.h.
+ * \param handle    Opaque handle used to manage this registration.
+ *
+ * \returns  0 on success, otherwise an errno.
+ */
+int xen_intr_add_handler(device_t dev, driver_filter_t filter,
+	driver_intr_t handler, void *arg, enum intr_type flags,
+	xen_intr_handle_t handle);
+
 #endif /* _XEN_INTR_H_ */

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 16:57:12 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 41DEBC83;
 Wed, 22 Oct 2014 16:57:12 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 2CEB939F;
 Wed, 22 Oct 2014 16:57:12 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MGvCs4054780;
 Wed, 22 Oct 2014 16:57:12 GMT (envelope-from royger@FreeBSD.org)
Received: (from royger@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MGvBES054777;
 Wed, 22 Oct 2014 16:57:11 GMT (envelope-from royger@FreeBSD.org)
Message-Id: <201410221657.s9MGvBES054777@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: royger set sender to
 royger@FreeBSD.org using -f
From: Roger Pau Monné 
Date: Wed, 22 Oct 2014 16:57:11 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273474 - in head/sys: conf dev/xen/evtchn xen/evtchn
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 16:57:12 -0000

Author: royger
Date: Wed Oct 22 16:57:11 2014
New Revision: 273474
URL: https://svnweb.freebsd.org/changeset/base/273474

Log:
  xen: import a proper event channel user-space device
  
  The user-space event channel device is used by applications to receive
  and send event channel interrupts. This device is based on the Linux
  evtchn device.
  
  Sponsored by: Citrix Systems R&D
  
  xen/evtchn/evtchn_dev.c:
   - Remove the old event channel device, which was already disabled in
     the build system.
  
  dev/xen/evtchn/evtchn_dev.c:
   - Import a new event channel device based on the one present in
     Linux.
   - This device allows the following operations:
     - Bind VIRQ event channels (ioctl).
     - Bind regular event channels (ioctl).
     - Create and bind new event channels (ioctl).
     - Unbind event channels (ioctl).
     - Send notifications to event channels (ioctl).
     - Reset the device shared memory ring (ioctl).
     - Unmask event channels (write).
     - Receive event channel upcalls (read).
   - The new code is MP safe, and can be used concurrently.
  
  conf/files:
   - Add the new device to the build system.

Added:
  head/sys/dev/xen/evtchn/
  head/sys/dev/xen/evtchn/evtchn_dev.c   (contents, props changed)
Deleted:
  head/sys/xen/evtchn/evtchn_dev.c
Modified:
  head/sys/conf/files

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files	Wed Oct 22 16:51:52 2014	(r273473)
+++ head/sys/conf/files	Wed Oct 22 16:57:11 2014	(r273474)
@@ -2647,6 +2647,7 @@ dev/xen/pvcpu/pvcpu.c		optional xen | xe
 dev/xen/xenstore/xenstore.c	optional xen | xenhvm
 dev/xen/xenstore/xenstore_dev.c	optional xen | xenhvm
 dev/xen/xenstore/xenstored_dev.c	optional xen | xenhvm
+dev/xen/evtchn/evtchn_dev.c	optional xen | xenhvm
 dev/xl/if_xl.c			optional xl pci
 dev/xl/xlphy.c			optional xl pci
 fs/autofs/autofs.c		optional autofs

Added: head/sys/dev/xen/evtchn/evtchn_dev.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/dev/xen/evtchn/evtchn_dev.c	Wed Oct 22 16:57:11 2014	(r273474)
@@ -0,0 +1,607 @@
+/******************************************************************************
+ * evtchn.c
+ *
+ * Driver for receiving and demuxing event-channel signals.
+ *
+ * Copyright (c) 2004-2005, K A Fraser
+ * Multi-process extensions Copyright (c) 2004, Steven Smith
+ * FreeBSD port Copyright (c) 2014, Roger Pau Monné
+ * Fetched from git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
+ * File: drivers/xen/evtchn.c
+ * Git commit: 0dc0064add422bc0ef5165ebe9ece3052bbd457d
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this source file (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+
+MALLOC_DEFINE(M_EVTCHN, "evtchn_dev", "Xen event channel user-space device");
+
+struct user_evtchn;
+
+static int evtchn_cmp(struct user_evtchn *u1, struct user_evtchn *u2);
+
+RB_HEAD(evtchn_tree, user_evtchn);
+
+struct per_user_data {
+	struct mtx bind_mutex; /* serialize bind/unbind operations */
+	struct evtchn_tree evtchns;
+
+	/* Notification ring, accessed via /dev/xen/evtchn. */
+#define EVTCHN_RING_SIZE     (PAGE_SIZE / sizeof(evtchn_port_t))
+#define EVTCHN_RING_MASK(_i) ((_i)&(EVTCHN_RING_SIZE-1))
+	evtchn_port_t *ring;
+	unsigned int ring_cons, ring_prod, ring_overflow;
+	struct sx ring_cons_mutex; /* protect against concurrent readers */
+	struct mtx ring_prod_mutex; /* product against concurrent interrupts */
+	struct selinfo ev_rsel;
+};
+
+struct user_evtchn {
+	RB_ENTRY(user_evtchn) node;
+	struct per_user_data *user;
+	evtchn_port_t port;
+	xen_intr_handle_t handle;
+	bool enabled;
+};
+
+RB_GENERATE_STATIC(evtchn_tree, user_evtchn, node, evtchn_cmp);
+
+static device_t evtchn_dev;
+
+static d_read_t      evtchn_read;
+static d_write_t     evtchn_write;
+static d_ioctl_t     evtchn_ioctl;
+static d_poll_t      evtchn_poll;
+static d_open_t      evtchn_open;
+
+static void evtchn_release(void *arg);
+
+static struct cdevsw evtchn_devsw = {
+	.d_version = D_VERSION,
+	.d_open = evtchn_open,
+	.d_read = evtchn_read,
+	.d_write = evtchn_write,
+	.d_ioctl = evtchn_ioctl,
+	.d_poll = evtchn_poll,
+	.d_name = "evtchn",
+};
+
+/*------------------------- Red-black tree helpers ---------------------------*/
+static int
+evtchn_cmp(struct user_evtchn *u1, struct user_evtchn *u2)
+{
+
+	return (u1->port - u2->port);
+}
+
+static struct user_evtchn *
+find_evtchn(struct per_user_data *u, evtchn_port_t port)
+{
+	struct user_evtchn tmp = {
+		.port = port,
+	};
+
+	return (RB_FIND(evtchn_tree, &u->evtchns, &tmp));
+}
+
+/*--------------------------- Interrupt handlers -----------------------------*/
+static int
+evtchn_filter(void *arg)
+{
+	struct user_evtchn *evtchn;
+
+	evtchn = arg;
+
+	if (!evtchn->enabled && bootverbose) {
+		device_printf(evtchn_dev,
+		    "Received upcall for disabled event channel %d\n",
+		    evtchn->port);
+	}
+
+	evtchn_mask_port(evtchn->port);
+	evtchn->enabled = false;
+
+	return (FILTER_SCHEDULE_THREAD);
+}
+
+static void
+evtchn_interrupt(void *arg)
+{
+	struct user_evtchn *evtchn;
+	struct per_user_data *u;
+
+	evtchn = arg;
+	u = evtchn->user;
+
+	/*
+	 * Protect against concurrent events using this handler
+	 * on different CPUs.
+	 */
+	mtx_lock(&u->ring_prod_mutex);
+	if ((u->ring_prod - u->ring_cons) < EVTCHN_RING_SIZE) {
+		u->ring[EVTCHN_RING_MASK(u->ring_prod)] = evtchn->port;
+		wmb(); /* Ensure ring contents visible */
+		if (u->ring_cons == u->ring_prod++) {
+			wakeup(u);
+			selwakeup(&u->ev_rsel);
+		}
+	} else
+		u->ring_overflow = 1;
+	mtx_unlock(&u->ring_prod_mutex);
+}
+
+/*------------------------- Character device methods -------------------------*/
+static int
+evtchn_open(struct cdev *dev, int flag, int otyp, struct thread *td)
+{
+	struct per_user_data *u;
+	int error;
+
+	u = malloc(sizeof(*u), M_EVTCHN, M_WAITOK | M_ZERO);
+	u->ring = malloc(PAGE_SIZE, M_EVTCHN, M_WAITOK | M_ZERO);
+
+	/* Initialize locks */
+	mtx_init(&u->bind_mutex, "evtchn_bind_mutex", NULL, MTX_DEF);
+	sx_init(&u->ring_cons_mutex, "evtchn_ringc_sx");
+	mtx_init(&u->ring_prod_mutex, "evtchn_ringp_mutex", NULL, MTX_DEF);
+
+	/* Initialize red-black tree. */
+	RB_INIT(&u->evtchns);
+
+	/* Assign the allocated per_user_data to this open instance. */
+	error = devfs_set_cdevpriv(u, evtchn_release);
+	if (error != 0) {
+		mtx_destroy(&u->bind_mutex);
+		mtx_destroy(&u->ring_prod_mutex);
+		sx_destroy(&u->ring_cons_mutex);
+		free(u->ring, M_EVTCHN);
+		free(u, M_EVTCHN);
+	}
+
+	return (error);
+}
+
+static void
+evtchn_release(void *arg)
+{
+	struct per_user_data *u;
+	struct user_evtchn *evtchn, *tmp;
+
+	u = arg;
+
+	seldrain(&u->ev_rsel);
+
+	RB_FOREACH_SAFE(evtchn, evtchn_tree, &u->evtchns, tmp) {
+		xen_intr_unbind(&evtchn->handle);
+
+		RB_REMOVE(evtchn_tree, &u->evtchns, evtchn);
+		free(evtchn, M_EVTCHN);
+	}
+
+	mtx_destroy(&u->bind_mutex);
+	mtx_destroy(&u->ring_prod_mutex);
+	sx_destroy(&u->ring_cons_mutex);
+	free(u->ring, M_EVTCHN);
+	free(u, M_EVTCHN);
+}
+
+static int
+evtchn_read(struct cdev *dev, struct uio *uio, int ioflag)
+{
+	int error, count;
+	unsigned int c, p, bytes1 = 0, bytes2 = 0;
+	struct per_user_data *u;
+
+	error = devfs_get_cdevpriv((void **)&u);
+	if (error != 0)
+		return (EINVAL);
+
+	/* Whole number of ports. */
+	count = uio->uio_resid;
+	count &= ~(sizeof(evtchn_port_t)-1);
+
+	if (count == 0)
+		return (0);
+
+	if (count > PAGE_SIZE)
+		count = PAGE_SIZE;
+
+	sx_xlock(&u->ring_cons_mutex);
+	for (;;) {
+		error = EFBIG;
+		if (u->ring_overflow)
+			goto unlock_out;
+
+		c = u->ring_cons;
+		p = u->ring_prod;
+		if (c != p)
+			break;
+
+		if (ioflag & IO_NDELAY) {
+			sx_xunlock(&u->ring_cons_mutex);
+			return (EWOULDBLOCK);
+		}
+
+		error = sx_sleep(u, &u->ring_cons_mutex, PCATCH, "evtchw", 0);
+		if ((error != 0) && (error != EWOULDBLOCK))
+			return (error);
+	}
+
+	/* Byte lengths of two chunks. Chunk split (if any) is at ring wrap. */
+	if (((c ^ p) & EVTCHN_RING_SIZE) != 0) {
+		bytes1 = (EVTCHN_RING_SIZE - EVTCHN_RING_MASK(c)) *
+		    sizeof(evtchn_port_t);
+		bytes2 = EVTCHN_RING_MASK(p) * sizeof(evtchn_port_t);
+	} else {
+		bytes1 = (p - c) * sizeof(evtchn_port_t);
+		bytes2 = 0;
+	}
+
+	/* Truncate chunks according to caller's maximum byte count. */
+	if (bytes1 > count) {
+		bytes1 = count;
+		bytes2 = 0;
+	} else if ((bytes1 + bytes2) > count) {
+		bytes2 = count - bytes1;
+	}
+
+	error = EFAULT;
+	rmb(); /* Ensure that we see the port before we copy it. */
+
+	if (uiomove(&u->ring[EVTCHN_RING_MASK(c)], bytes1, uio) ||
+	    ((bytes2 != 0) && uiomove(&u->ring[0], bytes2, uio)))
+		goto unlock_out;
+
+	u->ring_cons += (bytes1 + bytes2) / sizeof(evtchn_port_t);
+	error = 0;
+
+unlock_out:
+	sx_xunlock(&u->ring_cons_mutex);
+	return (error);
+}
+
+static int
+evtchn_write(struct cdev *dev, struct uio *uio, int ioflag)
+{
+	int error, i, count;
+	evtchn_port_t *kbuf;
+	struct per_user_data *u;
+
+	error = devfs_get_cdevpriv((void **)&u);
+	if (error != 0)
+		return (EINVAL);
+
+	kbuf = malloc(PAGE_SIZE, M_EVTCHN, M_WAITOK);
+	if (kbuf == NULL)
+		return (ENOMEM);
+
+	count = uio->uio_resid;
+	/* Whole number of ports. */
+	count &= ~(sizeof(evtchn_port_t)-1);
+
+	error = 0;
+	if (count == 0)
+		goto out;
+
+	if (count > PAGE_SIZE)
+		count = PAGE_SIZE;
+
+	error = uiomove(kbuf, count, uio);
+	if (error != 0)
+		goto out;
+
+	mtx_lock(&u->bind_mutex);
+
+	for (i = 0; i < (count/sizeof(evtchn_port_t)); i++) {
+		evtchn_port_t port = kbuf[i];
+		struct user_evtchn *evtchn;
+
+		evtchn = find_evtchn(u, port);
+		if (evtchn && !evtchn->enabled) {
+			evtchn->enabled = true;
+			evtchn_unmask_port(evtchn->port);
+		}
+	}
+
+	mtx_unlock(&u->bind_mutex);
+	error = 0;
+
+out:
+	free(kbuf, M_EVTCHN);
+	return (error);
+}
+
+static inline int
+evtchn_bind_user_port(struct per_user_data *u, struct user_evtchn *evtchn)
+{
+	int error;
+
+	evtchn->port = xen_intr_port(evtchn->handle);
+	evtchn->user = u;
+	evtchn->enabled = true;
+	mtx_lock(&u->bind_mutex);
+	RB_INSERT(evtchn_tree, &u->evtchns, evtchn);
+	mtx_unlock(&u->bind_mutex);
+	error = xen_intr_add_handler(evtchn_dev, evtchn_filter,
+	    evtchn_interrupt, evtchn, INTR_TYPE_MISC | INTR_MPSAFE,
+	    evtchn->handle);
+	if (error != 0) {
+		xen_intr_unbind(&evtchn->handle);
+		mtx_lock(&u->bind_mutex);
+		RB_REMOVE(evtchn_tree, &u->evtchns, evtchn);
+		mtx_unlock(&u->bind_mutex);
+		free(evtchn, M_EVTCHN);
+	}
+	return (error);
+}
+
+static int
+evtchn_ioctl(struct cdev *dev, unsigned long cmd, caddr_t arg,
+    int mode, struct thread *td __unused)
+{
+	struct per_user_data *u;
+	int error;
+
+	error = devfs_get_cdevpriv((void **)&u);
+	if (error != 0)
+		return (EINVAL);
+
+	switch (cmd) {
+	case IOCTL_EVTCHN_BIND_VIRQ: {
+		struct ioctl_evtchn_bind_virq *bind;
+		struct user_evtchn *evtchn;
+
+		evtchn = malloc(sizeof(*evtchn), M_EVTCHN, M_WAITOK | M_ZERO);
+
+		bind = (struct ioctl_evtchn_bind_virq *)arg;
+
+		error = xen_intr_bind_virq(evtchn_dev, bind->virq, 0,
+		    NULL, NULL, NULL, 0, &evtchn->handle);
+		if (error != 0) {
+			free(evtchn, M_EVTCHN);
+			break;
+		}
+		error = evtchn_bind_user_port(u, evtchn);
+		if (error != 0)
+			break;
+		bind->port = evtchn->port;
+		break;
+	}
+
+	case IOCTL_EVTCHN_BIND_INTERDOMAIN: {
+		struct ioctl_evtchn_bind_interdomain *bind;
+		struct user_evtchn *evtchn;
+
+		evtchn = malloc(sizeof(*evtchn), M_EVTCHN, M_WAITOK | M_ZERO);
+
+		bind = (struct ioctl_evtchn_bind_interdomain *)arg;
+
+		error = xen_intr_bind_remote_port(evtchn_dev,
+		    bind->remote_domain, bind->remote_port, NULL,
+		    NULL, NULL, 0, &evtchn->handle);
+		if (error != 0) {
+			free(evtchn, M_EVTCHN);
+			break;
+		}
+		error = evtchn_bind_user_port(u, evtchn);
+		if (error != 0)
+			break;
+		bind->port = evtchn->port;
+		break;
+	}
+
+	case IOCTL_EVTCHN_BIND_UNBOUND_PORT: {
+		struct ioctl_evtchn_bind_unbound_port *bind;
+		struct user_evtchn *evtchn;
+
+		evtchn = malloc(sizeof(*evtchn), M_EVTCHN, M_WAITOK | M_ZERO);
+
+		bind = (struct ioctl_evtchn_bind_unbound_port *)arg;
+
+		error = xen_intr_alloc_and_bind_local_port(evtchn_dev,
+		    bind->remote_domain, NULL, NULL, NULL, 0, &evtchn->handle);
+		if (error != 0) {
+			free(evtchn, M_EVTCHN);
+			break;
+		}
+		error = evtchn_bind_user_port(u, evtchn);
+		if (error != 0)
+			break;
+		bind->port = evtchn->port;
+		break;
+	}
+
+	case IOCTL_EVTCHN_UNBIND: {
+		struct ioctl_evtchn_unbind *unbind;
+		struct user_evtchn *evtchn;
+
+		unbind = (struct ioctl_evtchn_unbind *)arg;
+
+		mtx_lock(&u->bind_mutex);
+		evtchn = find_evtchn(u, unbind->port);
+		if (evtchn == NULL) {
+			error = ENOTCONN;
+			break;
+		}
+
+		xen_intr_unbind(&evtchn->handle);
+		RB_REMOVE(evtchn_tree, &u->evtchns, evtchn);
+		mtx_unlock(&u->bind_mutex);
+		free(evtchn, M_EVTCHN);
+		error = 0;
+		break;
+	}
+
+	case IOCTL_EVTCHN_NOTIFY: {
+		struct ioctl_evtchn_notify *notify;
+		struct user_evtchn *evtchn;
+
+		notify = (struct ioctl_evtchn_notify *)arg;
+
+		mtx_lock(&u->bind_mutex);
+		evtchn = find_evtchn(u, notify->port);
+		if (evtchn == NULL) {
+			error = ENOTCONN;
+			break;
+		}
+
+		xen_intr_signal(evtchn->handle);
+		mtx_unlock(&u->bind_mutex);
+		error = 0;
+		break;
+	}
+
+	case IOCTL_EVTCHN_RESET: {
+		/* Initialise the ring to empty. Clear errors. */
+		sx_xlock(&u->ring_cons_mutex);
+		mtx_lock(&u->ring_prod_mutex);
+		u->ring_cons = u->ring_prod = u->ring_overflow = 0;
+		mtx_unlock(&u->ring_prod_mutex);
+		sx_xunlock(&u->ring_cons_mutex);
+		error = 0;
+		break;
+	}
+
+	case FIONBIO:
+	case FIOASYNC:
+		/* Handled in an upper layer */
+		error = 0;
+		break;
+
+	default:
+		error = ENOTTY;
+		break;
+	}
+
+	return (error);
+}
+
+static int
+evtchn_poll(struct cdev *dev, int events, struct thread *td)
+{
+	struct per_user_data *u;
+	int error, mask;
+
+	error = devfs_get_cdevpriv((void **)&u);
+	if (error != 0)
+		return (POLLERR);
+
+	/* we can always write */
+	mask = events & (POLLOUT | POLLWRNORM);
+
+	mtx_lock(&u->ring_prod_mutex);
+	if (events & (POLLIN | POLLRDNORM)) {
+		if (u->ring_cons != u->ring_prod) {
+			mask |= events & (POLLIN | POLLRDNORM);
+		} else {
+			/* Record that someone is waiting */
+			selrecord(td, &u->ev_rsel);
+		}
+	}
+	mtx_unlock(&u->ring_prod_mutex);
+
+	return (mask);
+}
+
+/*------------------ Private Device Attachment Functions  --------------------*/
+static void
+evtchn_identify(driver_t *driver, device_t parent)
+{
+
+	KASSERT((xen_domain()),
+	    ("Trying to attach evtchn device on non Xen domain"));
+
+	evtchn_dev = BUS_ADD_CHILD(parent, 0, "evtchn", 0);
+	if (evtchn_dev == NULL)
+		panic("unable to attach evtchn user-space device");
+}
+
+static int
+evtchn_probe(device_t dev)
+{
+
+	device_set_desc(dev, "Xen event channel user-space device");
+	return (BUS_PROBE_NOWILDCARD);
+}
+
+static int
+evtchn_attach(device_t dev)
+{
+
+	make_dev_credf(MAKEDEV_ETERNAL, &evtchn_devsw, 0, NULL, UID_ROOT,
+	    GID_WHEEL, 0600, "xen/evtchn");
+	return (0);
+}
+
+/*-------------------- Private Device Attachment Data  -----------------------*/
+static device_method_t evtchn_methods[] = {
+	DEVMETHOD(device_identify, evtchn_identify),
+	DEVMETHOD(device_probe, evtchn_probe),
+	DEVMETHOD(device_attach, evtchn_attach),
+
+	DEVMETHOD_END
+};
+
+static driver_t evtchn_driver = {
+	"evtchn",
+	evtchn_methods,
+	0,
+};
+
+devclass_t evtchn_devclass;
+
+DRIVER_MODULE(evtchn, xenpv, evtchn_driver, evtchn_devclass, 0, 0);
+MODULE_DEPEND(evtchn, xenpv, 1, 1, 1);

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 16:58:53 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id C136ADDC;
 Wed, 22 Oct 2014 16:58:53 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id A48153B7;
 Wed, 22 Oct 2014 16:58:53 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MGwr6C055017;
 Wed, 22 Oct 2014 16:58:53 GMT (envelope-from royger@FreeBSD.org)
Received: (from royger@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MGwr0L055016;
 Wed, 22 Oct 2014 16:58:53 GMT (envelope-from royger@FreeBSD.org)
Message-Id: <201410221658.s9MGwr0L055016@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: royger set sender to
 royger@FreeBSD.org using -f
From: Roger Pau Monné 
Date: Wed, 22 Oct 2014 16:58:53 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273475 - head/sys/xen
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 16:58:53 -0000

Author: royger
Date: Wed Oct 22 16:58:52 2014
New Revision: 273475
URL: https://svnweb.freebsd.org/changeset/base/273475

Log:
  xen: add a Xen to BSD error translation
  
  Since Xen and FreeBSD error codes are completely different add a
  translation layer in order to convert Xen error codes into native
  FreeBSD error codes. This will be used by the privcmd device, which
  needs to return the hypercall errors into user-space.
  
  Sponsored by: Citrix Systems R&D
  
  xen/error.h:
   - Import Xen error codes.
   - Create a table to map Xen error codes into FreeBSD native error
     codes.
   - Create an inline function that performs the translation.

Added:
  head/sys/xen/error.h   (contents, props changed)

Added: head/sys/xen/error.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/xen/error.h	Wed Oct 22 16:58:52 2014	(r273475)
@@ -0,0 +1,305 @@
+/*-
+ * Copyright (c) 2014 Roger Pau Monné .
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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$
+ */
+
+#ifndef __XEN_ERROR_H__
+#define __XEN_ERROR_H__
+
+/* List of Xen error codes */
+#define	XEN_EPERM		 1	/* Operation not permitted */
+#define	XEN_ENOENT		 2	/* No such file or directory */
+#define	XEN_ESRCH		 3	/* No such process */
+#define	XEN_EINTR		 4	/* Interrupted system call */
+#define	XEN_EIO			 5	/* I/O error */
+#define	XEN_ENXIO		 6	/* No such device or address */
+#define	XEN_E2BIG		 7	/* Arg list too long */
+#define	XEN_ENOEXEC		 8	/* Exec format error */
+#define	XEN_EBADF		 9	/* Bad file number */
+#define	XEN_ECHILD		10	/* No child processes */
+#define	XEN_EAGAIN		11	/* Try again */
+#define	XEN_ENOMEM		12	/* Out of memory */
+#define	XEN_EACCES		13	/* Permission denied */
+#define	XEN_EFAULT		14	/* Bad address */
+#define	XEN_ENOTBLK		15	/* Block device required */
+#define	XEN_EBUSY		16	/* Device or resource busy */
+#define	XEN_EEXIST		17	/* File exists */
+#define	XEN_EXDEV		18	/* Cross-device link */
+#define	XEN_ENODEV		19	/* No such device */
+#define	XEN_ENOTDIR		20	/* Not a directory */
+#define	XEN_EISDIR		21	/* Is a directory */
+#define	XEN_EINVAL		22	/* Invalid argument */
+#define	XEN_ENFILE		23	/* File table overflow */
+#define	XEN_EMFILE		24	/* Too many open files */
+#define	XEN_ENOTTY		25	/* Not a typewriter */
+#define	XEN_ETXTBSY		26	/* Text file busy */
+#define	XEN_EFBIG		27	/* File too large */
+#define	XEN_ENOSPC		28	/* No space left on device */
+#define	XEN_ESPIPE		29	/* Illegal seek */
+#define	XEN_EROFS		30	/* Read-only file system */
+#define	XEN_EMLINK		31	/* Too many links */
+#define	XEN_EPIPE		32	/* Broken pipe */
+#define	XEN_EDOM		33	/* Math argument out of domain of func */
+#define	XEN_ERANGE		34	/* Math result not representable */
+#define	XEN_EDEADLK		35	/* Resource deadlock would occur */
+#define	XEN_ENAMETOOLONG	36	/* File name too long */
+#define	XEN_ENOLCK		37	/* No record locks available */
+#define	XEN_ENOSYS		38	/* Function not implemented */
+#define	XEN_ENOTEMPTY	 	39	/* Directory not empty */
+#define	XEN_ELOOP		40	/* Too many symbolic links encountered */
+#define	XEN_ENOMSG		42	/* No message of desired type */
+#define	XEN_EIDRM		43	/* Identifier removed */
+#define	XEN_ECHRNG		44	/* Channel number out of range */
+#define	XEN_EL2NSYNC		45	/* Level 2 not synchronized */
+#define	XEN_EL3HLT		46	/* Level 3 halted */
+#define	XEN_EL3RST		47	/* Level 3 reset */
+#define	XEN_ELNRNG		48	/* Link number out of range */
+#define	XEN_EUNATCH		49	/* Protocol driver not attached */
+#define	XEN_ENOCSI		50	/* No CSI structure available */
+#define	XEN_EL2HLT		51	/* Level 2 halted */
+#define	XEN_EBADE		52	/* Invalid exchange */
+#define	XEN_EBADR		53	/* Invalid request descriptor */
+#define	XEN_EXFULL		54	/* Exchange full */
+#define	XEN_ENOANO		55	/* No anode */
+#define	XEN_EBADRQC		56	/* Invalid request code */
+#define	XEN_EBADSLT		57	/* Invalid slot */
+#define	XEN_EBFONT		59	/* Bad font file format */
+#define	XEN_ENOSTR		60	/* Device not a stream */
+#define	XEN_ENODATA		61	/* No data available */
+#define	XEN_ETIME		62	/* Timer expired */
+#define	XEN_ENOSR		63	/* Out of streams resources */
+#define	XEN_ENONET		64	/* Machine is not on the network */
+#define	XEN_ENOPKG		65	/* Package not installed */
+#define	XEN_EREMOTE		66	/* Object is remote */
+#define	XEN_ENOLINK		67	/* Link has been severed */
+#define	XEN_EADV		68	/* Advertise error */
+#define	XEN_ESRMNT		69	/* Srmount error */
+#define	XEN_ECOMM		70	/* Communication error on send */
+#define	XEN_EPROTO		71	/* Protocol error */
+#define	XEN_EMULTIHOP		72	/* Multihop attempted */
+#define	XEN_EDOTDOT		73	/* RFS specific error */
+#define	XEN_EBADMSG		74	/* Not a data message */
+#define	XEN_EOVERFLOW		75	/* Value too large for defined data type */
+#define	XEN_ENOTUNIQ		76	/* Name not unique on network */
+#define	XEN_EBADFD		77	/* File descriptor in bad state */
+#define	XEN_EREMCHG		78	/* Remote address changed */
+#define	XEN_ELIBACC		79	/* Can not access a needed shared library */
+#define	XEN_ELIBBAD		80	/* Accessing a corrupted shared library */
+#define	XEN_ELIBSCN		81	/* .lib section in a.out corrupted */
+#define	XEN_ELIBMAX		82	/* Attempting to link in too many shared libraries */
+#define	XEN_ELIBEXEC		83	/* Cannot exec a shared library directly */
+#define	XEN_EILSEQ		84	/* Illegal byte sequence */
+#define	XEN_ERESTART		85	/* Interrupted system call should be restarted */
+#define	XEN_ESTRPIPE		86	/* Streams pipe error */
+#define	XEN_EUSERS		87	/* Too many users */
+#define	XEN_ENOTSOCK		88	/* Socket operation on non-socket */
+#define	XEN_EDESTADDRREQ	89	/* Destination address required */
+#define	XEN_EMSGSIZE		90	/* Message too long */
+#define	XEN_EPROTOTYPE		91	/* Protocol wrong type for socket */
+#define	XEN_ENOPROTOOPT		92	/* Protocol not available */
+#define	XEN_EPROTONOSUPPORT	93	/* Protocol not supported */
+#define	XEN_ESOCKTNOSUPPORT	94	/* Socket type not supported */
+#define	XEN_EOPNOTSUPP		95	/* Operation not supported on transport endpoint */
+#define	XEN_EPFNOSUPPORT	96	/* Protocol family not supported */
+#define	XEN_EAFNOSUPPORT	97	/* Address family not supported by protocol */
+#define	XEN_EADDRINUSE		98	/* Address already in use */
+#define	XEN_EADDRNOTAVAIL	99	/* Cannot assign requested address */
+#define	XEN_ENETDOWN		100	/* Network is down */
+#define	XEN_ENETUNREACH		101	/* Network is unreachable */
+#define	XEN_ENETRESET		102	/* Network dropped connection because of reset */
+#define	XEN_ECONNABORTED	103	/* Software caused connection abort */
+#define	XEN_ECONNRESET		104	/* Connection reset by peer */
+#define	XEN_ENOBUFS		105	/* No buffer space available */
+#define	XEN_EISCONN		106	/* Transport endpoint is already connected */
+#define	XEN_ENOTCONN		107	/* Transport endpoint is not connected */
+#define	XEN_ESHUTDOWN		108	/* Cannot send after transport endpoint shutdown */
+#define	XEN_ETOOMANYREFS	109	/* Too many references: cannot splice */
+#define	XEN_ETIMEDOUT		110	/* Connection timed out */
+#define	XEN_ECONNREFUSED	111	/* Connection refused */
+#define	XEN_EHOSTDOWN		112	/* Host is down */
+#define	XEN_EHOSTUNREACH	113	/* No route to host */
+#define	XEN_EALREADY		114	/* Operation already in progress */
+#define	XEN_EINPROGRESS		115	/* Operation now in progress */
+#define	XEN_ESTALE		116	/* Stale NFS file handle */
+#define	XEN_EUCLEAN		117	/* Structure needs cleaning */
+#define	XEN_ENOTNAM		118	/* Not a XENIX named type file */
+#define	XEN_ENAVAIL		119	/* No XENIX semaphores available */
+#define	XEN_EISNAM		120	/* Is a named type file */
+#define	XEN_EREMOTEIO		121	/* Remote I/O error */
+#define	XEN_EDQUOT		122	/* Quota exceeded */
+
+#define	XEN_ENOMEDIUM		123	/* No medium found */
+#define	XEN_EMEDIUMTYPE		124	/* Wrong medium type */
+
+/* Translation table */
+static int xen_errors[] =
+{
+	[XEN_EPERM]		= EPERM,
+	[XEN_ENOENT]		= ENOENT,
+	[XEN_ESRCH]		= ESRCH,
+	[XEN_EINTR]		= EINTR,
+	[XEN_EIO]		= EIO,
+	[XEN_ENXIO]		= ENXIO,
+	[XEN_E2BIG]		= E2BIG,
+	[XEN_ENOEXEC]		= ENOEXEC,
+	[XEN_EBADF]		= EBADF,
+	[XEN_ECHILD]		= ECHILD,
+	[XEN_EAGAIN]		= EAGAIN,
+	[XEN_ENOMEM]		= ENOMEM,
+	[XEN_EACCES]		= EACCES,
+	[XEN_EFAULT]		= EFAULT,
+	[XEN_ENOTBLK]		= ENOTBLK,
+	[XEN_EBUSY]		= EBUSY,
+	[XEN_EEXIST]		= EEXIST,
+	[XEN_EXDEV]		= EXDEV,
+	[XEN_ENODEV]		= ENODEV,
+	[XEN_ENOTDIR]		= ENOTDIR,
+	[XEN_EISDIR]		= EISDIR,
+	[XEN_EINVAL]		= EINVAL,
+	[XEN_ENFILE]		= ENFILE,
+	[XEN_EMFILE]		= EMFILE,
+	[XEN_ENOTTY]		= ENOTTY,
+	[XEN_ETXTBSY]		= ETXTBSY,
+	[XEN_EFBIG]		= EFBIG,
+	[XEN_ENOSPC]		= ENOSPC,
+	[XEN_ESPIPE]		= ESPIPE,
+	[XEN_EROFS]		= EROFS,
+	[XEN_EMLINK]		= EMLINK,
+	[XEN_EPIPE]		= EPIPE,
+	[XEN_EDOM]		= EDOM,
+	[XEN_ERANGE]		= ERANGE,
+	[XEN_EDEADLK]		= EDEADLK,
+	[XEN_ENAMETOOLONG]	= ENAMETOOLONG,
+	[XEN_ENOLCK]		= ENOLCK,
+	[XEN_ENOSYS]		= ENOSYS,
+	[XEN_ENOTEMPTY]		= ENOTEMPTY,
+	[XEN_ELOOP]		= ELOOP,
+	[XEN_ENOMSG]		= ENOMSG,
+	[XEN_EIDRM]		= EIDRM,
+	[XEN_ECHRNG]		= ERANGE,
+	[XEN_EL2NSYNC]		= EFAULT,
+	[XEN_EL3HLT]		= EFAULT,
+	[XEN_EL3RST]		= EFAULT,
+	[XEN_ELNRNG]		= ERANGE,
+	[XEN_EUNATCH]		= ENODEV,
+	[XEN_ENOCSI]		= ENODEV,
+	[XEN_EL2HLT]		= EFAULT,
+	[XEN_EBADE]		= ERANGE,
+	[XEN_EBADR]		= EINVAL,
+	[XEN_EXFULL]		= ENOBUFS,
+	[XEN_ENOANO]		= EINVAL,
+	[XEN_EBADRQC]		= EINVAL,
+	[XEN_EBADSLT]		= EINVAL,
+	[XEN_EBFONT]		= EFAULT,
+	[XEN_ENOSTR]		= EINVAL,
+	[XEN_ENODATA]		= ENOENT,
+	[XEN_ETIME]		= ETIMEDOUT,
+	[XEN_ENOSR]		= EFAULT,
+	[XEN_ENONET]		= ENETDOWN,
+	[XEN_ENOPKG]		= EINVAL,
+	[XEN_EREMOTE]		= EREMOTE,
+	[XEN_ENOLINK]		= ENOLINK,
+	[XEN_EADV]		= EFAULT,
+	[XEN_ESRMNT]		= EFAULT,
+	[XEN_ECOMM]		= EFAULT,
+	[XEN_EPROTO]		= EPROTO,
+	[XEN_EMULTIHOP]		= EMULTIHOP,
+	[XEN_EDOTDOT]		= EFAULT,
+	[XEN_EBADMSG]		= EBADMSG,
+	[XEN_EOVERFLOW]		= EOVERFLOW,
+	[XEN_ENOTUNIQ]		= EADDRINUSE,
+	[XEN_EBADFD]		= EBADF,
+	[XEN_EREMCHG]		= EHOSTDOWN,
+	[XEN_ELIBACC]		= EFAULT,
+	[XEN_ELIBBAD]		= EFAULT,
+	[XEN_ELIBSCN]		= EFAULT,
+	[XEN_ELIBMAX]		= EFAULT,
+	[XEN_ELIBEXEC]		= EFAULT,
+	[XEN_EILSEQ]		= EILSEQ,
+	[XEN_ERESTART]		= EAGAIN,
+	[XEN_ESTRPIPE]		= EPIPE,
+	[XEN_EUSERS]		= EUSERS,
+	[XEN_ENOTSOCK]		= ENOTSOCK,
+	[XEN_EDESTADDRREQ]	= EDESTADDRREQ,
+	[XEN_EMSGSIZE]		= EMSGSIZE,
+	[XEN_EPROTOTYPE]	= EPROTOTYPE,
+	[XEN_ENOPROTOOPT]	= ENOPROTOOPT,
+	[XEN_EPROTONOSUPPORT]	= EPROTONOSUPPORT,
+	[XEN_ESOCKTNOSUPPORT]	= ESOCKTNOSUPPORT,
+	[XEN_EOPNOTSUPP]	= EOPNOTSUPP,
+	[XEN_EPFNOSUPPORT]	= EPFNOSUPPORT,
+	[XEN_EAFNOSUPPORT]	= EAFNOSUPPORT,
+	[XEN_EADDRINUSE]	= EADDRINUSE,
+	[XEN_EADDRNOTAVAIL]	= EADDRNOTAVAIL,
+	[XEN_ENETDOWN]		= ENETDOWN,
+	[XEN_ENETUNREACH]	= ENETUNREACH,
+	[XEN_ENETRESET]		= ENETRESET,
+	[XEN_ECONNABORTED]	= ECONNABORTED,
+	[XEN_ECONNRESET]	= ECONNRESET,
+	[XEN_ENOBUFS]		= ENOBUFS,
+	[XEN_EISCONN]		= EISCONN,
+	[XEN_ENOTCONN]		= ENOTCONN,
+	[XEN_ESHUTDOWN]		= ESHUTDOWN,
+	[XEN_ETOOMANYREFS]	= ETOOMANYREFS,
+	[XEN_ETIMEDOUT]		= ETIMEDOUT,
+	[XEN_ECONNREFUSED]	= ECONNREFUSED,
+	[XEN_EHOSTDOWN]		= EHOSTDOWN,
+	[XEN_EHOSTUNREACH]	= EHOSTUNREACH,
+	[XEN_EALREADY]		= EALREADY,
+	[XEN_EINPROGRESS]	= EINPROGRESS,
+	[XEN_ESTALE]		= ESTALE,
+	[XEN_EUCLEAN]		= EFAULT,
+	[XEN_ENOTNAM]		= EFAULT,
+	[XEN_ENAVAIL]		= EFAULT,
+	[XEN_EISNAM]		= EFAULT,
+	[XEN_EREMOTEIO]		= EIO,
+	[XEN_EDQUOT]		= EDQUOT,
+	[XEN_ENOMEDIUM]		= ENOENT,
+	[XEN_EMEDIUMTYPE]	= ENOENT,
+};
+
+static inline int
+xen_translate_error(int error)
+{
+	int bsd_error;
+
+	KASSERT((error < 0), ("Value is not a valid Xen error code"));
+
+	if (-error >= nitems(xen_errors)) {
+		/*
+		 * We received an error value that cannot be translated,
+		 * return EINVAL.
+		 */
+		return (EINVAL);
+	}
+
+	bsd_error = xen_errors[-error];
+	KASSERT((bsd_error != 0), ("Unknown Xen error code"));
+
+	return (bsd_error);
+}
+
+#endif /* !__XEN_ERROR_H__ */

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 17:07:23 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 6A469129;
 Wed, 22 Oct 2014 17:07:23 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 54852688;
 Wed, 22 Oct 2014 17:07:23 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MH7NBq059811;
 Wed, 22 Oct 2014 17:07:23 GMT (envelope-from royger@FreeBSD.org)
Received: (from royger@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MH7LJe059801;
 Wed, 22 Oct 2014 17:07:21 GMT (envelope-from royger@FreeBSD.org)
Message-Id: <201410221707.s9MH7LJe059801@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: royger set sender to
 royger@FreeBSD.org using -f
From: Roger Pau Monné 
Date: Wed, 22 Oct 2014 17:07:21 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273476 - in head/sys: amd64/include/xen conf
 dev/xen/privcmd i386/include/xen x86/xen xen xen/interface
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 17:07:23 -0000

Author: royger
Date: Wed Oct 22 17:07:20 2014
New Revision: 273476
URL: https://svnweb.freebsd.org/changeset/base/273476

Log:
  xen: implement the privcmd user-space device
  
  This device is only attached to priviledged domains, and allows the
  toolstack to interact with Xen. The two functions of the privcmd
  interface is to allow the execution of hypercalls from user-space, and
  the mapping of foreign domain memory.
  
  Sponsored by: Citrix Systems R&D
  
  i386/include/xen/hypercall.h:
  amd64/include/xen/hypercall.h:
   - Introduce a function to make generic hypercalls into Xen.
  
  xen/interface/xen.h:
  xen/interface/memory.h:
   - Import the new hypercall XENMEM_add_to_physmap_range used by
     auto-translated guests to map memory from foreign domains.
  
  dev/xen/privcmd/privcmd.c:
   - This device has the following functions:
     - Allow user-space applications to make hypercalls into Xen.
     - Allow user-space applications to map memory from foreign domains,
       this is accomplished using the newly introduced hypercall
       (XENMEM_add_to_physmap_range).
  
  xen/privcmd.h:
   - Public ioctl interface for the privcmd device.
  
  x86/xen/hvm.c:
   - Remove declaration of hypercall_page, now it's declared in
     hypercall.h.
  
  conf/files:
   - Add the privcmd device to the build process.

Added:
  head/sys/dev/xen/privcmd/
  head/sys/dev/xen/privcmd/privcmd.c   (contents, props changed)
  head/sys/xen/privcmd.h   (contents, props changed)
Modified:
  head/sys/amd64/include/xen/hypercall.h
  head/sys/conf/files
  head/sys/i386/include/xen/hypercall.h
  head/sys/x86/xen/hvm.c
  head/sys/xen/interface/memory.h
  head/sys/xen/interface/xen.h

Modified: head/sys/amd64/include/xen/hypercall.h
==============================================================================
--- head/sys/amd64/include/xen/hypercall.h	Wed Oct 22 16:58:52 2014	(r273475)
+++ head/sys/amd64/include/xen/hypercall.h	Wed Oct 22 17:07:20 2014	(r273476)
@@ -45,6 +45,8 @@
 # error "please don't include this file directly"
 #endif
 
+extern char *hypercall_page;
+
 #define __STR(x) #x
 #define STR(x) __STR(x)
 #define	ENOXENSYS	38
@@ -134,6 +136,26 @@
 	__res;							\
 })
 
+static inline int
+privcmd_hypercall(long op, long a1, long a2, long a3, long a4, long a5)
+{
+	int __res;
+	long __ign1, __ign2, __ign3;
+	register long __arg4 __asm__("r10") = (long)(a4);
+	register long __arg5 __asm__("r8") = (long)(a5);
+	long __call = (long)&hypercall_page + (op * 32);
+
+	__asm__ volatile (
+		"call *%[call]"
+		: "=a" (__res), "=D" (__ign1), "=S" (__ign2),
+		  "=d" (__ign3), "+r" (__arg4), "+r" (__arg5)
+		: "1" ((long)(a1)), "2" ((long)(a2)),
+		  "3" ((long)(a3)), [call] "a" (__call)
+		: "memory" );
+
+	return (__res);
+}
+
 static inline int __must_check
 HYPERVISOR_set_trap_table(
 	const trap_info_t *table)

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files	Wed Oct 22 16:58:52 2014	(r273475)
+++ head/sys/conf/files	Wed Oct 22 17:07:20 2014	(r273476)
@@ -2648,6 +2648,7 @@ dev/xen/xenstore/xenstore.c	optional xen
 dev/xen/xenstore/xenstore_dev.c	optional xen | xenhvm
 dev/xen/xenstore/xenstored_dev.c	optional xen | xenhvm
 dev/xen/evtchn/evtchn_dev.c	optional xen | xenhvm
+dev/xen/privcmd/privcmd.c	optional xen | xenhvm
 dev/xl/if_xl.c			optional xl pci
 dev/xl/xlphy.c			optional xl pci
 fs/autofs/autofs.c		optional autofs

Added: head/sys/dev/xen/privcmd/privcmd.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/dev/xen/privcmd/privcmd.c	Wed Oct 22 17:07:20 2014	(r273476)
@@ -0,0 +1,414 @@
+/*
+ * Copyright (c) 2014 Roger Pau Monné 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+MALLOC_DEFINE(M_PRIVCMD, "privcmd_dev", "Xen privcmd user-space device");
+
+struct privcmd_map {
+	vm_object_t mem;
+	vm_size_t size;
+	struct resource *pseudo_phys_res;
+	int pseudo_phys_res_id;
+	vm_paddr_t phys_base_addr;
+	boolean_t mapped;
+	int *errs;
+};
+
+static d_ioctl_t     privcmd_ioctl;
+static d_mmap_single_t	privcmd_mmap_single;
+
+static struct cdevsw privcmd_devsw = {
+	.d_version = D_VERSION,
+	.d_ioctl = privcmd_ioctl,
+	.d_mmap_single = privcmd_mmap_single,
+	.d_name = "privcmd",
+};
+
+static int privcmd_pg_ctor(void *handle, vm_ooffset_t size, vm_prot_t prot,
+    vm_ooffset_t foff, struct ucred *cred, u_short *color);
+static void privcmd_pg_dtor(void *handle);
+static int privcmd_pg_fault(vm_object_t object, vm_ooffset_t offset,
+    int prot, vm_page_t *mres);
+
+static struct cdev_pager_ops privcmd_pg_ops = {
+	.cdev_pg_fault = privcmd_pg_fault,
+	.cdev_pg_ctor =	privcmd_pg_ctor,
+	.cdev_pg_dtor =	privcmd_pg_dtor,
+};
+
+static device_t privcmd_dev = NULL;
+
+/*------------------------- Privcmd Pager functions --------------------------*/
+static int
+privcmd_pg_ctor(void *handle, vm_ooffset_t size, vm_prot_t prot,
+    vm_ooffset_t foff, struct ucred *cred, u_short *color)
+{
+
+	return (0);
+}
+
+static void
+privcmd_pg_dtor(void *handle)
+{
+	struct xen_remove_from_physmap rm = { .domid = DOMID_SELF };
+	struct privcmd_map *map = handle;
+	int error;
+	vm_size_t i;
+	vm_page_t m;
+
+	/*
+	 * Remove the mappings from the used pages. This will remove the
+	 * underlying p2m bindings in Xen second stage translation.
+	 */
+	if (map->mapped == true) {
+		VM_OBJECT_WLOCK(map->mem);
+retry:
+		for (i = 0; i < map->size; i++) {
+			m = vm_page_lookup(map->mem, i);
+			if (m == NULL)
+				continue;
+			if (vm_page_sleep_if_busy(m, "pcmdum"))
+				goto retry;
+			cdev_pager_free_page(map->mem, m);
+		}
+		VM_OBJECT_WUNLOCK(map->mem);
+
+		for (i = 0; i < map->size; i++) {
+			rm.gpfn = atop(map->phys_base_addr) + i;
+			HYPERVISOR_memory_op(XENMEM_remove_from_physmap, &rm);
+		}
+		free(map->errs, M_PRIVCMD);
+	}
+
+	vm_phys_fictitious_unreg_range(map->phys_base_addr,
+	    map->phys_base_addr + map->size * PAGE_SIZE);
+
+	error = bus_release_resource(privcmd_dev, SYS_RES_MEMORY,
+	    map->pseudo_phys_res_id, map->pseudo_phys_res);
+	KASSERT(error == 0, ("Unable to release memory resource: %d", error));
+
+	free(map, M_PRIVCMD);
+}
+
+static int
+privcmd_pg_fault(vm_object_t object, vm_ooffset_t offset,
+    int prot, vm_page_t *mres)
+{
+	struct privcmd_map *map = object->handle;
+	vm_pindex_t pidx;
+	vm_page_t page, oldm;
+
+	if (map->mapped != true)
+		return (VM_PAGER_FAIL);
+
+	pidx = OFF_TO_IDX(offset);
+	if (pidx >= map->size || map->errs[pidx] != 0)
+		return (VM_PAGER_FAIL);
+
+	page = PHYS_TO_VM_PAGE(map->phys_base_addr + offset);
+	if (page == NULL)
+		return (VM_PAGER_FAIL);
+
+	KASSERT((page->flags & PG_FICTITIOUS) != 0,
+	    ("not fictitious %p", page));
+	KASSERT(page->wire_count == 1, ("wire_count not 1 %p", page));
+	KASSERT(vm_page_busied(page) == 0, ("page %p is busy", page));
+
+	if (*mres != NULL) {
+		oldm = *mres;
+		vm_page_lock(oldm);
+		vm_page_free(oldm);
+		vm_page_unlock(oldm);
+		*mres = NULL;
+	}
+
+	vm_page_insert(page, object, pidx);
+	page->valid = VM_PAGE_BITS_ALL;
+	vm_page_xbusy(page);
+	*mres = page;
+	return (VM_PAGER_OK);
+}
+
+/*----------------------- Privcmd char device methods ------------------------*/
+static int
+privcmd_mmap_single(struct cdev *cdev, vm_ooffset_t *offset, vm_size_t size,
+    vm_object_t *object, int nprot)
+{
+	struct privcmd_map *map;
+	int error;
+
+	map = malloc(sizeof(*map), M_PRIVCMD, M_WAITOK | M_ZERO);
+
+	map->size = OFF_TO_IDX(size);
+	map->pseudo_phys_res_id = 0;
+
+	map->pseudo_phys_res = bus_alloc_resource(privcmd_dev, SYS_RES_MEMORY,
+	    &map->pseudo_phys_res_id, 0, ~0, size, RF_ACTIVE);
+	if (map->pseudo_phys_res == NULL) {
+		free(map, M_PRIVCMD);
+		return (ENOMEM);
+	}
+
+	map->phys_base_addr = rman_get_start(map->pseudo_phys_res);
+
+	error = vm_phys_fictitious_reg_range(map->phys_base_addr,
+	    map->phys_base_addr + size, VM_MEMATTR_DEFAULT);
+	if (error) {
+		bus_release_resource(privcmd_dev, SYS_RES_MEMORY,
+		    map->pseudo_phys_res_id, map->pseudo_phys_res);
+		free(map, M_PRIVCMD);
+		return (error);
+	}
+
+	map->mem = cdev_pager_allocate(map, OBJT_MGTDEVICE, &privcmd_pg_ops,
+	    size, nprot, *offset, NULL);
+	if (map->mem == NULL) {
+		bus_release_resource(privcmd_dev, SYS_RES_MEMORY,
+		    map->pseudo_phys_res_id, map->pseudo_phys_res);
+		free(map, M_PRIVCMD);
+		return (ENOMEM);
+	}
+
+	*object = map->mem;
+
+	return (0);
+}
+
+static int
+privcmd_ioctl(struct cdev *dev, unsigned long cmd, caddr_t arg,
+	      int mode, struct thread *td)
+{
+	int error, i;
+
+	switch (cmd) {
+	case IOCTL_PRIVCMD_HYPERCALL: {
+		struct ioctl_privcmd_hypercall *hcall;
+
+		hcall = (struct ioctl_privcmd_hypercall *)arg;
+
+		error = privcmd_hypercall(hcall->op, hcall->arg[0],
+		    hcall->arg[1], hcall->arg[2], hcall->arg[3], hcall->arg[4]);
+		if (error >= 0) {
+			hcall->retval = error;
+			error = 0;
+		} else {
+			error = xen_translate_error(error);
+			hcall->retval = 0;
+		}
+		break;
+	}
+	case IOCTL_PRIVCMD_MMAPBATCH: {
+		struct ioctl_privcmd_mmapbatch *mmap;
+		vm_map_t map;
+		vm_map_entry_t entry;
+		vm_object_t mem;
+		vm_pindex_t index;
+		vm_prot_t prot;
+		boolean_t wired;
+		struct xen_add_to_physmap_range add;
+		xen_ulong_t *idxs;
+		xen_pfn_t *gpfns;
+		int *errs;
+		struct privcmd_map *umap;
+
+		mmap = (struct ioctl_privcmd_mmapbatch *)arg;
+
+		if ((mmap->num == 0) ||
+		    ((mmap->addr & PAGE_MASK) != 0)) {
+			error = EINVAL;
+			break;
+		}
+
+		map = &td->td_proc->p_vmspace->vm_map;
+		error = vm_map_lookup(&map, mmap->addr, VM_PROT_NONE, &entry,
+		    &mem, &index, &prot, &wired);
+		if (error != KERN_SUCCESS) {
+			error = EINVAL;
+			break;
+		}
+		if ((entry->start != mmap->addr) ||
+		    (entry->end != mmap->addr + (mmap->num * PAGE_SIZE))) {
+			vm_map_lookup_done(map, entry);
+			error = EINVAL;
+			break;
+		}
+		vm_map_lookup_done(map, entry);
+		if ((mem->type != OBJT_MGTDEVICE) ||
+		    (mem->un_pager.devp.ops != &privcmd_pg_ops)) {
+			error = EINVAL;
+			break;
+		}
+		umap = mem->handle;
+
+		add.domid = DOMID_SELF;
+		add.space = XENMAPSPACE_gmfn_foreign;
+		add.size = mmap->num;
+		add.foreign_domid = mmap->dom;
+
+		idxs = malloc(sizeof(*idxs) * mmap->num, M_PRIVCMD,
+		    M_WAITOK | M_ZERO);
+		gpfns = malloc(sizeof(*gpfns) * mmap->num, M_PRIVCMD,
+		    M_WAITOK | M_ZERO);
+		errs = malloc(sizeof(*errs) * mmap->num, M_PRIVCMD,
+		    M_WAITOK | M_ZERO);
+
+		set_xen_guest_handle(add.idxs, idxs);
+		set_xen_guest_handle(add.gpfns, gpfns);
+		set_xen_guest_handle(add.errs, errs);
+
+		error = copyin(&mmap->arr[0], idxs,
+		    sizeof(idxs[0]) * mmap->num);
+		if (error != 0)
+			goto mmap_out;
+
+		for (i = 0; i < mmap->num; i++)
+			gpfns[i] = atop(umap->phys_base_addr + i * PAGE_SIZE);
+
+		error = HYPERVISOR_memory_op(XENMEM_add_to_physmap_range, &add);
+		if (error) {
+			error = xen_translate_error(error);
+			goto mmap_out;
+		}
+
+		for (i = 0; i < mmap->num; i++) {
+			if (errs[i] != 0)
+				errs[i] = xen_translate_error(errs[i]);
+		}
+
+		/*
+		 * Save errs, so we know which pages have been
+		 * successfully mapped.
+		 */
+		umap->errs = errs;
+		umap->mapped = true;
+
+		error = copyout(errs, &mmap->err[0],
+		    sizeof(errs[0]) * mmap->num);
+
+mmap_out:
+		free(idxs, M_PRIVCMD);
+		free(gpfns, M_PRIVCMD);
+		if (!umap->mapped)
+			free(errs, M_PRIVCMD);
+
+		break;
+	}
+
+	default:
+		error = ENOSYS;
+		break;
+	}
+
+	return (error);
+}
+
+/*------------------ Private Device Attachment Functions  --------------------*/
+static void
+privcmd_identify(driver_t *driver, device_t parent)
+{
+
+	KASSERT(xen_domain(),
+	    ("Trying to attach privcmd device on non Xen domain"));
+
+	if (BUS_ADD_CHILD(parent, 0, "privcmd", 0) == NULL)
+		panic("unable to attach privcmd user-space device");
+}
+
+static int
+privcmd_probe(device_t dev)
+{
+
+	privcmd_dev = dev;
+	device_set_desc(dev, "Xen privileged interface user-space device");
+	return (BUS_PROBE_NOWILDCARD);
+}
+
+static int
+privcmd_attach(device_t dev)
+{
+
+	make_dev_credf(MAKEDEV_ETERNAL, &privcmd_devsw, 0, NULL, UID_ROOT,
+	    GID_WHEEL, 0600, "xen/privcmd");
+	return (0);
+}
+
+/*-------------------- Private Device Attachment Data  -----------------------*/
+static device_method_t privcmd_methods[] = {
+	DEVMETHOD(device_identify,	privcmd_identify),
+	DEVMETHOD(device_probe,		privcmd_probe),
+	DEVMETHOD(device_attach,	privcmd_attach),
+
+	DEVMETHOD_END
+};
+
+static driver_t privcmd_driver = {
+	"privcmd",
+	privcmd_methods,
+	0,
+};
+
+devclass_t privcmd_devclass;
+
+DRIVER_MODULE(privcmd, xenpv, privcmd_driver, privcmd_devclass, 0, 0);
+MODULE_DEPEND(privcmd, xenpv, 1, 1, 1);

Modified: head/sys/i386/include/xen/hypercall.h
==============================================================================
--- head/sys/i386/include/xen/hypercall.h	Wed Oct 22 16:58:52 2014	(r273475)
+++ head/sys/i386/include/xen/hypercall.h	Wed Oct 22 17:07:20 2014	(r273476)
@@ -34,6 +34,8 @@
 #include 
 #include 
 
+extern char *hypercall_page;
+
 #define __STR(x) #x
 #define STR(x) __STR(x)
 #define	ENOXENSYS	38
@@ -115,6 +117,24 @@
         (type)__res;                                            \
 })								
 
+static inline long
+privcmd_hypercall(long op, long a1, long a2, long a3, long a4, long a5)
+{
+	long __res, __ign1, __ign2, __ign3, __ign4, __ign5, __call;
+
+	__call = (long)&hypercall_page + (op * 32);
+	__asm__ volatile (
+		"call *%[call]"
+		: "=a" (__res), "=b" (__ign1), "=c" (__ign2),
+                "=d" (__ign3), "=S" (__ign4), "=D" (__ign5)
+                : "1" ((long)(a1)), "2" ((long)(a2)),
+                "3" ((long)(a3)), "4" ((long)(a4)),
+                "5" ((long)(a5)), [call] "a" (__call)
+		: "memory" );
+
+	return __res;
+}
+
 static inline int
 HYPERVISOR_set_trap_table(
 	trap_info_t *table)

Modified: head/sys/x86/xen/hvm.c
==============================================================================
--- head/sys/x86/xen/hvm.c	Wed Oct 22 16:58:52 2014	(r273475)
+++ head/sys/x86/xen/hvm.c	Wed Oct 22 17:07:20 2014	(r273476)
@@ -97,8 +97,6 @@ DPCPU_DEFINE(struct vcpu_info, vcpu_loca
 DPCPU_DEFINE(struct vcpu_info *, vcpu_info);
 
 /*------------------ Hypervisor Access Shared Memory Regions -----------------*/
-/** Hypercall table accessed via HYPERVISOR_*_op() methods. */
-extern char *hypercall_page;
 shared_info_t *HYPERVISOR_shared_info;
 start_info_t *HYPERVISOR_start_info;
 

Modified: head/sys/xen/interface/memory.h
==============================================================================
--- head/sys/xen/interface/memory.h	Wed Oct 22 16:58:52 2014	(r273475)
+++ head/sys/xen/interface/memory.h	Wed Oct 22 17:07:20 2014	(r273476)
@@ -198,6 +198,14 @@ struct xen_machphys_mapping {
 typedef struct xen_machphys_mapping xen_machphys_mapping_t;
 DEFINE_XEN_GUEST_HANDLE(xen_machphys_mapping_t);
 
+#define XENMAPSPACE_shared_info  0 /* shared info page */
+#define XENMAPSPACE_grant_table  1 /* grant table page */
+#define XENMAPSPACE_gmfn         2 /* GMFN */
+#define XENMAPSPACE_gmfn_range   3 /* GMFN range, XENMEM_add_to_physmap only. */
+#define XENMAPSPACE_gmfn_foreign 4 /* GMFN from another dom,
+                                    * XENMEM_add_to_physmap_range only.
+                                    */
+
 /*
  * Sets the GPFN at which a particular page appears in the specified guest's
  * pseudophysical address space.
@@ -248,6 +256,31 @@ DEFINE_XEN_GUEST_HANDLE(xen_remove_from_
 /*** REMOVED ***/
 /*#define XENMEM_translate_gpfn_list  8*/
 
+#define XENMEM_add_to_physmap_range 23
+struct xen_add_to_physmap_range {
+    /* IN */
+    /* Which domain to change the mapping for. */
+    domid_t domid;
+    uint16_t space; /* => enum phys_map_space */
+
+    /* Number of pages to go through */
+    uint16_t size;
+    domid_t foreign_domid; /* IFF gmfn_foreign */
+
+    /* Indexes into space being mapped. */
+    XEN_GUEST_HANDLE(xen_ulong_t) idxs;
+
+    /* GPFN in domid where the source mapping page should appear. */
+    XEN_GUEST_HANDLE(xen_pfn_t) gpfns;
+
+    /* OUT */
+
+    /* Per index error code. */
+    XEN_GUEST_HANDLE(int) errs;
+};
+typedef struct xen_add_to_physmap_range xen_add_to_physmap_range_t;
+DEFINE_XEN_GUEST_HANDLE(xen_add_to_physmap_range_t);
+
 /*
  * Returns the pseudo-physical memory map as it was when the domain
  * was started (specified by XENMEM_set_memory_map).

Modified: head/sys/xen/interface/xen.h
==============================================================================
--- head/sys/xen/interface/xen.h	Wed Oct 22 16:58:52 2014	(r273475)
+++ head/sys/xen/interface/xen.h	Wed Oct 22 17:07:20 2014	(r273476)
@@ -51,6 +51,7 @@ DEFINE_XEN_GUEST_HANDLE(void);
 
 DEFINE_XEN_GUEST_HANDLE(uint64_t);
 DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
+DEFINE_XEN_GUEST_HANDLE(xen_ulong_t);
 #endif
 
 /*

Added: head/sys/xen/privcmd.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/xen/privcmd.h	Wed Oct 22 17:07:20 2014	(r273476)
@@ -0,0 +1,58 @@
+/******************************************************************************
+ * privcmd.h
+ * 
+ * Interface to /proc/xen/privcmd.
+ * 
+ * Copyright (c) 2003-2005, K A Fraser
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this source file (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef __XEN_PRIVCMD_H__
+#define __XEN_PRIVCMD_H__
+
+struct ioctl_privcmd_hypercall
+{
+	unsigned long op; /* hypercall number */
+	unsigned long arg[5]; /* arguments */
+	long retval; /* return value */
+};
+
+struct ioctl_privcmd_mmapbatch {
+	int num;     /* number of pages to populate */
+	domid_t dom; /* target domain */
+	unsigned long addr;  /* virtual address */
+	const xen_pfn_t *arr; /* array of mfns */
+	int *err; /* array of error codes */
+};
+
+#define IOCTL_PRIVCMD_HYPERCALL					\
+	_IOWR('E', 0, struct ioctl_privcmd_hypercall)
+#define IOCTL_PRIVCMD_MMAPBATCH					\
+	_IOWR('E', 1, struct ioctl_privcmd_mmapbatch)
+
+#endif /* !__XEN_PRIVCMD_H__ */

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 17:09:13 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 68DD932F;
 Wed, 22 Oct 2014 17:09:13 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 3BF3F6A7;
 Wed, 22 Oct 2014 17:09:13 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MH9DX7060189;
 Wed, 22 Oct 2014 17:09:13 GMT (envelope-from royger@FreeBSD.org)
Received: (from royger@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MH9DWc060188;
 Wed, 22 Oct 2014 17:09:13 GMT (envelope-from royger@FreeBSD.org)
Message-Id: <201410221709.s9MH9DWc060188@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: royger set sender to
 royger@FreeBSD.org using -f
From: Roger Pau Monné 
Date: Wed, 22 Oct 2014 17:09:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273477 - head/sys/dev/xen/netback
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 17:09:13 -0000

Author: royger
Date: Wed Oct 22 17:09:12 2014
New Revision: 273477
URL: https://svnweb.freebsd.org/changeset/base/273477

Log:
  netback: change xnb naming convention
  
  Current FreeBSD netback names the interface with xnb, but
  this is not suitable for usage with the Xen toolstack, which expects
  something similar to . In order to solve this,
  change the netback naming convention to use xnb..
  
  Sponsored by: Citrix Systems R&D
  
  dev/xen/netback/netback.c:
   - Change netback to use the nomenclature stated above.

Modified:
  head/sys/dev/xen/netback/netback.c

Modified: head/sys/dev/xen/netback/netback.c
==============================================================================
--- head/sys/dev/xen/netback/netback.c	Wed Oct 22 17:07:20 2014	(r273476)
+++ head/sys/dev/xen/netback/netback.c	Wed Oct 22 17:09:12 2014	(r273477)
@@ -511,6 +511,9 @@ struct xnb_softc {
 
 	/** The size of the global kva pool. */
 	int			kva_size;
+
+	/** Name of the interface */
+	char			 if_name[IFNAMSIZ];
 };
 
 /*---------------------------- Debugging functions ---------------------------*/
@@ -1201,6 +1204,7 @@ create_netdev(device_t dev)
 	struct ifnet *ifp;
 	struct xnb_softc *xnb;
 	int err = 0;
+	uint32_t handle;
 
 	xnb = device_get_softc(dev);
 	mtx_init(&xnb->sc_lock, "xnb_softc", "xen netback softc lock", MTX_DEF);
@@ -1225,11 +1229,24 @@ create_netdev(device_t dev)
 	 */
 	bzero(&xnb->mac[0], sizeof(xnb->mac));
 
+	/* The interface will be named using the following nomenclature:
+	 *
+	 * xnb.
+	 *
+	 * Where handle is the oder of the interface referred to the guest.
+	 */
+	err = xs_scanf(XST_NIL, xenbus_get_node(xnb->dev), "handle", NULL,
+		       "%" PRIu32, &handle);
+	if (err != 0)
+		return (err);
+	snprintf(xnb->if_name, IFNAMSIZ, "xnb%" PRIu16 ".%" PRIu32,
+	    xenbus_get_otherend_id(dev), handle);
+
 	if (err == 0) {
 		/* Set up ifnet structure */
 		ifp = xnb->xnb_ifp = if_alloc(IFT_ETHER);
 		ifp->if_softc = xnb;
-		if_initname(ifp, "xnb",  device_get_unit(dev));
+		if_initname(ifp, xnb->if_name,  IF_DUNIT_NONE);
 		ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
 		ifp->if_ioctl = xnb_ioctl;
 		ifp->if_output = ether_output;

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 18:11:11 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 03AB7FF3;
 Wed, 22 Oct 2014 18:11:11 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id E4A74D9C;
 Wed, 22 Oct 2014 18:11:10 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MIBAUE089986;
 Wed, 22 Oct 2014 18:11:10 GMT (envelope-from ngie@FreeBSD.org)
Received: (from ngie@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MIBAlb089985;
 Wed, 22 Oct 2014 18:11:10 GMT (envelope-from ngie@FreeBSD.org)
Message-Id: <201410221811.s9MIBAlb089985@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org
 using -f
From: Garrett Cooper 
Date: Wed, 22 Oct 2014 18:11:10 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273478 - head/share/mk
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 18:11:11 -0000

Author: ngie
Date: Wed Oct 22 18:11:10 2014
New Revision: 273478
URL: https://svnweb.freebsd.org/changeset/base/273478

Log:
  Fix linking static test binaries with atf.test.mk
  
  Check for -static in LDFLAGS or LDFLAGS., then pass in the appropriate
  dependency (LIBATF or LDATF)
  
  This unbreaks the build with some of the NetBSD tests that need to be compiled
  statically
  
  Reviewed by: imp, jmmv
  Phabric: D991
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/share/mk/atf.test.mk

Modified: head/share/mk/atf.test.mk
==============================================================================
--- head/share/mk/atf.test.mk	Wed Oct 22 17:09:12 2014	(r273477)
+++ head/share/mk/atf.test.mk	Wed Oct 22 18:11:10 2014	(r273478)
@@ -71,7 +71,11 @@ BINDIR.${_T}= ${TESTSDIR}
 MAN.${_T}?= # empty
 SRCS.${_T}?= ${_T}.c
 DPADD.${_T}+= ${LIBATF_C}
+.if empty(LDFLAGS:M-static) && empty(LDFLAGS.${_T}:M-static)
 LDADD.${_T}+= ${LDATF_C}
+.else
+LDADD.${_T}+= ${LIBATF_C}
+.endif
 USEPRIVATELIB+= atf-c
 TEST_INTERFACE.${_T}= atf
 .endfor
@@ -85,7 +89,11 @@ BINDIR.${_T}= ${TESTSDIR}
 MAN.${_T}?= # empty
 SRCS.${_T}?= ${_T}${CXX_SUFFIX:U.cc}
 DPADD.${_T}+= ${LIBATF_CXX} ${LIBATF_C}
+.if empty(LDFLAGS:M-static) && empty(LDFLAGS.${_T}:M-static)
 LDADD.${_T}+= ${LDATF_CXX} ${LDATF_C}
+.else
+LDADD.${_T}+= ${LIBATF_CXX} ${LIBATF_C}
+.endif
 USEPRIVATELIB+= atf-c++
 TEST_INTERFACE.${_T}= atf
 .endfor

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 18:55:36 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id D20C0A79;
 Wed, 22 Oct 2014 18:55:36 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id BEB2F276;
 Wed, 22 Oct 2014 18:55:36 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MItaLp011461;
 Wed, 22 Oct 2014 18:55:36 GMT (envelope-from luigi@FreeBSD.org)
Received: (from luigi@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MIta3H011460;
 Wed, 22 Oct 2014 18:55:36 GMT (envelope-from luigi@FreeBSD.org)
Message-Id: <201410221855.s9MIta3H011460@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: luigi set sender to
 luigi@FreeBSD.org using -f
From: Luigi Rizzo 
Date: Wed, 22 Oct 2014 18:55:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273479 - head/sys/net
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 18:55:36 -0000

Author: luigi
Date: Wed Oct 22 18:55:36 2014
New Revision: 273479
URL: https://svnweb.freebsd.org/changeset/base/273479

Log:
  since we cast a pointer, use the correct signedness
  (this was already in, and got lost in a recent update).

Modified:
  head/sys/net/radix.c

Modified: head/sys/net/radix.c
==============================================================================
--- head/sys/net/radix.c	Wed Oct 22 18:11:10 2014	(r273478)
+++ head/sys/net/radix.c	Wed Oct 22 18:55:36 2014	(r273479)
@@ -528,7 +528,7 @@ rn_addmask(void *n_arg, struct radix_nod
 	R_Zalloc(x, struct radix_node *, RADIX_MAX_KEY_LEN + 2 * sizeof (*x));
 	if ((saved_x = x) == 0)
 		return (0);
-	netmask = cp = (caddr_t)(x + 2);
+	netmask = cp = (unsigned char *)(x + 2);
 	bcopy(addmask_key, cp, mlen);
 	x = rn_insert(cp, maskhead, &maskduplicated, x);
 	if (maskduplicated) {

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 18:55:45 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 20E8CBB7;
 Wed, 22 Oct 2014 18:55:45 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 0D972279;
 Wed, 22 Oct 2014 18:55:45 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MItiiI011522;
 Wed, 22 Oct 2014 18:55:44 GMT (envelope-from np@FreeBSD.org)
Received: (from np@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MItixN011521;
 Wed, 22 Oct 2014 18:55:44 GMT (envelope-from np@FreeBSD.org)
Message-Id: <201410221855.s9MItixN011521@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: np set sender to np@FreeBSD.org
 using -f
From: Navdeep Parhar 
Date: Wed, 22 Oct 2014 18:55:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273480 - head/sys/dev/cxgbe/iw_cxgbe
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 18:55:45 -0000

Author: np
Date: Wed Oct 22 18:55:44 2014
New Revision: 273480
URL: https://svnweb.freebsd.org/changeset/base/273480

Log:
  cxgbe/iw_cxgbe: wake up waiters after flushing the qp.
  
  Obtained from:	Chelsio

Modified:
  head/sys/dev/cxgbe/iw_cxgbe/qp.c

Modified: head/sys/dev/cxgbe/iw_cxgbe/qp.c
==============================================================================
--- head/sys/dev/cxgbe/iw_cxgbe/qp.c	Wed Oct 22 18:55:36 2014	(r273479)
+++ head/sys/dev/cxgbe/iw_cxgbe/qp.c	Wed Oct 22 18:55:44 2014	(r273480)
@@ -1359,9 +1359,9 @@ err:
 	qhp->ep = NULL;
 	set_state(qhp, C4IW_QP_STATE_ERROR);
 	free = 1;
-	wake_up(&qhp->wait);
 	BUG_ON(!ep);
 	flush_qp(qhp);
+	wake_up(&qhp->wait);
 out:
 	mutex_unlock(&qhp->mutex);
 

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 20:47:12 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 2BFFF339;
 Wed, 22 Oct 2014 20:47:12 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id F1ADAFB8;
 Wed, 22 Oct 2014 20:47:11 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MKlB7j062992;
 Wed, 22 Oct 2014 20:47:11 GMT (envelope-from rmacklem@FreeBSD.org)
Received: (from rmacklem@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MKlBut062991;
 Wed, 22 Oct 2014 20:47:11 GMT (envelope-from rmacklem@FreeBSD.org)
Message-Id: <201410222047.s9MKlBut062991@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: rmacklem set sender to
 rmacklem@FreeBSD.org using -f
From: Rick Macklem 
Date: Wed, 22 Oct 2014 20:47:11 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273481 - head/sys/fs/nfsclient
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 20:47:12 -0000

Author: rmacklem
Date: Wed Oct 22 20:47:11 2014
New Revision: 273481
URL: https://svnweb.freebsd.org/changeset/base/273481

Log:
  Clip the settings for the NFS rsize, wsize mount options
  to a power of 2. For non-power of 2 settings, intermittent
  page faults have been reported. Although the bug that causes
  these page faults/crashes has not been identified, it does
  not appear to occur when rsize, wsize is a power of 2.
  
  Reported by:	tcberner@gmail.com
  MFC after:	2 weeks

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

Modified: head/sys/fs/nfsclient/nfs_clvfsops.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clvfsops.c	Wed Oct 22 18:55:44 2014	(r273480)
+++ head/sys/fs/nfsclient/nfs_clvfsops.c	Wed Oct 22 20:47:11 2014	(r273481)
@@ -552,7 +552,7 @@ static void
 nfs_decode_args(struct mount *mp, struct nfsmount *nmp, struct nfs_args *argp,
     const char *hostname, struct ucred *cred, struct thread *td)
 {
-	int s;
+	int i, s;
 	int adjsock;
 	char *p;
 
@@ -621,18 +621,36 @@ nfs_decode_args(struct mount *mp, struct
 
 	if ((argp->flags & NFSMNT_WSIZE) && argp->wsize > 0) {
 		nmp->nm_wsize = argp->wsize;
-		/* Round down to multiple of blocksize */
-		nmp->nm_wsize &= ~(NFS_FABLKSIZE - 1);
-		if (nmp->nm_wsize <= 0)
-			nmp->nm_wsize = NFS_FABLKSIZE;
+		/*
+		 * Clip at the power of 2 below the size. There is an
+		 * issue (not isolated) that causes intermittent page
+		 * faults if this is not done.
+		 */
+		i = NFS_FABLKSIZE;
+		for (;;) {
+			if (i * 2 > nmp->nm_wsize) {
+				nmp->nm_wsize = i;
+				break;
+			}
+			i *= 2;
+		}
 	}
 
 	if ((argp->flags & NFSMNT_RSIZE) && argp->rsize > 0) {
 		nmp->nm_rsize = argp->rsize;
-		/* Round down to multiple of blocksize */
-		nmp->nm_rsize &= ~(NFS_FABLKSIZE - 1);
-		if (nmp->nm_rsize <= 0)
-			nmp->nm_rsize = NFS_FABLKSIZE;
+		/*
+		 * Clip at the power of 2 below the size. There is an
+		 * issue (not isolated) that causes intermittent page
+		 * faults if this is not done.
+		 */
+		i = NFS_FABLKSIZE;
+		for (;;) {
+			if (i * 2 > nmp->nm_rsize) {
+				nmp->nm_rsize = i;
+				break;
+			}
+			i *= 2;
+		}
 	}
 
 	if ((argp->flags & NFSMNT_READDIRSIZE) && argp->readdirsize > 0) {

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 21:04:55 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 44E077AD;
 Wed, 22 Oct 2014 21:04:55 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 25318221;
 Wed, 22 Oct 2014 21:04:55 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9ML4t5S072851;
 Wed, 22 Oct 2014 21:04:55 GMT (envelope-from ngie@FreeBSD.org)
Received: (from ngie@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9ML4sWx072849;
 Wed, 22 Oct 2014 21:04:54 GMT (envelope-from ngie@FreeBSD.org)
Message-Id: <201410222104.s9ML4sWx072849@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org
 using -f
From: Garrett Cooper 
Date: Wed, 22 Oct 2014 21:04:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273482 - in head/lib/libnetbsd: netinet sys
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 21:04:55 -0000

Author: ngie
Date: Wed Oct 22 21:04:54 2014
New Revision: 273482
URL: https://svnweb.freebsd.org/changeset/base/273482

Log:
  The NetBSD libc tests use several definitions/macros that aren't available in
  FreeBSD
  
  Add the missing compat definitions/macros to lib/libnetbsd so the testcases
  can be compiled with libnetbsd without having to invent ad hoc #define's, or
  having to convert things over to FreeBSD idioms
  
  Reviewed by: brooks
  Phabric: D993
  Sponsored by: EMC / Isilon Storage Division

Added:
  head/lib/libnetbsd/netinet/
  head/lib/libnetbsd/netinet/in.h   (contents, props changed)
Modified:
  head/lib/libnetbsd/sys/cdefs.h

Added: head/lib/libnetbsd/netinet/in.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lib/libnetbsd/netinet/in.h	Wed Oct 22 21:04:54 2014	(r273482)
@@ -0,0 +1,72 @@
+/* $FreeBSD$ */
+
+/*
+ * Copyright (c) 1982, 1986, 1990, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+ *
+ *	@(#)in.h	8.3 (Berkeley) 1/3/94
+ */
+
+#ifndef _LIBNETBSD_NETINET_IN_H_
+#define _LIBNETBSD_NETINET_IN_H_
+
+#include_next 
+
+/*
+ * Local port number conventions:
+ *
+ * Ports < IPPORT_RESERVED are reserved for privileged processes (e.g. root),
+ * unless a kernel is compiled with IPNOPRIVPORTS defined.
+ *
+ * When a user does a bind(2) or connect(2) with a port number of zero,
+ * a non-conflicting local port address is chosen.
+ *
+ * The default range is IPPORT_ANONMIN to IPPORT_ANONMAX, although
+ * that is settable by sysctl(3); net.inet.ip.anonportmin and
+ * net.inet.ip.anonportmax respectively.
+ *
+ * A user may set the IPPROTO_IP option IP_PORTRANGE to change this
+ * default assignment range.
+ *
+ * The value IP_PORTRANGE_DEFAULT causes the default behavior.
+ *
+ * The value IP_PORTRANGE_HIGH is the same as IP_PORTRANGE_DEFAULT,
+ * and exists only for FreeBSD compatibility purposes.
+ *
+ * The value IP_PORTRANGE_LOW changes the range to the "low" are
+ * that is (by convention) restricted to privileged processes.
+ * This convention is based on "vouchsafe" principles only.
+ * It is only secure if you trust the remote host to restrict these ports.
+ * The range is IPPORT_RESERVEDMIN to IPPORT_RESERVEDMAX.
+ */
+
+#define	IPPORT_ANONMIN		49152
+#define	IPPORT_ANONMAX		65535
+#define	IPPORT_RESERVEDMIN	600
+#define	IPPORT_RESERVEDMAX	(IPPORT_RESERVED-1)
+
+#endif

Modified: head/lib/libnetbsd/sys/cdefs.h
==============================================================================
--- head/lib/libnetbsd/sys/cdefs.h	Wed Oct 22 20:47:11 2014	(r273481)
+++ head/lib/libnetbsd/sys/cdefs.h	Wed Oct 22 21:04:54 2014	(r273482)
@@ -42,6 +42,28 @@
 #endif
 
 /*
+ * The __CONCAT macro is used to concatenate parts of symbol names, e.g.
+ * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
+ * The __CONCAT macro is a bit tricky -- make sure you don't put spaces
+ * in between its arguments.  __CONCAT can also concatenate double-quoted
+ * strings produced by the __STRING macro, but this only works with ANSI C.
+ */
+
+#define	___STRING(x)	__STRING(x)
+#define	___CONCAT(x,y)	__CONCAT(x,y)
+
+/*
+ * The following macro is used to remove const cast-away warnings
+ * from gcc -Wcast-qual; it should be used with caution because it
+ * can hide valid errors; in particular most valid uses are in
+ * situations where the API requires it, not to cast away string
+ * constants. We don't use *intptr_t on purpose here and we are
+ * explicit about unsigned long so that we don't have additional
+ * dependencies.
+ */
+#define __UNCONST(a)	((void *)(unsigned long)(const void *)(a))
+
+/*
  * Return the number of elements in a statically-allocated array,
  * __x.
  */

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 21:20:38 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 11DF5E0;
 Wed, 22 Oct 2014 21:20:38 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id F1279608;
 Wed, 22 Oct 2014 21:20:37 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MLKbMO080216;
 Wed, 22 Oct 2014 21:20:37 GMT (envelope-from melifaro@FreeBSD.org)
Received: (from melifaro@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MLKb6E080215;
 Wed, 22 Oct 2014 21:20:37 GMT (envelope-from melifaro@FreeBSD.org)
Message-Id: <201410222120.s9MLKb6E080215@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: melifaro set sender to
 melifaro@FreeBSD.org using -f
From: "Alexander V. Chernikov" 
Date: Wed, 22 Oct 2014 21:20:37 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273483 - head/sys/netpfil/ipfw
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 21:20:38 -0000

Author: melifaro
Date: Wed Oct 22 21:20:37 2014
New Revision: 273483
URL: https://svnweb.freebsd.org/changeset/base/273483

Log:
  Rename log2 to tal_log2.
  
  Submitted by:	luigi

Modified:
  head/sys/netpfil/ipfw/ip_fw_table_algo.c

Modified: head/sys/netpfil/ipfw/ip_fw_table_algo.c
==============================================================================
--- head/sys/netpfil/ipfw/ip_fw_table_algo.c	Wed Oct 22 21:04:54 2014	(r273482)
+++ head/sys/netpfil/ipfw/ip_fw_table_algo.c	Wed Oct 22 21:20:37 2014	(r273483)
@@ -954,7 +954,7 @@ static int ta_lookup_chash_64(struct tab
 static int chash_parse_opts(struct chash_cfg *cfg, char *data);
 static void ta_print_chash_config(void *ta_state, struct table_info *ti,
     char *buf, size_t bufsize);
-static int log2(uint32_t v);
+static int ta_log2(uint32_t v);
 static int ta_init_chash(struct ip_fw_chain *ch, void **ta_state,
     struct table_info *ti, char *data, uint8_t tflags);
 static void ta_destroy_chash(void *ta_state, struct table_info *ti);
@@ -1248,7 +1248,7 @@ ta_print_chash_config(void *ta_state, st
 }
 
 static int
-log2(uint32_t v)
+ta_log2(uint32_t v)
 {
 	uint32_t r;
 
@@ -1300,7 +1300,7 @@ ta_init_chash(struct ip_fw_chain *ch, vo
 	ti->xstate = cfg->head6;
 
 	/* Store data depending on v6 mask length */
-	hsize = log2(cfg->size4) << 8 | log2(cfg->size6);
+	hsize = ta_log2(cfg->size4) << 8 | ta_log2(cfg->size6);
 	if (cfg->mask6 == 64) {
 		ti->data = (32 - cfg->mask4) << 24 | (128 - cfg->mask6) << 16|
 		    hsize;
@@ -1838,7 +1838,7 @@ ta_modify_chash(void *ta_state, struct t
 
 	/* Update lower 32 bits with new values */
 	ti->data &= 0xFFFFFFFF00000000;
-	ti->data |= log2(cfg->size4) << 8 | log2(cfg->size6);
+	ti->data |= ta_log2(cfg->size4) << 8 | ta_log2(cfg->size6);
 }
 
 /*

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 21:57:36 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 87C75BC0;
 Wed, 22 Oct 2014 21:57:36 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 58EADA3D;
 Wed, 22 Oct 2014 21:57:36 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MLva71098618;
 Wed, 22 Oct 2014 21:57:36 GMT (envelope-from rmacklem@FreeBSD.org)
Received: (from rmacklem@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MLvaLD098617;
 Wed, 22 Oct 2014 21:57:36 GMT (envelope-from rmacklem@FreeBSD.org)
Message-Id: <201410222157.s9MLvaLD098617@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: rmacklem set sender to
 rmacklem@FreeBSD.org using -f
From: Rick Macklem 
Date: Wed, 22 Oct 2014 21:57:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273485 - head/sys/fs/nfsclient
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 21:57:36 -0000

Author: rmacklem
Date: Wed Oct 22 21:57:35 2014
New Revision: 273485
URL: https://svnweb.freebsd.org/changeset/base/273485

Log:
  Revert r273481 so it can be recoded using fls(), which
  some feel will make it more readable.

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

Modified: head/sys/fs/nfsclient/nfs_clvfsops.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clvfsops.c	Wed Oct 22 21:45:12 2014	(r273484)
+++ head/sys/fs/nfsclient/nfs_clvfsops.c	Wed Oct 22 21:57:35 2014	(r273485)
@@ -552,7 +552,7 @@ static void
 nfs_decode_args(struct mount *mp, struct nfsmount *nmp, struct nfs_args *argp,
     const char *hostname, struct ucred *cred, struct thread *td)
 {
-	int i, s;
+	int s;
 	int adjsock;
 	char *p;
 
@@ -621,36 +621,18 @@ nfs_decode_args(struct mount *mp, struct
 
 	if ((argp->flags & NFSMNT_WSIZE) && argp->wsize > 0) {
 		nmp->nm_wsize = argp->wsize;
-		/*
-		 * Clip at the power of 2 below the size. There is an
-		 * issue (not isolated) that causes intermittent page
-		 * faults if this is not done.
-		 */
-		i = NFS_FABLKSIZE;
-		for (;;) {
-			if (i * 2 > nmp->nm_wsize) {
-				nmp->nm_wsize = i;
-				break;
-			}
-			i *= 2;
-		}
+		/* Round down to multiple of blocksize */
+		nmp->nm_wsize &= ~(NFS_FABLKSIZE - 1);
+		if (nmp->nm_wsize <= 0)
+			nmp->nm_wsize = NFS_FABLKSIZE;
 	}
 
 	if ((argp->flags & NFSMNT_RSIZE) && argp->rsize > 0) {
 		nmp->nm_rsize = argp->rsize;
-		/*
-		 * Clip at the power of 2 below the size. There is an
-		 * issue (not isolated) that causes intermittent page
-		 * faults if this is not done.
-		 */
-		i = NFS_FABLKSIZE;
-		for (;;) {
-			if (i * 2 > nmp->nm_rsize) {
-				nmp->nm_rsize = i;
-				break;
-			}
-			i *= 2;
-		}
+		/* Round down to multiple of blocksize */
+		nmp->nm_rsize &= ~(NFS_FABLKSIZE - 1);
+		if (nmp->nm_rsize <= 0)
+			nmp->nm_rsize = NFS_FABLKSIZE;
 	}
 
 	if ((argp->flags & NFSMNT_READDIRSIZE) && argp->readdirsize > 0) {

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 22:27:52 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id AD16D23C;
 Wed, 22 Oct 2014 22:27:52 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 9824BCCC;
 Wed, 22 Oct 2014 22:27:52 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MMRqQb012947;
 Wed, 22 Oct 2014 22:27:52 GMT (envelope-from rmacklem@FreeBSD.org)
Received: (from rmacklem@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MMRqCI012946;
 Wed, 22 Oct 2014 22:27:52 GMT (envelope-from rmacklem@FreeBSD.org)
Message-Id: <201410222227.s9MMRqCI012946@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: rmacklem set sender to
 rmacklem@FreeBSD.org using -f
From: Rick Macklem 
Date: Wed, 22 Oct 2014 22:27:52 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273486 - head/sys/fs/nfsclient
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 22:27:52 -0000

Author: rmacklem
Date: Wed Oct 22 22:27:51 2014
New Revision: 273486
URL: https://svnweb.freebsd.org/changeset/base/273486

Log:
  Clip the settings for the NFS rsize, wsize mount options
  to a power of 2. For non-power of 2 settings, intermittent
  page faults have been reported. Although the bug that causes
  these page faults/crashes has not been identified, it does
  not appear to occur when rsize, wsize is a power of 2.
  
  Reported by:	tcberner@gmail.com
  MFC after:	2 weeks

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

Modified: head/sys/fs/nfsclient/nfs_clvfsops.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clvfsops.c	Wed Oct 22 21:57:35 2014	(r273485)
+++ head/sys/fs/nfsclient/nfs_clvfsops.c	Wed Oct 22 22:27:51 2014	(r273486)
@@ -621,17 +621,27 @@ nfs_decode_args(struct mount *mp, struct
 
 	if ((argp->flags & NFSMNT_WSIZE) && argp->wsize > 0) {
 		nmp->nm_wsize = argp->wsize;
-		/* Round down to multiple of blocksize */
-		nmp->nm_wsize &= ~(NFS_FABLKSIZE - 1);
-		if (nmp->nm_wsize <= 0)
+		/*
+		 * Clip at the power of 2 below the size. There is an
+		 * issue (not isolated) that causes intermittent page
+		 * faults if this is not done.
+		 */
+		if (nmp->nm_wsize > NFS_FABLKSIZE)
+			nmp->nm_wsize = 1 << (fls(nmp->nm_wsize) - 1);
+		else
 			nmp->nm_wsize = NFS_FABLKSIZE;
 	}
 
 	if ((argp->flags & NFSMNT_RSIZE) && argp->rsize > 0) {
 		nmp->nm_rsize = argp->rsize;
-		/* Round down to multiple of blocksize */
-		nmp->nm_rsize &= ~(NFS_FABLKSIZE - 1);
-		if (nmp->nm_rsize <= 0)
+		/*
+		 * Clip at the power of 2 below the size. There is an
+		 * issue (not isolated) that causes intermittent page
+		 * faults if this is not done.
+		 */
+		if (nmp->nm_rsize > NFS_FABLKSIZE)
+			nmp->nm_rsize = 1 << (fls(nmp->nm_rsize) - 1);
+		else
 			nmp->nm_rsize = NFS_FABLKSIZE;
 	}
 

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 22:32:41 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id D7809415;
 Wed, 22 Oct 2014 22:32:41 +0000 (UTC)
Received: from mail-ie0-x22b.google.com (mail-ie0-x22b.google.com
 [IPv6:2607:f8b0:4001:c03::22b])
 (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits))
 (Client CN "smtp.gmail.com",
 Issuer "Google Internet Authority G2" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 89EEED7B;
 Wed, 22 Oct 2014 22:32:41 +0000 (UTC)
Received: by mail-ie0-f171.google.com with SMTP id x19so3888400ier.2
 for ; Wed, 22 Oct 2014 15:32:41 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=mime-version:sender:in-reply-to:references:from:date:message-id
 :subject:to:cc:content-type;
 bh=eCH+hfnryxpP9QEc2ew1qOgnNWHU4TllKoDTlxp03nQ=;
 b=t9atySkb7NX/0Oz/Ktc/XxhEo9AQ7I5AslWg5eXMDt9+L3C8ALSP2lO/VttvxA0odf
 2D9rhff1oh8IT9HEeMIFOk013TLwpCiSHQu1DUz1KyMgYc07Q4PAP6kpLpfnEbKN6jOv
 zfylJRNdzPyac6N7EZjRyivBFV5WffmfpBd4H0hcMw5C//F9Hu9MrZ/7GjrT3otukDsX
 f+GT0E2fKDS7ZUkP6/UeQJT4YaLJ1/9s/T5x0CMjLhl+HDDSh5i/LIzYcCZRj7fThppP
 9B4IUz0ydwAGrbKlZVYO91iihyApOH0Cb4SsnsZUfwv/rRb1X0+CFtR2Y3jjucfdoVGP
 tNIw==
X-Received: by 10.43.153.131 with SMTP id la3mr7086907icc.38.1414017160960;
 Wed, 22 Oct 2014 15:32:40 -0700 (PDT)
MIME-Version: 1.0
Sender: carpeddiem@gmail.com
Received: by 10.107.29.132 with HTTP; Wed, 22 Oct 2014 15:32:20 -0700 (PDT)
In-Reply-To: <201410222047.s9MKlBut062991@svn.freebsd.org>
References: <201410222047.s9MKlBut062991@svn.freebsd.org>
From: Ed Maste 
Date: Wed, 22 Oct 2014 18:32:20 -0400
X-Google-Sender-Auth: hTFXJzmWe54MBh9QCt3XeeeH2UM
Message-ID: 
Subject: Re: svn commit: r273481 - head/sys/fs/nfsclient
To: Rick Macklem 
Content-Type: text/plain; charset=UTF-8
Cc: "svn-src-head@freebsd.org" ,
 "svn-src-all@freebsd.org" ,
 "src-committers@freebsd.org" 
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 22:32:42 -0000

On 22 October 2014 16:47, Rick Macklem  wrote:
> Author: rmacklem
> Date: Wed Oct 22 20:47:11 2014
> New Revision: 273481
> URL: https://svnweb.freebsd.org/changeset/base/273481
>
> Log:
>   Clip the settings for the NFS rsize, wsize mount options
>   to a power of 2.

For what it's worth, I fixed a similar issue in r248500 a while back.
It was an NFS bug and resulted in data corruption instead of a crash.
Anyhow, it appears these cases are not well tested so it does seem
reasonable to avoid them.

-Ed

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 23:35:33 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 50AF3F89;
 Wed, 22 Oct 2014 23:35:33 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 22348368;
 Wed, 22 Oct 2014 23:35:33 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MNZXrw045168;
 Wed, 22 Oct 2014 23:35:33 GMT (envelope-from cperciva@FreeBSD.org)
Received: (from cperciva@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MNZW62045167;
 Wed, 22 Oct 2014 23:35:32 GMT (envelope-from cperciva@FreeBSD.org)
Message-Id: <201410222335.s9MNZW62045167@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: cperciva set sender to
 cperciva@FreeBSD.org using -f
From: Colin Percival 
Date: Wed, 22 Oct 2014 23:35:32 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273487 - head/sys/kern
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 23:35:33 -0000

Author: cperciva
Date: Wed Oct 22 23:35:32 2014
New Revision: 273487
URL: https://svnweb.freebsd.org/changeset/base/273487

Log:
  Avoid leaking data from the kernel environment: When we convert the
  initial static environment to a dynamic one, zero the static environment
  buffer, and zero individual values when kern_unsetenv and freeenv are
  called.
  
  Tested by:	kmoore (VM memory dump + grep)
  Tested by:	cperciva (kernel panic dump + grep)

Modified:
  head/sys/kern/kern_environment.c

Modified: head/sys/kern/kern_environment.c
==============================================================================
--- head/sys/kern/kern_environment.c	Wed Oct 22 22:27:51 2014	(r273486)
+++ head/sys/kern/kern_environment.c	Wed Oct 22 23:35:32 2014	(r273487)
@@ -224,7 +224,7 @@ init_static_kenv(char *buf, size_t len)
 static void
 init_dynamic_kenv(void *data __unused)
 {
-	char *cp;
+	char *cp, *cpnext;
 	size_t len;
 	int i;
 
@@ -232,7 +232,8 @@ init_dynamic_kenv(void *data __unused)
 		M_WAITOK | M_ZERO);
 	i = 0;
 	if (kern_envp && *kern_envp != '\0') {
-		for (cp = kern_envp; cp != NULL; cp = kernenv_next(cp)) {
+		for (cp = kern_envp; cp != NULL; cp = cpnext) {
+			cpnext = kernenv_next(cp);
 			len = strlen(cp) + 1;
 			if (len > KENV_MNAMELEN + 1 + KENV_MVALLEN + 1) {
 				printf(
@@ -243,6 +244,7 @@ init_dynamic_kenv(void *data __unused)
 			if (i < KENV_SIZE) {
 				kenvp[i] = malloc(len, M_KENV, M_WAITOK);
 				strcpy(kenvp[i++], cp);
+				memset(cp, 0, strlen(cp));
 			} else
 				printf(
 				"WARNING: too many kenv strings, ignoring %s\n",
@@ -260,8 +262,10 @@ void
 freeenv(char *env)
 {
 
-	if (dynamic_kenv)
+	if (dynamic_kenv) {
+		memset(env, 0, strlen(env));
 		free(env, M_KENV);
+	}
 }
 
 /*
@@ -437,6 +441,7 @@ kern_unsetenv(const char *name)
 			kenvp[i++] = kenvp[j];
 		kenvp[i] = NULL;
 		mtx_unlock(&kenv_lock);
+		memset(oldenv, 0, strlen(oldenv));
 		free(oldenv, M_KENV);
 		return (0);
 	}

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 23:35:57 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 76F6814A;
 Wed, 22 Oct 2014 23:35:57 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 6293C36B;
 Wed, 22 Oct 2014 23:35:57 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MNZvh2045252;
 Wed, 22 Oct 2014 23:35:57 GMT (envelope-from markj@FreeBSD.org)
Received: (from markj@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MNZvVY045251;
 Wed, 22 Oct 2014 23:35:57 GMT (envelope-from markj@FreeBSD.org)
Message-Id: <201410222335.s9MNZvVY045251@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: markj set sender to
 markj@FreeBSD.org using -f
From: Mark Johnston 
Date: Wed, 22 Oct 2014 23:35:57 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273488 - head/usr.sbin/pciconf
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 23:35:57 -0000

Author: markj
Date: Wed Oct 22 23:35:56 2014
New Revision: 273488
URL: https://svnweb.freebsd.org/changeset/base/273488

Log:
  Fix some buglets in the error-handling of getdevice(). In particular, report
  an error if the argument to pciconf -a doesn't have a unit number, rather
  than triggering an assertion failure.
  
  PR:		194506
  Reported by:	Anthony Cornehl 
  Sponsored by:	EMC / Isilon Storage Division

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

Modified: head/usr.sbin/pciconf/pciconf.c
==============================================================================
--- head/usr.sbin/pciconf/pciconf.c	Wed Oct 22 23:35:32 2014	(r273487)
+++ head/usr.sbin/pciconf/pciconf.c	Wed Oct 22 23:35:56 2014	(r273488)
@@ -662,16 +662,16 @@ getdevice(const char *name)
 	 * find the start of the unit.
 	 */
 	if (name[0] == '\0')
-		err(1, "Empty device name");
+		errx(1, "Empty device name");
 	cp = strchr(name, '\0');
 	assert(cp != NULL && cp != name);
 	cp--;
 	while (cp != name && isdigit(cp[-1]))
 		cp--;
-	if (cp == name)
+	if (cp == name || !isdigit(*cp))
 		errx(1, "Invalid device name");
 	if ((size_t)(cp - name) + 1 > sizeof(patterns[0].pd_name))
-		errx(1, "Device name i2s too long");
+		errx(1, "Device name is too long");
 	memcpy(patterns[0].pd_name, name, cp - name);
 	patterns[0].pd_unit = strtol(cp, &cp, 10);
 	assert(*cp == '\0');

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 23:41:16 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 02C083E1;
 Wed, 22 Oct 2014 23:41:16 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id E240B63D;
 Wed, 22 Oct 2014 23:41:15 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MNfFXw048413;
 Wed, 22 Oct 2014 23:41:15 GMT (envelope-from cperciva@FreeBSD.org)
Received: (from cperciva@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MNfFDA048412;
 Wed, 22 Oct 2014 23:41:15 GMT (envelope-from cperciva@FreeBSD.org)
Message-Id: <201410222341.s9MNfFDA048412@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: cperciva set sender to
 cperciva@FreeBSD.org using -f
From: Colin Percival 
Date: Wed, 22 Oct 2014 23:41:15 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273489 - head/sys/geom/eli
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 23:41:16 -0000

Author: cperciva
Date: Wed Oct 22 23:41:15 2014
New Revision: 273489
URL: https://svnweb.freebsd.org/changeset/base/273489

Log:
  Populate the GELI passphrase cache with the kern.geom.eli.passphrase
  variable (if any) provided in the boot environment.  Unset it from
  the kernel environment after doing this, so that the passphrase is
  no longer present in kernel memory once we enter userland.
  
  This will make it possible to provide a GELI passphrase via the boot
  loader; FreeBSD's loader does not yet do this, but GRUB (and PCBSD)
  will have support for this soon.
  
  Tested by:	kmoore

Modified:
  head/sys/geom/eli/g_eli.c

Modified: head/sys/geom/eli/g_eli.c
==============================================================================
--- head/sys/geom/eli/g_eli.c	Wed Oct 22 23:35:56 2014	(r273488)
+++ head/sys/geom/eli/g_eli.c	Wed Oct 22 23:41:15 2014	(r273489)
@@ -93,6 +93,25 @@ SYSCTL_UINT(_kern_geom_eli, OID_AUTO, bo
     &g_eli_boot_passcache, 0,
     "Passphrases are cached during boot process for possible reuse");
 static void
+fetch_loader_passphrase(void * dummy)
+{
+	char * env_passphrase;
+
+	KASSERT(dynamic_kenv, ("need dynamic kenv"));
+
+	if ((env_passphrase = kern_getenv("kern.geom.eli.passphrase")) != NULL) {
+		/* Extract passphrase from the environment. */
+		strlcpy(cached_passphrase, env_passphrase,
+		    sizeof(cached_passphrase));
+		freeenv(env_passphrase);
+
+		/* Wipe the passphrase from the environment. */
+		kern_unsetenv("kern.geom.eli.passphrase");
+	}
+}
+SYSINIT(geli_fetch_loader_passphrase, SI_SUB_KMEM + 1, SI_ORDER_ANY,
+    fetch_loader_passphrase, NULL);
+static void
 zero_boot_passcache(void * dummy)
 {
 

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 23:55:07 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id CAFA0671;
 Wed, 22 Oct 2014 23:55:07 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id B5F10785;
 Wed, 22 Oct 2014 23:55:07 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MNt7Xl054437;
 Wed, 22 Oct 2014 23:55:07 GMT (envelope-from markj@FreeBSD.org)
Received: (from markj@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MNt7W5054436;
 Wed, 22 Oct 2014 23:55:07 GMT (envelope-from markj@FreeBSD.org)
Message-Id: <201410222355.s9MNt7W5054436@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: markj set sender to
 markj@FreeBSD.org using -f
From: Mark Johnston 
Date: Wed, 22 Oct 2014 23:55:07 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject: svn commit: r273490 - stable/9/usr.bin/elfdump
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 23:55:07 -0000

Author: markj
Date: Wed Oct 22 23:55:06 2014
New Revision: 273490
URL: https://svnweb.freebsd.org/changeset/base/273490

Log:
  MFC r271692:
  Fix a typo.

Modified:
  stable/9/usr.bin/elfdump/elfdump.1
Directory Properties:
  stable/9/usr.bin/elfdump/   (props changed)

Modified: stable/9/usr.bin/elfdump/elfdump.1
==============================================================================
--- stable/9/usr.bin/elfdump/elfdump.1	Wed Oct 22 23:41:15 2014	(r273489)
+++ stable/9/usr.bin/elfdump/elfdump.1	Wed Oct 22 23:55:06 2014	(r273490)
@@ -50,7 +50,7 @@ The options are as follows:
 .It Fl a
 Dump all information.
 .It Fl c
-Dump shared headers.
+Dump section headers.
 .It Fl d
 Dump dynamic symbols.
 .It Fl e

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 22 23:55:09 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 79BAA674;
 Wed, 22 Oct 2014 23:55:09 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 65913786;
 Wed, 22 Oct 2014 23:55:09 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MNt9jm054485;
 Wed, 22 Oct 2014 23:55:09 GMT (envelope-from markj@FreeBSD.org)
Received: (from markj@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MNt9br054484;
 Wed, 22 Oct 2014 23:55:09 GMT (envelope-from markj@FreeBSD.org)
Message-Id: <201410222355.s9MNt9br054484@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: markj set sender to
 markj@FreeBSD.org using -f
From: Mark Johnston 
Date: Wed, 22 Oct 2014 23:55:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject: svn commit: r273491 - stable/10/usr.bin/elfdump
X-SVN-Group: stable-10
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Wed, 22 Oct 2014 23:55:09 -0000

Author: markj
Date: Wed Oct 22 23:55:08 2014
New Revision: 273491
URL: https://svnweb.freebsd.org/changeset/base/273491

Log:
  MFC r271692:
  Fix a typo.

Modified:
  stable/10/usr.bin/elfdump/elfdump.1
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.bin/elfdump/elfdump.1
==============================================================================
--- stable/10/usr.bin/elfdump/elfdump.1	Wed Oct 22 23:55:06 2014	(r273490)
+++ stable/10/usr.bin/elfdump/elfdump.1	Wed Oct 22 23:55:08 2014	(r273491)
@@ -50,7 +50,7 @@ The options are as follows:
 .It Fl a
 Dump all information.
 .It Fl c
-Dump shared headers.
+Dump section headers.
 .It Fl d
 Dump dynamic symbols.
 .It Fl e

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 00:00:47 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id A0809A32
 for ; Thu, 23 Oct 2014 00:00:47 +0000 (UTC)
Received: from o3.shared.sendgrid.net (o3.shared.sendgrid.net [208.117.48.85])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128
 bits)) (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 56A7C7DA
 for ; Thu, 23 Oct 2014 00:00:46 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.info; 
 h=from:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding;
 s=smtpapi; bh=DumTvoMgN4sSl70WrpidNnKVxQ8=; b=b6ibMXOf+SviYXqKOO
 vxF3rl9QFoVlCme9P/yT15gWkkoa4l8D/j7IMtzD9RLMNHL2AfgbkM8/tWpp3m/M
 A4Uw6SFcXffElkylKl+7hvQx9+ZPggb4gIIRnvHZ17p33iE8qFZtgjICCfWZoyiE
 j/Krg8GI+YpfP0HKMKrCPHaf4=
Received: by filter0077p1mdw1.sendgrid.net with SMTP id
 filter0077p1mdw1.9825.5448452BD
 2014-10-23 00:00:44.045207474 +0000 UTC
Received: from mail.tarsnap.com (unknown [10.100.60.97])
 by ismtpd-014.iad1.sendgrid.net (SG) with ESMTP id 1493a4e33d8.709e.28e7fe
 for ; Thu, 23 Oct 2014 00:00:43 +0000 (GMT)
Received: (qmail 45546 invoked from network); 23 Oct 2014 00:00:43 -0000
Received: from unknown (HELO clamshell.daemonology.net) (127.0.0.1)
 by ec2-107-20-205-189.compute-1.amazonaws.com with ESMTP;
 23 Oct 2014 00:00:43 -0000
Received: (qmail 9678 invoked from network); 23 Oct 2014 00:00:31 -0000
Received: from unknown (HELO clamshell.daemonology.net) (127.0.0.1)
 by clamshell.daemonology.net with SMTP; 23 Oct 2014 00:00:31 -0000
Message-ID: <5448451E.1040104@freebsd.org>
Date: Wed, 22 Oct 2014 17:00:30 -0700
From: Colin Percival 
User-Agent: Mozilla/5.0 (X11; FreeBSD amd64;
 rv:31.0) Gecko/20100101 Thunderbird/31.1.2
MIME-Version: 1.0
To: src-committers@freebsd.org, svn-src-all@freebsd.org, 
 svn-src-head@freebsd.org
Subject: Re: svn commit: r273487 - head/sys/kern
References: <201410222335.s9MNZW62045167@svn.freebsd.org>
In-Reply-To: <201410222335.s9MNZW62045167@svn.freebsd.org>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-SG-EID: A6W2xSVPHetogaU8rnzccWwgBYtN+QvIzXyjfe/10PHqw9YPXwy6M63llyIZn5TKIVW+zk6S/gC3zqYQBxwkeAQat5p3AgYC4y6MRRpodTaM0cxi5NMRSjbkPDbo7AdeJkQ3hMgl2uewbGFJ5r+YWi1d3aAFNrfCCnLfeP6Byac=
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 00:00:47 -0000

On 10/22/14 16:35, Colin Percival wrote:
> Author: cperciva
> Date: Wed Oct 22 23:35:32 2014
> New Revision: 273487
> URL: https://svnweb.freebsd.org/changeset/base/273487
> 
> Log:
>   Avoid leaking data from the kernel environment: When we convert the
>   initial static environment to a dynamic one, zero the static environment
>   buffer, and zero individual values when kern_unsetenv and freeenv are
>   called.

Forgot to add, this will not be MFCed, since it would break KBI to zero
out the static environment when kernel modules could conceivably have
pointers into it.

Colin Percival

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 00:09:16 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id D6D6ADA9;
 Thu, 23 Oct 2014 00:09:16 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id A91018BF;
 Thu, 23 Oct 2014 00:09:16 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N09Gx9061074;
 Thu, 23 Oct 2014 00:09:16 GMT (envelope-from delphij@FreeBSD.org)
Received: (from delphij@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N09Ght061073;
 Thu, 23 Oct 2014 00:09:16 GMT (envelope-from delphij@FreeBSD.org)
Message-Id: <201410230009.s9N09Ght061073@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: delphij set sender to
 delphij@FreeBSD.org using -f
From: Xin LI 
Date: Thu, 23 Oct 2014 00:09:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-vendor@freebsd.org
Subject: svn commit: r273492 - vendor/xz/dist/po
X-SVN-Group: vendor
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 00:09:16 -0000

Author: delphij
Date: Thu Oct 23 00:09:16 2014
New Revision: 273492
URL: https://svnweb.freebsd.org/changeset/base/273492

Log:
  Remove gettext files as we don't enable NLS.

Deleted:
  vendor/xz/dist/po/

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 00:31:26 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id DAA21F4;
 Thu, 23 Oct 2014 00:31:26 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id C6D1EA74;
 Thu, 23 Oct 2014 00:31:26 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N0VQwG073536;
 Thu, 23 Oct 2014 00:31:26 GMT (envelope-from delphij@FreeBSD.org)
Received: (from delphij@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N0VQCf073535;
 Thu, 23 Oct 2014 00:31:26 GMT (envelope-from delphij@FreeBSD.org)
Message-Id: <201410230031.s9N0VQCf073535@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: delphij set sender to
 delphij@FreeBSD.org using -f
From: Xin LI 
Date: Thu, 23 Oct 2014 00:31:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273493 - in head/contrib/xz: . po
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 00:31:27 -0000

Author: delphij
Date: Thu Oct 23 00:31:26 2014
New Revision: 273493
URL: https://svnweb.freebsd.org/changeset/base/273493

Log:
  MFV r273492: remove gettext files.

Deleted:
  head/contrib/xz/po/
Modified:
  head/contrib/xz/FREEBSD-Xlist
Directory Properties:
  head/contrib/xz/   (props changed)

Modified: head/contrib/xz/FREEBSD-Xlist
==============================================================================
--- head/contrib/xz/FREEBSD-Xlist	Thu Oct 23 00:09:16 2014	(r273492)
+++ head/contrib/xz/FREEBSD-Xlist	Thu Oct 23 00:31:26 2014	(r273493)
@@ -30,6 +30,7 @@ lib/
 m4/
 macosx/
 makefile.am
+po/
 src/*/*.rc
 src/liblzma/liblzma.pc.in
 src/scripts/

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 00:33:25 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id CB622251;
 Thu, 23 Oct 2014 00:33:25 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id B494CB0B;
 Thu, 23 Oct 2014 00:33:25 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N0XPGH074456;
 Thu, 23 Oct 2014 00:33:25 GMT (envelope-from delphij@FreeBSD.org)
Received: (from delphij@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N0XPT1074454;
 Thu, 23 Oct 2014 00:33:25 GMT (envelope-from delphij@FreeBSD.org)
Message-Id: <201410230033.s9N0XPT1074454@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: delphij set sender to
 delphij@FreeBSD.org using -f
From: Xin LI 
Date: Thu, 23 Oct 2014 00:33:25 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-vendor@freebsd.org
Subject: svn commit: r273494 - in vendor/xz/dist: . src/liblzma/api/lzma
 src/liblzma/check src/liblzma/lzma src/xz
X-SVN-Group: vendor
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 00:33:26 -0000

Author: delphij
Date: Thu Oct 23 00:33:25 2014
New Revision: 273494
URL: https://svnweb.freebsd.org/changeset/base/273494

Log:
  Vendor import of xz 5.0.7.

Modified:
  vendor/xz/dist/ChangeLog
  vendor/xz/dist/THANKS
  vendor/xz/dist/TODO
  vendor/xz/dist/src/liblzma/api/lzma/block.h
  vendor/xz/dist/src/liblzma/api/lzma/version.h
  vendor/xz/dist/src/liblzma/check/crc32_fast.c
  vendor/xz/dist/src/liblzma/check/sha256.c
  vendor/xz/dist/src/liblzma/lzma/lzma_encoder_presets.c
  vendor/xz/dist/src/xz/coder.c
  vendor/xz/dist/src/xz/signals.c
  vendor/xz/dist/src/xz/suffix.c

Modified: vendor/xz/dist/ChangeLog
==============================================================================
--- vendor/xz/dist/ChangeLog	Thu Oct 23 00:31:26 2014	(r273493)
+++ vendor/xz/dist/ChangeLog	Thu Oct 23 00:33:25 2014	(r273494)
@@ -1,6 +1,337 @@
+commit 495aaf3a5b7200a5d2bf449bbbcc0e18834607af
+Author: Lasse Collin 
+Date:   2014-09-20 20:44:32 +0300
+
+    Bump version and soname for 5.0.7.
+
+ src/liblzma/Makefile.am        | 2 +-
+ src/liblzma/api/lzma/version.h | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+commit ac6c8921d1d8d2d749d5c97f9a0b0594cc863cea
+Author: Lasse Collin 
+Date:   2014-09-20 20:43:29 +0300
+
+    Update NEWS for 5.0.7.
+
+ NEWS | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+commit d1b0276aafd441a3d4db9dfd5dd9880e9f834d49
+Author: Lasse Collin 
+Date:   2014-09-20 20:21:18 +0300
+
+    liblzma: Fix invalid Libs.private value in liblzma.pc.
+
+ src/liblzma/Makefile.am | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit cac72956b1e56788182ac14bfb25519636afd503
+Author: Lasse Collin 
+Date:   2014-09-20 19:42:56 +0300
+
+    liblzma: Fix a portability problem in Makefile.am.
+    
+    POSIX supports $< only in inference rules (suffix rules).
+    Using it elsewhere is a GNU make extension and doesn't
+    work e.g. with OpenBSD make.
+    
+    Thanks to Christian Weisgerber for the patch.
+
+ src/liblzma/Makefile.am | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit 2cdf0875dedca3e89b02ad5ac8aa1109f902ae11
+Author: Lasse Collin 
+Date:   2014-09-14 19:35:45 +0300
+
+    Bump version and soname for 5.0.6.
+
+ src/liblzma/Makefile.am        | 2 +-
+ src/liblzma/api/lzma/version.h | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+commit 0168b6c8fbc88cae61b1f5fb41d6c33c9e127967
+Author: Lasse Collin 
+Date:   2014-09-14 19:33:46 +0300
+
+    Update NEWS for 5.0.6.
+
+ NEWS | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+commit 13337714e89d002af7af48d6853f977de985d7de
+Author: Lasse Collin 
+Date:   2014-06-13 19:21:54 +0300
+
+    xzgrep: List xzgrep_expected_output in tests/Makefile.am.
+
+ tests/Makefile.am | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+commit ccc728d8290c0464c7af62790b1c5528eceaae35
+Author: Lasse Collin 
+Date:   2014-06-13 18:58:22 +0300
+
+    xzgrep: Improve the test script.
+    
+    Now it should be close to the functionality of the original
+    version by Pavel Raiskup.
+
+ tests/Makefile.am            |  3 ++-
+ tests/test_scripts.sh        | 24 ++++++++++++++----------
+ tests/xzgrep_expected_output | 39 +++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 55 insertions(+), 11 deletions(-)
+
+commit 948f5865fe65061e215baa8ed63be570bae152ea
+Author: Lasse Collin 
+Date:   2014-06-11 21:03:25 +0300
+
+    xzgrep: Add a test for the previous fix.
+    
+    This is a simplified version of Pavel Raiskup's
+    original patch.
+
+ tests/test_scripts.sh | 26 ++++++++++++++++++++++----
+ 1 file changed, 22 insertions(+), 4 deletions(-)
+
+commit 64228d0d5cd75af31e5c330cc3a792016413fabf
+Author: Lasse Collin 
+Date:   2014-06-11 20:43:28 +0300
+
+    xzgrep: exit 0 when at least one file matches.
+    
+    Mimic the original grep behavior and return exit_success when
+    at least one xz compressed file matches given pattern.
+    
+    Original bugreport:
+    https://bugzilla.redhat.com/show_bug.cgi?id=1108085
+    
+    Thanks to Pavel Raiskup for the patch.
+
+ src/scripts/xzgrep.in | 15 +++++++++++++--
+ 1 file changed, 13 insertions(+), 2 deletions(-)
+
+commit 98d3368ef4bff0face78d6932f2156730c8cb658
+Author: Lasse Collin 
+Date:   2014-04-25 17:53:42 +0300
+
+    Build: Fix the combination of --disable-xzdec --enable-lzmadec.
+    
+    In this case "make install" could fail if the man page directory
+    didn't already exist at the destination. If it did exist, a
+    dangling symlink was created there. Now the link is omitted
+    instead. This isn't the best fix but it's better than the old
+    behavior.
+
+ src/xzdec/Makefile.am | 10 +++++++++-
+ 1 file changed, 9 insertions(+), 1 deletion(-)
+
+commit ba3b5dd082db2cb5973e877a74221d739c663fb4
+Author: Lasse Collin 
+Date:   2014-04-25 17:44:26 +0300
+
+    Build: Add --disable-doc to configure.
+
+ INSTALL      | 6 ++++++
+ Makefile.am  | 2 ++
+ configure.ac | 6 ++++++
+ 3 files changed, 14 insertions(+)
+
+commit 3d4575f2367fe8f1f2dcacba014e6c0aef388535
+Author: Lasse Collin 
+Date:   2014-04-24 18:06:24 +0300
+
+    Update INSTALL.
+    
+    Add a note about failing "make check". The source of
+    the problem should be fixed in libtool (if it really is
+    a libtool bug and not mine) but I'm unable to spend time
+    on that for now. Thanks to Nelson H. F. Beebe for reporting
+    the issue.
+    
+    Add a note about a possible need to run "ldconfig" after
+    "make install".
+
+ INSTALL | 25 +++++++++++++++++++++++++
+ 1 file changed, 25 insertions(+)
+
+commit b9f0584e3eff421eadbb6604de0b0b40bf87e129
+Author: Lasse Collin 
+Date:   2014-04-09 17:26:10 +0300
+
+    xz: Rename a variable to avoid a namespace collision on Solaris.
+    
+    I don't know the details but I have an impression that there's
+    no problem in practice if using GCC since people have built xz
+    with GCC (without patching xz), but renaming the variable cannot
+    hurt either.
+    
+    Thanks to Mark Ashley.
+
+ src/xz/signals.c | 12 +++++++-----
+ 1 file changed, 7 insertions(+), 5 deletions(-)
+
+commit cc41bcaf77c9c27ec09ef033fb3300e994e828e6
+Author: Lasse Collin 
+Date:   2014-04-26 08:45:49 +0300
+
+    xz: Fix a comment.
+
+ src/xz/coder.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+commit e34025d666852839388f997d076e3577847dd10f
+Author: Lasse Collin 
+Date:   2014-01-12 16:44:52 +0200
+
+    liblzma: Avoid C99 compound literal arrays.
+    
+    MSVC 2013 doesn't like them. Maybe they aren't so good
+    for readability either since many aren't used to them.
+
+ src/liblzma/lzma/lzma_encoder_presets.c | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+commit 0b6168974f1fac3a06157039235b66e4161b9b42
+Author: Lasse Collin 
+Date:   2014-01-12 12:50:30 +0200
+
+    liblzma: Remove a useless C99ism from sha256.c.
+    
+    Unsurprisingly it makes no difference in compiled output.
+
+ src/liblzma/check/sha256.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit 41e436076cfdcccc7e853de73b0d56b3d6d42053
+Author: Lasse Collin 
+Date:   2014-01-12 12:17:08 +0200
+
+    xz: Fix use of wrong variable.
+    
+    Since the only call to suffix_set() uses optarg
+    as the argument, fixing this bug doesn't change
+    the behavior of the program.
+
+ src/xz/suffix.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit c33efefd4ef0931e5795e13725d4bd2203571ce0
+Author: Lasse Collin 
+Date:   2014-04-26 08:37:00 +0300
+
+    Fix typos in comments.
+
+ src/liblzma/check/crc32_fast.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit e560c82f1f5693d88db9dc71f656436135f17595
+Author: Lasse Collin 
+Date:   2013-11-26 18:20:16 +0200
+
+    Update THANKS.
+
+ THANKS | 1 +
+ 1 file changed, 1 insertion(+)
+
+commit 05192b32e553eac5dfbd646b6102d10187f29a05
+Author: Lasse Collin 
+Date:   2013-11-26 18:20:09 +0200
+
+    liblzma: Document the need for block->check for lzma_block_header_decode().
+    
+    Thanks to Tomer Chachamu.
+
+ src/liblzma/api/lzma/block.h | 3 +++
+ 1 file changed, 3 insertions(+)
+
+commit 0f35eafe51db7b1eb0711bc8cc829ea6896b34f4
+Author: Lasse Collin 
+Date:   2013-10-26 12:47:04 +0300
+
+    Update TODO.
+
+ TODO | 4 ----
+ 1 file changed, 4 deletions(-)
+
+commit fc9eaf81d718488b052e5c65f9d6f08acc858873
+Author: Lasse Collin 
+Date:   2013-09-11 14:40:35 +0300
+
+    Build: Remove a comment about Automake 1.10 from configure.ac.
+    
+    The previous commit supports silent rules and that requires
+    Automake 1.11.
+
+ configure.ac | 2 --
+ 1 file changed, 2 deletions(-)
+
+commit 090c69dda59e00fc86d0792879bd921bb1156029
+Author: Lasse Collin 
+Date:   2013-09-09 20:37:03 +0300
+
+    Build: Create liblzma.pc in a src/liblzma/Makefile.am.
+    
+    Previously it was done in configure, but doing that goes
+    against the Autoconf manual. Autoconf requires that it is
+    possible to override e.g. prefix after running configure
+    and that doesn't work correctly if liblzma.pc is created
+    by configure.
+    
+    A potential downside of this change is that now e.g.
+    libdir in liblzma.pc is a standalone string instead of
+    being defined via ${prefix}, so if one overrides prefix
+    when running pkg-config the libdir won't get the new value.
+    I don't know if this matters in practice.
+    
+    Thanks to Vincent Torri.
+
+ configure.ac            |  1 -
+ src/liblzma/Makefile.am | 20 ++++++++++++++++++++
+ 2 files changed, 20 insertions(+), 1 deletion(-)
+
+commit 1f35331332273de01c46897cafdb37f8e6e285db
+Author: Anders F Bjorklund 
+Date:   2013-08-02 15:59:46 +0200
+
+    macosx: separate liblzma package
+
+ macosx/build.sh | 23 +++++++++++++++--------
+ 1 file changed, 15 insertions(+), 8 deletions(-)
+
+commit 1415f1d94644f28e07d544bc1e06b0636081abee
+Author: Anders F Bjorklund 
+Date:   2013-08-02 15:58:44 +0200
+
+    macosx: set minimum to leopard
+
+ macosx/build.sh | 13 ++++++++-----
+ 1 file changed, 8 insertions(+), 5 deletions(-)
+
+commit 41913949b93414a21ae9fb1a8e9b7cdde8b37f98
+Author: Anders F Bjorklund 
+Date:   2011-08-07 13:13:30 +0200
+
+    move configurables into variables
+
+ macosx/build.sh | 25 ++++++++++++++++++-------
+ 1 file changed, 18 insertions(+), 7 deletions(-)
+
+commit 3dffda33f47dc220bb1738564fe02effa9da4c8e
+Author: Lasse Collin 
+Date:   2013-07-15 14:08:02 +0300
+
+    Build: Fix the detection of missing CRC32.
+    
+    Thanks to Vincent Torri.
+
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
 commit b69900ed0b2f914fc6c0a180dcb522dbe5b80ea7
 Author: Lasse Collin 
-Date:   Sun Jun 30 18:02:27 2013 +0300
+Date:   2013-06-30 18:02:27 +0300
 
     Man pages: Use similar syntax for synopsis as in xz.
     
@@ -10,38 +341,56 @@ Date:   Sun Jun 30 18:02:27 2013 +0300
     didn't mention these man pages in his bug report, but
     it's nice to be consistent.
 
+ src/lzmainfo/lzmainfo.1 |  4 ++--
+ src/scripts/xzmore.1    |  6 +++---
+ src/xzdec/xzdec.1       | 10 +++++-----
+ 3 files changed, 10 insertions(+), 10 deletions(-)
+
 commit cf4a1e1879d89be314ef3c064bd2656ea452f87e
 Author: Lasse Collin 
-Date:   Sun Jun 30 15:55:09 2013 +0300
+Date:   2013-06-30 15:55:09 +0300
 
     Update NEWS for 5.0.5.
 
+ NEWS | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 52 insertions(+)
+
 commit cb94bb6d1f34e1e93c2d634ea9c3b7dfb3981d05
 Author: Lasse Collin 
-Date:   Sun Jun 30 15:54:38 2013 +0300
+Date:   2013-06-30 15:54:38 +0300
 
     Bump version and soname for 5.0.5.
 
+ src/liblzma/Makefile.am        | 2 +-
+ src/liblzma/api/lzma/version.h | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
 commit b7dee202d5b041ccae028d0c5433b83cecbe9e5d
 Author: Lasse Collin 
-Date:   Fri Jun 28 23:56:17 2013 +0300
+Date:   2013-06-28 23:56:17 +0300
 
     xz: Fix return value type in io_write_buf().
     
     It didn't affect the behavior of the code since -1
     becomes true anyway.
 
+ src/xz/file_io.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
 commit 265e7b44d804b47373f10b7da28350db7611cea6
 Author: Lasse Collin 
-Date:   Fri Jun 28 18:46:13 2013 +0300
+Date:   2013-06-28 18:46:13 +0300
 
     xz: Remove an outdated NetBSD-specific comment.
     
     Nowadays errno == EFTYPE is documented in open(2).
 
+ src/xz/file_io.c | 4 ----
+ 1 file changed, 4 deletions(-)
+
 commit 78c2f8db902195468b8249c432252a6b281db836
 Author: Lasse Collin 
-Date:   Fri Jun 28 18:09:47 2013 +0300
+Date:   2013-06-28 18:09:47 +0300
 
     xz: Fix error detection of fcntl(fd, F_SETFL, flags) calls.
     
@@ -51,9 +400,12 @@ Date:   Fri Jun 28 18:09:47 2013 +0300
     F_SETFL is always 0 (at least accorinding to fcntl(2)
     from man-pages 3.51).
 
+ src/xz/file_io.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
 commit 91750dff8f2c654ff636f12a2acdffe5492374b3
 Author: Lasse Collin 
-Date:   Fri Jun 28 17:36:47 2013 +0300
+Date:   2013-06-28 17:36:47 +0300
 
     xz: Fix use of wrong variable in a fcntl() call.
     
@@ -69,9 +421,12 @@ Date:   Fri Jun 28 17:36:47 2013 +0300
     indicate when the flags should be restored instead of
     relying on a special value in stdout_flags.
 
+ src/xz/file_io.c | 24 +++++++++++++-----------
+ 1 file changed, 13 insertions(+), 11 deletions(-)
+
 commit e11888a79a4a77a69afde60445880d44f63d01aa
 Author: Lasse Collin 
-Date:   Wed Jun 26 13:30:57 2013 +0300
+Date:   2013-06-26 13:30:57 +0300
 
     xz: Check the value of lzma_stream_flags.version in --list.
     
@@ -80,9 +435,12 @@ Date:   Wed Jun 26 13:30:57 2013 +0300
     then this check becomes important and will stop the old xz
     from trying to parse files that it won't understand.
 
+ src/xz/list.c | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
 commit f39ddd88f3222219ada88998cf30abfdd3e0e96c
 Author: Lasse Collin 
-Date:   Wed Jun 26 12:17:00 2013 +0300
+Date:   2013-06-26 12:17:00 +0300
 
     Build: Require Automake 1.12 and use serial-tests option.
     
@@ -95,9 +453,12 @@ Date:   Wed Jun 26 12:17:00 2013 +0300
     in XZ Utils but they hide the progress output from
     test_compress.sh.
 
+ configure.ac | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
 commit cb84e278027a90e9827a6f4d3bb0b4d4744a2fbb
 Author: Lasse Collin 
-Date:   Sun Jun 23 17:36:47 2013 +0300
+Date:   2013-06-23 17:36:47 +0300
 
     xz: Validate Uncompressed Size from Block Header in list.c.
     
@@ -107,23 +468,32 @@ Date:   Sun Jun 23 17:36:47 2013 +0300
     show such files as corrupt instead of showing the
     Uncompressed Size from Index.
 
+ src/xz/list.c | 14 +++++++++++++-
+ 1 file changed, 13 insertions(+), 1 deletion(-)
+
 commit f01780fce454c7489f7dcbf806299b50da5f51b7
 Author: Lasse Collin 
-Date:   Wed Jun 26 10:58:58 2013 +0300
+Date:   2013-06-26 10:58:58 +0300
 
     Update THANKS.
 
+ THANKS | 2 ++
+ 1 file changed, 2 insertions(+)
+
 commit d98ede7d700b892e32d9c2f46563b6ebc566786d
 Author: Lasse Collin 
-Date:   Fri Jun 21 22:04:45 2013 +0300
+Date:   2013-06-21 22:04:45 +0300
 
     xz: Make the man page more friendly to doclifter.
     
     Thanks to Eric S. Raymond.
 
+ src/xz/xz.1 | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
 commit 19b447b64b3f520cd5b11429000b092f7c76709b
 Author: Lasse Collin 
-Date:   Fri Jun 21 21:54:59 2013 +0300
+Date:   2013-06-21 21:54:59 +0300
 
     xz: A couple of man page fixes.
     
@@ -133,9 +503,12 @@ Date:   Fri Jun 21 21:54:59 2013 +0300
     Thanks to DevHC who reported these issues on IRC to me
     on 2012-12-14.
 
+ src/xz/xz.1 | 35 +++++++++++++++++++++++------------
+ 1 file changed, 23 insertions(+), 12 deletions(-)
+
 commit 45edf2966fc9a4d2eae8f84b2fa027fb4fa1df8b
 Author: Lasse Collin 
-Date:   Fri Jun 21 21:50:26 2013 +0300
+Date:   2013-06-21 21:50:26 +0300
 
     xz: Fix interaction between preset and custom filter chains.
     
@@ -158,15 +531,22 @@ Date:   Fri Jun 21 21:50:26 2013 +0300
     
     Thanks to Conley Moorhous.
 
+ src/xz/coder.c | 35 +++++++++++++++++++++--------------
+ 1 file changed, 21 insertions(+), 14 deletions(-)
+
 commit b065984e5a9272eb50bc0c6d3731e6199c0ae8a8
 Author: Lasse Collin 
-Date:   Fri Apr 8 17:53:05 2011 +0300
+Date:   2011-04-08 17:53:05 +0300
 
     xz: Change size_t to uint32_t in a few places.
 
+ src/xz/coder.c | 6 +++---
+ src/xz/coder.h | 2 +-
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
 commit 32be621f52f2e1686db88baa7b01dc1ae338f426
 Author: Lasse Collin 
-Date:   Sat Apr 27 22:07:46 2013 +0300
+Date:   2013-04-27 22:07:46 +0300
 
     Build: Use -Wvla with GCC if supported.
     
@@ -175,9 +555,12 @@ Date:   Sat Apr 27 22:07:46 2013 +0300
     future either to stay compatible with C11 without requiring any
     optional C11 features.
 
+ configure.ac | 1 +
+ 1 file changed, 1 insertion(+)
+
 commit efb07cfba65e9e05984c02cd796c1b0338ce04dc
 Author: Lasse Collin 
-Date:   Mon Apr 15 19:29:09 2013 +0300
+Date:   2013-04-15 19:29:09 +0300
 
     xzdec: Improve the --help message.
     
@@ -189,23 +572,32 @@ Date:   Mon Apr 15 19:29:09 2013 +0300
     because I find it easier to spot the ignored vs. non-ignored
     options from the list that way.
 
+ src/xzdec/xzdec.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
 commit e3c8be13699e2813f5e2879d8187444b46d82d89
 Author: Lasse Collin 
-Date:   Fri Apr 5 19:25:40 2013 +0300
+Date:   2013-04-05 19:25:40 +0300
 
     Update THANKS.
 
+ THANKS | 2 ++
+ 1 file changed, 2 insertions(+)
+
 commit ad8282efe483612f6b5544f9a0d2e4914fb2532a
 Author: Jeff Bastian 
-Date:   Wed Apr 3 13:59:17 2013 +0200
+Date:   2013-04-03 13:59:17 +0200
 
     xzgrep: make the '-h' option to be --no-filename equivalent
     
     * src/scripts/xzgrep.in: Accept the '-h' option in argument parsing.
 
+ src/scripts/xzgrep.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
 commit 9271a3eb0e022b23e8712154be851d0afe4c02e4
 Author: Lasse Collin 
-Date:   Fri Apr 5 19:34:09 2013 +0300
+Date:   2013-04-05 19:34:09 +0300
 
     liblzma: Be less picky in lzma_alone_decoder().
     
@@ -231,9 +623,14 @@ Date:   Fri Apr 5 19:34:09 2013 +0300
     	src/liblzma/common/alone_decoder.c
     	src/liblzma/common/alone_decoder.h
 
+ src/liblzma/common/alone_decoder.c | 22 ++++++++++++++--------
+ src/liblzma/common/alone_decoder.h |  5 +++--
+ src/liblzma/common/auto_decoder.c  |  2 +-
+ 3 files changed, 18 insertions(+), 11 deletions(-)
+
 commit 211b931cee58626c1d2e021810cb108cb5cbc10f
 Author: Lasse Collin 
-Date:   Tue Mar 5 19:14:50 2013 +0200
+Date:   2013-03-05 19:14:50 +0200
 
     Avoid unneeded use of awk in xzless.
     
@@ -243,9 +640,12 @@ Date:   Tue Mar 5 19:14:50 2013 +0200
     
     Thanks to Ariel P for the patch.
 
+ src/scripts/xzless.in | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
 commit 9f62fd9605eade23b62b07a235d1f02156f7a5c6
 Author: Jonathan Nieder 
-Date:   Mon Nov 19 00:10:10 2012 -0800
+Date:   2012-11-19 00:10:10 -0800
 
     xzless: Make "less -V" parsing more robust
     
@@ -282,46 +682,66 @@ Date:   Mon Nov 19 00:10:10 2012 -0800
     Reported-by: Jörg-Volker Peetz 
     Signed-off-by: Jonathan Nieder 
 
+ src/scripts/xzless.in | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
 commit 1d05980f5b5c2c94d833001daccacce4a466876e
 Author: Lasse Collin 
-Date:   Wed Oct 3 15:54:24 2012 +0300
+Date:   2012-10-03 15:54:24 +0300
 
     xz: Fix the note about --rsyncable on the man page.
 
+ src/xz/xz.1 | 17 +++++++++--------
+ 1 file changed, 9 insertions(+), 8 deletions(-)
+
 commit fb68497333598688d309a92838d91fd560f7e9f0
 Author: Lasse Collin 
-Date:   Fri Sep 28 20:11:09 2012 +0300
+Date:   2012-09-28 20:11:09 +0300
 
     xz: Improve handling of failed realloc in xrealloc.
     
     Thanks to Jim Meyering.
 
+ src/xz/util.c | 14 ++++++++++++--
+ 1 file changed, 12 insertions(+), 2 deletions(-)
+
 commit 75013db6d4d63c195bd8b8d45729b4be0665a812
 Author: Lasse Collin 
-Date:   Sat Dec 15 20:01:02 2012 +0200
+Date:   2012-12-15 20:01:02 +0200
 
     A few typo fixes to comments and the xz man page.
     
     Thanks to Jim Meyering.
 
+ configure.ac               | 2 +-
+ src/liblzma/check/sha256.c | 1 -
+ src/xz/xz.1                | 4 ++--
+ 3 files changed, 3 insertions(+), 4 deletions(-)
+
 commit e44b21839b1dcbac5097be39b87dd2ddb6e114fd
 Author: Lasse Collin 
-Date:   Thu Aug 2 17:13:30 2012 +0300
+Date:   2012-08-02 17:13:30 +0300
 
     Build: Bump gettext version requirement to 0.18.
     
     Otherwise too old version of m4/lib-link.m4 gets included
     when autoreconf -fi is run.
 
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
 commit fd3dbb23ca7e75a7a888d7e897c381dc06308307
 Author: Lasse Collin 
-Date:   Thu Jul 5 07:36:28 2012 +0300
+Date:   2012-07-05 07:36:28 +0300
 
     Tests: Remove tests/test_block.c that had gotten committed accidentally.
 
+ tests/test_block.c | 52 ----------------------------------------------------
+ 1 file changed, 52 deletions(-)
+
 commit 05a735d279d74af437c31f25f69aded4713c1a3d
 Author: Lasse Collin 
-Date:   Thu Jul 5 07:33:35 2012 +0300
+Date:   2012-07-05 07:33:35 +0300
 
     Build: Include macosx/build.sh in the distribution.
     
@@ -329,55 +749,81 @@ Date:   Thu Jul 5 07:33:35 2012 +0300
     few people have seen it since it hasn't been included in
     the release tarballs. :-(
 
+ Makefile.am | 1 +
+ 1 file changed, 1 insertion(+)
+
 commit 4e6d62793b5e7b87edcc93c7ded072c1ecd94173
 Author: Lasse Collin 
-Date:   Thu Jul 5 07:24:45 2012 +0300
+Date:   2012-07-05 07:24:45 +0300
 
     Docs: Fix the name LZMA Utils -> XZ Utils in debug/README.
 
+ debug/README | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
 commit dd95b5e7614baf1f07a1316b5106bd616a9efa79
 Author: Lasse Collin 
-Date:   Thu Jul 5 07:23:17 2012 +0300
+Date:   2012-07-05 07:23:17 +0300
 
     Include debug/translation.bash in the distribution.
     
     Also fix the script name mentioned in README.
 
+ README            | 4 ++--
+ debug/Makefile.am | 3 +++
+ 2 files changed, 5 insertions(+), 2 deletions(-)
+
 commit 20778053a07eb90c159c1377ca8dc05a90fd530b
 Author: Lasse Collin 
-Date:   Fri Jun 22 14:36:16 2012 +0300
+Date:   2012-06-22 14:36:16 +0300
 
     xz: Update man page date to match the latest update.
 
+ src/xz/xz.1 | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
 commit 2cefa84af676da37d7e9c466d55d46c67ab00c22
 Author: Lasse Collin 
-Date:   Fri Jun 22 10:25:43 2012 +0300
+Date:   2012-06-22 10:25:43 +0300
 
     Bump version and soname for 5.0.4.
 
+ src/liblzma/Makefile.am        | 2 +-
+ src/liblzma/api/lzma/version.h | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
 commit 433fec191a17e45690809e54146ea7a773f54cff
 Author: Lasse Collin 
-Date:   Fri Jun 22 10:25:09 2012 +0300
+Date:   2012-06-22 10:25:09 +0300
 
     Update NEWS for 5.0.4.
 
+ NEWS | 25 +++++++++++++++++++------
+ 1 file changed, 19 insertions(+), 6 deletions(-)
+
 commit 711fa680f552a4003df73b37e6dc4d6e00b47bcd
 Author: Lasse Collin 
-Date:   Mon Jun 18 21:27:47 2012 +0300
+Date:   2012-06-18 21:27:47 +0300
 
     Docs: Language fix to 01_compress_easy.c.
     
     Thanks to Jonathan Nieder.
 
+ doc/examples/01_compress_easy.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
 commit 3d7ab1dc61a75c560828be5df96598388b771456
 Author: Lasse Collin 
-Date:   Thu Jun 14 20:15:30 2012 +0300
+Date:   2012-06-14 20:15:30 +0300
 
     Fix the top-level Makefile.am for the new example programs.
 
+ Makefile.am | 12 ++++++++++--
+ 1 file changed, 10 insertions(+), 2 deletions(-)
+
 commit ef8b8e5f111469b5bc005975f7abb9abbd372b25
 Author: Lasse Collin 
-Date:   Thu Jun 14 10:52:33 2012 +0300
+Date:   2012-06-14 10:52:33 +0300
 
     Docs: Add new example programs.
     
@@ -385,9 +831,16 @@ Date:   Thu Jun 14 10:52:33 2012 +0300
     human-readable error messages. More tutorial-like examples
     are needed but these are a start.
 
+ doc/examples/00_README.txt        |  27 ++++
+ doc/examples/01_compress_easy.c   | 297 ++++++++++++++++++++++++++++++++++++++
+ doc/examples/02_decompress.c      | 287 ++++++++++++++++++++++++++++++++++++
+ doc/examples/03_compress_custom.c | 193 +++++++++++++++++++++++++
+ doc/examples/Makefile             |  23 +++
+ 5 files changed, 827 insertions(+)
+
 commit 75c149bc8045a26f8bc719cb8ed20668dab79091
 Author: Lasse Collin 
-Date:   Thu Jun 14 10:33:27 2012 +0300
+Date:   2012-06-14 10:33:27 +0300
 
     Docs: Move xz_pipe_comp.c and xz_pipe_decomp.c to doc/examples_old.
     
@@ -395,49 +848,73 @@ Date:   Thu Jun 14 10:33:27 2012 +0300
     copied the decompressor bug from xz_pipe_decomp.c he has
     an example how to easily fix it.
 
+ doc/examples/xz_pipe_comp.c       | 127 --------------------------------------
+ doc/examples/xz_pipe_decomp.c     | 123 ------------------------------------
+ doc/examples_old/xz_pipe_comp.c   | 127 ++++++++++++++++++++++++++++++++++++++
+ doc/examples_old/xz_pipe_decomp.c | 123 ++++++++++++++++++++++++++++++++++++
+ 4 files changed, 250 insertions(+), 250 deletions(-)
+
 commit 456307ebf947a5f50bd995d617b99c1215572308
 Author: Lasse Collin 
-Date:   Thu Jun 14 10:33:01 2012 +0300
+Date:   2012-06-14 10:33:01 +0300
 
     Docs: Fix a bug in xz_pipe_decomp.c example program.
 
+ doc/examples/xz_pipe_decomp.c | 10 +++++++++-
+ 1 file changed, 9 insertions(+), 1 deletion(-)
+
 commit 4c310b8a29bc257e6ccbd2310f12f258678f3fef
 Author: Lasse Collin 
-Date:   Thu May 31 15:53:25 2012 +0300
+Date:   2012-05-31 15:53:25 +0300
 
     Translations: Update the Italian translation.
     
     Thanks to Milo Casagrande.
 
+ po/it.po | 311 ++++++++++++++++++++++++++++++---------------------------------
+ 1 file changed, 146 insertions(+), 165 deletions(-)
+
 commit ec32b79366dc47a55ea877589df9e8509ba113a7
 Author: Lasse Collin 
-Date:   Wed May 30 23:15:07 2012 +0300
+Date:   2012-05-30 23:15:07 +0300
 
     Translations: Update the French translation.
     
     Thanks to Adrien Nader.
 
+ po/fr.po | 237 +++++++++++++++++++++++++++++++--------------------------------
+ 1 file changed, 118 insertions(+), 119 deletions(-)
+
 commit dd06f40e4dd7649525e4f28d890dc238a3aa37e5
 Author: Lasse Collin 
-Date:   Tue May 29 22:26:27 2012 +0300
+Date:   2012-05-29 22:26:27 +0300
 
     Translations: Update the German translation.
 
+ po/de.po | 169 ++++++++++++++++++++++++++++++++++-----------------------------
+ 1 file changed, 91 insertions(+), 78 deletions(-)
+
 commit c66808d1f55d0149ed57c536cc9b52e9c8b583bc
 Author: Lasse Collin 
-Date:   Tue May 29 22:12:57 2012 +0300
+Date:   2012-05-29 22:12:57 +0300
 
     Translations: Update Polish translation.
 
+ po/pl.po | 150 ++++++++++++++++++++++++++++++++++-----------------------------
+ 1 file changed, 82 insertions(+), 68 deletions(-)
+
 commit 556c22dfed195c1466b298183b850d6c28544900
 Author: Lasse Collin 
-Date:   Tue May 29 13:10:36 2012 +0300
+Date:   2012-05-29 13:10:36 +0300
 
     Preliminary NEWS for 5.0.4.
 
+ NEWS | 24 ++++++++++++++++++++++++
+ 1 file changed, 24 insertions(+)
+
 commit dd13b66bf582f49d3aec36e3410ff8541b7506da
 Author: Lasse Collin 
-Date:   Mon May 28 20:42:11 2012 +0300
+Date:   2012-05-28 20:42:11 +0300
 
     liblzma: Fix possibility of incorrect LZMA_BUF_ERROR.
     
@@ -465,21 +942,32 @@ Date:   Mon May 28 20:42:11 2012 +0300
     
     A similar bug was fixed in XZ Embedded on 2011-09-19.
 
+ src/liblzma/simple/simple_coder.c |   2 +-
+ tests/Makefile.am                 |   4 +-
+ tests/test_bcj_exact_size.c       | 112 ++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 116 insertions(+), 2 deletions(-)
+
 commit a0223bf796fdaad51a11ad02c4195c694849cc78
 Author: Lasse Collin 
-Date:   Mon May 28 15:38:32 2012 +0300
+Date:   2012-05-28 15:38:32 +0300
 
     Update THANKS.
 
+ THANKS | 1 +
+ 1 file changed, 1 insertion(+)
+
 commit 86e57e4bfefe3fd8e13615c41604165bb2359501
 Author: Lasse Collin 
-Date:   Mon May 28 15:37:43 2012 +0300
+Date:   2012-05-28 15:37:43 +0300
 
     xz: Don't show a huge number in -vv when memory limit is disabled.
 
+ src/xz/message.c | 12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
 commit 13e44a94da19d1ef14832ff12d3877a6fd2c54c0
 Author: Lasse Collin 
-Date:   Sun May 27 22:30:17 2012 +0300
+Date:   2012-05-27 22:30:17 +0300
 
     xz: Document the "summary" lines of --robot -lvv.
     
@@ -487,30 +975,43 @@ Date:   Sun May 27 22:30:17 2012 +0300
     The new columns added in the master branch aren't
     necessarily stable yet.
 
+ src/xz/xz.1 | 19 +++++++++++++++++++
+ 1 file changed, 19 insertions(+)
+
 commit 2f90345e13ab8fea4de45a4f1caa73ebc63a62e7
 Author: Lasse Collin 
-Date:   Sun May 27 21:53:20 2012 +0300
+Date:   2012-05-27 21:53:20 +0300
 
     xz: Fix output of verbose --robot --list modes.
     
     It printed the filename in "filename (x/y)" format
     which it obviously shouldn't do in robot mode.
 
+ src/xz/message.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
 commit 8d4864f53ffae5d862c691a0b334a6b69bc5366e
 Author: Lasse Collin 
-Date:   Thu May 10 21:15:17 2012 +0300
+Date:   2012-05-10 21:15:17 +0300
 
     Update THANKS.
 
+ THANKS | 1 +
+ 1 file changed, 1 insertion(+)
+
 commit 35e9c58abb0ce3993da844aaeaa3e7231cd2be8f
 Author: Lasse Collin 
-Date:   Thu May 10 21:14:16 2012 +0300
+Date:   2012-05-10 21:14:16 +0300
 
     Docs: Cleanup line wrapping a bit.
 
+ README          | 12 ++++++------
+ doc/history.txt | 49 +++++++++++++++++++++++++------------------------
+ 2 files changed, 31 insertions(+), 30 deletions(-)
+
 commit 532b3e4c568a228309b56f95c13435fd078dbe02
 Author: Benno Schulenberg 
-Date:   Tue Mar 13 22:04:04 2012 +0100
+Date:   2012-03-13 22:04:04 +0100
 
     Fix a few typos and add some missing articles in some documents.
     
@@ -518,42 +1019,64 @@ Date:   Tue Mar 13 22:04:04 2012 +0100
     
     Signed-off-by: Benno Schulenberg 
 
+ AUTHORS         |  6 +++---
+ README          | 42 ++++++++++++++++++++---------------------
+ doc/faq.txt     | 24 ++++++++++++------------
+ doc/history.txt | 58 ++++++++++++++++++++++++++++-----------------------------
+ 4 files changed, 65 insertions(+), 65 deletions(-)
+
 commit afb6ce8c82ffef8f2505a3759da72a733c7b0b8f
 Author: Lasse Collin 
-Date:   Sun Apr 29 11:51:25 2012 +0300
+Date:   2012-04-29 11:51:25 +0300
 
     Windows: Update notes about static linking with MSVC.
 
+ windows/README-Windows.txt | 13 +++++++++----
+ 1 file changed, 9 insertions(+), 4 deletions(-)
+
 commit 7c3ba2ed5c3c878d4a14ca549b46dbff60c6d565
 Author: Lasse Collin 
-Date:   Thu Apr 19 15:25:26 2012 +0300
+Date:   2012-04-19 15:25:26 +0300
 
     liblzma: Remove outdated comments.
 
+ src/liblzma/simple/simple_coder.c   | 3 ---
+ src/liblzma/simple/simple_private.h | 3 +--
+ 2 files changed, 1 insertion(+), 5 deletions(-)
+
 commit f55db9c187651094f43881c49db2b2d9ffee6b80
 Author: Lasse Collin 
-Date:   Thu Apr 19 14:17:52 2012 +0300
+Date:   2012-04-19 14:17:52 +0300
 
     DOS: Link against DJGPP's libemu to support FPU emulation.
     
     This way xz should work on 386SX and 486SX. Floating point
     only is needed for verbose output in xz.

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 00:37:52 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id BCBF54A9;
 Thu, 23 Oct 2014 00:37:52 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 8F4AFB40;
 Thu, 23 Oct 2014 00:37:52 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N0bq4e075226;
 Thu, 23 Oct 2014 00:37:52 GMT (envelope-from delphij@FreeBSD.org)
Received: (from delphij@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N0bqNC075225;
 Thu, 23 Oct 2014 00:37:52 GMT (envelope-from delphij@FreeBSD.org)
Message-Id: <201410230037.s9N0bqNC075225@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: delphij set sender to
 delphij@FreeBSD.org using -f
From: Xin LI 
Date: Thu, 23 Oct 2014 00:37:52 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-vendor@freebsd.org
Subject: svn commit: r273495 - vendor/xz/5.0.7
X-SVN-Group: vendor
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 00:37:52 -0000

Author: delphij
Date: Thu Oct 23 00:37:52 2014
New Revision: 273495
URL: https://svnweb.freebsd.org/changeset/base/273495

Log:
  Tag xz 5.0.7.

Added:
  vendor/xz/5.0.7/
     - copied from r273494, vendor/xz/dist/

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 00:39:20 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id E4DC35D3;
 Thu, 23 Oct 2014 00:39:20 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id C4F6EB51;
 Thu, 23 Oct 2014 00:39:20 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N0dKmh075467;
 Thu, 23 Oct 2014 00:39:20 GMT (envelope-from ngie@FreeBSD.org)
Received: (from ngie@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N0dJxi075459;
 Thu, 23 Oct 2014 00:39:19 GMT (envelope-from ngie@FreeBSD.org)
Message-Id: <201410230039.s9N0dJxi075459@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org
 using -f
From: Garrett Cooper 
Date: Thu, 23 Oct 2014 00:39:19 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject: svn commit: r273496 - stable/10/usr.bin/talk
X-SVN-Group: stable-10
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 00:39:21 -0000

Author: ngie
Date: Thu Oct 23 00:39:19 2014
New Revision: 273496
URL: https://svnweb.freebsd.org/changeset/base/273496

Log:
  MFC r263264 (by glebius):
  
    Make talk(1) capable of displaying UTF-8 characters.
  
    Sponsored by:	Nginx, Inc.

Modified:
  stable/10/usr.bin/talk/Makefile
  stable/10/usr.bin/talk/display.c
  stable/10/usr.bin/talk/io.c
  stable/10/usr.bin/talk/talk.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.bin/talk/Makefile
==============================================================================
--- stable/10/usr.bin/talk/Makefile	Thu Oct 23 00:37:52 2014	(r273495)
+++ stable/10/usr.bin/talk/Makefile	Thu Oct 23 00:39:19 2014	(r273496)
@@ -4,7 +4,7 @@
 PROG=	talk
 SRCS=	ctl.c ctl_transact.c display.c get_addrs.c get_iface.c get_names.c \
 	init_disp.c invite.c io.c look_up.c msgs.c talk.c
-DPADD=	${LIBCURSES}
-LDADD=	-lcurses
+DPADD=	${LIBCURSESW}
+LDADD=	-lcursesw
 
 .include 

Modified: stable/10/usr.bin/talk/display.c
==============================================================================
--- stable/10/usr.bin/talk/display.c	Thu Oct 23 00:37:52 2014	(r273495)
+++ stable/10/usr.bin/talk/display.c	Thu Oct 23 00:39:19 2014	(r273496)
@@ -41,9 +41,14 @@ static const char sccsid[] = "@(#)displa
  */
 #include 
 #include 
+#include 
+#define _XOPEN_SOURCE_EXTENDED
+#include 
 
 #include "talk.h"
 
+void	display(xwin_t *, wchar_t *);
+
 xwin_t	my_win;
 xwin_t	his_win;
 WINDOW	*line_win;
@@ -61,111 +66,130 @@ max(int a, int b)
 	return (a > b ? a : b);
 }
 
+static cchar_t *
+makecchar(wchar_t in)
+{
+	static cchar_t cc;
+	wchar_t wc[2];
+
+	wc[0] = in;
+	wc[1] = L'\0';
+
+	if (setcchar(&cc, wc, A_NORMAL, 0, NULL) != OK)
+		p_error("settchar(3) failure");
+
+	return (&cc);
+}
+
 /*
- * Display some text on somebody's window, processing some control
+ * Display a symbol on somebody's window, processing some control
  * characters while we are at it.
  */
 void
-display(xwin_t *win, char *text, int size)
+display(xwin_t *win, wchar_t *wc)
 {
-	int i;
-	char cch;
 
-	for (i = 0; i < size; i++) {
-		if (*text == '\n' || *text == '\r') {
-			waddch(win->x_win, '\n');
-			getyx(win->x_win, win->x_line, win->x_col);
-			text++;
-			continue;
-		}
-		if (*text == 004 && win == &my_win) {
-			/* control-D clears the screen */
+	/*
+	 * Alas, can't use variables in C switch statement.
+	 * Workaround these 3 cases with goto.
+	 */
+	if (*wc == win->kill)
+		goto kill;
+	else if (*wc == win->cerase)
+		goto cerase;
+	else if (*wc == win->werase)
+		goto werase;
+
+	switch (*wc) {
+	case L'\n':
+	case L'\r':
+		wadd_wch(win->x_win, makecchar(L'\n'));
+		getyx(win->x_win, win->x_line, win->x_col);
+		wrefresh(win->x_win);
+		return;
+
+	case 004:
+		if (win == &my_win) {
+			/* Ctrl-D clears the screen. */
 			werase(my_win.x_win);
 			getyx(my_win.x_win, my_win.x_line, my_win.x_col);
 			wrefresh(my_win.x_win);
 			werase(his_win.x_win);
 			getyx(his_win.x_win, his_win.x_line, his_win.x_col);
 			wrefresh(his_win.x_win);
-			text++;
-			continue;
 		}
+		return;
 
-		/* erase character */
-		if (   *text == win->cerase
-		    || *text == 010     /* BS */
-		    || *text == 0177    /* DEL */
-		   ) {
-			wmove(win->x_win, win->x_line, max(--win->x_col, 0));
-			getyx(win->x_win, win->x_line, win->x_col);
-			waddch(win->x_win, ' ');
-			wmove(win->x_win, win->x_line, win->x_col);
-			getyx(win->x_win, win->x_line, win->x_col);
-			text++;
-			continue;
-		}
+	/* Erase character. */
+	case 010:	/* BS */
+	case 0177:	/* DEL */
+cerase:
+		wmove(win->x_win, win->x_line, max(--win->x_col, 0));
+		getyx(win->x_win, win->x_line, win->x_col);
+		waddch(win->x_win, ' ');
+		wmove(win->x_win, win->x_line, win->x_col);
+		getyx(win->x_win, win->x_line, win->x_col);
+		wrefresh(win->x_win);
+		return;
+
+	case 027:	/* ^W */
+werase:
+	    {
 		/*
 		 * On word erase search backwards until we find
 		 * the beginning of a word or the beginning of
 		 * the line.
 		 */
-		if (   *text == win->werase
-		    || *text == 027     /* ^W */
-		   ) {
-			int endcol, xcol, ii, c;
-
-			endcol = win->x_col;
-			xcol = endcol - 1;
-			while (xcol >= 0) {
-				c = readwin(win->x_win, win->x_line, xcol);
-				if (c != ' ')
-					break;
-				xcol--;
-			}
-			while (xcol >= 0) {
-				c = readwin(win->x_win, win->x_line, xcol);
-				if (c == ' ')
-					break;
-				xcol--;
-			}
-			wmove(win->x_win, win->x_line, xcol + 1);
-			for (ii = xcol + 1; ii < endcol; ii++)
-				waddch(win->x_win, ' ');
-			wmove(win->x_win, win->x_line, xcol + 1);
-			getyx(win->x_win, win->x_line, win->x_col);
-			text++;
-			continue;
-		}
-		/* line kill */
-		if (   *text == win->kill
-		    || *text == 025     /* ^U */
-		   ) {
-			wmove(win->x_win, win->x_line, 0);
-			wclrtoeol(win->x_win);
-			getyx(win->x_win, win->x_line, win->x_col);
-			text++;
-			continue;
-		}
-		if (*text == '\f') {
-			if (win == &my_win)
-				wrefresh(curscr);
-			text++;
-			continue;
-		}
-		if (*text == '\7') {
-			write(STDOUT_FILENO, text, 1);
-			text++;
-			continue;
+		int endcol, xcol, c;
+
+		endcol = win->x_col;
+		xcol = endcol - 1;
+		while (xcol >= 0) {
+			c = readwin(win->x_win, win->x_line, xcol);
+			if (c != ' ')
+				break;
+			xcol--;
+		}
+		while (xcol >= 0) {
+			c = readwin(win->x_win, win->x_line, xcol);
+			if (c == ' ')
+				break;
+			xcol--;
 		}
-		if (!isprint((unsigned char)*text) && *text != '\t') {
-			waddch(win->x_win, '^');
-			getyx(win->x_win, win->x_line, win->x_col);
-			cch = (*text & 63) + 64;
-			waddch(win->x_win, cch);
-		} else
-			waddch(win->x_win, (unsigned char)*text);
+		wmove(win->x_win, win->x_line, xcol + 1);
+		for (int i = xcol + 1; i < endcol; i++)
+			waddch(win->x_win, ' ');
+		wmove(win->x_win, win->x_line, xcol + 1);
+		getyx(win->x_win, win->x_line, win->x_col);
+		wrefresh(win->x_win);
+		return;
+	    }
+
+	case 025:	/* ^U */
+kill:
+		wmove(win->x_win, win->x_line, 0);
+		wclrtoeol(win->x_win);
 		getyx(win->x_win, win->x_line, win->x_col);
-		text++;
+		wrefresh(win->x_win);
+		return;
+
+	case L'\f':
+		if (win == &my_win)
+			wrefresh(curscr);
+		return;
+
+	case L'\7':
+		write(STDOUT_FILENO, wc, sizeof(*wc));
+		return;
 	}
+
+
+	if (iswprint(*wc) || *wc == L'\t')
+		wadd_wch(win->x_win, makecchar(*wc));
+	else
+		beep();
+
+	getyx(win->x_win, win->x_line, win->x_col);
 	wrefresh(win->x_win);
 }
 

Modified: stable/10/usr.bin/talk/io.c
==============================================================================
--- stable/10/usr.bin/talk/io.c	Thu Oct 23 00:37:52 2014	(r273495)
+++ stable/10/usr.bin/talk/io.c	Thu Oct 23 00:39:19 2014	(r273496)
@@ -46,14 +46,17 @@ static const char sccsid[] = "@(#)io.c	8
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
+#define _XOPEN_SOURCE_EXTENDED
+#include 
 
 #include "talk.h"
 #include "talk_ctl.h"
 
-#define A_LONG_TIME 10000000
+extern void	display(xwin_t *, wchar_t *);
 
 volatile sig_atomic_t gotwinch = 0;
 
@@ -65,9 +68,10 @@ talk(void)
 {
 	struct hostent *hp, *hp2;
 	int nb;
-	fd_set read_set, read_template;
-	char buf[BUFSIZ], **addr, *his_machine_name;
-	struct timeval wait;
+	fd_set read_set;
+	wchar_t buf[BUFSIZ];
+	char **addr, *his_machine_name;
+	FILE *sockfp;
 
 	his_machine_name = NULL;
 	hp = gethostbyaddr((const char *)&his_machine_addr.s_addr,
@@ -85,64 +89,58 @@ talk(void)
 	}
 	if (his_machine_name == NULL)
 		his_machine_name = strdup(inet_ntoa(his_machine_addr));
-	snprintf(buf, sizeof(buf), "Connection established with %s@%s.",
+	snprintf((char *)buf, sizeof(buf), "Connection established with %s@%s.",
 	    msg.r_name, his_machine_name);
 	free(his_machine_name);
-	message(buf);
+	message((char *)buf);
 	write(STDOUT_FILENO, "\007\007\007", 3);
 	
 	current_line = 0;
 
+	if ((sockfp = fdopen(sockt, "w+")) == NULL)
+		p_error("fdopen");
+
+	setvbuf(sockfp, NULL, _IONBF, 0);
+	setvbuf(stdin, NULL, _IONBF, 0);
+
 	/*
-	 * Wait on both the other process (sockt_mask) and
-	 * standard input ( STDIN_MASK )
+	 * Wait on both the other process (sockt) and standard input.
 	 */
-	FD_ZERO(&read_template);
-	FD_SET(sockt, &read_template);
-	FD_SET(fileno(stdin), &read_template);
 	for (;;) {
-		read_set = read_template;
-		wait.tv_sec = A_LONG_TIME;
-		wait.tv_usec = 0;
-		nb = select(32, &read_set, 0, 0, &wait);
+		FD_ZERO(&read_set);
+		FD_SET(sockt, &read_set);
+		FD_SET(fileno(stdin), &read_set);
+		nb = select(32, &read_set, 0, 0, NULL);
 		if (gotwinch) {
 			resize_display();
 			gotwinch = 0;
 		}
 		if (nb <= 0) {
-			if (errno == EINTR) {
-				read_set = read_template;
+			if (errno == EINTR)
 				continue;
-			}
-			/* panic, we don't know what happened */
+			/* Panic, we don't know what happened. */
 			p_error("Unexpected error from select");
 			quit();
 		}
 		if (FD_ISSET(sockt, &read_set)) {
-			/* There is data on sockt */
-			nb = read(sockt, buf, sizeof buf);
-			if (nb <= 0) {
+			wint_t w;
+
+			/* There is data on sockt. */
+			w = fgetwc(sockfp);
+			if (w == WEOF) {
 				message("Connection closed. Exiting");
 				quit();
 			}
-			display(&his_win, buf, nb);
+			display(&his_win, &w);
 		}
 		if (FD_ISSET(fileno(stdin), &read_set)) {
-			/*
-			 * We can't make the tty non_blocking, because
-			 * curses's output routines would screw up
-			 */
-			int i;
-			ioctl(0, FIONREAD, (void *) &nb);
-			if (nb > (ssize_t)(sizeof buf))
-				nb = sizeof buf;
-			nb = read(STDIN_FILENO, buf, nb);
-			display(&my_win, buf, nb);
-			/* might lose data here because sockt is non-blocking */
-			for (i = 0; i < nb; ++i)
-				if (buf[i] == '\r')
-					buf[i] = '\n';
-			write(sockt, buf, nb);
+			wint_t w;
+
+			if ((w = getwchar()) != WEOF) {
+				display(&my_win, &w);
+				(void )fputwc(w, sockfp);
+				(void )fflush(sockfp);
+			}
 		}
 	}
 }

Modified: stable/10/usr.bin/talk/talk.h
==============================================================================
--- stable/10/usr.bin/talk/talk.h	Thu Oct 23 00:37:52 2014	(r273495)
+++ stable/10/usr.bin/talk/talk.h	Thu Oct 23 00:39:19 2014	(r273496)
@@ -69,7 +69,6 @@ extern	int	check_local(void);
 extern	void	check_writeable(void);
 extern	void	ctl_transact(struct in_addr,CTL_MSG,int,CTL_RESPONSE *);
 extern	void	disp_msg(int);
-extern	void	display(xwin_t *, char *, int);
 extern	void	end_msgs(void);
 extern	void	get_addrs(const char *, const char *);
 extern	int	get_iface(struct in_addr *, struct in_addr *);

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 00:40:40 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id D5E2A70C;
 Thu, 23 Oct 2014 00:40:40 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id A79A1B5E;
 Thu, 23 Oct 2014 00:40:40 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N0eek7076347;
 Thu, 23 Oct 2014 00:40:40 GMT (envelope-from ngie@FreeBSD.org)
Received: (from ngie@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N0eeme076345;
 Thu, 23 Oct 2014 00:40:40 GMT (envelope-from ngie@FreeBSD.org)
Message-Id: <201410230040.s9N0eeme076345@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org
 using -f
From: Garrett Cooper 
Date: Thu, 23 Oct 2014 00:40:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject: svn commit: r273497 - stable/10
X-SVN-Group: stable-10
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 00:40:41 -0000

Author: ngie
Date: Thu Oct 23 00:40:40 2014
New Revision: 273497
URL: https://svnweb.freebsd.org/changeset/base/273497

Log:
  MFC r270650:
  
    Convert LIBCURSES to LIBNCURSES to fix "make checkdpadd"
  
    Also, add a missing LIBPANEL dependency for lldb
  
    Approved by: rpaulo (mentor)
    Suggested by: brooks
    Phabric: D675 (as part of a larger diff)
    PR: 192762

Modified:
Directory Properties:
  stable/10/   (props changed)

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 00:40:57 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id BD30A849;
 Thu, 23 Oct 2014 00:40:57 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id A68FAB66;
 Thu, 23 Oct 2014 00:40:57 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N0evwc076895;
 Thu, 23 Oct 2014 00:40:57 GMT (envelope-from delphij@FreeBSD.org)
Received: (from delphij@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N0ev3u076892;
 Thu, 23 Oct 2014 00:40:57 GMT (envelope-from delphij@FreeBSD.org)
Message-Id: <201410230040.s9N0ev3u076892@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: delphij set sender to
 delphij@FreeBSD.org using -f
From: Xin LI 
Date: Thu, 23 Oct 2014 00:40:57 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273498 - in head/contrib/xz: . src/liblzma/api/lzma
 src/liblzma/check src/liblzma/lzma src/xz
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 00:40:57 -0000

Author: delphij
Date: Thu Oct 23 00:40:56 2014
New Revision: 273498
URL: https://svnweb.freebsd.org/changeset/base/273498

Log:
  MFV r273494: xz 5.0.7.
  
  MFC after:	2 weeks

Modified:
  head/contrib/xz/ChangeLog
  head/contrib/xz/THANKS
  head/contrib/xz/TODO
  head/contrib/xz/src/liblzma/api/lzma/block.h
  head/contrib/xz/src/liblzma/api/lzma/version.h
  head/contrib/xz/src/liblzma/check/crc32_fast.c
  head/contrib/xz/src/liblzma/check/sha256.c
  head/contrib/xz/src/liblzma/lzma/lzma_encoder_presets.c
  head/contrib/xz/src/xz/coder.c
  head/contrib/xz/src/xz/signals.c
  head/contrib/xz/src/xz/suffix.c
Directory Properties:
  head/contrib/xz/   (props changed)

Modified: head/contrib/xz/ChangeLog
==============================================================================
--- head/contrib/xz/ChangeLog	Thu Oct 23 00:40:40 2014	(r273497)
+++ head/contrib/xz/ChangeLog	Thu Oct 23 00:40:56 2014	(r273498)
@@ -1,6 +1,337 @@
+commit 495aaf3a5b7200a5d2bf449bbbcc0e18834607af
+Author: Lasse Collin 
+Date:   2014-09-20 20:44:32 +0300
+
+    Bump version and soname for 5.0.7.
+
+ src/liblzma/Makefile.am        | 2 +-
+ src/liblzma/api/lzma/version.h | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+commit ac6c8921d1d8d2d749d5c97f9a0b0594cc863cea
+Author: Lasse Collin 
+Date:   2014-09-20 20:43:29 +0300
+
+    Update NEWS for 5.0.7.
+
+ NEWS | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+commit d1b0276aafd441a3d4db9dfd5dd9880e9f834d49
+Author: Lasse Collin 
+Date:   2014-09-20 20:21:18 +0300
+
+    liblzma: Fix invalid Libs.private value in liblzma.pc.
+
+ src/liblzma/Makefile.am | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit cac72956b1e56788182ac14bfb25519636afd503
+Author: Lasse Collin 
+Date:   2014-09-20 19:42:56 +0300
+
+    liblzma: Fix a portability problem in Makefile.am.
+    
+    POSIX supports $< only in inference rules (suffix rules).
+    Using it elsewhere is a GNU make extension and doesn't
+    work e.g. with OpenBSD make.
+    
+    Thanks to Christian Weisgerber for the patch.
+
+ src/liblzma/Makefile.am | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit 2cdf0875dedca3e89b02ad5ac8aa1109f902ae11
+Author: Lasse Collin 
+Date:   2014-09-14 19:35:45 +0300
+
+    Bump version and soname for 5.0.6.
+
+ src/liblzma/Makefile.am        | 2 +-
+ src/liblzma/api/lzma/version.h | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+commit 0168b6c8fbc88cae61b1f5fb41d6c33c9e127967
+Author: Lasse Collin 
+Date:   2014-09-14 19:33:46 +0300
+
+    Update NEWS for 5.0.6.
+
+ NEWS | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+commit 13337714e89d002af7af48d6853f977de985d7de
+Author: Lasse Collin 
+Date:   2014-06-13 19:21:54 +0300
+
+    xzgrep: List xzgrep_expected_output in tests/Makefile.am.
+
+ tests/Makefile.am | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+commit ccc728d8290c0464c7af62790b1c5528eceaae35
+Author: Lasse Collin 
+Date:   2014-06-13 18:58:22 +0300
+
+    xzgrep: Improve the test script.
+    
+    Now it should be close to the functionality of the original
+    version by Pavel Raiskup.
+
+ tests/Makefile.am            |  3 ++-
+ tests/test_scripts.sh        | 24 ++++++++++++++----------
+ tests/xzgrep_expected_output | 39 +++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 55 insertions(+), 11 deletions(-)
+
+commit 948f5865fe65061e215baa8ed63be570bae152ea
+Author: Lasse Collin 
+Date:   2014-06-11 21:03:25 +0300
+
+    xzgrep: Add a test for the previous fix.
+    
+    This is a simplified version of Pavel Raiskup's
+    original patch.
+
+ tests/test_scripts.sh | 26 ++++++++++++++++++++++----
+ 1 file changed, 22 insertions(+), 4 deletions(-)
+
+commit 64228d0d5cd75af31e5c330cc3a792016413fabf
+Author: Lasse Collin 
+Date:   2014-06-11 20:43:28 +0300
+
+    xzgrep: exit 0 when at least one file matches.
+    
+    Mimic the original grep behavior and return exit_success when
+    at least one xz compressed file matches given pattern.
+    
+    Original bugreport:
+    https://bugzilla.redhat.com/show_bug.cgi?id=1108085
+    
+    Thanks to Pavel Raiskup for the patch.
+
+ src/scripts/xzgrep.in | 15 +++++++++++++--
+ 1 file changed, 13 insertions(+), 2 deletions(-)
+
+commit 98d3368ef4bff0face78d6932f2156730c8cb658
+Author: Lasse Collin 
+Date:   2014-04-25 17:53:42 +0300
+
+    Build: Fix the combination of --disable-xzdec --enable-lzmadec.
+    
+    In this case "make install" could fail if the man page directory
+    didn't already exist at the destination. If it did exist, a
+    dangling symlink was created there. Now the link is omitted
+    instead. This isn't the best fix but it's better than the old
+    behavior.
+
+ src/xzdec/Makefile.am | 10 +++++++++-
+ 1 file changed, 9 insertions(+), 1 deletion(-)
+
+commit ba3b5dd082db2cb5973e877a74221d739c663fb4
+Author: Lasse Collin 
+Date:   2014-04-25 17:44:26 +0300
+
+    Build: Add --disable-doc to configure.
+
+ INSTALL      | 6 ++++++
+ Makefile.am  | 2 ++
+ configure.ac | 6 ++++++
+ 3 files changed, 14 insertions(+)
+
+commit 3d4575f2367fe8f1f2dcacba014e6c0aef388535
+Author: Lasse Collin 
+Date:   2014-04-24 18:06:24 +0300
+
+    Update INSTALL.
+    
+    Add a note about failing "make check". The source of
+    the problem should be fixed in libtool (if it really is
+    a libtool bug and not mine) but I'm unable to spend time
+    on that for now. Thanks to Nelson H. F. Beebe for reporting
+    the issue.
+    
+    Add a note about a possible need to run "ldconfig" after
+    "make install".
+
+ INSTALL | 25 +++++++++++++++++++++++++
+ 1 file changed, 25 insertions(+)
+
+commit b9f0584e3eff421eadbb6604de0b0b40bf87e129
+Author: Lasse Collin 
+Date:   2014-04-09 17:26:10 +0300
+
+    xz: Rename a variable to avoid a namespace collision on Solaris.
+    
+    I don't know the details but I have an impression that there's
+    no problem in practice if using GCC since people have built xz
+    with GCC (without patching xz), but renaming the variable cannot
+    hurt either.
+    
+    Thanks to Mark Ashley.
+
+ src/xz/signals.c | 12 +++++++-----
+ 1 file changed, 7 insertions(+), 5 deletions(-)
+
+commit cc41bcaf77c9c27ec09ef033fb3300e994e828e6
+Author: Lasse Collin 
+Date:   2014-04-26 08:45:49 +0300
+
+    xz: Fix a comment.
+
+ src/xz/coder.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+commit e34025d666852839388f997d076e3577847dd10f
+Author: Lasse Collin 
+Date:   2014-01-12 16:44:52 +0200
+
+    liblzma: Avoid C99 compound literal arrays.
+    
+    MSVC 2013 doesn't like them. Maybe they aren't so good
+    for readability either since many aren't used to them.
+
+ src/liblzma/lzma/lzma_encoder_presets.c | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+commit 0b6168974f1fac3a06157039235b66e4161b9b42
+Author: Lasse Collin 
+Date:   2014-01-12 12:50:30 +0200
+
+    liblzma: Remove a useless C99ism from sha256.c.
+    
+    Unsurprisingly it makes no difference in compiled output.
+
+ src/liblzma/check/sha256.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit 41e436076cfdcccc7e853de73b0d56b3d6d42053
+Author: Lasse Collin 
+Date:   2014-01-12 12:17:08 +0200
+
+    xz: Fix use of wrong variable.
+    
+    Since the only call to suffix_set() uses optarg
+    as the argument, fixing this bug doesn't change
+    the behavior of the program.
+
+ src/xz/suffix.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit c33efefd4ef0931e5795e13725d4bd2203571ce0
+Author: Lasse Collin 
+Date:   2014-04-26 08:37:00 +0300
+
+    Fix typos in comments.
+
+ src/liblzma/check/crc32_fast.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit e560c82f1f5693d88db9dc71f656436135f17595
+Author: Lasse Collin 
+Date:   2013-11-26 18:20:16 +0200
+
+    Update THANKS.
+
+ THANKS | 1 +
+ 1 file changed, 1 insertion(+)
+
+commit 05192b32e553eac5dfbd646b6102d10187f29a05
+Author: Lasse Collin 
+Date:   2013-11-26 18:20:09 +0200
+
+    liblzma: Document the need for block->check for lzma_block_header_decode().
+    
+    Thanks to Tomer Chachamu.
+
+ src/liblzma/api/lzma/block.h | 3 +++
+ 1 file changed, 3 insertions(+)
+
+commit 0f35eafe51db7b1eb0711bc8cc829ea6896b34f4
+Author: Lasse Collin 
+Date:   2013-10-26 12:47:04 +0300
+
+    Update TODO.
+
+ TODO | 4 ----
+ 1 file changed, 4 deletions(-)
+
+commit fc9eaf81d718488b052e5c65f9d6f08acc858873
+Author: Lasse Collin 
+Date:   2013-09-11 14:40:35 +0300
+
+    Build: Remove a comment about Automake 1.10 from configure.ac.
+    
+    The previous commit supports silent rules and that requires
+    Automake 1.11.
+
+ configure.ac | 2 --
+ 1 file changed, 2 deletions(-)
+
+commit 090c69dda59e00fc86d0792879bd921bb1156029
+Author: Lasse Collin 
+Date:   2013-09-09 20:37:03 +0300
+
+    Build: Create liblzma.pc in a src/liblzma/Makefile.am.
+    
+    Previously it was done in configure, but doing that goes
+    against the Autoconf manual. Autoconf requires that it is
+    possible to override e.g. prefix after running configure
+    and that doesn't work correctly if liblzma.pc is created
+    by configure.
+    
+    A potential downside of this change is that now e.g.
+    libdir in liblzma.pc is a standalone string instead of
+    being defined via ${prefix}, so if one overrides prefix
+    when running pkg-config the libdir won't get the new value.
+    I don't know if this matters in practice.
+    
+    Thanks to Vincent Torri.
+
+ configure.ac            |  1 -
+ src/liblzma/Makefile.am | 20 ++++++++++++++++++++
+ 2 files changed, 20 insertions(+), 1 deletion(-)
+
+commit 1f35331332273de01c46897cafdb37f8e6e285db
+Author: Anders F Bjorklund 
+Date:   2013-08-02 15:59:46 +0200
+
+    macosx: separate liblzma package
+
+ macosx/build.sh | 23 +++++++++++++++--------
+ 1 file changed, 15 insertions(+), 8 deletions(-)
+
+commit 1415f1d94644f28e07d544bc1e06b0636081abee
+Author: Anders F Bjorklund 
+Date:   2013-08-02 15:58:44 +0200
+
+    macosx: set minimum to leopard
+
+ macosx/build.sh | 13 ++++++++-----
+ 1 file changed, 8 insertions(+), 5 deletions(-)
+
+commit 41913949b93414a21ae9fb1a8e9b7cdde8b37f98
+Author: Anders F Bjorklund 
+Date:   2011-08-07 13:13:30 +0200
+
+    move configurables into variables
+
+ macosx/build.sh | 25 ++++++++++++++++++-------
+ 1 file changed, 18 insertions(+), 7 deletions(-)
+
+commit 3dffda33f47dc220bb1738564fe02effa9da4c8e
+Author: Lasse Collin 
+Date:   2013-07-15 14:08:02 +0300
+
+    Build: Fix the detection of missing CRC32.
+    
+    Thanks to Vincent Torri.
+
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
 commit b69900ed0b2f914fc6c0a180dcb522dbe5b80ea7
 Author: Lasse Collin 
-Date:   Sun Jun 30 18:02:27 2013 +0300
+Date:   2013-06-30 18:02:27 +0300
 
     Man pages: Use similar syntax for synopsis as in xz.
     
@@ -10,38 +341,56 @@ Date:   Sun Jun 30 18:02:27 2013 +0300
     didn't mention these man pages in his bug report, but
     it's nice to be consistent.
 
+ src/lzmainfo/lzmainfo.1 |  4 ++--
+ src/scripts/xzmore.1    |  6 +++---
+ src/xzdec/xzdec.1       | 10 +++++-----
+ 3 files changed, 10 insertions(+), 10 deletions(-)
+
 commit cf4a1e1879d89be314ef3c064bd2656ea452f87e
 Author: Lasse Collin 
-Date:   Sun Jun 30 15:55:09 2013 +0300
+Date:   2013-06-30 15:55:09 +0300
 
     Update NEWS for 5.0.5.
 
+ NEWS | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 52 insertions(+)
+
 commit cb94bb6d1f34e1e93c2d634ea9c3b7dfb3981d05
 Author: Lasse Collin 
-Date:   Sun Jun 30 15:54:38 2013 +0300
+Date:   2013-06-30 15:54:38 +0300
 
     Bump version and soname for 5.0.5.
 
+ src/liblzma/Makefile.am        | 2 +-
+ src/liblzma/api/lzma/version.h | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
 commit b7dee202d5b041ccae028d0c5433b83cecbe9e5d
 Author: Lasse Collin 
-Date:   Fri Jun 28 23:56:17 2013 +0300
+Date:   2013-06-28 23:56:17 +0300
 
     xz: Fix return value type in io_write_buf().
     
     It didn't affect the behavior of the code since -1
     becomes true anyway.
 
+ src/xz/file_io.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
 commit 265e7b44d804b47373f10b7da28350db7611cea6
 Author: Lasse Collin 
-Date:   Fri Jun 28 18:46:13 2013 +0300
+Date:   2013-06-28 18:46:13 +0300
 
     xz: Remove an outdated NetBSD-specific comment.
     
     Nowadays errno == EFTYPE is documented in open(2).
 
+ src/xz/file_io.c | 4 ----
+ 1 file changed, 4 deletions(-)
+
 commit 78c2f8db902195468b8249c432252a6b281db836
 Author: Lasse Collin 
-Date:   Fri Jun 28 18:09:47 2013 +0300
+Date:   2013-06-28 18:09:47 +0300
 
     xz: Fix error detection of fcntl(fd, F_SETFL, flags) calls.
     
@@ -51,9 +400,12 @@ Date:   Fri Jun 28 18:09:47 2013 +0300
     F_SETFL is always 0 (at least accorinding to fcntl(2)
     from man-pages 3.51).
 
+ src/xz/file_io.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
 commit 91750dff8f2c654ff636f12a2acdffe5492374b3
 Author: Lasse Collin 
-Date:   Fri Jun 28 17:36:47 2013 +0300
+Date:   2013-06-28 17:36:47 +0300
 
     xz: Fix use of wrong variable in a fcntl() call.
     
@@ -69,9 +421,12 @@ Date:   Fri Jun 28 17:36:47 2013 +0300
     indicate when the flags should be restored instead of
     relying on a special value in stdout_flags.
 
+ src/xz/file_io.c | 24 +++++++++++++-----------
+ 1 file changed, 13 insertions(+), 11 deletions(-)
+
 commit e11888a79a4a77a69afde60445880d44f63d01aa
 Author: Lasse Collin 
-Date:   Wed Jun 26 13:30:57 2013 +0300
+Date:   2013-06-26 13:30:57 +0300
 
     xz: Check the value of lzma_stream_flags.version in --list.
     
@@ -80,9 +435,12 @@ Date:   Wed Jun 26 13:30:57 2013 +0300
     then this check becomes important and will stop the old xz
     from trying to parse files that it won't understand.
 
+ src/xz/list.c | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
 commit f39ddd88f3222219ada88998cf30abfdd3e0e96c
 Author: Lasse Collin 
-Date:   Wed Jun 26 12:17:00 2013 +0300
+Date:   2013-06-26 12:17:00 +0300
 
     Build: Require Automake 1.12 and use serial-tests option.
     
@@ -95,9 +453,12 @@ Date:   Wed Jun 26 12:17:00 2013 +0300
     in XZ Utils but they hide the progress output from
     test_compress.sh.
 
+ configure.ac | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
 commit cb84e278027a90e9827a6f4d3bb0b4d4744a2fbb
 Author: Lasse Collin 
-Date:   Sun Jun 23 17:36:47 2013 +0300
+Date:   2013-06-23 17:36:47 +0300
 
     xz: Validate Uncompressed Size from Block Header in list.c.
     
@@ -107,23 +468,32 @@ Date:   Sun Jun 23 17:36:47 2013 +0300
     show such files as corrupt instead of showing the
     Uncompressed Size from Index.
 
+ src/xz/list.c | 14 +++++++++++++-
+ 1 file changed, 13 insertions(+), 1 deletion(-)
+
 commit f01780fce454c7489f7dcbf806299b50da5f51b7
 Author: Lasse Collin 
-Date:   Wed Jun 26 10:58:58 2013 +0300
+Date:   2013-06-26 10:58:58 +0300
 
     Update THANKS.
 
+ THANKS | 2 ++
+ 1 file changed, 2 insertions(+)
+
 commit d98ede7d700b892e32d9c2f46563b6ebc566786d
 Author: Lasse Collin 
-Date:   Fri Jun 21 22:04:45 2013 +0300
+Date:   2013-06-21 22:04:45 +0300
 
     xz: Make the man page more friendly to doclifter.
     
     Thanks to Eric S. Raymond.
 
+ src/xz/xz.1 | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
 commit 19b447b64b3f520cd5b11429000b092f7c76709b
 Author: Lasse Collin 
-Date:   Fri Jun 21 21:54:59 2013 +0300
+Date:   2013-06-21 21:54:59 +0300
 
     xz: A couple of man page fixes.
     
@@ -133,9 +503,12 @@ Date:   Fri Jun 21 21:54:59 2013 +0300
     Thanks to DevHC who reported these issues on IRC to me
     on 2012-12-14.
 
+ src/xz/xz.1 | 35 +++++++++++++++++++++++------------
+ 1 file changed, 23 insertions(+), 12 deletions(-)
+
 commit 45edf2966fc9a4d2eae8f84b2fa027fb4fa1df8b
 Author: Lasse Collin 
-Date:   Fri Jun 21 21:50:26 2013 +0300
+Date:   2013-06-21 21:50:26 +0300
 
     xz: Fix interaction between preset and custom filter chains.
     
@@ -158,15 +531,22 @@ Date:   Fri Jun 21 21:50:26 2013 +0300
     
     Thanks to Conley Moorhous.
 
+ src/xz/coder.c | 35 +++++++++++++++++++++--------------
+ 1 file changed, 21 insertions(+), 14 deletions(-)
+
 commit b065984e5a9272eb50bc0c6d3731e6199c0ae8a8
 Author: Lasse Collin 
-Date:   Fri Apr 8 17:53:05 2011 +0300
+Date:   2011-04-08 17:53:05 +0300
 
     xz: Change size_t to uint32_t in a few places.
 
+ src/xz/coder.c | 6 +++---
+ src/xz/coder.h | 2 +-
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
 commit 32be621f52f2e1686db88baa7b01dc1ae338f426
 Author: Lasse Collin 
-Date:   Sat Apr 27 22:07:46 2013 +0300
+Date:   2013-04-27 22:07:46 +0300
 
     Build: Use -Wvla with GCC if supported.
     
@@ -175,9 +555,12 @@ Date:   Sat Apr 27 22:07:46 2013 +0300
     future either to stay compatible with C11 without requiring any
     optional C11 features.
 
+ configure.ac | 1 +
+ 1 file changed, 1 insertion(+)
+
 commit efb07cfba65e9e05984c02cd796c1b0338ce04dc
 Author: Lasse Collin 
-Date:   Mon Apr 15 19:29:09 2013 +0300
+Date:   2013-04-15 19:29:09 +0300
 
     xzdec: Improve the --help message.
     
@@ -189,23 +572,32 @@ Date:   Mon Apr 15 19:29:09 2013 +0300
     because I find it easier to spot the ignored vs. non-ignored
     options from the list that way.
 
+ src/xzdec/xzdec.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
 commit e3c8be13699e2813f5e2879d8187444b46d82d89
 Author: Lasse Collin 
-Date:   Fri Apr 5 19:25:40 2013 +0300
+Date:   2013-04-05 19:25:40 +0300
 
     Update THANKS.
 
+ THANKS | 2 ++
+ 1 file changed, 2 insertions(+)
+
 commit ad8282efe483612f6b5544f9a0d2e4914fb2532a
 Author: Jeff Bastian 
-Date:   Wed Apr 3 13:59:17 2013 +0200
+Date:   2013-04-03 13:59:17 +0200
 
     xzgrep: make the '-h' option to be --no-filename equivalent
     
     * src/scripts/xzgrep.in: Accept the '-h' option in argument parsing.
 
+ src/scripts/xzgrep.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
 commit 9271a3eb0e022b23e8712154be851d0afe4c02e4
 Author: Lasse Collin 
-Date:   Fri Apr 5 19:34:09 2013 +0300
+Date:   2013-04-05 19:34:09 +0300
 
     liblzma: Be less picky in lzma_alone_decoder().
     
@@ -231,9 +623,14 @@ Date:   Fri Apr 5 19:34:09 2013 +0300
     	src/liblzma/common/alone_decoder.c
     	src/liblzma/common/alone_decoder.h
 
+ src/liblzma/common/alone_decoder.c | 22 ++++++++++++++--------
+ src/liblzma/common/alone_decoder.h |  5 +++--
+ src/liblzma/common/auto_decoder.c  |  2 +-
+ 3 files changed, 18 insertions(+), 11 deletions(-)
+
 commit 211b931cee58626c1d2e021810cb108cb5cbc10f
 Author: Lasse Collin 
-Date:   Tue Mar 5 19:14:50 2013 +0200
+Date:   2013-03-05 19:14:50 +0200
 
     Avoid unneeded use of awk in xzless.
     
@@ -243,9 +640,12 @@ Date:   Tue Mar 5 19:14:50 2013 +0200
     
     Thanks to Ariel P for the patch.
 
+ src/scripts/xzless.in | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
 commit 9f62fd9605eade23b62b07a235d1f02156f7a5c6
 Author: Jonathan Nieder 
-Date:   Mon Nov 19 00:10:10 2012 -0800
+Date:   2012-11-19 00:10:10 -0800
 
     xzless: Make "less -V" parsing more robust
     
@@ -282,46 +682,66 @@ Date:   Mon Nov 19 00:10:10 2012 -0800
     Reported-by: Jörg-Volker Peetz 
     Signed-off-by: Jonathan Nieder 
 
+ src/scripts/xzless.in | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
 commit 1d05980f5b5c2c94d833001daccacce4a466876e
 Author: Lasse Collin 
-Date:   Wed Oct 3 15:54:24 2012 +0300
+Date:   2012-10-03 15:54:24 +0300
 
     xz: Fix the note about --rsyncable on the man page.
 
+ src/xz/xz.1 | 17 +++++++++--------
+ 1 file changed, 9 insertions(+), 8 deletions(-)
+
 commit fb68497333598688d309a92838d91fd560f7e9f0
 Author: Lasse Collin 
-Date:   Fri Sep 28 20:11:09 2012 +0300
+Date:   2012-09-28 20:11:09 +0300
 
     xz: Improve handling of failed realloc in xrealloc.
     
     Thanks to Jim Meyering.
 
+ src/xz/util.c | 14 ++++++++++++--
+ 1 file changed, 12 insertions(+), 2 deletions(-)
+
 commit 75013db6d4d63c195bd8b8d45729b4be0665a812
 Author: Lasse Collin 
-Date:   Sat Dec 15 20:01:02 2012 +0200
+Date:   2012-12-15 20:01:02 +0200
 
     A few typo fixes to comments and the xz man page.
     
     Thanks to Jim Meyering.
 
+ configure.ac               | 2 +-
+ src/liblzma/check/sha256.c | 1 -
+ src/xz/xz.1                | 4 ++--
+ 3 files changed, 3 insertions(+), 4 deletions(-)
+
 commit e44b21839b1dcbac5097be39b87dd2ddb6e114fd
 Author: Lasse Collin 
-Date:   Thu Aug 2 17:13:30 2012 +0300
+Date:   2012-08-02 17:13:30 +0300
 
     Build: Bump gettext version requirement to 0.18.
     
     Otherwise too old version of m4/lib-link.m4 gets included
     when autoreconf -fi is run.
 
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
 commit fd3dbb23ca7e75a7a888d7e897c381dc06308307
 Author: Lasse Collin 
-Date:   Thu Jul 5 07:36:28 2012 +0300
+Date:   2012-07-05 07:36:28 +0300
 
     Tests: Remove tests/test_block.c that had gotten committed accidentally.
 
+ tests/test_block.c | 52 ----------------------------------------------------
+ 1 file changed, 52 deletions(-)
+
 commit 05a735d279d74af437c31f25f69aded4713c1a3d
 Author: Lasse Collin 
-Date:   Thu Jul 5 07:33:35 2012 +0300
+Date:   2012-07-05 07:33:35 +0300
 
     Build: Include macosx/build.sh in the distribution.
     
@@ -329,55 +749,81 @@ Date:   Thu Jul 5 07:33:35 2012 +0300
     few people have seen it since it hasn't been included in
     the release tarballs. :-(
 
+ Makefile.am | 1 +
+ 1 file changed, 1 insertion(+)
+
 commit 4e6d62793b5e7b87edcc93c7ded072c1ecd94173
 Author: Lasse Collin 
-Date:   Thu Jul 5 07:24:45 2012 +0300
+Date:   2012-07-05 07:24:45 +0300
 
     Docs: Fix the name LZMA Utils -> XZ Utils in debug/README.
 
+ debug/README | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
 commit dd95b5e7614baf1f07a1316b5106bd616a9efa79
 Author: Lasse Collin 
-Date:   Thu Jul 5 07:23:17 2012 +0300
+Date:   2012-07-05 07:23:17 +0300
 
     Include debug/translation.bash in the distribution.
     
     Also fix the script name mentioned in README.
 
+ README            | 4 ++--
+ debug/Makefile.am | 3 +++
+ 2 files changed, 5 insertions(+), 2 deletions(-)
+
 commit 20778053a07eb90c159c1377ca8dc05a90fd530b
 Author: Lasse Collin 
-Date:   Fri Jun 22 14:36:16 2012 +0300
+Date:   2012-06-22 14:36:16 +0300
 
     xz: Update man page date to match the latest update.
 
+ src/xz/xz.1 | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
 commit 2cefa84af676da37d7e9c466d55d46c67ab00c22
 Author: Lasse Collin 
-Date:   Fri Jun 22 10:25:43 2012 +0300
+Date:   2012-06-22 10:25:43 +0300
 
     Bump version and soname for 5.0.4.
 
+ src/liblzma/Makefile.am        | 2 +-
+ src/liblzma/api/lzma/version.h | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
 commit 433fec191a17e45690809e54146ea7a773f54cff
 Author: Lasse Collin 
-Date:   Fri Jun 22 10:25:09 2012 +0300
+Date:   2012-06-22 10:25:09 +0300
 
     Update NEWS for 5.0.4.
 
+ NEWS | 25 +++++++++++++++++++------
+ 1 file changed, 19 insertions(+), 6 deletions(-)
+
 commit 711fa680f552a4003df73b37e6dc4d6e00b47bcd
 Author: Lasse Collin 
-Date:   Mon Jun 18 21:27:47 2012 +0300
+Date:   2012-06-18 21:27:47 +0300
 
     Docs: Language fix to 01_compress_easy.c.
     
     Thanks to Jonathan Nieder.
 
+ doc/examples/01_compress_easy.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
 commit 3d7ab1dc61a75c560828be5df96598388b771456
 Author: Lasse Collin 
-Date:   Thu Jun 14 20:15:30 2012 +0300
+Date:   2012-06-14 20:15:30 +0300
 
     Fix the top-level Makefile.am for the new example programs.
 
+ Makefile.am | 12 ++++++++++--
+ 1 file changed, 10 insertions(+), 2 deletions(-)
+
 commit ef8b8e5f111469b5bc005975f7abb9abbd372b25
 Author: Lasse Collin 
-Date:   Thu Jun 14 10:52:33 2012 +0300
+Date:   2012-06-14 10:52:33 +0300
 
     Docs: Add new example programs.
     
@@ -385,9 +831,16 @@ Date:   Thu Jun 14 10:52:33 2012 +0300
     human-readable error messages. More tutorial-like examples
     are needed but these are a start.
 
+ doc/examples/00_README.txt        |  27 ++++
+ doc/examples/01_compress_easy.c   | 297 ++++++++++++++++++++++++++++++++++++++
+ doc/examples/02_decompress.c      | 287 ++++++++++++++++++++++++++++++++++++
+ doc/examples/03_compress_custom.c | 193 +++++++++++++++++++++++++
+ doc/examples/Makefile             |  23 +++
+ 5 files changed, 827 insertions(+)
+
 commit 75c149bc8045a26f8bc719cb8ed20668dab79091
 Author: Lasse Collin 
-Date:   Thu Jun 14 10:33:27 2012 +0300
+Date:   2012-06-14 10:33:27 +0300
 
     Docs: Move xz_pipe_comp.c and xz_pipe_decomp.c to doc/examples_old.
     
@@ -395,49 +848,73 @@ Date:   Thu Jun 14 10:33:27 2012 +0300
     copied the decompressor bug from xz_pipe_decomp.c he has
     an example how to easily fix it.
 
+ doc/examples/xz_pipe_comp.c       | 127 --------------------------------------
+ doc/examples/xz_pipe_decomp.c     | 123 ------------------------------------
+ doc/examples_old/xz_pipe_comp.c   | 127 ++++++++++++++++++++++++++++++++++++++
+ doc/examples_old/xz_pipe_decomp.c | 123 ++++++++++++++++++++++++++++++++++++
+ 4 files changed, 250 insertions(+), 250 deletions(-)
+
 commit 456307ebf947a5f50bd995d617b99c1215572308
 Author: Lasse Collin 
-Date:   Thu Jun 14 10:33:01 2012 +0300
+Date:   2012-06-14 10:33:01 +0300
 
     Docs: Fix a bug in xz_pipe_decomp.c example program.
 
+ doc/examples/xz_pipe_decomp.c | 10 +++++++++-
+ 1 file changed, 9 insertions(+), 1 deletion(-)
+
 commit 4c310b8a29bc257e6ccbd2310f12f258678f3fef
 Author: Lasse Collin 
-Date:   Thu May 31 15:53:25 2012 +0300
+Date:   2012-05-31 15:53:25 +0300
 
     Translations: Update the Italian translation.
     
     Thanks to Milo Casagrande.
 
+ po/it.po | 311 ++++++++++++++++++++++++++++++---------------------------------
+ 1 file changed, 146 insertions(+), 165 deletions(-)
+
 commit ec32b79366dc47a55ea877589df9e8509ba113a7
 Author: Lasse Collin 
-Date:   Wed May 30 23:15:07 2012 +0300
+Date:   2012-05-30 23:15:07 +0300
 
     Translations: Update the French translation.
     
     Thanks to Adrien Nader.
 
+ po/fr.po | 237 +++++++++++++++++++++++++++++++--------------------------------
+ 1 file changed, 118 insertions(+), 119 deletions(-)
+
 commit dd06f40e4dd7649525e4f28d890dc238a3aa37e5
 Author: Lasse Collin 
-Date:   Tue May 29 22:26:27 2012 +0300
+Date:   2012-05-29 22:26:27 +0300
 
     Translations: Update the German translation.
 
+ po/de.po | 169 ++++++++++++++++++++++++++++++++++-----------------------------
+ 1 file changed, 91 insertions(+), 78 deletions(-)
+
 commit c66808d1f55d0149ed57c536cc9b52e9c8b583bc
 Author: Lasse Collin 
-Date:   Tue May 29 22:12:57 2012 +0300
+Date:   2012-05-29 22:12:57 +0300
 
     Translations: Update Polish translation.
 
+ po/pl.po | 150 ++++++++++++++++++++++++++++++++++-----------------------------
+ 1 file changed, 82 insertions(+), 68 deletions(-)
+
 commit 556c22dfed195c1466b298183b850d6c28544900
 Author: Lasse Collin 
-Date:   Tue May 29 13:10:36 2012 +0300
+Date:   2012-05-29 13:10:36 +0300
 
     Preliminary NEWS for 5.0.4.
 
+ NEWS | 24 ++++++++++++++++++++++++
+ 1 file changed, 24 insertions(+)
+
 commit dd13b66bf582f49d3aec36e3410ff8541b7506da
 Author: Lasse Collin 
-Date:   Mon May 28 20:42:11 2012 +0300
+Date:   2012-05-28 20:42:11 +0300
 
     liblzma: Fix possibility of incorrect LZMA_BUF_ERROR.
     
@@ -465,21 +942,32 @@ Date:   Mon May 28 20:42:11 2012 +0300
     
     A similar bug was fixed in XZ Embedded on 2011-09-19.
 
+ src/liblzma/simple/simple_coder.c |   2 +-
+ tests/Makefile.am                 |   4 +-
+ tests/test_bcj_exact_size.c       | 112 ++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 116 insertions(+), 2 deletions(-)
+
 commit a0223bf796fdaad51a11ad02c4195c694849cc78
 Author: Lasse Collin 
-Date:   Mon May 28 15:38:32 2012 +0300
+Date:   2012-05-28 15:38:32 +0300
 
     Update THANKS.
 
+ THANKS | 1 +
+ 1 file changed, 1 insertion(+)
+
 commit 86e57e4bfefe3fd8e13615c41604165bb2359501
 Author: Lasse Collin 
-Date:   Mon May 28 15:37:43 2012 +0300
+Date:   2012-05-28 15:37:43 +0300
 
     xz: Don't show a huge number in -vv when memory limit is disabled.
 
+ src/xz/message.c | 12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
 commit 13e44a94da19d1ef14832ff12d3877a6fd2c54c0
 Author: Lasse Collin 
-Date:   Sun May 27 22:30:17 2012 +0300
+Date:   2012-05-27 22:30:17 +0300
 
     xz: Document the "summary" lines of --robot -lvv.
     
@@ -487,30 +975,43 @@ Date:   Sun May 27 22:30:17 2012 +0300
     The new columns added in the master branch aren't
     necessarily stable yet.
 
+ src/xz/xz.1 | 19 +++++++++++++++++++
+ 1 file changed, 19 insertions(+)
+
 commit 2f90345e13ab8fea4de45a4f1caa73ebc63a62e7
 Author: Lasse Collin 
-Date:   Sun May 27 21:53:20 2012 +0300
+Date:   2012-05-27 21:53:20 +0300
 
     xz: Fix output of verbose --robot --list modes.
     
     It printed the filename in "filename (x/y)" format
     which it obviously shouldn't do in robot mode.
 
+ src/xz/message.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
 commit 8d4864f53ffae5d862c691a0b334a6b69bc5366e
 Author: Lasse Collin 
-Date:   Thu May 10 21:15:17 2012 +0300
+Date:   2012-05-10 21:15:17 +0300
 
     Update THANKS.
 
+ THANKS | 1 +
+ 1 file changed, 1 insertion(+)
+
 commit 35e9c58abb0ce3993da844aaeaa3e7231cd2be8f
 Author: Lasse Collin 
-Date:   Thu May 10 21:14:16 2012 +0300
+Date:   2012-05-10 21:14:16 +0300
 
     Docs: Cleanup line wrapping a bit.
 
+ README          | 12 ++++++------
+ doc/history.txt | 49 +++++++++++++++++++++++++------------------------
+ 2 files changed, 31 insertions(+), 30 deletions(-)
+
 commit 532b3e4c568a228309b56f95c13435fd078dbe02
 Author: Benno Schulenberg 
-Date:   Tue Mar 13 22:04:04 2012 +0100
+Date:   2012-03-13 22:04:04 +0100
 
     Fix a few typos and add some missing articles in some documents.
     
@@ -518,42 +1019,64 @@ Date:   Tue Mar 13 22:04:04 2012 +0100
     
     Signed-off-by: Benno Schulenberg 
 
+ AUTHORS         |  6 +++---
+ README          | 42 ++++++++++++++++++++---------------------
+ doc/faq.txt     | 24 ++++++++++++------------
+ doc/history.txt | 58 ++++++++++++++++++++++++++++-----------------------------
+ 4 files changed, 65 insertions(+), 65 deletions(-)
+
 commit afb6ce8c82ffef8f2505a3759da72a733c7b0b8f
 Author: Lasse Collin 
-Date:   Sun Apr 29 11:51:25 2012 +0300
+Date:   2012-04-29 11:51:25 +0300
 
     Windows: Update notes about static linking with MSVC.
 
+ windows/README-Windows.txt | 13 +++++++++----
+ 1 file changed, 9 insertions(+), 4 deletions(-)
+
 commit 7c3ba2ed5c3c878d4a14ca549b46dbff60c6d565
 Author: Lasse Collin 
-Date:   Thu Apr 19 15:25:26 2012 +0300
+Date:   2012-04-19 15:25:26 +0300
 
     liblzma: Remove outdated comments.
 
+ src/liblzma/simple/simple_coder.c   | 3 ---
+ src/liblzma/simple/simple_private.h | 3 +--
+ 2 files changed, 1 insertion(+), 5 deletions(-)
+
 commit f55db9c187651094f43881c49db2b2d9ffee6b80
 Author: Lasse Collin 
-Date:   Thu Apr 19 14:17:52 2012 +0300
+Date:   2012-04-19 14:17:52 +0300
 
     DOS: Link against DJGPP's libemu to support FPU emulation.
     
     This way xz should work on 386SX and 486SX. Floating point
     only is needed for verbose output in xz.

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 00:43:09 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id BBD139AB;
 Thu, 23 Oct 2014 00:43:09 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 9C77FC08;
 Thu, 23 Oct 2014 00:43:09 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N0h9E4079515;
 Thu, 23 Oct 2014 00:43:09 GMT (envelope-from ngie@FreeBSD.org)
Received: (from ngie@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N0h8WJ079511;
 Thu, 23 Oct 2014 00:43:08 GMT (envelope-from ngie@FreeBSD.org)
Message-Id: <201410230043.s9N0h8WJ079511@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org
 using -f
From: Garrett Cooper 
Date: Thu, 23 Oct 2014 00:43:08 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject: svn commit: r273499 - in stable/10: usr.bin/bc usr.bin/clang/lldb
 usr.bin/talk usr.sbin/gstat
X-SVN-Group: stable-10
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 00:43:09 -0000

Author: ngie
Date: Thu Oct 23 00:43:08 2014
New Revision: 273499
URL: https://svnweb.freebsd.org/changeset/base/273499

Log:
  MFC r270650 (this is what should have been committed in r273497):
  
    Convert LIBCURSES to LIBNCURSES to fix "make checkdpadd"
  
    Also, add a missing LIBPANEL dependency for lldb
  
    Approved by: rpaulo (mentor)
    Suggested by: brooks
    Phabric: D675 (as part of a larger diff)
    PR: 192762

Modified:
  stable/10/usr.bin/bc/Makefile
  stable/10/usr.bin/clang/lldb/Makefile
  stable/10/usr.bin/talk/Makefile
  stable/10/usr.sbin/gstat/Makefile

Modified: stable/10/usr.bin/bc/Makefile
==============================================================================
--- stable/10/usr.bin/bc/Makefile	Thu Oct 23 00:40:56 2014	(r273498)
+++ stable/10/usr.bin/bc/Makefile	Thu Oct 23 00:43:08 2014	(r273499)
@@ -5,8 +5,8 @@ PROG=		bc
 SRCS=		bc.y scan.l tty.c
 CFLAGS+=	-I. -I${.CURDIR}
 
-LDADD+=		-ledit -lcurses
-DPADD+=		${LIBEDIT} ${LIBCURSES}
+DPADD+=		${LIBEDIT} ${LIBNCURSESW}
+LDADD+=		-ledit -lncursesw
 
 NO_WMISSING_VARIABLE_DECLARATIONS=
 

Modified: stable/10/usr.bin/clang/lldb/Makefile
==============================================================================
--- stable/10/usr.bin/clang/lldb/Makefile	Thu Oct 23 00:40:56 2014	(r273498)
+++ stable/10/usr.bin/clang/lldb/Makefile	Thu Oct 23 00:43:08 2014	(r273499)
@@ -16,8 +16,8 @@ SRCS=	Driver.cpp \
 lldb.1:
 	ln -fs ${LLDB_SRCS}/docs/lldb.1 ${.TARGET}
 
-DPADD=	${LIBEDIT} ${LIBCURSES} ${LIBEXECINFO}
-LDADD=	-lcurses -ledit -lexecinfo -lpanel
+DPADD=	${LIBEDIT} ${LIBNCURSESW} ${LIBEXECINFO} ${LIBPANEL}
+LDADD=	-ledit -lncursesw -lexecinfo -lpanel
 
 LLDB_LIBS=\
 	lldb \

Modified: stable/10/usr.bin/talk/Makefile
==============================================================================
--- stable/10/usr.bin/talk/Makefile	Thu Oct 23 00:40:56 2014	(r273498)
+++ stable/10/usr.bin/talk/Makefile	Thu Oct 23 00:43:08 2014	(r273499)
@@ -4,7 +4,7 @@
 PROG=	talk
 SRCS=	ctl.c ctl_transact.c display.c get_addrs.c get_iface.c get_names.c \
 	init_disp.c invite.c io.c look_up.c msgs.c talk.c
-DPADD=	${LIBCURSESW}
-LDADD=	-lcursesw
+DPADD=	${LIBNCURSESW}
+LDADD=	-lncursesw
 
 .include 

Modified: stable/10/usr.sbin/gstat/Makefile
==============================================================================
--- stable/10/usr.sbin/gstat/Makefile	Thu Oct 23 00:40:56 2014	(r273498)
+++ stable/10/usr.sbin/gstat/Makefile	Thu Oct 23 00:43:08 2014	(r273499)
@@ -2,7 +2,7 @@
 
 PROG=	gstat
 MAN=	gstat.8
-DPADD=	${LIBDEVSTAT} ${LIBKVM} ${LIBGEOM} ${LIBBSDXML} ${LIBSBUF} ${LIBEDIT} ${LIBCURSES}
-LDADD=	-ldevstat -lkvm -lgeom -lbsdxml -lsbuf -ledit -lcurses
+DPADD=	${LIBDEVSTAT} ${LIBKVM} ${LIBGEOM} ${LIBBSDXML} ${LIBSBUF} ${LIBEDIT} ${LIBNCURSESW}
+LDADD=	-ldevstat -lkvm -lgeom -lbsdxml -lsbuf -ledit -lncursesw
 
 .include 

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 00:51:53 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 7D8B8B42;
 Thu, 23 Oct 2014 00:51:53 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 69009CC2;
 Thu, 23 Oct 2014 00:51:53 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N0pro8083701;
 Thu, 23 Oct 2014 00:51:53 GMT (envelope-from ngie@FreeBSD.org)
Received: (from ngie@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N0prbv083700;
 Thu, 23 Oct 2014 00:51:53 GMT (envelope-from ngie@FreeBSD.org)
Message-Id: <201410230051.s9N0prbv083700@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org
 using -f
From: Garrett Cooper 
Date: Thu, 23 Oct 2014 00:51:53 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject: svn commit: r273500 - stable/10/share/mk
X-SVN-Group: stable-10
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 00:51:53 -0000

Author: ngie
Date: Thu Oct 23 00:51:52 2014
New Revision: 273500
URL: https://svnweb.freebsd.org/changeset/base/273500

Log:
  MFC r271365:
  
    Remove many false positives with make checkdpadd
  
    - Reduce DPADD and LDADD in checkdpadd to -l
    - Skip over -Wl,[es]*-group because -Wl,--end-group and
      -Wl,--start-group might be required to properly link objects (see
      usr.bin/clang/lldb as an example)
  
    This caveat has been present for a while with some components of
    the build. However, these false positives were made more more apparent
    after r269648.
  
    Phabric: D635
    Reviewed by: jmmv (an earlier version)
    PR: 192730

Modified:
  stable/10/share/mk/bsd.dep.mk
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/mk/bsd.dep.mk
==============================================================================
--- stable/10/share/mk/bsd.dep.mk	Thu Oct 23 00:43:08 2014	(r273499)
+++ stable/10/share/mk/bsd.dep.mk	Thu Oct 23 00:51:52 2014	(r273500)
@@ -215,8 +215,10 @@ cleandepend:
 .endif
 
 .if !target(checkdpadd) && (defined(DPADD) || defined(LDADD))
-_LDADD_FROM_DPADD=	${DPADD:C;^/usr/lib/lib(.*)\.a$;-l\1;}
-_LDADD_CANONICALIZED=	${LDADD:S/$//}
+_LDADD_FROM_DPADD=	${DPADD:R:T:C;^lib(.*)$;-l\1;g}
+# Ignore -Wl,--start-group/-Wl,--end-group as it might be required in the
+# LDADD list due to unresolved symbols
+_LDADD_CANONICALIZED=	${LDADD:N:R:T:C;^lib(.*)$;-l\1;g:N-Wl,--[es]*-group}
 checkdpadd:
 .if ${_LDADD_FROM_DPADD} != ${_LDADD_CANONICALIZED}
 	@echo ${.CURDIR}

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 00:54:53 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id BBE83E38;
 Thu, 23 Oct 2014 00:54:53 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 9CA76CFA;
 Thu, 23 Oct 2014 00:54:53 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N0srL5084581;
 Thu, 23 Oct 2014 00:54:53 GMT (envelope-from ngie@FreeBSD.org)
Received: (from ngie@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N0srfB084580;
 Thu, 23 Oct 2014 00:54:53 GMT (envelope-from ngie@FreeBSD.org)
Message-Id: <201410230054.s9N0srfB084580@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org
 using -f
From: Garrett Cooper 
Date: Thu, 23 Oct 2014 00:54:53 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject: svn commit: r273501 - stable/10/share/mk
X-SVN-Group: stable-10
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 00:54:53 -0000

Author: ngie
Date: Thu Oct 23 00:54:52 2014
New Revision: 273501
URL: https://svnweb.freebsd.org/changeset/base/273501

Log:
  MFC r272055:
  
    Improve bsd.progs.mk compatibility with bsd.prog.mk
  
    1. Do not install FILES/SCRIPTS multiple times if PROGS is specified; this is
       already handled via bsd.prog.mk when it's called recursively (PR: 191055,
       191955).
    2. Some variables, like BINDIR and PROGNAME, default to a value if unset
       whereas others get appended to, like CFLAGS. Add support for the former case
       (PR: 191056)
    3. Make "checkdpadd" and "clean" available targets for recursive execution.
  
    Reviewed by: marcel, sjg
    Phabric: D822
    PR: 191055, 191056, 191955
    Sponsored by: EMC / Isilon Storage Division

Modified:
  stable/10/share/mk/bsd.progs.mk
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/mk/bsd.progs.mk
==============================================================================
--- stable/10/share/mk/bsd.progs.mk	Thu Oct 23 00:51:52 2014	(r273500)
+++ stable/10/share/mk/bsd.progs.mk	Thu Oct 23 00:54:52 2014	(r273501)
@@ -42,10 +42,15 @@ PROG ?= $t
 
 .if defined(PROG)
 # just one of many
-PROG_VARS += BINDIR CFLAGS CPPFLAGS CXXFLAGS DPADD DPLIBS LDADD MAN SRCS
+PROG_OVERRIDE_VARS += BINDIR MAN SRCS
+PROG_VARS += CFLAGS CPPFLAGS CXXFLAGS DPADD DPLIBS LDADD ${PROG_OVERRIDE_VARS}
 .for v in ${PROG_VARS:O:u}
-.if defined(${v}.${PROG}) || defined(${v}_${PROG})
-$v += ${${v}_${PROG}:U${${v}.${PROG}}}
+.if empty(${PROG_OVERRIDE_VARS:M$v})
+.if defined(${v}.${PROG})
+$v += ${${v}.${PROG}}
+.elif defined(${v}_${PROG})
+$v += ${${v}_${PROG}}
+.endif
 .else
 $v ?=
 .endif
@@ -61,7 +66,7 @@ UPDATE_DEPENDFILE ?= NO
 DEPENDFILE?= .depend.${PROG}
 # prog.mk will do the rest
 .else
-all: ${PROGS}
+all: ${FILES} ${PROGS} ${SCRIPTS}
 
 # We cannot capture dependencies for meta mode here
 UPDATE_DEPENDFILE = NO
@@ -75,7 +80,7 @@ UPDATE_DEPENDFILE = NO
 
 .ifndef _RECURSING_PROGS
 # tell progs.mk we might want to install things
-PROGS_TARGETS+= cleandepend cleandir cleanobj depend install
+PROGS_TARGETS+= checkdpadd clean cleandepend cleandir cleanobj depend install
 
 .for p in ${PROGS}
 .if defined(PROGS_CXX) && !empty(PROGS_CXX:M$p)
@@ -98,18 +103,15 @@ $p.$t: .PHONY .MAKE
 $t: ${PROGS:%=%.$t}
 .endfor
 
-SCRIPTS_TARGETS+= cleandepend cleandir cleanobj depend install
+.if empty(PROGS) && !empty(SCRIPTS)
 
-.for p in ${SCRIPTS}
-.for t in ${SCRIPTS_TARGETS:O:u}
-$p.$t: .PHONY .MAKE
-	(cd ${.CURDIR} && ${MAKE} -f ${MAKEFILE} _RECURSING_PROGS= \
-	    SUBDIR= SCRIPT=$p ${x.$p} ${@:E})
-.endfor
+.for t in ${PROGS_TARGETS:O:u}
+scripts.$t: .PHONY .MAKE
+	(cd ${.CURDIR} && ${MAKE} -f ${MAKEFILE} SUBDIR= _RECURSING_PROGS= \
+	    $t)
+$t: scripts.$t
 .endfor
 
-.for t in ${SCRIPTS_TARGETS:O:u}
-$t: ${SCRIPTS:%=%.$t}
-.endfor
+.endif
 
 .endif

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 01:01:59 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 2E2AEB3;
 Thu, 23 Oct 2014 01:01:59 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id F40CCDC4;
 Thu, 23 Oct 2014 01:01:58 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N11w2E089121;
 Thu, 23 Oct 2014 01:01:58 GMT (envelope-from ngie@FreeBSD.org)
Received: (from ngie@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N11wIu089120;
 Thu, 23 Oct 2014 01:01:58 GMT (envelope-from ngie@FreeBSD.org)
Message-Id: <201410230101.s9N11wIu089120@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org
 using -f
From: Garrett Cooper 
Date: Thu, 23 Oct 2014 01:01:58 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject: svn commit: r273502 - stable/10/tools/regression/lib/msun
X-SVN-Group: stable-10
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 01:01:59 -0000

Author: ngie
Date: Thu Oct 23 01:01:58 2014
New Revision: 273502
URL: https://svnweb.freebsd.org/changeset/base/273502

Log:
  MFC r271336:
  
    Expand the tests structure in test_small(..) to workaround the
    "initializer not constant" warning with gcc
  
    Approved by: jmmv (mentor)
    Phabric: D744
    Sponsored by: EMC / Isilon Storage Division

Modified:
  stable/10/tools/regression/lib/msun/test-invctrig.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/tools/regression/lib/msun/test-invctrig.c
==============================================================================
--- stable/10/tools/regression/lib/msun/test-invctrig.c	Thu Oct 23 00:54:52 2014	(r273501)
+++ stable/10/tools/regression/lib/msun/test-invctrig.c	Thu Oct 23 01:01:58 2014	(r273502)
@@ -315,25 +315,20 @@ test_small(void)
 	 *     asin(z) = Pi/4 + i ln(2)/2
 	 *     atan(z) = atan(4)/2 + i ln(17/9)/4
 	 */
-	static const struct {
-		complex long double z;
-		complex long double acos_z;
-		complex long double asin_z;
-		complex long double atan_z;
-	} tests[] = {
-		{ CMPLXL(0.75L, 0.25L),
-		  CMPLXL(pi / 4, -0.34657359027997265470861606072908828L),
-		  CMPLXL(pi / 4, 0.34657359027997265470861606072908828L),
-		  CMPLXL(0.66290883183401623252961960521423782L,
-			 0.15899719167999917436476103600701878L) },
-	};
-	int i;
-
-	for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) {
-		testall_tol(cacos, tests[i].z, tests[i].acos_z, 2);
-		testall_odd_tol(casin, tests[i].z, tests[i].asin_z, 2);
-		testall_odd_tol(catan, tests[i].z, tests[i].atan_z, 2);
-        }
+	complex long double z;
+	complex long double acos_z;
+	complex long double asin_z;
+	complex long double atan_z;
+
+	z = CMPLXL(0.75L, 0.25L);
+	acos_z = CMPLXL(pi / 4, -0.34657359027997265470861606072908828L);
+	asin_z = CMPLXL(pi / 4, 0.34657359027997265470861606072908828L);
+	atan_z = CMPLXL(0.66290883183401623252961960521423782L,
+			 0.15899719167999917436476103600701878L);
+
+	testall_tol(cacos, z, acos_z, 2);
+	testall_odd_tol(casin, z, asin_z, 2);
+	testall_odd_tol(catan, z, atan_z, 2);
 }
 
 /* Test inputs that might cause overflow in a sloppy implementation. */

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 01:02:38 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 0E1CC1E0;
 Thu, 23 Oct 2014 01:02:38 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id D43ECDC8;
 Thu, 23 Oct 2014 01:02:37 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N12bLp089272;
 Thu, 23 Oct 2014 01:02:37 GMT (envelope-from ngie@FreeBSD.org)
Received: (from ngie@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N12bK6089271;
 Thu, 23 Oct 2014 01:02:37 GMT (envelope-from ngie@FreeBSD.org)
Message-Id: <201410230102.s9N12bK6089271@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org
 using -f
From: Garrett Cooper 
Date: Thu, 23 Oct 2014 01:02:37 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject: svn commit: r273503 - stable/10/tools/regression/lib/msun
X-SVN-Group: stable-10
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 01:02:38 -0000

Author: ngie
Date: Thu Oct 23 01:02:37 2014
New Revision: 273503
URL: https://svnweb.freebsd.org/changeset/base/273503

Log:
  MFC r271349:
  
    Add diagnostic printfs and disable test # 4 on i386
  
    Reviewed by: jmmv, rpaulo
    Phabric: D749
    PR: 191676
    Sponsored by: EMC / Isilon Storage Division

Modified:
  stable/10/tools/regression/lib/msun/test-cexp.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/tools/regression/lib/msun/test-cexp.c
==============================================================================
--- stable/10/tools/regression/lib/msun/test-cexp.c	Thu Oct 23 01:01:58 2014	(r273502)
+++ stable/10/tools/regression/lib/msun/test-cexp.c	Thu Oct 23 01:02:37 2014	(r273503)
@@ -117,6 +117,7 @@ test_nan()
 	/* cexp(x + NaNi) = NaN + NaNi and optionally raises invalid */
 	/* cexp(NaN + yi) = NaN + NaNi and optionally raises invalid (|y|>0) */
 	for (i = 0; i < N(finites); i++) {
+		printf("# Run %d..\n", i);
 		testall(CMPLXL(finites[i], NAN), CMPLXL(NAN, NAN),
 			ALL_STD_EXCEPT & ~FE_INVALID, 0, 0);
 		if (finites[i] == 0.0)
@@ -148,6 +149,7 @@ test_inf(void)
 
 	/* cexp(x + inf i) = NaN + NaNi and raises invalid */
 	for (i = 0; i < N(finites); i++) {
+		printf("# Run %d..\n", i);
 		testall(CMPLXL(finites[i], INFINITY), CMPLXL(NAN, NAN),
 			ALL_STD_EXCEPT, FE_INVALID, 1);
 	}
@@ -189,6 +191,7 @@ test_reals(void)
 
 	for (i = 0; i < N(finites); i++) {
 		/* XXX could check exceptions more meticulously */
+		printf("# Run %d..\n", i);
 		test(cexp, CMPLXL(finites[i], 0.0),
 		     CMPLXL(exp(finites[i]), 0.0),
 		     FE_INVALID | FE_DIVBYZERO, 0, 1);
@@ -210,6 +213,7 @@ test_imaginaries(void)
 	int i;
 
 	for (i = 0; i < N(finites); i++) {
+		printf("# Run %d..\n", i);
 		test(cexp, CMPLXL(0.0, finites[i]),
 		     CMPLXL(cos(finites[i]), sin(finites[i])),
 		     ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1);
@@ -241,6 +245,7 @@ test_small(void)
 	int i;
 
 	for (i = 0; i < N(tests); i += 4) {
+		printf("# Run %d..\n", i);
 		a = tests[i];
 		b = tests[i + 1];
 		x = tests[i + 2];
@@ -297,8 +302,12 @@ main(int argc, char *argv[])
 	test_inf();
 	printf("ok 3 - cexp inf\n");
 
+#if defined(__i386__)
+	printf("not ok 4 - cexp reals # TODO: PR # 191676 fails assertion on i386\n");
+#else
 	test_reals();
 	printf("ok 4 - cexp reals\n");
+#endif
 
 	test_imaginaries();
 	printf("ok 5 - cexp imaginaries\n");

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 01:06:01 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 6472937F;
 Thu, 23 Oct 2014 01:06:01 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 37832DEC;
 Thu, 23 Oct 2014 01:06:01 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N161F2089799;
 Thu, 23 Oct 2014 01:06:01 GMT (envelope-from ngie@FreeBSD.org)
Received: (from ngie@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N161aj089798;
 Thu, 23 Oct 2014 01:06:01 GMT (envelope-from ngie@FreeBSD.org)
Message-Id: <201410230106.s9N161aj089798@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org
 using -f
From: Garrett Cooper 
Date: Thu, 23 Oct 2014 01:06:01 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject: svn commit: r273504 - stable/10
X-SVN-Group: stable-10
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 01:06:01 -0000

Author: ngie
Date: Thu Oct 23 01:06:00 2014
New Revision: 273504
URL: https://svnweb.freebsd.org/changeset/base/273504

Log:
  MFC r272053:
  
    Have distrib-dirs, distribution, hier, hierarchy, redistribute, and reinstall
    depend on the .MAKE special target
  
    This will allow users to do something like the following to print out the
    results of the running the simulated make target with bmake, like some of the
    other top-level make targets in Makefile.inc1:
  
      % make -f Makefile.inc1 -n distribution TARGET=i386 TARGET_ARCH=i386
  
    Sponsored by: EMC / Isilon Storage Division

Modified:
  stable/10/Makefile.inc1
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/Makefile.inc1
==============================================================================
--- stable/10/Makefile.inc1	Thu Oct 23 01:02:37 2014	(r273503)
+++ stable/10/Makefile.inc1	Thu Oct 23 01:06:00 2014	(r273504)
@@ -925,7 +925,7 @@ packageworld:
 # and do a 'make reinstall' on the *client* to install new binaries from the
 # most recent server build.
 #
-reinstall:
+reinstall: .MAKE
 	@echo "--------------------------------------------------------------"
 	@echo ">>> Making hierarchy"
 	@echo "--------------------------------------------------------------"
@@ -940,7 +940,7 @@ reinstall:
 	${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32
 .endif
 
-redistribute:
+redistribute: .MAKE
 	@echo "--------------------------------------------------------------"
 	@echo ">>> Distributing everything"
 	@echo "--------------------------------------------------------------"
@@ -950,7 +950,7 @@ redistribute:
 	    DISTRIBUTION=lib32
 .endif
 
-distrib-dirs distribution:
+distrib-dirs distribution: .MAKE
 	cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
 	    ${IMAKE_INSTALL} ${IMAKE_MTREE} METALOG=${METALOG} ${.TARGET}
 
@@ -1449,7 +1449,7 @@ cross-tools: .MAKE
 #
 # hierarchy - ensure that all the needed directories are present
 #
-hierarchy hier:
+hierarchy hier: .MAKE
 	cd ${.CURDIR}/etc && ${HMAKE} distrib-dirs
 
 #

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 01:08:31 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id CD6CC4D6;
 Thu, 23 Oct 2014 01:08:31 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id B8E78E08;
 Thu, 23 Oct 2014 01:08:31 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N18V1f090177;
 Thu, 23 Oct 2014 01:08:31 GMT (envelope-from ngie@FreeBSD.org)
Received: (from ngie@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N18VKq090176;
 Thu, 23 Oct 2014 01:08:31 GMT (envelope-from ngie@FreeBSD.org)
Message-Id: <201410230108.s9N18VKq090176@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org
 using -f
From: Garrett Cooper 
Date: Thu, 23 Oct 2014 01:08:31 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject: svn commit: r273505 - stable/10/share/mk
X-SVN-Group: stable-10
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 01:08:31 -0000

Author: ngie
Date: Thu Oct 23 01:08:31 2014
New Revision: 273505
URL: https://svnweb.freebsd.org/changeset/base/273505

Log:
  MFC r272917:
  
    Add LDFLAGS to PROG_VARS so it can be overridden on a per-PROG basis
  
    Sponsored by: EMC / Isilon Storage Division

Modified:
  stable/10/share/mk/bsd.progs.mk
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/mk/bsd.progs.mk
==============================================================================
--- stable/10/share/mk/bsd.progs.mk	Thu Oct 23 01:06:00 2014	(r273504)
+++ stable/10/share/mk/bsd.progs.mk	Thu Oct 23 01:08:31 2014	(r273505)
@@ -43,7 +43,7 @@ PROG ?= $t
 .if defined(PROG)
 # just one of many
 PROG_OVERRIDE_VARS += BINDIR MAN SRCS
-PROG_VARS += CFLAGS CPPFLAGS CXXFLAGS DPADD DPLIBS LDADD ${PROG_OVERRIDE_VARS}
+PROG_VARS += CFLAGS CPPFLAGS CXXFLAGS DPADD DPLIBS LDADD LDFLAGS ${PROG_OVERRIDE_VARS}
 .for v in ${PROG_VARS:O:u}
 .if empty(${PROG_OVERRIDE_VARS:M$v})
 .if defined(${v}.${PROG})

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 01:09:02 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 2E406605;
 Thu, 23 Oct 2014 01:09:02 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 19A88E0D;
 Thu, 23 Oct 2014 01:09:02 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N191c8090471;
 Thu, 23 Oct 2014 01:09:01 GMT (envelope-from ngie@FreeBSD.org)
Received: (from ngie@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N191cE090469;
 Thu, 23 Oct 2014 01:09:01 GMT (envelope-from ngie@FreeBSD.org)
Message-Id: <201410230109.s9N191cE090469@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org
 using -f
From: Garrett Cooper 
Date: Thu, 23 Oct 2014 01:09:01 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject: svn commit: r273506 - stable/10/etc/mtree
X-SVN-Group: stable-10
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 01:09:02 -0000

Author: ngie
Date: Thu Oct 23 01:09:01 2014
New Revision: 273506
URL: https://svnweb.freebsd.org/changeset/base/273506

Log:
  MFC r272778:
  
    Set the autoindent to 4 spaces with vim in BSD.tests.dist
  
    This will prevent vim users from accidentally checking in buggy mtree files
    (mixed tabs/spaces).
  
    Sponsored by: EMC / Isilon Storage Division

Modified:
  stable/10/etc/mtree/BSD.tests.dist
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/etc/mtree/BSD.tests.dist
==============================================================================
--- stable/10/etc/mtree/BSD.tests.dist	Thu Oct 23 01:08:31 2014	(r273505)
+++ stable/10/etc/mtree/BSD.tests.dist	Thu Oct 23 01:09:01 2014	(r273506)
@@ -278,3 +278,5 @@
         ..
     ..
 ..
+
+# vim: set expandtab ts=4 sw=4:

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 01:22:31 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id E53AB8A3;
 Thu, 23 Oct 2014 01:22:31 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id C5A56F86;
 Thu, 23 Oct 2014 01:22:31 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N1MV6j099026;
 Thu, 23 Oct 2014 01:22:31 GMT (envelope-from delphij@FreeBSD.org)
Received: (from delphij@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N1MUX4099021;
 Thu, 23 Oct 2014 01:22:30 GMT (envelope-from delphij@FreeBSD.org)
Message-Id: <201410230122.s9N1MUX4099021@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: delphij set sender to
 delphij@FreeBSD.org using -f
From: Xin LI 
Date: Thu, 23 Oct 2014 01:22:30 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273507 - head/usr.bin/gzip
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 01:22:32 -0000

Author: delphij
Date: Thu Oct 23 01:22:29 2014
New Revision: 273507
URL: https://svnweb.freebsd.org/changeset/base/273507

Log:
  Sync with NetBSD.
  
  MFC after:	2 weeks

Modified:
  head/usr.bin/gzip/Makefile
  head/usr.bin/gzip/gzip.1
  head/usr.bin/gzip/gzip.c
  head/usr.bin/gzip/zmore
  head/usr.bin/gzip/zmore.1

Modified: head/usr.bin/gzip/Makefile
==============================================================================
--- head/usr.bin/gzip/Makefile	Thu Oct 23 01:09:01 2014	(r273506)
+++ head/usr.bin/gzip/Makefile	Thu Oct 23 01:22:29 2014	(r273507)
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.16 2011/06/21 13:25:45 joerg Exp $
+#	$NetBSD: Makefile,v 1.18 2013/11/13 11:12:24 pettai Exp $
 # $FreeBSD$
 
 .include 
@@ -21,7 +21,8 @@ SCRIPTS=	gzexe zdiff zforce zmore znew
 MLINKS+=	gzip.1 gunzip.1 \
 		gzip.1 gzcat.1 \
 		gzip.1 zcat.1 \
-		zdiff.1 zcmp.1
+		zdiff.1 zcmp.1 \
+		zmore.1 zless.1
 
 LINKS+=		${BINDIR}/gzip ${BINDIR}/gunzip \
 		${BINDIR}/gzip ${BINDIR}/gzcat \

Modified: head/usr.bin/gzip/gzip.1
==============================================================================
--- head/usr.bin/gzip/gzip.1	Thu Oct 23 01:09:01 2014	(r273506)
+++ head/usr.bin/gzip/gzip.1	Thu Oct 23 01:22:29 2014	(r273507)
@@ -1,4 +1,4 @@
-.\"	$NetBSD: gzip.1,v 1.21 2011/06/19 02:22:36 christos Exp $
+.\"	$NetBSD: gzip.1,v 1.23 2014/03/18 18:20:45 riastradh Exp $
 .\"
 .\" Copyright (c) 1997, 2003, 2004 Matthew R. Green
 .\" All rights reserved.

Modified: head/usr.bin/gzip/gzip.c
==============================================================================
--- head/usr.bin/gzip/gzip.c	Thu Oct 23 01:09:01 2014	(r273506)
+++ head/usr.bin/gzip/gzip.c	Thu Oct 23 01:22:29 2014	(r273507)
@@ -1,4 +1,4 @@
-/*	$NetBSD: gzip.c,v 1.105 2011/08/30 23:06:00 joerg Exp $	*/
+/*	$NetBSD: gzip.c,v 1.106 2014/10/18 08:33:30 snj Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2003, 2004, 2006 Matthew R. Green
@@ -158,7 +158,7 @@ static suffixes_t suffixes[] = {
 #define NUM_SUFFIXES (sizeof suffixes / sizeof suffixes[0])
 #define SUFFIX_MAXLEN	30
 
-static	const char	gzip_version[] = "FreeBSD gzip 20111009";
+static	const char	gzip_version[] = "FreeBSD gzip 20141022";
 
 #ifndef SMALL
 static	const char	gzip_copyright[] = \
@@ -1769,7 +1769,7 @@ handle_stdout(void)
 		return;
 	}
 #endif
-	/* If stdin is a file use it's mtime, otherwise use current time */
+	/* If stdin is a file use its mtime, otherwise use current time */
 	ret = fstat(STDIN_FILENO, &sb);
 
 #ifndef SMALL
@@ -2110,7 +2110,7 @@ static void
 display_license(void)
 {
 
-	fprintf(stderr, "%s (based on NetBSD gzip 20111009)\n", gzip_version);
+	fprintf(stderr, "%s (based on NetBSD gzip 20141018)\n", gzip_version);
 	fprintf(stderr, "%s\n", gzip_copyright);
 	exit(0);
 }

Modified: head/usr.bin/gzip/zmore
==============================================================================
--- head/usr.bin/gzip/zmore	Thu Oct 23 01:09:01 2014	(r273506)
+++ head/usr.bin/gzip/zmore	Thu Oct 23 01:22:29 2014	(r273507)
@@ -1,7 +1,8 @@
 #!/bin/sh -
 #
-# $NetBSD: zmore,v 1.3 2004/03/29 09:59:42 wiz Exp $
-# $OpenBSD: zmore,v 1.4 2003/07/29 07:42:45 otto Exp $
+# $NetBSD: zmore,v 1.5 2013/12/06 13:33:15 pettai Exp $
+#
+# $OpenBSD: zmore,v 1.6 2008/08/20 09:22:02 mpf Exp $
 #
 #-
 # Copyright (c) 2003 Todd C. Miller 
@@ -42,15 +43,21 @@ while test $# -ne 0; do
 	esac
 done
 
+if [ `basename $0` = "zless" ] ; then
+	pager=${PAGER-less}
+else
+	pager=${PAGER-more}
+fi
+
 # No files means read from stdin
 if [ $# -eq 0 ]; then
-	gzip -cdfq 2>&1 | ${PAGER-more} $flags
+	gzip -cdfq 2>&1 | $pager $flags
 	exit 0
 fi
 
 oterm=`stty -g 2>/dev/null`
 while test $# -ne 0; do
-	gzip -cdfq "$1" 2>&1 | ${PAGER-more} $flags
+	gzip -cdfq "$1" 2>&1 | $pager $flags
 	prev="$1"
 	shift
 	if tty -s && test -n "$oterm" -a $# -gt 0; then

Modified: head/usr.bin/gzip/zmore.1
==============================================================================
--- head/usr.bin/gzip/zmore.1	Thu Oct 23 01:09:01 2014	(r273506)
+++ head/usr.bin/gzip/zmore.1	Thu Oct 23 01:22:29 2014	(r273507)
@@ -1,5 +1,5 @@
-.\"	$NetBSD: zmore.1,v 1.3 2003/12/28 12:47:52 wiz Exp $
-.\"	$OpenBSD: zmore.1,v 1.3 2003/06/23 21:00:48 deraadt Exp $
+.\"	$NetBSD: zmore.1,v 1.4 2013/11/12 21:58:37 pettai Exp $
+.\"	$OpenBSD: zmore.1,v 1.10 2009/08/16 09:41:08 sobrado Exp $
 .\"
 .\" Copyright (c) 2003 Todd C. Miller 
 .\"
@@ -20,16 +20,20 @@
 .\" Materiel Command, USAF, under agreement number F39502-99-1-0512.
 .\"
 .\" $FreeBSD$
-.Dd February 6, 2011
+.Dd October 22, 2014
 .Dt ZMORE 1
 .Os
 .Sh NAME
-.Nm zmore
+.Nm zmore ,
+.Nm zless
 .Nd view compressed files
 .Sh SYNOPSIS
 .Nm zmore
 .Op Ar flags
-.Op Ar file ...
+.Op Ar
+.Nm zless
+.Op Ar flags
+.Op Ar
 .Sh DESCRIPTION
 .Nm
 is a filter that allows the viewing of files compressed with Lempel-Ziv
@@ -51,6 +55,14 @@ that are specified are passed to the use
 .Pa /usr/bin/more
 by default).
 .Pp
+.Nm zless
+is equivalent to
+.Nm zmore
+but uses
+.Xr less 1
+as a pager instead of
+.Xr more 1 .
+.Pp
 When multiple files are specified,
 .Nm
 will pause at the end of each file and present the following prompt to the user:
@@ -86,7 +98,11 @@ style compression since there is no suff
 Program used to display files.
 If unset,
 .Pa /usr/bin/more
-is used.
+is used
+.Pq Nm zmore
+or
+.Pa /usr/bin/less
+.Pq Nm zless .
 .El
 .Sh SEE ALSO
 .Xr compress 1 ,

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 01:36:44 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id A660DAEA;
 Thu, 23 Oct 2014 01:36:44 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 90E34F6;
 Thu, 23 Oct 2014 01:36:44 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N1aiZd004353;
 Thu, 23 Oct 2014 01:36:44 GMT (envelope-from delphij@FreeBSD.org)
Received: (from delphij@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N1aihu004352;
 Thu, 23 Oct 2014 01:36:44 GMT (envelope-from delphij@FreeBSD.org)
Message-Id: <201410230136.s9N1aihu004352@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: delphij set sender to
 delphij@FreeBSD.org using -f
From: Xin LI 
Date: Thu, 23 Oct 2014 01:36:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject: svn commit: r273508 - stable/10/cddl/contrib/opensolaris/cmd/zdb
X-SVN-Group: stable-10
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 01:36:44 -0000

Author: delphij
Date: Thu Oct 23 01:36:43 2014
New Revision: 273508
URL: https://svnweb.freebsd.org/changeset/base/273508

Log:
  MFC r272806: MFV r272802:
  
   - Limit ARC for zdb at 256MB.  zdb do not typically revisit data
     in the ARC.
   - Increase default max_inflight from 200 to 1000 (can be overriden
     by -I) so we can queue more I/Os when doing scrubbing.
   - Print status while loading meataslabs for leak detection.
  
  Illumos issues:
  
      5169 zdb should limit its ARC size
      5170 zdb -c should create more scrub i/os by default
      5171 zdb should print status while loading metaslabs for leak detection

Modified:
  stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c
==============================================================================
--- stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c	Thu Oct 23 01:22:29 2014	(r273507)
+++ stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c	Thu Oct 23 01:36:43 2014	(r273508)
@@ -76,8 +76,10 @@
 
 #ifndef lint
 extern boolean_t zfs_recover;
+extern uint64_t zfs_arc_max, zfs_arc_meta_limit;
 #else
 boolean_t zfs_recover;
+uint64_t zfs_arc_max, zfs_arc_meta_limit;
 #endif
 
 const char cmdname[] = "zdb";
@@ -89,7 +91,7 @@ extern void dump_intent_log(zilog_t *);
 uint64_t *zopt_object = NULL;
 int zopt_objects = 0;
 libzfs_handle_t *g_zfs;
-uint64_t max_inflight = 200;
+uint64_t max_inflight = 1000;
 
 /*
  * These libumem hooks provide a reasonable set of defaults for the allocator's
@@ -2382,7 +2384,7 @@ zdb_blkptr_cb(spa_t *spa, zilog_t *zilog
 
 	zcb->zcb_readfails = 0;
 
-	if (dump_opt['b'] < 5 && isatty(STDERR_FILENO) &&
+	if (dump_opt['b'] < 5 &&
 	    gethrtime() > zcb->zcb_lastprint + NANOSEC) {
 		uint64_t now = gethrtime();
 		char buf[10];
@@ -2467,9 +2469,9 @@ zdb_leak_init(spa_t *spa, zdb_cb_t *zcb)
 
 	if (!dump_opt['L']) {
 		vdev_t *rvd = spa->spa_root_vdev;
-		for (int c = 0; c < rvd->vdev_children; c++) {
+		for (uint64_t c = 0; c < rvd->vdev_children; c++) {
 			vdev_t *vd = rvd->vdev_child[c];
-			for (int m = 0; m < vd->vdev_ms_count; m++) {
+			for (uint64_t m = 0; m < vd->vdev_ms_count; m++) {
 				metaslab_t *msp = vd->vdev_ms[m];
 				mutex_enter(&msp->ms_lock);
 				metaslab_unload(msp);
@@ -2482,6 +2484,15 @@ zdb_leak_init(spa_t *spa, zdb_cb_t *zcb)
 				 * interfaces.
 				 */
 				if (msp->ms_sm != NULL) {
+					(void) fprintf(stderr,
+					    "\rloading space map for "
+					    "vdev %llu of %llu, "
+					    "metaslab %llu of %llu ...",
+					    (longlong_t)c,
+					    (longlong_t)rvd->vdev_children,
+					    (longlong_t)m,
+					    (longlong_t)vd->vdev_ms_count);
+
 					msp->ms_ops = &zdb_metaslab_ops;
 					VERIFY0(space_map_load(msp->ms_sm,
 					    msp->ms_tree, SM_ALLOC));
@@ -2490,6 +2501,7 @@ zdb_leak_init(spa_t *spa, zdb_cb_t *zcb)
 				mutex_exit(&msp->ms_lock);
 			}
 		}
+		(void) fprintf(stderr, "\n");
 	}
 
 	spa_config_enter(spa, SCL_CONFIG, FTAG, RW_READER);
@@ -3490,6 +3502,12 @@ main(int argc, char **argv)
 		usage();
 	}
 
+	/*
+	 * ZDB does not typically re-read blocks; therefore limit the ARC
+	 * to 256 MB, which can be used entirely for metadata.
+	 */
+	zfs_arc_max = zfs_arc_meta_limit = 256 * 1024 * 1024;
+
 	kernel_init(FREAD);
 	g_zfs = libzfs_init();
 	ASSERT(g_zfs != NULL);

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 01:40:32 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 6AC53C38;
 Thu, 23 Oct 2014 01:40:32 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 54E6E106;
 Thu, 23 Oct 2014 01:40:32 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N1eWvl005349;
 Thu, 23 Oct 2014 01:40:32 GMT (envelope-from delphij@FreeBSD.org)
Received: (from delphij@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N1eVlk005341;
 Thu, 23 Oct 2014 01:40:31 GMT (envelope-from delphij@FreeBSD.org)
Message-Id: <201410230140.s9N1eVlk005341@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: delphij set sender to
 delphij@FreeBSD.org using -f
From: Xin LI 
Date: Thu, 23 Oct 2014 01:40:31 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject: svn commit: r273509 - in
 stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys
X-SVN-Group: stable-10
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 01:40:32 -0000

Author: delphij
Date: Thu Oct 23 01:40:31 2014
New Revision: 273509
URL: https://svnweb.freebsd.org/changeset/base/273509

Log:
  MFC r272809: MFV r272803:
  
  Illumos issue:
      5175 implement dmu_read_uio_dbuf() to improve cached read performance

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
==============================================================================
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c	Thu Oct 23 01:36:43 2014	(r273508)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c	Thu Oct 23 01:40:31 2014	(r273509)
@@ -1022,8 +1022,8 @@ xuio_stat_wbuf_nocopy()
 }
 
 #ifdef _KERNEL
-int
-dmu_read_uio(objset_t *os, uint64_t object, uio_t *uio, uint64_t size)
+static int
+dmu_read_uio_dnode(dnode_t *dn, uio_t *uio, uint64_t size)
 {
 	dmu_buf_t **dbp;
 	int numbufs, i, err;
@@ -1033,8 +1033,8 @@ dmu_read_uio(objset_t *os, uint64_t obje
 	 * NB: we could do this block-at-a-time, but it's nice
 	 * to be reading in parallel.
 	 */
-	err = dmu_buf_hold_array(os, object, uio->uio_loffset, size, TRUE, FTAG,
-	    &numbufs, &dbp);
+	err = dmu_buf_hold_array_by_dnode(dn, uio->uio_loffset, size,
+	    TRUE, FTAG, &numbufs, &dbp, 0);
 	if (err)
 		return (err);
 
@@ -1081,6 +1081,58 @@ dmu_read_uio(objset_t *os, uint64_t obje
 	return (err);
 }
 
+/*
+ * Read 'size' bytes into the uio buffer.
+ * From object zdb->db_object.
+ * Starting at offset uio->uio_loffset.
+ *
+ * If the caller already has a dbuf in the target object
+ * (e.g. its bonus buffer), this routine is faster than dmu_read_uio(),
+ * because we don't have to find the dnode_t for the object.
+ */
+int
+dmu_read_uio_dbuf(dmu_buf_t *zdb, uio_t *uio, uint64_t size)
+{
+	dmu_buf_impl_t *db = (dmu_buf_impl_t *)zdb;
+	dnode_t *dn;
+	int err;
+
+	if (size == 0)
+		return (0);
+
+	DB_DNODE_ENTER(db);
+	dn = DB_DNODE(db);
+	err = dmu_read_uio_dnode(dn, uio, size);
+	DB_DNODE_EXIT(db);
+
+	return (err);
+}
+
+/*
+ * Read 'size' bytes into the uio buffer.
+ * From the specified object
+ * Starting at offset uio->uio_loffset.
+ */
+int
+dmu_read_uio(objset_t *os, uint64_t object, uio_t *uio, uint64_t size)
+{
+	dnode_t *dn;
+	int err;
+
+	if (size == 0)
+		return (0);
+
+	err = dnode_hold(os, object, FTAG, &dn);
+	if (err)
+		return (err);
+
+	err = dmu_read_uio_dnode(dn, uio, size);
+
+	dnode_rele(dn, FTAG);
+
+	return (err);
+}
+
 static int
 dmu_write_uio_dnode(dnode_t *dn, uio_t *uio, uint64_t size, dmu_tx_t *tx)
 {
@@ -1133,6 +1185,15 @@ dmu_write_uio_dnode(dnode_t *dn, uio_t *
 	return (err);
 }
 
+/*
+ * Write 'size' bytes from the uio buffer.
+ * To object zdb->db_object.
+ * Starting at offset uio->uio_loffset.
+ *
+ * If the caller already has a dbuf in the target object
+ * (e.g. its bonus buffer), this routine is faster than dmu_write_uio(),
+ * because we don't have to find the dnode_t for the object.
+ */
 int
 dmu_write_uio_dbuf(dmu_buf_t *zdb, uio_t *uio, uint64_t size,
     dmu_tx_t *tx)
@@ -1152,6 +1213,11 @@ dmu_write_uio_dbuf(dmu_buf_t *zdb, uio_t
 	return (err);
 }
 
+/*
+ * Write 'size' bytes from the uio buffer.
+ * To the specified object.
+ * Starting at offset uio->uio_loffset.
+ */
 int
 dmu_write_uio(objset_t *os, uint64_t object, uio_t *uio, uint64_t size,
     dmu_tx_t *tx)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h
==============================================================================
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h	Thu Oct 23 01:36:43 2014	(r273508)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h	Thu Oct 23 01:40:31 2014	(r273509)
@@ -616,6 +616,7 @@ void dmu_write(objset_t *os, uint64_t ob
 void dmu_prealloc(objset_t *os, uint64_t object, uint64_t offset, uint64_t size,
 	dmu_tx_t *tx);
 int dmu_read_uio(objset_t *os, uint64_t object, struct uio *uio, uint64_t size);
+int dmu_read_uio_dbuf(dmu_buf_t *zdb, struct uio *uio, uint64_t size);
 int dmu_write_uio(objset_t *os, uint64_t object, struct uio *uio, uint64_t size,
     dmu_tx_t *tx);
 int dmu_write_uio_dbuf(dmu_buf_t *zdb, struct uio *uio, uint64_t size,

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
==============================================================================
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c	Thu Oct 23 01:36:43 2014	(r273508)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c	Thu Oct 23 01:40:31 2014	(r273509)
@@ -582,7 +582,6 @@ static int
 mappedread(vnode_t *vp, int nbytes, uio_t *uio)
 {
 	znode_t *zp = VTOZ(vp);
-	objset_t *os = zp->z_zfsvfs->z_os;
 	vm_object_t obj;
 	int64_t start;
 	caddr_t va;
@@ -613,7 +612,8 @@ mappedread(vnode_t *vp, int nbytes, uio_
 			page_unhold(pp);
 		} else {
 			zfs_vmobject_wunlock(obj);
-			error = dmu_read_uio(os, zp->z_id, uio, bytes);
+			error = dmu_read_uio_dbuf(sa_get_db(zp->z_sa_hdl),
+			    uio, bytes);
 			zfs_vmobject_wlock(obj);
 		}
 		len -= bytes;
@@ -650,7 +650,6 @@ zfs_read(vnode_t *vp, uio_t *uio, int io
 {
 	znode_t		*zp = VTOZ(vp);
 	zfsvfs_t	*zfsvfs = zp->z_zfsvfs;
-	objset_t	*os;
 	ssize_t		n, nbytes;
 	int		error = 0;
 	rl_t		*rl;
@@ -658,7 +657,6 @@ zfs_read(vnode_t *vp, uio_t *uio, int io
 
 	ZFS_ENTER(zfsvfs);
 	ZFS_VERIFY_ZP(zp);
-	os = zfsvfs->z_os;
 
 	if (zp->z_pflags & ZFS_AV_QUARANTINED) {
 		ZFS_EXIT(zfsvfs);
@@ -756,10 +754,12 @@ zfs_read(vnode_t *vp, uio_t *uio, int io
 			error = mappedread_sf(vp, nbytes, uio);
 		else
 #endif /* __FreeBSD__ */
-		if (vn_has_cached_data(vp))
+		if (vn_has_cached_data(vp)) {
 			error = mappedread(vp, nbytes, uio);
-		else
-			error = dmu_read_uio(os, zp->z_id, uio, nbytes);
+		} else {
+			error = dmu_read_uio_dbuf(sa_get_db(zp->z_sa_hdl),
+			    uio, nbytes);
+		}
 		if (error) {
 			/* convert checksum errors into IO errors */
 			if (error == ECKSUM)

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 01:47:10 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id C54A5E1C;
 Thu, 23 Oct 2014 01:47:10 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id AF05A1CF;
 Thu, 23 Oct 2014 01:47:10 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N1lAqX009122;
 Thu, 23 Oct 2014 01:47:10 GMT (envelope-from delphij@FreeBSD.org)
Received: (from delphij@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N1l9mF009116;
 Thu, 23 Oct 2014 01:47:09 GMT (envelope-from delphij@FreeBSD.org)
Message-Id: <201410230147.s9N1l9mF009116@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: delphij set sender to
 delphij@FreeBSD.org using -f
From: Xin LI 
Date: Thu, 23 Oct 2014 01:47:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject: svn commit: r273510 - in
 stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys
X-SVN-Group: stable-10
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 01:47:11 -0000

Author: delphij
Date: Thu Oct 23 01:47:09 2014
New Revision: 273510
URL: https://svnweb.freebsd.org/changeset/base/273510

Log:
  MFC r272810: FV r272804:
  
  Refactor the code and stop restore_object from creating two transactions.
  
  Illumos issue:
      3693 restore_object uses at least two transactions to restore an object

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
==============================================================================
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c	Thu Oct 23 01:40:31 2014	(r273509)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c	Thu Oct 23 01:47:09 2014	(r273510)
@@ -1920,6 +1920,7 @@ dmu_object_info_from_dnode(dnode_t *dn, 
 	doi->doi_indirection = dn->dn_nlevels;
 	doi->doi_checksum = dn->dn_checksum;
 	doi->doi_compress = dn->dn_compress;
+	doi->doi_nblkptr = dn->dn_nblkptr;
 	doi->doi_physical_blocks_512 = (DN_USED_BYTES(dnp) + 256) >> 9;
 	doi->doi_max_offset = (dn->dn_maxblkid + 1) * dn->dn_datablksz;
 	doi->doi_fill_count = 0;

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c
==============================================================================
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c	Thu Oct 23 01:40:31 2014	(r273509)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c	Thu Oct 23 01:47:09 2014	(r273510)
@@ -20,7 +20,8 @@
  */
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2013, 2014 by Delphix. All rights reserved.
+ * Copyright 2014 HybridCluster. All rights reserved.
  */
 
 #include 
@@ -107,11 +108,9 @@ dmu_object_claim(objset_t *os, uint64_t 
 
 int
 dmu_object_reclaim(objset_t *os, uint64_t object, dmu_object_type_t ot,
-    int blocksize, dmu_object_type_t bonustype, int bonuslen)
+    int blocksize, dmu_object_type_t bonustype, int bonuslen, dmu_tx_t *tx)
 {
 	dnode_t *dn;
-	dmu_tx_t *tx;
-	int nblkptr;
 	int err;
 
 	if (object == DMU_META_DNODE_OBJECT)
@@ -122,44 +121,9 @@ dmu_object_reclaim(objset_t *os, uint64_
 	if (err)
 		return (err);
 
-	if (dn->dn_type == ot && dn->dn_datablksz == blocksize &&
-	    dn->dn_bonustype == bonustype && dn->dn_bonuslen == bonuslen) {
-		/* nothing is changing, this is a noop */
-		dnode_rele(dn, FTAG);
-		return (0);
-	}
-
-	if (bonustype == DMU_OT_SA) {
-		nblkptr = 1;
-	} else {
-		nblkptr = 1 + ((DN_MAX_BONUSLEN - bonuslen) >> SPA_BLKPTRSHIFT);
-	}
-
-	/*
-	 * If we are losing blkptrs or changing the block size this must
-	 * be a new file instance.   We must clear out the previous file
-	 * contents before we can change this type of metadata in the dnode.
-	 */
-	if (dn->dn_nblkptr > nblkptr || dn->dn_datablksz != blocksize) {
-		err = dmu_free_long_range(os, object, 0, DMU_OBJECT_END);
-		if (err)
-			goto out;
-	}
-
-	tx = dmu_tx_create(os);
-	dmu_tx_hold_bonus(tx, object);
-	err = dmu_tx_assign(tx, TXG_WAIT);
-	if (err) {
-		dmu_tx_abort(tx);
-		goto out;
-	}
-
 	dnode_reallocate(dn, ot, blocksize, bonustype, bonuslen, tx);
 
-	dmu_tx_commit(tx);
-out:
 	dnode_rele(dn, FTAG);
-
 	return (err);
 }
 

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c
==============================================================================
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c	Thu Oct 23 01:40:31 2014	(r273509)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c	Thu Oct 23 01:47:09 2014	(r273510)
@@ -24,6 +24,7 @@
  * Copyright (c) 2011, 2014 by Delphix. All rights reserved.
  * Copyright (c) 2014, Joyent, Inc. All rights reserved.
  * Copyright (c) 2012, Martin Matuska . All rights reserved.
+ * Copyright 2014 HybridCluster. All rights reserved.
  */
 
 #include 
@@ -1392,12 +1393,25 @@ backup_byteswap(dmu_replay_record_t *drr
 #undef DO32
 }
 
+static inline uint8_t
+deduce_nblkptr(dmu_object_type_t bonus_type, uint64_t bonus_size)
+{
+	if (bonus_type == DMU_OT_SA) {
+		return (1);
+	} else {
+		return (1 +
+		    ((DN_MAX_BONUSLEN - bonus_size) >> SPA_BLKPTRSHIFT));
+	}
+}
+
 static int
 restore_object(struct restorearg *ra, objset_t *os, struct drr_object *drro)
 {
-	int err;
+	dmu_object_info_t doi;
 	dmu_tx_t *tx;
 	void *data = NULL;
+	uint64_t object;
+	int err;
 
 	if (drro->drr_type == DMU_OT_NONE ||
 	    !DMU_OT_IS_VALID(drro->drr_type) ||
@@ -1411,10 +1425,11 @@ restore_object(struct restorearg *ra, ob
 		return (SET_ERROR(EINVAL));
 	}
 
-	err = dmu_object_info(os, drro->drr_object, NULL);
+	err = dmu_object_info(os, drro->drr_object, &doi);
 
 	if (err != 0 && err != ENOENT)
 		return (SET_ERROR(EINVAL));
+	object = err == 0 ? drro->drr_object : DMU_NEW_OBJECT;
 
 	if (drro->drr_bonuslen) {
 		data = restore_read(ra, P2ROUNDUP(drro->drr_bonuslen, 8), NULL);
@@ -1422,37 +1437,53 @@ restore_object(struct restorearg *ra, ob
 			return (ra->err);
 	}
 
-	if (err == ENOENT) {
-		/* currently free, want to be allocated */
-		tx = dmu_tx_create(os);
-		dmu_tx_hold_bonus(tx, DMU_NEW_OBJECT);
-		err = dmu_tx_assign(tx, TXG_WAIT);
-		if (err != 0) {
-			dmu_tx_abort(tx);
-			return (err);
+	/*
+	 * If we are losing blkptrs or changing the block size this must
+	 * be a new file instance.  We must clear out the previous file
+	 * contents before we can change this type of metadata in the dnode.
+	 */
+	if (err == 0) {
+		int nblkptr;
+
+		nblkptr = deduce_nblkptr(drro->drr_bonustype,
+		    drro->drr_bonuslen);
+
+		if (drro->drr_blksz != doi.doi_data_block_size ||
+		    nblkptr < doi.doi_nblkptr) {
+			err = dmu_free_long_range(os, drro->drr_object,
+			    0, DMU_OBJECT_END);
+			if (err != 0)
+				return (SET_ERROR(EINVAL));
 		}
+	}
+
+	tx = dmu_tx_create(os);
+	dmu_tx_hold_bonus(tx, object);
+	err = dmu_tx_assign(tx, TXG_WAIT);
+	if (err != 0) {
+		dmu_tx_abort(tx);
+		return (err);
+	}
+
+	if (object == DMU_NEW_OBJECT) {
+		/* currently free, want to be allocated */
 		err = dmu_object_claim(os, drro->drr_object,
 		    drro->drr_type, drro->drr_blksz,
 		    drro->drr_bonustype, drro->drr_bonuslen, tx);
-		dmu_tx_commit(tx);
-	} else {
-		/* currently allocated, want to be allocated */
+	} else if (drro->drr_type != doi.doi_type ||
+	    drro->drr_blksz != doi.doi_data_block_size ||
+	    drro->drr_bonustype != doi.doi_bonus_type ||
+	    drro->drr_bonuslen != doi.doi_bonus_size) {
+		/* currently allocated, but with different properties */
 		err = dmu_object_reclaim(os, drro->drr_object,
 		    drro->drr_type, drro->drr_blksz,
-		    drro->drr_bonustype, drro->drr_bonuslen);
+		    drro->drr_bonustype, drro->drr_bonuslen, tx);
 	}
 	if (err != 0) {
+		dmu_tx_commit(tx);
 		return (SET_ERROR(EINVAL));
 	}
 
-	tx = dmu_tx_create(os);
-	dmu_tx_hold_bonus(tx, drro->drr_object);
-	err = dmu_tx_assign(tx, TXG_WAIT);
-	if (err != 0) {
-		dmu_tx_abort(tx);
-		return (err);
-	}
-
 	dmu_object_set_checksum(os, drro->drr_object, drro->drr_checksumtype,
 	    tx);
 	dmu_object_set_compress(os, drro->drr_object, drro->drr_compress, tx);

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h
==============================================================================
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h	Thu Oct 23 01:40:31 2014	(r273509)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h	Thu Oct 23 01:47:09 2014	(r273510)
@@ -25,6 +25,7 @@
  * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
  * Copyright (c) 2012, Joyent, Inc. All rights reserved.
  * Copyright 2013 DEY Storage Systems, Inc.
+ * Copyright 2014 HybridCluster. All rights reserved.
  */
 
 /* Portions Copyright 2010 Robert Milkowski */
@@ -341,7 +342,7 @@ uint64_t dmu_object_alloc(objset_t *os, 
 int dmu_object_claim(objset_t *os, uint64_t object, dmu_object_type_t ot,
     int blocksize, dmu_object_type_t bonus_type, int bonus_len, dmu_tx_t *tx);
 int dmu_object_reclaim(objset_t *os, uint64_t object, dmu_object_type_t ot,
-    int blocksize, dmu_object_type_t bonustype, int bonuslen);
+    int blocksize, dmu_object_type_t bonustype, int bonuslen, dmu_tx_t *txp);
 
 /*
  * Free an object from this objset.
@@ -662,7 +663,8 @@ typedef struct dmu_object_info {
 	uint8_t doi_indirection;		/* 2 = dnode->indirect->data */
 	uint8_t doi_checksum;
 	uint8_t doi_compress;
-	uint8_t doi_pad[5];
+	uint8_t doi_nblkptr;
+	uint8_t doi_pad[4];
 	uint64_t doi_physical_blocks_512;	/* data + metadata, 512b blks */
 	uint64_t doi_max_offset;
 	uint64_t doi_fill_count;		/* number of non-empty blocks */

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 02:18:24 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id BAF8F579;
 Thu, 23 Oct 2014 02:18:24 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id A6AD9678;
 Thu, 23 Oct 2014 02:18:24 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N2IO1f023188;
 Thu, 23 Oct 2014 02:18:24 GMT (envelope-from emaste@FreeBSD.org)
Received: (from emaste@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N2IOh6023187;
 Thu, 23 Oct 2014 02:18:24 GMT (envelope-from emaste@FreeBSD.org)
Message-Id: <201410230218.s9N2IOh6023187@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: emaste set sender to
 emaste@FreeBSD.org using -f
From: Ed Maste 
Date: Thu, 23 Oct 2014 02:18:24 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject: svn commit: r273511 - stable/10/share/man/man4
X-SVN-Group: stable-10
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 02:18:24 -0000

Author: emaste
Date: Thu Oct 23 02:18:23 2014
New Revision: 273511
URL: https://svnweb.freebsd.org/changeset/base/273511

Log:
  Add vtfontcvt(8) cross-reference to vt(4) man page
  
  MFC of r273332

Modified:
  stable/10/share/man/man4/vt.4
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/man/man4/vt.4
==============================================================================
--- stable/10/share/man/man4/vt.4	Thu Oct 23 01:47:09 2014	(r273510)
+++ stable/10/share/man/man4/vt.4	Thu Oct 23 02:18:23 2014	(r273511)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 16, 2014
+.Dd October 20, 2014
 .Dt "VIRTUAL TERMINALS" 4
 .Os
 .Sh NAME
@@ -273,7 +273,8 @@ on a black background, or black on a bri
 .Xr getty 8 ,
 .Xr kbdmux 8 ,
 .Xr kldload 8 ,
-.Xr moused 8
+.Xr moused 8 ,
+.Xr vtfontcvt 8
 .Sh HISTORY
 The
 .Nm

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 02:50:19 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 2C2349D3;
 Thu, 23 Oct 2014 02:50:19 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 0CD4F97A;
 Thu, 23 Oct 2014 02:50:19 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N2oIoG038319;
 Thu, 23 Oct 2014 02:50:18 GMT (envelope-from pfg@FreeBSD.org)
Received: (from pfg@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N2oIFk038311;
 Thu, 23 Oct 2014 02:50:18 GMT (envelope-from pfg@FreeBSD.org)
Message-Id: <201410230250.s9N2oIFk038311@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: pfg set sender to pfg@FreeBSD.org
 using -f
From: "Pedro F. Giffuni" 
Date: Thu, 23 Oct 2014 02:50:18 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject: svn commit: r273512 - stable/10/release/picobsd/tinyware/simple_httpd
X-SVN-Group: stable-10
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 02:50:19 -0000

Author: pfg
Date: Thu Oct 23 02:50:18 2014
New Revision: 273512
URL: https://svnweb.freebsd.org/changeset/base/273512

Log:
  MFC	r271787:
  
  simple_httpd: cosmetic cleanups.
  
  Many tab vs space cleanups.
  Use setpgid() instead of setpgrp() which is more portable.

Modified:
  stable/10/release/picobsd/tinyware/simple_httpd/simple_httpd.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/release/picobsd/tinyware/simple_httpd/simple_httpd.c
==============================================================================
--- stable/10/release/picobsd/tinyware/simple_httpd/simple_httpd.c	Thu Oct 23 02:18:23 2014	(r273511)
+++ stable/10/release/picobsd/tinyware/simple_httpd/simple_httpd.c	Thu Oct 23 02:50:18 2014	(r273512)
@@ -160,8 +160,8 @@ http_date(void)
 void
 http_output(const char *html)
 {
-        write(con_sock, html, strlen(html));
-        write(con_sock, "\r\n", 2);
+	write(con_sock, html, strlen(html));
+	write(con_sock, "\r\n", 2);
 }
 
 
@@ -172,30 +172,30 @@ http_output(const char *html)
 void
 log_line(char *req)
 {
-        char            log_buff[256];
-        char            msg[1024];
-	char            env_host[80], env_addr[80];
-	long            addr;
-	FILE           *log;
+	char	log_buff[256];
+	char	msg[1024];
+	char	env_host[80], env_addr[80];
+	long	addr;
+	FILE	*log;
 
 	strcpy(log_buff,inet_ntoa(source.sin_addr));
 	sprintf(env_addr, "REMOTE_ADDR=%s",log_buff);
 
-        addr=inet_addr(log_buff);
-        
-        strcpy(msg,adate());
-        strcat(msg,"    ");                 
-        hst=gethostbyaddr((char*) &addr, 4, AF_INET);
+	addr=inet_addr(log_buff);
+
+	strcpy(msg,adate());
+	strcat(msg,"    ");
+	hst=gethostbyaddr((char*) &addr, 4, AF_INET);
 
 	/* If DNS hostname exists */
-        if (hst) {
+	if (hst) {
 	  strcat(msg,hst->h_name);
 	  sprintf(env_host, "REMOTE_HOST=%s",hst->h_name);
 	}
-        strcat(msg," (");
-        strcat(msg,log_buff);
-        strcat(msg,")   ");
-        strcat(msg,req);
+	strcat(msg," (");
+	strcat(msg,log_buff);
+	strcat(msg,")   ");
+	strcat(msg,req);
 
 	if (daemonize) {
 	  log=fopen(logfile,"a");
@@ -226,8 +226,8 @@ http_request(void)
 
 	lg = read(con_sock, req, 1024);
 
-        if ((p=strstr(req,"\n"))) *p=0;
-        if ((p=strstr(req,"\r"))) *p=0;
+	if ((p=strstr(req,"\n"))) *p=0;
+	if ((p=strstr(req,"\r"))) *p=0;
 
 	log_line(req);
 
@@ -253,40 +253,40 @@ http_request(void)
 	filename = strtok(NULL, " ");
 
 	c = strtok(NULL, " ");
-	if (fetch_mode != NULL) filename=fetch_mode; 
-	if (filename == NULL || 
-            strlen(filename)==1) filename="/index.html"; 
+	if (fetch_mode != NULL) filename=fetch_mode;
+	if (filename == NULL ||
+	    strlen(filename)==1) filename="/index.html";
 
-	while (filename[0]== '/') filename++;        
+	while (filename[0]== '/') filename++;
 	
-        /* CGI handling.  Untested */
-        if (!strncmp(filename,"cgi-bin/",8))           
-           {
-           par=0;
-           if ((par=strstr(filename,"?")))                        
-              {
-               *par=0;            
-                par++;      
-              } 
-           if (access(filename,X_OK)) goto conti;
-           stat (filename,&file_status);
-           if (setuid(file_status.st_uid)) return;
-           if (seteuid(file_status.st_uid)) return;
-           if (!fork())
-              {
-               close(1);
-               dup(con_sock);
-               /*printf("HTTP/1.0 200 OK\nContent-type: text/html\n\n\n");*/
+	/* CGI handling.  Untested */
+	if (!strncmp(filename,"cgi-bin/",8))
+	   {
+	   par=0;
+	   if ((par=strstr(filename,"?")))
+	      {
+	       *par=0;
+	        par++;
+	      } 
+	   if (access(filename,X_OK)) goto conti;
+	   stat (filename,&file_status);
+	   if (setuid(file_status.st_uid)) return;
+	   if (seteuid(file_status.st_uid)) return;
+	   if (!fork())
+	      {
+	       close(1);
+	       dup(con_sock);
+	       /*printf("HTTP/1.0 200 OK\nContent-type: text/html\n\n\n");*/
 	       printf("HTTP/1.0 200 OK\r\n");
-               /* Plug in environment variable, others in log_line */
+	       /* Plug in environment variable, others in log_line */
 	       setenv("SERVER_SOFTWARE", "FreeBSD/PicoBSD", 1);
 
 	       execlp (filename,filename,par,(char *)0);
-              } 
-            wait(&i);
-            return;
-            }
-        conti:
+	      } 
+	    wait(&i);
+	    return;
+	    }
+	conti:
 	if (filename == NULL) {
 	  http_output(http_405[0]);
 	  http_output(http_405[1]);
@@ -307,8 +307,8 @@ http_request(void)
 	/* Open filename */
 	fd = open(filename, O_RDONLY);
 	if (fd < 0) {
-	        http_output(http_404[0]);
-	        http_output(http_404[1]);
+		http_output(http_404[0]);
+		http_output(http_404[1]);
 		goto end_request;
 	}
 
@@ -325,7 +325,7 @@ http_request(void)
 	  http_output(http_404[1]);
 	  goto end_request2;
 	}
-     
+
 	/* Past this point we are serving either a GET or HEAD */
 	/* Print all the header info */
 	http_output(http_200);
@@ -371,14 +371,14 @@ end_request:
 int
 main(int argc, char *argv[])
 {
-        int ch, ld;
-	int             httpd_group = 65534;
-        pid_t server_pid;
-  
+	int ch, ld;
+	pid_t httpd_group = 65534;
+	pid_t server_pid;
+
 	/* Default for html directory */
 	strcpy (homedir,getenv("HOME"));
-        if (!geteuid()) strcpy (homedir,"/httphome");
-           else         strcat (homedir,"/httphome");
+	if (!geteuid())	strcpy (homedir,"/httphome");
+	   else		strcat (homedir,"/httphome");
 
 	/* Defaults for log file */
 	if (geteuid()) {
@@ -420,10 +420,10 @@ main(int argc, char *argv[])
 	    printf("usage: simple_httpd [[-d directory][-g grpid][-l logfile][-p port][-vD]]\n");
 	    exit(1);
 	    /* NOTREACHED */
-	  }                           
+	  }
 
 	/* Not running as root and no port supplied, assume 1080 */
-        if ((http_port == 80) && geteuid()) {
+	if ((http_port == 80) && geteuid()) {
 	  http_port = 1080;
 	}
 
@@ -437,15 +437,15 @@ main(int argc, char *argv[])
 	}
 
 	/* Create log file if it doesn't exit */
-	if ((access(logfile,W_OK)) && daemonize) { 
-	  ld = open (logfile,O_WRONLY);         
+	if ((access(logfile,W_OK)) && daemonize) {
+	  ld = open (logfile,O_WRONLY);
 	  chmod (logfile,00600);
 	  close(ld);
 	}
 
-        init_servconnection();                  
+	init_servconnection();
 
-        if (verbose) {
+	if (verbose) {
 	  printf("Server started with options \n"); 
 	  printf("port: %d\n",http_port);
 	  if (fetch_mode == NULL) printf("html home: %s\n",homedir);
@@ -453,7 +453,7 @@ main(int argc, char *argv[])
 	}
 
 	/* httpd is spawned */
-        if (daemonize) {
+	if (daemonize) {
 	  if ((server_pid = fork()) != 0) {
 	    wait3(0,WNOHANG,0);
 	    if (verbose) printf("pid: %d\n",server_pid);
@@ -462,16 +462,17 @@ main(int argc, char *argv[])
 	  wait3(0,WNOHANG,0);
 	}
 
-	if (fetch_mode == NULL) setpgrp(0,httpd_group);
+	if (fetch_mode == NULL)
+		setpgrp((pid_t)0, httpd_group);
 
 	/* How many connections do you want? 
 	 * Keep this lower than the available number of processes
 	 */
-        if (listen(http_sock,15) < 0) exit(1);
+	if (listen(http_sock,15) < 0) exit(1);
 
-        label:	
+	label:	
 	wait_connection();
-    
+
 	if (fork()) {
 	  wait3(0,WNOHANG,0);
 	  close(con_sock);
@@ -488,13 +489,13 @@ main(int argc, char *argv[])
 char *
 adate(void)
 {
-        static char out[50];
-        time_t now;
-        struct tm *t;
-        time(&now);
-        t = localtime(&now);
-        sprintf(out, "%02d:%02d:%02d %02d/%02d/%02d",
-                     t->tm_hour, t->tm_min, t->tm_sec,
-                     t->tm_mday, t->tm_mon+1, t->tm_year );
-        return out;
+	static char out[50];
+	time_t now;
+	struct tm *t;
+	time(&now);
+	t = localtime(&now);
+	sprintf(out, "%02d:%02d:%02d %02d/%02d/%02d",
+		     t->tm_hour, t->tm_min, t->tm_sec,
+		     t->tm_mday, t->tm_mon+1, t->tm_year );
+	return out;
 }

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 02:53:58 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id BE151D84;
 Thu, 23 Oct 2014 02:53:58 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id A9797A4C;
 Thu, 23 Oct 2014 02:53:58 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N2rwa5041068;
 Thu, 23 Oct 2014 02:53:58 GMT (envelope-from pfg@FreeBSD.org)
Received: (from pfg@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N2rwDt041067;
 Thu, 23 Oct 2014 02:53:58 GMT (envelope-from pfg@FreeBSD.org)
Message-Id: <201410230253.s9N2rwDt041067@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: pfg set sender to pfg@FreeBSD.org
 using -f
From: "Pedro F. Giffuni" 
Date: Thu, 23 Oct 2014 02:53:58 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject: svn commit: r273513 - stable/10/usr.sbin/lpr/lpd
X-SVN-Group: stable-10
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 02:53:58 -0000

Author: pfg
Date: Thu Oct 23 02:53:57 2014
New Revision: 273513
URL: https://svnweb.freebsd.org/changeset/base/273513

Log:
  MFC	r271789:
  
  lpr: replace setpgrp(2) with setpgid(2).
  
  setpgid(2) is more portable than setpgrp(2).
  The BSD variant of setpgrp is a wrapper for
  setpgid(2) anyways.

Modified:
  stable/10/usr.sbin/lpr/lpd/printjob.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/lpr/lpd/printjob.c
==============================================================================
--- stable/10/usr.sbin/lpr/lpd/printjob.c	Thu Oct 23 02:50:18 2014	(r273512)
+++ stable/10/usr.sbin/lpr/lpd/printjob.c	Thu Oct 23 02:53:57 2014	(r273513)
@@ -176,7 +176,7 @@ printjob(struct printer *pp)
 	}
 	if(setgid(getegid()) != 0) err(1, "setgid() failed");
 	printpid = getpid();			/* for use with lprm */
-	setpgrp(0, printpid);
+	setpgid((pid_t)0, printpid);
 
 	/*
 	 * At initial lpd startup, printjob may be called with various

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 03:13:15 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id B534D336;
 Thu, 23 Oct 2014 03:13:15 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 874B5CDC;
 Thu, 23 Oct 2014 03:13:15 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N3DFYO051390;
 Thu, 23 Oct 2014 03:13:15 GMT (envelope-from ian@FreeBSD.org)
Received: (from ian@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N3DF4B051389;
 Thu, 23 Oct 2014 03:13:15 GMT (envelope-from ian@FreeBSD.org)
Message-Id: <201410230313.s9N3DF4B051389@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org
 using -f
From: Ian Lepore 
Date: Thu, 23 Oct 2014 03:13:15 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273514 - head/sys/arm/freescale/imx
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 03:13:15 -0000

Author: ian
Date: Thu Oct 23 03:13:14 2014
New Revision: 273514
URL: https://svnweb.freebsd.org/changeset/base/273514

Log:
  Unconditionally enable the clocks for all imx6 devices that we have drivers
  for, or that are required to run the chip (such as busses).  Turn off all
  the devices we don't yet have drivers for.
  
  Some day we will have a fully functional imx6 clock driver so that we can
  manage clocks based on fdt data.  This will have to do until then.

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

Modified: head/sys/arm/freescale/imx/imx6_ccm.c
==============================================================================
--- head/sys/arm/freescale/imx/imx6_ccm.c	Thu Oct 23 02:53:57 2014	(r273513)
+++ head/sys/arm/freescale/imx/imx6_ccm.c	Thu Oct 23 03:13:14 2014	(r273514)
@@ -76,6 +76,28 @@ WR4(struct ccm_softc *sc, bus_size_t off
 	bus_write_4(sc->mem_res, off, val);
 }
 
+/*
+ * Until we have a fully functional ccm driver which implements the fdt_clock
+ * interface, use the age-old workaround of unconditionally enabling the clocks
+ * for devices we might need to use.  The SoC defaults to most clocks enabled,
+ * but the rom boot code and u-boot disable a few of them.  We turn on only
+ * what's needed to run the chip plus devices we have drivers for, and turn off
+ * devices we don't yet have drivers for.  (Note that USB is not turned on here
+ * because that is one we do when the driver asks for it.)
+ */
+static void
+ccm_init_gates(struct ccm_softc *sc)
+{
+                                        /* Turns on... */
+	WR4(sc, CCM_CCGR0, 0x0000003f); /* ahpbdma, aipstz 1 & 2 busses */
+	WR4(sc, CCM_CCGR1, 0x00300c00); /* gpt, enet */
+	WR4(sc, CCM_CCGR2, 0x0fffffc0); /* ipmux & ipsync (bridges), iomux, i2c */
+	WR4(sc, CCM_CCGR3, 0x3ff00000); /* DDR memory controller */
+	WR4(sc, CCM_CCGR4, 0x0000f300); /* pl301 bus crossbar */
+	WR4(sc, CCM_CCGR5, 0x0f000000); /* uarts */
+	WR4(sc, CCM_CCGR6, 0x000000cc); /* usdhc 1 & 3 */
+}
+
 static int
 ccm_detach(device_t dev)
 {
@@ -130,6 +152,8 @@ ccm_attach(device_t dev)
 	reg = (reg & ~CCM_CLPCR_LPM_MASK) | CCM_CLPCR_LPM_RUN;
 	WR4(sc, CCM_CLPCR, reg);
 
+	ccm_init_gates(sc);
+
 	err = 0;
 
 out:

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 04:47:34 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 6804FF6D;
 Thu, 23 Oct 2014 04:47:34 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 520636C1;
 Thu, 23 Oct 2014 04:47:34 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N4lYcE092853;
 Thu, 23 Oct 2014 04:47:34 GMT (envelope-from bryanv@FreeBSD.org)
Received: (from bryanv@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N4lXih092846;
 Thu, 23 Oct 2014 04:47:33 GMT (envelope-from bryanv@FreeBSD.org)
Message-Id: <201410230447.s9N4lXih092846@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: bryanv set sender to
 bryanv@FreeBSD.org using -f
From: Bryan Venteicher 
Date: Thu, 23 Oct 2014 04:47:33 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273515 - in head: share/man/man4 sys/dev/virtio/console
 sys/modules/virtio sys/modules/virtio/console
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 04:47:34 -0000

Author: bryanv
Date: Thu Oct 23 04:47:32 2014
New Revision: 273515
URL: https://svnweb.freebsd.org/changeset/base/273515

Log:
  Add VirtIO console driver
  
  Support for the multiport feature is mostly implemented, but currently
  disabled due to some potential races in the hot plug code paths.
  
  Requested by:	marcel
  MFC after:	1 month
  Relnotes:	yes

Added:
  head/share/man/man4/virtio_console.4   (contents, props changed)
  head/sys/dev/virtio/console/
  head/sys/dev/virtio/console/virtio_console.c   (contents, props changed)
  head/sys/dev/virtio/console/virtio_console.h   (contents, props changed)
  head/sys/modules/virtio/console/
  head/sys/modules/virtio/console/Makefile   (contents, props changed)
Modified:
  head/share/man/man4/Makefile
  head/share/man/man4/virtio.4
  head/sys/modules/virtio/Makefile

Modified: head/share/man/man4/Makefile
==============================================================================
--- head/share/man/man4/Makefile	Thu Oct 23 03:13:14 2014	(r273514)
+++ head/share/man/man4/Makefile	Thu Oct 23 04:47:32 2014	(r273515)
@@ -563,6 +563,7 @@ MAN=	aac.4 \
 	${_virtio.4} \
 	${_virtio_balloon.4} \
 	${_virtio_blk.4} \
+	${_virtio_console.4} \
 	${_virtio_random.4} \
 	${_virtio_scsi.4} \
 	vkbd.4 \
@@ -814,6 +815,7 @@ _nxge.4=	nxge.4
 _virtio.4=	virtio.4
 _virtio_balloon.4=virtio_balloon.4
 _virtio_blk.4=	virtio_blk.4
+_virtio_console.4=virtio_console.4
 _virtio_random.4= virtio_random.4
 _virtio_scsi.4= virtio_scsi.4
 _vmx.4=		vmx.4

Modified: head/share/man/man4/virtio.4
==============================================================================
--- head/share/man/man4/virtio.4	Thu Oct 23 03:13:14 2014	(r273514)
+++ head/share/man/man4/virtio.4	Thu Oct 23 04:47:32 2014	(r273515)
@@ -85,6 +85,7 @@ device driver.
 .Sh SEE ALSO
 .Xr virtio_balloon 4 ,
 .Xr virtio_blk 4 ,
+.Xr virtio_console 4 ,
 .Xr virtio_scsi 4 ,
 .Xr vtnet 4
 .Sh HISTORY

Added: head/share/man/man4/virtio_console.4
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/share/man/man4/virtio_console.4	Thu Oct 23 04:47:32 2014	(r273515)
@@ -0,0 +1,66 @@
+.\" Copyright (c) 2014 Bryan Venteicher
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 October 22, 2014
+.Dt VIRTIO_CONSOLE 4
+.Os
+.Sh NAME
+.Nm virtio_console
+.Nd VirtIO Console driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device virtio_console"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+virtio_console_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+device driver provides support for VirtIO console devices.
+.Pp
+The console device may have one or more ports.
+Each port is similar to a simple serial interface, and
+each port is accessible through
+.Xr tty 4 .
+.Sh FILES
+.Bl -tag -width ".Pa /dev/ttyV?.??" -compact
+.It Pa /dev/ttyV?.??
+.Sh SEE ALSO
+.Xr tty 4
+.Xr virtio 4
+.Sh HISTORY
+The
+.Nm
+driver was written by
+.An Bryan Venteicher Aq bryanv@FreeBSD.org .

Added: head/sys/dev/virtio/console/virtio_console.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/dev/virtio/console/virtio_console.c	Thu Oct 23 04:47:32 2014	(r273515)
@@ -0,0 +1,1238 @@
+/*-
+ * Copyright (c) 2014, Bryan Venteicher 
+ * 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, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* Driver for VirtIO console devices. */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include "virtio_if.h"
+
+#define VTCON_MAX_PORTS	1
+#define VTCON_TTY_PREFIX "V"
+#define VTCON_BULK_BUFSZ 128
+
+struct vtcon_softc;
+
+struct vtcon_port {
+	struct vtcon_softc	*vtcport_sc;
+	TAILQ_ENTRY(vtcon_port)  vtcport_next;
+	struct mtx		 vtcport_mtx;
+	int			 vtcport_id;
+	struct tty		*vtcport_tty;
+	struct virtqueue	*vtcport_invq;
+	struct virtqueue	*vtcport_outvq;
+	char			 vtcport_name[16];
+};
+
+#define VTCON_PORT_MTX(_port)		&(_port)->vtcport_mtx
+#define VTCON_PORT_LOCK_INIT(_port) \
+    mtx_init(VTCON_PORT_MTX((_port)), (_port)->vtcport_name, NULL, MTX_DEF)
+#define VTCON_PORT_LOCK(_port)		mtx_lock(VTCON_PORT_MTX((_port)))
+#define VTCON_PORT_UNLOCK(_port)	mtx_unlock(VTCON_PORT_MTX((_port)))
+#define VTCON_PORT_LOCK_DESTROY(_port)	mtx_destroy(VTCON_PORT_MTX((_port)))
+#define VTCON_PORT_LOCK_ASSERT(_port) \
+    mtx_assert(VTCON_PORT_MTX((_port)), MA_OWNED)
+#define VTCON_PORT_LOCK_ASSERT_NOTOWNED(_port) \
+    mtx_assert(VTCON_PORT_MTX((_port)), MA_NOTOWNED)
+
+struct vtcon_softc {
+	device_t		 vtcon_dev;
+	struct mtx		 vtcon_mtx;
+	uint64_t		 vtcon_features;
+	uint32_t		 vtcon_flags;
+#define VTCON_FLAG_DETACHED	0x0001
+#define VTCON_FLAG_SIZE		0x0010
+#define VTCON_FLAG_MULTIPORT	0x0020
+
+	struct task		 vtcon_ctrl_task;
+	struct virtqueue	*vtcon_ctrl_rxvq;
+	struct virtqueue	*vtcon_ctrl_txvq;
+
+	uint32_t		 vtcon_max_ports;
+	TAILQ_HEAD(, vtcon_port)
+				 vtcon_ports;
+
+	/*
+	 * Ports can be added and removed during runtime, but we have
+	 * to allocate all the virtqueues during attach. This array is
+	 * indexed by the port ID.
+	 */
+	struct vtcon_port_extra {
+		struct vtcon_port	*port;
+		struct virtqueue	*invq;
+		struct virtqueue	*outvq;
+	}			*vtcon_portsx;
+};
+
+#define VTCON_MTX(_sc)		&(_sc)->vtcon_mtx
+#define VTCON_LOCK_INIT(_sc, _name) \
+    mtx_init(VTCON_MTX((_sc)), (_name), NULL, MTX_DEF)
+#define VTCON_LOCK(_sc)		mtx_lock(VTCON_MTX((_sc)))
+#define VTCON_UNLOCK(_sc)	mtx_unlock(VTCON_MTX((_sc)))
+#define VTCON_LOCK_DESTROY(_sc)	mtx_destroy(VTCON_MTX((_sc)))
+#define VTCON_LOCK_ASSERT(_sc)	mtx_assert(VTCON_MTX((_sc)), MA_OWNED)
+#define VTCON_LOCK_ASSERT_NOTOWNED(_sc) \
+    mtx_assert(VTCON_MTX((_sc)), MA_NOTOWNED)
+
+#define VTCON_ASSERT_VALID_PORTID(_sc, _id)			\
+    KASSERT((_id) >= 0 && (_id) < (_sc)->vtcon_max_ports,	\
+        ("%s: port ID %d out of range", __func__, _id))
+
+#define VTCON_FEATURES  0
+
+static struct virtio_feature_desc vtcon_feature_desc[] = {
+	{ VIRTIO_CONSOLE_F_SIZE,	"ConsoleSize"	},
+	{ VIRTIO_CONSOLE_F_MULTIPORT,	"MultiplePorts"	},
+
+	{ 0, NULL }
+};
+
+static int	 vtcon_modevent(module_t, int, void *);
+
+static int	 vtcon_probe(device_t);
+static int	 vtcon_attach(device_t);
+static int	 vtcon_detach(device_t);
+static int	 vtcon_config_change(device_t);
+
+static void	 vtcon_negotiate_features(struct vtcon_softc *);
+static int	 vtcon_alloc_virtqueues(struct vtcon_softc *);
+static void	 vtcon_read_config(struct vtcon_softc *,
+		     struct virtio_console_config *);
+
+static void	 vtcon_determine_max_ports(struct vtcon_softc *,
+		     struct virtio_console_config *);
+static void	 vtcon_deinit_ports(struct vtcon_softc *);
+static void	 vtcon_stop(struct vtcon_softc *);
+
+static void	 vtcon_ctrl_rx_vq_intr(void *);
+static int	 vtcon_ctrl_enqueue_msg(struct vtcon_softc *,
+		     struct virtio_console_control *);
+static int	 vtcon_ctrl_add_msg(struct vtcon_softc *);
+static void	 vtcon_ctrl_readd_msg(struct vtcon_softc *,
+		     struct virtio_console_control *);
+static int	 vtcon_ctrl_populate(struct vtcon_softc *);
+static void	 vtcon_ctrl_send_msg(struct vtcon_softc *,
+		     struct virtio_console_control *control);
+static void	 vtcon_ctrl_send_event(struct vtcon_softc *, uint32_t,
+		     uint16_t, uint16_t);
+static int	 vtcon_ctrl_init(struct vtcon_softc *);
+static void	 vtcon_ctrl_drain(struct vtcon_softc *);
+static void	 vtcon_ctrl_deinit(struct vtcon_softc *);
+static void	 vtcon_ctrl_port_add_event(struct vtcon_softc *, int);
+static void	 vtcon_ctrl_port_remove_event(struct vtcon_softc *, int);
+static void	 vtcon_ctrl_port_console_event(struct vtcon_softc *, int);
+static void	 vtcon_ctrl_port_open_event(struct vtcon_softc *, int);
+static void	 vtcon_ctrl_process_msg(struct vtcon_softc *,
+		     struct virtio_console_control *);
+static void	 vtcon_ctrl_task_cb(void *, int);
+
+static int	 vtcon_port_add_inbuf(struct vtcon_port *);
+static void	 vtcon_port_readd_inbuf(struct vtcon_port *, void *);
+static int	 vtcon_port_populate(struct vtcon_port *);
+static void	 vtcon_port_destroy(struct vtcon_port *);
+static int	 vtcon_port_create(struct vtcon_softc *, int,
+		     struct vtcon_port **);
+static void	 vtcon_port_drain_inbufs(struct vtcon_port *);
+static void	 vtcon_port_teardown(struct vtcon_port *, int);
+static void	 vtcon_port_change_size(struct vtcon_port *, uint16_t,
+		     uint16_t);
+static void	 vtcon_port_enable_intr(struct vtcon_port *);
+static void	 vtcon_port_disable_intr(struct vtcon_port *);
+static void	 vtcon_port_intr(struct vtcon_port *);
+static void	 vtcon_port_in_vq_intr(void *);
+static void	 vtcon_port_put(struct vtcon_port *, void *, int);
+static void	 vtcon_port_send_ctrl_msg(struct vtcon_port *, uint16_t,
+		     uint16_t);
+static struct vtcon_port *vtcon_port_lookup_by_id(struct vtcon_softc *, int);
+
+static int	 vtcon_tty_open(struct tty *);
+static void	 vtcon_tty_close(struct tty *);
+static void	 vtcon_tty_outwakeup(struct tty *);
+static void	 vtcon_tty_free(void *);
+
+static void	 vtcon_get_console_size(struct vtcon_softc *, uint16_t *,
+		     uint16_t *);
+
+static void	 vtcon_enable_interrupts(struct vtcon_softc *);
+static void	 vtcon_disable_interrupts(struct vtcon_softc *);
+
+static int	 vtcon_pending_free;
+
+static struct ttydevsw vtcon_tty_class = {
+	.tsw_flags	= 0,
+	.tsw_open	= vtcon_tty_open,
+	.tsw_close	= vtcon_tty_close,
+	.tsw_outwakeup	= vtcon_tty_outwakeup,
+	.tsw_free	= vtcon_tty_free,
+};
+
+static device_method_t vtcon_methods[] = {
+	/* Device methods. */
+	DEVMETHOD(device_probe,		vtcon_probe),
+	DEVMETHOD(device_attach,	vtcon_attach),
+	DEVMETHOD(device_detach,	vtcon_detach),
+
+	/* VirtIO methods. */
+	DEVMETHOD(virtio_config_change,	vtcon_config_change),
+
+	DEVMETHOD_END
+};
+
+static driver_t vtcon_driver = {
+	"vtcon",
+	vtcon_methods,
+	sizeof(struct vtcon_softc)
+};
+static devclass_t vtcon_devclass;
+
+DRIVER_MODULE(virtio_console, virtio_pci, vtcon_driver, vtcon_devclass,
+    vtcon_modevent, 0);
+MODULE_VERSION(virtio_console, 1);
+MODULE_DEPEND(virtio_console, virtio, 1, 1, 1);
+
+static int
+vtcon_modevent(module_t mod, int type, void *unused)
+{
+	int error;
+
+	switch (type) {
+	case MOD_LOAD:
+		error = 0;
+		break;
+	case MOD_QUIESCE:
+	case MOD_UNLOAD:
+		error = vtcon_pending_free != 0 ? EBUSY : 0;
+		/* error = EOPNOTSUPP; */
+		break;
+	case MOD_SHUTDOWN:
+		error = 0;
+		break;
+	default:
+		error = EOPNOTSUPP;
+		break;
+	}
+
+	return (error);
+}
+
+static int
+vtcon_probe(device_t dev)
+{
+
+	if (virtio_get_device_type(dev) != VIRTIO_ID_CONSOLE)
+		return (ENXIO);
+
+	device_set_desc(dev, "VirtIO Console Adapter");
+
+	return (BUS_PROBE_DEFAULT);
+}
+
+static int
+vtcon_attach(device_t dev)
+{
+	struct vtcon_softc *sc;
+	struct virtio_console_config concfg;
+	int error;
+
+	sc = device_get_softc(dev);
+	sc->vtcon_dev = dev;
+
+	VTCON_LOCK_INIT(sc, device_get_nameunit(dev));
+	TASK_INIT(&sc->vtcon_ctrl_task, 0, vtcon_ctrl_task_cb, sc);
+	TAILQ_INIT(&sc->vtcon_ports);
+
+	virtio_set_feature_desc(dev, vtcon_feature_desc);
+	vtcon_negotiate_features(sc);
+
+	if (virtio_with_feature(dev, VIRTIO_CONSOLE_F_SIZE))
+		sc->vtcon_flags |= VTCON_FLAG_SIZE;
+	if (virtio_with_feature(dev, VIRTIO_CONSOLE_F_MULTIPORT))
+		sc->vtcon_flags |= VTCON_FLAG_MULTIPORT;
+
+	vtcon_read_config(sc, &concfg);
+	vtcon_determine_max_ports(sc, &concfg);
+
+	error = vtcon_alloc_virtqueues(sc);
+	if (error) {
+		device_printf(dev, "cannot allocate virtqueues\n");
+		goto fail;
+	}
+
+	if (sc->vtcon_flags & VTCON_FLAG_MULTIPORT)
+		error = vtcon_ctrl_init(sc);
+	else
+		error = vtcon_port_create(sc, 0, NULL);
+	if (error)
+		goto fail;
+
+	error = virtio_setup_intr(dev, INTR_TYPE_TTY);
+	if (error) {
+		device_printf(dev, "cannot setup virtqueue interrupts\n");
+		goto fail;
+	}
+
+	vtcon_enable_interrupts(sc);
+
+	vtcon_ctrl_send_event(sc, VIRTIO_CONSOLE_BAD_ID,
+	    VIRTIO_CONSOLE_DEVICE_READY, 1);
+
+fail:
+	if (error)
+		vtcon_detach(dev);
+
+	return (error);
+}
+
+static int
+vtcon_detach(device_t dev)
+{
+	struct vtcon_softc *sc;
+
+	sc = device_get_softc(dev);
+
+	VTCON_LOCK(sc);
+	sc->vtcon_flags |= VTCON_FLAG_DETACHED;
+	if (device_is_attached(dev))
+		vtcon_stop(sc);
+	VTCON_UNLOCK(sc);
+
+	taskqueue_drain(taskqueue_thread, &sc->vtcon_ctrl_task);
+
+	if (sc->vtcon_flags & VTCON_FLAG_MULTIPORT)
+		vtcon_ctrl_deinit(sc);
+
+	vtcon_deinit_ports(sc);
+
+	VTCON_LOCK_DESTROY(sc);
+
+	return (0);
+}
+
+static int
+vtcon_config_change(device_t dev)
+{
+	struct vtcon_softc *sc;
+	struct vtcon_port *port;
+	uint16_t cols, rows;
+
+	sc = device_get_softc(dev);
+
+	/*
+	 * With the multiport feature, all configuration changes are
+	 * done through control virtqueue events. This is a spurious
+	 * interrupt.
+	 */
+	if (sc->vtcon_flags & VTCON_FLAG_MULTIPORT)
+		return (0);
+
+	if (sc->vtcon_flags & VTCON_FLAG_SIZE) {
+		/*
+		 * For now, assume the first (only) port is the 'console'.
+		 * Note QEMU does not implement this feature yet.
+		 */
+		VTCON_LOCK(sc);
+		if ((port = vtcon_port_lookup_by_id(sc, 0)) != NULL) {
+			vtcon_get_console_size(sc, &cols, &rows);
+			vtcon_port_change_size(port, cols, rows);
+		}
+		VTCON_UNLOCK(sc);
+	}
+
+	return (0);
+}
+
+static void
+vtcon_negotiate_features(struct vtcon_softc *sc)
+{
+	device_t dev;
+	uint64_t features;
+
+	dev = sc->vtcon_dev;
+	features = VTCON_FEATURES;
+
+	sc->vtcon_features = virtio_negotiate_features(dev, features);
+}
+
+#define VTCON_GET_CONFIG(_dev, _feature, _field, _cfg)			\
+	if (virtio_with_feature(_dev, _feature)) {			\
+		virtio_read_device_config(_dev,				\
+		    offsetof(struct virtio_console_config, _field),	\
+		    &(_cfg)->_field, sizeof((_cfg)->_field));		\
+	}
+
+static void
+vtcon_read_config(struct vtcon_softc *sc, struct virtio_console_config *concfg)
+{
+	device_t dev;
+
+	dev = sc->vtcon_dev;
+
+	bzero(concfg, sizeof(struct virtio_console_config));
+
+	/* Read the configuration if the feature was negotiated. */
+	VTCON_GET_CONFIG(dev, VIRTIO_CONSOLE_F_SIZE, cols, concfg);
+	VTCON_GET_CONFIG(dev, VIRTIO_CONSOLE_F_SIZE, rows, concfg);
+	VTCON_GET_CONFIG(dev, VIRTIO_CONSOLE_F_MULTIPORT, max_nr_ports, concfg);
+}
+
+#undef VTCON_GET_CONFIG
+
+static int
+vtcon_alloc_virtqueues(struct vtcon_softc *sc)
+{
+	device_t dev;
+	struct vq_alloc_info *info;
+	struct vtcon_port_extra *portx;
+	int i, idx, portidx, nvqs, error;
+
+	dev = sc->vtcon_dev;
+
+	sc->vtcon_portsx = malloc(sizeof(struct vtcon_port_extra) *
+	    sc->vtcon_max_ports, M_DEVBUF, M_NOWAIT | M_ZERO);
+	if (sc->vtcon_portsx == NULL)
+		return (ENOMEM);
+
+	nvqs = sc->vtcon_max_ports * 2;
+	if (sc->vtcon_flags & VTCON_FLAG_MULTIPORT)
+		nvqs += 2;
+
+	info = malloc(sizeof(struct vq_alloc_info) * nvqs, M_TEMP, M_NOWAIT);
+	if (info == NULL)
+		return (ENOMEM);
+
+	for (i = 0, idx = 0, portidx = 0; i < nvqs / 2; i++, idx+=2) {
+
+		if (i == 1) {
+			/* The control virtqueues are after the first port. */
+			VQ_ALLOC_INFO_INIT(&info[idx], 0,
+			    vtcon_ctrl_rx_vq_intr, sc, &sc->vtcon_ctrl_rxvq,
+			    "%s-control rx", device_get_nameunit(dev));
+			VQ_ALLOC_INFO_INIT(&info[idx+1], 0,
+			    NULL, sc, &sc->vtcon_ctrl_txvq,
+			    "%s-control tx", device_get_nameunit(dev));
+			continue;
+		}
+
+		portx = &sc->vtcon_portsx[portidx];
+
+		VQ_ALLOC_INFO_INIT(&info[idx], 0, vtcon_port_in_vq_intr,
+		    portx, &portx->invq, "%s-port%d in",
+		    device_get_nameunit(dev), portidx);
+		VQ_ALLOC_INFO_INIT(&info[idx+1], 0, NULL,
+		    NULL, &portx->outvq, "%s-port%d out",
+		    device_get_nameunit(dev), portidx);
+
+		portidx++;
+	}
+
+	error = virtio_alloc_virtqueues(dev, 0, nvqs, info);
+	free(info, M_TEMP);
+
+	return (error);
+}
+
+static void
+vtcon_determine_max_ports(struct vtcon_softc *sc,
+    struct virtio_console_config *concfg)
+{
+
+	if (sc->vtcon_flags & VTCON_FLAG_MULTIPORT) {
+		sc->vtcon_max_ports =
+		    min(concfg->max_nr_ports, VTCON_MAX_PORTS);
+		if (sc->vtcon_max_ports == 0)
+			sc->vtcon_max_ports = 1;
+	} else
+		sc->vtcon_max_ports = 1;
+}
+
+static void
+vtcon_deinit_ports(struct vtcon_softc *sc)
+{
+	struct vtcon_port *port, *tmp;
+
+	TAILQ_FOREACH_SAFE(port, &sc->vtcon_ports, vtcport_next, tmp) {
+		vtcon_port_teardown(port, 1);
+	}
+
+	if (sc->vtcon_portsx != NULL) {
+		free(sc->vtcon_portsx, M_DEVBUF);
+		sc->vtcon_portsx = NULL;
+	}
+}
+
+static void
+vtcon_stop(struct vtcon_softc *sc)
+{
+
+	vtcon_disable_interrupts(sc);
+	virtio_stop(sc->vtcon_dev);
+}
+
+static void
+vtcon_ctrl_rx_vq_intr(void *xsc)
+{
+	struct vtcon_softc *sc;
+
+	sc = xsc;
+
+	/*
+	 * Some events require us to potentially block, but it easier
+	 * to just defer all event handling to a seperate thread.
+	 */
+	taskqueue_enqueue(taskqueue_thread, &sc->vtcon_ctrl_task);
+}
+
+static int
+vtcon_ctrl_enqueue_msg(struct vtcon_softc *sc,
+    struct virtio_console_control *control)
+{
+	struct sglist_seg segs[1];
+	struct sglist sg;
+	struct virtqueue *vq;
+	int error __unused;
+
+	vq = sc->vtcon_ctrl_rxvq;
+
+	sglist_init(&sg, 1, segs);
+	error = sglist_append(&sg, control, sizeof(*control));
+	KASSERT(error == 0 && sg.sg_nseg == 1,
+	    ("%s: error %d adding control msg to sglist", __func__, error));
+
+	return (virtqueue_enqueue(vq, control, &sg, 0, 1));
+}
+
+static int
+vtcon_ctrl_add_msg(struct vtcon_softc *sc)
+{
+	struct virtio_console_control *control;
+	int error;
+
+	control = malloc(sizeof(*control), M_DEVBUF, M_ZERO | M_NOWAIT);
+	if (control == NULL)
+		return (ENOMEM);
+
+	error = vtcon_ctrl_enqueue_msg(sc, control);
+	if (error)
+		free(control, M_DEVBUF);
+
+	return (error);
+}
+
+static void
+vtcon_ctrl_readd_msg(struct vtcon_softc *sc,
+    struct virtio_console_control *control)
+{
+	int error;
+
+	bzero(control, sizeof(*control));
+
+	error = vtcon_ctrl_enqueue_msg(sc, control);
+	KASSERT(error == 0,
+	    ("%s: cannot requeue control buffer %d", __func__, error));
+}
+
+static int
+vtcon_ctrl_populate(struct vtcon_softc *sc)
+{
+	struct virtqueue *vq;
+	int nbufs, error;
+
+	vq = sc->vtcon_ctrl_rxvq;
+	error = ENOSPC;
+
+	for (nbufs = 0; !virtqueue_full(vq); nbufs++) {
+		error = vtcon_ctrl_add_msg(sc);
+		if (error)
+			break;
+	}
+
+	if (nbufs > 0) {
+		virtqueue_notify(vq);
+		/*
+		 * EMSGSIZE signifies the virtqueue did not have enough
+		 * entries available to hold the last buf. This is not
+		 * an error.
+		 */
+		if (error == EMSGSIZE)
+			error = 0;
+	}
+
+	return (error);
+}
+
+static void
+vtcon_ctrl_send_msg(struct vtcon_softc *sc,
+    struct virtio_console_control *control)
+{
+	struct sglist_seg segs[1];
+	struct sglist sg;
+	struct virtqueue *vq;
+	int error;
+
+	vq = sc->vtcon_ctrl_txvq;
+	KASSERT(virtqueue_empty(vq),
+	    ("%s: virtqueue is not emtpy", __func__));
+
+	sglist_init(&sg, 1, segs);
+	error = sglist_append(&sg, control, sizeof(*control));
+	KASSERT(error == 0 && sg.sg_nseg == 1,
+	    ("%s: error %d adding control msg to sglist", __func__, error));
+
+	error = virtqueue_enqueue(vq, control, &sg, 1, 0);
+	if (error == 0) {
+		virtqueue_notify(vq);
+		virtqueue_poll(vq, NULL);
+	}
+}
+
+static void
+vtcon_ctrl_send_event(struct vtcon_softc *sc, uint32_t portid, uint16_t event,
+    uint16_t value)
+{
+	struct virtio_console_control control;
+
+	if ((sc->vtcon_flags & VTCON_FLAG_MULTIPORT) == 0)
+		return;
+
+	control.id = portid;
+	control.event = event;
+	control.value = value;
+
+	vtcon_ctrl_send_msg(sc, &control);
+}
+
+static int
+vtcon_ctrl_init(struct vtcon_softc *sc)
+{
+	int error;
+
+	error = vtcon_ctrl_populate(sc);
+
+	return (error);
+}
+
+static void
+vtcon_ctrl_drain(struct vtcon_softc *sc)
+{
+	struct virtio_console_control *control;
+	struct virtqueue *vq;
+	int last;
+
+	vq = sc->vtcon_ctrl_rxvq;
+	last = 0;
+
+	if (vq == NULL)
+		return;
+
+	while ((control = virtqueue_drain(vq, &last)) != NULL)
+		free(control, M_DEVBUF);
+}
+
+static void
+vtcon_ctrl_deinit(struct vtcon_softc *sc)
+{
+
+	vtcon_ctrl_drain(sc);
+}
+
+static void
+vtcon_ctrl_port_add_event(struct vtcon_softc *sc, int id)
+{
+	device_t dev;
+	struct vtcon_port *port;
+	int error;
+
+	dev = sc->vtcon_dev;
+
+	if (vtcon_port_lookup_by_id(sc, id) != NULL) {
+		device_printf(dev, "%s: adding port %d, but already exists\n",
+		    __func__, id);
+		return;
+	}
+
+	error = vtcon_port_create(sc, id, &port);
+	if (error) {
+		device_printf(dev, "%s: cannot create port %d: %d\n",
+		    __func__, id, error);
+		return;
+	}
+
+	vtcon_port_send_ctrl_msg(port, VIRTIO_CONSOLE_PORT_READY, 1);
+}
+
+static void
+vtcon_ctrl_port_remove_event(struct vtcon_softc *sc, int id)
+{
+	device_t dev;
+	struct vtcon_port *port;
+
+	dev = sc->vtcon_dev;
+
+	port = vtcon_port_lookup_by_id(sc, id);
+	if (port == NULL) {
+		device_printf(dev, "%s: remove port %d, but does not exist\n",
+		    __func__, id);
+		return;
+	}
+
+	vtcon_port_teardown(port, 1);
+}
+
+static void
+vtcon_ctrl_port_console_event(struct vtcon_softc *sc, int id)
+{
+	device_t dev;
+
+	dev = sc->vtcon_dev;
+
+	/*
+	 * BMV: I don't think we need to do anything.
+	 */
+	device_printf(dev, "%s: port %d console event\n", __func__, id);
+}
+
+static void
+vtcon_ctrl_port_open_event(struct vtcon_softc *sc, int id)
+{
+	device_t dev;
+	struct vtcon_port *port;
+
+	dev = sc->vtcon_dev;
+
+	port = vtcon_port_lookup_by_id(sc, id);
+	if (port == NULL) {
+		device_printf(dev, "%s: open port %d, but does not exist\n",
+		    __func__, id);
+		return;
+	}
+
+	vtcon_port_enable_intr(port);
+}
+
+static void
+vtcon_ctrl_process_msg(struct vtcon_softc *sc,
+    struct virtio_console_control *control)
+{
+	device_t dev;
+	int id;
+
+	dev = sc->vtcon_dev;
+	id = control->id;
+
+	if (id < 0 || id >= sc->vtcon_max_ports) {
+		device_printf(dev, "%s: invalid port ID %d\n", __func__, id);
+		return;
+	}
+
+	switch (control->event) {
+	case VIRTIO_CONSOLE_PORT_ADD:
+		vtcon_ctrl_port_add_event(sc, id);
+		break;
+
+	case VIRTIO_CONSOLE_PORT_REMOVE:
+		vtcon_ctrl_port_remove_event(sc, id);
+		break;
+
+	case VIRTIO_CONSOLE_CONSOLE_PORT:
+		vtcon_ctrl_port_console_event(sc, id);
+		break;
+
+	case VIRTIO_CONSOLE_RESIZE:
+		break;
+
+	case VIRTIO_CONSOLE_PORT_OPEN:
+		vtcon_ctrl_port_open_event(sc, id);
+		break;
+
+	case VIRTIO_CONSOLE_PORT_NAME:
+		break;
+	}
+}
+
+static void
+vtcon_ctrl_task_cb(void *xsc, int pending)
+{
+	struct vtcon_softc *sc;
+	struct virtqueue *vq;
+	struct virtio_console_control *control;
+
+	sc = xsc;
+	vq = sc->vtcon_ctrl_rxvq;
+
+	VTCON_LOCK(sc);
+	while ((sc->vtcon_flags & VTCON_FLAG_DETACHED) == 0) {
+		control = virtqueue_dequeue(vq, NULL);
+		if (control == NULL)
+			break;
+
+		VTCON_UNLOCK(sc);
+		vtcon_ctrl_process_msg(sc, control);
+		VTCON_LOCK(sc);
+		vtcon_ctrl_readd_msg(sc, control);
+	}
+	VTCON_UNLOCK(sc);
+
+	if (virtqueue_enable_intr(vq) != 0)
+		taskqueue_enqueue(taskqueue_thread, &sc->vtcon_ctrl_task);
+}
+
+static int
+vtcon_port_enqueue_inbuf(struct vtcon_port *port, void *buf, size_t len)
+{
+	struct sglist_seg segs[1];
+	struct sglist sg;
+	struct virtqueue *vq;
+	int error;
+
+	vq = port->vtcport_invq;
+
+	sglist_init(&sg, 1, segs);
+	error = sglist_append(&sg, buf, len);
+	KASSERT(error == 0 && sg.sg_nseg == 1,
+	    ("%s: error %d adding buffer to sglist", __func__, error));
+
+	return (virtqueue_enqueue(vq, buf, &sg, 0, 1));
+}
+
+static int
+vtcon_port_add_inbuf(struct vtcon_port *port)
+{
+	void *buf;
+	int error;
+
+	buf = malloc(VTCON_BULK_BUFSZ, M_DEVBUF, M_ZERO | M_NOWAIT);
+	if (buf == NULL)
+		return (ENOMEM);
+
+	error = vtcon_port_enqueue_inbuf(port, buf, VTCON_BULK_BUFSZ);
+	if (error)
+		free(buf, M_DEVBUF);
+
+	return (error);
+}
+
+static void
+vtcon_port_readd_inbuf(struct vtcon_port *port, void *buf)
+{
+	int error __unused;
+
+	error = vtcon_port_enqueue_inbuf(port, buf, VTCON_BULK_BUFSZ);
+	KASSERT(error == 0,
+	    ("%s: cannot requeue input buffer %d", __func__, error));
+}
+
+static int
+vtcon_port_populate(struct vtcon_port *port)
+{
+	struct virtqueue *vq;
+	int nbufs, error;
+
+	vq = port->vtcport_invq;
+	error = ENOSPC;
+
+	for (nbufs = 0; !virtqueue_full(vq); nbufs++) {
+		error = vtcon_port_add_inbuf(port);
+		if (error)
+			break;
+	}
+
+	if (nbufs > 0) {
+		virtqueue_notify(vq);
+		/*
+		 * EMSGSIZE signifies the virtqueue did not have enough
+		 * entries available to hold the last buf. This is not
+		 * an error.
+		 */
+		if (error == EMSGSIZE)
+			error = 0;
+	}
+
+	return (error);
+}
+

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 05:46:11 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id B83DADAA;
 Thu, 23 Oct 2014 05:46:11 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id A4B32C04;
 Thu, 23 Oct 2014 05:46:11 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N5kBJK020244;
 Thu, 23 Oct 2014 05:46:11 GMT (envelope-from ngie@FreeBSD.org)
Received: (from ngie@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N5kBDB020243;
 Thu, 23 Oct 2014 05:46:11 GMT (envelope-from ngie@FreeBSD.org)
Message-Id: <201410230546.s9N5kBDB020243@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org
 using -f
From: Garrett Cooper 
Date: Thu, 23 Oct 2014 05:46:11 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273516 - head/contrib/netbsd-tests/lib/libc/sys
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 05:46:11 -0000

Author: ngie
Date: Thu Oct 23 05:46:10 2014
New Revision: 273516
URL: https://svnweb.freebsd.org/changeset/base/273516

Log:
  Add netinet/in.h for struct sockaddr_in
  
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/contrib/netbsd-tests/lib/libc/sys/t_stat.c

Modified: head/contrib/netbsd-tests/lib/libc/sys/t_stat.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/sys/t_stat.c	Thu Oct 23 04:47:32 2014	(r273515)
+++ head/contrib/netbsd-tests/lib/libc/sys/t_stat.c	Thu Oct 23 05:46:10 2014	(r273516)
@@ -47,6 +47,10 @@ __RCSID("$NetBSD: t_stat.c,v 1.4 2012/03
 
 #include 
 
+#if defined(__FreeBSD__)
+#include 
+#endif
+
 static const char *path = "stat";
 
 ATF_TC_WITH_CLEANUP(stat_chflags);

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 05:58:03 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 2D02CEA;
 Thu, 23 Oct 2014 05:58:03 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 19E95CC9;
 Thu, 23 Oct 2014 05:58:03 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N5w2gt025123;
 Thu, 23 Oct 2014 05:58:02 GMT (envelope-from ngie@FreeBSD.org)
Received: (from ngie@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N5w2Ts025122;
 Thu, 23 Oct 2014 05:58:02 GMT (envelope-from ngie@FreeBSD.org)
Message-Id: <201410230558.s9N5w2Ts025122@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org
 using -f
From: Garrett Cooper 
Date: Thu, 23 Oct 2014 05:58:02 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273517 - head/contrib/netbsd-tests/lib/libc/sys
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 05:58:03 -0000

Author: ngie
Date: Thu Oct 23 05:58:02 2014
New Revision: 273517
URL: https://svnweb.freebsd.org/changeset/base/273517

Log:
  Expect getgroups_err to fail on FreeBSD
  
  PR: 189941
  Submitted by: pho
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/contrib/netbsd-tests/lib/libc/sys/t_getgroups.c

Modified: head/contrib/netbsd-tests/lib/libc/sys/t_getgroups.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/sys/t_getgroups.c	Thu Oct 23 05:46:10 2014	(r273516)
+++ head/contrib/netbsd-tests/lib/libc/sys/t_getgroups.c	Thu Oct 23 05:58:02 2014	(r273517)
@@ -57,6 +57,9 @@ ATF_TC_BODY(getgroups_err, tc)
 
 	errno = 0;
 
+#if defined(__FreeBSD__)
+	atf_tc_expect_fail("Reported as kern/189941");
+#endif
 	ATF_REQUIRE(getgroups(-1, gidset) == -1);
 	ATF_REQUIRE(errno == EINVAL);
 }

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 06:11:17 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 89FAD4F6;
 Thu, 23 Oct 2014 06:11:17 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 75ED6E79;
 Thu, 23 Oct 2014 06:11:17 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N6BHim031548;
 Thu, 23 Oct 2014 06:11:17 GMT (envelope-from edwin@FreeBSD.org)
Received: (from edwin@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N6BGkF031543;
 Thu, 23 Oct 2014 06:11:16 GMT (envelope-from edwin@FreeBSD.org)
Message-Id: <201410230611.s9N6BGkF031543@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: edwin set sender to
 edwin@FreeBSD.org using -f
From: Edwin Groothuis 
Date: Thu, 23 Oct 2014 06:11:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-vendor@freebsd.org
Subject: svn commit: r273518 - vendor/tzdata/dist
X-SVN-Group: vendor
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 06:11:17 -0000

Author: edwin
Date: Thu Oct 23 06:11:16 2014
New Revision: 273518
URL: https://svnweb.freebsd.org/changeset/base/273518

Log:
  Upgrade to 2014i
  
  Lots of historical data
  
  Pacific/Fiji will go into DST from 2014-11-02 to 2015-01-18
  Pacific/Bougainville will go from UTC+10 to UTC+11.
  Europe/Minsk will go from FET to MSK.
  
  Obtained from:	ftp://ftp.iana.org/tz/releases/

Modified:
  vendor/tzdata/dist/africa
  vendor/tzdata/dist/antarctica
  vendor/tzdata/dist/asia
  vendor/tzdata/dist/australasia
  vendor/tzdata/dist/backward
  vendor/tzdata/dist/europe
  vendor/tzdata/dist/northamerica
  vendor/tzdata/dist/southamerica
  vendor/tzdata/dist/zone.tab
  vendor/tzdata/dist/zone1970.tab

Modified: vendor/tzdata/dist/africa
==============================================================================
--- vendor/tzdata/dist/africa	Thu Oct 23 05:58:02 2014	(r273517)
+++ vendor/tzdata/dist/africa	Thu Oct 23 06:11:16 2014	(r273518)
@@ -1,9 +1,10 @@
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
-# This data is by no means authoritative; if you think you know better,
+# This file is by no means authoritative; if you think you know better,
 # go ahead and edit the file (and please send any changes to
-# tz@iana.org for general use in the future).
+# tz@iana.org for general use in the future).  For more, please see
+# the file CONTRIBUTING in the tz distribution.
 
 # From Paul Eggert (2013-02-21):
 #
@@ -25,8 +26,8 @@
 # I found in the UCLA library.
 #
 # For data circa 1899, a common source is:
-# Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94
-# .
+# Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94.
+# http://www.jstor.org/stable/1774359
 #
 # A reliable and entertaining source about time zones is
 # Derek Howse, Greenwich time and longitude, Philip Wilson Publishers (1997).
@@ -93,9 +94,9 @@ Rule	Algeria	1980	only	-	Oct	31	 2:00	0	
 # Shanks & Pottenger give 0:09:20 for Paris Mean Time; go with Howse's
 # more precise 0:09:21.
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Algiers	0:12:12 -	LMT	1891 Mar 15 0:01
-			0:09:21	-	PMT	1911 Mar 11    # Paris Mean Time
-			0:00	Algeria	WE%sT	1940 Feb 25 2:00
+Zone	Africa/Algiers	0:12:12 -	LMT	1891 Mar 15  0:01
+			0:09:21	-	PMT	1911 Mar 11 # Paris Mean Time
+			0:00	Algeria	WE%sT	1940 Feb 25  2:00
 			1:00	Algeria	CE%sT	1946 Oct  7
 			0:00	-	WET	1956 Jan 29
 			1:00	-	CET	1963 Apr 14
@@ -105,82 +106,57 @@ Zone	Africa/Algiers	0:12:12 -	LMT	1891 M
 			1:00	-	CET
 
 # Angola
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Luanda	0:52:56	-	LMT	1892
-			0:52:04	-	AOT	1911 May 26 # Angola Time
-			1:00	-	WAT
-
 # Benin
-# Whitman says they switched to 1:00 in 1946, not 1934;
-# go with Shanks & Pottenger.
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Africa/Porto-Novo	0:10:28	-	LMT	1912
-			0:00	-	GMT	1934 Feb 26
-			1:00	-	WAT
+# See Africa/Lagos.
 
 # Botswana
-# From Paul Eggert (2013-02-21):
-# Milne says they were regulated by the Cape Town Signal in 1899;
-# assume they switched to 2:00 when Cape Town did.
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Gaborone	1:43:40 -	LMT	1885
-			1:30	-	SAST	1903 Mar
-			2:00	-	CAT	1943 Sep 19 2:00
-			2:00	1:00	CAST	1944 Mar 19 2:00
-			2:00	-	CAT
+# See Africa/Maputo.
 
 # Burkina Faso
 # See Africa/Abidjan.
 
 # Burundi
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Africa/Bujumbura	1:57:28	-	LMT	1890
-			2:00	-	CAT
+# See Africa/Maputo.
 
 # Cameroon
-# Whitman says they switched to 1:00 in 1920; go with Shanks & Pottenger.
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Douala	0:38:48	-	LMT	1912
-			1:00	-	WAT
+# See Africa/Lagos.
 
 # Cape Verde
+#
+# Shanks gives 1907 for the transition to CVT.
+# Perhaps the 1911-05-26 Portuguese decree
+# http://dre.pt/pdf1sdip/1911/05/12500/23132313.pdf
+# merely made it official?
+#
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Atlantic/Cape_Verde -1:34:04 -	LMT	1907			# Praia
+Zone Atlantic/Cape_Verde -1:34:04 -	LMT	1907        # Praia
 			-2:00	-	CVT	1942 Sep
 			-2:00	1:00	CVST	1945 Oct 15
-			-2:00	-	CVT	1975 Nov 25 2:00
+			-2:00	-	CVT	1975 Nov 25  2:00
 			-1:00	-	CVT
 
 # Central African Republic
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Bangui	1:14:20	-	LMT	1912
-			1:00	-	WAT
+# See Africa/Lagos.
 
 # Chad
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Ndjamena	1:00:12 -	LMT	1912 # N'Djamena
+Zone	Africa/Ndjamena	1:00:12 -	LMT	1912        # N'Djamena
 			1:00	-	WAT	1979 Oct 14
 			1:00	1:00	WAST	1980 Mar  8
 			1:00	-	WAT
 
 # Comoros
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Indian/Comoro	2:53:04 -	LMT	1911 Jul   # Moroni, Gran Comoro
+Zone	Indian/Comoro	2:53:04 -	LMT	1911 Jul # Moroni, Gran Comoro
 			3:00	-	EAT
 
-# Democratic Republic of Congo
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Africa/Kinshasa	1:01:12 -	LMT	1897 Nov 9
-			1:00	-	WAT
-Zone Africa/Lubumbashi	1:49:52 -	LMT	1897 Nov 9
-			2:00	-	CAT
+# Democratic Republic of the Congo
+# See Africa/Lagos for the western part and Africa/Maputo for the eastern.
 
 # Republic of the Congo
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Africa/Brazzaville	1:01:08 -	LMT	1912
-			1:00	-	WAT
+# See Africa/Lagos.
 
-# Côte D'Ivoire / Ivory Coast
+# Côte d'Ivoire / Ivory Coast
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Africa/Abidjan	-0:16:08 -	LMT	1912
 			 0:00	-	GMT
@@ -327,7 +303,7 @@ Rule	Egypt	2007	only	-	Sep	Thu>=1	24:00	
 # Egypt is to change back to Daylight system on May 15
 # http://english.ahram.org.eg/NewsContent/1/64/100735/Egypt/Politics-/Egypts-government-to-reapply-daylight-saving-time-.aspx
 
-# From Gunther Vermier (2015-05-13):
+# From Gunther Vermier (2014-05-13):
 # our Egypt office confirms that the change will be at 15 May "midnight" (24:00)
 
 # From Imed Chihi (2014-06-04):
@@ -408,16 +384,13 @@ Zone	Africa/Cairo	2:05:09 -	LMT	1900 Oct
 			2:00	Egypt	EE%sT
 
 # Equatorial Guinea
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Malabo	0:35:08 -	LMT	1912
-			0:00	-	GMT	1963 Dec 15
-			1:00	-	WAT
+# See Africa/Lagos.
 
 # Eritrea
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Africa/Asmara	2:35:32 -	LMT	1870
-			2:35:32	-	AMT	1890	      # Asmara Mean Time
-			2:35:20	-	ADMT	1936 May 5    # Adis Dera MT
+			2:35:32	-	AMT	1890        # Asmara Mean Time
+			2:35:20	-	ADMT	1936 May  5 # Adis Dera MT
 			3:00	-	EAT
 
 # Ethiopia
@@ -429,16 +402,15 @@ Zone	Africa/Asmara	2:35:32 -	LMT	1870
 # Shanks & Pottenger write that Ethiopia had six narrowly-spaced time
 # zones between 1870 and 1890, that they merged to 38E50 (2:35:20) in
 # 1890, and that they switched to 3:00 on 1936-05-05.  Perhaps 38E50
-# was for Adis Dera.  Quite likely the Shanks data are wrong anyway.
+# was for Adis Dera.  Quite likely the Shanks data entries are wrong
+# anyway.
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Africa/Addis_Ababa	2:34:48 -	LMT	1870
-			2:35:20	-	ADMT	1936 May 5    # Adis Dera MT
+			2:35:20	-	ADMT	1936 May  5 # Adis Dera MT
 			3:00	-	EAT
 
 # Gabon
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Africa/Libreville	0:37:48 -	LMT	1912
-			1:00	-	WAT
+# See Africa/Lagos.
 
 # Gambia
 # See Africa/Abidjan.
@@ -461,8 +433,14 @@ Zone	Africa/Accra	-0:00:52 -	LMT	1918
 # See Africa/Abidjan.
 
 # Guinea-Bissau
+#
+# Shanks gives 1911-05-26 for the transition to WAT,
+# evidently confusing the date of the Portuguese decree
+# http://dre.pt/pdf1sdip/1911/05/12500/23132313.pdf
+# with the date that it took effect, namely 1912-01-01.
+#
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Bissau	-1:02:20 -	LMT	1911 May 26
+Zone	Africa/Bissau	-1:02:20 -	LMT	1912 Jan  1
 			-1:00	-	WAT	1975
 			 0:00	-	GMT
 
@@ -475,11 +453,7 @@ Zone	Africa/Nairobi	2:27:16	-	LMT	1928 J
 			3:00	-	EAT
 
 # Lesotho
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Maseru	1:50:00 -	LMT	1903 Mar
-			2:00	-	SAST	1943 Sep 19 2:00
-			2:00	1:00	SAST	1944 Mar 19 2:00
-			2:00	-	SAST
+# See Africa/Johannesburg.
 
 # Liberia
 # From Paul Eggert (2006-03-22):
@@ -546,11 +520,11 @@ Zone	Africa/Tripoli	0:52:44 -	LMT	1920
 			2:00	-	EET	1982
 			1:00	Libya	CE%sT	1990 May  4
 # The 1996 and 1997 entries are from Shanks & Pottenger;
-# the IATA SSIM data contain some obvious errors.
+# the IATA SSIM data entries contain some obvious errors.
 			2:00	-	EET	1996 Sep 30
 			1:00	Libya	CE%sT	1997 Oct  4
-			2:00	-	EET	2012 Nov 10 2:00
-			1:00	Libya	CE%sT	2013 Oct 25 2:00
+			2:00	-	EET	2012 Nov 10  2:00
+			1:00	Libya	CE%sT	2013 Oct 25  2:00
 			2:00	-	EET
 
 # Madagascar
@@ -561,9 +535,7 @@ Zone Indian/Antananarivo 3:10:04 -	LMT	1
 			3:00	-	EAT
 
 # Malawi
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Blantyre	2:20:00 -	LMT	1903 Mar
-			2:00	-	CAT
+# See Africa/Maputo.
 
 # Mali
 # Mauritania
@@ -606,7 +578,7 @@ Zone	Africa/Blantyre	2:20:00 -	LMT	1903 
 
 # From Alex Krivenyshev (2008-07-11):
 # Seems that English language article "The revival of daylight saving
-# time:  Energy conservation?"-# No. 16578 (07/11/2008) was originally
+# time: Energy conservation?"-# No. 16578 (07/11/2008) was originally
 # published on Monday, June 30, 2008...
 #
 # I guess that article in French "Le gouvernement avance l'introduction
@@ -657,14 +629,14 @@ Rule Mauritius	1983	only	-	Mar	21	0:00	0
 Rule Mauritius	2008	only	-	Oct	lastSun	2:00	1:00	S
 Rule Mauritius	2009	only	-	Mar	lastSun	2:00	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Indian/Mauritius	3:50:00 -	LMT	1907		# Port Louis
+Zone Indian/Mauritius	3:50:00 -	LMT	1907 # Port Louis
 			4:00 Mauritius	MU%sT	# Mauritius Time
 # Agalega Is, Rodriguez
 # no information; probably like Indian/Mauritius
 
 # Mayotte
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Indian/Mayotte	3:00:56 -	LMT	1911 Jul	# Mamoutzou
+Zone	Indian/Mayotte	3:00:56 -	LMT	1911 Jul # Mamoutzou
 			3:00	-	EAT
 
 # Morocco
@@ -682,7 +654,8 @@ Zone	Indian/Mayotte	3:00:56 -	LMT	1911 J
 # http://en.afrik.com/news11892.html
 
 # From Alex Krivenyshev (2008-05-09):
-# The Morocco time change can be confirmed on Morocco web site Maghreb Arabe Presse:
+# The Morocco time change can be confirmed on Morocco web site Maghreb Arabe
+# Presse:
 # http://www.map.ma/eng/sections/box3/morocco_shifts_to_da/view
 #
 # Morocco shifts to daylight time on June 1st through September 27, Govt.
@@ -760,8 +733,8 @@ Zone	Indian/Mayotte	3:00:56 -	LMT	1911 J
 
 # From Dan Abitol (2011-03-30):
 # ...Rules for Africa/Casablanca are the following (24h format)
-# The 3rd april 2011 at 00:00:00, [it] will be 3rd april 1:00:00
-# The 31th july 2011 at 00:59:59,  [it] will be 31th July 00:00:00
+# The 3rd April 2011 at 00:00:00, [it] will be 3rd April 01:00:00
+# The 31st July 2011 at 00:59:59, [it] will be 31st July 00:00:00
 # ...Official links of change in morocco
 # The change was broadcast on the FM Radio
 # I ve called ANRT (telecom regulations in Morocco) at
@@ -831,7 +804,7 @@ Zone	Indian/Mayotte	3:00:56 -	LMT	1911 J
 # announced a bit in advance.  On 2012-07-11 the Moroccan government
 # announced that year's Ramadan daylight-saving transitions would be
 # 2012-07-20 and 2012-08-20; see
-# .
+# http://www.mmsp.gov.ma/fr/actualites.aspx?id=288
 
 # From Andrew Paprocki (2013-07-02):
 # Morocco announced that the year's Ramadan daylight-savings
@@ -963,16 +936,29 @@ Zone Africa/El_Aaiun	-0:52:48 -	LMT	1934
 			 0:00	Morocco	WE%sT
 
 # Mozambique
+#
+# Shanks gives 1903-03-01 for the transition to CAT.
+# Perhaps the 1911-05-26 Portuguese decree
+# http://dre.pt/pdf1sdip/1911/05/12500/23132313.pdf
+# merely made it official?
+#
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Africa/Maputo	2:10:20 -	LMT	1903 Mar
 			2:00	-	CAT
+Link Africa/Maputo Africa/Blantyre	# Malawi
+Link Africa/Maputo Africa/Bujumbura	# Burundi
+Link Africa/Maputo Africa/Gaborone	# Botswana
+Link Africa/Maputo Africa/Harare	# Zimbabwe
+Link Africa/Maputo Africa/Kigali	# Rwanda
+Link Africa/Maputo Africa/Lubumbashi	# E Dem. Rep. of Congo
+Link Africa/Maputo Africa/Lusaka	# Zambia
 
 # Namibia
 # The 1994-04-03 transition is from Shanks & Pottenger.
 # Shanks & Pottenger report no DST after 1998-04; go with IATA.
 
-# From Petronella Sibeene (2007-03-30) in
-# :
+# From Petronella Sibeene (2007-03-30):
+# http://allafrica.com/stories/200703300178.html
 # While the entire country changes its time, Katima Mulilo and other
 # settlements in Caprivi unofficially will not because the sun there
 # rises and sets earlier compared to other regions.  Chief of
@@ -989,28 +975,33 @@ Rule	Namibia	1994	max	-	Sep	Sun>=1	2:00	
 Rule	Namibia	1995	max	-	Apr	Sun>=1	2:00	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Africa/Windhoek	1:08:24 -	LMT	1892 Feb 8
-			1:30	-	SWAT	1903 Mar	# SW Africa Time
-			2:00	-	SAST	1942 Sep 20 2:00
-			2:00	1:00	SAST	1943 Mar 21 2:00
+			1:30	-	SWAT	1903 Mar    # SW Africa Time
+			2:00	-	SAST	1942 Sep 20  2:00
+			2:00	1:00	SAST	1943 Mar 21  2:00
 			2:00	-	SAST	1990 Mar 21 # independence
 			2:00	-	CAT	1994 Apr  3
 			1:00	Namibia	WA%sT
 
 # Niger
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Niamey	 0:08:28 -	LMT	1912
-			-1:00	-	WAT	1934 Feb 26
-			 0:00	-	GMT	1960
-			 1:00	-	WAT
+# See Africa/Lagos.
 
 # Nigeria
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Africa/Lagos	0:13:36 -	LMT	1919 Sep
 			1:00	-	WAT
+Link Africa/Lagos Africa/Bangui	     # Central African Republic
+Link Africa/Lagos Africa/Brazzaville # Rep. of the Congo
+Link Africa/Lagos Africa/Douala	     # Cameroon
+Link Africa/Lagos Africa/Kinshasa    # Dem. Rep. of the Congo (west)
+Link Africa/Lagos Africa/Libreville  # Gabon
+Link Africa/Lagos Africa/Luanda	     # Angola
+Link Africa/Lagos Africa/Malabo	     # Equatorial Guinea
+Link Africa/Lagos Africa/Niamey	     # Niger
+Link Africa/Lagos Africa/Porto-Novo  # Benin
 
 # Réunion
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Indian/Reunion	3:41:52 -	LMT	1911 Jun	# Saint-Denis
+Zone	Indian/Reunion	3:41:52 -	LMT	1911 Jun # Saint-Denis
 			4:00	-	RET	# Réunion Time
 #
 # Crozet Islands also observes Réunion time; see the 'antarctica' file.
@@ -1028,9 +1019,7 @@ Zone	Indian/Reunion	3:41:52 -	LMT	1911 J
 # Tromelin - inhabited until at least 1958
 
 # Rwanda
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Kigali	2:00:16 -	LMT	1935 Jun
-			2:00	-	CAT
+# See Africa/Maputo.
 
 # St Helena
 # See Africa/Abidjan.
@@ -1047,7 +1036,7 @@ Zone	Africa/Kigali	2:00:16 -	LMT	1935 Ju
 
 # Seychelles
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Indian/Mahe	3:41:48 -	LMT	1906 Jun	# Victoria
+Zone	Indian/Mahe	3:41:48 -	LMT	1906 Jun # Victoria
 			4:00	-	SCT	# Seychelles Time
 # From Paul Eggert (2001-05-30):
 # Aldabra, Farquhar, and Desroches, originally dependencies of the
@@ -1074,6 +1063,9 @@ Rule	SA	1943	1944	-	Mar	Sun>=15	2:00	0	-
 Zone Africa/Johannesburg 1:52:00 -	LMT	1892 Feb 8
 			1:30	-	SAST	1903 Mar
 			2:00	SA	SAST
+Link Africa/Johannesburg Africa/Maseru	   # Lesotho
+Link Africa/Johannesburg Africa/Mbabane    # Swaziland
+#
 # Marion and Prince Edward Is
 # scientific station since 1947
 # no information
@@ -1101,9 +1093,7 @@ Zone	Africa/Khartoum	2:10:08 -	LMT	1931
 Link Africa/Khartoum Africa/Juba
 
 # Swaziland
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Mbabane	2:04:24 -	LMT	1903 Mar
-			2:00	-	SAST
+# See Africa/Johannesburg.
 
 # Tanzania
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -1128,7 +1118,7 @@ Zone Africa/Dar_es_Salaam 2:37:08 -	LMT	
 #
 # From Oscar van Vlijmen (2005-05-02):
 # La Presse, the first national daily newspaper ...
-# 
+# http://www.lapresse.tn/archives/archives280405/actualites/lheure.html
 # ... DST for 2005: on: Sun May 1 0h standard time, off: Fri Sept. 30,
 # 1h standard time.
 #
@@ -1212,7 +1202,7 @@ Rule	Tunisia	2006	2008	-	Oct	lastSun	 2:
 # Shanks & Pottenger say the 1911 switch was on Mar 9; go with Howse's Mar 11.
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Africa/Tunis	0:40:44 -	LMT	1881 May 12
-			0:09:21	-	PMT	1911 Mar 11    # Paris Mean Time
+			0:09:21	-	PMT	1911 Mar 11 # Paris Mean Time
 			1:00	Tunisia	CE%sT
 
 # Uganda
@@ -1224,11 +1214,5 @@ Zone	Africa/Kampala	2:09:40 -	LMT	1928 J
 			3:00	-	EAT
 
 # Zambia
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Lusaka	1:53:08 -	LMT	1903 Mar
-			2:00	-	CAT
-
 # Zimbabwe
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Harare	2:04:12 -	LMT	1903 Mar
-			2:00	-	CAT
+# See Africa/Maputo.

Modified: vendor/tzdata/dist/antarctica
==============================================================================
--- vendor/tzdata/dist/antarctica	Thu Oct 23 05:58:02 2014	(r273517)
+++ vendor/tzdata/dist/antarctica	Thu Oct 23 06:11:16 2014	(r273518)
@@ -4,10 +4,10 @@
 # From Paul Eggert (1999-11-15):
 # To keep things manageable, we list only locations occupied year-round; see
 # COMNAP - Stations and Bases
-# 
+# http://www.comnap.aq/comnap/comnap.nsf/P/Stations/
 # and
 # Summary of the Peri-Antarctic Islands (1998-07-23)
-# 
+# http://www.spri.cam.ac.uk/bob/periant.htm
 # for information.
 # Unless otherwise specified, we have no time zone information.
 #
@@ -63,7 +63,7 @@ Rule	ChileAQ	2012	max	-	Sep	Sun>=2	4:00u
 # Heard Island, McDonald Islands (uninhabited)
 #	previously sealers and scientific personnel wintered
 #	Margaret Turner reports
-#	
+#	http://web.archive.org/web/20021204222245/http://www.dstc.qut.edu.au/DST/marg/daylight.html
 #	(1999-09-30) that they're UTC+5, with no DST;
 #	presumably this is when they have visitors.
 #
@@ -103,32 +103,30 @@ Rule	ChileAQ	2012	max	-	Sep	Sun>=2	4:00u
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Antarctica/Casey	0	-	zzz	1969
-			8:00	-	AWST	2009 Oct 18 2:00
+			8:00	-	AWST	2009 Oct 18  2:00
 						# Australian Western Std Time
-			11:00	-	CAST	2010 Mar 5 2:00
-						# Casey Time
-			8:00	-	AWST	2011 Oct 28 2:00
+			11:00	-	CAST	2010 Mar  5  2:00  # Casey Time
+			8:00	-	AWST	2011 Oct 28  2:00
 			11:00	-	CAST	2012 Feb 21 17:00u
 			8:00	-	AWST
 Zone Antarctica/Davis	0	-	zzz	1957 Jan 13
-			7:00	-	DAVT	1964 Nov # Davis Time
+			7:00	-	DAVT	1964 Nov    # Davis Time
 			0	-	zzz	1969 Feb
-			7:00	-	DAVT	2009 Oct 18 2:00
+			7:00	-	DAVT	2009 Oct 18  2:00
 			5:00	-	DAVT	2010 Mar 10 20:00u
-			7:00	-	DAVT	2011 Oct 28 2:00
+			7:00	-	DAVT	2011 Oct 28  2:00
 			5:00	-	DAVT	2012 Feb 21 20:00u
 			7:00	-	DAVT
 Zone Antarctica/Mawson	0	-	zzz	1954 Feb 13
-			6:00	-	MAWT	2009 Oct 18 2:00
-						# Mawson Time
+			6:00	-	MAWT	2009 Oct 18  2:00 # Mawson Time
 			5:00	-	MAWT
 # References:
 # Casey Weather (1998-02-26)
-# 
+# http://www.antdiv.gov.au/aad/exop/sfo/casey/casey_aws.html
 # Davis Station, Antarctica (1998-02-26)
-# 
+# http://www.antdiv.gov.au/aad/exop/sfo/davis/video.html
 # Mawson Station, Antarctica (1998-02-25)
-# 
+# http://www.antdiv.gov.au/aad/exop/sfo/mawson/video.html
 
 # Belgium - year-round base
 # Princess Elisabeth, Queen Maud Land, -713412+0231200, since 2007
@@ -154,7 +152,7 @@ Zone Antarctica/Mawson	0	-	zzz	1954 Feb 
 # France - year-round bases (also see "France & Italy")
 #
 # From Antoine Leca (1997-01-20):
-# Time data are from Nicole Pailleau at the IFRTP
+# Time data entries are from Nicole Pailleau at the IFRTP
 # (French Institute for Polar Research and Technology).
 # She confirms that French Southern Territories and Terre Adélie bases
 # don't observe daylight saving time, even if Terre Adélie supplies came
@@ -174,7 +172,7 @@ Zone Antarctica/Mawson	0	-	zzz	1954 Feb 
 #	fishing stations operated variously 1819/1931
 #
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Indian/Kerguelen	0	-	zzz	1950	# Port-aux-Français
+Zone Indian/Kerguelen	0	-	zzz	1950 # Port-aux-Français
 			5:00	-	TFT	# ISO code TF Time
 #
 # year-round base in the main continent
@@ -217,7 +215,7 @@ Zone Antarctica/Syowa	0	-	zzz	1957 Jan 2
 			3:00	-	SYOT	# Syowa Time
 # See:
 # NIPR Antarctic Research Activities (1999-08-17)
-# 
+# http://www.nipr.ac.jp/english/ara01.html
 
 # S Korea - year-round base
 # Jang Bogo, Terra Nova Bay, -743700+1641205 since 2014
@@ -264,7 +262,7 @@ Rule	Troll	2005	max	-	Mar	lastSun	1:00u	
 Rule	Troll	2004	max	-	Oct	lastSun	1:00u	0:00	UTC
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Antarctica/Troll	0	-	zzz	2005 Feb 12
-     			0:00	Troll	%s
+			0:00	Troll	%s
 
 # Poland - year-round base
 # Arctowski, King George Island, -620945-0582745, since 1977
@@ -281,8 +279,8 @@ Zone Antarctica/Troll	0	-	zzz	2005 Feb 1
 #	year-round from 1960/61 to 1992
 
 # Vostok, since 1957-12-16, temporarily closed 1994-02/1994-11
-# From Craig Mundell (1994-12-15)
-# :
+# From Craig Mundell (1994-12-15):
+# http://quest.arc.nasa.gov/antarctica/QA/computers/Directions,Time,ZIP
 # Vostok, which is one of the Russian stations, is set on the same
 # time as Moscow, Russia.
 #

Modified: vendor/tzdata/dist/asia
==============================================================================
--- vendor/tzdata/dist/asia	Thu Oct 23 05:58:02 2014	(r273517)
+++ vendor/tzdata/dist/asia	Thu Oct 23 06:11:16 2014	(r273518)
@@ -1,9 +1,10 @@
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
-# This data is by no means authoritative; if you think you know better,
+# This file is by no means authoritative; if you think you know better,
 # go ahead and edit the file (and please send any changes to
-# tz@iana.org for general use in the future).
+# tz@iana.org for general use in the future).  For more, please see
+# the file CONTRIBUTING in the tz distribution.
 
 # From Paul Eggert (2013-08-11):
 #
@@ -25,8 +26,12 @@
 # I found in the UCLA library.
 #
 # For data circa 1899, a common source is:
-# Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94
-# .
+# Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94.
+# http://www.jstor.org/stable/1774359
+#
+# For Russian data circa 1919, a source is:
+# Byalokoz EL. New Counting of Time in Russia since July 1, 1919.
+# (See the 'europe' file for a fuller citation.)
 #
 # A reliable and entertaining source about time zones is
 # Derek Howse, Greenwich time and longitude, Philip Wilson Publishers (1997).
@@ -42,10 +47,11 @@
 #	3:30 IRST IRDT	Iran
 #	4:00 GST	Gulf*
 #	5:30 IST	India
-#	7:00 ICT	Indochina*
+#	7:00 ICT	Indochina, most times and locations*
 #	7:00 WIB	west Indonesia (Waktu Indonesia Barat)
 #	8:00 WITA	central Indonesia (Waktu Indonesia Tengah)
 #	8:00 CST	China
+#	8:00 IDT	Indochina, 1943-45, 1947-55, 1960-75 (some locations)*
 #	8:00 JWST	Western Standard Time (Japan, 1896/1937)*
 #	9:00 JCST	Central Standard Time (Japan, 1896/1937)
 #	9:00 WIT	east Indonesia (Waktu Indonesia Timur)
@@ -115,11 +121,11 @@ Zone	Asia/Kabul	4:36:48 -	LMT	1890
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Yerevan	2:58:00 -	LMT	1924 May  2
 			3:00	-	YERT	1957 Mar    # Yerevan Time
-			4:00 RussiaAsia YER%sT	1991 Mar 31 2:00s
+			4:00 RussiaAsia YER%sT	1991 Mar 31  2:00s
 			3:00	1:00	YERST	1991 Sep 23 # independence
-			3:00 RussiaAsia	AM%sT	1995 Sep 24 2:00s
+			3:00 RussiaAsia	AM%sT	1995 Sep 24  2:00s
 			4:00	-	AMT	1997
-			4:00 RussiaAsia	AM%sT	2012 Mar 25 2:00s
+			4:00 RussiaAsia	AM%sT	2012 Mar 25  2:00s
 			4:00	-	AMT
 
 # Azerbaijan
@@ -132,16 +138,16 @@ Rule	Azer	1997	max	-	Oct	lastSun	 5:00	0
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Baku	3:19:24 -	LMT	1924 May  2
 			3:00	-	BAKT	1957 Mar    # Baku Time
-			4:00 RussiaAsia BAK%sT	1991 Mar 31 2:00s
+			4:00 RussiaAsia BAK%sT	1991 Mar 31  2:00s
 			3:00	1:00	BAKST	1991 Aug 30 # independence
 			3:00 RussiaAsia	AZ%sT	1992 Sep lastSat 23:00
-			4:00	-	AZT	1996 # Azerbaijan time
+			4:00	-	AZT	1996     # Azerbaijan Time
 			4:00	EUAsia	AZ%sT	1997
 			4:00	Azer	AZ%sT
 
 # Bahrain
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Asia/Bahrain	3:22:20 -	LMT	1920		# Manamah
+Zone	Asia/Bahrain	3:22:20 -	LMT	1920     # Manamah
 			4:00	-	GST	1972 Jun
 			3:00	-	AST
 
@@ -219,7 +225,7 @@ Zone	Asia/Bahrain	3:22:20 -	LMT	1920		# 
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Dhaka	2009	only	-	Jun	19	23:00	1:00	S
-Rule	Dhaka	2009	only	-	Dec	31	23:59	0	-
+Rule	Dhaka	2009	only	-	Dec	31	24:00	0	-
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Dhaka	6:01:40 -	LMT	1890
@@ -250,7 +256,7 @@ Zone	Indian/Chagos	4:49:40	-	LMT	1907
 
 # Brunei
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Asia/Brunei	7:39:40 -	LMT	1926 Mar   # Bandar Seri Begawan
+Zone	Asia/Brunei	7:39:40 -	LMT	1926 Mar # Bandar Seri Begawan
 			7:30	-	BNT	1933
 			8:00	-	BNT
 
@@ -259,19 +265,15 @@ Zone	Asia/Brunei	7:39:40 -	LMT	1926 Mar 
 # Milne says 6:24:40 was the meridian of the time ball observatory at Rangoon.
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Asia/Rangoon	6:24:40 -	LMT	1880		# or Yangon
-			6:24:40	-	RMT	1920	   # Rangoon Mean Time?
-			6:30	-	BURT	1942 May   # Burma Time
-			9:00	-	JST	1945 May 3
-			6:30	-	MMT		   # Myanmar Time
+Zone	Asia/Rangoon	6:24:40 -	LMT	1880        # or Yangon
+			6:24:40	-	RMT	1920        # Rangoon Mean Time?
+			6:30	-	BURT	1942 May    # Burma Time
+			9:00	-	JST	1945 May  3
+			6:30	-	MMT	# Myanmar Time
 
 # Cambodia
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Asia/Phnom_Penh	6:59:40 -	LMT	1906 Jun  9
-			7:06:20	-	SMT	1911 Mar 11 0:01 # Saigon MT?
-			7:00	-	ICT	1912 May
-			8:00	-	ICT	1931 May
-			7:00	-	ICT
+# See Asia/Bangkok.
+
 
 # China
 
@@ -356,8 +358,8 @@ Rule	PRC	1987	1991	-	Apr	Sun>=10	0:00	1:
 #   * The Republic of China instituted Beijing mean solar time effective
 #     the official calendar book of 1914.
 #   * The French Concession in Shanghai set up signal stations in
-#     French docks in the 1890s, controled by Xujiahui (Zikawei)
-#     Obervatory and set to local mean time.
+#     French docks in the 1890s, controlled by Xujiahui (Zikawei)
+#     Observatory and set to local mean time.
 #   * "From the end of the 19th century" it changed to UT+8.
 #   * Chinese Customs (by then reduced to a tool of foreign powers)
 #     eventually standardized on this time for all ports, and it
@@ -381,7 +383,7 @@ Rule	PRC	1987	1991	-	Apr	Sun>=10	0:00	1:
 # Xujiahui Observatory was under French control and stuck with UT+8.
 #
 # In earlier versions of this file, China had many separate Zone entries, but
-# this was based on what was apparently incorrect data in Shanks & Pottenger.
+# this was based on what were apparently incorrect data in Shanks & Pottenger.
 # This has now been simplified to the two entries Asia/Shanghai and
 # Asia/Urumqi, with the others being links for backward compatibility.
 # Proposed in 1918 and theoretically in effect until 1949 (although in practice
@@ -501,7 +503,7 @@ Rule	PRC	1987	1991	-	Apr	Sun>=10	0:00	1:
 # "The Working-Calendar for The Xinjiang Uygur Autonomous Region Government"
 #  (2014-04-22).
 # Unfortunately, we have no good records of time in Xinjiang before 1986.
-# During the 20th century parts of Xinjiang were ruled by the Qing dyansty,
+# During the 20th century parts of Xinjiang were ruled by the Qing dynasty,
 # the Republic of China, various warlords, the First and Second East Turkestan
 # Republics, the Soviet Union, the Kuomintang, and the People's Republic of
 # China, and tracking down all these organizations' timekeeping rules would be
@@ -698,19 +700,19 @@ Zone	Asia/Hong_Kong	7:36:42 -	LMT	1904 O
 # Central Weather Bureau website was not correct.
 #
 # Original Bulletin:
-# 
-#  (cont.)
+# http://subtpg.tpg.gov.tw/og/image2.asp?f=03502F0AKM1AF
+# http://subtpg.tpg.gov.tw/og/image2.asp?f=0350300AKM1B0 (cont.)
 #
 # In 1947, DST in Taiwan was expanded to Oct 31. There is a backup of that
 # telegram announcement from Taiwan Province Government:
 #
-# 
+# http://subtpg.tpg.gov.tw/og/image2.asp?f=0360310AKZ431
 #
 # Here is a brief translation:
 #
 #   The Summer Time this year is adopted from midnight Apr 15 until Sep 20
 #   midnight. To save (energy?) consumption, we're expanding Summer Time
-#   adption till Oct 31 midnight.
+#   adoption till Oct 31 midnight.
 #
 # The Central Weather Bureau website didn't mention that, however it can
 # be found from historical government announcement database.
@@ -741,7 +743,7 @@ Rule	Taiwan	1979	only	-	Oct	1	0:00	0	S
 # Taipei or Taibei or T'ai-pei
 Zone	Asia/Taipei	8:06:00 -	LMT	1896 Jan  1
 			8:00	-	JWST	1937 Oct  1
-			9:00	-	JST	1945 Sep 21 01:00
+			9:00	-	JST	1945 Sep 21  1:00
 			8:00	Taiwan	C%sT
 
 # Macau (Macao, Aomen)
@@ -761,7 +763,7 @@ Rule	Macau	1975	1977	-	Apr	Sun>=15	3:30	
 Rule	Macau	1978	1980	-	Apr	Sun>=15	0:00	1:00	S
 Rule	Macau	1978	1980	-	Oct	Sun>=15	0:00	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Asia/Macau	7:34:20 -	LMT	1912
+Zone	Asia/Macau	7:34:20 -	LMT	1912 Jan  1
 			8:00	Macau	MO%sT	1999 Dec 20 # return to China
 			8:00	PRC	C%sT
 
@@ -823,20 +825,22 @@ Link	Asia/Nicosia	Europe/Nicosia
 # I don't know what can be done, especially knowing that some years ago our
 # DST rules where changed THREE TIMES during one month.
 
-# Milne says Tbilisi (Tiflis) time was 2:59:05.7; round to nearest.)
+# Milne 1899 says Tbilisi (Tiflis) time was 2:59:05.7.
+# Byalokoz 1919 says Georgia was 2:59:11.
+# Go with Byalokoz.
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Asia/Tbilisi	2:59:06 -	LMT	1880
-			2:59:06	-	TBMT	1924 May  2 # Tbilisi Mean Time
+Zone	Asia/Tbilisi	2:59:11 -	LMT	1880
+			2:59:11	-	TBMT	1924 May  2 # Tbilisi Mean Time
 			3:00	-	TBIT	1957 Mar    # Tbilisi Time
-			4:00 RussiaAsia TBI%sT	1991 Mar 31 2:00s
+			4:00 RussiaAsia TBI%sT	1991 Mar 31  2:00s
 			3:00	1:00	TBIST	1991 Apr  9 # independence
-			3:00 RussiaAsia GE%sT	1992 # Georgia Time
+			3:00 RussiaAsia GE%sT	1992        # Georgia Time
 			3:00 E-EurAsia	GE%sT	1994 Sep lastSun
 			4:00 E-EurAsia	GE%sT	1996 Oct lastSun
 			4:00	1:00	GEST	1997 Mar lastSun
 			4:00 E-EurAsia	GE%sT	2004 Jun 27
-			3:00 RussiaAsia	GE%sT	2005 Mar lastSun 2:00
+			3:00 RussiaAsia	GE%sT	2005 Mar lastSun  2:00
 			4:00	-	GET
 
 # East Timor
@@ -864,16 +868,16 @@ Zone	Asia/Tbilisi	2:59:06 -	LMT	1880
 # midnight on Saturday, September 16.
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Asia/Dili	8:22:20 -	LMT	1912
+Zone	Asia/Dili	8:22:20 -	LMT	1912 Jan  1
 			8:00	-	TLT	1942 Feb 21 23:00 # E Timor Time
 			9:00	-	JST	1945 Sep 23
 			9:00	-	TLT	1976 May  3
-			8:00	-	WITA	2000 Sep 17 00:00
+			8:00	-	WITA	2000 Sep 17  0:00
 			9:00	-	TLT
 
 # India
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Asia/Kolkata	5:53:28 -	LMT	1880	# Kolkata
+Zone	Asia/Kolkata	5:53:28 -	LMT	1880        # Kolkata
 			5:53:20	-	HMT	1941 Oct    # Howrah Mean Time?
 			6:30	-	BURT	1942 May 15 # Burma Time
 			5:30	-	IST	1942 Sep
@@ -886,8 +890,12 @@ Zone	Asia/Kolkata	5:53:28 -	LMT	1880	# K
 
 # Indonesia
 #
+# From Paul Eggert (2014-09-06):
+# The 1876 Report of the Secretary of the [US] Navy, p 306 says that Batavia
+# civil time was 7:07:12.5; round to even for Jakarta.
+#
 # From Gwillim Law (2001-05-28), overriding Shanks & Pottenger:
-# 
+# http://www.sumatera-inc.com/go_to_invest/about_indonesia.asp#standtime
 # says that Indonesia's time zones changed on 1988-01-01.  Looking at some
 # time zone maps, I think that must refer to Western Borneo (Kalimantan Barat
 # and Kalimantan Tengah) switching from UTC+8 to UTC+7.
@@ -924,7 +932,7 @@ Zone Asia/Jakarta	7:07:12 -	LMT	1867 Aug
 # Shanks & Pottenger say the next transition was at 1924 Jan 1 0:13,
 # but this must be a typo.
 			7:07:12	-	BMT	1923 Dec 31 23:47:12 # Batavia
-			7:20	-	JAVT	1932 Nov	 # Java Time
+			7:20	-	JAVT	1932 Nov    # Java Time
 			7:30	-	WIB	1942 Mar 23
 			9:00	-	JST	1945 Sep 23
 			7:30	-	WIB	1948 May
@@ -1082,7 +1090,7 @@ Rule	Iran	2036	2037	-	Mar	21	0:00	1:00	D
 Rule	Iran	2036	2037	-	Sep	21	0:00	0	S
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Tehran	3:25:44	-	LMT	1916
-			3:25:44	-	TMT	1946	# Tehran Mean Time
+			3:25:44	-	TMT	1946     # Tehran Mean Time
 			3:30	-	IRST	1977 Nov
 			4:00	Iran	IR%sT	1979
 			3:30	Iran	IR%sT
@@ -1127,7 +1135,7 @@ Rule	Iraq	1991	2007	-	Apr	 1	3:00s	1:00	
 Rule	Iraq	1991	2007	-	Oct	 1	3:00s	0	S
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Baghdad	2:57:40	-	LMT	1890
-			2:57:36	-	BMT	1918	    # Baghdad Mean Time?
+			2:57:36	-	BMT	1918     # Baghdad Mean Time?
 			3:00	-	AST	1982 May
 			3:00	Iraq	A%sT
 
@@ -1355,7 +1363,7 @@ Rule	Zion	2013	max	-	Oct	lastSun	2:00	0	
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Jerusalem	2:20:54 -	LMT	1880
-			2:20:40	-	JMT	1918	# Jerusalem Mean Time?
+			2:20:40	-	JMT	1918 # Jerusalem Mean Time?
 			2:00	Zion	I%sT
 
 
@@ -1371,8 +1379,8 @@ Zone	Asia/Jerusalem	2:20:54 -	LMT	1880
 # daylight saving between 1948 and 1951, but "the system was discontinued
 # because the public believed it would lead to longer working hours."
 
-# From Mayumi Negishi in the 2005-08-10 Japan Times
-# :
+# From Mayumi Negishi in the 2005-08-10 Japan Times:
+# http://www.japantimes.co.jp/cgi-bin/getarticle.pl5?nn20050810f2.htm
 # Occupation authorities imposed daylight-saving time on Japan on
 # [1948-05-01]....  But lack of prior debate and the execution of
 # daylight-saving time just three days after the bill was passed generated
@@ -1396,7 +1404,8 @@ Rule	Japan	1950	1951	-	May	Sun>=1	2:00	1
 
 # From Hideyuki Suzuki (1998-11-09):
 # 'Tokyo' usually stands for the former location of Tokyo Astronomical
-# Observatory: 139 degrees 44' 40.90" E (9h 18m 58.727s), 35 degrees 39' 16.0" N.
+# Observatory: 139 degrees 44' 40.90" E (9h 18m 58.727s),
+# 35 degrees 39' 16.0" N.
 # This data is from 'Rika Nenpyou (Chronological Scientific Tables) 1996'
 # edited by National Astronomical Observatory of Japan....
 # JST (Japan Standard Time) has been used since 1888-01-01 00:00 (JST).
@@ -1586,10 +1595,10 @@ Zone	Asia/Qyzylorda	4:21:52 -	LMT	1924 M
 			6:00	-	KIZT	1982 Apr  1
 			5:00 RussiaAsia	KIZ%sT	1991
 			5:00	-	KIZT	1991 Dec 16 # independence
-			5:00	-	QYZT	1992 Jan 19 2:00
+			5:00	-	QYZT	1992 Jan 19  2:00
 			6:00 RussiaAsia	QYZ%sT	2005 Mar 15
 			6:00	-	QYZT
-# Aqtobe (aka Aktobe, formerly Akt'ubinsk)
+# Aqtobe (aka Aktobe, formerly Aktyubinsk)
 Zone	Asia/Aqtobe	3:48:40	-	LMT	1924 May  2
 			4:00	-	AKTT	1930 Jun 21 # Aktyubinsk Time
 			5:00	-	AKTT	1981 Apr  1
@@ -1609,7 +1618,7 @@ Zone	Asia/Aqtau	3:21:04	-	LMT	1924 May  
 			6:00	-	SHET	1982 Apr  1
 			5:00 RussiaAsia	SHE%sT	1991
 			5:00	-	SHET	1991 Dec 16 # independence
-			5:00 RussiaAsia	AQT%sT	1995 Mar lastSun 2:00 # Aqtau Time
+			5:00 RussiaAsia	AQT%sT	1995 Mar lastSun  2:00 # Aqtau Time
 			4:00 RussiaAsia	AQT%sT	2005 Mar 15
 			5:00	-	AQTT
 # West Kazakhstan
@@ -1618,7 +1627,7 @@ Zone	Asia/Oral	3:25:24	-	LMT	1924 May  2
 			5:00	-	URAT	1981 Apr  1
 			5:00	1:00	URAST	1981 Oct  1
 			6:00	-	URAT	1982 Apr  1
-			5:00 RussiaAsia	URA%sT	1989 Mar 26 2:00
+			5:00 RussiaAsia	URA%sT	1989 Mar 26  2:00
 			4:00 RussiaAsia	URA%sT	1991
 			4:00	-	URAT	1991 Dec 16 # independence
 			4:00 RussiaAsia	ORA%sT	2005 Mar 15 # Oral Time
@@ -1629,7 +1638,7 @@ Zone	Asia/Oral	3:25:24	-	LMT	1924 May  2
 
 # From Paul Eggert (2005-08-15):
 # According to an article dated today in the Kyrgyzstan Development Gateway
-# 
+# http://eng.gateway.kg/cgi-bin/page.pl?id=1&story_name=doc9979.shtml
 # Kyrgyzstan is canceling the daylight saving time system.  I take the article
 # to mean that they will leave their clocks at 6 hours ahead of UTC.
 # From Malik Abdugaliev (2005-09-21):
@@ -1644,17 +1653,17 @@ Rule	Kyrgyz	1997	2004	-	Oct	lastSun	2:30
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Bishkek	4:58:24 -	LMT	1924 May  2
 			5:00	-	FRUT	1930 Jun 21 # Frunze Time
-			6:00 RussiaAsia FRU%sT	1991 Mar 31 2:00s
-			5:00	1:00	FRUST	1991 Aug 31 2:00 # independence
-			5:00	Kyrgyz	KG%sT	2005 Aug 12    # Kyrgyzstan Time
+			6:00 RussiaAsia FRU%sT	1991 Mar 31  2:00s
+			5:00	1:00	FRUST	1991 Aug 31  2:00 # independence
+			5:00	Kyrgyz	KG%sT	2005 Aug 12 # Kyrgyzstan Time
 			6:00	-	KGT
 
 ###############################################################################
 
 # Korea (North and South)
 
-# From Annie I. Bang (2006-07-10) in
-# :
+# From Annie I. Bang (2006-07-10):
+# http://www.koreaherald.co.kr/SITE/data/html_dir/2006/07/10/200607100012.asp
 # The Ministry of Commerce, Industry and Energy has already
 # commissioned a research project [to reintroduce DST] and has said
 # the system may begin as early as 2008....  Korea ran a daylight
@@ -1702,12 +1711,8 @@ Zone	Asia/Kuwait	3:11:56 -	LMT	1950
 			3:00	-	AST
 
 # Laos
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Asia/Vientiane	6:50:24 -	LMT	1906 Jun  9 # or Viangchan
-			7:06:20	-	SMT	1911 Mar 11 0:01 # Saigon MT?
-			7:00	-	ICT	1912 May
-			8:00	-	ICT	1931 May
-			7:00	-	ICT
+# See Asia/Bangkok.
+
 
 # Lebanon
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
@@ -1745,8 +1750,8 @@ Rule	NBorneo	1935	1941	-	Sep	14	0:00	0:2
 Rule	NBorneo	1935	1941	-	Dec	14	0:00	0	-
 #
 # peninsular Malaysia
-# The data here are taken from Mok Ly Yng (2003-10-30)
-# .
+# taken from Mok Ly Yng (2003-10-30)
+# http://www.math.nus.edu.sg/aslaksen/teaching/timezone.html
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Asia/Kuala_Lumpur	6:46:46 -	LMT	1901 Jan  1
 			6:55:25	-	SMT	1905 Jun  1 # Singapore M.T.
@@ -1758,12 +1763,12 @@ Zone Asia/Kuala_Lumpur	6:46:46 -	LMT	190
 			7:30	-	MALT	1982 Jan  1
 			8:00	-	MYT	# Malaysia Time
 # Sabah & Sarawak
-# From Paul Eggert (2006-03-22):
-# The data here are mostly from Shanks & Pottenger, but the 1942, 1945 and 1982
-# transition dates are from Mok Ly Yng.
+# From Paul Eggert (2014-08-12):
+# The data entries here are mostly from Shanks & Pottenger, but the 1942, 1945
+# and 1982 transition dates are from Mok Ly Yng.
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Asia/Kuching	7:21:20	-	LMT	1926 Mar
-			7:30	-	BORT	1933	# Borneo Time
+			7:30	-	BORT	1933        # Borneo Time
 			8:00	NBorneo	BOR%sT	1942 Feb 16
 			9:00	-	JST	1945 Sep 12
 			8:00	-	BORT	1982 Jan  1
@@ -1771,9 +1776,9 @@ Zone Asia/Kuching	7:21:20	-	LMT	1926 Mar
 
 # Maldives
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Indian/Maldives	4:54:00 -	LMT	1880	# Male
-			4:54:00	-	MMT	1960	# Male Mean Time
-			5:00	-	MVT		# Maldives Time
+Zone	Indian/Maldives	4:54:00 -	LMT	1880 # Male
+			4:54:00	-	MMT	1960 # Male Mean Time
+			5:00	-	MVT	# Maldives Time
 
 # Mongolia
 
@@ -1835,7 +1840,7 @@ Zone	Indian/Maldives	4:54:00 -	LMT	1880	
 # Oscar van Vlijmen (2005-05-20) reports that the Mongolian Embassy in
 # Washington, DC says there are two time zones, with DST observed.
 # He also found

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 06:13:43 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 2456973F;
 Thu, 23 Oct 2014 06:13:43 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id EB6EAEAD;
 Thu, 23 Oct 2014 06:13:42 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N6Dg6g034323;
 Thu, 23 Oct 2014 06:13:42 GMT (envelope-from edwin@FreeBSD.org)
Received: (from edwin@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N6DgIM034322;
 Thu, 23 Oct 2014 06:13:42 GMT (envelope-from edwin@FreeBSD.org)
Message-Id: <201410230613.s9N6DgIM034322@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: edwin set sender to
 edwin@FreeBSD.org using -f
From: Edwin Groothuis 
Date: Thu, 23 Oct 2014 06:13:42 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-vendor@freebsd.org
Subject: svn commit: r273519 - vendor/tzdata/tzdata2014i
X-SVN-Group: vendor
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 06:13:43 -0000

Author: edwin
Date: Thu Oct 23 06:13:42 2014
New Revision: 273519
URL: https://svnweb.freebsd.org/changeset/base/273519

Log:
  Tag of tzdata2014i sources

Added:
  vendor/tzdata/tzdata2014i/
     - copied from r273518, vendor/tzdata/dist/

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 06:18:29 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 15E90987;
 Thu, 23 Oct 2014 06:18:29 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id EBAC9ED8;
 Thu, 23 Oct 2014 06:18:28 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N6ISV6035129;
 Thu, 23 Oct 2014 06:18:28 GMT (envelope-from ngie@FreeBSD.org)
Received: (from ngie@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N6ISU6035128;
 Thu, 23 Oct 2014 06:18:28 GMT (envelope-from ngie@FreeBSD.org)
Message-Id: <201410230618.s9N6ISU6035128@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org
 using -f
From: Garrett Cooper 
Date: Thu, 23 Oct 2014 06:18:28 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273520 - head/contrib/netbsd-tests/lib/libc/sys
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 06:18:29 -0000

Author: ngie
Date: Thu Oct 23 06:18:28 2014
New Revision: 273520
URL: https://svnweb.freebsd.org/changeset/base/273520

Log:
  Port t_pipe2.c to FreeBSD
  
  - Omit the pipe2_nosigpipe testcase on FreeBSD (FreeBSD doesn't have
    O_NOSIGPIPE).
  - Convert "fcntl(n, F_CLOSEM)" to "closefrom(n)".
  - Save and restore the resource limit on the number of files (RLIMIT_NOFILE).
  
  In collaboration with: pho
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/contrib/netbsd-tests/lib/libc/sys/t_pipe2.c

Modified: head/contrib/netbsd-tests/lib/libc/sys/t_pipe2.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/sys/t_pipe2.c	Thu Oct 23 06:13:42 2014	(r273519)
+++ head/contrib/netbsd-tests/lib/libc/sys/t_pipe2.c	Thu Oct 23 06:18:28 2014	(r273520)
@@ -53,7 +53,11 @@ run(int flags)
 	while ((i = open("/", O_RDONLY)) < 3)
 		ATF_REQUIRE(i != -1);
 
+#if defined(__FreeBSD__)
+	closefrom(3);
+#else
 	ATF_REQUIRE(fcntl(3, F_CLOSEM) != -1);
+#endif
 
 	ATF_REQUIRE(pipe2(fd, flags) == 0);
 
@@ -76,6 +80,7 @@ run(int flags)
 		ATF_REQUIRE((fcntl(fd[1], F_GETFL) & O_NONBLOCK) == 0);
 	}
 
+#if !defined(__FreeBSD__)
 	if (flags & O_NOSIGPIPE) {
 		ATF_REQUIRE(fcntl(fd[0], F_GETNOSIGPIPE) != 0);
 		ATF_REQUIRE(fcntl(fd[1], F_GETNOSIGPIPE) != 0);
@@ -83,6 +88,7 @@ run(int flags)
 		ATF_REQUIRE(fcntl(fd[0], F_GETNOSIGPIPE) == 0);
 		ATF_REQUIRE(fcntl(fd[1], F_GETNOSIGPIPE) == 0);
 	}
+#endif
 
 	ATF_REQUIRE(close(fd[0]) != -1);
 	ATF_REQUIRE(close(fd[1]) != -1);
@@ -110,9 +116,14 @@ ATF_TC_BODY(pipe2_consume, tc)
 {
 	struct rlimit rl;
 	int err, filedes[2];
+#if defined(__FreeBSD__)
+	int old;
 
+	closefrom(4);
+#else
 	err = fcntl(4, F_CLOSEM);
 	ATF_REQUIRE(err == 0);
+#endif
 
 	err = getrlimit(RLIMIT_NOFILE, &rl);
 	ATF_REQUIRE(err == 0);
@@ -121,12 +132,19 @@ ATF_TC_BODY(pipe2_consume, tc)
 	 * file descriptor limit in the middle of a pipe2() call - i.e.
 	 * before the call only a single descriptor may be openend.
 	 */
+#if defined(__FreeBSD__)
+	old = rl.rlim_cur;
+#endif
 	rl.rlim_cur = 4;
 	err = setrlimit(RLIMIT_NOFILE, &rl);
 	ATF_REQUIRE(err == 0);
 
 	err = pipe2(filedes, O_CLOEXEC);
 	ATF_REQUIRE(err == -1);
+#if defined(__FreeBSD__)
+	rl.rlim_cur = old;
+	err = setrlimit(RLIMIT_NOFILE, &rl);
+#endif
 }
 
 ATF_TC(pipe2_nonblock);
@@ -151,6 +169,7 @@ ATF_TC_BODY(pipe2_cloexec, tc)
 	run(O_CLOEXEC);
 }
 
+#if defined(__NetBSD__)
 ATF_TC(pipe2_nosigpipe);
 ATF_TC_HEAD(pipe2_nosigpipe, tc)
 {
@@ -161,6 +180,7 @@ ATF_TC_BODY(pipe2_nosigpipe, tc)
 {
 	run(O_NOSIGPIPE);
 }
+#endif
 
 ATF_TC(pipe2_einval);
 ATF_TC_HEAD(pipe2_einval, tc)
@@ -181,7 +201,9 @@ ATF_TP_ADD_TCS(tp)
 	ATF_TP_ADD_TC(tp, pipe2_consume);
 	ATF_TP_ADD_TC(tp, pipe2_nonblock);
 	ATF_TP_ADD_TC(tp, pipe2_cloexec);
+#if defined(__NetBSD__)
 	ATF_TP_ADD_TC(tp, pipe2_nosigpipe);
+#endif
 	ATF_TP_ADD_TC(tp, pipe2_einval);
 
 	return atf_no_error();

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 06:21:11 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 82D55B14;
 Thu, 23 Oct 2014 06:21:11 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 6F2D1F80;
 Thu, 23 Oct 2014 06:21:11 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N6LBuo038918;
 Thu, 23 Oct 2014 06:21:11 GMT (envelope-from ngie@FreeBSD.org)
Received: (from ngie@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N6LBcn038913;
 Thu, 23 Oct 2014 06:21:11 GMT (envelope-from ngie@FreeBSD.org)
Message-Id: <201410230621.s9N6LBcn038913@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org
 using -f
From: Garrett Cooper 
Date: Thu, 23 Oct 2014 06:21:11 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273521 - head/contrib/netbsd-tests/lib/libc/sys
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 06:21:11 -0000

Author: ngie
Date: Thu Oct 23 06:21:10 2014
New Revision: 273521
URL: https://svnweb.freebsd.org/changeset/base/273521

Log:
  Convert "fcntl(n, F_CLOSEM)" to "closefrom(n)"
  
  Submitted by: pho
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/contrib/netbsd-tests/lib/libc/sys/t_socketpair.c

Modified: head/contrib/netbsd-tests/lib/libc/sys/t_socketpair.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/sys/t_socketpair.c	Thu Oct 23 06:18:28 2014	(r273520)
+++ head/contrib/netbsd-tests/lib/libc/sys/t_socketpair.c	Thu Oct 23 06:21:10 2014	(r273521)
@@ -63,7 +63,11 @@ run(int flags)
 	while ((i = open("/", O_RDONLY)) < 3)
 		ATF_REQUIRE(i != -1);
 
+#ifdef __FreeBSD__
+	closefrom(3);
+#else
 	ATF_REQUIRE(fcntl(3, F_CLOSEM) != -1);
+#endif
 
 	ATF_REQUIRE(socketpair(AF_UNIX, SOCK_DGRAM | flags, 0, fd) == 0);
 

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 06:24:37 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 49D36DF9;
 Thu, 23 Oct 2014 06:24:37 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 363AAFB5;
 Thu, 23 Oct 2014 06:24:37 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N6Obc3039506;
 Thu, 23 Oct 2014 06:24:37 GMT (envelope-from ngie@FreeBSD.org)
Received: (from ngie@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N6Obiq039505;
 Thu, 23 Oct 2014 06:24:37 GMT (envelope-from ngie@FreeBSD.org)
Message-Id: <201410230624.s9N6Obiq039505@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org
 using -f
From: Garrett Cooper 
Date: Thu, 23 Oct 2014 06:24:37 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273522 - head/contrib/netbsd-tests/lib/libc/sys
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 06:24:37 -0000

Author: ngie
Date: Thu Oct 23 06:24:36 2014
New Revision: 273522
URL: https://svnweb.freebsd.org/changeset/base/273522

Log:
  - Mark unused parameters __unused in handler
  - Call sigqueue with getpid() instead of 0 -- the latter idiom appears to only
  be valid on NetBSD
  
  In collaboration with: pho
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/contrib/netbsd-tests/lib/libc/sys/t_sigqueue.c

Modified: head/contrib/netbsd-tests/lib/libc/sys/t_sigqueue.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/sys/t_sigqueue.c	Thu Oct 23 06:21:10 2014	(r273521)
+++ head/contrib/netbsd-tests/lib/libc/sys/t_sigqueue.c	Thu Oct 23 06:24:36 2014	(r273522)
@@ -46,7 +46,11 @@ static void	handler(int, siginfo_t *, vo
 static int value;
 
 static void
+#if defined(__FreeBSD__)
+handler(int signo __unused, siginfo_t *info __unused, void *data __unused)
+#else
 handler(int signo, siginfo_t *info, void *data)
+#endif
 {
 	value = info->si_value.sival_int;
 	kill(0, SIGINFO);
@@ -72,7 +76,15 @@ ATF_TC_BODY(sigqueue_basic, tc)
 
 	sv.sival_int = VALUE;
 
+#if defined(__FreeBSD__)
+	/* 
+	 * From kern_sig.c:
+	 * Specification says sigqueue can only send signal to single process.
+	 */
+	if (sigqueue(getpid(), SIGUSR1, sv) != 0)
+#else
 	if (sigqueue(0, SIGUSR1, sv) != 0)
+#endif
 		atf_tc_fail("sigqueue failed");
 
 	sched_yield();

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 06:25:52 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id E323EF43;
 Thu, 23 Oct 2014 06:25:52 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id CFC89FBF;
 Thu, 23 Oct 2014 06:25:52 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N6PqcJ039728;
 Thu, 23 Oct 2014 06:25:52 GMT (envelope-from ngie@FreeBSD.org)
Received: (from ngie@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N6PqK2039727;
 Thu, 23 Oct 2014 06:25:52 GMT (envelope-from ngie@FreeBSD.org)
Message-Id: <201410230625.s9N6PqK2039727@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org
 using -f
From: Garrett Cooper 
Date: Thu, 23 Oct 2014 06:25:52 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273523 - head/contrib/netbsd-tests/lib/libc/sys
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 06:25:53 -0000

Author: ngie
Date: Thu Oct 23 06:25:52 2014
New Revision: 273523
URL: https://svnweb.freebsd.org/changeset/base/273523

Log:
  Add limits.h #include for LINE_MAX
  
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/contrib/netbsd-tests/lib/libc/sys/t_link.c

Modified: head/contrib/netbsd-tests/lib/libc/sys/t_link.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/sys/t_link.c	Thu Oct 23 06:24:36 2014	(r273522)
+++ head/contrib/netbsd-tests/lib/libc/sys/t_link.c	Thu Oct 23 06:25:52 2014	(r273523)
@@ -41,6 +41,10 @@ __RCSID("$NetBSD: t_link.c,v 1.2 2014/04
 #include 
 #include 
 
+#ifdef __FreeBSD__
+#include 
+#endif
+
 static const char	*getpath(void);
 static char		 path[] = "link";
 static const char	*pathl;

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 06:35:20 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 1A744257;
 Thu, 23 Oct 2014 06:35:20 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 07154128;
 Thu, 23 Oct 2014 06:35:20 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N6ZJKH044428;
 Thu, 23 Oct 2014 06:35:19 GMT (envelope-from ngie@FreeBSD.org)
Received: (from ngie@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N6ZJq5044427;
 Thu, 23 Oct 2014 06:35:19 GMT (envelope-from ngie@FreeBSD.org)
Message-Id: <201410230635.s9N6ZJq5044427@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org
 using -f
From: Garrett Cooper 
Date: Thu, 23 Oct 2014 06:35:19 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273524 - head/contrib/netbsd-tests/lib/libc/sys
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 06:35:20 -0000

Author: ngie
Date: Thu Oct 23 06:35:19 2014
New Revision: 273524
URL: https://svnweb.freebsd.org/changeset/base/273524

Log:
  Add sys/socket.h #include for struct sockaddr_in
  
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/contrib/netbsd-tests/lib/libc/sys/t_listen.c

Modified: head/contrib/netbsd-tests/lib/libc/sys/t_listen.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/sys/t_listen.c	Thu Oct 23 06:25:52 2014	(r273523)
+++ head/contrib/netbsd-tests/lib/libc/sys/t_listen.c	Thu Oct 23 06:35:19 2014	(r273524)
@@ -36,6 +36,10 @@
 #include 
 #include 
 
+#if defined(__FreeBSD__)
+#include 
+#endif
+
 static const char *path = "listen";
 
 ATF_TC_WITH_CLEANUP(listen_err);

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 06:42:54 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id E95E950F;
 Thu, 23 Oct 2014 06:42:54 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id BC32D207;
 Thu, 23 Oct 2014 06:42:54 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N6gseY048918;
 Thu, 23 Oct 2014 06:42:54 GMT (envelope-from ngie@FreeBSD.org)
Received: (from ngie@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N6gsN6048917;
 Thu, 23 Oct 2014 06:42:54 GMT (envelope-from ngie@FreeBSD.org)
Message-Id: <201410230642.s9N6gsN6048917@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org
 using -f
From: Garrett Cooper 
Date: Thu, 23 Oct 2014 06:42:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273525 - head/contrib/netbsd-tests/lib/libc/sys
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 06:42:55 -0000

Author: ngie
Date: Thu Oct 23 06:42:53 2014
New Revision: 273525
URL: https://svnweb.freebsd.org/changeset/base/273525

Log:
  Port t_mmap.c to FreeBSD
  
  - Add needed headers for the testcases
  - Omit mmap_block on non-NetBSD OSes
  - Use "security.bsd.map_at_zero" instead of "vm.user_va0_disable"
  
  Submitted by: pho
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/contrib/netbsd-tests/lib/libc/sys/t_mmap.c

Modified: head/contrib/netbsd-tests/lib/libc/sys/t_mmap.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/sys/t_mmap.c	Thu Oct 23 06:35:19 2014	(r273524)
+++ head/contrib/netbsd-tests/lib/libc/sys/t_mmap.c	Thu Oct 23 06:42:53 2014	(r273525)
@@ -72,7 +72,15 @@ __RCSID("$NetBSD: t_mmap.c,v 1.7 2012/06
 #include 
 #include 
 #include 
+#ifdef __NetBSD__
 #include 
+#endif
+
+#ifdef __FreeBSD__
+#include 
+#include 
+#include 
+#endif
 
 static long	page = 0;
 static char	path[] = "mmap";
@@ -155,6 +163,7 @@ map_sighandler(int signo)
 	_exit(signo);
 }
 
+#ifdef __NetBSD__
 ATF_TC(mmap_block);
 ATF_TC_HEAD(mmap_block, tc)
 {
@@ -199,6 +208,7 @@ ATF_TC_BODY(mmap_block, tc)
 
 	ATF_REQUIRE(munmap(map, 4096) == 0);
 }
+#endif
 
 ATF_TC(mmap_err);
 ATF_TC_HEAD(mmap_err, tc)
@@ -468,8 +478,15 @@ ATF_TC_BODY(mmap_va0, tc)
 	 * Make an anonymous fixed mapping at zero address. If the address
 	 * is restricted as noted in security(7), the syscall should fail.
 	 */
+#ifdef __FreeBSD__
+	if (sysctlbyname("security.bsd.map_at_zero", &val, &len, NULL, 0) != 0)
+		atf_tc_fail("failed to read security.bsd.map_at_zero");
+	val = !val; /* 1 == enable  map at zero */
+#endif
+#ifdef __NetBSD__
 	if (sysctlbyname("vm.user_va0_disable", &val, &len, NULL, 0) != 0)
 		atf_tc_fail("failed to read vm.user_va0_disable");
+#endif
 
 	map = mmap(NULL, page, PROT_EXEC, flags, -1, 0);
 	map_check(map, val);
@@ -492,7 +509,9 @@ ATF_TP_ADD_TCS(tp)
 	page = sysconf(_SC_PAGESIZE);
 	ATF_REQUIRE(page >= 0);
 
+#ifdef __NetBSD__
 	ATF_TP_ADD_TC(tp, mmap_block);
+#endif
 	ATF_TP_ADD_TC(tp, mmap_err);
 	ATF_TP_ADD_TC(tp, mmap_loan);
 	ATF_TP_ADD_TC(tp, mmap_prot_1);

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 07:05:15 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 0B29575C;
 Thu, 23 Oct 2014 07:05:15 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id EBD093E3;
 Thu, 23 Oct 2014 07:05:14 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N75ES0058529;
 Thu, 23 Oct 2014 07:05:14 GMT (envelope-from ngie@FreeBSD.org)
Received: (from ngie@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N75E6U058528;
 Thu, 23 Oct 2014 07:05:14 GMT (envelope-from ngie@FreeBSD.org)
Message-Id: <201410230705.s9N75E6U058528@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org
 using -f
From: Garrett Cooper 
Date: Thu, 23 Oct 2014 07:05:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273526 - head/contrib/netbsd-tests/lib/libc/sys
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 07:05:15 -0000

Author: ngie
Date: Thu Oct 23 07:05:14 2014
New Revision: 273526
URL: https://svnweb.freebsd.org/changeset/base/273526

Log:
  Omit the pollts testcases on FreeBSD
  
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/contrib/netbsd-tests/lib/libc/sys/t_poll.c

Modified: head/contrib/netbsd-tests/lib/libc/sys/t_poll.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/sys/t_poll.c	Thu Oct 23 06:42:53 2014	(r273525)
+++ head/contrib/netbsd-tests/lib/libc/sys/t_poll.c	Thu Oct 23 07:05:14 2014	(r273526)
@@ -233,6 +233,7 @@ ATF_TC_BODY(poll_err, tc)
 	ATF_REQUIRE_ERRNO(EINVAL, poll(&pfd, 1, -2) == -1);
 }
 
+#if !defined(__FreeBSD__)
 ATF_TC(pollts_basic);
 ATF_TC_HEAD(pollts_basic, tc)
 {
@@ -377,6 +378,7 @@ ATF_TC_BODY(pollts_sigmask, tc)
 
 	ATF_REQUIRE_EQ(close(fd), 0);
 }
+#endif
 
 ATF_TP_ADD_TCS(tp)
 {
@@ -384,9 +386,11 @@ ATF_TP_ADD_TCS(tp)
 	ATF_TP_ADD_TC(tp, poll_3way);
 	ATF_TP_ADD_TC(tp, poll_basic);
 	ATF_TP_ADD_TC(tp, poll_err);
+#if !defined(__FreeBSD__)
 	ATF_TP_ADD_TC(tp, pollts_basic);
 	ATF_TP_ADD_TC(tp, pollts_err);
 	ATF_TP_ADD_TC(tp, pollts_sigmask);
+#endif
 
 	return atf_no_error();
 }

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 07:07:36 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 154DB8E1;
 Thu, 23 Oct 2014 07:07:36 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 01AD23FE;
 Thu, 23 Oct 2014 07:07:36 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N77ZTs058842;
 Thu, 23 Oct 2014 07:07:35 GMT (envelope-from ngie@FreeBSD.org)
Received: (from ngie@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N77ZXL058841;
 Thu, 23 Oct 2014 07:07:35 GMT (envelope-from ngie@FreeBSD.org)
Message-Id: <201410230707.s9N77ZXL058841@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org
 using -f
From: Garrett Cooper 
Date: Thu, 23 Oct 2014 07:07:35 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273527 - head/contrib/netbsd-tests/lib/libc/sys
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 07:07:36 -0000

Author: ngie
Date: Thu Oct 23 07:07:35 2014
New Revision: 273527
URL: https://svnweb.freebsd.org/changeset/base/273527

Log:
  Omit all of the testcases as revoke(2) is only implemented on devfs(5)
  
  Submitted by: pho
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/contrib/netbsd-tests/lib/libc/sys/t_revoke.c

Modified: head/contrib/netbsd-tests/lib/libc/sys/t_revoke.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/sys/t_revoke.c	Thu Oct 23 07:05:14 2014	(r273526)
+++ head/contrib/netbsd-tests/lib/libc/sys/t_revoke.c	Thu Oct 23 07:07:35 2014	(r273527)
@@ -58,6 +58,9 @@ ATF_TC_BODY(revoke_basic, tc)
 	size_t i, n;
 	int *buf;
 
+#if defined(__FreeBSD__)
+	atf_tc_skip("revoke(2) is only implemented for devfs(5).");
+#endif
 	(void)memset(&res, 0, sizeof(struct rlimit));
 	(void)getrlimit(RLIMIT_NOFILE, &res);
 
@@ -113,6 +116,9 @@ ATF_TC_BODY(revoke_err, tc)
 	errno = 0;
 	ATF_REQUIRE_ERRNO(ENAMETOOLONG, revoke(buf) == -1);
 
+#if defined(__FreeBSD__)
+	atf_tc_skip("revoke(2) is only implemented for devfs(5).");
+#endif
 	errno = 0;
 	ATF_REQUIRE_ERRNO(EPERM, revoke("/etc/passwd") == -1);
 
@@ -133,6 +139,9 @@ ATF_TC_BODY(revoke_perm, tc)
 	int fd, sta;
 	pid_t pid;
 
+#if defined(__FreeBSD__)
+	atf_tc_skip("revoke(2) is only implemented for devfs(5).");
+#endif
 	pw = getpwnam("nobody");
 	fd = open(path, O_RDWR | O_CREAT, 0600);
 

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 07:11:59 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id CA740A60;
 Thu, 23 Oct 2014 07:11:59 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id B6D2F68B;
 Thu, 23 Oct 2014 07:11:59 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N7BxfS062866;
 Thu, 23 Oct 2014 07:11:59 GMT (envelope-from ngie@FreeBSD.org)
Received: (from ngie@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N7Bx1r062865;
 Thu, 23 Oct 2014 07:11:59 GMT (envelope-from ngie@FreeBSD.org)
Message-Id: <201410230711.s9N7Bx1r062865@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org
 using -f
From: Garrett Cooper 
Date: Thu, 23 Oct 2014 07:11:59 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273528 - head/contrib/netbsd-tests/lib/libc/sys
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 07:11:59 -0000

Author: ngie
Date: Thu Oct 23 07:11:58 2014
New Revision: 273528
URL: https://svnweb.freebsd.org/changeset/base/273528

Log:
  Mark signo __unused in handler(..)
  
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/contrib/netbsd-tests/lib/libc/sys/t_nanosleep.c

Modified: head/contrib/netbsd-tests/lib/libc/sys/t_nanosleep.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/sys/t_nanosleep.c	Thu Oct 23 07:07:35 2014	(r273527)
+++ head/contrib/netbsd-tests/lib/libc/sys/t_nanosleep.c	Thu Oct 23 07:11:58 2014	(r273528)
@@ -45,7 +45,11 @@ __RCSID("$NetBSD: t_nanosleep.c,v 1.3 20
 #include 
 
 static void
+#if defined(__FreeBSD__)
+handler(int signo __unused)
+#else
 handler(int signo)
+#endif
 {
 	/* Nothing. */
 }

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 07:20:36 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 9C28FC81;
 Thu, 23 Oct 2014 07:20:36 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 6EE677A4;
 Thu, 23 Oct 2014 07:20:36 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N7KaTg064606;
 Thu, 23 Oct 2014 07:20:36 GMT (envelope-from ngie@FreeBSD.org)
Received: (from ngie@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N7KadE064605;
 Thu, 23 Oct 2014 07:20:36 GMT (envelope-from ngie@FreeBSD.org)
Message-Id: <201410230720.s9N7KadE064605@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org
 using -f
From: Garrett Cooper 
Date: Thu, 23 Oct 2014 07:20:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273529 - head/contrib/netbsd-tests/lib/libc/gen
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 07:20:36 -0000

Author: ngie
Date: Thu Oct 23 07:20:35 2014
New Revision: 273529
URL: https://svnweb.freebsd.org/changeset/base/273529

Log:
  - Omit the poll testcases on FreeBSD (they require pollts)
  - Add necessary headers for the testcases
  
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/contrib/netbsd-tests/lib/libc/gen/t_sleep.c

Modified: head/contrib/netbsd-tests/lib/libc/gen/t_sleep.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/gen/t_sleep.c	Thu Oct 23 07:11:58 2014	(r273528)
+++ head/contrib/netbsd-tests/lib/libc/gen/t_sleep.c	Thu Oct 23 07:20:35 2014	(r273529)
@@ -49,6 +49,11 @@
 #define KEVNT_TIMEOUT	10300		/* measured in milli-seconds */
 #define FUZZ		(40 * MILLION)	/* scheduling fuzz accepted - 40 ms */
 
+#ifdef __FreeBSD__
+#include 
+#include 
+#endif
+
 /*
  * Timer notes
  *
@@ -78,7 +83,9 @@ static volatile int sig;
 int sleeptest(int (*)(struct timespec *, struct timespec *), bool, bool);
 int do_nanosleep(struct timespec *, struct timespec *);
 int do_select(struct timespec *, struct timespec *);
+#ifdef __NetBSD__
 int do_poll(struct timespec *, struct timespec *);
+#endif
 int do_sleep(struct timespec *, struct timespec *);
 int do_kevent(struct timespec *, struct timespec *);
 void sigalrm(int);
@@ -116,6 +123,7 @@ do_select(struct timespec *delay, struct
 	return ret;
 }
 
+#ifdef __NetBSD__
 int
 do_poll(struct timespec *delay, struct timespec *remain)
 {
@@ -129,6 +137,7 @@ do_poll(struct timespec *delay, struct t
 		ret = 0;
 	return ret;
 }
+#endif
 
 int
 do_sleep(struct timespec *delay, struct timespec *remain)
@@ -210,6 +219,7 @@ ATF_TC_BODY(select, tc)
 	sleeptest(do_select, true, true);
 }
 
+#ifdef __NetBSD__
 ATF_TC(poll);
 ATF_TC_HEAD(poll, tc) 
 {
@@ -223,6 +233,7 @@ ATF_TC_BODY(poll, tc)
 
 	sleeptest(do_poll, true, true);
 }
+#endif
 
 ATF_TC(sleep);
 ATF_TC_HEAD(sleep, tc) 
@@ -329,7 +340,9 @@ ATF_TP_ADD_TCS(tp) 
 {
 	ATF_TP_ADD_TC(tp, nanosleep);
 	ATF_TP_ADD_TC(tp, select);
+#ifdef __NetBSD__
 	ATF_TP_ADD_TC(tp, poll); 
+#endif
 	ATF_TP_ADD_TC(tp, sleep);
 	ATF_TP_ADD_TC(tp, kevent);
  

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 07:22:19 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 34593DDC;
 Thu, 23 Oct 2014 07:22:19 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 210917BB;
 Thu, 23 Oct 2014 07:22:19 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N7MIrs067801;
 Thu, 23 Oct 2014 07:22:18 GMT (envelope-from ngie@FreeBSD.org)
Received: (from ngie@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N7MIqL067800;
 Thu, 23 Oct 2014 07:22:18 GMT (envelope-from ngie@FreeBSD.org)
Message-Id: <201410230722.s9N7MIqL067800@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org
 using -f
From: Garrett Cooper 
Date: Thu, 23 Oct 2014 07:22:18 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273530 - head/contrib/netbsd-tests/lib/libc/sys
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 07:22:19 -0000

Author: ngie
Date: Thu Oct 23 07:22:18 2014
New Revision: 273530
URL: https://svnweb.freebsd.org/changeset/base/273530

Log:
  Add limits.h #include for INT_MAX
  
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/contrib/netbsd-tests/lib/libc/sys/t_msgctl.c

Modified: head/contrib/netbsd-tests/lib/libc/sys/t_msgctl.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/sys/t_msgctl.c	Thu Oct 23 07:20:35 2014	(r273529)
+++ head/contrib/netbsd-tests/lib/libc/sys/t_msgctl.c	Thu Oct 23 07:22:18 2014	(r273530)
@@ -46,6 +46,10 @@ __RCSID("$NetBSD: t_msgctl.c,v 1.4 2014/
 #include 
 #include 
 
+#ifdef __FreeBSD__
+#include 
+#endif
+
 #define MSG_KEY		12345689
 #define MSG_MTYPE_1	0x41
 

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 07:36:36 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 339B980;
 Thu, 23 Oct 2014 07:36:36 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 153778B5;
 Thu, 23 Oct 2014 07:36:36 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N7aZY5072948;
 Thu, 23 Oct 2014 07:36:35 GMT (envelope-from mav@FreeBSD.org)
Received: (from mav@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N7aYe4072941;
 Thu, 23 Oct 2014 07:36:34 GMT (envelope-from mav@FreeBSD.org)
Message-Id: <201410230736.s9N7aYe4072941@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org
 using -f
From: Alexander Motin 
Date: Thu, 23 Oct 2014 07:36:34 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject: svn commit: r273531 - stable/10/sys/cam/ctl
X-SVN-Group: stable-10
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 07:36:36 -0000

Author: mav
Date: Thu Oct 23 07:36:33 2014
New Revision: 273531
URL: https://svnweb.freebsd.org/changeset/base/273531

Log:
  MFC r273163:  Implement more functional CTL debug logging.
  
  Setting bits in kern.cam.ctl.debug allows to log errors, commands and some
  commands data respectively.

Modified:
  stable/10/sys/cam/ctl/ctl.c
  stable/10/sys/cam/ctl/ctl_debug.h
  stable/10/sys/cam/ctl/ctl_private.h
  stable/10/sys/cam/ctl/ctl_scsi_all.c
  stable/10/sys/cam/ctl/ctl_util.c
  stable/10/sys/cam/ctl/ctl_util.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl.c
==============================================================================
--- stable/10/sys/cam/ctl/ctl.c	Thu Oct 23 07:22:18 2014	(r273530)
+++ stable/10/sys/cam/ctl/ctl.c	Thu Oct 23 07:36:33 2014	(r273531)
@@ -315,10 +315,10 @@ static int worker_threads = -1;
 TUNABLE_INT("kern.cam.ctl.worker_threads", &worker_threads);
 SYSCTL_INT(_kern_cam_ctl, OID_AUTO, worker_threads, CTLFLAG_RDTUN,
     &worker_threads, 1, "Number of worker threads");
-static int verbose = 0;
-TUNABLE_INT("kern.cam.ctl.verbose", &verbose);
-SYSCTL_INT(_kern_cam_ctl, OID_AUTO, verbose, CTLFLAG_RWTUN,
-    &verbose, 0, "Show SCSI errors returned to initiator");
+static int ctl_debug = CTL_DEBUG_NONE;
+TUNABLE_INT("kern.cam.ctl.debug", &ctl_debug);
+SYSCTL_INT(_kern_cam_ctl, OID_AUTO, debug, CTLFLAG_RWTUN,
+    &ctl_debug, 0, "Enabled debug flags");
 
 /*
  * Supported pages (0x00), Serial number (0x80), Device ID (0x83),
@@ -5294,6 +5294,8 @@ ctl_config_move_done(union ctl_io *io)
 		 *
 		 * - Call some other function once the data is in?
 		 */
+		if (ctl_debug & CTL_DEBUG_CDB_DATA)
+			ctl_data_print(io);
 
 		/*
 		 * XXX KDM call ctl_scsiio() again for now, and check flag
@@ -13766,17 +13768,14 @@ ctl_process_done(union ctl_io *io)
 	case CTL_IO_SCSI:
 		break;
 	case CTL_IO_TASK:
-		if (bootverbose || verbose > 0)
+		if (bootverbose || (ctl_debug & CTL_DEBUG_INFO))
 			ctl_io_error_print(io, NULL);
 		if (io->io_hdr.flags & CTL_FLAG_FROM_OTHER_SC)
 			ctl_free_io(io);
 		else
 			fe_done(io);
 		return (CTL_RETVAL_COMPLETE);
-		break;
 	default:
-		printf("ctl_process_done: invalid io type %d\n",
-		       io->io_hdr.io_type);
 		panic("ctl_process_done: invalid io type %d\n",
 		      io->io_hdr.io_type);
 		break; /* NOTREACHED */
@@ -13870,74 +13869,28 @@ ctl_process_done(union ctl_io *io)
 		ctl_set_task_aborted(&io->scsiio);
 
 	/*
-	 * We print out status for every task management command.  For SCSI
-	 * commands, we filter out any unit attention errors; they happen
-	 * on every boot, and would clutter up the log.  Note:  task
-	 * management commands aren't printed here, they are printed above,
-	 * since they should never even make it down here.
+	 * If enabled, print command error status.
+	 * We don't print UAs unless debugging was enabled explicitly.
 	 */
-	switch (io->io_hdr.io_type) {
-	case CTL_IO_SCSI: {
-		int error_code, sense_key, asc, ascq;
-
-		sense_key = 0;
+	do {
+		if ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS)
+			break;
+		if (!bootverbose && (ctl_debug & CTL_DEBUG_INFO) == 0)
+			break;
+		if ((ctl_debug & CTL_DEBUG_INFO) == 0 &&
+		    ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_SCSI_ERROR) &&
+		     (io->scsiio.scsi_status == SCSI_STATUS_CHECK_COND)) {
+			int error_code, sense_key, asc, ascq;
 
-		if (((io->io_hdr.status & CTL_STATUS_MASK) == CTL_SCSI_ERROR)
-		 && (io->scsiio.scsi_status == SCSI_STATUS_CHECK_COND)) {
-			/*
-			 * Since this is just for printing, no need to
-			 * show errors here.
-			 */
 			scsi_extract_sense_len(&io->scsiio.sense_data,
-					       io->scsiio.sense_len,
-					       &error_code,
-					       &sense_key,
-					       &asc,
-					       &ascq,
-					       /*show_errors*/ 0);
+			    io->scsiio.sense_len, &error_code, &sense_key,
+			    &asc, &ascq, /*show_errors*/ 0);
+			if (sense_key == SSD_KEY_UNIT_ATTENTION)
+				break;
 		}
 
-		if (((io->io_hdr.status & CTL_STATUS_MASK) != CTL_SUCCESS)
-		 && (((io->io_hdr.status & CTL_STATUS_MASK) != CTL_SCSI_ERROR)
-		  || (io->scsiio.scsi_status != SCSI_STATUS_CHECK_COND)
-		  || (sense_key != SSD_KEY_UNIT_ATTENTION))) {
-
-			if ((time_uptime - ctl_softc->last_print_jiffies) <= 0){
-				ctl_softc->skipped_prints++;
-			} else {
-				uint32_t skipped_prints;
-
-				skipped_prints = ctl_softc->skipped_prints;
-
-				ctl_softc->skipped_prints = 0;
-				ctl_softc->last_print_jiffies = time_uptime;
-
-				if (skipped_prints > 0) {
-#ifdef NEEDTOPORT
-					csevent_log(CSC_CTL | CSC_SHELF_SW |
-					    CTL_ERROR_REPORT,
-					    csevent_LogType_Trace,
-					    csevent_Severity_Information,
-					    csevent_AlertLevel_Green,
-					    csevent_FRU_Firmware,
-					    csevent_FRU_Unknown,
-					    "High CTL error volume, %d prints "
-					    "skipped", skipped_prints);
-#endif
-				}
-				if (bootverbose || verbose > 0)
-					ctl_io_error_print(io, NULL);
-			}
-		}
-		break;
-	}
-	case CTL_IO_TASK:
-		if (bootverbose || verbose > 0)
-			ctl_io_error_print(io, NULL);
-		break;
-	default:
-		break;
-	}
+		ctl_io_error_print(io, NULL);
+	} while (0);
 
 	/*
 	 * Tell the FETD or the other shelf controller we're done with this
@@ -14082,6 +14035,8 @@ ctl_queue(union ctl_io *io)
 	switch (io->io_hdr.io_type) {
 	case CTL_IO_SCSI:
 	case CTL_IO_TASK:
+		if (ctl_debug & CTL_DEBUG_CDB)
+			ctl_io_print(io);
 		ctl_enqueue_incoming(io);
 		break;
 	default:

Modified: stable/10/sys/cam/ctl/ctl_debug.h
==============================================================================
--- stable/10/sys/cam/ctl/ctl_debug.h	Thu Oct 23 07:22:18 2014	(r273530)
+++ stable/10/sys/cam/ctl/ctl_debug.h	Thu Oct 23 07:36:33 2014	(r273531)
@@ -39,6 +39,16 @@
 #ifndef	_CTL_DEBUG_H_
 #define	_CTL_DEBUG_H_
 
+/*
+ * Debugging flags.
+ */
+typedef enum {
+	CTL_DEBUG_NONE		= 0x00,	/* no debugging */
+	CTL_DEBUG_INFO		= 0x01,	/* SCSI errors */
+	CTL_DEBUG_CDB		= 0x02,	/* SCSI CDBs and tasks */
+	CTL_DEBUG_CDB_DATA	= 0x04	/* SCSI CDB DATA */
+} ctl_debug_flags;
+
 #ifdef	CAM_CTL_DEBUG
 #define	CTL_DEBUG_PRINT(X)		\
 	do {				\

Modified: stable/10/sys/cam/ctl/ctl_private.h
==============================================================================
--- stable/10/sys/cam/ctl/ctl_private.h	Thu Oct 23 07:22:18 2014	(r273530)
+++ stable/10/sys/cam/ctl/ctl_private.h	Thu Oct 23 07:36:33 2014	(r273531)
@@ -456,8 +456,6 @@ struct ctl_softc {
 	uint32_t num_pools;
 	uint32_t cur_pool_id;
 	STAILQ_HEAD(, ctl_io_pool) io_pools;
-	time_t last_print_jiffies;
-	uint32_t skipped_prints;
 	struct ctl_thread threads[CTL_MAX_THREADS];
 	TAILQ_HEAD(tpc_tokens, tpc_token) tpc_tokens;
 	struct callout tpc_timeout;

Modified: stable/10/sys/cam/ctl/ctl_scsi_all.c
==============================================================================
--- stable/10/sys/cam/ctl/ctl_scsi_all.c	Thu Oct 23 07:22:18 2014	(r273530)
+++ stable/10/sys/cam/ctl/ctl_scsi_all.c	Thu Oct 23 07:36:33 2014	(r273531)
@@ -112,32 +112,10 @@ ctl_scsi_command_string(struct ctl_scsii
 void
 ctl_scsi_path_string(union ctl_io *io, char *path_str, int len)
 {
-	if (io->io_hdr.nexus.targ_target.wwid[0] == 0) {
-		snprintf(path_str, len, "(%ju:%d:%ju:%d): ",
-			 (uintmax_t)io->io_hdr.nexus.initid.id,
-			 io->io_hdr.nexus.targ_port,
-			 (uintmax_t)io->io_hdr.nexus.targ_target.id,
-			 io->io_hdr.nexus.targ_lun);
-	} else {
-		/*
-		 * XXX KDM find a better way to display FC WWIDs.
-		 */
-#ifdef _KERNEL
-		snprintf(path_str, len, "(%ju:%d:%#jx,%#jx:%d): ",
-			 (uintmax_t)io->io_hdr.nexus.initid.id,
-			 io->io_hdr.nexus.targ_port,
-			 (intmax_t)io->io_hdr.nexus.targ_target.wwid[0],
-			 (intmax_t)io->io_hdr.nexus.targ_target.wwid[1],
-			 io->io_hdr.nexus.targ_lun);
-#else /* _KERNEL */
-		snprintf(path_str, len, "(%ju:%d:%#jx,%#jx:%d): ",
-			 (uintmax_t)io->io_hdr.nexus.initid.id,
-			 io->io_hdr.nexus.targ_port,
-			 (intmax_t)io->io_hdr.nexus.targ_target.wwid[0],
-			 (intmax_t)io->io_hdr.nexus.targ_target.wwid[1],
-			 io->io_hdr.nexus.targ_lun);
-#endif /* _KERNEL */
-	}
+
+	snprintf(path_str, len, "(%u:%u:%u/%u): ",
+	    io->io_hdr.nexus.initid.id, io->io_hdr.nexus.targ_port,
+	    io->io_hdr.nexus.targ_lun, io->io_hdr.nexus.targ_mapped_lun);
 }
 
 /*

Modified: stable/10/sys/cam/ctl/ctl_util.c
==============================================================================
--- stable/10/sys/cam/ctl/ctl_util.c	Thu Oct 23 07:22:18 2014	(r273530)
+++ stable/10/sys/cam/ctl/ctl_util.c	Thu Oct 23 07:36:33 2014	(r273531)
@@ -731,69 +731,64 @@ ctl_scsi_task_string(struct ctl_taskio *
 }
 
 void
-ctl_io_error_sbuf(union ctl_io *io, struct scsi_inquiry_data *inq_data,
-		  struct sbuf *sb)
+ctl_io_sbuf(union ctl_io *io, struct sbuf *sb)
 {
-	struct ctl_status_desc *status_desc;
+	const char *task_desc;
 	char path_str[64];
-	unsigned int i;
-
-	status_desc = NULL;
-
-	for (i = 0; i < (sizeof(ctl_status_table)/sizeof(ctl_status_table[0]));
-	     i++) {
-		if ((io->io_hdr.status & CTL_STATUS_MASK) ==
-		     ctl_status_table[i].status) {
-			status_desc = &ctl_status_table[i];
-			break;
-		}
-	}
 
 	ctl_scsi_path_string(io, path_str, sizeof(path_str));
 
 	switch (io->io_hdr.io_type) {
 	case CTL_IO_SCSI:
 		sbuf_cat(sb, path_str);
-
 		ctl_scsi_command_string(&io->scsiio, NULL, sb);
-
-		sbuf_printf(sb, "\n");
-
-		sbuf_printf(sb, "%sTag: 0x%04x, Type: %d\n", path_str,
+		sbuf_printf(sb, " Tag: %#x/%d\n",
 			    io->scsiio.tag_num, io->scsiio.tag_type);
 		break;
-	case CTL_IO_TASK: {
-		const char *task_desc;
-
+	case CTL_IO_TASK:
 		sbuf_cat(sb, path_str);
-
 		task_desc = ctl_scsi_task_string(&io->taskio);
-
 		if (task_desc == NULL)
 			sbuf_printf(sb, "Unknown Task Action %d (%#x)",
-				    io->taskio.task_action,
-				    io->taskio.task_action);
+			    io->taskio.task_action, io->taskio.task_action);
 		else
 			sbuf_printf(sb, "Task Action: %s", task_desc);
-
-		sbuf_printf(sb, "\n");
-
 		switch (io->taskio.task_action) {
 		case CTL_TASK_ABORT_TASK:
-		case CTL_TASK_ABORT_TASK_SET:
-		case CTL_TASK_CLEAR_TASK_SET:
-			sbuf_printf(sb, "%sTag: 0x%04x, Type: %d\n", path_str,
-				    io->taskio.tag_num,
-				    io->taskio.tag_type);
+			sbuf_printf(sb, " Tag: %#x/%d\n",
+			    io->taskio.tag_num, io->taskio.tag_type);
 			break;
 		default:
+			sbuf_printf(sb, "\n");
 			break;
 		}
 		break;
-	}
 	default:
 		break;
 	}
+}
+
+void
+ctl_io_error_sbuf(union ctl_io *io, struct scsi_inquiry_data *inq_data,
+		  struct sbuf *sb)
+{
+	struct ctl_status_desc *status_desc;
+	char path_str[64];
+	unsigned int i;
+
+	ctl_io_sbuf(io, sb);
+
+	status_desc = NULL;
+	for (i = 0; i < (sizeof(ctl_status_table)/sizeof(ctl_status_table[0]));
+	     i++) {
+		if ((io->io_hdr.status & CTL_STATUS_MASK) ==
+		     ctl_status_table[i].status) {
+			status_desc = &ctl_status_table[i];
+			break;
+		}
+	}
+
+	ctl_scsi_path_string(io, path_str, sizeof(path_str));
 
 	sbuf_cat(sb, path_str);
 	if (status_desc == NULL)
@@ -815,23 +810,39 @@ ctl_io_error_sbuf(union ctl_io *io, stru
 }
 
 char *
+ctl_io_string(union ctl_io *io, char *str, int str_len)
+{
+	struct sbuf sb;
+
+	sbuf_new(&sb, str, str_len, SBUF_FIXEDLEN);
+	ctl_io_sbuf(io, &sb);
+	sbuf_finish(&sb);
+	return (sbuf_data(&sb));
+}
+
+char *
 ctl_io_error_string(union ctl_io *io, struct scsi_inquiry_data *inq_data,
 		    char *str, int str_len)
 {
 	struct sbuf sb;
 
 	sbuf_new(&sb, str, str_len, SBUF_FIXEDLEN);
-
 	ctl_io_error_sbuf(io, inq_data, &sb);
-
 	sbuf_finish(&sb);
-
 	return (sbuf_data(&sb));
 }
 
 #ifdef _KERNEL
 
 void
+ctl_io_print(union ctl_io *io)
+{
+	char str[512];
+
+	printf("%s", ctl_io_string(io, str, sizeof(str)));
+}
+
+void
 ctl_io_error_print(union ctl_io *io, struct scsi_inquiry_data *inq_data)
 {
 	char str[512];
@@ -856,6 +867,37 @@ ctl_io_error_print(union ctl_io *io, str
 
 }
 
+void
+ctl_data_print(union ctl_io *io)
+{
+	char str[128];
+	char path_str[64];
+	struct sbuf sb;
+	int i, j, len;
+
+	if (io->io_hdr.io_type != CTL_IO_SCSI)
+		return;
+	if (io->io_hdr.flags & CTL_FLAG_BUS_ADDR)
+		return;
+	if (io->io_hdr.flags & CTL_FLAG_EDPTR_SGLIST)	/* XXX: Implement */
+		return;
+	ctl_scsi_path_string(io, path_str, sizeof(path_str));
+	len = min(io->scsiio.kern_data_len, 4096);
+	for (i = 0; i < len; ) {
+		sbuf_new(&sb, str, sizeof(str), SBUF_FIXEDLEN);
+		sbuf_cat(&sb, path_str);
+		sbuf_printf(&sb, " %#6x:%04x:", io->scsiio.tag_num, i);
+		for (j = 0; j < 16 && i < len; i++, j++) {
+			if (j == 8)
+				sbuf_cat(&sb, " ");
+			sbuf_printf(&sb, " %02x", io->scsiio.kern_data_ptr[i]);
+		}
+		sbuf_cat(&sb, "\n");
+		sbuf_finish(&sb);
+		printf("%s", sbuf_data(&sb));
+	}
+}
+
 #else /* _KERNEL */
 
 void

Modified: stable/10/sys/cam/ctl/ctl_util.h
==============================================================================
--- stable/10/sys/cam/ctl/ctl_util.h	Thu Oct 23 07:22:18 2014	(r273530)
+++ stable/10/sys/cam/ctl/ctl_util.h	Thu Oct 23 07:36:33 2014	(r273531)
@@ -99,19 +99,20 @@ void ctl_scsi_free_io(union ctl_io *io);
 #endif /* !_KERNEL */
 void ctl_scsi_zero_io(union ctl_io *io);
 const char *ctl_scsi_task_string(struct ctl_taskio *taskio);
+void ctl_io_sbuf(union ctl_io *io, struct sbuf *sb);
 void ctl_io_error_sbuf(union ctl_io *io,
 		       struct scsi_inquiry_data *inq_data, struct sbuf *sb);
+char *ctl_io_string(union ctl_io *io, char *str, int str_len);
 char *ctl_io_error_string(union ctl_io *io,
 			  struct scsi_inquiry_data *inq_data, char *str,
 			  int str_len);
 #ifdef _KERNEL
-
+void ctl_io_print(union ctl_io *io);
 void ctl_io_error_print(union ctl_io *io, struct scsi_inquiry_data *inq_data);
+void ctl_data_print(union ctl_io *io);
 #else /* _KERNEL */
-void
-ctl_io_error_print(union ctl_io *io, struct scsi_inquiry_data *inq_data,
+void ctl_io_error_print(union ctl_io *io, struct scsi_inquiry_data *inq_data,
 		   FILE *ofile);
-
 #endif /* _KERNEL */
 
 __END_DECLS

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 07:37:49 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 5FA5E1CE;
 Thu, 23 Oct 2014 07:37:49 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 325D28C4;
 Thu, 23 Oct 2014 07:37:49 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N7bn5L073178;
 Thu, 23 Oct 2014 07:37:49 GMT (envelope-from mav@FreeBSD.org)
Received: (from mav@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N7bnHj073177;
 Thu, 23 Oct 2014 07:37:49 GMT (envelope-from mav@FreeBSD.org)
Message-Id: <201410230737.s9N7bnHj073177@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org
 using -f
From: Alexander Motin 
Date: Thu, 23 Oct 2014 07:37:49 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject: svn commit: r273532 - stable/10/sys/cam/ctl
X-SVN-Group: stable-10
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 07:37:49 -0000

Author: mav
Date: Thu Oct 23 07:37:48 2014
New Revision: 273532
URL: https://svnweb.freebsd.org/changeset/base/273532

Log:
  MFC r273259:
  Make VPD 80h (Serial Number) transfer length match serial number length.

Modified:
  stable/10/sys/cam/ctl/ctl.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl.c
==============================================================================
--- stable/10/sys/cam/ctl/ctl.c	Thu Oct 23 07:36:33 2014	(r273531)
+++ stable/10/sys/cam/ctl/ctl.c	Thu Oct 23 07:37:48 2014	(r273532)
@@ -9963,17 +9963,17 @@ ctl_inquiry_evpd_serial(struct ctl_scsii
 {
 	struct scsi_vpd_unit_serial_number *sn_ptr;
 	struct ctl_lun *lun;
+	int data_len;
 
 	lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr;
 
-	ctsio->kern_data_ptr = malloc(sizeof(*sn_ptr), M_CTL, M_WAITOK | M_ZERO);
+	data_len = 4 + CTL_SN_LEN;
+	ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO);
 	sn_ptr = (struct scsi_vpd_unit_serial_number *)ctsio->kern_data_ptr;
-	ctsio->kern_sg_entries = 0;
-
-	if (sizeof(*sn_ptr) < alloc_len) {
-		ctsio->residual = alloc_len - sizeof(*sn_ptr);
-		ctsio->kern_data_len = sizeof(*sn_ptr);
-		ctsio->kern_total_len = sizeof(*sn_ptr);
+	if (data_len < alloc_len) {
+		ctsio->residual = alloc_len - data_len;
+		ctsio->kern_data_len = data_len;
+		ctsio->kern_total_len = data_len;
 	} else {
 		ctsio->residual = 0;
 		ctsio->kern_data_len = alloc_len;
@@ -9995,16 +9995,16 @@ ctl_inquiry_evpd_serial(struct ctl_scsii
 		sn_ptr->device = (SID_QUAL_LU_OFFLINE << 5) | T_DIRECT;
 
 	sn_ptr->page_code = SVPD_UNIT_SERIAL_NUMBER;
-	sn_ptr->length = ctl_min(sizeof(*sn_ptr) - 4, CTL_SN_LEN);
+	sn_ptr->length = CTL_SN_LEN;
 	/*
 	 * If we don't have a LUN, we just leave the serial number as
 	 * all spaces.
 	 */
-	memset(sn_ptr->serial_num, 0x20, sizeof(sn_ptr->serial_num));
 	if (lun != NULL) {
 		strncpy((char *)sn_ptr->serial_num,
 			(char *)lun->be_lun->serial_num, CTL_SN_LEN);
-	}
+	} else
+		memset(sn_ptr->serial_num, 0x20, CTL_SN_LEN);
 	ctsio->scsi_status = SCSI_STATUS_OK;
 
 	ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED;

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 07:54:47 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 7BD118D9;
 Thu, 23 Oct 2014 07:54:47 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 6803BAC2;
 Thu, 23 Oct 2014 07:54:47 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N7slQd082118;
 Thu, 23 Oct 2014 07:54:47 GMT (envelope-from ngie@FreeBSD.org)
Received: (from ngie@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N7slW1082117;
 Thu, 23 Oct 2014 07:54:47 GMT (envelope-from ngie@FreeBSD.org)
Message-Id: <201410230754.s9N7slW1082117@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org
 using -f
From: Garrett Cooper 
Date: Thu, 23 Oct 2014 07:54:47 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273533 - head/contrib/netbsd-tests/lib/libc/sys
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 07:54:47 -0000

Author: ngie
Date: Thu Oct 23 07:54:46 2014
New Revision: 273533
URL: https://svnweb.freebsd.org/changeset/base/273533

Log:
  Use /truncate_test.root_owned instead of /usr/bin/fpr as fpr does
  not exist on FreeBSD
  
  truncate_test.root_owned will be generated at build time and owned by root
  
  In collaboration with: pho
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/contrib/netbsd-tests/lib/libc/sys/t_truncate.c

Modified: head/contrib/netbsd-tests/lib/libc/sys/t_truncate.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/sys/t_truncate.c	Thu Oct 23 07:37:48 2014	(r273532)
+++ head/contrib/netbsd-tests/lib/libc/sys/t_truncate.c	Thu Oct 23 07:54:46 2014	(r273533)
@@ -40,6 +40,10 @@ __RCSID("$NetBSD: t_truncate.c,v 1.2 201
 #include 
 #include 
 
+#ifdef __FreeBSD__
+#include 
+#endif
+
 static const char path[] = "truncate";
 static const size_t sizes[] = { 8, 16, 512, 1024, 2048, 4094, 3000, 30 };
 
@@ -149,6 +153,9 @@ ATF_TC_HEAD(truncate_err, tc)
 
 ATF_TC_BODY(truncate_err, tc)
 {
+#ifndef __NetBSD__
+	char buf[PATH_MAX];
+#endif
 
 	errno = 0;
 	ATF_REQUIRE_ERRNO(EFAULT, truncate((void *)-1, 999) == -1);
@@ -160,7 +167,13 @@ ATF_TC_BODY(truncate_err, tc)
 	ATF_REQUIRE_ERRNO(ENOENT, truncate("/a/b/c/d/e/f/g", 999) == -1);
 
 	errno = 0;
+#ifdef __NetBSD__
 	ATF_REQUIRE_ERRNO(EACCES, truncate("/usr/bin/fpr", 999) == -1);
+#else
+	snprintf(buf, sizeof(buf), "%s/truncate_test.root_owned",
+	    atf_tc_get_config_var(tc, "srcdir"));
+	ATF_REQUIRE_ERRNO(EACCES, truncate(buf, 999) == -1);
+#endif
 }
 
 ATF_TP_ADD_TCS(tp)

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 08:00:00 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 94293A8A;
 Thu, 23 Oct 2014 08:00:00 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 80AECAFF;
 Thu, 23 Oct 2014 08:00:00 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N80073082881;
 Thu, 23 Oct 2014 08:00:00 GMT (envelope-from ngie@FreeBSD.org)
Received: (from ngie@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N8006Q082880;
 Thu, 23 Oct 2014 08:00:00 GMT (envelope-from ngie@FreeBSD.org)
Message-Id: <201410230800.s9N8006Q082880@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org
 using -f
From: Garrett Cooper 
Date: Thu, 23 Oct 2014 08:00:00 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273534 - head/contrib/netbsd-tests/lib/libc/sys
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 08:00:00 -0000

Author: ngie
Date: Thu Oct 23 07:59:59 2014
New Revision: 273534
URL: https://svnweb.freebsd.org/changeset/base/273534

Log:
  - Mark sig/signo __unused
  - Do not provide a relative path via #include "h_macros.h"
  
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/contrib/netbsd-tests/lib/libc/sys/t_sigaction.c

Modified: head/contrib/netbsd-tests/lib/libc/sys/t_sigaction.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/sys/t_sigaction.c	Thu Oct 23 07:54:46 2014	(r273533)
+++ head/contrib/netbsd-tests/lib/libc/sys/t_sigaction.c	Thu Oct 23 07:59:59 2014	(r273534)
@@ -42,12 +42,20 @@ __RCSID("$NetBSD: t_sigaction.c,v 1.2 20
 #include 
 #include 
 
+#ifdef __NetBSD__
 #include "../../../h_macros.h"
+#else
+#include "h_macros.h"
+#endif
 
 static bool handler_called = false;
 
 static void
+#ifdef __FreeBSD__
+handler(int signo __unused)
+#else
 handler(int signo)
+#endif
 {
     handler_called = true;
 }
@@ -80,7 +88,11 @@ wait_and_check_child(const pid_t pid, co
 }
 
 static void
+#ifdef __FreeBSD__
+catch(int sig __unused)
+#else
 catch(int sig)
+#endif
 {
 	return;
 }

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 08:05:04 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id C5C5EC5B;
 Thu, 23 Oct 2014 08:05:04 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 9891EBD5;
 Thu, 23 Oct 2014 08:05:04 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N854Rn087006;
 Thu, 23 Oct 2014 08:05:04 GMT (envelope-from ngie@FreeBSD.org)
Received: (from ngie@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N854dD087005;
 Thu, 23 Oct 2014 08:05:04 GMT (envelope-from ngie@FreeBSD.org)
Message-Id: <201410230805.s9N854dD087005@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org
 using -f
From: Garrett Cooper 
Date: Thu, 23 Oct 2014 08:05:04 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273535 - head/contrib/netbsd-tests/lib/libc/sys
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 08:05:04 -0000

Author: ngie
Date: Thu Oct 23 08:05:03 2014
New Revision: 273535
URL: https://svnweb.freebsd.org/changeset/base/273535

Log:
  - Omit setrlimit_nthr testcase on FreeBSD (requires lwp.h, et al)
  - Expect overflow with rlim_max at INT64_MAX, not UINT64_MAX (rlim_t is int64_t
  on FreeBSD)
  
  In collaboration with: pho
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c

Modified: head/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c	Thu Oct 23 07:59:59 2014	(r273534)
+++ head/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c	Thu Oct 23 08:05:03 2014	(r273535)
@@ -39,7 +39,9 @@ __RCSID("$NetBSD: t_setrlimit.c,v 1.4 20
 #include 
 #include 
 #include 
+#ifdef __NetBSD__
 #include 
+#endif
 #include 
 #include 
 #include 
@@ -438,6 +440,7 @@ ATF_TC_BODY(setrlimit_nproc, tc)
 		atf_tc_fail("RLIMIT_NPROC not enforced");
 }
 
+#ifdef __NetBSD__
 ATF_TC(setrlimit_nthr);
 ATF_TC_HEAD(setrlimit_nthr, tc)
 {
@@ -474,6 +477,7 @@ ATF_TC_BODY(setrlimit_nthr, tc)
 	makecontext(&c, func, 1, &lwpid);
 	ATF_CHECK_ERRNO(EAGAIN, _lwp_create(&c, 0, &lwpid) == -1);
 }
+#endif
 
 ATF_TC(setrlimit_perm);
 ATF_TC_HEAD(setrlimit_perm, tc)
@@ -494,7 +498,11 @@ ATF_TC_BODY(setrlimit_perm, tc)
 
 		ATF_REQUIRE(getrlimit(rlimit[i], &res) == 0);
 
+#ifdef __FreeBSD__
+		if (res.rlim_max == INT64_MAX) /* Overflow. */
+#else
 		if (res.rlim_max == UINT64_MAX) /* Overflow. */
+#endif
 			continue;
 
 		errno = 0;
@@ -516,7 +524,9 @@ ATF_TP_ADD_TCS(tp)
 	ATF_TP_ADD_TC(tp, setrlimit_nofile_2);
 	ATF_TP_ADD_TC(tp, setrlimit_nproc);
 	ATF_TP_ADD_TC(tp, setrlimit_perm);
+#ifdef __FreeBSD__
 	ATF_TP_ADD_TC(tp, setrlimit_nthr);
+#endif
 
 	return atf_no_error();
 }

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 08:05:48 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 41F18D9E;
 Thu, 23 Oct 2014 08:05:48 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 2E77EBDD;
 Thu, 23 Oct 2014 08:05:48 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N85mma087128;
 Thu, 23 Oct 2014 08:05:48 GMT (envelope-from ngie@FreeBSD.org)
Received: (from ngie@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N85mTr087127;
 Thu, 23 Oct 2014 08:05:48 GMT (envelope-from ngie@FreeBSD.org)
Message-Id: <201410230805.s9N85mTr087127@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org
 using -f
From: Garrett Cooper 
Date: Thu, 23 Oct 2014 08:05:48 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273536 - head/contrib/netbsd-tests/lib/libc/sys
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 08:05:48 -0000

Author: ngie
Date: Thu Oct 23 08:05:47 2014
New Revision: 273536
URL: https://svnweb.freebsd.org/changeset/base/273536

Log:
  Add limits.h #include for SSIZE_MAX
  
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/contrib/netbsd-tests/lib/libc/sys/t_msgsnd.c

Modified: head/contrib/netbsd-tests/lib/libc/sys/t_msgsnd.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/sys/t_msgsnd.c	Thu Oct 23 08:05:03 2014	(r273535)
+++ head/contrib/netbsd-tests/lib/libc/sys/t_msgsnd.c	Thu Oct 23 08:05:47 2014	(r273536)
@@ -47,6 +47,10 @@ __RCSID("$NetBSD: t_msgsnd.c,v 1.2 2011/
 #include 
 #include 
 
+#if defined(__FreeBSD__)
+#include 
+#endif
+
 #define MSG_KEY		1234
 #define MSG_MTYPE_1	0x41
 #define	MSG_MTYPE_2	0x42

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 08:06:35 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 1A96CEEE;
 Thu, 23 Oct 2014 08:06:35 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 071A5BED;
 Thu, 23 Oct 2014 08:06:35 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N86Yrk087285;
 Thu, 23 Oct 2014 08:06:34 GMT (envelope-from ngie@FreeBSD.org)
Received: (from ngie@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N86Y06087284;
 Thu, 23 Oct 2014 08:06:34 GMT (envelope-from ngie@FreeBSD.org)
Message-Id: <201410230806.s9N86Y06087284@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org
 using -f
From: Garrett Cooper 
Date: Thu, 23 Oct 2014 08:06:34 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273537 - head/contrib/netbsd-tests/lib/libc/sys
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 08:06:35 -0000

Author: ngie
Date: Thu Oct 23 08:06:34 2014
New Revision: 273537
URL: https://svnweb.freebsd.org/changeset/base/273537

Log:
  Add limits.h #include for SSIZE_MAX
  
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/contrib/netbsd-tests/lib/libc/sys/t_msgrcv.c

Modified: head/contrib/netbsd-tests/lib/libc/sys/t_msgrcv.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/sys/t_msgrcv.c	Thu Oct 23 08:05:47 2014	(r273536)
+++ head/contrib/netbsd-tests/lib/libc/sys/t_msgrcv.c	Thu Oct 23 08:06:34 2014	(r273537)
@@ -47,6 +47,10 @@ __RCSID("$NetBSD: t_msgrcv.c,v 1.3 2013/
 #include 
 #include 
 
+#if defined(__FreeBSD__)
+#include 
+#endif
+
 #define MSG_KEY		1234
 #define MSG_MTYPE_1	0x41
 #define	MSG_MTYPE_2	0x42

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 08:12:32 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 7BE8115D;
 Thu, 23 Oct 2014 08:12:32 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 684FCCBF;
 Thu, 23 Oct 2014 08:12:32 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N8CW2D091594;
 Thu, 23 Oct 2014 08:12:32 GMT (envelope-from ngie@FreeBSD.org)
Received: (from ngie@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N8CW1n091593;
 Thu, 23 Oct 2014 08:12:32 GMT (envelope-from ngie@FreeBSD.org)
Message-Id: <201410230812.s9N8CW1n091593@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org
 using -f
From: Garrett Cooper 
Date: Thu, 23 Oct 2014 08:12:32 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273538 - head/contrib/netbsd-tests/lib/libc/sys
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 08:12:32 -0000

Author: ngie
Date: Thu Oct 23 08:12:31 2014
New Revision: 273538
URL: https://svnweb.freebsd.org/changeset/base/273538

Log:
  Fix a typo (__FreeBSD__ -> __NetBSD__ when omitting setrlimit_nthr)

Modified:
  head/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c

Modified: head/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c	Thu Oct 23 08:06:34 2014	(r273537)
+++ head/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c	Thu Oct 23 08:12:31 2014	(r273538)
@@ -524,7 +524,7 @@ ATF_TP_ADD_TCS(tp)
 	ATF_TP_ADD_TC(tp, setrlimit_nofile_2);
 	ATF_TP_ADD_TC(tp, setrlimit_nproc);
 	ATF_TP_ADD_TC(tp, setrlimit_perm);
-#ifdef __FreeBSD__
+#ifdef __NetBSD__
 	ATF_TP_ADD_TC(tp, setrlimit_nthr);
 #endif
 

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 08:13:08 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 1975C2A6;
 Thu, 23 Oct 2014 08:13:08 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 05A81CCA;
 Thu, 23 Oct 2014 08:13:08 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N8D7Qp091714;
 Thu, 23 Oct 2014 08:13:07 GMT (envelope-from ngie@FreeBSD.org)
Received: (from ngie@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N8D7RV091713;
 Thu, 23 Oct 2014 08:13:07 GMT (envelope-from ngie@FreeBSD.org)
Message-Id: <201410230813.s9N8D7RV091713@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org
 using -f
From: Garrett Cooper 
Date: Thu, 23 Oct 2014 08:13:07 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273539 - head/contrib/netbsd-tests/lib/libc/sys
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 08:13:08 -0000

Author: ngie
Date: Thu Oct 23 08:13:07 2014
New Revision: 273539
URL: https://svnweb.freebsd.org/changeset/base/273539

Log:
  Mark signum __unused
  
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/contrib/netbsd-tests/lib/libc/sys/t_select.c

Modified: head/contrib/netbsd-tests/lib/libc/sys/t_select.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/sys/t_select.c	Thu Oct 23 08:12:31 2014	(r273538)
+++ head/contrib/netbsd-tests/lib/libc/sys/t_select.c	Thu Oct 23 08:13:07 2014	(r273539)
@@ -47,13 +47,21 @@
 static sig_atomic_t keep_going = 1;
 
 static void
+#ifdef __FreeBSD__
+sig_handler(int signum __unused)
+#else
 sig_handler(int signum)
+#endif
 {
 	keep_going = 0;
 }
 
 static void
+#ifdef __FreeBSD__
+sigchld(int signum __unused)
+#else
 sigchld(int signum)
+#endif
 {
 }
 

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 08:29:10 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id B15BD651;
 Thu, 23 Oct 2014 08:29:10 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 9DADBDF2;
 Thu, 23 Oct 2014 08:29:10 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N8TAww097071;
 Thu, 23 Oct 2014 08:29:10 GMT (envelope-from ngie@FreeBSD.org)
Received: (from ngie@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N8TABZ097070;
 Thu, 23 Oct 2014 08:29:10 GMT (envelope-from ngie@FreeBSD.org)
Message-Id: <201410230829.s9N8TABZ097070@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org
 using -f
From: Garrett Cooper 
Date: Thu, 23 Oct 2014 08:29:10 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273540 - head/contrib/netbsd-tests/lib/libc/sys
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 08:29:10 -0000

Author: ngie
Date: Thu Oct 23 08:29:09 2014
New Revision: 273540
URL: https://svnweb.freebsd.org/changeset/base/273540

Log:
  Omit the mprotect_exec testcase on FreeBSD
  
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/contrib/netbsd-tests/lib/libc/sys/t_mprotect.c

Modified: head/contrib/netbsd-tests/lib/libc/sys/t_mprotect.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/sys/t_mprotect.c	Thu Oct 23 08:13:07 2014	(r273539)
+++ head/contrib/netbsd-tests/lib/libc/sys/t_mprotect.c	Thu Oct 23 08:29:09 2014	(r273540)
@@ -44,7 +44,9 @@ __RCSID("$NetBSD: t_mprotect.c,v 1.3 201
 
 #include 
 
+#ifdef __NetBSD__
 #include "../common/exec_prot.h"
+#endif
 
 static long	page = 0;
 static int	pax_global = -1;
@@ -160,6 +162,7 @@ ATF_TC_BODY(mprotect_err, tc)
 	ATF_REQUIRE(errno == EINVAL);
 }
 
+#ifdef __NetBSD__
 ATF_TC(mprotect_exec);
 ATF_TC_HEAD(mprotect_exec, tc)
 {
@@ -242,6 +245,7 @@ ATF_TC_BODY(mprotect_exec, tc)
 		break;
 	}
 }
+#endif
 
 ATF_TC(mprotect_pax);
 ATF_TC_HEAD(mprotect_pax, tc)
@@ -351,7 +355,9 @@ ATF_TP_ADD_TCS(tp)
 
 	ATF_TP_ADD_TC(tp, mprotect_access);
 	ATF_TP_ADD_TC(tp, mprotect_err);
+#ifdef __NetBSD__
 	ATF_TP_ADD_TC(tp, mprotect_exec);
+#endif
 	ATF_TP_ADD_TC(tp, mprotect_pax);
 	ATF_TP_ADD_TC(tp, mprotect_write);
 

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 11:01:50 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 919E87E7;
 Thu, 23 Oct 2014 11:01:50 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 723A5269;
 Thu, 23 Oct 2014 11:01:50 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NB1ogI072303;
 Thu, 23 Oct 2014 11:01:50 GMT (envelope-from melifaro@FreeBSD.org)
Received: (from melifaro@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NB1oRf072302;
 Thu, 23 Oct 2014 11:01:50 GMT (envelope-from melifaro@FreeBSD.org)
Message-Id: <201410231101.s9NB1oRf072302@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: melifaro set sender to
 melifaro@FreeBSD.org using -f
From: "Alexander V. Chernikov" 
Date: Thu, 23 Oct 2014 11:01:50 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273541 - head/sbin/ifconfig
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 11:01:50 -0000

Author: melifaro
Date: Thu Oct 23 11:01:49 2014
New Revision: 273541
URL: https://svnweb.freebsd.org/changeset/base/273541

Log:
  Show SFP+/QSFP memory map dump on higher verbose levels.
  
  Sponsored by:	Yandex LLC
  MFC after:	1 week

Modified:
  head/sbin/ifconfig/sfp.c

Modified: head/sbin/ifconfig/sfp.c
==============================================================================
--- head/sbin/ifconfig/sfp.c	Thu Oct 23 08:29:09 2014	(r273540)
+++ head/sbin/ifconfig/sfp.c	Thu Oct 23 11:01:49 2014	(r273541)
@@ -67,6 +67,9 @@ struct i2c_info {
 	int chip_id;
 };
 
+static void dump_i2c_data(struct i2c_info *ii, uint8_t addr, uint8_t off,
+    uint8_t len);
+
 struct _nv {
 	int v;
 	const char *n;
@@ -327,6 +330,9 @@ get_sfp_transceiver_class(struct i2c_inf
 	const char *tech_class;
 	uint8_t code;
 
+	unsigned char qbuf[8];
+	ii->f(ii, SFF_8472_BASE, SFF_8472_TRANS_START, 8, (caddr_t)qbuf);
+
 	/* Check 10G Ethernet/IB first */
 	ii->f(ii, SFF_8472_BASE, SFF_8472_TRANS_START, 1, (caddr_t)&code);
 	tech_class = find_zero_bit(eth_10g, code, 1);
@@ -662,6 +668,30 @@ read_i2c_generic(struct i2c_info *ii, ui
 }
 
 static void
+dump_i2c_data(struct i2c_info *ii, uint8_t addr, uint8_t off, uint8_t len)
+{
+	unsigned char buf[16];
+	int i, read;
+
+	while (len > 0) {
+		memset(buf, 0, sizeof(buf));
+		read = (len > sizeof(buf)) ? sizeof(buf) : len;
+		ii->f(ii, addr, off, read, buf);
+		if (ii->error != 0) {
+			fprintf(stderr, "Error reading i2c info\n");
+			return;
+		}
+
+		printf("\t");
+		for (i = 0; i < read; i++)
+			printf("%02X ", buf[i]);
+		printf("\n");
+		len -= read;
+		off += read;
+	}
+}
+
+static void
 print_qsfp_status(struct i2c_info *ii, int verbose)
 {
 	char buf[80], buf2[40], buf3[40];
@@ -703,6 +733,13 @@ print_qsfp_status(struct i2c_info *ii, i
 			printf("\tlane %d: RX: %s TX: %s\n", i, buf, buf2);
 		}
 	}
+
+	if (verbose > 2) {
+		printf("\n\tSFF8436 DUMP (0xA0 128..255 range):\n");
+		dump_i2c_data(ii, SFF_8436_BASE, 128, 128);
+		printf("\n\tSFF8436 DUMP (0xA0 0..81 range):\n");
+		dump_i2c_data(ii, SFF_8436_BASE, 0, 82);
+	}
 }
 
 static void
@@ -730,12 +767,12 @@ print_sfp_status(struct i2c_info *ii, in
 	get_sfp_connector(ii, buf3, sizeof(buf3));
 	if (ii->error == 0)
 		printf("\tplugged: %s %s (%s)\n", buf, buf2, buf3);
-	if (verbose > 2)
-		printf_sfp_transceiver_descr(ii, buf, sizeof(buf));
 	print_sfp_vendor(ii, buf, sizeof(buf));
 	if (ii->error == 0)
 		printf("\t%s\n", buf);
 
+	if (verbose > 5)
+		printf_sfp_transceiver_descr(ii, buf, sizeof(buf));
 	/*
 	 * Request current measurements iff they are provided:
 	 */
@@ -747,6 +784,11 @@ print_sfp_status(struct i2c_info *ii, in
 		get_sfp_tx_power(ii, buf2, sizeof(buf2));
 		printf("\tRX: %s TX: %s\n", buf, buf2);
 	}
+
+	if (verbose > 2) {
+		printf("\n\tSFF8472 DUMP (0xA0 0..127 range):\n");
+		dump_i2c_data(ii, SFF_8472_BASE, 0, 128);
+	}
 }
 
 void

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 12:02:28 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 7E1B0818;
 Thu, 23 Oct 2014 12:02:28 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 50608B62;
 Thu, 23 Oct 2014 12:02:28 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NC2SEN002288;
 Thu, 23 Oct 2014 12:02:28 GMT (envelope-from trasz@FreeBSD.org)
Received: (from trasz@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NC2SRB002287;
 Thu, 23 Oct 2014 12:02:28 GMT (envelope-from trasz@FreeBSD.org)
Message-Id: <201410231202.s9NC2SRB002287@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: trasz set sender to
 trasz@FreeBSD.org using -f
From: Edward Tomasz Napierala 
Date: Thu, 23 Oct 2014 12:02:28 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273543 - head/usr.sbin/ctld
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 12:02:28 -0000

Author: trasz
Date: Thu Oct 23 12:02:27 2014
New Revision: 273543
URL: https://svnweb.freebsd.org/changeset/base/273543

Log:
  Clean up (refactor) discovery a little; no functional changes.
  
  MFC after:	1 month
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/usr.sbin/ctld/discovery.c

Modified: head/usr.sbin/ctld/discovery.c
==============================================================================
--- head/usr.sbin/ctld/discovery.c	Thu Oct 23 11:12:27 2014	(r273542)
+++ head/usr.sbin/ctld/discovery.c	Thu Oct 23 12:02:27 2014	(r273543)
@@ -160,7 +160,7 @@ logout_new_response(struct pdu *request)
 }
 
 static void
-discovery_add_target(struct keys *response_keys, struct target *targ)
+discovery_add_target(struct keys *response_keys, const struct target *targ)
 {
 	struct portal *portal;
 	char *buf;
@@ -206,9 +206,12 @@ discovery(struct connection *conn)
 {
 	struct pdu *request, *response;
 	struct keys *request_keys, *response_keys;
-	struct target *targ;
+	const struct portal_group *pg;
+	const struct target *targ;
 	const char *send_targets;
 
+	pg = conn->conn_portal->p_portal_group;
+
 	log_debugx("beginning discovery session; waiting for Text PDU");
 	request = text_receive(conn);
 	request_keys = keys_new();
@@ -222,11 +225,8 @@ discovery(struct connection *conn)
 	response_keys = keys_new();
 
 	if (strcmp(send_targets, "All") == 0) {
-		TAILQ_FOREACH(targ,
-		    &conn->conn_portal->p_portal_group->pg_conf->conf_targets,
-		    t_next) {
-			if (targ->t_portal_group !=
-			    conn->conn_portal->p_portal_group) {
+		TAILQ_FOREACH(targ, &pg->pg_conf->conf_targets, t_next) {
+			if (targ->t_portal_group != pg) {
 				log_debugx("not returning target \"%s\"; "
 				    "belongs to a different portal group",
 				    targ->t_name);
@@ -235,8 +235,7 @@ discovery(struct connection *conn)
 			discovery_add_target(response_keys, targ);
 		}
 	} else {
-		targ = target_find(conn->conn_portal->p_portal_group->pg_conf,
-		    send_targets);
+		targ = target_find(pg->pg_conf, send_targets);
 		if (targ == NULL) {
 			log_debugx("initiator requested information on unknown "
 			    "target \"%s\"; returning nothing", send_targets);

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 12:38:07 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 38813F2B;
 Thu, 23 Oct 2014 12:38:07 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 2329EEA8;
 Thu, 23 Oct 2014 12:38:07 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NCc7Go017248;
 Thu, 23 Oct 2014 12:38:07 GMT (envelope-from dumbbell@FreeBSD.org)
Received: (from dumbbell@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NCc6ux017244;
 Thu, 23 Oct 2014 12:38:06 GMT (envelope-from dumbbell@FreeBSD.org)
Message-Id: <201410231238.s9NCc6ux017244@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: dumbbell set sender to
 dumbbell@FreeBSD.org using -f
From: Jean-Sebastien Pedron 
Date: Thu, 23 Oct 2014 12:38:06 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273544 - in head: sys/dev/vt sys/sys usr.sbin/vidcontrol
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 12:38:07 -0000

Author: dumbbell
Date: Thu Oct 23 12:38:05 2014
New Revision: 273544
URL: https://svnweb.freebsd.org/changeset/base/273544

Log:
  vt(4): Add PIO_VFONT_DEFAULT ioctl to restore the default builtin font
  
  To restore the default font using vidcontrol(1), use the "-f" flag
  without an argument:
      vidcontrol -f < /dev/ttyv0
  
  PR:		193910
  Differential Revision:	https://reviews.freebsd.org/D971
  Submitted by:	Marcin Cieslak 
  Reviewed by:	ray@, emaste@
  Approved by:	ray@
  MFC after:	1 week

Modified:
  head/sys/dev/vt/vt_core.c
  head/sys/sys/consio.h
  head/usr.sbin/vidcontrol/vidcontrol.1
  head/usr.sbin/vidcontrol/vidcontrol.c

Modified: head/sys/dev/vt/vt_core.c
==============================================================================
--- head/sys/dev/vt/vt_core.c	Thu Oct 23 12:02:27 2014	(r273543)
+++ head/sys/dev/vt/vt_core.c	Thu Oct 23 12:38:05 2014	(r273544)
@@ -2218,6 +2218,11 @@ skip_thunk:
 		vtfont_unref(vf);
 		return (error);
 	}
+	case PIO_VFONT_DEFAULT: {
+		/* Reset to default font. */
+		error = vt_change_font(vw, &vt_font_default);
+		return (error);
+	}
 	case GIO_SCRNMAP: {
 		scrmap_t *sm = (scrmap_t *)data;
 

Modified: head/sys/sys/consio.h
==============================================================================
--- head/sys/sys/consio.h	Thu Oct 23 12:02:27 2014	(r273543)
+++ head/sys/sys/consio.h	Thu Oct 23 12:38:05 2014	(r273544)
@@ -239,6 +239,7 @@ typedef struct vfnt	vfnt_t;
 #define GIO_FONT8x16	_IOR('c', 69, fnt16_t)
 #define PIO_VFONT	_IOW('c', 70, vfnt_t)
 #define GIO_VFONT	_IOR('c', 71, vfnt_t)
+#define PIO_VFONT_DEFAULT _IO('c', 72)
 
 /* get video mode information */
 struct colors	{

Modified: head/usr.sbin/vidcontrol/vidcontrol.1
==============================================================================
--- head/usr.sbin/vidcontrol/vidcontrol.1	Thu Oct 23 12:02:27 2014	(r273543)
+++ head/usr.sbin/vidcontrol/vidcontrol.1	Thu Oct 23 12:38:05 2014	(r273544)
@@ -26,9 +26,11 @@
 .Op Fl c Ar appearance
 .Oo
 .Fl f
+.Oo
 .Op Ar size
 .Ar file
 .Oc
+.Oc
 .Op Fl g Ar geometry
 .Op Fl h Ar size
 .Op Fl i Cm adapter | mode
@@ -136,8 +138,10 @@ The latter is actually a simulation.
 Print out current output screen map.
 .It Xo
 .Fl f
+.Oo
 .Op Ar size
 .Ar file
+.Oc
 .Xc
 Load font
 .Ar file
@@ -158,6 +162,14 @@ may be omitted, in this case
 .Nm
 will try to guess it from the size of font file.
 .Pp
+When using
+.Xr vt 4
+both
+.Ar size
+and
+.Ar font
+can be omitted, and the default font will be loaded.
+.Pp
 Note that older video cards, such as MDA and CGA, do not support
 software font.
 See also

Modified: head/usr.sbin/vidcontrol/vidcontrol.c
==============================================================================
--- head/usr.sbin/vidcontrol/vidcontrol.c	Thu Oct 23 12:02:27 2014	(r273543)
+++ head/usr.sbin/vidcontrol/vidcontrol.c	Thu Oct 23 12:38:05 2014	(r273544)
@@ -197,7 +197,7 @@ usage(void)
 {
 	if (vt4_mode)
 		fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n",
-"usage: vidcontrol [-CHPpx] [-b color] [-c appearance] [-f [size] file]",
+"usage: vidcontrol [-CHPpx] [-b color] [-c appearance] [-f [[size] file]]",
 "                  [-g geometry] [-h size] [-i adapter | mode]",
 "                  [-M char] [-m on | off] [-r foreground background]",
 "                  [-S on | off] [-s number] [-T xterm | cons25] [-t N | off]",
@@ -409,6 +409,19 @@ load_vt4mappingtable(unsigned int nmappi
 	return (t);
 }
 
+/*
+ * Set the default vt font.
+ */
+
+static void
+load_default_vt4font(void)
+{
+	if (ioctl(0, PIO_VFONT_DEFAULT) == -1) {
+		revert();
+		errc(1, errno, "loading default vt font");
+	}
+}
+
 static int
 load_vt4font(FILE *f)
 {
@@ -1328,7 +1341,7 @@ main(int argc, char **argv)
 	dumpopt = DUMP_FBF;
 	termmode = NULL;
 	if (vt4_mode)
-		opts = "b:Cc:f:g:h:Hi:M:m:pPr:S:s:T:t:x";
+		opts = "b:Cc:fg:h:Hi:M:m:pPr:S:s:T:t:x";
 	else
 		opts = "b:Cc:df:g:h:Hi:l:LM:m:pPr:S:s:T:t:x";
 
@@ -1349,15 +1362,23 @@ main(int argc, char **argv)
 			print_scrnmap();
 			break;
 		case 'f':
-			type = optarg;
-			font = nextarg(argc, argv, &optind, 'f', 0);
+			optarg = nextarg(argc, argv, &optind, 'f', 0);
+			if (optarg != NULL) {
+				font = nextarg(argc, argv, &optind, 'f', 0);
+
+				if (font == NULL) {
+					type = NULL;
+					font = optarg;
+				} else
+					type = optarg;
 
-			if (font == NULL) {
-				type = NULL;
-				font = optarg;
-			}
+				load_font(type, font);
+			} else {
+				if (!vt4_mode)
+					usage(); /* Switch syscons to ROM? */
 
-			load_font(type, font);
+				load_default_vt4font();
+			}
 			break;
 		case 'g':
 			if (sscanf(optarg, "%dx%d",

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 12:50:07 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 77167251;
 Thu, 23 Oct 2014 12:50:07 +0000 (UTC)
Received: from mail.made4.biz (mail.made4.biz [IPv6:2001:41d0:2:c018::1:3])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 36EC0FC0;
 Thu, 23 Oct 2014 12:50:07 +0000 (UTC)
Received: from 2a02-8428-011b-e000-0290-f5ff-fe9d-b78c.rev.sfr.net
 ([2a02:8428:11b:e000:290:f5ff:fe9d:b78c] helo=magellan.dumbbell.fr)
 by mail.made4.biz with esmtpsa (TLSv1.2:DHE-RSA-AES128-SHA:128)
 (Exim 4.84 (FreeBSD)) (envelope-from )
 id 1XhHq9-000DS1-6e; Thu, 23 Oct 2014 14:50:05 +0200
Message-ID: <5448F973.8050102@FreeBSD.org>
Date: Thu, 23 Oct 2014 14:49:55 +0200
From: =?UTF-8?B?SmVhbi1Tw6liYXN0aWVuIFDDqWRyb24=?= 
User-Agent: Mozilla/5.0 (X11; FreeBSD amd64;
 rv:31.0) Gecko/20100101 Thunderbird/31.1.2
MIME-Version: 1.0
To: svn-src-all@freebsd.org, Colin Percival 
Subject: Re: svn commit: r273487 - head/sys/kern
References: <201410222335.s9MNZW62045167@svn.freebsd.org>
In-Reply-To: <201410222335.s9MNZW62045167@svn.freebsd.org>
Content-Type: multipart/signed; micalg=pgp-sha512;
 protocol="application/pgp-signature";
 boundary="5siMQmWpgiEsfB9Vd6lr0NHwUw6hjAWRB"
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 12:50:07 -0000

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--5siMQmWpgiEsfB9Vd6lr0NHwUw6hjAWRB
Content-Type: multipart/mixed;
 boundary="------------080404040809030003020701"

This is a multi-part message in MIME format.
--------------080404040809030003020701
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Hi!

The following change triggers a kernel trap 12 when env is NULL:

> @@ -260,8 +262,10 @@ void
>  freeenv(char *env)
>  {
> =20
> -	if (dynamic_kenv)
> +	if (dynamic_kenv) {
> +		memset(env, 0, strlen(env));
>  		free(env, M_KENV);
> +	}
>  }

This happens very early in boot for me, just after the lines:
    WARNING: WITNESS option enabled, expect reduced performance.
    VT: running with driver "vga".

The attached simple patch fixes the problem.

What I don't know is if the same problem can occur in kern_unsetenv():

> @@ -437,6 +441,7 @@ kern_unsetenv(const char *name)
>  			kenvp[i++] =3D kenvp[j];
>  		kenvp[i] =3D NULL;
>  		mtx_unlock(&kenv_lock);
> +		memset(oldenv, 0, strlen(oldenv));
>  		free(oldenv, M_KENV);
>  		return (0);
>  	}

--=20
Jean-S=C3=A9bastien P=C3=A9dron

--------------080404040809030003020701
Content-Type: text/x-patch;
 name="kern_freeenv-trap12.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
 filename="kern_freeenv-trap12.patch"

Index: sys/kern/kern_environment.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- sys/kern/kern_environment.c	(revision 273540)
+++ sys/kern/kern_environment.c	(working copy)
@@ -262,7 +262,7 @@
 freeenv(char *env)
 {
=20
-	if (dynamic_kenv) {
+	if (dynamic_kenv && env !=3D NULL) {
 		memset(env, 0, strlen(env));
 		free(env, M_KENV);
 	}

--------------080404040809030003020701--

--5siMQmWpgiEsfB9Vd6lr0NHwUw6hjAWRB
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQJ8BAEBCgBmBQJUSPl9XxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ2NzA4N0ZEMUFFQUUwRTEyREJDNkE2RjAz
OUU5OTc2MUE1RkQ5NENDAAoJEDnpl2Gl/ZTMz2UP/jGE7gokzqLfafFummHJ/FJd
tmWOsL5T84kY+rrPw8WfLo5gTH962WqIRTEXivKoxFEAV442gAfYyrd+/HYvXStf
3NKMx2LLuTAjNcfx17EkJgh3zk96+OR9NvrZQvXYV0XyOAIKgOuUjR3PNrr26WCa
KSg80lOrlA52WdE3spuv5V/mXiaFUIydAZE4/fkCE1x928Ta3k0J5Jo73aqQOmG/
dQTljh2ClqOZ6mOmL9pzsJJGRc4G/EkgzqjdqZQE7nXJMZIgIKjpfRGDCaHt6uGO
EmhSh2e/o1V0RedFT4Wy2uzpenYQJXkM1K7kwK4p8bX8Swz9yumigkUQltgLWxlD
+6Bi1VU6BnLqzsHUXerMOPQQWCy0McbyQqj+B6rtsG/whkgPq2b5IvmMw8F137FW
xVPczD/aF3h3/uAKI9wKeAoSAWtU1M2zQimFGFKgpGsG3Xr6FWxjdPOhA8QsLHng
Vb28Vkel0DrHisfxEcJ4Tf1Nyy2is+slzNgkwUZgqPlKwJRE69kFmSVJFtSbaFtp
Ey8xK1BsbrertlkLlQ0HwhJobmk9Q9UjXte5L1hwk/ZJZ1qxainQm7bPcPlvJTw8
dzJdm+m9yYJAGE1H4Z/Q0RCoZzQYId/w4AbWymzVM1qs2rHtEgxfV9g0mGwINrhR
WHsOVrEjMdad906WlMqR
=wQkS
-----END PGP SIGNATURE-----

--5siMQmWpgiEsfB9Vd6lr0NHwUw6hjAWRB--

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 13:32:02 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 32D99AC7;
 Thu, 23 Oct 2014 13:32:02 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 1DFFC77E;
 Thu, 23 Oct 2014 13:32:02 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NDW1CO045071;
 Thu, 23 Oct 2014 13:32:01 GMT (envelope-from dumbbell@FreeBSD.org)
Received: (from dumbbell@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NDW1mK045070;
 Thu, 23 Oct 2014 13:32:01 GMT (envelope-from dumbbell@FreeBSD.org)
Message-Id: <201410231332.s9NDW1mK045070@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: dumbbell set sender to
 dumbbell@FreeBSD.org using -f
From: Jean-Sebastien Pedron 
Date: Thu, 23 Oct 2014 13:32:01 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject: svn commit: r273545 - stable/10/sys/dev/vt
X-SVN-Group: stable-10
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 13:32:02 -0000

Author: dumbbell
Date: Thu Oct 23 13:32:01 2014
New Revision: 273545
URL: https://svnweb.freebsd.org/changeset/base/273545

Log:
  vt(4): Refuse to load a font if hw.vga.textmode is selected
  
  Before, the font was loaded and the window size recalculated, giving an
  unusable terminal, even if the actual font didn't change.
  
  Reported by:	beeessdee@ruggedinbox.com
  MFC of:		r273330

Modified:
  stable/10/sys/dev/vt/vt_core.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/vt/vt_core.c
==============================================================================
--- stable/10/sys/dev/vt/vt_core.c	Thu Oct 23 12:38:05 2014	(r273544)
+++ stable/10/sys/dev/vt/vt_core.c	Thu Oct 23 13:32:01 2014	(r273545)
@@ -2200,6 +2200,9 @@ skip_thunk:
 	case PIO_VFONT: {
 		struct vt_font *vf;
 
+		if (vd->vd_flags & VDF_TEXTMODE)
+			return (ENOTSUP);
+
 		error = vtfont_load((void *)data, &vf);
 		if (error != 0)
 			return (error);

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 13:47:20 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 16751162;
 Thu, 23 Oct 2014 13:47:20 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 0261093A;
 Thu, 23 Oct 2014 13:47:20 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NDlJna050464;
 Thu, 23 Oct 2014 13:47:19 GMT (envelope-from loos@FreeBSD.org)
Received: (from loos@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NDlJkP050463;
 Thu, 23 Oct 2014 13:47:19 GMT (envelope-from loos@FreeBSD.org)
Message-Id: <201410231347.s9NDlJkP050463@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: loos set sender to loos@FreeBSD.org
 using -f
From: Luiz Otavio O Souza 
Date: Thu, 23 Oct 2014 13:47:19 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273546 - head/sys/dev/usb/net
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 13:47:20 -0000

Author: loos
Date: Thu Oct 23 13:47:19 2014
New Revision: 273546
URL: https://svnweb.freebsd.org/changeset/base/273546

Log:
  Fix a bug where some DTS layouts could cause the premature ending of the
  search (i.e. without returning any result) and you would end up with a
  random MAC address.
  
  Change the search algorithm to a recursive one to ensure that all the nodes
  on DTS will be verified.
  
  The previous algorithm could not keep up if the DTS has too many sub-nodes.
  
  While here, fix the punctuation on comments.

Modified:
  head/sys/dev/usb/net/if_smsc.c

Modified: head/sys/dev/usb/net/if_smsc.c
==============================================================================
--- head/sys/dev/usb/net/if_smsc.c	Thu Oct 23 13:32:01 2014	(r273545)
+++ head/sys/dev/usb/net/if_smsc.c	Thu Oct 23 13:47:19 2014	(r273546)
@@ -1556,57 +1556,56 @@ smsc_ioctl(struct ifnet *ifp, u_long cmd
 }
 
 #ifdef FDT
+static phandle_t
+smsc_fdt_find_eth_node(phandle_t start)
+{
+	phandle_t child, node;
+
+	/* Traverse through entire tree to find usb ethernet nodes. */
+	for (node = OF_child(start); node != 0; node = OF_peer(node)) {
+		if (fdt_is_compatible(node, "net,ethernet") &&
+		    fdt_is_compatible(node, "usb,device"))
+			return (node);
+		child = smsc_fdt_find_eth_node(node);
+		if (child != 0)
+			return (child);
+	}
+
+	return (0);
+}
+
 /**
- * Get MAC address from FDT blob. Firmware or loader should fill
- * mac-address or local-mac-address property Returns 0 if MAC address
- * obtained, error code otherwise
+ * Get MAC address from FDT blob.  Firmware or loader should fill
+ * mac-address or local-mac-address property.  Returns 0 if MAC address
+ * obtained, error code otherwise.
  */
 static int
 smsc_fdt_find_mac(unsigned char *mac)
 {
-	phandle_t child, parent, root;
+	phandle_t node, root;
 	int len;
 
 	root = OF_finddevice("/");
-	len = 0;
-	parent = root;
-
-	/* Traverse through entire tree to find nodes usb ethernet nodes */
-	for (child = OF_child(parent); child != 0; child = OF_peer(child)) {
-
-		/* Find a 'leaf'. Start the search from this node. */
-		while (OF_child(child)) {
-			parent = child;
-			child = OF_child(child);
-		}
-
-		if (fdt_is_compatible(child, "net,ethernet") &&
-		    fdt_is_compatible(child, "usb,device")) {
+	node = smsc_fdt_find_eth_node(root);
+	if (node != 0) {
 
-			/* Check if there is property */
-			if ((len = OF_getproplen(child, "local-mac-address")) > 0) {
-				if (len != ETHER_ADDR_LEN)
-					return (EINVAL);
-
-				OF_getprop(child, "local-mac-address", mac,
-				    ETHER_ADDR_LEN);
-				return (0);
-			}
-
-			if ((len = OF_getproplen(child, "mac-address")) > 0) {
-				if (len != ETHER_ADDR_LEN)
-					return (EINVAL);
-
-				OF_getprop(child, "mac-address", mac,
-				    ETHER_ADDR_LEN);
-				return (0);
-			}
+		/* Check if there is property */
+		if ((len = OF_getproplen(node, "local-mac-address")) > 0) {
+			if (len != ETHER_ADDR_LEN)
+				return (EINVAL);
+
+			OF_getprop(node, "local-mac-address", mac,
+			    ETHER_ADDR_LEN);
+			return (0);
 		}
 
-		if (OF_peer(child) == 0) {
-			/* No more siblings. */
-			child = parent;
-			parent = OF_parent(child);
+		if ((len = OF_getproplen(node, "mac-address")) > 0) {
+			if (len != ETHER_ADDR_LEN)
+				return (EINVAL);
+
+			OF_getprop(node, "mac-address", mac,
+			    ETHER_ADDR_LEN);
+			return (0);
 		}
 	}
 

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 14:29:53 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 6D1EAF54;
 Thu, 23 Oct 2014 14:29:53 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 59D43DA8;
 Thu, 23 Oct 2014 14:29:53 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NETrmL070031;
 Thu, 23 Oct 2014 14:29:53 GMT (envelope-from ae@FreeBSD.org)
Received: (from ae@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NETr9Y070030;
 Thu, 23 Oct 2014 14:29:53 GMT (envelope-from ae@FreeBSD.org)
Message-Id: <201410231429.s9NETr9Y070030@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: ae set sender to ae@FreeBSD.org
 using -f
From: "Andrey V. Elsukov" 
Date: Thu, 23 Oct 2014 14:29:53 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273547 - head/sys/net
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 14:29:53 -0000

Author: ae
Date: Thu Oct 23 14:29:52 2014
New Revision: 273547
URL: https://svnweb.freebsd.org/changeset/base/273547

Log:
  Move if_get_counter initialization from if_attach into if_alloc.
  Also, initialize all counters before ifnet will become available in the system.
  This fixes possible access to uninitialized ifned fields.
  
  PR:		194550

Modified:
  head/sys/net/if.c

Modified: head/sys/net/if.c
==============================================================================
--- head/sys/net/if.c	Thu Oct 23 13:47:19 2014	(r273546)
+++ head/sys/net/if.c	Thu Oct 23 14:29:52 2014	(r273547)
@@ -467,11 +467,10 @@ if_alloc(u_char type)
 	ifq_init(&ifp->if_snd, ifp);
 
 	refcount_init(&ifp->if_refcount, 1);	/* Index reference. */
-	ifnet_setbyindex(ifp->if_index, ifp);
-
 	for (int i = 0; i < IFCOUNTERS; i++)
 		ifp->if_counters[i] = counter_u64_alloc(M_WAITOK);
-
+	ifp->if_get_counter = if_get_counter_default;
+	ifnet_setbyindex(ifp->if_index, ifp);
 	return (ifp);
 }
 
@@ -674,9 +673,6 @@ if_attach_internal(struct ifnet *ifp, in
 		ifp->if_qflush = if_qflush;
 	}
 
-	if (ifp->if_get_counter == NULL)
-		ifp->if_get_counter = if_get_counter_default;
-
 	if (!vmove) {
 #ifdef MAC
 		mac_ifnet_create(ifp);

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 15:16:42 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 5E642A64;
 Thu, 23 Oct 2014 15:16:42 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 3F37735E;
 Thu, 23 Oct 2014 15:16:42 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NFGgfE093149;
 Thu, 23 Oct 2014 15:16:42 GMT (envelope-from emax@FreeBSD.org)
Received: (from emax@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NFGfqq093145;
 Thu, 23 Oct 2014 15:16:41 GMT (envelope-from emax@FreeBSD.org)
Message-Id: <201410231516.s9NFGfqq093145@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: emax set sender to emax@FreeBSD.org
 using -f
From: Maksim Yevmenkin 
Date: Thu, 23 Oct 2014 15:16:41 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273548 - head/usr.bin/bluetooth/rfcomm_sppd
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 15:16:42 -0000

Author: emax
Date: Thu Oct 23 15:16:40 2014
New Revision: 273548
URL: https://svnweb.freebsd.org/changeset/base/273548

Log:
  Change the code to use the openpty(3) API which uses the pts(4) driver
  instead of the pty(4) driver.
  
  PR:		184597
  Submitted by:	tobias.rehbein
  MFC after:	2 weeks

Modified:
  head/usr.bin/bluetooth/rfcomm_sppd/Makefile
  head/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.1
  head/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.c

Modified: head/usr.bin/bluetooth/rfcomm_sppd/Makefile
==============================================================================
--- head/usr.bin/bluetooth/rfcomm_sppd/Makefile	Thu Oct 23 14:29:52 2014	(r273547)
+++ head/usr.bin/bluetooth/rfcomm_sppd/Makefile	Thu Oct 23 15:16:40 2014	(r273548)
@@ -6,6 +6,6 @@ SRCS=		rfcomm_sppd.c rfcomm_sdp.c
 WARNS?=		2
 
 DPADD=		${LIBBLUETOOTH} ${LIBSDP}
-LDADD=		-lbluetooth -lsdp
+LDADD=		-lbluetooth -lsdp -lutil
 
 .include 

Modified: head/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.1
==============================================================================
--- head/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.1	Thu Oct 23 14:29:52 2014	(r273547)
+++ head/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.1	Thu Oct 23 15:16:40 2014	(r273548)
@@ -33,10 +33,9 @@
 .Nd RFCOMM Serial Port Profile daemon
 .Sh SYNOPSIS
 .Nm
-.Op Fl bhS
+.Op Fl bhtS
 .Fl a Ar address
 .Fl c Ar channel
-.Op Fl t Ar tty
 .Sh DESCRIPTION
 The
 .Nm
@@ -53,7 +52,7 @@ Once connection is established, the
 .Nm
 utility provides access to the server's remote serial port via stdin/stdout
 or via
-.Xr pty 4
+.Xr pts 4
 interface if
 .Fl t
 option was specified.
@@ -72,8 +71,7 @@ daemon.
 If
 .Fl t
 options was specified,
-the server side of the virtual serial port is attached to the pseudo-terminal
-.Ar tty .
+the server side of the virtual serial port is attached to a pseudo-terminal.
 Otherwise the virtual serial port is attached to the stdin/stdout.
 .Nm
 should be run as root in order to communicate with
@@ -146,24 +144,22 @@ Display usage message and exit.
 .It Fl S
 Server mode; see
 .Sx DESCRIPTION .
-.It Fl t Ar tty
-Slave pseudo tty name.
+.It Fl t
+Use slave pseudo tty.
 If not set stdin/stdout will be used.
 This option is required if
 .Fl b
 option was specified.
 .El
 .Sh FILES
-.Bl -tag -width ".Pa /dev/tty[p-sP-S][0-9a-v]" -compact
-.It Pa /dev/pty[p-sP-S][0-9a-v]
-master pseudo terminals
-.It Pa /dev/tty[p-sP-S][0-9a-v]
+.Bl -tag -width ".Pa /dev/pts/[num]" -compact
+.It Pa /dev/pts/[num]
 slave pseudo terminals
 .El
 .Sh EXIT STATUS
 .Ex -std
 .Sh EXAMPLES
-.Dl "rfcomm_sppd -a 00:01:02:03:04:05 -c 1 -t /dev/ttyp1"
+.Dl "rfcomm_sppd -a 00:01:02:03:04:05 -c 1 -t"
 .Pp
 Will start the
 .Nm
@@ -171,13 +167,17 @@ utility and open RFCOMM connection to th
 .Li 00:01:02:03:04:05
 and channel
 .Li 1 .
-Once the connection has been established,
-.Pa /dev/ttyp1
+Once the connection has been established, a
+.Xr pts 4
 can be used to talk to the remote serial port on the server.
+.Nm
+prints the name of the
+.Xr pts 4
+to use on stdout.
 .Sh SEE ALSO
 .Xr bluetooth 3 ,
 .Xr ng_btsocket 4 ,
-.Xr pty 4 ,
+.Xr pts 4 ,
 .Xr rfcomm_pppd 8 ,
 .Xr sdpd 8
 .Sh AUTHORS

Modified: head/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.c
==============================================================================
--- head/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.c	Thu Oct 23 14:29:52 2014	(r273547)
+++ head/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.c	Thu Oct 23 15:16:40 2014	(r273548)
@@ -32,6 +32,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -49,6 +50,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define SPPD_IDENT		"rfcomm_sppd"
 #define SPPD_BUFFER_SIZE	1024
@@ -58,7 +60,7 @@ int		rfcomm_channel_lookup	(bdaddr_t con
 					 bdaddr_t const *remote, 
 					 int service, int *channel, int *error);
 
-static int	sppd_ttys_open	(char const *tty, int *amaster, int *aslave);
+static int	sppd_ttys_open	(char **tty, int *amaster, int *aslave);
 static int	sppd_read	(int fd, char *buffer, int size);
 static int	sppd_write	(int fd, char *buffer, int size);
 static void	sppd_sighandler	(int s);
@@ -74,7 +76,8 @@ main(int argc, char *argv[]) 
 	struct sockaddr_rfcomm	 ra;
 	bdaddr_t		 addr;
 	int			 n, background, channel, service,
-				 s, amaster, aslave, fd, doserver;
+				 s, amaster, aslave, fd, doserver,
+				 dopty;
 	fd_set			 rfd;
 	char			*tty = NULL, *ep = NULL, buf[SPPD_BUFFER_SIZE];
 
@@ -82,9 +85,10 @@ main(int argc, char *argv[]) 
 	background = channel = 0;
 	service = SDP_SERVICE_CLASS_SERIAL_PORT;
 	doserver = 0;
+	dopty = 0;
 
 	/* Parse command line options */
-	while ((n = getopt(argc, argv, "a:bc:t:hS")) != -1) {
+	while ((n = getopt(argc, argv, "a:bc:thS")) != -1) {
 		switch (n) { 
 		case 'a': /* BDADDR */
 			if (!bt_aton(optarg, &addr)) {
@@ -130,11 +134,8 @@ main(int argc, char *argv[]) 
 			background = 1;
 			break;
 
-		case 't': /* Slave TTY name */
-			if (optarg[0] != '/')
-				asprintf(&tty, "%s%s", _PATH_DEV, optarg);
-			else
-				tty = optarg;
+		case 't': /* Open pseudo TTY */
+			dopty = 1;
 			break;
 
 		case 'S':
@@ -173,18 +174,18 @@ main(int argc, char *argv[]) 
 		err(1, "Could not sigaction(SIGCHLD)");
 
 	/* Open TTYs */
-	if (tty == NULL) {
+	if (dopty) {
+		if (sppd_ttys_open(&tty, &amaster, &aslave) < 0)
+			exit(1);
+
+		fd = amaster;
+	} else {
 		if (background)
 			usage();
 
 		amaster = STDIN_FILENO;
 		fd = STDOUT_FILENO;
-	} else {
-		if (sppd_ttys_open(tty, &amaster, &aslave) < 0)
-			exit(1);
-		
-		fd = amaster;
-	}		
+	}
 
 	/* Open RFCOMM connection */
 
@@ -287,6 +288,10 @@ main(int argc, char *argv[]) 
 	openlog(SPPD_IDENT, LOG_NDELAY|LOG_PERROR|LOG_PID, LOG_DAEMON);
 	syslog(LOG_INFO, "Starting on %s...", (tty != NULL)? tty : "stdin/stdout");
 
+	/* Print used tty on stdout for wrappers to pick up */
+	if (!background)
+		fprintf(stdout, "%s\n", tty);
+
 	for (done = 0; !done; ) {
 		FD_ZERO(&rfd);
 		FD_SET(amaster, &rfd);
@@ -359,70 +364,20 @@ main(int argc, char *argv[]) 
 
 /* Open TTYs */
 static int
-sppd_ttys_open(char const *tty, int *amaster, int *aslave)
+sppd_ttys_open(char **tty, int *amaster, int *aslave)
 {
-	char		 pty[PATH_MAX], *slash;
-	struct group	*gr = NULL;
-	gid_t		 ttygid;
+	char		 pty[PATH_MAX];
 	struct termios	 tio;
 
-	/*
-	 * Construct master PTY name. The slave tty name must be less then
-	 * PATH_MAX characters in length, must contain '/' character and 
-	 * must not end with '/'.
-	 */
-
-	if (strlen(tty) >= sizeof(pty)) {
-		syslog(LOG_ERR, "Slave tty name is too long");
-		return (-1);
-	}
-
-	strlcpy(pty, tty, sizeof(pty));
-	slash = strrchr(pty, '/');
-	if (slash == NULL || slash[1] == '\0') {
-		syslog(LOG_ERR, "Invalid slave tty name (%s)", tty);
-		return (-1);
-	}
-
-	slash[1] = 'p';
-	
-	if (strcmp(pty, tty) == 0) {
-		syslog(LOG_ERR, "Master and slave tty are the same (%s)", tty);
-		return (-1);
-	}
-
-	if ((*amaster = open(pty, O_RDWR, 0)) < 0) {
-		syslog(LOG_ERR, "Could not open(%s). %s", pty, strerror(errno));
-		return (-1);
-	}
-
-	/*
-	 * Slave TTY
-	 */
-
-	if ((gr = getgrnam("tty")) != NULL)
-		ttygid = gr->gr_gid;
-	else
-		ttygid = -1;
-
-	(void) chown(tty, getuid(), ttygid);
-	(void) chmod(tty, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
-	(void) revoke(tty);
+	cfmakeraw(&tio);
 
-	if ((*aslave = open(tty, O_RDWR, 0)) < 0) {
-		syslog(LOG_ERR, "Could not open(%s). %s", tty, strerror(errno));
-		close(*amaster);
+	if (openpty(amaster, aslave, pty, &tio, NULL) == -1) {
+		syslog(LOG_ERR, "Could not openpty(). %s", strerror(errno));
 		return (-1);
 	}
 
-	/*
-	 * Make slave TTY raw
-	 */
-
-	cfmakeraw(&tio);
-
-	if (tcsetattr(*aslave, TCSANOW, &tio) < 0) {
-		syslog(LOG_ERR, "Could not tcsetattr(). %s", strerror(errno));
+	if ((*tty = strdup(pty)) == NULL) {
+		syslog(LOG_ERR, "Could not strdup(). %s", strerror(errno));
 		close(*aslave);
 		close(*amaster);
 		return (-1);
@@ -496,7 +451,7 @@ usage(void)
 "\t-a address Peer address (required in client mode)\n" \
 "\t-b         Run in background\n" \
 "\t-c channel RFCOMM channel to connect to or listen on\n" \
-"\t-t tty     TTY name (required in background mode)\n" \
+"\t-t         use slave pseudo tty (required in background mode)\n" \
 "\t-S         Server mode\n" \
 "\t-h         Display this message\n", SPPD_IDENT);
 	exit(255);

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 15:35:47 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id EB564545;
 Thu, 23 Oct 2014 15:35:47 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id D8D7481C;
 Thu, 23 Oct 2014 15:35:47 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NFZleo002657;
 Thu, 23 Oct 2014 15:35:47 GMT (envelope-from mjg@FreeBSD.org)
Received: (from mjg@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NFZlbn002656;
 Thu, 23 Oct 2014 15:35:47 GMT (envelope-from mjg@FreeBSD.org)
Message-Id: <201410231535.s9NFZlbn002656@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org
 using -f
From: Mateusz Guzik 
Date: Thu, 23 Oct 2014 15:35:47 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273549 - head/sys/kern
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 15:35:48 -0000

Author: mjg
Date: Thu Oct 23 15:35:47 2014
New Revision: 273549
URL: https://svnweb.freebsd.org/changeset/base/273549

Log:
  Avoid taking the lock in selfdfree when not needed.

Modified:
  head/sys/kern/sys_generic.c

Modified: head/sys/kern/sys_generic.c
==============================================================================
--- head/sys/kern/sys_generic.c	Thu Oct 23 15:16:40 2014	(r273548)
+++ head/sys/kern/sys_generic.c	Thu Oct 23 15:35:47 2014	(r273549)
@@ -1600,10 +1600,11 @@ static void
 selfdfree(struct seltd *stp, struct selfd *sfp)
 {
 	STAILQ_REMOVE(&stp->st_selq, sfp, selfd, sf_link);
-	mtx_lock(sfp->sf_mtx);
-	if (sfp->sf_si)
+	if (sfp->sf_si != NULL) {
+		mtx_lock(sfp->sf_mtx);
 		TAILQ_REMOVE(&sfp->sf_si->si_tdlist, sfp, sf_threads);
-	mtx_unlock(sfp->sf_mtx);
+		mtx_unlock(sfp->sf_mtx);
+	}
 	uma_zfree(selfd_zone, sfp);
 }
 

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 17:24:51 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 14C817B2;
 Thu, 23 Oct 2014 17:24:51 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 0139E38F;
 Thu, 23 Oct 2014 17:24:51 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NHOoZ8053726;
 Thu, 23 Oct 2014 17:24:50 GMT (envelope-from jmg@FreeBSD.org)
Received: (from jmg@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NHOoTe053725;
 Thu, 23 Oct 2014 17:24:50 GMT (envelope-from jmg@FreeBSD.org)
Message-Id: <201410231724.s9NHOoTe053725@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: jmg set sender to jmg@FreeBSD.org
 using -f
From: John-Mark Gurney 
Date: Thu, 23 Oct 2014 17:24:50 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273550 - head/share/man/man9
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 17:24:51 -0000

Author: jmg
Date: Thu Oct 23 17:24:50 2014
New Revision: 273550
URL: https://svnweb.freebsd.org/changeset/base/273550

Log:
  minor updates to make it more explicit that when using fpu_kern_thread,
  you don't need to use fpu_kern_enter/_leave...
  
  Reviewed by:	kib

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

Modified: head/share/man/man9/fpu_kern.9
==============================================================================
--- head/share/man/man9/fpu_kern.9	Thu Oct 23 15:35:47 2014	(r273549)
+++ head/share/man/man9/fpu_kern.9	Thu Oct 23 17:24:50 2014	(r273550)
@@ -23,7 +23,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 23, 2014
+.Dd October 23, 2014
 .Dt FPU_KERN 9
 .Os
 .Sh NAME
@@ -157,12 +157,17 @@ There are no errors defined for the func
 .Pp
 The
 .Fn fpu_kern_thread
-function provides an optimization for threads which never leave to
+function enables an optimization for threads which never leave to
 the usermode.
-Such thread can reuse the usermode save area for the FPU state,
-which is allowed by the function call.
-There is no flags defined for the function, and no error states
+The current thread will reuse the usermode save area for the kernel FPU state
+instead of requiring an explicitly allocated context.
+There are no flags defined for the function, and no error states
 that the function returns.
+Once this function has been called, neither
+.Fn fpu_kern_enter
+nor
+.Fn fpu_kern_leave
+is required to be called and the fpu is available for use in the calling thread.
 .Pp
 The
 .Fn is_fpu_kern_thread

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 18:03:28 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id B722C1E3;
 Thu, 23 Oct 2014 18:03:28 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id A38639D8;
 Thu, 23 Oct 2014 18:03:28 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NI3SAd072972;
 Thu, 23 Oct 2014 18:03:28 GMT (envelope-from rpaulo@FreeBSD.org)
Received: (from rpaulo@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NI3SrO072971;
 Thu, 23 Oct 2014 18:03:28 GMT (envelope-from rpaulo@FreeBSD.org)
Message-Id: <201410231803.s9NI3SrO072971@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: rpaulo set sender to
 rpaulo@FreeBSD.org using -f
From: Rui Paulo 
Date: Thu, 23 Oct 2014 18:03:28 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273551 - head/sys/dev/puc
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 18:03:28 -0000

Author: rpaulo
Date: Thu Oct 23 18:03:27 2014
New Revision: 273551
URL: https://svnweb.freebsd.org/changeset/base/273551

Log:
  puc(4): add an entry for the Oxford Semiconductor OXPCIe952 1S1P card.
  
  Submitted by:	Alex Burlyga 
  MFC after:	1 week

Modified:
  head/sys/dev/puc/pucdata.c

Modified: head/sys/dev/puc/pucdata.c
==============================================================================
--- head/sys/dev/puc/pucdata.c	Thu Oct 23 17:24:50 2014	(r273550)
+++ head/sys/dev/puc/pucdata.c	Thu Oct 23 18:03:27 2014	(r273551)
@@ -839,6 +839,13 @@ const struct puc_cfg puc_pci_devices[] =
 	 * 
 	 */
 
+	{   0x1415, 0xc11b, 0xffff, 0,
+            "Oxford Semiconductor OXPCIe952 1S1P",
+            DEFAULT_RCLK * 0x22,
+            PUC_PORT_NONSTANDARD, 0x10, 0, -1,
+	    .config_function = puc_config_oxford_pcie
+	},
+
 	{   0x1415, 0xc138, 0xffff, 0,
 	    "Oxford Semiconductor OXPCIe952 UARTs",
 	    DEFAULT_RCLK * 0x22,

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 18:23:51 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 7C880698;
 Thu, 23 Oct 2014 18:23:51 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 68FD3BF7;
 Thu, 23 Oct 2014 18:23:51 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NINpmP082634;
 Thu, 23 Oct 2014 18:23:51 GMT (envelope-from delphij@FreeBSD.org)
Received: (from delphij@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NINpXD082633;
 Thu, 23 Oct 2014 18:23:51 GMT (envelope-from delphij@FreeBSD.org)
Message-Id: <201410231823.s9NINpXD082633@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: delphij set sender to
 delphij@FreeBSD.org using -f
From: Xin LI 
Date: Thu, 23 Oct 2014 18:23:51 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273552 - head/sys/kern
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 18:23:51 -0000

Author: delphij
Date: Thu Oct 23 18:23:50 2014
New Revision: 273552
URL: https://svnweb.freebsd.org/changeset/base/273552

Log:
  Test if 'env' is NULL before doing memset() and strlen(),
  the caller may pass NULL to freeenv().

Modified:
  head/sys/kern/kern_environment.c

Modified: head/sys/kern/kern_environment.c
==============================================================================
--- head/sys/kern/kern_environment.c	Thu Oct 23 18:03:27 2014	(r273551)
+++ head/sys/kern/kern_environment.c	Thu Oct 23 18:23:50 2014	(r273552)
@@ -262,7 +262,7 @@ void
 freeenv(char *env)
 {
 
-	if (dynamic_kenv) {
+	if (dynamic_kenv && env != NULL) {
 		memset(env, 0, strlen(env));
 		free(env, M_KENV);
 	}

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 18:38:21 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id DCCB7C08;
 Thu, 23 Oct 2014 18:38:21 +0000 (UTC)
Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1])
 (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id B630CD37;
 Thu, 23 Oct 2014 18:38:21 +0000 (UTC)
Received: from jhbbsd.localnet (unknown [209.249.190.124])
 by bigwig.baldwin.cx (Postfix) with ESMTPSA id 8D8B3B98D;
 Thu, 23 Oct 2014 14:38:20 -0400 (EDT)
From: John Baldwin 
To: Marcel Moolenaar 
Subject: Re: svn commit: r273446 - head/sys/x86/isa
Date: Thu, 23 Oct 2014 11:43:03 -0400
User-Agent: KMail/1.13.5 (FreeBSD/8.4-CBSD-20140415; KDE/4.5.5; amd64; ; )
References: <201410220137.s9M1bXuh023209@svn.freebsd.org>
In-Reply-To: <201410220137.s9M1bXuh023209@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: Text/Plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
Message-Id: <201410231143.03527.jhb@freebsd.org>
X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7
 (bigwig.baldwin.cx); Thu, 23 Oct 2014 14:38:20 -0400 (EDT)
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
 src-committers@freebsd.org
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 18:38:22 -0000

On Tuesday, October 21, 2014 9:37:33 pm Marcel Moolenaar wrote:
> Author: marcel
> Date: Wed Oct 22 01:37:32 2014
> New Revision: 273446
> URL: https://svnweb.freebsd.org/changeset/base/273446
> 
> Log:
>   Virtual machines can easily have more than 16 option ROMs and
>   when that happens, we happily access our resource array out of
>   bounds. Make sure we stay within the MAX_ROMS limit.
>   While here, bump MAX_ROMS from 16 to 32 to minimize the chance
>   of leaving option ROMs unaccounted for.
>   
>   Obtained from:	Juniper Networks, Inc.

The res[] array should just go away entirely.  This driver never gets 
detached, so its detach routine can get removed.  sc->rnum can become
a local variable in attach, the arrays can be axed, and the entire softc
should be empty.

-- 
John Baldwin

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 18:38:24 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id AF2BBD58;
 Thu, 23 Oct 2014 18:38:24 +0000 (UTC)
Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1])
 (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 89C6AD3A;
 Thu, 23 Oct 2014 18:38:24 +0000 (UTC)
Received: from jhbbsd.localnet (unknown [209.249.190.124])
 by bigwig.baldwin.cx (Postfix) with ESMTPSA id 7F604B9B1;
 Thu, 23 Oct 2014 14:38:23 -0400 (EDT)
From: John Baldwin 
To: Mateusz Guzik 
Subject: Re: svn commit: r273401 - head/sys/kern
Date: Thu, 23 Oct 2014 12:14:03 -0400
User-Agent: KMail/1.13.5 (FreeBSD/8.4-CBSD-20140415; KDE/4.5.5; amd64; ; )
References: <201410211905.s9LJ5jDb032492@svn.freebsd.org>
In-Reply-To: <201410211905.s9LJ5jDb032492@svn.freebsd.org>
MIME-Version: 1.0
Message-Id: <201410231214.04027.jhb@freebsd.org>
Content-Type: Text/Plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7
 (bigwig.baldwin.cx); Thu, 23 Oct 2014 14:38:23 -0400 (EDT)
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
 src-committers@freebsd.org
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 18:38:24 -0000

On Tuesday, October 21, 2014 3:05:45 pm Mateusz Guzik wrote:
> Author: mjg
> Date: Tue Oct 21 19:05:44 2014
> New Revision: 273401
> URL: https://svnweb.freebsd.org/changeset/base/273401
> 
> Log:
>   Implement shared locking for sysctl.

A bit more detail in this message was warranted.  We had some shared locking 
in the past (r192125) but it was subsequently reverted (r216060).

In particular, explaining how you fixed the part of 216060 that caused the
shared locking to be reverted would have answered Bjoern's earlier question as 
well.  It's important that log messages not only explain what they are doing, 
but why they are doing so.  (For exmaple, it would have been nice if 216060 
had explained why it was reverting the shared locking in its log message, but 
it didn't. :( )

I think that you fixed the issues by a combination of using sysctl_lock/unlock 
to handle shared vs exclusive locking for the caller and you used atomic ops 
on the running count (previously the xlock allowed use of non-atomic ops on 
the running count).

sysctl_root() is now only called with a shared lock held, so you should change 
its assertion accordingly.  sysctl_register_oid() is still called with the 
xlock held, so you can't remove the sysctl_lock() stuff from 
sysctl_root_handler_locked() entirely.  OTOH, there is a stale comment in 
kern_sysctl.c about having a public sysctl_lock/unlock API that you can just 
remove.  Also, given that sysctl_lock/unlock are only used in 
sysctl_root_handler_locked(), I would probably remove them and just inline 
them in the one place they are needed.

Finally, getting pre-commit review is fairly easy these days with phabricator 
and would allow you to have had all these things noted and addressed before it 
went into the tree.

-- 
John Baldwin

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 18:38:30 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id CBA34EA2;
 Thu, 23 Oct 2014 18:38:30 +0000 (UTC)
Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1])
 (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id A40A0D3C;
 Thu, 23 Oct 2014 18:38:30 +0000 (UTC)
Received: from jhbbsd.localnet (unknown [209.249.190.124])
 by bigwig.baldwin.cx (Postfix) with ESMTPSA id B9B0FB9B9;
 Thu, 23 Oct 2014 14:38:29 -0400 (EDT)
From: John Baldwin 
To: Mateusz Guzik 
Subject: Re: svn commit: r273549 - head/sys/kern
Date: Thu, 23 Oct 2014 14:38:09 -0400
User-Agent: KMail/1.13.5 (FreeBSD/8.4-CBSD-20140415; KDE/4.5.5; amd64; ; )
References: <201410231535.s9NFZlbn002656@svn.freebsd.org>
In-Reply-To: <201410231535.s9NFZlbn002656@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: Text/Plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
Message-Id: <201410231438.09220.jhb@freebsd.org>
X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7
 (bigwig.baldwin.cx); Thu, 23 Oct 2014 14:38:29 -0400 (EDT)
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
 src-committers@freebsd.org
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 18:38:30 -0000

On Thursday, October 23, 2014 11:35:47 am Mateusz Guzik wrote:
> Author: mjg
> Date: Thu Oct 23 15:35:47 2014
> New Revision: 273549
> URL: https://svnweb.freebsd.org/changeset/base/273549
> 
> Log:
>   Avoid taking the lock in selfdfree when not needed.
> 
> Modified:
>   head/sys/kern/sys_generic.c
> 
> Modified: head/sys/kern/sys_generic.c
> 
==============================================================================
> --- head/sys/kern/sys_generic.c	Thu Oct 23 15:16:40 2014	(r273548)
> +++ head/sys/kern/sys_generic.c	Thu Oct 23 15:35:47 2014	(r273549)
> @@ -1600,10 +1600,11 @@ static void
>  selfdfree(struct seltd *stp, struct selfd *sfp)
>  {
>  	STAILQ_REMOVE(&stp->st_selq, sfp, selfd, sf_link);
> -	mtx_lock(sfp->sf_mtx);
> -	if (sfp->sf_si)
> +	if (sfp->sf_si != NULL) {
> +		mtx_lock(sfp->sf_mtx);
>  		TAILQ_REMOVE(&sfp->sf_si->si_tdlist, sfp, sf_threads);
> -	mtx_unlock(sfp->sf_mtx);
> +		mtx_unlock(sfp->sf_mtx);
> +	}
>  	uma_zfree(selfd_zone, sfp);

How do you ensure that the value you read for sf_si here is up to date?  In 
particular, if a thread is selecting on multiple fds and one awakens it,
another fd can invoke selwakeup() while the thread is in seltdclear().
In that case, you might see a stale value of sf_si and not realize it is 
cleared by the selwakeup() after you get the lock and you will invoke
TAILQ_REMOVE an extra time.

-- 
John Baldwin

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 18:45:19 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id C915A2D7;
 Thu, 23 Oct 2014 18:45:19 +0000 (UTC)
Received: from mail-lb0-x22a.google.com (mail-lb0-x22a.google.com
 [IPv6:2a00:1450:4010:c04::22a])
 (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits))
 (Client CN "smtp.gmail.com",
 Issuer "Google Internet Authority G2" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 8CD1EE19;
 Thu, 23 Oct 2014 18:45:18 +0000 (UTC)
Received: by mail-lb0-f170.google.com with SMTP id u10so1367774lbd.15
 for ; Thu, 23 Oct 2014 11:45:16 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=sender:content-type:mime-version:subject:from:in-reply-to:date:cc
 :content-transfer-encoding:message-id:references:to;
 bh=mK9rRkxKSYXy5OMwSTUojabY/90Ayj2J4+LPMWXZ4iQ=;
 b=Lqxw0PkxqwXdzSkFGGoMUB09yGsvnzsYXSieULDR7O1eXrffhVOEeeQaRKT4MqbOQz
 Etd2OINiDXtKPGd4fco03IVAOJMrLLQI1xEhXuUtLoMSh6wsYVe7O14N3KBB7fYmf8Bm
 HltHkojEvSGouYUhzjaA072nctiK9T9tRh1snzxSURUxK8P6En5ApsixCpGCGV1mBo2W
 Xy2sWmiO2NfOjujQa2MP0mgX6nKY0Y65bpJB2NqxF8mI99BrgOGoU/NYEK2YYg9RfBXv
 gRnsUdww0hHGSo5r5kY4M/VhY8amcMpgB9J31oiEFKw3mCUOYlJWbSF6c8Lwimw6PznI
 dStA==
X-Received: by 10.112.26.71 with SMTP id j7mr5248609lbg.96.1414089916366;
 Thu, 23 Oct 2014 11:45:16 -0700 (PDT)
Received: from [192.168.1.14] (aefx165.neoplus.adsl.tpnet.pl. [79.186.153.165])
 by mx.google.com with ESMTPSA id i6sm1046976laf.47.2014.10.23.11.45.14
 for 
 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
 Thu, 23 Oct 2014 11:45:15 -0700 (PDT)
Sender: =?UTF-8?Q?Edward_Tomasz_Napiera=C5=82a?= 
Content-Type: text/plain;
	charset=utf-8
Mime-Version: 1.0 (1.0)
Subject: Re: svn commit: r273549 - head/sys/kern
From: =?utf-8?Q?Edward_Tomasz_Napiera=C5=82a?= 
X-Mailer: iPhone Mail (12A405)
In-Reply-To: <201410231438.09220.jhb@freebsd.org>
Date: Thu, 23 Oct 2014 20:45:13 +0200
Content-Transfer-Encoding: quoted-printable
Message-Id: <20E7F407-9DC5-4A59-BC1C-7B868C31EF52@FreeBSD.org>
References: <201410231535.s9NFZlbn002656@svn.freebsd.org>
 <201410231438.09220.jhb@freebsd.org>
To: John Baldwin 
Cc: "svn-src-head@freebsd.org" ,
 "svn-src-all@freebsd.org" ,
 "src-committers@freebsd.org" ,
 Mateusz Guzik 
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 18:45:20 -0000

Dnia 23 pa=C5=BA 2014 o godz. 20:38 John Baldwin  napisa=C5=
=82(a):

>> On Thursday, October 23, 2014 11:35:47 am Mateusz Guzik wrote:
>> Author: mjg
>> Date: Thu Oct 23 15:35:47 2014
>> New Revision: 273549
>> URL: https://svnweb.freebsd.org/changeset/base/273549
>>=20
>> Log:
>>  Avoid taking the lock in selfdfree when not needed.
>>=20
>> Modified:
>>  head/sys/kern/sys_generic.c
>>=20
>> Modified: head/sys/kern/sys_generic.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D
>> --- head/sys/kern/sys_generic.c    Thu Oct 23 15:16:40 2014    (r273548)
>> +++ head/sys/kern/sys_generic.c    Thu Oct 23 15:35:47 2014    (r273549)
>> @@ -1600,10 +1600,11 @@ static void
>> selfdfree(struct seltd *stp, struct selfd *sfp)
>> {
>>    STAILQ_REMOVE(&stp->st_selq, sfp, selfd, sf_link);
>> -    mtx_lock(sfp->sf_mtx);
>> -    if (sfp->sf_si)
>> +    if (sfp->sf_si !=3D NULL) {
>> +        mtx_lock(sfp->sf_mtx);
>>        TAILQ_REMOVE(&sfp->sf_si->si_tdlist, sfp, sf_threads);
>> -    mtx_unlock(sfp->sf_mtx);
>> +        mtx_unlock(sfp->sf_mtx);
>> +    }
>>    uma_zfree(selfd_zone, sfp);
>=20
> How do you ensure that the value you read for sf_si here is up to date?  I=
n=20
> particular, if a thread is selecting on multiple fds and one awakens it,
> another fd can invoke selwakeup() while the thread is in seltdclear().
> In that case, you might see a stale value of sf_si and not realize it is=20=

> cleared by the selwakeup() after you get the lock and you will invoke
> TAILQ_REMOVE an extra time.

FWIW, I've just hit a panic in selfdfree().


From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 18:48:44 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 2F0974B1;
 Thu, 23 Oct 2014 18:48:44 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 1AD42E59;
 Thu, 23 Oct 2014 18:48:44 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NImhqP092766;
 Thu, 23 Oct 2014 18:48:43 GMT (envelope-from markj@FreeBSD.org)
Received: (from markj@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NImhOr092765;
 Thu, 23 Oct 2014 18:48:43 GMT (envelope-from markj@FreeBSD.org)
Message-Id: <201410231848.s9NImhOr092765@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: markj set sender to
 markj@FreeBSD.org using -f
From: Mark Johnston 
Date: Thu, 23 Oct 2014 18:48:43 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject: svn commit: r273553 - stable/9/usr.sbin/newsyslog
X-SVN-Group: stable-9
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 18:48:44 -0000

Author: markj
Date: Thu Oct 23 18:48:43 2014
New Revision: 273553
URL: https://svnweb.freebsd.org/changeset/base/273553

Log:
  MFC 272763:
  If we fail to send a signal after rotation, print the pidfile from which
  the corresponding PID was obtained.
  
  PR:           194143

Modified:
  stable/9/usr.sbin/newsyslog/newsyslog.c
Directory Properties:
  stable/9/usr.sbin/newsyslog/   (props changed)

Modified: stable/9/usr.sbin/newsyslog/newsyslog.c
==============================================================================
--- stable/9/usr.sbin/newsyslog/newsyslog.c	Thu Oct 23 18:23:50 2014	(r273552)
+++ stable/9/usr.sbin/newsyslog/newsyslog.c	Thu Oct 23 18:48:43 2014	(r273553)
@@ -1966,8 +1966,8 @@ do_sigwork(struct sigwork_entry *swork)
 		 */
 		if (errno != ESRCH)
 			swork->sw_pidok = 0;
-		warn("can't notify %s, pid %d", swork->sw_pidtype,
-		    (int)swork->sw_pid);
+		warn("can't notify %s, pid %d = %s", swork->sw_pidtype,
+		    (int)swork->sw_pid, swork->sw_fname);
 	} else {
 		if (verbose)
 			printf("Notified %s pid %d = %s\n", swork->sw_pidtype,

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 18:50:45 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 47D86639;
 Thu, 23 Oct 2014 18:50:45 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 33AD1F15;
 Thu, 23 Oct 2014 18:50:45 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NIojme093870;
 Thu, 23 Oct 2014 18:50:45 GMT (envelope-from markj@FreeBSD.org)
Received: (from markj@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NIojiw093869;
 Thu, 23 Oct 2014 18:50:45 GMT (envelope-from markj@FreeBSD.org)
Message-Id: <201410231850.s9NIojiw093869@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: markj set sender to
 markj@FreeBSD.org using -f
From: Mark Johnston 
Date: Thu, 23 Oct 2014 18:50:45 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject: svn commit: r273554 - stable/10/usr.sbin/newsyslog
X-SVN-Group: stable-10
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 18:50:45 -0000

Author: markj
Date: Thu Oct 23 18:50:44 2014
New Revision: 273554
URL: https://svnweb.freebsd.org/changeset/base/273554

Log:
  MFC r272763:
  If we fail to send a signal after rotation, print the pidfile from which
  the corresponding PID was obtained.
  
  PR:           194143

Modified:
  stable/10/usr.sbin/newsyslog/newsyslog.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/newsyslog/newsyslog.c
==============================================================================
--- stable/10/usr.sbin/newsyslog/newsyslog.c	Thu Oct 23 18:48:43 2014	(r273553)
+++ stable/10/usr.sbin/newsyslog/newsyslog.c	Thu Oct 23 18:50:44 2014	(r273554)
@@ -1968,8 +1968,8 @@ do_sigwork(struct sigwork_entry *swork)
 		 */
 		if (errno != ESRCH)
 			swork->sw_pidok = 0;
-		warn("can't notify %s, pid %d", swork->sw_pidtype,
-		    (int)swork->sw_pid);
+		warn("can't notify %s, pid %d = %s", swork->sw_pidtype,
+		    (int)swork->sw_pid, swork->sw_fname);
 	} else {
 		if (verbose)
 			printf("Notified %s pid %d = %s\n", swork->sw_pidtype,

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 19:06:08 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id DB7F7E1A;
 Thu, 23 Oct 2014 19:06:08 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id C7B14107;
 Thu, 23 Oct 2014 19:06:08 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NJ68rT002295;
 Thu, 23 Oct 2014 19:06:08 GMT (envelope-from mjg@FreeBSD.org)
Received: (from mjg@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NJ68CJ002294;
 Thu, 23 Oct 2014 19:06:08 GMT (envelope-from mjg@FreeBSD.org)
Message-Id: <201410231906.s9NJ68CJ002294@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org
 using -f
From: Mateusz Guzik 
Date: Thu, 23 Oct 2014 19:06:08 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273555 - head/sys/kern
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 19:06:09 -0000

Author: mjg
Date: Thu Oct 23 19:06:08 2014
New Revision: 273555
URL: https://svnweb.freebsd.org/changeset/base/273555

Log:
  In selfdfree re-evaulate sf_si after takin the lock.
  
  Otherwise we can race with doselwakeup.
  
  This is a fixup to r273549
  
  Reviewed by:	jhb
  Reported by:	everyone and their dog

Modified:
  head/sys/kern/sys_generic.c

Modified: head/sys/kern/sys_generic.c
==============================================================================
--- head/sys/kern/sys_generic.c	Thu Oct 23 18:50:44 2014	(r273554)
+++ head/sys/kern/sys_generic.c	Thu Oct 23 19:06:08 2014	(r273555)
@@ -1602,7 +1602,8 @@ selfdfree(struct seltd *stp, struct self
 	STAILQ_REMOVE(&stp->st_selq, sfp, selfd, sf_link);
 	if (sfp->sf_si != NULL) {
 		mtx_lock(sfp->sf_mtx);
-		TAILQ_REMOVE(&sfp->sf_si->si_tdlist, sfp, sf_threads);
+		if (sfp->sf_si != NULL)
+			TAILQ_REMOVE(&sfp->sf_si->si_tdlist, sfp, sf_threads);
 		mtx_unlock(sfp->sf_mtx);
 	}
 	uma_zfree(selfd_zone, sfp);

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 19:39:43 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id DE2919EC;
 Thu, 23 Oct 2014 19:39:42 +0000 (UTC)
Received: from mail-wg0-x22d.google.com (mail-wg0-x22d.google.com
 [IPv6:2a00:1450:400c:c00::22d])
 (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits))
 (Client CN "smtp.gmail.com",
 Issuer "Google Internet Authority G2" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id B546F674;
 Thu, 23 Oct 2014 19:39:41 +0000 (UTC)
Received: by mail-wg0-f45.google.com with SMTP id m15so1862546wgh.4
 for ; Thu, 23 Oct 2014 12:39:40 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=mime-version:sender:in-reply-to:references:date:message-id:subject
 :from:to:cc:content-type:content-transfer-encoding;
 bh=Jt4GdNFdJE99PJ4v+Tr6XZLqOzIQ3jxebHMupbTIlmk=;
 b=swBU3LeRGG8UK/kLLdhwx2iiT0TdvtCxf3S2vFvu6Dw35kmTe0Ndl90tJzXlXPniGa
 VSEp+o77VjCsuAL1cV39HzM7wbiO8P7GCzrxPo321payZLo0Ta5DFSiTSPzGKcdAL+CG
 yDo2XrTZ+XNlRRsYeNWU/6mRwHWq6UALGTyMbNnU57WwpODgmJWwE+Cs6s5Ncs54a59A
 S1ROwRG5Co+IGCvrns8oq2qvFTwxef788Wov+JXEKMS4acBrFTPM6ev6KGFU4lNGTYqL
 l1VheNHD+yb3uz8xpt05uLAavwX7/SnA1wMVW8qjdUsApF8M6Sh17EXnnm+/LbwWHorO
 vy1Q==
MIME-Version: 1.0
X-Received: by 10.194.216.162 with SMTP id or2mr7720803wjc.68.1414093180007;
 Thu, 23 Oct 2014 12:39:40 -0700 (PDT)
Sender: adrian.chadd@gmail.com
Received: by 10.216.106.136 with HTTP; Thu, 23 Oct 2014 12:39:39 -0700 (PDT)
In-Reply-To: <20E7F407-9DC5-4A59-BC1C-7B868C31EF52@FreeBSD.org>
References: <201410231535.s9NFZlbn002656@svn.freebsd.org>
 <201410231438.09220.jhb@freebsd.org>
 <20E7F407-9DC5-4A59-BC1C-7B868C31EF52@FreeBSD.org>
Date: Thu, 23 Oct 2014 12:39:39 -0700
X-Google-Sender-Auth: CGL1LT6XCY4oV3jnlEifwmswfDY
Message-ID: 
Subject: Re: svn commit: r273549 - head/sys/kern
From: Adrian Chadd 
To: =?UTF-8?Q?Edward_Tomasz_Napiera=C5=82a?= 
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Cc: "svn-src-head@freebsd.org" ,
 "svn-src-all@freebsd.org" ,
 "src-committers@freebsd.org" ,
 Mateusz Guzik , John Baldwin 
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 19:39:43 -0000

Please back this out; it looks like the lock is protecting sf_si.


-adrian

On 23 October 2014 11:45, Edward Tomasz Napiera=C5=82a  =
wrote:
> Dnia 23 pa=C5=BA 2014 o godz. 20:38 John Baldwin  napisa=
=C5=82(a):
>
>>> On Thursday, October 23, 2014 11:35:47 am Mateusz Guzik wrote:
>>> Author: mjg
>>> Date: Thu Oct 23 15:35:47 2014
>>> New Revision: 273549
>>> URL: https://svnweb.freebsd.org/changeset/base/273549
>>>
>>> Log:
>>>  Avoid taking the lock in selfdfree when not needed.
>>>
>>> Modified:
>>>  head/sys/kern/sys_generic.c
>>>
>>> Modified: head/sys/kern/sys_generic.c
>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
>>> --- head/sys/kern/sys_generic.c    Thu Oct 23 15:16:40 2014    (r273548=
)
>>> +++ head/sys/kern/sys_generic.c    Thu Oct 23 15:35:47 2014    (r273549=
)
>>> @@ -1600,10 +1600,11 @@ static void
>>> selfdfree(struct seltd *stp, struct selfd *sfp)
>>> {
>>>    STAILQ_REMOVE(&stp->st_selq, sfp, selfd, sf_link);
>>> -    mtx_lock(sfp->sf_mtx);
>>> -    if (sfp->sf_si)
>>> +    if (sfp->sf_si !=3D NULL) {
>>> +        mtx_lock(sfp->sf_mtx);
>>>        TAILQ_REMOVE(&sfp->sf_si->si_tdlist, sfp, sf_threads);
>>> -    mtx_unlock(sfp->sf_mtx);
>>> +        mtx_unlock(sfp->sf_mtx);
>>> +    }
>>>    uma_zfree(selfd_zone, sfp);
>>
>> How do you ensure that the value you read for sf_si here is up to date? =
 In
>> particular, if a thread is selecting on multiple fds and one awakens it,
>> another fd can invoke selwakeup() while the thread is in seltdclear().
>> In that case, you might see a stale value of sf_si and not realize it is
>> cleared by the selwakeup() after you get the lock and you will invoke
>> TAILQ_REMOVE an extra time.
>
> FWIW, I've just hit a panic in selfdfree().
>
>

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 20:01:40 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 8ECD0717
 for ; Thu, 23 Oct 2014 20:01:40 +0000 (UTC)
Received: from o1.l99.sendgrid.net (o1.l99.sendgrid.net [198.37.153.74])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 4194B9CB
 for ; Thu, 23 Oct 2014 20:01:39 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.info; 
 h=from:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding;
 s=smtpapi; bh=I84dqj8B5eHEUfPvXEBozW+3ZCI=; b=Sidgl96+B8/OI36NLS
 G+cZeTYWCTf1V4aV/ueYwNkgwEftEKcx8wCubQWSV+lmU/qtqNxPXzpvW259kv6p
 sodKWSORw+ZPsZ3cz4SdOKjOUB+KZaNoWQ4v9Fj5nDHmyefG92OBcMIWii1y5RB6
 7C1Gk9RfbyIpXMaWhiWySYtFA=
Received: by filter0046p1mdw1.sendgrid.net with SMTP id
 filter0046p1mdw1.32365.54495E9D6
 2014-10-23 20:01:33.38457457 +0000 UTC
Received: from mail.tarsnap.com (unknown [10.100.60.108])
 by ismtpd-015.iad1.sendgrid.net (SG) with ESMTP id 1493e99968d.5728.24b9a7
 for ; Thu, 23 Oct 2014 20:01:33 +0000 (GMT)
Received: (qmail 83738 invoked from network); 23 Oct 2014 20:01:32 -0000
Received: from unknown (HELO clamshell.daemonology.net) (127.0.0.1)
 by ec2-107-20-205-189.compute-1.amazonaws.com with ESMTP;
 23 Oct 2014 20:01:32 -0000
Received: (qmail 14540 invoked from network); 23 Oct 2014 20:01:19 -0000
Received: from unknown (HELO clamshell.daemonology.net) (127.0.0.1)
 by clamshell.daemonology.net with SMTP; 23 Oct 2014 20:01:19 -0000
Message-ID: <54495E8E.20408@freebsd.org>
Date: Thu, 23 Oct 2014 13:01:18 -0700
From: Colin Percival 
User-Agent: Mozilla/5.0 (X11; FreeBSD amd64;
 rv:31.0) Gecko/20100101 Thunderbird/31.1.2
MIME-Version: 1.0
To: =?UTF-8?B?SmVhbi1Tw6liYXN0aWVuIFDDqWRyb24=?= , 
 svn-src-all@freebsd.org
Subject: Re: svn commit: r273487 - head/sys/kern
References: <201410222335.s9MNZW62045167@svn.freebsd.org>
 <5448F973.8050102@FreeBSD.org>
In-Reply-To: <5448F973.8050102@FreeBSD.org>
Content-Type: text/plain; charset=utf-8
content-transfer-encoding: quoted-printable
X-SG-EID: A6W2xSVPHetogaU8rnzccWwgBYtN+QvIzXyjfe/10PEXaK9+6wsRDqnbC2+kSkDnEVLlO7CMiE4IlgAt5E8S6oqfYChDr+CRJPshCgHDoZH0nmm3BR/4r0zJUsG0AIzmDkgksTM7skrJ3SzP/FZILqzaz3qG+Vwbiag4LrjhhDBliGp1KISy+7NgA2ZgmsOQ
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 20:01:40 -0000

On 10/23/14 05:49, Jean-S=C3=A9bastien P=C3=A9dron wrote:=0D
> The following change triggers a kernel trap 12 when env is NULL:=0D
> =0D
>> @@ -260,8 +262,10 @@ void=0D
>>  freeenv(char *env)=0D
>>  {=0D
>>  =0D
>> -	if (dynamic_kenv)=0D
>> +	if (dynamic_kenv) {=0D
>> +		memset(env, 0, strlen(env));=0D
>>  		free(env, M_KENV);=0D
>> +	}=0D
>>  }=0D
> =0D
> This happens very early in boot for me, just after the lines:=0D
>     WARNING: WITNESS option enabled, expect reduced performance.=0D
>     VT: running with driver "vga".=0D
=0D
This sounds like a bug in the code which is using kern_getenv / freeenv.=0D
The comment at kern_getenv says=0D
 * Look up an environment variable by name.=0D
 * Return a pointer to the string if found.=0D
 * The pointer has to be freed with freeenv()=0D
 * after use.=0D
which I interpret to mean that if the environment variable is not found=0D
and you don't get a pointer to a string, you shouldn't be freeing it.=0D
=0D
I'm willing to work around this in freeenv, but since we're in HEAD and=0D
this isn't going to be MFCed, it seems like an opportunity to fix the=0D
code which is calling freeenv(NULL).=0D
=0D
> The attached simple patch fixes the problem.=0D
> =0D
> What I don't know is if the same problem can occur in kern_unsetenv():=0D
> =0D
>> @@ -437,6 +441,7 @@ kern_unsetenv(const char *name)=0D
>>  			kenvp[i++] =3D kenvp[j];=0D
>>  		kenvp[i] =3D NULL;=0D
>>  		mtx_unlock(&kenv_lock);=0D
>> +		memset(oldenv, 0, strlen(oldenv));=0D
>>  		free(oldenv, M_KENV);=0D
>>  		return (0);=0D
>>  	}=0D
=0D
We can only get into that code if cp !=3D NULL, and cp is part of the=0D
string pointed to by kenvp[i] (aka. oldenv) so unless I'm missing=0D
something we're guaranteed that oldenv is a pointer to a string here.=0D
=0D
Colin Percival

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 20:43:17 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id B23D2851;
 Thu, 23 Oct 2014 20:43:17 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 848D1E10;
 Thu, 23 Oct 2014 20:43:17 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NKhHdO050194;
 Thu, 23 Oct 2014 20:43:17 GMT (envelope-from jhb@FreeBSD.org)
Received: (from jhb@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NKhHxI050192;
 Thu, 23 Oct 2014 20:43:17 GMT (envelope-from jhb@FreeBSD.org)
Message-Id: <201410232043.s9NKhHxI050192@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: jhb set sender to jhb@FreeBSD.org
 using -f
From: John Baldwin 
Date: Thu, 23 Oct 2014 20:43:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273557 - head/sys/netipsec
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 20:43:17 -0000

Author: jhb
Date: Thu Oct 23 20:43:16 2014
New Revision: 273557
URL: https://svnweb.freebsd.org/changeset/base/273557

Log:
  Use a static callout to drive key_timehandler() instead of timeout().
  While here, make key_timehandler() private to key.c.
  
  Submitted by:	bz (2)
  Tested by:	bz

Modified:
  head/sys/netipsec/key.c
  head/sys/netipsec/key.h

Modified: head/sys/netipsec/key.c
==============================================================================
--- head/sys/netipsec/key.c	Thu Oct 23 20:01:55 2014	(r273556)
+++ head/sys/netipsec/key.c	Thu Oct 23 20:43:16 2014	(r273557)
@@ -410,6 +410,10 @@ struct sadb_msghdr {
 	int extlen[SADB_EXT_MAX + 1];
 };
 
+#ifndef IPSEC_DEBUG2
+static struct callout key_timer;
+#endif
+
 static struct secasvar *key_allocsa_policy __P((const struct secasindex *));
 static void key_freesp_so __P((struct secpolicy **));
 static struct secasvar *key_do_allocsa_policy __P((struct secashead *, u_int));
@@ -4525,8 +4529,8 @@ key_flush_spacq(time_t now)
  * and do to remove or to expire.
  * XXX: year 2038 problem may remain.
  */
-void
-key_timehandler(void)
+static void
+key_timehandler(void *arg)
 {
 	VNET_ITERATOR_DECL(vnet_iter);
 	time_t now = time_second;
@@ -4544,7 +4548,7 @@ key_timehandler(void)
 
 #ifndef IPSEC_DEBUG2
 	/* do exchange to tick time !! */
-	(void)timeout((void *)key_timehandler, (void *)0, hz);
+	callout_schedule(&key_timer, hz);
 #endif /* IPSEC_DEBUG2 */
 }
 
@@ -7769,7 +7773,8 @@ key_init(void)
 	SPACQ_LOCK_INIT();
 
 #ifndef IPSEC_DEBUG2
-	timeout((void *)key_timehandler, (void *)0, hz);
+	callout_init(&key_timer, CALLOUT_MPSAFE);
+	callout_reset(&key_timer, hz, key_timehandler, NULL);
 #endif /*IPSEC_DEBUG2*/
 
 	/* initialize key statistics */

Modified: head/sys/netipsec/key.h
==============================================================================
--- head/sys/netipsec/key.h	Thu Oct 23 20:01:55 2014	(r273556)
+++ head/sys/netipsec/key.h	Thu Oct 23 20:43:16 2014	(r273557)
@@ -97,7 +97,6 @@ extern struct secpolicy *key_msg2sp __P(
 extern struct mbuf *key_sp2msg __P((struct secpolicy *));
 extern int key_ismyaddr __P((struct sockaddr *));
 extern int key_spdacquire __P((struct secpolicy *));
-extern void key_timehandler __P((void));
 extern u_long key_random __P((void));
 extern void key_randomfill __P((void *, size_t));
 extern void key_freereg __P((struct socket *));

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 20:44:03 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 6981999E;
 Thu, 23 Oct 2014 20:44:03 +0000 (UTC)
Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1])
 (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 3E2A7E18;
 Thu, 23 Oct 2014 20:44:03 +0000 (UTC)
Received: from jhbbsd.localnet (unknown [209.249.190.124])
 by bigwig.baldwin.cx (Postfix) with ESMTPSA id 7D0AFB98D;
 Thu, 23 Oct 2014 16:44:01 -0400 (EDT)
From: John Baldwin 
To: Adrian Chadd 
Subject: Re: svn commit: r273549 - head/sys/kern
Date: Thu, 23 Oct 2014 16:32:52 -0400
User-Agent: KMail/1.13.5 (FreeBSD/8.4-CBSD-20140415; KDE/4.5.5; amd64; ; )
References: <201410231535.s9NFZlbn002656@svn.freebsd.org>
 <20E7F407-9DC5-4A59-BC1C-7B868C31EF52@FreeBSD.org>
 
In-Reply-To: 
MIME-Version: 1.0
Content-Type: Text/Plain;
  charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Message-Id: <201410231632.53172.jhb@freebsd.org>
X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7
 (bigwig.baldwin.cx); Thu, 23 Oct 2014 16:44:01 -0400 (EDT)
Cc: "svn-src-head@freebsd.org" ,
 "svn-src-all@freebsd.org" ,
 "src-committers@freebsd.org" ,
 Edward Tomasz =?utf-8?q?Napiera=C5=82a?= ,
 Mateusz Guzik 
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 20:44:03 -0000

On Thursday, October 23, 2014 3:39:39 pm Adrian Chadd wrote:
> Please back this out; it looks like the lock is protecting sf_si.

The followup fix should be fine.  The lock does indeed protect sf_si, but t=
he value
can only transition from non-NULL to NULL at this point, so if it is =3D=3D=
 NULL without
the lock, it is safe to assume it has already been cleared.

> -adrian
>=20
> On 23 October 2014 11:45, Edward Tomasz Napiera=C5=82a  wrote:
> > Dnia 23 pa=C5=BA 2014 o godz. 20:38 John Baldwin  napi=
sa=C5=82(a):
> >
> >>> On Thursday, October 23, 2014 11:35:47 am Mateusz Guzik wrote:
> >>> Author: mjg
> >>> Date: Thu Oct 23 15:35:47 2014
> >>> New Revision: 273549
> >>> URL: https://svnweb.freebsd.org/changeset/base/273549
> >>>
> >>> Log:
> >>>  Avoid taking the lock in selfdfree when not needed.
> >>>
> >>> Modified:
> >>>  head/sys/kern/sys_generic.c
> >>>
> >>> Modified: head/sys/kern/sys_generic.c
> >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D
> >>> --- head/sys/kern/sys_generic.c    Thu Oct 23 15:16:40 2014    (r2735=
48)
> >>> +++ head/sys/kern/sys_generic.c    Thu Oct 23 15:35:47 2014    (r2735=
49)
> >>> @@ -1600,10 +1600,11 @@ static void
> >>> selfdfree(struct seltd *stp, struct selfd *sfp)
> >>> {
> >>>    STAILQ_REMOVE(&stp->st_selq, sfp, selfd, sf_link);
> >>> -    mtx_lock(sfp->sf_mtx);
> >>> -    if (sfp->sf_si)
> >>> +    if (sfp->sf_si !=3D NULL) {
> >>> +        mtx_lock(sfp->sf_mtx);
> >>>        TAILQ_REMOVE(&sfp->sf_si->si_tdlist, sfp, sf_threads);
> >>> -    mtx_unlock(sfp->sf_mtx);
> >>> +        mtx_unlock(sfp->sf_mtx);
> >>> +    }
> >>>    uma_zfree(selfd_zone, sfp);
> >>
> >> How do you ensure that the value you read for sf_si here is up to date=
?  In
> >> particular, if a thread is selecting on multiple fds and one awakens i=
t,
> >> another fd can invoke selwakeup() while the thread is in seltdclear().
> >> In that case, you might see a stale value of sf_si and not realize it =
is
> >> cleared by the selwakeup() after you get the lock and you will invoke
> >> TAILQ_REMOVE an extra time.
> >
> > FWIW, I've just hit a panic in selfdfree().
> >
> >
>=20
>=20

=2D-=20
John Baldwin

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 21:02:41 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 17AB27C;
 Thu, 23 Oct 2014 21:02:41 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 04250C4;
 Thu, 23 Oct 2014 21:02:41 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NL2eWA059694;
 Thu, 23 Oct 2014 21:02:40 GMT (envelope-from alc@FreeBSD.org)
Received: (from alc@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NL2edr059693;
 Thu, 23 Oct 2014 21:02:40 GMT (envelope-from alc@FreeBSD.org)
Message-Id: <201410232102.s9NL2edr059693@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: alc set sender to alc@FreeBSD.org
 using -f
From: Alan Cox 
Date: Thu, 23 Oct 2014 21:02:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273558 - head/sys/i386/i386
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 21:02:41 -0000

Author: alc
Date: Thu Oct 23 21:02:40 2014
New Revision: 273558
URL: https://svnweb.freebsd.org/changeset/base/273558

Log:
  Under PAE ULONG is insufficient for representing the physical memory size.  Use QUAD
  for "hw.physmem" so that a physical memory size greater than 4 GB can be specified
  from the boot loader.

Modified:
  head/sys/i386/i386/machdep.c

Modified: head/sys/i386/i386/machdep.c
==============================================================================
--- head/sys/i386/i386/machdep.c	Thu Oct 23 20:43:16 2014	(r273557)
+++ head/sys/i386/i386/machdep.c	Thu Oct 23 21:02:40 2014	(r273558)
@@ -2463,10 +2463,10 @@ static void
 getmemsize(int first)
 {
 	int has_smap, off, physmap_idx, pa_indx, da_indx;
-	u_long physmem_tunable, memtest;
+	u_long memtest;
 	vm_paddr_t physmap[PHYSMAP_SIZE];
 	pt_entry_t *pte;
-	quad_t dcons_addr, dcons_size;
+	quad_t dcons_addr, dcons_size, physmem_tunable;
 #ifndef XEN
 	int hasbrokenint12, i, res;
 	u_int extmem;
@@ -2650,7 +2650,7 @@ physmap_done:
 	Maxmem = MAXMEM / 4;
 #endif
 
-	if (TUNABLE_ULONG_FETCH("hw.physmem", &physmem_tunable))
+	if (TUNABLE_QUAD_FETCH("hw.physmem", &physmem_tunable))
 		Maxmem = atop(physmem_tunable);
 
 	/*

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 22:21:23 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 1C91A185;
 Thu, 23 Oct 2014 22:21:23 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id E2B1DAE0;
 Thu, 23 Oct 2014 22:21:22 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NMLMBQ098173;
 Thu, 23 Oct 2014 22:21:22 GMT (envelope-from ian@FreeBSD.org)
Received: (from ian@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NMLMvV098172;
 Thu, 23 Oct 2014 22:21:22 GMT (envelope-from ian@FreeBSD.org)
Message-Id: <201410232221.s9NMLMvV098172@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org
 using -f
From: Ian Lepore 
Date: Thu, 23 Oct 2014 22:21:22 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273561 - head/sys/arm/freescale/imx
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 22:21:23 -0000

Author: ian
Date: Thu Oct 23 22:21:22 2014
New Revision: 273561
URL: https://svnweb.freebsd.org/changeset/base/273561

Log:
  Install a temporary workaround to avoid problems in fdt data with linux's
  workaround for an imx6 chip erratum.  Linux works around the bug with
  changes in fdt data that we can't currently handle, so to enable running
  with standard vendor-supplied fdt data, this watches for an attempt to map
  the gpio1_6 interrupt and remaps it back to the standard ethernet interrupt.
  
  This can be undone when the intrng project is completed and our gpio drivers
  can also be interrupt controllers.

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

Modified: head/sys/arm/freescale/imx/imx6_machdep.c
==============================================================================
--- head/sys/arm/freescale/imx/imx6_machdep.c	Thu Oct 23 21:38:54 2014	(r273560)
+++ head/sys/arm/freescale/imx/imx6_machdep.c	Thu Oct 23 22:21:22 2014	(r273561)
@@ -54,8 +54,39 @@ struct fdt_fixup_entry fdt_fixup_table[]
 	{ NULL, NULL }
 };
 
+static uint32_t gpio1_node;
+
+/*
+ * Work around the linux workaround for imx6 erratum 006687, in which some
+ * ethernet interrupts don't go to the GPC and thus won't wake the system from
+ * Wait mode. We don't use Wait mode (which halts the GIC, leaving only GPC
+ * interrupts able to wake the system), so we don't experience the bug at all.
+ * The linux workaround is to reconfigure GPIO1_6 as the ENET interrupt by
+ * writing magic values to an undocumented IOMUX register, then letting the gpio
+ * interrupt driver notify the ethernet driver.  We'll be able to do all that
+ * (even though we don't need to) once the INTRNG project is committed and the
+ * imx_gpio driver becomes an interrupt driver.  Until then, this crazy little
+ * workaround watches for requests to map an interrupt 6 with the interrupt
+ * controller node referring to gpio1, and it substitutes the proper ffec
+ * interrupt number.
+ */
+static int
+imx6_decode_fdt(uint32_t iparent, uint32_t *intr, int *interrupt,
+    int *trig, int *pol)
+{
+
+	if (fdt32_to_cpu(intr[0]) == 6 && 
+	    OF_node_from_xref(iparent) == gpio1_node) {
+		*interrupt = 150;
+		*trig = INTR_TRIGGER_CONFORM;
+		*pol  = INTR_POLARITY_CONFORM;
+		return (0);
+	}
+	return (gic_decode_fdt(iparent, intr, interrupt, trig, pol));
+}
+
 fdt_pic_decode_t fdt_pic_table[] = {
-	&gic_decode_fdt,
+	&imx6_decode_fdt,
 	NULL
 };
 
@@ -84,6 +115,9 @@ void
 platform_late_init(void)
 {
 
+	/* Cache the gpio1 node handle for imx6_decode_fdt() workaround code. */
+	gpio1_node = OF_node_from_xref(
+	    OF_finddevice("/soc/aips-bus@02000000/gpio@0209c000"));
 }
 
 /*

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 23 22:30:18 2014
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id E70CB533;
 Thu, 23 Oct 2014 22:30:18 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id CF055B52;
 Thu, 23 Oct 2014 22:30:18 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NMUIfA099846;
 Thu, 23 Oct 2014 22:30:18 GMT (envelope-from marcel@FreeBSD.org)
Received: (from marcel@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NMUF54099829;
 Thu, 23 Oct 2014 22:30:15 GMT (envelope-from marcel@FreeBSD.org)
Message-Id: <201410232230.s9NMUF54099829@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: marcel set sender to
 marcel@FreeBSD.org using -f
From: Marcel Moolenaar 
Date: Thu, 23 Oct 2014 22:30:15 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r273562 - in head/contrib/libxo: . bin build doc libxo m4
 packaging tests tests/core tests/core/saved tests/xo tests/xo/saved xo xohtml
 xohtml/external xolint
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18-1
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
 user" and " projects" \)" 
List-Unsubscribe: ,
 
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
 
X-List-Received-Date: Thu, 23 Oct 2014 22:30:19 -0000

Author: marcel
Date: Thu Oct 23 22:30:14 2014
New Revision: 273562
URL: https://svnweb.freebsd.org/changeset/base/273562

Log:
  Import libxo 0.1.4
  
  Obtained from:	https://github.com/Juniper/libxo
  Sponsored by:	Juniper Networks, Inc.

Added:
  head/contrib/libxo/
  head/contrib/libxo/.gitignore
  head/contrib/libxo/.travis.yml
  head/contrib/libxo/Copyright
  head/contrib/libxo/LICENSE
  head/contrib/libxo/Makefile.am   (contents, props changed)
  head/contrib/libxo/README.md
  head/contrib/libxo/bin/
  head/contrib/libxo/bin/Makefile.am   (contents, props changed)
  head/contrib/libxo/bin/Zaliases
  head/contrib/libxo/bin/setup.sh   (contents, props changed)
  head/contrib/libxo/build/
  head/contrib/libxo/build/.create
  head/contrib/libxo/configure.ac
  head/contrib/libxo/doc/
  head/contrib/libxo/doc/Makefile.am   (contents, props changed)
  head/contrib/libxo/doc/libxo.txt   (contents, props changed)
  head/contrib/libxo/install-sh   (contents, props changed)
  head/contrib/libxo/libxo/
  head/contrib/libxo/libxo-config.in   (contents, props changed)
  head/contrib/libxo/libxo/Makefile.am   (contents, props changed)
  head/contrib/libxo/libxo/gen-wide.sh   (contents, props changed)
  head/contrib/libxo/libxo/libxo.3   (contents, props changed)
  head/contrib/libxo/libxo/libxo.c   (contents, props changed)
  head/contrib/libxo/libxo/xo.h   (contents, props changed)
  head/contrib/libxo/libxo/xo_attr.3   (contents, props changed)
  head/contrib/libxo/libxo/xo_create.3   (contents, props changed)
  head/contrib/libxo/libxo/xo_emit.3   (contents, props changed)
  head/contrib/libxo/libxo/xo_err.3   (contents, props changed)
  head/contrib/libxo/libxo/xo_finish.3   (contents, props changed)
  head/contrib/libxo/libxo/xo_flush.3   (contents, props changed)
  head/contrib/libxo/libxo/xo_format.5   (contents, props changed)
  head/contrib/libxo/libxo/xo_no_setlocale.3   (contents, props changed)
  head/contrib/libxo/libxo/xo_open_container.3   (contents, props changed)
  head/contrib/libxo/libxo/xo_open_list.3   (contents, props changed)
  head/contrib/libxo/libxo/xo_parse_args.3   (contents, props changed)
  head/contrib/libxo/libxo/xo_set_allocator.3   (contents, props changed)
  head/contrib/libxo/libxo/xo_set_flags.3   (contents, props changed)
  head/contrib/libxo/libxo/xo_set_info.3   (contents, props changed)
  head/contrib/libxo/libxo/xo_set_options.3   (contents, props changed)
  head/contrib/libxo/libxo/xo_set_style.3   (contents, props changed)
  head/contrib/libxo/libxo/xo_set_writer.3   (contents, props changed)
  head/contrib/libxo/libxo/xoconfig.h.in   (contents, props changed)
  head/contrib/libxo/libxo/xoversion.h.in   (contents, props changed)
  head/contrib/libxo/m4/
  head/contrib/libxo/m4/libtool.m4
  head/contrib/libxo/m4/ltoptions.m4
  head/contrib/libxo/m4/ltsugar.m4
  head/contrib/libxo/m4/ltversion.m4
  head/contrib/libxo/m4/lt~obsolete.m4
  head/contrib/libxo/packaging/
  head/contrib/libxo/packaging/libxo.pc.in   (contents, props changed)
  head/contrib/libxo/packaging/libxo.spec.in   (contents, props changed)
  head/contrib/libxo/tests/
  head/contrib/libxo/tests/Makefile.am   (contents, props changed)
  head/contrib/libxo/tests/core/
  head/contrib/libxo/tests/core/Makefile.am   (contents, props changed)
  head/contrib/libxo/tests/core/saved/
  head/contrib/libxo/tests/core/saved/test_01.H.err
  head/contrib/libxo/tests/core/saved/test_01.H.out
  head/contrib/libxo/tests/core/saved/test_01.HIPx.err
  head/contrib/libxo/tests/core/saved/test_01.HIPx.out
  head/contrib/libxo/tests/core/saved/test_01.HP.err
  head/contrib/libxo/tests/core/saved/test_01.HP.out
  head/contrib/libxo/tests/core/saved/test_01.J.err
  head/contrib/libxo/tests/core/saved/test_01.J.out
  head/contrib/libxo/tests/core/saved/test_01.JP.err
  head/contrib/libxo/tests/core/saved/test_01.JP.out
  head/contrib/libxo/tests/core/saved/test_01.T.err
  head/contrib/libxo/tests/core/saved/test_01.T.out
  head/contrib/libxo/tests/core/saved/test_01.X.err
  head/contrib/libxo/tests/core/saved/test_01.X.out
  head/contrib/libxo/tests/core/saved/test_01.XP.err
  head/contrib/libxo/tests/core/saved/test_01.XP.out
  head/contrib/libxo/tests/core/saved/test_01.err
  head/contrib/libxo/tests/core/saved/test_01.out
  head/contrib/libxo/tests/core/saved/test_02.H.err
  head/contrib/libxo/tests/core/saved/test_02.H.out
  head/contrib/libxo/tests/core/saved/test_02.HIPx.err
  head/contrib/libxo/tests/core/saved/test_02.HIPx.out
  head/contrib/libxo/tests/core/saved/test_02.HP.err
  head/contrib/libxo/tests/core/saved/test_02.HP.out
  head/contrib/libxo/tests/core/saved/test_02.J.err
  head/contrib/libxo/tests/core/saved/test_02.J.out
  head/contrib/libxo/tests/core/saved/test_02.JP.err
  head/contrib/libxo/tests/core/saved/test_02.JP.out
  head/contrib/libxo/tests/core/saved/test_02.T.err
  head/contrib/libxo/tests/core/saved/test_02.T.out
  head/contrib/libxo/tests/core/saved/test_02.X.err
  head/contrib/libxo/tests/core/saved/test_02.X.out
  head/contrib/libxo/tests/core/saved/test_02.XP.err
  head/contrib/libxo/tests/core/saved/test_02.XP.out
  head/contrib/libxo/tests/core/saved/test_02.err
  head/contrib/libxo/tests/core/saved/test_02.out
  head/contrib/libxo/tests/core/saved/test_03.H.err
  head/contrib/libxo/tests/core/saved/test_03.H.out
  head/contrib/libxo/tests/core/saved/test_03.HIPx.err
  head/contrib/libxo/tests/core/saved/test_03.HIPx.out
  head/contrib/libxo/tests/core/saved/test_03.HP.err
  head/contrib/libxo/tests/core/saved/test_03.HP.out
  head/contrib/libxo/tests/core/saved/test_03.J.err
  head/contrib/libxo/tests/core/saved/test_03.J.out
  head/contrib/libxo/tests/core/saved/test_03.JP.err
  head/contrib/libxo/tests/core/saved/test_03.JP.out
  head/contrib/libxo/tests/core/saved/test_03.T.err
  head/contrib/libxo/tests/core/saved/test_03.T.out
  head/contrib/libxo/tests/core/saved/test_03.X.err
  head/contrib/libxo/tests/core/saved/test_03.X.out
  head/contrib/libxo/tests/core/saved/test_03.XP.err
  head/contrib/libxo/tests/core/saved/test_03.XP.out
  head/contrib/libxo/tests/core/saved/test_03.err
  head/contrib/libxo/tests/core/saved/test_03.out
  head/contrib/libxo/tests/core/saved/test_04.H.err
  head/contrib/libxo/tests/core/saved/test_04.H.out
  head/contrib/libxo/tests/core/saved/test_04.HIPx.err
  head/contrib/libxo/tests/core/saved/test_04.HIPx.out
  head/contrib/libxo/tests/core/saved/test_04.HP.err
  head/contrib/libxo/tests/core/saved/test_04.HP.out
  head/contrib/libxo/tests/core/saved/test_04.J.err
  head/contrib/libxo/tests/core/saved/test_04.J.out
  head/contrib/libxo/tests/core/saved/test_04.JP.err
  head/contrib/libxo/tests/core/saved/test_04.JP.out
  head/contrib/libxo/tests/core/saved/test_04.T.err
  head/contrib/libxo/tests/core/saved/test_04.T.out
  head/contrib/libxo/tests/core/saved/test_04.X.err
  head/contrib/libxo/tests/core/saved/test_04.X.out
  head/contrib/libxo/tests/core/saved/test_04.XP.err
  head/contrib/libxo/tests/core/saved/test_04.XP.out
  head/contrib/libxo/tests/core/saved/test_05.H.err
  head/contrib/libxo/tests/core/saved/test_05.H.out
  head/contrib/libxo/tests/core/saved/test_05.HIPx.err
  head/contrib/libxo/tests/core/saved/test_05.HIPx.out
  head/contrib/libxo/tests/core/saved/test_05.HP.err
  head/contrib/libxo/tests/core/saved/test_05.HP.out
  head/contrib/libxo/tests/core/saved/test_05.J.err
  head/contrib/libxo/tests/core/saved/test_05.J.out   (contents, props changed)
  head/contrib/libxo/tests/core/saved/test_05.JP.err
  head/contrib/libxo/tests/core/saved/test_05.JP.out
  head/contrib/libxo/tests/core/saved/test_05.T.err
  head/contrib/libxo/tests/core/saved/test_05.T.out   (contents, props changed)
  head/contrib/libxo/tests/core/saved/test_05.X.err
  head/contrib/libxo/tests/core/saved/test_05.X.out
  head/contrib/libxo/tests/core/saved/test_05.XP.err
  head/contrib/libxo/tests/core/saved/test_05.XP.out
  head/contrib/libxo/tests/core/saved/test_06.H.err
  head/contrib/libxo/tests/core/saved/test_06.H.out
  head/contrib/libxo/tests/core/saved/test_06.HIPx.err
  head/contrib/libxo/tests/core/saved/test_06.HIPx.out
  head/contrib/libxo/tests/core/saved/test_06.HP.err
  head/contrib/libxo/tests/core/saved/test_06.HP.out
  head/contrib/libxo/tests/core/saved/test_06.J.err
  head/contrib/libxo/tests/core/saved/test_06.J.out
  head/contrib/libxo/tests/core/saved/test_06.JP.err
  head/contrib/libxo/tests/core/saved/test_06.JP.out
  head/contrib/libxo/tests/core/saved/test_06.T.err
  head/contrib/libxo/tests/core/saved/test_06.T.out
  head/contrib/libxo/tests/core/saved/test_06.X.err
  head/contrib/libxo/tests/core/saved/test_06.X.out
  head/contrib/libxo/tests/core/saved/test_06.XP.err
  head/contrib/libxo/tests/core/saved/test_06.XP.out
  head/contrib/libxo/tests/core/saved/test_07.H.err
  head/contrib/libxo/tests/core/saved/test_07.H.out
  head/contrib/libxo/tests/core/saved/test_07.HIPx.err
  head/contrib/libxo/tests/core/saved/test_07.HIPx.out
  head/contrib/libxo/tests/core/saved/test_07.HP.err
  head/contrib/libxo/tests/core/saved/test_07.HP.out
  head/contrib/libxo/tests/core/saved/test_07.J.err
  head/contrib/libxo/tests/core/saved/test_07.J.out
  head/contrib/libxo/tests/core/saved/test_07.JP.err
  head/contrib/libxo/tests/core/saved/test_07.JP.out
  head/contrib/libxo/tests/core/saved/test_07.T.err
  head/contrib/libxo/tests/core/saved/test_07.T.out   (contents, props changed)
  head/contrib/libxo/tests/core/saved/test_07.X.err
  head/contrib/libxo/tests/core/saved/test_07.X.out
  head/contrib/libxo/tests/core/saved/test_07.XP.err
  head/contrib/libxo/tests/core/saved/test_07.XP.out
  head/contrib/libxo/tests/core/test_01.c   (contents, props changed)
  head/contrib/libxo/tests/core/test_02.c   (contents, props changed)
  head/contrib/libxo/tests/core/test_03.c   (contents, props changed)
  head/contrib/libxo/tests/core/test_04.c   (contents, props changed)
  head/contrib/libxo/tests/core/test_05.c   (contents, props changed)
  head/contrib/libxo/tests/core/test_06.c   (contents, props changed)
  head/contrib/libxo/tests/core/test_07.c   (contents, props changed)
  head/contrib/libxo/tests/xo/
  head/contrib/libxo/tests/xo/Makefile.am   (contents, props changed)
  head/contrib/libxo/tests/xo/saved/
  head/contrib/libxo/tests/xo/saved/xo_01.H.err
  head/contrib/libxo/tests/xo/saved/xo_01.H.out
  head/contrib/libxo/tests/xo/saved/xo_01.HIPx.err
  head/contrib/libxo/tests/xo/saved/xo_01.HIPx.out
  head/contrib/libxo/tests/xo/saved/xo_01.HP.err
  head/contrib/libxo/tests/xo/saved/xo_01.HP.out
  head/contrib/libxo/tests/xo/saved/xo_01.J.err
  head/contrib/libxo/tests/xo/saved/xo_01.J.out
  head/contrib/libxo/tests/xo/saved/xo_01.JP.err
  head/contrib/libxo/tests/xo/saved/xo_01.JP.out
  head/contrib/libxo/tests/xo/saved/xo_01.T.err
  head/contrib/libxo/tests/xo/saved/xo_01.T.out
  head/contrib/libxo/tests/xo/saved/xo_01.X.err
  head/contrib/libxo/tests/xo/saved/xo_01.X.out
  head/contrib/libxo/tests/xo/saved/xo_01.XP.err
  head/contrib/libxo/tests/xo/saved/xo_01.XP.out
  head/contrib/libxo/tests/xo/xo_01.sh   (contents, props changed)
  head/contrib/libxo/warnings.mk   (contents, props changed)
  head/contrib/libxo/xo/
  head/contrib/libxo/xo/Makefile.am   (contents, props changed)
  head/contrib/libxo/xo/xo.1   (contents, props changed)
  head/contrib/libxo/xo/xo.c   (contents, props changed)
  head/contrib/libxo/xohtml/
  head/contrib/libxo/xohtml/external/
  head/contrib/libxo/xohtml/external/jquery.js
  head/contrib/libxo/xohtml/external/jquery.qtip.css   (contents, props changed)
  head/contrib/libxo/xohtml/external/jquery.qtip.js
  head/contrib/libxo/xohtml/xohtml.css   (contents, props changed)
  head/contrib/libxo/xohtml/xohtml.js
  head/contrib/libxo/xohtml/xohtml.sh.in   (contents, props changed)
  head/contrib/libxo/xolint/
  head/contrib/libxo/xolint/Makefile.am   (contents, props changed)
  head/contrib/libxo/xolint/xolint.1   (contents, props changed)
  head/contrib/libxo/xolint/xolint.pl   (contents, props changed)

Added: head/contrib/libxo/.gitignore
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/contrib/libxo/.gitignore	Thu Oct 23 22:30:14 2014	(r273562)
@@ -0,0 +1,43 @@
+# Object files
+*.o
+
+# Libraries
+*.lib
+*.a
+
+# Shared objects (inc. Windows DLLs)
+*.dll
+*.so
+*.so.*
+*.dylib
+
+# Executables
+*.exe
+*.app
+
+*~
+*.orig
+
+aclocal.m4
+ar-lib
+autom4te.cache
+build
+compile
+config.guess
+config.h.in
+config.sub
+depcomp
+ltmain.sh
+missing
+
+Makefile.in
+configure
+.DS_Store
+
+xoconfig.h.in
+
+.gdbinit
+.gdbinit.local
+xtest
+xtest.dSYM
+tests/w

Added: head/contrib/libxo/.travis.yml
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/contrib/libxo/.travis.yml	Thu Oct 23 22:30:14 2014	(r273562)
@@ -0,0 +1,12 @@
+language: c
+
+script: printenv && uname -a && /bin/sh ./bin/setup.sh && cd build && ../configure --enable-warnings && make && sudo make install && make test
+
+notifications:
+  recipients:
+    - libslax-noise@googlegroups.com
+
+branches:
+  only:
+    - master
+    - develop

Added: head/contrib/libxo/Copyright
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/contrib/libxo/Copyright	Thu Oct 23 22:30:14 2014	(r273562)
@@ -0,0 +1,23 @@
+Copyright (c) 2014 Juniper Networks, Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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.

Added: head/contrib/libxo/LICENSE
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/contrib/libxo/LICENSE	Thu Oct 23 22:30:14 2014	(r273562)
@@ -0,0 +1,23 @@
+Copyright (c) 2014, Juniper Networks
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+  list of conditions and the following disclaimer.
+
+* 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 COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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.

Added: head/contrib/libxo/Makefile.am
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/contrib/libxo/Makefile.am	Thu Oct 23 22:30:14 2014	(r273562)
@@ -0,0 +1,102 @@
+#
+# $Id$
+#
+# Copyright 2014, Juniper Networks, Inc.
+# All rights reserved.
+# This SOFTWARE is licensed under the LICENSE provided in the
+# ../Copyright file. By downloading, installing, copying, or otherwise
+# using the SOFTWARE, you agree to be bound by the terms of that
+# LICENSE.
+
+ACLOCAL_AMFLAGS = -I m4
+
+SUBDIRS = libxo xo xolint tests doc
+bin_SCRIPTS=libxo-config
+dist_doc_DATA = Copyright
+
+EXTRA_DIST = \
+    libxo-config.in \
+    warnings.mk \
+    README.md \
+    INSTALL.md \
+    packaging/libxo.spec
+
+.PHONY: test tests
+
+test tests:
+	@(cd tests ; ${MAKE} test)
+
+errors:
+	@(cd tests/errors ; ${MAKE} test)
+
+docs:
+	@(cd doc ; ${MAKE} docs)
+
+
+DIST_FILES_DIR = ~/Dropbox/dist-files/
+GH_PAGES_DIR = gh-pages/
+PACKAGE_FILE = ${PACKAGE_TARNAME}-${PACKAGE_VERSION}.tar.gz
+
+upload: dist upload-docs
+	@echo "Remember to run:"
+	@echo "        gt tag ${PACKAGE_VERSION}"
+
+upload-docs: docs
+	@echo "Uploading libxo-manual.html ... "
+	@-[ -d ${GH_PAGES_DIR} ] \
+		&& echo "Updating manual on gh-pages ..." \
+		&& cp doc/libxo-manual.html ${GH_PAGES_DIR} \
+		&& (cd ${GH_PAGES_DIR} \
+			&& git commit -m 'new docs' \
+                               libxo-manual.html \
+			&& git push origin gh-pages ) ; true
+
+pkgconfigdir=$(libdir)/pkgconfig
+pkgconfig_DATA = packaging/${PACKAGE_NAME}.pc
+
+get-wiki:
+	git clone https://github.com/Juniper/${PACKAGE_NAME}.wiki.git wiki
+
+get-gh-pages:
+	git clone https://github.com/Juniper/${PACKAGE_NAME}.git \
+		gh-pages -b gh-pages
+
+UPDATE_PACKAGE_FILE = \
+    -e "s;__SHA1__;$$SHA1;" \
+    -e "s;__SHA256__;SHA256 (textproc/${PACKAGE_FILE}) = $$SHA256;" \
+    -e "s;__SIZE__;SIZE (textproc/${PACKAGE_FILE}) = $$SIZE;"
+
+GH_PACKAGING_DIR = packaging/${PACKAGE_VERSION}
+GH_PAGES_PACKAGE_DIR = ${GH_PAGES_DIR}/${GH_PACKAGING_DIR}
+
+packages:
+	@-[ -d ${GH_PAGES_DIR} ] && set -x \
+		&& echo "Updating packages on gh-pages ..." \
+		&& SHA1="`openssl sha1 ${PACKAGE_FILE} | awk '{print $$2}'`" \
+		&& SHA256="`openssl sha256 ${PACKAGE_FILE} | awk '{print $$2}'`" \
+		&& SIZE="`ls -l ${PACKAGE_FILE} | awk '{print $$5}'`" \
+		&& mkdir -p ${GH_PAGES_PACKAGE_DIR}/freebsd \
+		&& echo "... ${GH_PAGES_PACKAGE_DIR}/${PACKAGE_NAME}.rb ..." \
+		&& sed ${UPDATE_PACKAGE_FILE} \
+			packaging/${PACKAGE_NAME}.rb.base \
+			> ${GH_PAGES_PACKAGE_DIR}/${PACKAGE_NAME}.rb \
+		&& echo "... ${GH_PAGES_PACKAGE_DIR}/${PACKAGE_NAME}.spec ..." \
+		&& cp packaging/${PACKAGE_NAME}.spec \
+			${GH_PAGES_PACKAGE_DIR}/${PACKAGE_NAME}.spec \
+		&& echo "... ${GH_PAGES_PACKAGE_DIR}/freebsd ..." \
+		&& sed ${UPDATE_PACKAGE_FILE} \
+			${srcdir}/packaging/freebsd/distinfo.base \
+			> ${GH_PAGES_PACKAGE_DIR}/freebsd/distinfo \
+		&& cp ${srcdir}/packaging/freebsd/pkg-descr \
+			${GH_PAGES_PACKAGE_DIR}/freebsd/pkg-descr \
+		&& cp ${srcdir}/packaging/freebsd/pkg-plist \
+			${GH_PAGES_PACKAGE_DIR}/freebsd/pkg-plist \
+		&& cp ${srcdir}/packaging/freebsd/pkg-plist \
+			${GH_PAGES_PACKAGE_DIR}/freebsd/pkg-plist \
+		&& cp packaging/freebsd/port-Makefile \
+			${GH_PAGES_PACKAGE_DIR}/freebsd/Makefile \
+		&& (cd ${GH_PAGES_DIR} \
+			&& git add ${GH_PACKAGING_DIR} \
+			&& git commit -m 'new packaging data' \
+                               ${GH_PACKAGING_DIR} \
+			&& git push origin gh-pages ) ; true

Added: head/contrib/libxo/README.md
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/contrib/libxo/README.md	Thu Oct 23 22:30:14 2014	(r273562)
@@ -0,0 +1,62 @@
+libxo
+=====
+
+libxo - A Library for Generating Text, XML, JSON, and HTML Output
+
+The libxo library allows an application to generate text, XML, JSON,
+and HTML output using a common set of function calls.  The application
+decides at run time which output style should be produced.  The
+application calls a function "xo_emit" to product output that is
+described in a format string.  A "field descriptor" tells libxo what
+the field is and what it means.
+
+```
+    xo_emit(" {:lines/%7ju/%ju} {:words/%7ju/%ju} "
+            "{:characters/%7ju/%ju}{d:filename/%s}\n",
+            linect, wordct, charct, file);
+```
+
+Output can then be generated in various style, using the "--libxo"
+option: 
+
+```
+    % wc /etc/motd
+          25     165    1140 /etc/motd
+    % wc --libxo xml,pretty,warn /etc/motd
+    
+      
+        /etc/motd
+        25
+        165
+        1140
+      
+    
+    % wc --libxo json,pretty,warn /etc/motd
+    {
+      "wc": {
+        "file": [
+          {
+            "filename": "/etc/motd",
+            "lines": 25,
+            "words": 165,
+            "characters": 1140
+          }
+        ]
+      }
+    }
+    % wc --libxo html,pretty,warn /etc/motd
+    
+
+
25
+
+
165
+
+
1140
+
+
/etc/motd
+
+``` + +View the beautiful documentation at: + +http://juniper.github.io/libxo/libxo-manual.html Added: head/contrib/libxo/bin/Makefile.am ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libxo/bin/Makefile.am Thu Oct 23 22:30:14 2014 (r273562) @@ -0,0 +1,29 @@ +# +# Copyright 2013, Juniper Networks, Inc. +# All rights reserved. +# This SOFTWARE is licensed under the LICENSE provided in the +# ../Copyright file. By downloading, installing, copying, or otherwise +# using the SOFTWARE, you agree to be bound by the terms of that +# LICENSE. + +ACLOCAL_AMFLAGS = -I m4 + +EXTRA_DIST = gt setup.sh + +GT_INSTALL_DIR = ${prefix}/bin +GT_INSTALL_FILES = gt + +install-data-hook: + @echo "Installing gt ... " + @-mkdir -p ${GT_INSTALL_DIR} + @for file in ${GT_INSTALL_FILES} ; do \ + if [ -f $$file ]; then \ + rfile=$$file ; \ + else \ + rfile=${srcdir}/$$file ; \ + fi ; \ + mdir=${GT_INSTALL_DIR}/ ; \ + mkdir -p $$mdir ; \ + cp $$rfile $$mdir/ ; \ + done + @${CHMOD} a+x ${GT_INSTALL_DIR}/gt Added: head/contrib/libxo/bin/Zaliases ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libxo/bin/Zaliases Thu Oct 23 22:30:14 2014 (r273562) @@ -0,0 +1,24 @@ +set top_src=`pwd` +alias Zautoreconf "(cd $top_src ; autoreconf --install)" + +set opts=' \ +--with-libslax-prefix=/Users/phil/work/root \ +--enable-debug \ +--enable-warnings \ +--enable-printflike \ +--prefix ${HOME}/work/root \ +' +set opts=`echo $opts` + +setenv CONFIGURE_OPTS "$opts" +setenv ADB_PATH $top_src/build/libxo/.libs + +alias Zconfigure "(cd $top_src/build; ../configure $opts)" +alias Zbuild "(cd $top_src/build; make \!* )" +alias mi "(cd $top_src/build; make && make install); ." + +mkdir -p build +cd build + + +alias xx 'cc -I.. -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Werror -Waggregate-return -Wcast-align -Wcast-qual -Wchar-subscripts -Wcomment -Wformat -Wimplicit -Wmissing-declarations -Wnested-externs -Wparentheses -Wreturn-type -Wshadow -Wswitch -Wtrigraphs -Wuninitialized -Wunused -Wwrite-strings -fno-inline-functions-called-once -g -O2 -o xtest -DUNIT_TEST libxo.c' Added: head/contrib/libxo/bin/setup.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libxo/bin/setup.sh Thu Oct 23 22:30:14 2014 (r273562) @@ -0,0 +1,31 @@ +# +# Copyright 2013, Juniper Networks, Inc. +# All rights reserved. +# This SOFTWARE is licensed under the LICENSE provided in the +# ../Copyright file. By downloading, installing, copying, or otherwise +# using the SOFTWARE, you agree to be bound by the terms of that +# LICENSE. + + +if [ ! -f configure ]; then + vers=`autoreconf --version | head -1` + echo "Using" $vers + + autoreconf --install + + if [ ! -f configure ]; then + echo "Failed to create configure script" + exit 1 + fi +fi + +echo "Creating build directory ..." +mkdir build + +echo "Setup is complete. To build libslax:" + +echo " 1) Type 'cd build ; ../configure' to configure libslax" +echo " 2) Type 'make' to build libslax" +echo " 3) Type 'make install' to install libslax" + +exit 0 Added: head/contrib/libxo/build/.create ============================================================================== Added: head/contrib/libxo/configure.ac ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libxo/configure.ac Thu Oct 23 22:30:14 2014 (r273562) @@ -0,0 +1,263 @@ +# +# $Id$ +# +# See ./INSTALL for more info +# + +# +# Release numbering: even numbered dot releases are official ones, and +# odd numbers are development ones. The svn version of this file will +# only (ONLY!) ever (EVER!) contain odd numbers, so I'll always know if +# a particular user has the dist or svn release. +# + +AC_PREREQ(2.2) +AC_INIT([libxo], [0.1.4], [phil@juniper.net]) +AM_INIT_AUTOMAKE([-Wall -Werror foreign -Wno-portability]) + +# Support silent build rules. Requires at least automake-1.11. +# Disable with "configure --disable-silent-rules" or "make V=1" +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) + +AC_PROG_CC +AM_PROG_AR +AC_PROG_INSTALL +AC_CONFIG_MACRO_DIR([m4]) +AC_PROG_LN_S + +# Must be after AC_PROG_AR +LT_INIT([dlopen shared]) + +AC_PATH_PROG(BASENAME, basename, /usr/bin/basename) +AC_PATH_PROG(BISON, bison, /usr/bin/bison) +AC_PATH_PROG(CAT, cat, /bin/cat) +AC_PATH_PROG(CHMOD, chmod, /bin/chmod) +AC_PATH_PROG(CP, cp, /bin/cp) +AC_PATH_PROG(DIFF, diff, /usr/bin/diff) +AC_PATH_PROG(MKDIR, mkdir, /bin/mkdir) +AC_PATH_PROG(MV, mv, /bin/mv) +AC_PATH_PROG(RM, rm, /bin/rm) +AC_PATH_PROG(SED, sed, /bin/sed) + +AC_STDC_HEADERS + +# Checks for typedefs, structures, and compiler characteristics. +AC_C_INLINE +AC_TYPE_SIZE_T + +# Checks for library functions. +AC_FUNC_ALLOCA +AC_FUNC_MALLOC +AC_FUNC_REALLOC +AC_CHECK_FUNCS([bzero memmove strchr strcspn strerror strspn]) +AC_CHECK_FUNCS([sranddev srand strlcpy]) +AC_CHECK_FUNCS([fdopen getrusage]) +AC_CHECK_FUNCS([gettimeofday ctime]) +AC_CHECK_FUNCS([getpass]) +AC_CHECK_FUNCS([sysctlbyname]) +AC_CHECK_FUNCS([flock]) +AC_CHECK_FUNCS([asprintf]) + +AC_CHECK_HEADERS([dlfcn.h]) +AC_CHECK_HEADERS([tzfile.h]) +AC_CHECK_HEADERS([stdtime/tzfile.h]) +AC_CHECK_FUNCS([dlfunc]) + +AC_CHECK_HEADERS([sys/time.h]) +AC_CHECK_HEADERS([ctype.h errno.h stdio.h stdlib.h]) +AC_CHECK_HEADERS([string.h sys/param.h unistd.h ]) +AC_CHECK_HEADERS([sys/sysctl.h]) + +AC_CHECK_LIB([crypto], [MD5_Init]) +AM_CONDITIONAL([HAVE_LIBCRYPTO], [test "$HAVE_LIBCRYPTO" != "no"]) + +dnl +dnl Some packages need to be checked against version numbers so we +dnl define a function here for later use +dnl +AC_DEFUN([VERSION_TO_NUMBER], +[`$1 | sed -e 's/lib.* //' | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`]) + +LIBSLAX_CONFIG_PREFIX="" +LIBSLAX_SRC="" + +AC_ARG_WITH(libslax-prefix, + [ --with-libslax-prefix=[PFX] Specify location of libslax config], + LIBSLAX_CONFIG_PREFIX=$withval +) + +AC_MSG_CHECKING(for libslax) +if test "x$LIBSLAX_CONFIG_PREFIX" != "x" +then + SLAX_CONFIG=${LIBSLAX_CONFIG_PREFIX}/bin/slax-config +else + SLAX_CONFIG=slax-config +fi + +dnl +dnl make sure slax-config is executable, +dnl test version and init our variables +dnl + +if ${SLAX_CONFIG} --libs > /dev/null 2>&1 +then + LIBSLAX_VERSION=`$SLAX_CONFIG --version` + SLAX_BINDIR="`$SLAX_CONFIG --bindir | head -1`" + SLAX_OXTRADOCDIR="`$SLAX_CONFIG --oxtradoc | head -1`" + AC_MSG_RESULT($LIBSLAX_VERSION found) +else + LIBSLAX_VERSION= + SLAX_BINDIR= + SLAX_OXTRADOCDIR= + AC_MSG_RESULT([no]) +fi + +AC_SUBST(SLAX_BINDIR) +AC_SUBST(SLAX_OXTRADOCDIR) + +AC_MSG_CHECKING([whether to build with warnings]) +AC_ARG_ENABLE([warnings], + [ --enable-warnings Turn on compiler warnings], + [LIBXO_WARNINGS=$enableval], + [LIBXO_WARNINGS=no]) +AC_MSG_RESULT([$LIBXO_WARNINGS]) +AM_CONDITIONAL([LIBXO_WARNINGS_HIGH], [test "$LIBXO_WARNINGS" != "no"]) + +AC_MSG_CHECKING([whether to build with debugging]) +AC_ARG_ENABLE([debug], + [ --enable-debug Turn on debugging], + [LIBXO_DEBUG=yes; AC_DEFINE([LIBXO_DEBUG], [1], [Enable debugging])], + [LIBXO_DEBUG=no]) +AC_MSG_RESULT([$LIBXO_DEBUG]) +AM_CONDITIONAL([LIBXO_DEBUG], [test "$LIBXO_DEBUG" != "no"]) + +AC_CHECK_LIB([m], [lrint]) +AM_CONDITIONAL([HAVE_LIBM], [test "$HAVE_LIBM" != "no"]) + +AC_MSG_CHECKING([compiler for gcc]) +HAVE_GCC=no +if test "${CC}" != ""; then + HAVE_GCC=`${CC} --version 2>&1 | grep GCC` + if test "${HAVE_GCC}" != ""; then + HAVE_GCC=yes + else + HAVE_GCC=no + fi +fi +AC_MSG_RESULT([$HAVE_GCC]) +AM_CONDITIONAL([HAVE_GCC], [test "$HAVE_GCC" = "yes"]) + +AC_MSG_CHECKING([whether to build with printflike]) +AC_ARG_ENABLE([printflike], + [ --enable-printflike Enable use of GCC __printflike attribute], + [HAVE_PRINTFLIKE=yes; + AC_DEFINE([HAVE_PRINTFLIKE], [1], [Support printflike])], + [HAVE_PRINTFLIKE=no]) +AC_MSG_RESULT([$HAVE_PRINTFLIKE]) +AM_CONDITIONAL([HAVE_PRINTFLIKE], [test "$HAVE_PRINTFLIKE" != ""]) + +AC_MSG_CHECKING([whether to build with LIBXO_OPTIONS]) +AC_ARG_ENABLE([libxo-options], + [ --disable-libxo-options Turn off support for LIBXO_OPTIONS], + [LIBXO_OPTS=$enableval], + [LIBXO_OPTS=yes]) +AC_MSG_RESULT([$LIBXO_OPTS]) +AM_CONDITIONAL([NO_LIBXO_OPTIONS], [test "$LIBXO_OPTS" != "yes"]) + + +case $host_os in + darwin*) + LIBTOOL=glibtool + ;; + Linux*|linux*) + CFLAGS="-D_GNU_SOURCE $CFLAGS" + LDFLAGS=-ldl + ;; + cygwin*|CYGWIN*) + LDFLAGS=-no-undefined + ;; +esac + +case $prefix in + NONE) + prefix=/usr/local + ;; +esac + +XO_LIBS=-lxo +XO_SRCDIR=${srcdir} +XO_LIBDIR=${libdir} +XO_BINDIR=${bindir} +XO_INCLUDEDIR=${includedir} + +AC_SUBST(XO_SRCDIR) +AC_SUBST(XO_LIBDIR) +AC_SUBST(XO_BINDIR) +AC_SUBST(XO_INCLUDEDIR) + +AC_ARG_WITH(share-dir, + [ --with-share-dir=[DIR] Specify location of shared files], + [XO_SHAREDIR=$withval], + [XO_SHAREDIR=$datarootdir/libxo] +) +XO_SHAREDIR=`echo $XO_SHAREDIR | sed "s;\\${prefix};$prefix;"` +AC_SUBST(XO_SHAREDIR) + +dnl for the spec file +RELDATE=`date +'%Y-%m-%d%n'` +AC_SUBST(RELDATE) + +AC_MSG_RESULT(Using configure dir $ac_abs_confdir) + +if test -d $ac_abs_confdir/.git ; then + extra=`git branch | awk '/\*/ { print $2 }'` + if test "$extra" != "" -a "$extra" != "master" + then + LIBXO_VERSION_EXTRA="-git-$extra" + fi +fi + +LIBXO_VERSION=$PACKAGE_VERSION +LIBXO_VERSION_NUMBER=VERSION_TO_NUMBER(echo $PACKAGE_VERSION) +AC_SUBST(LIBXO_VERSION) +AC_SUBST(LIBXO_VERSION_NUMBER) +AC_SUBST(LIBXO_VERSION_EXTRA) + +AC_CONFIG_HEADERS([libxo/xoconfig.h]) +AC_CONFIG_FILES([ + Makefile + libxo-config + xohtml/xohtml.sh + libxo/Makefile + libxo/xoversion.h + xo/Makefile + xolint/Makefile + packaging/libxo.pc + doc/Makefile + tests/Makefile + tests/core/Makefile + tests/xo/Makefile + packaging/libxo.spec +]) +AC_OUTPUT + +AC_MSG_NOTICE([summary of build options: + + libxo version: ${VERSION} ${LIBXO_VERSION_EXTRA} + host type: ${host} / ${host_os} + install prefix: ${prefix} + srcdir: ${XO_SRCDIR} + libdir: ${XO_LIBDIR} + bindir: ${XO_BINDIR} + includedir: ${XO_INCLUDEDIR} + share dir: ${XO_SHAREDIR} + + compiler: ${CC} (${HAVE_GCC:-no}) + compiler flags: ${CFLAGS} + library types: Shared=${enable_shared}, Static=${enable_static} + + warnings: ${LIBXO_WARNINGS:-no} + debug: ${LIBXO_DEBUG:-no} + printf-like: ${HAVE_PRINTFLIKE:-no} + libxo-options: ${LIBXO_OPTS:-no} +]) Added: head/contrib/libxo/doc/Makefile.am ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libxo/doc/Makefile.am Thu Oct 23 22:30:14 2014 (r273562) @@ -0,0 +1,65 @@ +# +# $Id$ +# +# Copyright 2014, Juniper Networks, Inc. +# All rights reserved. +# This SOFTWARE is licensed under the LICENSE provided in the +# ../Copyright file. By downloading, installing, copying, or otherwise +# using the SOFTWARE, you agree to be bound by the terms of that +# LICENSE. + +OXTRADOC_DIR = ${SLAX_OXTRADOCDIR} +OXTRADOC_PREFIX = ${OXTRADOC_DIR} +OXTRADOC = ${OXTRADOC_DIR}/oxtradoc +SLAXPROC_BINDIR = ${SLAX_BINDIR} + +XML2RFC = ${OXTRADOC_DIR}/xml2rfc.tcl +XML2HTMLDIR = ${OXTRADOC_DIR} +XML2HTMLBIN = ${XML2HTMLDIR}/rfc2629-to-html.slax +SLAXPROC = ${SLAX_BINDIR}/slaxproc + +SLAXPROC_ARGS = \ + -a oxtradoc-dir ${OXTRADOC_DIR} \ + -a oxtradoc-install-dir ${OXTRADOC_DIR} \ + -a anchor-prefix docs + +SLAXPROC_ARGS_INLINE = \ + -a oxtradoc-inline yes + +SLAXPROC_ARGS += ${SLAXPROC_ARGS_INLINE} + +XML2HTML = \ + ${SLAXPROC} -g -e -I ${OXTRADOC_DIR} -I . \ + ${SLAXPROC_ARGS} \ + ${XML2HTMLBIN} + +OX_ARGS = -P ${OXTRADOC_PREFIX} -L ${OXTRADOC_PREFIX} +OX_ARGS += -S ${SLAXPROC} -p doc +OX_CMD = ${PERL} ${PERLOPTS} ${OXTRADOC} ${OX_ARGS} +OXTRADOC_CMD = ${OX_CMD} + + +OUTPUT = libxo-manual +INPUT = libxo.txt + +EXTRA_DIST = \ + ${INPUT} \ + ${OUTPUT}.html \ + ${OUTPUT}.txt + +doc docs: ${OUTPUT}.txt ${OUTPUT}.html + +${OUTPUT}.txt: ${INPUT} ${OXTRADOC} xolint.txt + ${OXTRADOC_CMD} -m text -o $@ $< + +${OUTPUT}.html: ${INPUT} ${OXTRADOC} ${XML2HTMLBIN} xolint.txt + ${OXTRADOC_CMD} -m html -o $@ $< + +xolint.txt: ${top_srcdir}/xolint/xolint.pl + perl ${top_srcdir}/xolint/xolint.pl -D > xolint.txt + +CLEANFILES = \ +${OUTPUT}.xml \ +${OUTPUT}.txt \ +${OUTPUT}.fxml \ +${OUTPUT}.html Added: head/contrib/libxo/doc/libxo.txt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libxo/doc/libxo.txt Thu Oct 23 22:30:14 2014 (r273562) @@ -0,0 +1,2400 @@ +# +# Copyright (c) 2014, Juniper Networks, Inc. +# All rights reserved. +# This SOFTWARE is licensed under the LICENSE provided in the +# ../Copyright file. By downloading, installing, copying, or +# using the SOFTWARE, you agree to be bound by the terms of that +# LICENSE. +# Phil Shafer, July 2014 +# + +* libxo + +libxo - A Library for Generating Text, XML, JSON, and HTML Output + +You live in the present, but you want to live in the future. You'd +love a flying car, but need to get to work today. You want to support +features like XML, JSON, and HTML rendering to allow integration with +NETCONF, REST, and web browsers, but you need to make text output for +command line users. And you don't want multiple code paths that can't +help but get out of sync. None of this "if (xml) {... } else {...}" +logic. And ifdefs are right out. But you'd really, really like all +the fancy features that modern encoding formats can provide. + +The libxo library allows an application to generate text, XML, JSON, +and HTML output using a common set of function calls. The application +decides at run time which output style should be produced. The +application calls a function "xo_emit" to product output that is +described in a format string. A "field descriptor" tells libxo what +the field is and what it means. Each field descriptor is placed in +braces with a printf-like format string: + + xo_emit(" {:lines/%7ju} {:words/%7ju} " + "{:characters/%7ju}{d:filename/%s}\n", + linect, wordct, charct, file); + +Each field can have a role, with the 'value' role being the default, +and the role tells libxo how and when to render that field. Output +can then be generated in various style, using the "--libxo" option: + + % wc /etc/motd + 25 165 1140 /etc/motd + % wc --libxo xml,pretty,warn /etc/motd + + + /etc/motd + 25 + 165 + 1140 + + + % wc --libxo json,pretty,warn /etc/motd + { + "wc": { + "file": [ + { + "filename": "/etc/motd", + "lines": 25, + "words": 165, + "characters": 1140 + } + ] + } + } + % wc --libxo html,pretty,warn /etc/motd +
+
+
25
+
+
165
+
+
1140
+
+
/etc/motd
+
+ +** Getting libxo + +libxo lives on github as: + + https://github.com/Juniper/libxo + +The latest release of libxo is available at: + + https://github.com/Juniper/libxo/releases + +We are following the branching scheme from +^http://nvie.com/posts/a-successful-git-branching-model/^ +which means we will do development under the "develop" branch, and +release from the master. To clone a developer tree, run the following +command: + + git clone https://github.com/Juniper/libxo.git -b develop + +We're using semantic release numbering. + +* Overview + +Most unix commands emit text output aimed at humans. It is designed +to be parsed and understood by a user. Humans are gifted at extracted +details and pattern matching. Often programmers need to extract +information from this human-oriented output. Programmers use tools +like grep, awk, and regular expressions to ferret out the pieces of +information they need. Such solutions are fragile and require +updates when output contents change or evolve, requiring testing and +validation. + +Modern tool developers favors encoding schemes like XML and JSON, +which allow trivial parsing and extraction of data. Such formats are +simple, well understood, hierarchical, easily parsed, and often +integrate easier with common tools and environments. + +In addition, modern reality means that more output ends up in web +browsers than in terminals, making HTML output valuable. + +libxo allows a single set of function calls in source code to generate +traditional text output, as well as XML and JSON formatted data. HTML +can also be generated; "
" elements surround the traditional text +output, with attributes that detail how to render the data. + +A single libxo function call in source code is all that's required: + + xo_emit("Connecting to {:host}.{:domain}...\n", host, domain); + + Text: + Connection to my-box.example.com... + XML: + my-box + example.com + JSON: + "host": my-box", + "domain": "example.com" + +For brevity, the HTML output is emitted. + +** Encoding Styles + +There are four encoding styles supported by libxo: TEXT, HTML, JSON, +and XML. JSON and XML are suitable for encoding data, while TEXT and +HTML are suited for display to the user. TEXT output can be display +on a terminal session, allowing compatibility with traditional usage. +HTML can be matched with a small CSS file to permit rendering in any +HTML5 browser. XML output is suitable for tools like XPath and +protocols like NETCONF. JSON output can be used for RESTful APIs. + +*** Text Output + +Most traditional programs generate text output on standard output, +with contents like: + + 36 ./src + 40 ./bin + 90 . + +In this example (taken from du source code), the code to generate this +data might look like: + + printf("%d\t%s\n", num_blocks, path); + +Simple, direct, obvious. But it's only making text output. Imagine +using a single code path to make text, XML, JSON or HTML, deciding at +run time which to generate. + +libxo expands on the idea of printf format strings to make a single +format containing instructions for creating multiple output styles: + + xo_emit("{:blocks/%d}\t{:path/%s}\n", num_blocks, path); + +This line will generate the same text output as the earlier printf +call, but also has enough information to generate XML, JSON, and HTML. + +The following sections introduce the other formats. + +*** XML Output + +XML output consists of a hierarchical set of elements, each encoded +with a start tag and an end tag. The element should be named for data +value that it is encoding: + + + 36 + ./src + + + 40 + ./bin + + + 90 + . + + +XML is a W3C standard for encoding data. See w3c.org/TR/xml for +additional information. + +*** JSON Output + +JSON output consists of a hierarchical set of objects and lists, each +encoded with a quoted name, a colon, and a value. If the value is a +string, it must be quoted, but numbers are not quoted. Objects are +encoded using braces; lists are encoded using square brackets. +Data inside objects and lists is separated using commas: + + items: [ + { "blocks": 36, "path" : "./src" }, + { "blocks": 40, "path" : "./bin" }, + { "blocks": 90, "path" : "./" } + ] + +*** HTML Output + +HTML output is designed to allow the output to be rendered in a web +browser with minimal effort. Each piece of output data is rendered +inside a
element, with a class name related to the role of the +data. By using a small set of class attribute values, a CSS +stylesheet can render the HTML into rich text that mirrors the +traditional text content. + +Additional attributes can be enabled to provide more details about the +data, including data type, description, and an XPath location. + +
+
36
+
+
./src
+
+
+
40
+
+
./bin
+
+
+
90
+
+
./
+
+ +** Format Strings @format-strings@ + +libxo uses format strings to control the rendering of data into the +various output styles. Each format string contains a set of zero or +more field descriptions, which describe independent data fields. Each +field description contains a set of modifiers, a content string, and +zero, one, or two format descriptors. The modifiers tell libxo what +the field is and how to treat it, while the format descriptors are +formatting instructions using printf-style format strings, telling +libxo how to format the field. The field description is placed inside +a set of braces, with a colon (":") after the modifiers and a slash +("/") before each format descriptors. Text may be intermixed with +field descriptions within the format string. + +The field description is given as follows: + + '{' [ role | modifier ]* ':' [ content ] + [ '/' field-format [ '/' encoding-format ]] '}' + +The role describes the function of the field, while the modifiers +enable optional behaviors. The contents, field-format, and +encoding-format are used in varying ways, based on the role. These +are described in the following sections. + +In the following example, three field descriptors appear. The first +is a padding field containing three spaces of padding, the second is a +label ("In stock"), and the third is a value field ("in-stock"). The +in-stock field has a "%u" format that will parse the next argument +passed to the xo_emit function as an unsigned integer. + + xo_emit("{P: }{Lwc:In stock}{:in-stock/%u}\n", 65); + +This single line of code can generate text (" In stock: 65\n"), XML +("65"), JSON ('"in-stock": 6'), or HTML (too +lengthy to be listed here). + +*** Modifier Roles + +Modifiers are optional, and indicate the role and formatting of the +content. The roles are listed below; only one role is permitted: + +|---+--------------+-------------------------------------------------| +| M | Name | Description | +|---+--------------+-------------------------------------------------| +| D | decoration | Field is non-text (e.g. colon, comma) | +| E | error | Field is an error message | +| L | label | Field is text that prefixes a value | +| N | note | Field is text that follows a value | +| P | padding | Field is spaces needed for vertical alignment | +| T | title | Field is a title value for headings | +| U | units | Field is the units for the previous value field | *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Thu Oct 23 22:33:28 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B8D856D2; Thu, 23 Oct 2014 22:33:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9A2BFC10; Thu, 23 Oct 2014 22:33:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NMXSke003781; Thu, 23 Oct 2014 22:33:28 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NMXSHW003779; Thu, 23 Oct 2014 22:33:28 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201410232233.s9NMXSHW003779@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Thu, 23 Oct 2014 22:33:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273563 - head/contrib/libxo/libxo X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 22:33:28 -0000 Author: marcel Date: Thu Oct 23 22:33:27 2014 New Revision: 273563 URL: https://svnweb.freebsd.org/changeset/base/273563 Log: Add generated headers xoversion.h and xoconfig.h. These are the result of configuring the source tree: % automake --add-missing % autoconf % ./configure Added: head/contrib/libxo/libxo/xoconfig.h (contents, props changed) head/contrib/libxo/libxo/xoversion.h (contents, props changed) Added: head/contrib/libxo/libxo/xoconfig.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libxo/libxo/xoconfig.h Thu Oct 23 22:33:27 2014 (r273563) @@ -0,0 +1,199 @@ +/* libxo/xoconfig.h. Generated from xoconfig.h.in by configure. */ +/* libxo/xoconfig.h.in. Generated from configure.ac by autoheader. */ + +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ +/* #undef CRAY_STACKSEG_END */ + +/* Define to 1 if using `alloca.c'. */ +/* #undef C_ALLOCA */ + +/* Define to 1 if you have `alloca', as a function or macro. */ +#define HAVE_ALLOCA 1 + +/* Define to 1 if you have and it should be used (not on Ultrix). + */ +/* #undef HAVE_ALLOCA_H */ + +/* Define to 1 if you have the `asprintf' function. */ +#define HAVE_ASPRINTF 1 + +/* Define to 1 if you have the `bzero' function. */ +#define HAVE_BZERO 1 + +/* Define to 1 if you have the `ctime' function. */ +#define HAVE_CTIME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_CTYPE_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the `dlfunc' function. */ +#define HAVE_DLFUNC 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the `fdopen' function. */ +#define HAVE_FDOPEN 1 + +/* Define to 1 if you have the `flock' function. */ +#define HAVE_FLOCK 1 + +/* Define to 1 if you have the `getpass' function. */ +#define HAVE_GETPASS 1 + +/* Define to 1 if you have the `getrusage' function. */ +#define HAVE_GETRUSAGE 1 + +/* Define to 1 if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `crypto' library (-lcrypto). */ +#define HAVE_LIBCRYPTO 1 + +/* Define to 1 if you have the `m' library (-lm). */ +#define HAVE_LIBM 1 + +/* Define to 1 if your system has a GNU libc compatible `malloc' function, and + to 0 otherwise. */ +#define HAVE_MALLOC 1 + +/* Define to 1 if you have the `memmove' function. */ +#define HAVE_MEMMOVE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Support printflike */ +/* #undef HAVE_PRINTFLIKE */ + +/* Define to 1 if your system has a GNU libc compatible `realloc' function, + and to 0 otherwise. */ +#define HAVE_REALLOC 1 + +/* Define to 1 if you have the `srand' function. */ +#define HAVE_SRAND 1 + +/* Define to 1 if you have the `sranddev' function. */ +#define HAVE_SRANDDEV 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_STDTIME_TZFILE_H */ + +/* Define to 1 if you have the `strchr' function. */ +#define HAVE_STRCHR 1 + +/* Define to 1 if you have the `strcspn' function. */ +#define HAVE_STRCSPN 1 + +/* Define to 1 if you have the `strerror' function. */ +#define HAVE_STRERROR 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strlcpy' function. */ +#define HAVE_STRLCPY 1 + +/* Define to 1 if you have the `strspn' function. */ +#define HAVE_STRSPN 1 + +/* Define to 1 if you have the `sysctlbyname' function. */ +#define HAVE_SYSCTLBYNAME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SYSCTL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_TZFILE_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Enable debugging */ +/* #undef LIBXO_DEBUG */ + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#define LT_OBJDIR ".libs/" + +/* Name of package */ +#define PACKAGE "libxo" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "phil@juniper.net" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "libxo" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "libxo 0.1.4" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "libxo" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "0.1.4" + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at runtime. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +/* #undef STACK_DIRECTION */ + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Version number of package */ +#define VERSION "0.1.4" + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif + +/* Define to rpl_malloc if the replacement function should be used. */ +/* #undef malloc */ + +/* Define to rpl_realloc if the replacement function should be used. */ +/* #undef realloc */ + +/* Define to `unsigned int' if does not define. */ +/* #undef size_t */ Added: head/contrib/libxo/libxo/xoversion.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libxo/libxo/xoversion.h Thu Oct 23 22:33:27 2014 (r273563) @@ -0,0 +1,38 @@ +/* + * $Id$ + * + * Copyright (c) 2014, Juniper Networks, Inc. + * All rights reserved. + * This SOFTWARE is licensed under the LICENSE provided in the + * ../Copyright file. By downloading, installing, copying, or otherwise + * using the SOFTWARE, you agree to be bound by the terms of that + * LICENSE. + * + * xoversion.h -- compile time constants for libxo + * NOTE: This file is generated from xoversion.h.in. + */ + +#ifndef LIBXO_XOVERSION_H +#define LIBXO_XOVERSION_H + +/** + * The version string + */ +#define LIBXO_VERSION "0.1.4" + +/** + * The version number + */ +#define LIBXO_VERSION_NUMBER 1004 + +/** + * The version number as a string + */ +#define LIBXO_VERSION_STRING "1004" + +/** + * The version number extra info as a string + */ +#define LIBXO_VERSION_EXTRA "" + +#endif /* LIBXO_XOVERSION_H */ From owner-svn-src-all@FreeBSD.ORG Thu Oct 23 22:42:57 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 32BEA956; Thu, 23 Oct 2014 22:42:57 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1F6A2D00; Thu, 23 Oct 2014 22:42:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NMguni008310; Thu, 23 Oct 2014 22:42:56 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NMguV9008309; Thu, 23 Oct 2014 22:42:56 GMT (envelope-from des@FreeBSD.org) Message-Id: <201410232242.s9NMguV9008309@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: des set sender to des@FreeBSD.org using -f From: Dag-Erling Smørgrav Date: Thu, 23 Oct 2014 22:42:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273564 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 22:42:57 -0000 Author: des Date: Thu Oct 23 22:42:56 2014 New Revision: 273564 URL: https://svnweb.freebsd.org/changeset/base/273564 Log: In all cases except CTLTYPE_STRING, penv is NULL here, so passing it indiscriminately to printf() and freeenv() is incorrect. Add a NULL check before freeenv(); as for printf(), we could use req.newptr instead, but we'd have to select the correct format string based on the type, and that's too much work for an error message, so just remove it. Modified: head/sys/kern/kern_sysctl.c Modified: head/sys/kern/kern_sysctl.c ============================================================================== --- head/sys/kern/kern_sysctl.c Thu Oct 23 22:33:27 2014 (r273563) +++ head/sys/kern/kern_sysctl.c Thu Oct 23 22:42:56 2014 (r273564) @@ -280,11 +280,10 @@ sysctl_load_tunable_by_oid_locked(struct } error = sysctl_root_handler_locked(oidp, oidp->oid_arg1, oidp->oid_arg2, &req); - if (error != 0) { - printf("Setting sysctl '%s' to '%s' failed: %d\n", - path, penv, error); - } - freeenv(penv); + if (error != 0) + printf("Setting sysctl %s failed: %d\n", path, error); + if (penv != NULL) + freeenv(penv); } void From owner-svn-src-all@FreeBSD.ORG Thu Oct 23 22:47:28 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 927DCAEC; Thu, 23 Oct 2014 22:47:28 +0000 (UTC) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id 55FB8D26; Thu, 23 Oct 2014 22:47:28 +0000 (UTC) Received: from nine.des.no (smtp.des.no [194.63.250.102]) by smtp-int.des.no (Postfix) with ESMTP id 41001A205; Thu, 23 Oct 2014 22:47:27 +0000 (UTC) Received: by nine.des.no (Postfix, from userid 1001) id 58563102C3; Fri, 24 Oct 2014 00:47:16 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Xin LI Subject: Re: svn commit: r273552 - head/sys/kern References: <201410231823.s9NINpXD082633@svn.freebsd.org> Date: Fri, 24 Oct 2014 00:47:16 +0200 In-Reply-To: <201410231823.s9NINpXD082633@svn.freebsd.org> (Xin LI's message of "Thu, 23 Oct 2014 18:23:51 +0000 (UTC)") Message-ID: <86egtyz9mz.fsf@nine.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 22:47:28 -0000 Xin LI writes: > Log: > Test if 'env' is NULL before doing memset() and strlen(), > the caller may pass NULL to freeenv(). If this is in response to a panic in early boot, the real bug is elsewhere (see r273564). Adding a NULL check here only hides it. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-all@FreeBSD.ORG Thu Oct 23 23:12:31 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0446B1EB; Thu, 23 Oct 2014 23:12:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E4C5EFBC; Thu, 23 Oct 2014 23:12:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NNCUZK022379; Thu, 23 Oct 2014 23:12:30 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NNCUxU022378; Thu, 23 Oct 2014 23:12:30 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201410232312.s9NNCUxU022378@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Thu, 23 Oct 2014 23:12:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273566 - head/sys/dev/gpio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 23:12:31 -0000 Author: loos Date: Thu Oct 23 23:12:30 2014 New Revision: 273566 URL: https://svnweb.freebsd.org/changeset/base/273566 Log: Provide a working GPIOBUS_IVAR() macro for FDT systems. Modified: head/sys/dev/gpio/gpiobusvar.h Modified: head/sys/dev/gpio/gpiobusvar.h ============================================================================== --- head/sys/dev/gpio/gpiobusvar.h Thu Oct 23 23:11:04 2014 (r273565) +++ head/sys/dev/gpio/gpiobusvar.h Thu Oct 23 23:12:30 2014 (r273566) @@ -41,7 +41,12 @@ #include "gpio_if.h" +#ifdef FDT +#define GPIOBUS_IVAR(d) (struct gpiobus_ivar *) \ + &((struct ofw_gpiobus_devinfo *)device_get_ivars(d))->opd_dinfo +#else #define GPIOBUS_IVAR(d) (struct gpiobus_ivar *) device_get_ivars(d) +#endif #define GPIOBUS_SOFTC(d) (struct gpiobus_softc *) device_get_softc(d) #define GPIOBUS_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) #define GPIOBUS_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) From owner-svn-src-all@FreeBSD.ORG Thu Oct 23 23:14:24 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7E9C133C; Thu, 23 Oct 2014 23:14:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6A478FC7; Thu, 23 Oct 2014 23:14:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NNEOrc022666; Thu, 23 Oct 2014 23:14:24 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NNENYh022661; Thu, 23 Oct 2014 23:14:23 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201410232314.s9NNENYh022661@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Thu, 23 Oct 2014 23:14:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273567 - in head: etc/mtree lib lib/libxo X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 23:14:24 -0000 Author: marcel Date: Thu Oct 23 23:14:23 2014 New Revision: 273567 URL: https://svnweb.freebsd.org/changeset/base/273567 Log: Hook libxo to the build. Sponsored by: Juniper Networks, Inc. Added: head/lib/libxo/ head/lib/libxo/Makefile (contents, props changed) Modified: head/etc/mtree/BSD.include.dist head/lib/Makefile Modified: head/etc/mtree/BSD.include.dist ============================================================================== --- head/etc/mtree/BSD.include.dist Thu Oct 23 23:12:30 2014 (r273566) +++ head/etc/mtree/BSD.include.dist Thu Oct 23 23:14:23 2014 (r273567) @@ -249,6 +249,8 @@ .. libmilter .. + libxo + .. lzma .. machine Modified: head/lib/Makefile ============================================================================== --- head/lib/Makefile Thu Oct 23 23:12:30 2014 (r273566) +++ head/lib/Makefile Thu Oct 23 23:14:23 2014 (r273567) @@ -106,6 +106,7 @@ SUBDIR= ${SUBDIR_ORDERED} \ ${_libvgl} \ ${_libvmmapi} \ libwrap \ + libxo \ liby \ ${_libypclnt} \ libz \ Added: head/lib/libxo/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libxo/Makefile Thu Oct 23 23:14:23 2014 (r273567) @@ -0,0 +1,36 @@ +# $FreeBSD$ + +LIBXO= ${.CURDIR:H:H}/contrib/libxo + +.PATH: ${LIBXO}/libxo + +LIB= xo +SHLIB_MAJOR=0 + +SRCS= libxo.c + +CFLAGS+=-I${LIBXO}/libxo + +INCS= xo.h +INCSDIR=${INCLUDEDIR}/libxo + +MAN+= libxo.3 +MAN+= xo_attr.3 \ + xo_create.3 \ + xo_emit.3 \ + xo_err.3 \ + xo_finish.3 \ + xo_flush.3 \ + xo_no_setlocale.3 \ + xo_open_container.3 \ + xo_open_list.3 \ + xo_parse_args.3 \ + xo_set_allocator.3 \ + xo_set_flags.3 \ + xo_set_info.3 \ + xo_set_options.3 \ + xo_set_style.3 \ + xo_set_writer.3 +MAN+= xo_format.5 + +.include From owner-svn-src-all@FreeBSD.ORG Thu Oct 23 23:16:22 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DE9E64F0; Thu, 23 Oct 2014 23:16:22 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C4CDDFDF; Thu, 23 Oct 2014 23:16:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NNGMZG022995; Thu, 23 Oct 2014 23:16:22 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NNGMO1022993; Thu, 23 Oct 2014 23:16:22 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201410232316.s9NNGMO1022993@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Thu, 23 Oct 2014 23:16:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273568 - in head/usr.bin: . xo X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 23:16:23 -0000 Author: marcel Date: Thu Oct 23 23:16:21 2014 New Revision: 273568 URL: https://svnweb.freebsd.org/changeset/base/273568 Log: Hook xo(1) to the build -- it's like echo, but uses libxo to support emitting machine-readable output. Sponsored by: Juniper Networks, Inc. Added: head/usr.bin/xo/ head/usr.bin/xo/Makefile (contents, props changed) Modified: head/usr.bin/Makefile Modified: head/usr.bin/Makefile ============================================================================== --- head/usr.bin/Makefile Thu Oct 23 23:14:23 2014 (r273567) +++ head/usr.bin/Makefile Thu Oct 23 23:16:21 2014 (r273568) @@ -196,6 +196,7 @@ SUBDIR= alias \ xargs \ xinstall \ ${_xlint} \ + xo \ ${_xstr} \ xz \ xzdec \ Added: head/usr.bin/xo/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/xo/Makefile Thu Oct 23 23:16:21 2014 (r273568) @@ -0,0 +1,16 @@ +# $FreeBSD$ + +LIBXO= ${.CURDIR:H:H}/contrib/libxo + +.PATH: ${LIBXO}/xo + +PROG= xo +MAN= xo.1 + +# XXX For xoversion.h +CFLAGS+=-I${LIBXO}/libxo + +DPADD= ${LIBXO} +LDADD= -lxo + +.include From owner-svn-src-all@FreeBSD.ORG Thu Oct 23 23:19:06 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 061596CB; Thu, 23 Oct 2014 23:19:06 +0000 (UTC) Received: from anubis.delphij.net (anubis.delphij.net [IPv6:2001:470:1:117::25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "anubis.delphij.net", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id DFC6DA; Thu, 23 Oct 2014 23:19:05 +0000 (UTC) Received: from zeta.ixsystems.com (unknown [12.229.62.2]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by anubis.delphij.net (Postfix) with ESMTPSA id 80CF4155B6; Thu, 23 Oct 2014 16:19:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=delphij.net; s=anubis; t=1414106345; x=1414120745; bh=gFPx6W3mB0z0cvggR1pOM7gAxuJu1PamOT00C1uIPZc=; h=Date:From:Reply-To:To:CC:Subject:References:In-Reply-To; b=PWpGVGL9a3Snc79Okr93U84Vzz89+A3zM9D5ZrPWRFPfuJx875IkrCHa5+jGBBI0W e1u3DMwwEb5ThOTWKxQZtUav427vVb3i/GCO5BSBeFYeps5eRC7IZd0D8t+EIuoIuP bslROPNZSmfxBUlVcxf/REo6jZcYPvuc708XBuOc= Message-ID: <54498CE9.1090000@delphij.net> Date: Thu, 23 Oct 2014 16:19:05 -0700 From: Xin Li Reply-To: d@delphij.net Organization: The FreeBSD Project MIME-Version: 1.0 To: =?UTF-8?B?RGFnLUVybGluZyBTbcO4cmdyYXY=?= , Xin LI Subject: Re: svn commit: r273552 - head/sys/kern References: <201410231823.s9NINpXD082633@svn.freebsd.org> <86egtyz9mz.fsf@nine.des.no> In-Reply-To: <86egtyz9mz.fsf@nine.des.no> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 23:19:06 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 On 10/23/14 15:47, Dag-Erling Smørgrav wrote: > Xin LI writes: >> Log: Test if 'env' is NULL before doing memset() and strlen(), >> the caller may pass NULL to freeenv(). > > If this is in response to a panic in early boot, the real bug is > elsewhere (see r273564). Adding a NULL check here only hides it. Yes that would fix it. Does this look good to you? Index: sys/kern/kern_environment.c =================================================================== - --- sys/kern/kern_environment.c (revision 273564) +++ sys/kern/kern_environment.c (working copy) @@ -262,7 +262,8 @@ void freeenv(char *env) { - - if (dynamic_kenv && env != NULL) { + MPASS(env != NULL); + if (dynamic_kenv) { memset(env, 0, strlen(env)); free(env, M_KENV); } Cheers, - -- Xin LI https://www.delphij.net/ FreeBSD - The Power to Serve! Live free or die -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0 iQIcBAEBCgAGBQJUSYzoAAoJEJW2GBstM+nsSnYP/i4boJtEHPzOiJceF0x1OW+h /Jn/ewoZh5itogPuGBcXB0QSNZIoQjH3x8Puv6S+bgfGwP6oXtWGpFHeH1EXtu0N pUqaft3VP8d/8+QeM0l5GSrYWverDZM0FpwnhWC0L/+0Fen52pseLGJIYGmG0Z80 vBxiRokXmNtC467tgu5upSSXDftEu9RFsWPCtuTr2yP+RZYC98hdSTl2EufA0L3Z ih46Iz+zIYcQt7ziryQ0nblGSuQy+AucqPa/0/fs9mSpqd0+fSphR+nd62P60yC4 mDUB093mMl/PhZY5IrfoU1DTxDdUJNoGc1wNdzKqsbxTbjpMJMeWr6dHX2pni8Ki MCR+Hh6aMxC+P0g2n5cCmTTff8ghRXSW0/pSluJjyPALmYHXCUdnXWAj59hkbpUA O6wOtth4rLi0ZcGPT4hNKu5bm+BvhQ4EEKjomB+WzZUmUL+/H8xoin2xEaItMs6T uDaZqaknRACr5+TFuwVbBP77QOZ9i9EcqBIMOSkNw1E0NqdGLxTwud8IQCqMAONJ ZHrwNOCM91sLk4ohjrPNzZzY3IXostBzRNNJQvFEXQJhbxJvQM3CDcr/QOoMajN2 1VWMbxrONgcyi8RTC8PvOgxRN36SFBJP0rxhrn465xGpAWsZ9M28sOWmKk2O4yhB LHZuuMYanWSQ0+SYJrGT =eSq9 -----END PGP SIGNATURE----- From owner-svn-src-all@FreeBSD.ORG Thu Oct 23 23:20:05 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9B32681A; Thu, 23 Oct 2014 23:20:05 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 84A0468; Thu, 23 Oct 2014 23:20:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NNK5wM023563; Thu, 23 Oct 2014 23:20:05 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NNK4fV023557; Thu, 23 Oct 2014 23:20:04 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201410232320.s9NNK4fV023557@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Thu, 23 Oct 2014 23:20:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273569 - head/sys/dev/gpio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 23:20:05 -0000 Author: loos Date: Thu Oct 23 23:20:04 2014 New Revision: 273569 URL: https://svnweb.freebsd.org/changeset/base/273569 Log: Move the duplicated code to a single function. No functional changes. Modified: head/sys/dev/gpio/gpiobus.c head/sys/dev/gpio/gpiobusvar.h head/sys/dev/gpio/ofw_gpiobus.c Modified: head/sys/dev/gpio/gpiobus.c ============================================================================== --- head/sys/dev/gpio/gpiobus.c Thu Oct 23 23:16:21 2014 (r273568) +++ head/sys/dev/gpio/gpiobus.c Thu Oct 23 23:20:04 2014 (r273569) @@ -99,6 +99,34 @@ gpiobus_print_pins(struct gpiobus_ivar * printf("%d", range_start); } +int +gpiobus_init_softc(device_t dev) +{ + struct gpiobus_softc *sc; + + sc = GPIOBUS_SOFTC(dev); + sc->sc_busdev = dev; + sc->sc_dev = device_get_parent(dev); + + if (GPIO_PIN_MAX(sc->sc_dev, &sc->sc_npins) != 0) + return (ENXIO); + + KASSERT(sc->sc_npins != 0, ("GPIO device with no pins")); + + /* Pins = GPIO_PIN_MAX() + 1 */ + sc->sc_npins++; + + sc->sc_pins_mapped = malloc(sizeof(int) * sc->sc_npins, M_DEVBUF, + M_NOWAIT | M_ZERO); + if (sc->sc_pins_mapped == NULL) + return (ENOMEM); + + /* Initialize the bus lock. */ + GPIOBUS_LOCK_INIT(sc); + + return (0); +} + static int gpiobus_parse_pins(struct gpiobus_softc *sc, device_t child, int mask) { @@ -163,30 +191,11 @@ gpiobus_probe(device_t dev) static int gpiobus_attach(device_t dev) { - struct gpiobus_softc *sc = GPIOBUS_SOFTC(dev); - int res; - - sc->sc_busdev = dev; - sc->sc_dev = device_get_parent(dev); - res = GPIO_PIN_MAX(sc->sc_dev, &sc->sc_npins); - if (res) - return (ENXIO); - - KASSERT(sc->sc_npins != 0, ("GPIO device with no pins")); - - /* - * Increase to get number of pins - */ - sc->sc_npins++; - - sc->sc_pins_mapped = malloc(sizeof(int) * sc->sc_npins, M_DEVBUF, - M_NOWAIT | M_ZERO); - - if (!sc->sc_pins_mapped) - return (ENOMEM); + int err; - /* init bus lock */ - GPIOBUS_LOCK_INIT(sc); + err = gpiobus_init_softc(dev); + if (err != 0) + return (err); /* * Get parent's pins and mark them as unmapped Modified: head/sys/dev/gpio/gpiobusvar.h ============================================================================== --- head/sys/dev/gpio/gpiobusvar.h Thu Oct 23 23:16:21 2014 (r273568) +++ head/sys/dev/gpio/gpiobusvar.h Thu Oct 23 23:20:04 2014 (r273569) @@ -89,6 +89,7 @@ gpio_map_gpios(device_t bus, phandle_t d device_t ofw_gpiobus_add_fdt_child(device_t, phandle_t); #endif void gpiobus_print_pins(struct gpiobus_ivar *); +int gpiobus_init_softc(device_t); extern driver_t gpiobus_driver; Modified: head/sys/dev/gpio/ofw_gpiobus.c ============================================================================== --- head/sys/dev/gpio/ofw_gpiobus.c Thu Oct 23 23:16:21 2014 (r273568) +++ head/sys/dev/gpio/ofw_gpiobus.c Thu Oct 23 23:20:04 2014 (r273569) @@ -264,33 +264,13 @@ ofw_gpiobus_probe(device_t dev) static int ofw_gpiobus_attach(device_t dev) { - struct gpiobus_softc *sc; + int err; phandle_t child; - sc = GPIOBUS_SOFTC(dev); - sc->sc_busdev = dev; - sc->sc_dev = device_get_parent(dev); - - /* Read the pin max. value */ - if (GPIO_PIN_MAX(sc->sc_dev, &sc->sc_npins) != 0) - return (ENXIO); - - KASSERT(sc->sc_npins != 0, ("GPIO device with no pins")); - - /* - * Increase to get number of pins. - */ - sc->sc_npins++; - - sc->sc_pins_mapped = malloc(sizeof(int) * sc->sc_npins, M_DEVBUF, - M_NOWAIT | M_ZERO); - - if (!sc->sc_pins_mapped) - return (ENOMEM); - - /* Init the bus lock. */ - GPIOBUS_LOCK_INIT(sc); - + err = gpiobus_init_softc(dev); + if (err != 0) + return (err); + bus_generic_probe(dev); bus_enumerate_hinted_children(dev); From owner-svn-src-all@FreeBSD.ORG Thu Oct 23 23:21:39 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6AAA6998; Thu, 23 Oct 2014 23:21:39 +0000 (UTC) Received: from mail-wi0-x232.google.com (mail-wi0-x232.google.com [IPv6:2a00:1450:400c:c05::232]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7BB2E128; Thu, 23 Oct 2014 23:21:38 +0000 (UTC) Received: by mail-wi0-f178.google.com with SMTP id q5so58175wiv.17 for ; Thu, 23 Oct 2014 16:21:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=gOjDjSZv/BoE3yO/hSVF785WlGnHPFhm4pbLOTwpMxE=; b=YTKEf6u2B9toWU2kAIMw8/cUzrFmQGJhJZmuA1cqPxbi8Lh5TPcuM3zKkAbmcaCIli GXL0evYYHESxkQ1eKZVDt1nO9HTM3KCb2+8YTgEs8SOw9CnJ34i06Zn5wexckplI2atw zUWJ2ifJIiFiB2ttEJTfmX7MZtSK0aOYUBPS5UGbtlwPzCJhOpwCQIHaAFIHeri0RLwV L3Jl9xpGv+AZVVYJqwJmwJYVN/j1BfZwKgl3sKSE7VPvsKjmvEpyKVd4Pr/affTyqp/I WgIJXclhnMsf+jMbdnSPktNL8dORNyeGrop0DONiA0dSuShSG4rIoPMmBLY7gtlu9SOu 5YhQ== X-Received: by 10.180.90.230 with SMTP id bz6mr131404wib.67.1414106496819; Thu, 23 Oct 2014 16:21:36 -0700 (PDT) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPSA id ei1sm98378wib.20.2014.10.23.16.21.35 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 23 Oct 2014 16:21:35 -0700 (PDT) Date: Fri, 24 Oct 2014 01:21:33 +0200 From: Mateusz Guzik To: d@delphij.net Subject: Re: svn commit: r273552 - head/sys/kern Message-ID: <20141023232133.GA11222@dft-labs.eu> References: <201410231823.s9NINpXD082633@svn.freebsd.org> <86egtyz9mz.fsf@nine.des.no> <54498CE9.1090000@delphij.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <54498CE9.1090000@delphij.net> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, Dag-Erling =?utf-8?B?U23DuHJncmF2?= , svn-src-all@freebsd.org, src-committers@freebsd.org, Xin LI X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 23:21:39 -0000 On Thu, Oct 23, 2014 at 04:19:05PM -0700, Xin Li wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA512 > > On 10/23/14 15:47, Dag-Erling Smørgrav wrote: > > Xin LI writes: > >> Log: Test if 'env' is NULL before doing memset() and strlen(), > >> the caller may pass NULL to freeenv(). > > > > If this is in response to a panic in early boot, the real bug is > > elsewhere (see r273564). Adding a NULL check here only hides it. > > Yes that would fix it. Does this look good to you? > > Index: sys/kern/kern_environment.c > =================================================================== > - --- sys/kern/kern_environment.c (revision 273564) > +++ sys/kern/kern_environment.c (working copy) > @@ -262,7 +262,8 @@ void > freeenv(char *env) > { > > - - if (dynamic_kenv && env != NULL) { > + MPASS(env != NULL); > + if (dynamic_kenv) { > memset(env, 0, strlen(env)); > free(env, M_KENV); > } > There are at least 80 consumers of this function. Unless someone is up to reviewing them all, can we go with a warning + backtrace for the time being? -- Mateusz Guzik From owner-svn-src-all@FreeBSD.ORG Thu Oct 23 23:31:07 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0B18BC59 for ; Thu, 23 Oct 2014 23:31:07 +0000 (UTC) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DEB4620B for ; Thu, 23 Oct 2014 23:31:06 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NNV5vx043333 for ; Thu, 23 Oct 2014 23:31:05 GMT (envelope-from bdrewery@freefall.freebsd.org) Received: (from bdrewery@localhost) by freefall.freebsd.org (8.14.9/8.14.9/Submit) id s9NNV57D043332 for svn-src-all@freebsd.org; Thu, 23 Oct 2014 23:31:05 GMT (envelope-from bdrewery) Received: (qmail 81128 invoked from network); 23 Oct 2014 18:31:03 -0500 Received: from unknown (HELO ?10.10.0.24?) (freebsd@shatow.net@10.10.0.24) by sweb.xzibition.com with ESMTPA; 23 Oct 2014 18:31:03 -0500 Message-ID: <54498FB0.5000703@FreeBSD.org> Date: Thu, 23 Oct 2014 18:30:56 -0500 From: Bryan Drewery Organization: FreeBSD User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Mateusz Guzik , d@delphij.net Subject: Re: svn commit: r273552 - head/sys/kern References: <201410231823.s9NINpXD082633@svn.freebsd.org> <86egtyz9mz.fsf@nine.des.no> <54498CE9.1090000@delphij.net> <20141023232133.GA11222@dft-labs.eu> In-Reply-To: <20141023232133.GA11222@dft-labs.eu> OpenPGP: id=6E4697CF; url=http://www.shatow.net/bryan/bryan2.asc Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="BpuAxd8XErTmXqHgr9QiaQ1DTUtlGhPul" Cc: svn-src-head@freebsd.org, =?UTF-8?B?RGFnLUVybGluZyBTbcO4cmdyYXY=?= , svn-src-all@freebsd.org, src-committers@freebsd.org, Xin LI X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 23:31:07 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --BpuAxd8XErTmXqHgr9QiaQ1DTUtlGhPul Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/23/2014 6:21 PM, Mateusz Guzik wrote: > On Thu, Oct 23, 2014 at 04:19:05PM -0700, Xin Li wrote: >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA512 >> >> On 10/23/14 15:47, Dag-Erling Sm=C3=B8rgrav wrote: >>> Xin LI writes: >>>> Log: Test if 'env' is NULL before doing memset() and strlen(),=20 >>>> the caller may pass NULL to freeenv(). >>> >>> If this is in response to a panic in early boot, the real bug is=20 >>> elsewhere (see r273564). Adding a NULL check here only hides it. >> >> Yes that would fix it. Does this look good to you? >> >> Index: sys/kern/kern_environment.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> - --- sys/kern/kern_environment.c (revision 273564) >> +++ sys/kern/kern_environment.c (working copy) >> @@ -262,7 +262,8 @@ void >> freeenv(char *env) >> { >> >> - - if (dynamic_kenv && env !=3D NULL) { >> + MPASS(env !=3D NULL); >> + if (dynamic_kenv) { >> memset(env, 0, strlen(env)); >> free(env, M_KENV); >> } >> >=20 > There are at least 80 consumers of this function. Unless someone is up > to reviewing them all, can we go with a warning + backtrace for the tim= e > being? >=20 My DEBUG_WARN could be used for that. I had not committed yet, but it is ready. --=20 Regards, Bryan Drewery --BpuAxd8XErTmXqHgr9QiaQ1DTUtlGhPul Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (MingW32) iQEcBAEBAgAGBQJUSY+wAAoJEDXXcbtuRpfPJHAH/jKdxCxKy6ZT1o6RmOewNVvK DUmzobU4xHIdcQTBsH0cYNukedKKtxFPzVR7dos2G1r8+u8Evwb4MSi8nhq2a6Mz iH8MAsLIxUYzUEC+kRDkcerzZPvymyx9yE2mELJ07V6Qmkyb9/AKgVu0eGud3kfn XK+sBlIJiNJwzUjK0B0H5Cjud6gVzsm8bZf2BnTfi+BKJV1TQhL6eCDctWcyklFC TPr8a19j78MzO+j4RTN/dVRejJBLy+5RuXUVMdTx+o6cIHKGzbNVvdgDWcPl/Ny5 bx5jXvc02FNEVwwVx/AcATItqtOkxRfLEJuzuV2es2FL3ceH5/yj9Z4jcG2aGGo= =yP/f -----END PGP SIGNATURE----- --BpuAxd8XErTmXqHgr9QiaQ1DTUtlGhPul-- From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 03:33:01 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E1D3EAE2; Fri, 24 Oct 2014 03:33:01 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B40CCC6C; Fri, 24 Oct 2014 03:33:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9O3X1ZW046068; Fri, 24 Oct 2014 03:33:01 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9O3X1GA046067; Fri, 24 Oct 2014 03:33:01 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201410240333.s9O3X1GA046067@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 24 Oct 2014 03:33:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273570 - head/sys/cddl/dev/fbt/powerpc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 03:33:02 -0000 Author: jhibbits Date: Fri Oct 24 03:33:01 2014 New Revision: 273570 URL: https://svnweb.freebsd.org/changeset/base/273570 Log: Three updates to PowerPC FBT: * Use a constant to define the number of stack frames in a probe exception. * Only allow function symbols in powerpc64 ('.' prefixed) * Set the fbtp_roffset for return probes, so the correct dtrace_probe call is made. MFC after: 1 week Modified: head/sys/cddl/dev/fbt/powerpc/fbt_isa.c Modified: head/sys/cddl/dev/fbt/powerpc/fbt_isa.c ============================================================================== --- head/sys/cddl/dev/fbt/powerpc/fbt_isa.c Thu Oct 23 23:20:04 2014 (r273569) +++ head/sys/cddl/dev/fbt/powerpc/fbt_isa.c Fri Oct 24 03:33:01 2014 (r273570) @@ -48,6 +48,7 @@ #define FBT_ENTRY "entry" #define FBT_RETURN "return" +#define FBT_AFRAMES 7 int fbt_invop(uintptr_t addr, uintptr_t *stack, uintptr_t rval) @@ -116,9 +117,17 @@ fbt_provide_module_function(linker_file_ int j; uint32_t *instr, *limit; - /* PowerPC64 uses '.' prefixes on symbol names, ignore it. */ +#ifdef __powerpc64__ + /* + * PowerPC64 uses '.' prefixes on symbol names, ignore it, but only + * allow symbols with the '.' prefix, so that we don't get the function + * descriptor instead. + */ if (name[0] == '.') name++; + else + return (0); +#endif if (strncmp(name, "dtrace_", 7) == 0 && strncmp(name, "dtrace_safe_", 12) != 0) { @@ -147,7 +156,7 @@ fbt_provide_module_function(linker_file_ fbt = malloc(sizeof (fbt_probe_t), M_FBT, M_WAITOK | M_ZERO); fbt->fbtp_name = name; fbt->fbtp_id = dtrace_probe_create(fbt_id, modname, - name, FBT_ENTRY, 7, fbt); + name, FBT_ENTRY, FBT_AFRAMES, fbt); fbt->fbtp_patchpoint = instr; fbt->fbtp_ctl = lf; fbt->fbtp_loadcnt = lf->loadcnt; @@ -210,7 +219,7 @@ again: if (retfbt == NULL) { fbt->fbtp_id = dtrace_probe_create(fbt_id, modname, - name, FBT_RETURN, 7, fbt); + name, FBT_RETURN, FBT_AFRAMES, fbt); } else { retfbt->fbtp_next = fbt; fbt->fbtp_id = retfbt->fbtp_id; @@ -229,6 +238,9 @@ again: else fbt->fbtp_rval = DTRACE_INVOP_JUMP; + fbt->fbtp_roffset = + (uintptr_t)((uint8_t *)instr - (uint8_t *)symval->value); + fbt->fbtp_savedval = *instr; fbt->fbtp_patchval = FBT_PATCHVAL; fbt->fbtp_hashnext = fbt_probetab[FBT_ADDR2NDX(instr)]; From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 03:34:21 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D76FAC40; Fri, 24 Oct 2014 03:34:21 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C3AD6C82; Fri, 24 Oct 2014 03:34:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9O3YLLr046261; Fri, 24 Oct 2014 03:34:21 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9O3YLxn046260; Fri, 24 Oct 2014 03:34:21 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201410240334.s9O3YLxn046260@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 24 Oct 2014 03:34:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273571 - head/sys/cddl/dev/fbt/powerpc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 03:34:22 -0000 Author: jhibbits Date: Fri Oct 24 03:34:21 2014 New Revision: 273571 URL: https://svnweb.freebsd.org/changeset/base/273571 Log: Whitespace X-MFC-with: r273570 MFC after: 1 week Modified: head/sys/cddl/dev/fbt/powerpc/fbt_isa.c Modified: head/sys/cddl/dev/fbt/powerpc/fbt_isa.c ============================================================================== --- head/sys/cddl/dev/fbt/powerpc/fbt_isa.c Fri Oct 24 03:33:01 2014 (r273570) +++ head/sys/cddl/dev/fbt/powerpc/fbt_isa.c Fri Oct 24 03:34:21 2014 (r273571) @@ -48,7 +48,7 @@ #define FBT_ENTRY "entry" #define FBT_RETURN "return" -#define FBT_AFRAMES 7 +#define FBT_AFRAMES 7 int fbt_invop(uintptr_t addr, uintptr_t *stack, uintptr_t rval) From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 03:42:38 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1AEB8DE2; Fri, 24 Oct 2014 03:42:38 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 07001D3D; Fri, 24 Oct 2014 03:42:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9O3gboZ050615; Fri, 24 Oct 2014 03:42:37 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9O3gbQ1050614; Fri, 24 Oct 2014 03:42:37 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410240342.s9O3gbQ1050614@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Fri, 24 Oct 2014 03:42:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273572 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 03:42:38 -0000 Author: ngie Date: Fri Oct 24 03:42:37 2014 New Revision: 273572 URL: https://svnweb.freebsd.org/changeset/base/273572 Log: - Ignore EINVAL check with mknod(path, S_IFCHR, -1) as the testcase is always executed on a non-devfs filesystem - Expect mknod(path, S_IFREG, 0) to fail on FreeBSD Submitted by: pho Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_mknod.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_mknod.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_mknod.c Fri Oct 24 03:34:21 2014 (r273571) +++ head/contrib/netbsd-tests/lib/libc/sys/t_mknod.c Fri Oct 24 03:42:37 2014 (r273572) @@ -58,8 +58,15 @@ ATF_TC_BODY(mknod_err, tc) (void)memset(buf, 'x', sizeof(buf)); +#ifndef __FreeBSD__ + /* + * As of FreeBSD 6.0 device nodes may be created in regular file systems but + * such nodes cannot be used to access devices. As a result an invalid dev + * argument is unchecked. + */ errno = 0; ATF_REQUIRE_ERRNO(EINVAL, mknod(path, S_IFCHR, -1) == -1); +#endif errno = 0; ATF_REQUIRE_ERRNO(ENAMETOOLONG, mknod(buf, S_IFCHR, 0) == -1); @@ -166,6 +173,9 @@ ATF_TC_BODY(mknod_stat, tc) (void)memset(&st, 0, sizeof(struct stat)); +#ifdef __FreeBSD__ + atf_tc_expect_fail("mknod does not allow S_IFREG"); +#endif ATF_REQUIRE(mknod(path, S_IFREG, 0) == 0); ATF_REQUIRE(stat(path, &st) == 0); From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 03:48:54 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E2989F6C; Fri, 24 Oct 2014 03:48:54 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CEB33D67; Fri, 24 Oct 2014 03:48:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9O3msQT051410; Fri, 24 Oct 2014 03:48:54 GMT (envelope-from neel@FreeBSD.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9O3msY0051409; Fri, 24 Oct 2014 03:48:54 GMT (envelope-from neel@FreeBSD.org) Message-Id: <201410240348.s9O3msY0051409@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: neel set sender to neel@FreeBSD.org using -f From: Neel Natu Date: Fri, 24 Oct 2014 03:48:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273573 - stable/10/sys/amd64/amd64 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 03:48:55 -0000 Author: neel Date: Fri Oct 24 03:48:54 2014 New Revision: 273573 URL: https://svnweb.freebsd.org/changeset/base/273573 Log: MFC r273356: Fix a race in pmap_emulate_accessed_dirty() that could trigger a EPT misconfiguration VM-exit. Modified: stable/10/sys/amd64/amd64/pmap.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/amd64/pmap.c ============================================================================== --- stable/10/sys/amd64/amd64/pmap.c Fri Oct 24 03:42:37 2014 (r273572) +++ stable/10/sys/amd64/amd64/pmap.c Fri Oct 24 03:48:54 2014 (r273573) @@ -6791,9 +6791,19 @@ retry: if (ftype == VM_PROT_WRITE) { if ((*pte & PG_RW) == 0) goto done; - *pte |= PG_M; + /* + * Set the modified and accessed bits simultaneously. + * + * Intel EPT PTEs that do software emulation of A/D bits map + * PG_A and PG_M to EPT_PG_READ and EPT_PG_WRITE respectively. + * An EPT misconfiguration is triggered if the PTE is writable + * but not readable (WR=10). This is avoided by setting PG_A + * and PG_M simultaneously. + */ + *pte |= PG_M | PG_A; + } else { + *pte |= PG_A; } - *pte |= PG_A; /* try to promote the mapping */ if (va < VM_MAXUSER_ADDRESS) From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 03:53:50 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C7EC2150; Fri, 24 Oct 2014 03:53:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B3860E0A; Fri, 24 Oct 2014 03:53:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9O3robp055417; Fri, 24 Oct 2014 03:53:50 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9O3roYD055416; Fri, 24 Oct 2014 03:53:50 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410240353.s9O3roYD055416@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Fri, 24 Oct 2014 03:53:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273574 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 03:53:50 -0000 Author: ngie Date: Fri Oct 24 03:53:49 2014 New Revision: 273574 URL: https://svnweb.freebsd.org/changeset/base/273574 Log: - Test for EINVAL requirement when passing an invalid flag in to msync(2) - Expect ENOMEM instead of EFAULT when msync'ing a previously munmap'ed region on FreeBSD Submitted by: pho Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_msync.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_msync.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_msync.c Fri Oct 24 03:48:54 2014 (r273573) +++ head/contrib/netbsd-tests/lib/libc/sys/t_msync.c Fri Oct 24 03:53:49 2014 (r273574) @@ -170,8 +170,15 @@ ATF_TC_BODY(msync_err, tc) /* * Test that invalid flags error out. */ +#ifdef __FreeBSD__ + errno = 0; + ATF_REQUIRE_ERRNO(EINVAL, msync_sync("error", -1) != NULL); + errno = 0; + ATF_REQUIRE_ERRNO(EINVAL, msync_sync("error", INT_MAX) != NULL); +#else ATF_REQUIRE(msync_sync("error", -1) != NULL); ATF_REQUIRE(msync_sync("error", INT_MAX) != NULL); +#endif errno = 0; @@ -185,7 +192,11 @@ ATF_TC_BODY(msync_err, tc) (void)munmap(map, page); ATF_REQUIRE(msync(map, page, MS_SYNC) != 0); +#ifdef __FreeBSD__ + ATF_REQUIRE(errno == ENOMEM); +#else ATF_REQUIRE(errno == EFAULT); +#endif } ATF_TC(msync_invalidate); From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 04:01:15 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 31DB7302; Fri, 24 Oct 2014 04:01:15 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1277BEC3; Fri, 24 Oct 2014 04:01:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9O41Eie059946; Fri, 24 Oct 2014 04:01:14 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9O41EBE059945; Fri, 24 Oct 2014 04:01:14 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201410240401.s9O41EBE059945@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Fri, 24 Oct 2014 04:01:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273575 - head/usr.bin/vmstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 04:01:15 -0000 Author: mckusick Date: Fri Oct 24 04:01:14 2014 New Revision: 273575 URL: https://svnweb.freebsd.org/changeset/base/273575 Log: Fix formatting of vmstat (1) so that it looks cleaner on standard 80 column displays. In particular it wraps far less often. Submitted by: Andy Kosela PR: 191976 Modified: head/usr.bin/vmstat/vmstat.c Modified: head/usr.bin/vmstat/vmstat.c ============================================================================== --- head/usr.bin/vmstat/vmstat.c Fri Oct 24 03:53:49 2014 (r273574) +++ head/usr.bin/vmstat/vmstat.c Fri Oct 24 04:01:14 2014 (r273575) @@ -767,22 +767,26 @@ dovmstat(unsigned int interval, int reps fill_vmmeter(&sum); fill_vmtotal(&total); - (void)printf("%2d %1d %1d", + (void)printf("%1d %1d %1d", total.t_rq - 1, total.t_dw + total.t_pw, total.t_sw); #define vmstat_pgtok(a) ((a) * (sum.v_page_size >> 10)) #define rate(x) (((x) * rate_adj + halfuptime) / uptime) /* round */ if (hflag) { + printf(""); + prthuman(total.t_avm * (u_int64_t)sum.v_page_size, 5); printf(" "); - prthuman(total.t_avm * (u_int64_t)sum.v_page_size, 7); - printf(" "); - prthuman(total.t_free * (u_int64_t)sum.v_page_size, 6); + prthuman(total.t_free * (u_int64_t)sum.v_page_size, 5); printf(" "); + (void)printf("%5lu ", + (unsigned long)rate(sum.v_vm_faults - + osum.v_vm_faults)); } else { - printf(" %7d ", vmstat_pgtok(total.t_avm)); - printf(" %6d ", vmstat_pgtok(total.t_free)); + printf(" %7d", vmstat_pgtok(total.t_avm)); + printf(" %7d ", vmstat_pgtok(total.t_free)); + (void)printf("%4lu ", + (unsigned long)rate(sum.v_vm_faults - + osum.v_vm_faults)); } - (void)printf("%5lu ", - (unsigned long)rate(sum.v_vm_faults - osum.v_vm_faults)); (void)printf("%3lu ", (unsigned long)rate(sum.v_reactivated - osum.v_reactivated)); (void)printf("%3lu ", @@ -793,10 +797,10 @@ dovmstat(unsigned int interval, int reps (osum.v_swapout + osum.v_vnodeout))); (void)printf("%5lu ", (unsigned long)rate(sum.v_tfree - osum.v_tfree)); - (void)printf("%3lu ", + (void)printf("%4lu ", (unsigned long)rate(sum.v_pdpages - osum.v_pdpages)); devstats(); - (void)printf("%4lu %4lu %4lu", + (void)printf("%4lu %5lu %5lu", (unsigned long)rate(sum.v_intr - osum.v_intr), (unsigned long)rate(sum.v_syscall - osum.v_syscall), (unsigned long)rate(sum.v_swtch - osum.v_swtch)); @@ -824,35 +828,43 @@ dovmstat(unsigned int interval, int reps } static void -printhdr(int maxid, u_long cpumask) +printhdr(int ncpus, u_long cpumask) { int i, num_shown; num_shown = (num_selected < maxshowdevs) ? num_selected : maxshowdevs; - (void)printf(" procs memory page%*s", 19, ""); + if (hflag) { + (void)printf("procs memory page%*s ", 19, ""); + } else { + (void)printf("procs memory page%*s ", 19, ""); + } if (num_shown > 1) - (void)printf(" disks %*s", num_shown * 4 - 7, ""); + (void)printf(" disks %*s", num_shown * 4 - 7, ""); else if (num_shown == 1) - (void)printf("disk"); - (void)printf(" faults "); + (void)printf(" disk"); + (void)printf(" faults "); if (Pflag) { - for (i = 0; i <= maxid; i++) { + for (i = 0; i < ncpus; i++) { if (cpumask & (1ul << i)) - printf("cpu%-2d ", i); + printf(" cpu%d ", i); } printf("\n"); } else - printf("cpu\n"); - (void)printf(" r b w avm fre flt re pi po fr sr "); + printf(" cpu\n"); + if (hflag) { + (void)printf("r b w avm fre flt re pi po fr sr "); + } else { + (void)printf("r b w avm fre flt re pi po fr sr "); + } for (i = 0; i < num_devices; i++) if ((dev_select[i].selected) && (dev_select[i].selected <= maxshowdevs)) (void)printf("%c%c%d ", dev_select[i].device_name[0], dev_select[i].device_name[1], dev_select[i].unit_number); - (void)printf(" in sy cs"); + (void)printf(" in sy cs"); if (Pflag) { - for (i = 0; i <= maxid; i++) { + for (i = 0; i < ncpus; i++) { if (cpumask & (1ul << i)) printf(" us sy id"); } @@ -982,7 +994,8 @@ dosum(void) (void)printf("%9u intransit blocking page faults\n", sum.v_intrans); (void)printf("%9u total VM faults taken\n", sum.v_vm_faults); (void)printf("%9u page faults requiring I/O\n", sum.v_io_faults); - (void)printf("%9u pages affected by kernel thread creation\n", sum.v_kthreadpages); + (void)printf("%9u pages affected by kernel thread creation\n", + sum.v_kthreadpages); (void)printf("%9u pages affected by fork()\n", sum.v_forkpages); (void)printf("%9u pages affected by vfork()\n", sum.v_vforkpages); (void)printf("%9u pages affected by rfork()\n", sum.v_rforkpages); @@ -1124,7 +1137,8 @@ pcpustats(int ncpus, u_long cpumask, int continue; for (state = 0; state < CPUSTATES; ++state) { tmp = cur_cp_times[i * CPUSTATES + state]; - cur_cp_times[i * CPUSTATES + state] -= last_cp_times[i * CPUSTATES + state]; + cur_cp_times[i * CPUSTATES + state] -= last_cp_times[i * + CPUSTATES + state]; last_cp_times[i * CPUSTATES + state] = tmp; } } From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 05:39:33 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 24DAB142; Fri, 24 Oct 2014 05:39:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EB8BA97A; Fri, 24 Oct 2014 05:39:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9O5dWpk002151; Fri, 24 Oct 2014 05:39:32 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9O5dWWK002150; Fri, 24 Oct 2014 05:39:32 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201410240539.s9O5dWWK002150@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Fri, 24 Oct 2014 05:39:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273576 - head/sys/dev/uart X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 05:39:33 -0000 Author: araujo (ports committer) Date: Fri Oct 24 05:39:32 2014 New Revision: 273576 URL: https://svnweb.freebsd.org/changeset/base/273576 Log: Fix a leaked Storage Variable. Phabric: D981 Submitted by: myself Reported by: Coverity CID: 1248848 Reworked by: kevlo Reviewed by: marcel, davide, ray, kevlo Approved by: marcel, kevlo Modified: head/sys/dev/uart/uart_subr.c Modified: head/sys/dev/uart/uart_subr.c ============================================================================== --- head/sys/dev/uart/uart_subr.c Fri Oct 24 04:01:14 2014 (r273575) +++ head/sys/dev/uart/uart_subr.c Fri Oct 24 05:39:32 2014 (r273576) @@ -196,7 +196,7 @@ out: int uart_getenv(int devtype, struct uart_devinfo *di, struct uart_class *class) { - const char *spec; + const char *cp, *spec; bus_addr_t addr = ~0U; int error; @@ -214,12 +214,12 @@ uart_getenv(int devtype, struct uart_dev * port (resp). */ if (devtype == UART_DEV_CONSOLE) - spec = kern_getenv("hw.uart.console"); + cp = kern_getenv("hw.uart.console"); else if (devtype == UART_DEV_DBGPORT) - spec = kern_getenv("hw.uart.dbgport"); + cp = kern_getenv("hw.uart.dbgport"); else - spec = NULL; - if (spec == NULL) + cp = NULL; + if (cp == NULL) return (ENXIO); /* Set defaults. */ @@ -232,6 +232,7 @@ uart_getenv(int devtype, struct uart_dev di->parity = UART_PARITY_NONE; /* Parse the attributes. */ + spec = cp; while (1) { switch (uart_parse_tag(&spec)) { case UART_TAG_BR: @@ -267,14 +268,18 @@ uart_getenv(int devtype, struct uart_dev di->bas.rclk = uart_parse_long(&spec); break; default: + freeenv(__DECONST(char *, cp)); return (EINVAL); } if (*spec == '\0') break; - if (*spec != ',') + if (*spec != ',') { + freeenv(__DECONST(char *, cp)); return (EINVAL); + } spec++; } + freeenv(__DECONST(char *, cp)); /* * If we still have an invalid address, the specification must be From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 05:58:26 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 71E293D5; Fri, 24 Oct 2014 05:58:26 +0000 (UTC) Received: from mail-wi0-x235.google.com (mail-wi0-x235.google.com [IPv6:2a00:1450:400c:c05::235]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 928D5B1C; Fri, 24 Oct 2014 05:58:25 +0000 (UTC) Received: by mail-wi0-f181.google.com with SMTP id n3so361943wiv.14 for ; Thu, 23 Oct 2014 22:58:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=sYr2SRa/Bolm+OozhGB3tM0eX7Amlyr9vL6FhS5Rc04=; b=iUp0GTZLPY2aeXc5X4YqJok2o43ArV0EIDlqOS95gBEKwGVNXAFmmp8Ypmm6nypKr+ 9a/XNpRGRwyKpGp3nHocRTYU7CEP8BTPvCypJ3pYbERRHniJfkBmB/6vly3zICFnKMye Ar2vBxko7E+/fS1lLz7VKBCoQHKGv0h1UqxtXnnyWY7DapEN1ORQjWNPM4PKAbtyjj5B PUItDaphJyBJDrE9JYbwp7/hSbhMwyjkQLx55l8b2eru1KvzolO9IBJ2/lMKMVsV3Rgl Cmm8syraUWvhOgfwOqtshXSF6DpmoMwaHkpF2OoFphkZ3KWXCXsNuLwjOtD3fgPfnDPV PqQg== X-Received: by 10.180.72.243 with SMTP id g19mr1761433wiv.64.1414130303862; Thu, 23 Oct 2014 22:58:23 -0700 (PDT) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPSA id fx2sm4405222wjb.37.2014.10.23.22.58.22 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 23 Oct 2014 22:58:23 -0700 (PDT) Date: Fri, 24 Oct 2014 07:58:20 +0200 From: Mateusz Guzik To: Marcelo Araujo Subject: Re: svn commit: r273576 - head/sys/dev/uart Message-ID: <20141024055820.GI11222@dft-labs.eu> References: <201410240539.s9O5dWWK002150@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <201410240539.s9O5dWWK002150@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 05:58:26 -0000 On Fri, Oct 24, 2014 at 05:39:32AM +0000, Marcelo Araujo wrote: > Author: araujo (ports committer) > Date: Fri Oct 24 05:39:32 2014 > New Revision: 273576 > URL: https://svnweb.freebsd.org/changeset/base/273576 > > Log: > Fix a leaked Storage Variable. > > int > uart_getenv(int devtype, struct uart_devinfo *di, struct uart_class *class) > { > - const char *spec; > + const char *cp, *spec; > bus_addr_t addr = ~0U; > int error; > > @@ -214,12 +214,12 @@ uart_getenv(int devtype, struct uart_dev > * port (resp). > */ > if (devtype == UART_DEV_CONSOLE) > - spec = kern_getenv("hw.uart.console"); > + cp = kern_getenv("hw.uart.console"); > else if (devtype == UART_DEV_DBGPORT) > - spec = kern_getenv("hw.uart.dbgport"); > + cp = kern_getenv("hw.uart.dbgport"); > else > - spec = NULL; > - if (spec == NULL) > + cp = NULL; > + if (cp == NULL) > return (ENXIO); [..] > default: > + freeenv(__DECONST(char *, cp)); > return (EINVAL); > } > if (*spec == '\0') > break; > - if (*spec != ',') > + if (*spec != ',') { > + freeenv(__DECONST(char *, cp)); > return (EINVAL); > + } > spec++; > } > + freeenv(__DECONST(char *, cp)); > Why not 'char *cp;'? That would avoid __DECONST entirely and would not require spec to change type. There are some cosmetics around that may be worth fixing (e.g. if, else-if instead of switch, while (1) instead of for (;;)). -- Mateusz Guzik From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 06:27:47 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F2012A86; Fri, 24 Oct 2014 06:27:46 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D321FDC0; Fri, 24 Oct 2014 06:27:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9O6RkH2025269; Fri, 24 Oct 2014 06:27:46 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9O6Rjre025263; Fri, 24 Oct 2014 06:27:45 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410240627.s9O6Rjre025263@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Fri, 24 Oct 2014 06:27:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273577 - in head/sys/dev/hyperv: netvsc stordisengage storvsc utilities X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 06:27:47 -0000 Author: delphij Date: Fri Oct 24 06:27:45 2014 New Revision: 273577 URL: https://svnweb.freebsd.org/changeset/base/273577 Log: Return BUS_PROBE_DEFAULT instead of BUS_PROBE_VENDOR or 0 for in-tree driver. This change was verified by Microsoft. Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.c head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c head/sys/dev/hyperv/utilities/hv_util.c Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Oct 24 05:39:32 2014 (r273576) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Oct 24 06:27:45 2014 (r273577) @@ -218,7 +218,7 @@ netvsc_probe(device_t dev) if (bootverbose) printf("Netvsc probe... DONE \n"); - return (0); + return (BUS_PROBE_DEFAULT); } return (ENXIO); Modified: head/sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.c ============================================================================== --- head/sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.c Fri Oct 24 05:39:32 2014 (r273576) +++ head/sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.c Fri Oct 24 06:27:45 2014 (r273577) @@ -116,7 +116,7 @@ hv_ata_pci_probe(device_t dev) device_set_desc(dev, "Hyper-V ATA storage disengage driver"); - return (BUS_PROBE_VENDOR); + return (BUS_PROBE_DEFAULT); } static int Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Fri Oct 24 05:39:32 2014 (r273576) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Fri Oct 24 06:27:45 2014 (r273577) @@ -689,14 +689,14 @@ storvsc_probe(device_t dev) if(bootverbose) device_printf(dev, "Enlightened ATA/IDE detected\n"); - ret = 0; + ret = BUS_PROBE_DEFAULT; } else if(bootverbose) device_printf(dev, "Emulated ATA/IDE set (hw.ata.disk_enable set)\n"); break; case DRIVER_STORVSC: if(bootverbose) device_printf(dev, "Enlightened SCSI device detected\n"); - ret = 0; + ret = BUS_PROBE_DEFAULT; break; default: ret = ENXIO; Modified: head/sys/dev/hyperv/utilities/hv_util.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_util.c Fri Oct 24 05:39:32 2014 (r273576) +++ head/sys/dev/hyperv/utilities/hv_util.c Fri Oct 24 06:27:45 2014 (r273577) @@ -378,7 +378,7 @@ hv_util_probe(device_t dev) const char *p = vmbus_get_type(dev); if (service_table[i].enabled && !memcmp(p, &service_table[i].guid, sizeof(hv_guid))) { device_set_softc(dev, (void *) (&service_table[i])); - rtn_value = 0; + rtn_value = BUS_PROBE_DEFAULT; } } From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 06:53:07 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1D1EBF04; Fri, 24 Oct 2014 06:53:07 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 09708FF2; Fri, 24 Oct 2014 06:53:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9O6r65d038886; Fri, 24 Oct 2014 06:53:06 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9O6r6ls038885; Fri, 24 Oct 2014 06:53:06 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410240653.s9O6r6ls038885@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Fri, 24 Oct 2014 06:53:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273578 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 06:53:07 -0000 Author: ngie Date: Fri Oct 24 06:53:06 2014 New Revision: 273578 URL: https://svnweb.freebsd.org/changeset/base/273578 Log: - Add inttypes.h and stdint.h in lieu of int_limits.h from NetBSD - Use #include "h_macros.h" instead of relative path analog Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_clock_gettime.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_clock_gettime.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_clock_gettime.c Fri Oct 24 06:27:45 2014 (r273577) +++ head/contrib/netbsd-tests/lib/libc/sys/t_clock_gettime.c Fri Oct 24 06:53:06 2014 (r273578) @@ -63,7 +63,9 @@ __RCSID("$NetBSD: t_clock_gettime.c,v 1. #include #include +#if defined(__NetBSD__) #include +#endif #include #include @@ -73,7 +75,13 @@ __RCSID("$NetBSD: t_clock_gettime.c,v 1. #include #include +#if defined(__NetBSD__) #include "../../../h_macros.h" +#else +#include +#include +#include "h_macros.h" +#endif #define MINPOSDIFF 15000000 /* 15 ms for now */ #define TIMEOUT 5 From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 06:57:17 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 95E2928F; Fri, 24 Oct 2014 06:57:17 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 82452B9; Fri, 24 Oct 2014 06:57:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9O6vHcA039447; Fri, 24 Oct 2014 06:57:17 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9O6vHtY039446; Fri, 24 Oct 2014 06:57:17 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410240657.s9O6vHtY039446@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Fri, 24 Oct 2014 06:57:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273579 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 06:57:17 -0000 Author: ngie Date: Fri Oct 24 06:57:16 2014 New Revision: 273579 URL: https://svnweb.freebsd.org/changeset/base/273579 Log: - Mark signo __unused in the signal handler function - Effectively #if 0 out some code that does not fail on FreeBSD In collaboration with: pho Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_getrusage.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_getrusage.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_getrusage.c Fri Oct 24 06:53:06 2014 (r273578) +++ head/contrib/netbsd-tests/lib/libc/sys/t_getrusage.c Fri Oct 24 06:57:16 2014 (r273579) @@ -47,7 +47,11 @@ static void sighandler(int); static const size_t maxiter = 2000; static void +#if defined(__FreeBSD__) +sighandler(int signo __unused) +#else sighandler(int signo) +#endif { /* Nothing. */ } @@ -168,7 +172,9 @@ ATF_TC_BODY(getrusage_utime_zero, tc) * * See also (duplicate) PR port-amd64/41734. */ +#if defined(__NetBSD__) atf_tc_expect_fail("PR kern/30115"); +#endif for (i = 0; i < maxiter; i++) { @@ -182,7 +188,9 @@ ATF_TC_BODY(getrusage_utime_zero, tc) atf_tc_fail("zero user time from getrusage(2)"); } +#if defined(__NetBSD__) atf_tc_fail("anticipated error did not occur"); +#endif } ATF_TP_ADD_TCS(tp) From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 06:59:37 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 26970464; Fri, 24 Oct 2014 06:59:37 +0000 (UTC) Received: from mail-wi0-x235.google.com (mail-wi0-x235.google.com [IPv6:2a00:1450:400c:c05::235]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 60451CF; Fri, 24 Oct 2014 06:59:36 +0000 (UTC) Received: by mail-wi0-f181.google.com with SMTP id n3so466657wiv.8 for ; Thu, 23 Oct 2014 23:59:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=GvRd4uRzKNVj1sDS+uteuC9QbBhzjlQynKPPTOvDti0=; b=nYJt7vbRLykSWBZRB1oM4iTSCxSHorpBEhhABR41y5hNIdFQVy+SETatsH05BpdxXG 2I3jkPiTWHIN9MmXT0L4vR8jJ8D8KrrOtwSirdmD1UWVuz9VY3mdkd/VpndLyA7BIPGs KiotisVL86QLH7fxCs/9YRz7TYXRjreSjtAuVWoP6bD0aMJRdY2loYIeRHTsDSr7r1YV hDjDyrc0ucRXjguBDWMIcizF0wKq5LB1/E7Ulc26Fbzz4aEmqBnWi4DRime5a3gmhOdi zunohGM7PPrrLX4uYEoK2f9FEbLYKh7pLWBaljB+5JuacB5asY0Wsax5EzXVu3m9f9bI NUPA== MIME-Version: 1.0 X-Received: by 10.194.157.137 with SMTP id wm9mr2634213wjb.5.1414133974707; Thu, 23 Oct 2014 23:59:34 -0700 (PDT) Received: by 10.216.159.193 with HTTP; Thu, 23 Oct 2014 23:59:34 -0700 (PDT) Reply-To: araujo@FreeBSD.org In-Reply-To: <20141024055820.GI11222@dft-labs.eu> References: <201410240539.s9O5dWWK002150@svn.freebsd.org> <20141024055820.GI11222@dft-labs.eu> Date: Fri, 24 Oct 2014 14:59:34 +0800 Message-ID: Subject: Re: svn commit: r273576 - head/sys/dev/uart From: Marcelo Araujo To: Mateusz Guzik Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 06:59:37 -0000 2014-10-24 13:58 GMT+08:00 Mateusz Guzik : > On Fri, Oct 24, 2014 at 05:39:32AM +0000, Marcelo Araujo wrote: > > Author: araujo (ports committer) > > Date: Fri Oct 24 05:39:32 2014 > > New Revision: 273576 > > URL: https://svnweb.freebsd.org/changeset/base/273576 > > > > Log: > > Fix a leaked Storage Variable. > > > > int > > uart_getenv(int devtype, struct uart_devinfo *di, struct uart_class > *class) > > { > > - const char *spec; > > + const char *cp, *spec; > > bus_addr_t addr = ~0U; > > int error; > > > > @@ -214,12 +214,12 @@ uart_getenv(int devtype, struct uart_dev > > * port (resp). > > */ > > if (devtype == UART_DEV_CONSOLE) > > - spec = kern_getenv("hw.uart.console"); > > + cp = kern_getenv("hw.uart.console"); > > else if (devtype == UART_DEV_DBGPORT) > > - spec = kern_getenv("hw.uart.dbgport"); > > + cp = kern_getenv("hw.uart.dbgport"); > > else > > - spec = NULL; > > - if (spec == NULL) > > + cp = NULL; > > + if (cp == NULL) > > return (ENXIO); > [..] > > default: > > + freeenv(__DECONST(char *, cp)); > > return (EINVAL); > > } > > if (*spec == '\0') > > break; > > - if (*spec != ',') > > + if (*spec != ',') { > > + freeenv(__DECONST(char *, cp)); > > return (EINVAL); > > + } > > spec++; > > } > > + freeenv(__DECONST(char *, cp)); > > > > Why not 'char *cp;'? That would avoid __DECONST entirely and would not > require spec to change type. > Well, it might be possible to use 'char *cp', however as I'm not aware of all uart implementation, I just followed the previous 'spec' declaration type that is a constant too. I'm gonna take a look on it, to check if there is any backward to only use 'char *cp'. > > There are some cosmetics around that may be worth fixing (e.g. if, > else-if instead of switch, while (1) instead of for (;;)). > Yes, that for sure makes sense and it is worth. Thanks to point all of these things. Best Regards, -- -- Marcelo Araujo (__)araujo@FreeBSD.org \\\'',)http://www.FreeBSD.org \/ \ ^ Power To Server. .\. /_) From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 07:06:03 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 31DE0608; Fri, 24 Oct 2014 07:06:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 12F7B189; Fri, 24 Oct 2014 07:06:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9O762Is044022; Fri, 24 Oct 2014 07:06:02 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9O762ZV044014; Fri, 24 Oct 2014 07:06:02 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410240706.s9O762ZV044014@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Fri, 24 Oct 2014 07:06:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273580 - in stable/10/sys/dev/hyperv: netvsc stordisengage storvsc utilities X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 07:06:03 -0000 Author: delphij Date: Fri Oct 24 07:06:01 2014 New Revision: 273580 URL: https://svnweb.freebsd.org/changeset/base/273580 Log: MFC r273577: Return BUS_PROBE_DEFAULT instead of BUS_PROBE_VENDOR or 0 for in-tree driver. This change was verified by Microsoft. Instant MFC approved by: re (kib) Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/10/sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.c stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c stable/10/sys/dev/hyperv/utilities/hv_util.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Oct 24 06:57:16 2014 (r273579) +++ stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Oct 24 07:06:01 2014 (r273580) @@ -218,7 +218,7 @@ netvsc_probe(device_t dev) if (bootverbose) printf("Netvsc probe... DONE \n"); - return (0); + return (BUS_PROBE_DEFAULT); } return (ENXIO); Modified: stable/10/sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.c ============================================================================== --- stable/10/sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.c Fri Oct 24 06:57:16 2014 (r273579) +++ stable/10/sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.c Fri Oct 24 07:06:01 2014 (r273580) @@ -116,7 +116,7 @@ hv_ata_pci_probe(device_t dev) device_set_desc(dev, "Hyper-V ATA storage disengage driver"); - return (BUS_PROBE_VENDOR); + return (BUS_PROBE_DEFAULT); } static int Modified: stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Fri Oct 24 06:57:16 2014 (r273579) +++ stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Fri Oct 24 07:06:01 2014 (r273580) @@ -689,14 +689,14 @@ storvsc_probe(device_t dev) if(bootverbose) device_printf(dev, "Enlightened ATA/IDE detected\n"); - ret = 0; + ret = BUS_PROBE_DEFAULT; } else if(bootverbose) device_printf(dev, "Emulated ATA/IDE set (hw.ata.disk_enable set)\n"); break; case DRIVER_STORVSC: if(bootverbose) device_printf(dev, "Enlightened SCSI device detected\n"); - ret = 0; + ret = BUS_PROBE_DEFAULT; break; default: ret = ENXIO; Modified: stable/10/sys/dev/hyperv/utilities/hv_util.c ============================================================================== --- stable/10/sys/dev/hyperv/utilities/hv_util.c Fri Oct 24 06:57:16 2014 (r273579) +++ stable/10/sys/dev/hyperv/utilities/hv_util.c Fri Oct 24 07:06:01 2014 (r273580) @@ -378,7 +378,7 @@ hv_util_probe(device_t dev) const char *p = vmbus_get_type(dev); if (service_table[i].enabled && !memcmp(p, &service_table[i].guid, sizeof(hv_guid))) { device_set_softc(dev, (void *) (&service_table[i])); - rtn_value = 0; + rtn_value = BUS_PROBE_DEFAULT; } } From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 07:50:36 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 39138B55; Fri, 24 Oct 2014 07:50:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1ABC078C; Fri, 24 Oct 2014 07:50:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9O7oZ6R065971; Fri, 24 Oct 2014 07:50:35 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9O7oZHj065967; Fri, 24 Oct 2014 07:50:35 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410240750.s9O7oZHj065967@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Fri, 24 Oct 2014 07:50:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r273581 - in releng/10.1/sys/dev/hyperv: netvsc stordisengage storvsc utilities X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 07:50:36 -0000 Author: delphij Date: Fri Oct 24 07:50:34 2014 New Revision: 273581 URL: https://svnweb.freebsd.org/changeset/base/273581 Log: MFS r273580: MFC r273577: Return BUS_PROBE_DEFAULT instead of BUS_PROBE_VENDOR or 0 for in-tree driver. This change was verified by Microsoft. Approved by: re (kib) Modified: releng/10.1/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c releng/10.1/sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.c releng/10.1/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c releng/10.1/sys/dev/hyperv/utilities/hv_util.c Directory Properties: releng/10.1/ (props changed) Modified: releng/10.1/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- releng/10.1/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Oct 24 07:06:01 2014 (r273580) +++ releng/10.1/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Oct 24 07:50:34 2014 (r273581) @@ -218,7 +218,7 @@ netvsc_probe(device_t dev) if (bootverbose) printf("Netvsc probe... DONE \n"); - return (0); + return (BUS_PROBE_DEFAULT); } return (ENXIO); Modified: releng/10.1/sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.c ============================================================================== --- releng/10.1/sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.c Fri Oct 24 07:06:01 2014 (r273580) +++ releng/10.1/sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.c Fri Oct 24 07:50:34 2014 (r273581) @@ -116,7 +116,7 @@ hv_ata_pci_probe(device_t dev) device_set_desc(dev, "Hyper-V ATA storage disengage driver"); - return (BUS_PROBE_VENDOR); + return (BUS_PROBE_DEFAULT); } static int Modified: releng/10.1/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- releng/10.1/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Fri Oct 24 07:06:01 2014 (r273580) +++ releng/10.1/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Fri Oct 24 07:50:34 2014 (r273581) @@ -689,14 +689,14 @@ storvsc_probe(device_t dev) if(bootverbose) device_printf(dev, "Enlightened ATA/IDE detected\n"); - ret = 0; + ret = BUS_PROBE_DEFAULT; } else if(bootverbose) device_printf(dev, "Emulated ATA/IDE set (hw.ata.disk_enable set)\n"); break; case DRIVER_STORVSC: if(bootverbose) device_printf(dev, "Enlightened SCSI device detected\n"); - ret = 0; + ret = BUS_PROBE_DEFAULT; break; default: ret = ENXIO; Modified: releng/10.1/sys/dev/hyperv/utilities/hv_util.c ============================================================================== --- releng/10.1/sys/dev/hyperv/utilities/hv_util.c Fri Oct 24 07:06:01 2014 (r273580) +++ releng/10.1/sys/dev/hyperv/utilities/hv_util.c Fri Oct 24 07:50:34 2014 (r273581) @@ -378,7 +378,7 @@ hv_util_probe(device_t dev) const char *p = vmbus_get_type(dev); if (service_table[i].enabled && !memcmp(p, &service_table[i].guid, sizeof(hv_guid))) { device_set_softc(dev, (void *) (&service_table[i])); - rtn_value = 0; + rtn_value = BUS_PROBE_DEFAULT; } } From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 09:49:00 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8BF4C6B5; Fri, 24 Oct 2014 09:49:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 777A339C; Fri, 24 Oct 2014 09:49:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9O9n0Wx019504; Fri, 24 Oct 2014 09:49:00 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9O9mxNP019487; Fri, 24 Oct 2014 09:48:59 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201410240948.s9O9mxNP019487@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: Roger Pau Monné Date: Fri, 24 Oct 2014 09:48:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273582 - in head/sys/amd64: amd64 include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 09:49:00 -0000 Author: royger Date: Fri Oct 24 09:48:58 2014 New Revision: 273582 URL: https://svnweb.freebsd.org/changeset/base/273582 Log: amd64: make uiomove_fromphys functional for pages not mapped by the DMAP Place the code introduced in r268660 into a separate function that can be called from uiomove_fromphys. Instead of pre-allocating two KVA pages use vmem_alloc to allocate them on demand when needed. This prevents blocking if a page fault is taken while physical addresses from outside the DMAP are used, since the lock is now removed. Also introduce a safety catch in PHYS_TO_DMAP and DMAP_TO_PHYS. Sponsored by: Citrix Systems R&D Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D947 amd64/amd64/pmap.c: - Factor out the code to deal with non DMAP addresses from pmap_copy_pages and place it in pmap_map_io_transient. - Change the code to use vmem_alloc instead of a set of pre-allocated pages. - Use pmap_qenter and don't pin the thread if there can be page faults. amd64/amd64/uio_machdep.c: - Use pmap_map_io_transient in order to correctly deal with physical addresses not covered by the DMAP. amd64/include/pmap.h: - Add the prototypes for the new functions. amd64/include/vmparam.h: - Add safety catches to make sure PHYS_TO_DMAP and DMAP_TO_PHYS are only used with addresses covered by the DMAP. Modified: head/sys/amd64/amd64/pmap.c head/sys/amd64/amd64/uio_machdep.c head/sys/amd64/include/pmap.h head/sys/amd64/include/vmparam.h Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Fri Oct 24 07:50:34 2014 (r273581) +++ head/sys/amd64/amd64/pmap.c Fri Oct 24 09:48:58 2014 (r273582) @@ -115,6 +115,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -402,11 +403,6 @@ SYSCTL_PROC(_vm_pmap, OID_AUTO, pcid_sav CTLFLAG_MPSAFE, NULL, 0, pmap_pcid_save_cnt_proc, "QU", "Count of saved TLB context on switch"); -/* pmap_copy_pages() over non-DMAP */ -static struct mtx cpage_lock; -static vm_offset_t cpage_a; -static vm_offset_t cpage_b; - /* * Crashdump maps. */ @@ -1072,10 +1068,6 @@ pmap_init(void) M_WAITOK | M_ZERO); for (i = 0; i < pv_npg; i++) TAILQ_INIT(&pv_table[i].pv_list); - - mtx_init(&cpage_lock, "cpage", NULL, MTX_DEF); - cpage_a = kva_alloc(PAGE_SIZE); - cpage_b = kva_alloc(PAGE_SIZE); } static SYSCTL_NODE(_vm_pmap, OID_AUTO, pde, CTLFLAG_RD, 0, @@ -5056,66 +5048,24 @@ pmap_copy_pages(vm_page_t ma[], vm_offse vm_offset_t b_offset, int xfersize) { void *a_cp, *b_cp; - vm_page_t m_a, m_b; - vm_paddr_t p_a, p_b; - pt_entry_t *pte; - vm_offset_t a_pg_offset, b_pg_offset; + vm_page_t pages[2]; + vm_offset_t vaddr[2], a_pg_offset, b_pg_offset; int cnt; - boolean_t pinned; + boolean_t mapped; - /* - * NB: The sequence of updating a page table followed by accesses - * to the corresponding pages used in the !DMAP case is subject to - * the situation described in the "AMD64 Architecture Programmer's - * Manual Volume 2: System Programming" rev. 3.23, "7.3.1 Special - * Coherency Considerations". Therefore, issuing the INVLPG right - * after modifying the PTE bits is crucial. - */ - pinned = FALSE; while (xfersize > 0) { a_pg_offset = a_offset & PAGE_MASK; - m_a = ma[a_offset >> PAGE_SHIFT]; - p_a = m_a->phys_addr; + pages[0] = ma[a_offset >> PAGE_SHIFT]; b_pg_offset = b_offset & PAGE_MASK; - m_b = mb[b_offset >> PAGE_SHIFT]; - p_b = m_b->phys_addr; + pages[1] = mb[b_offset >> PAGE_SHIFT]; cnt = min(xfersize, PAGE_SIZE - a_pg_offset); cnt = min(cnt, PAGE_SIZE - b_pg_offset); - if (__predict_false(p_a < DMAP_MIN_ADDRESS || - p_a > DMAP_MIN_ADDRESS + dmaplimit)) { - mtx_lock(&cpage_lock); - sched_pin(); - pinned = TRUE; - pte = vtopte(cpage_a); - *pte = p_a | X86_PG_A | X86_PG_V | - pmap_cache_bits(kernel_pmap, m_a->md.pat_mode, 0); - invlpg(cpage_a); - a_cp = (char *)cpage_a + a_pg_offset; - } else { - a_cp = (char *)PHYS_TO_DMAP(p_a) + a_pg_offset; - } - if (__predict_false(p_b < DMAP_MIN_ADDRESS || - p_b > DMAP_MIN_ADDRESS + dmaplimit)) { - if (!pinned) { - mtx_lock(&cpage_lock); - sched_pin(); - pinned = TRUE; - } - pte = vtopte(cpage_b); - *pte = p_b | X86_PG_A | X86_PG_M | X86_PG_RW | - X86_PG_V | pmap_cache_bits(kernel_pmap, - m_b->md.pat_mode, 0); - invlpg(cpage_b); - b_cp = (char *)cpage_b + b_pg_offset; - } else { - b_cp = (char *)PHYS_TO_DMAP(p_b) + b_pg_offset; - } + mapped = pmap_map_io_transient(pages, vaddr, 2, FALSE); + a_cp = (char *)vaddr[0] + a_pg_offset; + b_cp = (char *)vaddr[1] + b_pg_offset; bcopy(a_cp, b_cp, cnt); - if (__predict_false(pinned)) { - sched_unpin(); - mtx_unlock(&cpage_lock); - pinned = FALSE; - } + if (__predict_false(mapped)) + pmap_unmap_io_transient(pages, vaddr, 2, FALSE); a_offset += cnt; b_offset += cnt; xfersize -= cnt; @@ -6901,6 +6851,107 @@ done: *num = idx; } +/** + * Get the kernel virtual address of a set of physical pages. If there are + * physical addresses not covered by the DMAP perform a transient mapping + * that will be removed when calling pmap_unmap_io_transient. + * + * \param page The pages the caller wishes to obtain the virtual + * address on the kernel memory map. + * \param vaddr On return contains the kernel virtual memory address + * of the pages passed in the page parameter. + * \param count Number of pages passed in. + * \param can_fault TRUE if the thread using the mapped pages can take + * page faults, FALSE otherwise. + * + * \returns TRUE if the caller must call pmap_unmap_io_transient when + * finished or FALSE otherwise. + * + */ +boolean_t +pmap_map_io_transient(vm_page_t page[], vm_offset_t vaddr[], int count, + boolean_t can_fault) +{ + vm_paddr_t paddr; + boolean_t needs_mapping; + pt_entry_t *pte; + int cache_bits, error, i; + + /* + * Allocate any KVA space that we need, this is done in a separate + * loop to prevent calling vmem_alloc while pinned. + */ + needs_mapping = FALSE; + for (i = 0; i < count; i++) { + paddr = VM_PAGE_TO_PHYS(page[i]); + if (__predict_false(paddr >= dmaplimit)) { + error = vmem_alloc(kernel_arena, PAGE_SIZE, + M_BESTFIT | M_WAITOK, &vaddr[i]); + KASSERT(error == 0, ("vmem_alloc failed: %d", error)); + needs_mapping = TRUE; + } else { + vaddr[i] = PHYS_TO_DMAP(paddr); + } + } + + /* Exit early if everything is covered by the DMAP */ + if (!needs_mapping) + return (FALSE); + + /* + * NB: The sequence of updating a page table followed by accesses + * to the corresponding pages used in the !DMAP case is subject to + * the situation described in the "AMD64 Architecture Programmer's + * Manual Volume 2: System Programming" rev. 3.23, "7.3.1 Special + * Coherency Considerations". Therefore, issuing the INVLPG right + * after modifying the PTE bits is crucial. + */ + if (!can_fault) + sched_pin(); + for (i = 0; i < count; i++) { + paddr = VM_PAGE_TO_PHYS(page[i]); + if (paddr >= dmaplimit) { + if (can_fault) { + /* + * Slow path, since we can get page faults + * while mappings are active don't pin the + * thread to the CPU and instead add a global + * mapping visible to all CPUs. + */ + pmap_qenter(vaddr[i], &page[i], 1); + } else { + pte = vtopte(vaddr[i]); + cache_bits = pmap_cache_bits(kernel_pmap, + page[i]->md.pat_mode, 0); + pte_store(pte, paddr | X86_PG_RW | X86_PG_V | + cache_bits); + invlpg(vaddr[i]); + } + } + } + + return (needs_mapping); +} + +void +pmap_unmap_io_transient(vm_page_t page[], vm_offset_t vaddr[], int count, + boolean_t can_fault) +{ + vm_paddr_t paddr; + int i; + + if (!can_fault) + sched_unpin(); + for (i = 0; i < count; i++) { + paddr = VM_PAGE_TO_PHYS(page[i]); + if (paddr >= dmaplimit) { + if (can_fault) + pmap_qremove(vaddr[i], 1); + vmem_free(kernel_arena, vaddr[i], PAGE_SIZE); + } + } +} + #include "opt_ddb.h" #ifdef DDB #include Modified: head/sys/amd64/amd64/uio_machdep.c ============================================================================== --- head/sys/amd64/amd64/uio_machdep.c Fri Oct 24 07:50:34 2014 (r273581) +++ head/sys/amd64/amd64/uio_machdep.c Fri Oct 24 09:48:58 2014 (r273582) @@ -61,10 +61,11 @@ uiomove_fromphys(vm_page_t ma[], vm_offs struct thread *td = curthread; struct iovec *iov; void *cp; - vm_offset_t page_offset; + vm_offset_t page_offset, vaddr; size_t cnt; int error = 0; int save = 0; + boolean_t mapped; KASSERT(uio->uio_rw == UIO_READ || uio->uio_rw == UIO_WRITE, ("uiomove_fromphys: mode")); @@ -72,6 +73,7 @@ uiomove_fromphys(vm_page_t ma[], vm_offs ("uiomove_fromphys proc")); save = td->td_pflags & TDP_DEADLKTREAT; td->td_pflags |= TDP_DEADLKTREAT; + mapped = FALSE; while (n > 0 && uio->uio_resid) { iov = uio->uio_iov; cnt = iov->iov_len; @@ -84,8 +86,11 @@ uiomove_fromphys(vm_page_t ma[], vm_offs cnt = n; page_offset = offset & PAGE_MASK; cnt = min(cnt, PAGE_SIZE - page_offset); - cp = (char *)PHYS_TO_DMAP(ma[offset >> PAGE_SHIFT]->phys_addr) + - page_offset; + if (uio->uio_segflg != UIO_NOCOPY) { + mapped = pmap_map_io_transient( + &ma[offset >> PAGE_SHIFT], &vaddr, 1, TRUE); + cp = (char *)vaddr + page_offset; + } switch (uio->uio_segflg) { case UIO_USERSPACE: maybe_yield(); @@ -105,6 +110,11 @@ uiomove_fromphys(vm_page_t ma[], vm_offs case UIO_NOCOPY: break; } + if (__predict_false(mapped)) { + pmap_unmap_io_transient(&ma[offset >> PAGE_SHIFT], + &vaddr, 1, TRUE); + mapped = FALSE; + } iov->iov_base = (char *)iov->iov_base + cnt; iov->iov_len -= cnt; uio->uio_resid -= cnt; @@ -113,6 +123,9 @@ uiomove_fromphys(vm_page_t ma[], vm_offs n -= cnt; } out: + if (__predict_false(mapped)) + pmap_unmap_io_transient(&ma[offset >> PAGE_SHIFT], &vaddr, 1, + TRUE); if (save == 0) td->td_pflags &= ~TDP_DEADLKTREAT; return (error); Modified: head/sys/amd64/include/pmap.h ============================================================================== --- head/sys/amd64/include/pmap.h Fri Oct 24 07:50:34 2014 (r273581) +++ head/sys/amd64/include/pmap.h Fri Oct 24 09:48:58 2014 (r273582) @@ -397,6 +397,8 @@ void pmap_invalidate_cache_pages(vm_page void pmap_invalidate_cache_range(vm_offset_t sva, vm_offset_t eva, boolean_t force); void pmap_get_mapping(pmap_t pmap, vm_offset_t va, uint64_t *ptr, int *num); +boolean_t pmap_map_io_transient(vm_page_t *, vm_offset_t *, int, boolean_t); +void pmap_unmap_io_transient(vm_page_t *, vm_offset_t *, int, boolean_t); #endif /* _KERNEL */ #endif /* !LOCORE */ Modified: head/sys/amd64/include/vmparam.h ============================================================================== --- head/sys/amd64/include/vmparam.h Fri Oct 24 07:50:34 2014 (r273581) +++ head/sys/amd64/include/vmparam.h Fri Oct 24 09:48:58 2014 (r273582) @@ -175,8 +175,18 @@ #define VM_MAX_ADDRESS UPT_MAX_ADDRESS #define VM_MIN_ADDRESS (0) -#define PHYS_TO_DMAP(x) ((x) | DMAP_MIN_ADDRESS) -#define DMAP_TO_PHYS(x) ((x) & ~DMAP_MIN_ADDRESS) +#define PHYS_TO_DMAP(x) ({ \ + KASSERT((x) < dmaplimit, \ + ("physical address %#jx not covered by the DMAP", \ + (uintmax_t)x)); \ + (x) | DMAP_MIN_ADDRESS; }) + +#define DMAP_TO_PHYS(x) ({ \ + KASSERT((x) < (DMAP_MIN_ADDRESS + dmaplimit) && \ + (x) >= DMAP_MIN_ADDRESS, \ + ("virtual address %#jx not covered by the DMAP", \ + (uintmax_t)x)); \ + (x) & ~DMAP_MIN_ADDRESS; }) /* * How many physical pages per kmem arena virtual page. From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 11:34:56 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A9D59F5B; Fri, 24 Oct 2014 11:34:56 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 95D273D9; Fri, 24 Oct 2014 11:34:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OBYurX070575; Fri, 24 Oct 2014 11:34:56 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OBYujj070574; Fri, 24 Oct 2014 11:34:56 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201410241134.s9OBYujj070574@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Fri, 24 Oct 2014 11:34:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273583 - head/usr.sbin/ctld X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 11:34:56 -0000 Author: trasz Date: Fri Oct 24 11:34:55 2014 New Revision: 273583 URL: https://svnweb.freebsd.org/changeset/base/273583 Log: Tidy up the login code; no functional changes. MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/ctld/login.c Modified: head/usr.sbin/ctld/login.c ============================================================================== --- head/usr.sbin/ctld/login.c Fri Oct 24 09:48:58 2014 (r273582) +++ head/usr.sbin/ctld/login.c Fri Oct 24 11:34:55 2014 (r273583) @@ -672,6 +672,7 @@ login(struct connection *conn) struct iscsi_bhs_login_response *bhslr2; struct keys *request_keys, *response_keys; struct auth_group *ag; + struct portal_group *pg; const char *initiator_name, *initiator_alias, *session_type, *target_name, *auth_method; @@ -688,6 +689,8 @@ login(struct connection *conn) log_errx(1, "received Login PDU with non-zero TSIH"); } + pg = conn->conn_portal->p_portal_group; + memcpy(conn->conn_initiator_isid, bhslr->bhslr_isid, sizeof(conn->conn_initiator_isid)); @@ -741,9 +744,7 @@ login(struct connection *conn) log_errx(1, "received Login PDU without TargetName"); } - conn->conn_target = - target_find(conn->conn_portal->p_portal_group->pg_conf, - target_name); + conn->conn_target = target_find(pg->pg_conf, target_name); if (conn->conn_target == NULL) { login_send_error(request, 0x02, 0x03); log_errx(1, "requested target \"%s\" not found", @@ -760,14 +761,14 @@ login(struct connection *conn) log_debugx("initiator requests to connect " "to target \"%s\"; auth-group \"%s\"", conn->conn_target->t_name, - conn->conn_target->t_auth_group->ag_name); + ag->ag_name); } else { log_debugx("initiator requests to connect " "to target \"%s\"", conn->conn_target->t_name); } } else { assert(conn->conn_session_type == CONN_SESSION_TYPE_DISCOVERY); - ag = conn->conn_portal->p_portal_group->pg_discovery_auth_group; + ag = pg->pg_discovery_auth_group; if (ag->ag_name != NULL) { log_debugx("initiator requests " "discovery session; auth-group \"%s\"", ag->ag_name); @@ -837,8 +838,7 @@ login(struct connection *conn) response = login_new_response(request); bhslr2 = (struct iscsi_bhs_login_response *)response->pdu_bhs; bhslr2->bhslr_flags |= BHSLR_FLAGS_TRANSIT; - login_set_nsg(response, - BHSLR_STAGE_OPERATIONAL_NEGOTIATION); + login_set_nsg(response, BHSLR_STAGE_OPERATIONAL_NEGOTIATION); response_keys = keys_new(); /* * Required by Linux initiator. @@ -852,8 +852,8 @@ login(struct connection *conn) if (conn->conn_target->t_alias != NULL) keys_add(response_keys, "TargetAlias", conn->conn_target->t_alias); - keys_add_int(response_keys, "TargetPortalGroupTag", - conn->conn_portal->p_portal_group->pg_tag); + keys_add_int(response_keys, + "TargetPortalGroupTag", pg->pg_tag); } keys_save(response_keys, response); pdu_send(response); @@ -903,8 +903,8 @@ login(struct connection *conn) if (conn->conn_target->t_alias != NULL) keys_add(response_keys, "TargetAlias", conn->conn_target->t_alias); - keys_add_int(response_keys, "TargetPortalGroupTag", - conn->conn_portal->p_portal_group->pg_tag); + keys_add_int(response_keys, + "TargetPortalGroupTag", pg->pg_tag); } keys_save(response_keys, response); From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 11:40:11 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E11E524A; Fri, 24 Oct 2014 11:40:10 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CD04F611; Fri, 24 Oct 2014 11:40:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OBeAeN071920; Fri, 24 Oct 2014 11:40:10 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OBeAaX071917; Fri, 24 Oct 2014 11:40:10 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201410241140.s9OBeAaX071917@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Fri, 24 Oct 2014 11:40:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273584 - head/usr.sbin/ctld X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 11:40:11 -0000 Author: trasz Date: Fri Oct 24 11:40:09 2014 New Revision: 273584 URL: https://svnweb.freebsd.org/changeset/base/273584 Log: Make the initiator-name and initiator-portal checks a little nicer. MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/ctld/ctld.c head/usr.sbin/ctld/ctld.h head/usr.sbin/ctld/login.c Modified: head/usr.sbin/ctld/ctld.c ============================================================================== --- head/usr.sbin/ctld/ctld.c Fri Oct 24 11:34:55 2014 (r273583) +++ head/usr.sbin/ctld/ctld.c Fri Oct 24 11:40:09 2014 (r273584) @@ -318,6 +318,18 @@ auth_name_find(const struct auth_group * return (NULL); } +int +auth_name_check(const struct auth_group *ag, const char *initiator_name) +{ + if (!auth_name_defined(ag)) + return (0); + + if (auth_name_find(ag, initiator_name) == NULL) + return (1); + + return (0); +} + const struct auth_portal * auth_portal_new(struct auth_group *ag, const char *portal) { @@ -430,6 +442,19 @@ next: return (NULL); } +int +auth_portal_check(const struct auth_group *ag, const struct sockaddr_storage *sa) +{ + + if (!auth_portal_defined(ag)) + return (0); + + if (auth_portal_find(ag, sa) == NULL) + return (1); + + return (0); +} + struct auth_group * auth_group_new(struct conf *conf, const char *name) { Modified: head/usr.sbin/ctld/ctld.h ============================================================================== --- head/usr.sbin/ctld/ctld.h Fri Oct 24 11:34:55 2014 (r273583) +++ head/usr.sbin/ctld/ctld.h Fri Oct 24 11:40:09 2014 (r273584) @@ -263,12 +263,16 @@ const struct auth_name *auth_name_new(st bool auth_name_defined(const struct auth_group *ag); const struct auth_name *auth_name_find(const struct auth_group *ag, const char *initiator_name); +int auth_name_check(const struct auth_group *ag, + const char *initiator_name); const struct auth_portal *auth_portal_new(struct auth_group *ag, const char *initiator_portal); bool auth_portal_defined(const struct auth_group *ag); const struct auth_portal *auth_portal_find(const struct auth_group *ag, const struct sockaddr_storage *sa); +int auth_portal_check(const struct auth_group *ag, + const struct sockaddr_storage *sa); struct portal_group *portal_group_new(struct conf *conf, const char *name); void portal_group_delete(struct portal_group *pg); Modified: head/usr.sbin/ctld/login.c ============================================================================== --- head/usr.sbin/ctld/login.c Fri Oct 24 11:34:55 2014 (r273583) +++ head/usr.sbin/ctld/login.c Fri Oct 24 11:40:09 2014 (r273584) @@ -780,28 +780,15 @@ login(struct connection *conn) /* * Enforce initiator-name and initiator-portal. */ - if (auth_name_defined(ag)) { - if (auth_name_find(ag, initiator_name) == NULL) { - login_send_error(request, 0x02, 0x02); - log_errx(1, "initiator does not match allowed " - "initiator names"); - } - log_debugx("initiator matches allowed initiator names"); - } else { - log_debugx("auth-group does not define initiator name " - "restrictions"); + if (auth_name_check(ag, initiator_name) != 0) { + login_send_error(request, 0x02, 0x02); + log_errx(1, "initiator does not match allowed initiator names"); } - if (auth_portal_defined(ag)) { - if (auth_portal_find(ag, &conn->conn_initiator_sa) == NULL) { - login_send_error(request, 0x02, 0x02); - log_errx(1, "initiator does not match allowed " - "initiator portals"); - } - log_debugx("initiator matches allowed initiator portals"); - } else { - log_debugx("auth-group does not define initiator portal " - "restrictions"); + if (auth_portal_check(ag, &conn->conn_initiator_sa) != 0) { + login_send_error(request, 0x02, 0x02); + log_errx(1, "initiator does not match allowed " + "initiator portals"); } /* From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 12:30:44 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 76E11EA7; Fri, 24 Oct 2014 12:30:44 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 62892BE5; Fri, 24 Oct 2014 12:30:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OCUiP3096570; Fri, 24 Oct 2014 12:30:44 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OCUio2096569; Fri, 24 Oct 2014 12:30:44 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201410241230.s9OCUio2096569@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Fri, 24 Oct 2014 12:30:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273585 - head/usr.sbin/ctld X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 12:30:44 -0000 Author: trasz Date: Fri Oct 24 12:30:43 2014 New Revision: 273585 URL: https://svnweb.freebsd.org/changeset/base/273585 Log: Improve ctld.conf example. MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/ctld/ctl.conf.5 Modified: head/usr.sbin/ctld/ctl.conf.5 ============================================================================== --- head/usr.sbin/ctld/ctl.conf.5 Fri Oct 24 11:40:09 2014 (r273584) +++ head/usr.sbin/ctld/ctl.conf.5 Fri Oct 24 12:30:43 2014 (r273585) @@ -295,18 +295,25 @@ configuration file. .Bd -literal pidfile /var/run/ctld.pid -auth-group example2 { +auth-group ag0 { chap-mutual "user" "secret" "mutualuser" "mutualsecret" chap-mutual "user2" "secret2" "mutualuser" "mutualsecret" initiator-portal 192.168.1.1/16 } -portal-group example2 { +auth-group ag1 { + auth-type none + initiator-name "iqn.2012-06.com.example:initiatorhost1" + initiator-name "iqn.2012-06.com.example:initiatorhost2" + initiator-portal 192.168.1.1/24 + initiator-portal [2001:db8::de:ef] +} + +portal-group pg0 { discovery-auth-group no-authentication - listen 127.0.0.1 - listen 0.0.0.0:3261 - listen [::]:3261 - listen [fe80::be:ef] + listen 0.0.0.0:3260 + listen [::]:3260 + listen [fe80::be:ef]:3261 } target iqn.2012-06.com.example:target0 { @@ -319,16 +326,16 @@ target iqn.2012-06.com.example:target0 { } } -target iqn.2012-06.com.example:target3 { +target iqn.2012-06.com.example:target1 { chap chapuser chapsecret lun 0 { - path /dev/zvol/tank/example_3 + path /dev/zvol/tank/example_1 } } target iqn.2012-06.com.example:target2 { - auth-group example2 - portal-group example2 + auth-group ag0 + portal-group pg0 lun 0 { path /dev/zvol/tank/example2_0 } From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 13:14:25 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 385AD9E0; Fri, 24 Oct 2014 13:14:25 +0000 (UTC) Received: from mx0.gentlemail.de (mx0.gentlemail.de [IPv6:2a00:e10:2800::a130]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B5A5513C; Fri, 24 Oct 2014 13:14:24 +0000 (UTC) Received: from mh0.gentlemail.de (mh0.gentlemail.de [78.138.80.135]) by mx0.gentlemail.de (8.14.5/8.14.5) with ESMTP id s9ODELil099716; Fri, 24 Oct 2014 15:14:21 +0200 (CEST) (envelope-from h.schmalzbauer@omnilan.de) Received: from titan.inop.mo1.omnilan.net (titan.inop.mo1.omnilan.net [IPv6:2001:a60:f0bb:1::3:1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mh0.gentlemail.de (Postfix) with ESMTPSA id 98E043E05; Fri, 24 Oct 2014 15:14:20 +0200 (CEST) Message-ID: <544A50A3.9030309@omnilan.de> Date: Fri, 24 Oct 2014 15:14:11 +0200 From: Harald Schmalzbauer Organization: OmniLAN User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; de-DE; rv:1.9.2.8) Gecko/20100906 Lightning/1.0b2 Thunderbird/3.1.2 MIME-Version: 1.0 To: Luigi Rizzo Subject: Re: svn commit: r272604 - stable/10/sys/dev/netmap References: <201410060946.s969kMiO074394@svn.freebsd.org> In-Reply-To: <201410060946.s969kMiO074394@svn.freebsd.org> X-Enigmail-Version: 1.1.2 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig429F4304986C41C3A227CE63" X-Greylist: ACL 119 matched, not delayed by milter-greylist-4.2.7 (mx0.gentlemail.de [78.138.80.130]); Fri, 24 Oct 2014 15:14:21 +0200 (CEST) X-Milter: Spamilter (Reciever: mx0.gentlemail.de; Sender-ip: 78.138.80.135; Sender-helo: mh0.gentlemail.de; ) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-10@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 13:14:25 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig429F4304986C41C3A227CE63 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Bez=FCglich Luigi Rizzo's Nachricht vom 06.10.2014 11:46 (localtime): > Author: luigi > Date: Mon Oct 6 09:46:21 2014 > New Revision: 272604 > URL: https://svnweb.freebsd.org/changeset/base/272604 > > Log: > MFC r272111 > fix a panic when passing ifioctl from a netmap file descriptor to > the underlying device. This needs to be merged to 10.1 > Was MFS rejected by re? Thanks, -Harry --------------enig429F4304986C41C3A227CE63 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAlRKUKwACgkQLDqVQ9VXb8jVVQCgmZSyZUCfOcVr6C84WCCbcvXd PtwAnRMYq5wLmdxLrHoK7KpikdeB005V =QNFi -----END PGP SIGNATURE----- --------------enig429F4304986C41C3A227CE63-- From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 13:29:13 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BD972EFB; Fri, 24 Oct 2014 13:29:13 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A920C286; Fri, 24 Oct 2014 13:29:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9ODTDUt022692; Fri, 24 Oct 2014 13:29:13 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9ODTDK7022691; Fri, 24 Oct 2014 13:29:13 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201410241329.s9ODTDK7022691@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Fri, 24 Oct 2014 13:29:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273586 - head/sbin/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 13:29:13 -0000 Author: melifaro Date: Fri Oct 24 13:29:12 2014 New Revision: 273586 URL: https://svnweb.freebsd.org/changeset/base/273586 Log: Fix displaying non-contiguous netmasks. Found by: ae Sponsored by: Yandex LLC Modified: head/sbin/ipfw/ipfw2.c Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Fri Oct 24 12:30:43 2014 (r273585) +++ head/sbin/ipfw/ipfw2.c Fri Oct 24 13:29:12 2014 (r273586) @@ -1225,9 +1225,10 @@ print_ip(struct buf_pr *bp, struct forma else { /* numeric IP followed by some kind of mask */ ia = (struct in_addr *)&a[0]; bprintf(bp, "%s", inet_ntoa(*ia)); - if (mb < 0) - bprintf(bp, ":%s", inet_ntoa(*ia ) ); - else if (mb < 32) + if (mb < 0) { + ia = (struct in_addr *)&a[1]; + bprintf(bp, ":%s", inet_ntoa(*ia)); + } else if (mb < 32) bprintf(bp, "/%d", mb); } if (len > 1) From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 13:34:23 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C11973B4; Fri, 24 Oct 2014 13:34:23 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ACDF63F8; Fri, 24 Oct 2014 13:34:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9ODYNQ4026916; Fri, 24 Oct 2014 13:34:23 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9ODYNGX026913; Fri, 24 Oct 2014 13:34:23 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201410241334.s9ODYNGX026913@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Fri, 24 Oct 2014 13:34:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273587 - in head/sys: net netinet netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 13:34:23 -0000 Author: ae Date: Fri Oct 24 13:34:22 2014 New Revision: 273587 URL: https://svnweb.freebsd.org/changeset/base/273587 Log: Remove redundant check and m_pullup() call. Modified: head/sys/net/if_gif.c head/sys/netinet/in_gif.c head/sys/netinet6/in6_gif.c Modified: head/sys/net/if_gif.c ============================================================================== --- head/sys/net/if_gif.c Fri Oct 24 13:29:12 2014 (r273586) +++ head/sys/net/if_gif.c Fri Oct 24 13:34:22 2014 (r273587) @@ -400,8 +400,6 @@ gif_transmit(struct ifnet *ifp, struct m case AF_LINK: proto = IPPROTO_ETHERIP; M_PREPEND(m, sizeof(struct etherip_header), M_NOWAIT); - if (m != NULL && m->m_len < sizeof(struct etherip_header)) - m = m_pullup(m, sizeof(struct etherip_header)); if (m == NULL) { error = ENOBUFS; goto err; Modified: head/sys/netinet/in_gif.c ============================================================================== --- head/sys/netinet/in_gif.c Fri Oct 24 13:29:12 2014 (r273586) +++ head/sys/netinet/in_gif.c Fri Oct 24 13:34:22 2014 (r273587) @@ -103,8 +103,6 @@ in_gif_output(struct ifnet *ifp, struct len += ETHERIP_ALIGN; #endif M_PREPEND(m, len, M_NOWAIT); - if (m != NULL && m->m_len < len) - m = m_pullup(m, len); if (m == NULL) return (ENOBUFS); #ifndef __NO_STRICT_ALIGNMENT Modified: head/sys/netinet6/in6_gif.c ============================================================================== --- head/sys/netinet6/in6_gif.c Fri Oct 24 13:29:12 2014 (r273586) +++ head/sys/netinet6/in6_gif.c Fri Oct 24 13:34:22 2014 (r273587) @@ -111,8 +111,6 @@ in6_gif_output(struct ifnet *ifp, struct len += ETHERIP_ALIGN; #endif M_PREPEND(m, len, M_NOWAIT); - if (m != NULL && m->m_len < len) - m = m_pullup(m, len); if (m == NULL) return (ENOBUFS); #ifndef __NO_STRICT_ALIGNMENT From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 13:57:16 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3CC52AF4; Fri, 24 Oct 2014 13:57:16 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 28311874; Fri, 24 Oct 2014 13:57:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9ODvG4F036740; Fri, 24 Oct 2014 13:57:16 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9ODvGvh036739; Fri, 24 Oct 2014 13:57:16 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201410241357.s9ODvGvh036739@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Fri, 24 Oct 2014 13:57:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273588 - head/sys/netpfil/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 13:57:16 -0000 Author: melifaro Date: Fri Oct 24 13:57:15 2014 New Revision: 273588 URL: https://svnweb.freebsd.org/changeset/base/273588 Log: Bump default dynamic limit to 16k entries. Print better log message when limit is hit. PR: 193300 Submitted by: me at nileshgr.com Modified: head/sys/netpfil/ipfw/ip_fw_dynamic.c Modified: head/sys/netpfil/ipfw/ip_fw_dynamic.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_dynamic.c Fri Oct 24 13:34:22 2014 (r273587) +++ head/sys/netpfil/ipfw/ip_fw_dynamic.c Fri Oct 24 13:57:15 2014 (r273588) @@ -592,8 +592,9 @@ add_dyn_rule(struct ipfw_flow_id *id, in if (r == NULL) { if (last_log != time_uptime) { last_log = time_uptime; - log(LOG_DEBUG, "ipfw: %s: Cannot allocate rule\n", - __func__); + log(LOG_DEBUG, + "ipfw: Cannot allocate dynamic state, " + "consider increasing net.inet.ip.fw.dyn_max\n"); } return NULL; } @@ -1385,7 +1386,7 @@ ipfw_dyn_init(struct ip_fw_chain *chain) V_dyn_keepalive = 1; /* do send keepalives */ V_dyn_keepalive_last = time_uptime; - V_dyn_max = 4096; /* max # of dynamic rules */ + V_dyn_max = 16384; /* max # of dynamic rules */ V_ipfw_dyn_rule_zone = uma_zcreate("IPFW dynamic rule", sizeof(ipfw_dyn_rule), NULL, NULL, NULL, NULL, From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 15:36:32 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 803E3788; Fri, 24 Oct 2014 15:36:32 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 53863382; Fri, 24 Oct 2014 15:36:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OFaWFR084486; Fri, 24 Oct 2014 15:36:32 GMT (envelope-from kevlo@FreeBSD.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OFaVoA084483; Fri, 24 Oct 2014 15:36:31 GMT (envelope-from kevlo@FreeBSD.org) Message-Id: <201410241536.s9OFaVoA084483@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kevlo set sender to kevlo@FreeBSD.org using -f From: Kevin Lo Date: Fri, 24 Oct 2014 15:36:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273589 - in head: share/man/man4 sys/dev/usb sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 15:36:32 -0000 Author: kevlo Date: Fri Oct 24 15:36:30 2014 New Revision: 273589 URL: https://svnweb.freebsd.org/changeset/base/273589 Log: Add D-Link DWA-123 rev D1 and Elecom WDC-150SU2M. Modified: head/share/man/man4/urtwn.4 head/sys/dev/usb/usbdevs head/sys/dev/usb/wlan/if_urtwn.c Modified: head/share/man/man4/urtwn.4 ============================================================================== --- head/share/man/man4/urtwn.4 Fri Oct 24 13:57:15 2014 (r273588) +++ head/share/man/man4/urtwn.4 Fri Oct 24 15:36:30 2014 (r273589) @@ -14,7 +14,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 3, 2014 +.Dd October 24, 2014 .Dt URTWN 4 .Os .Sh NAME @@ -89,9 +89,11 @@ IEEE 802.11b/g/n wireless network adapte .It Alfa AWUS036NHR v2 .It ASUS USB-N10 NANO .It Belkin F7D1102 Surf Wireless Micro +.It D-Link DWA-123 rev D1 .It D-Link DWA-125 rev D1 .It D-Link DWA-131 .It Edimax EW-7811Un +.It Elecom WDC-150SU2M .It Netgear WNA1000M .It Realtek RTL8192CU .It Realtek RTL8188CUS Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Fri Oct 24 13:57:15 2014 (r273588) +++ head/sys/dev/usb/usbdevs Fri Oct 24 15:36:30 2014 (r273589) @@ -1596,6 +1596,7 @@ product DLINK DUBE100C1 0x1a02 DUB-E100 product DLINK DSB650TX4 0x200c 10/100 Ethernet product DLINK DWL120E 0x3200 DWL-120 rev E product DLINK DWA125D1 0x330f DWA-125 rev D1 +product DLINK DWA123D1 0x3310 DWA-123 rev D1 product DLINK DWL122 0x3700 DWL-122 product DLINK DWLG120 0x3701 DWL-G120 product DLINK DWL120F 0x3702 DWL-120 rev F @@ -1708,6 +1709,7 @@ product ELECOM MOUSE29UO 0x0002 mouse 29 product ELECOM LDUSBTX0 0x200c LD-USB/TX product ELECOM LDUSBTX1 0x4002 LD-USB/TX product ELECOM LDUSBLTX 0x4005 LD-USBL/TX +product ELECOM WDC150SU2M 0x4008 WDC-150SU2M product ELECOM LDUSBTX2 0x400b LD-USB/TX product ELECOM LDUSB20 0x4010 LD-USB20 product ELECOM UCSGT 0x5003 UC-SGT Modified: head/sys/dev/usb/wlan/if_urtwn.c ============================================================================== --- head/sys/dev/usb/wlan/if_urtwn.c Fri Oct 24 13:57:15 2014 (r273588) +++ head/sys/dev/usb/wlan/if_urtwn.c Fri Oct 24 15:36:30 2014 (r273589) @@ -153,7 +153,9 @@ static const STRUCT_USB_HOST_ID urtwn_de URTWN_DEV(TRENDNET, RTL8192CU), URTWN_DEV(ZYXEL, RTL8192CU), /* URTWN_RTL8188E */ + URTWN_RTL8188E_DEV(DLINK, DWA123D1), URTWN_RTL8188E_DEV(DLINK, DWA125D1), + URTWN_RTL8188E_DEV(ELECOM, WDC150SU2M), URTWN_RTL8188E_DEV(REALTEK, RTL8188ETV), URTWN_RTL8188E_DEV(REALTEK, RTL8188EU), #undef URTWN_RTL8188E_DEV From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 15:44:30 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5F47BAF7; Fri, 24 Oct 2014 15:44:30 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4B51D672; Fri, 24 Oct 2014 15:44:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OFiUf9088924; Fri, 24 Oct 2014 15:44:30 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OFiUZP088923; Fri, 24 Oct 2014 15:44:30 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201410241544.s9OFiUZP088923@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Fri, 24 Oct 2014 15:44:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273590 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 15:44:30 -0000 Author: ian Date: Fri Oct 24 15:44:29 2014 New Revision: 273590 URL: https://svnweb.freebsd.org/changeset/base/273590 Log: Accept the documented FDT compatible string for the PL310 cache controller as well as the non-standard string we've been using for a couple years. Modified: head/sys/arm/arm/pl310.c Modified: head/sys/arm/arm/pl310.c ============================================================================== --- head/sys/arm/arm/pl310.c Fri Oct 24 15:36:30 2014 (r273589) +++ head/sys/arm/arm/pl310.c Fri Oct 24 15:44:29 2014 (r273590) @@ -84,6 +84,12 @@ static uint32_t g_ways_assoc; static struct pl310_softc *pl310_softc; +static struct ofw_compat_data compat_data[] = { + {"arm,pl310", true}, /* Non-standard, FreeBSD. */ + {"arm,pl310-cache", true}, + {NULL, false} +}; + void pl310_print_config(struct pl310_softc *sc) { @@ -422,8 +428,7 @@ pl310_probe(device_t dev) if (!ofw_bus_status_okay(dev)) return (ENXIO); - - if (!ofw_bus_is_compatible(dev, "arm,pl310")) + if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data) return (ENXIO); device_set_desc(dev, "PL310 L2 cache controller"); return (0); From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 16:07:32 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AC33117D; Fri, 24 Oct 2014 16:07:32 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7E2ED8F9; Fri, 24 Oct 2014 16:07:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OG7Wrb099196; Fri, 24 Oct 2014 16:07:32 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OG7WrR099195; Fri, 24 Oct 2014 16:07:32 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410241607.s9OG7WrR099195@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Fri, 24 Oct 2014 16:07:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273591 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 16:07:32 -0000 Author: ngie Date: Fri Oct 24 16:07:31 2014 New Revision: 273591 URL: https://svnweb.freebsd.org/changeset/base/273591 Log: Correct my previous commit: - getrusage_utime_back succeeds reliably on FreeBSD - getrusage_utime_zero passes/fails in a seemingly non-deterministic manner. Skip it for now (and fix it later) In the initial port of this testcase to FreeBSD, the results failed reliably in the same manner as it does on NetBSD Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_getrusage.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_getrusage.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_getrusage.c Fri Oct 24 15:44:29 2014 (r273590) +++ head/contrib/netbsd-tests/lib/libc/sys/t_getrusage.c Fri Oct 24 16:07:31 2014 (r273591) @@ -133,7 +133,9 @@ ATF_TC_BODY(getrusage_utime_back, tc) /* * Test that two consecutive calls are sane. */ +#ifdef __NetBSD__ atf_tc_expect_fail("PR kern/30115"); +#endif for (i = 0; i < maxiter; i++) { @@ -152,7 +154,9 @@ ATF_TC_BODY(getrusage_utime_back, tc) atf_tc_fail("user time went backwards"); } +#ifdef __NetBSD__ atf_tc_fail("anticipated error did not occur"); +#endif } ATF_TC(getrusage_utime_zero); @@ -166,15 +170,18 @@ ATF_TC_BODY(getrusage_utime_zero, tc) struct rusage ru; size_t i; +#ifdef __FreeBSD__ + atf_tc_skip("this testcase passes/fails sporadically on FreeBSD/i386 " + "@ r273153 (at least)"); +#endif + /* * Test that getrusage(2) does not return * zero user time for the calling process. * * See also (duplicate) PR port-amd64/41734. */ -#if defined(__NetBSD__) atf_tc_expect_fail("PR kern/30115"); -#endif for (i = 0; i < maxiter; i++) { @@ -188,9 +195,7 @@ ATF_TC_BODY(getrusage_utime_zero, tc) atf_tc_fail("zero user time from getrusage(2)"); } -#if defined(__NetBSD__) atf_tc_fail("anticipated error did not occur"); -#endif } ATF_TP_ADD_TCS(tp) From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 16:18:17 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 63BFC8CC; Fri, 24 Oct 2014 16:18:17 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4F7FAA55; Fri, 24 Oct 2014 16:18:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OGIHiZ004617; Fri, 24 Oct 2014 16:18:17 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OGIHAJ004616; Fri, 24 Oct 2014 16:18:17 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410241618.s9OGIHAJ004616@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Fri, 24 Oct 2014 16:18:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273592 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 16:18:17 -0000 Author: ngie Date: Fri Oct 24 16:18:16 2014 New Revision: 273592 URL: https://svnweb.freebsd.org/changeset/base/273592 Log: - Add sys/types.h for the APIs in sys/sysctl.h - Poke at VM_MIN_ADDRESS in machine/vmparam.h because FreeBSD doesn't have a vm.minaddress sysctl analog - Expect ENOMEM instead of EAGAIN in mlock_limits - Provide mlock an mmap'ed page twice to simulate MAP_WIRED on NetBSD In collaboration with: pho Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_mlock.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_mlock.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_mlock.c Fri Oct 24 16:07:31 2014 (r273591) +++ head/contrib/netbsd-tests/lib/libc/sys/t_mlock.c Fri Oct 24 16:18:16 2014 (r273592) @@ -31,6 +31,9 @@ #include __RCSID("$NetBSD: t_mlock.c,v 1.5 2014/02/26 20:49:26 martin Exp $"); +#ifdef __FreeBSD__ +#include +#endif #include #include #include @@ -43,6 +46,11 @@ __RCSID("$NetBSD: t_mlock.c,v 1.5 2014/0 #include #include +#ifdef __FreeBSD__ +#define _KMEMUSER +#include +#endif + static long page = 0; ATF_TC(mlock_clip); @@ -79,16 +87,25 @@ ATF_TC_HEAD(mlock_err, tc) ATF_TC_BODY(mlock_err, tc) { +#ifdef __NetBSD__ unsigned long vmin = 0; size_t len = sizeof(vmin); +#endif void *invalid_ptr; int null_errno = ENOMEM; /* error expected for NULL */ +#ifdef __FreeBSD__ +#ifdef VM_MIN_ADDRESS + if ((uintptr_t)VM_MIN_ADDRESS > 0) + null_errno = EINVAL; /* NULL is not inside user VM */ +#endif +#else if (sysctlbyname("vm.minaddress", &vmin, &len, NULL, 0) != 0) atf_tc_fail("failed to read vm.minaddress"); if (vmin > 0) null_errno = EINVAL; /* NULL is not inside user VM */ +#endif errno = 0; ATF_REQUIRE_ERRNO(null_errno, mlock(NULL, page) == -1); @@ -156,7 +173,17 @@ ATF_TC_BODY(mlock_limits, tc) errno = 0; +#ifdef __FreeBSD__ + /* + * NetBSD doesn't conform to POSIX with ENOMEM requirement; + * FreeBSD does. + * + * See: NetBSD PR # kern/48962 for more details. + */ + if (mlock(buf, i) != -1 || errno != ENOMEM) { +#else if (mlock(buf, i) != -1 || errno != EAGAIN) { +#endif (void)munlock(buf, i); _exit(EXIT_FAILURE); } @@ -181,7 +208,11 @@ ATF_TC_HEAD(mlock_mmap, tc) ATF_TC_BODY(mlock_mmap, tc) { +#ifdef __NetBSD__ static const int flags = MAP_ANON | MAP_PRIVATE | MAP_WIRED; +#else + static const int flags = MAP_ANON | MAP_PRIVATE; +#endif void *buf; /* @@ -191,6 +222,13 @@ ATF_TC_BODY(mlock_mmap, tc) buf = mmap(NULL, page, PROT_READ | PROT_WRITE, flags, -1, 0); ATF_REQUIRE(buf != MAP_FAILED); +#ifdef __FreeBSD__ + /* + * The duplicate mlock call is added to ensure that the call works + * as described above without MAP_WIRED support. + */ + ATF_REQUIRE(mlock(buf, page) == 0); +#endif ATF_REQUIRE(mlock(buf, page) == 0); ATF_REQUIRE(munlock(buf, page) == 0); ATF_REQUIRE(munmap(buf, page) == 0); @@ -202,7 +240,11 @@ ATF_TC_BODY(mlock_mmap, tc) buf = mmap(NULL, page, PROT_NONE, flags, -1, 0); ATF_REQUIRE(buf != MAP_FAILED); +#ifdef __FreeBSD__ + ATF_REQUIRE_ERRNO(ENOMEM, mlock(buf, page) != 0); +#else ATF_REQUIRE(mlock(buf, page) != 0); +#endif ATF_REQUIRE(munmap(buf, page) == 0); } From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 16:39:02 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CE71C31A; Fri, 24 Oct 2014 16:39:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A0B24CA9; Fri, 24 Oct 2014 16:39:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OGd21v016325; Fri, 24 Oct 2014 16:39:02 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OGd2xC016324; Fri, 24 Oct 2014 16:39:02 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201410241639.s9OGd2xC016324@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 24 Oct 2014 16:39:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273593 - head/sys/ofed/drivers/net/mlx4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 16:39:02 -0000 Author: hselasky Date: Fri Oct 24 16:39:01 2014 New Revision: 273593 URL: https://svnweb.freebsd.org/changeset/base/273593 Log: Update the network interface baudrate integer according to the actual line rate. Submitted by: jhb @ MFC after: 1 week Modified: head/sys/ofed/drivers/net/mlx4/en_netdev.c Modified: head/sys/ofed/drivers/net/mlx4/en_netdev.c ============================================================================== --- head/sys/ofed/drivers/net/mlx4/en_netdev.c Fri Oct 24 16:18:16 2014 (r273592) +++ head/sys/ofed/drivers/net/mlx4/en_netdev.c Fri Oct 24 16:39:01 2014 (r273593) @@ -970,6 +970,9 @@ static void mlx4_en_do_set_rx_mode(struc /* Important note: the following call for if_link_state_change * is needed for interface up scenario (start port, link state * change) */ + /* update netif baudrate */ + priv->dev->if_baudrate = + IF_Mbps(priv->port_state.link_speed); if_link_state_change(priv->dev, LINK_STATE_UP); en_dbg(HW, priv, "Link Up\n"); } @@ -1186,6 +1189,9 @@ static void mlx4_en_linkstate(struct wor if (linkstate == MLX4_DEV_EVENT_PORT_DOWN) { en_info(priv, "Link Down\n"); if_link_state_change(priv->dev, LINK_STATE_DOWN); + /* update netif baudrate */ + priv->dev->if_baudrate = 0; + /* make sure the port is up before notifying the OS. * This is tricky since we get here on INIT_PORT and * in such case we can't tell the OS the port is up. @@ -1193,6 +1199,10 @@ static void mlx4_en_linkstate(struct wor * in set_rx_mode. * */ } else if (priv->port_up && (linkstate == MLX4_DEV_EVENT_PORT_UP)){ + if (mlx4_en_QUERY_PORT(priv->mdev, priv->port)) + en_info(priv, "Query port failed\n"); + priv->dev->if_baudrate = + IF_Mbps(priv->port_state.link_speed); en_info(priv, "Link Up\n"); if_link_state_change(priv->dev, LINK_STATE_UP); } @@ -1978,7 +1988,6 @@ int mlx4_en_init_netdev(struct mlx4_en_d dev->if_softc = priv; if_initname(dev, "mlxen", atomic_fetchadd_int(&mlx4_en_unit, 1)); dev->if_mtu = ETHERMTU; - dev->if_baudrate = 1000000000; dev->if_init = mlx4_en_open; dev->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; dev->if_ioctl = mlx4_en_ioctl; From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 17:06:57 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 183C3F6B; Fri, 24 Oct 2014 17:06:57 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0458CF8E; Fri, 24 Oct 2014 17:06:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OH6uUH033900; Fri, 24 Oct 2014 17:06:56 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OH6uOd033898; Fri, 24 Oct 2014 17:06:56 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201410241706.s9OH6uOd033898@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Fri, 24 Oct 2014 17:06:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273594 - head/sbin/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 17:06:57 -0000 Author: melifaro Date: Fri Oct 24 17:06:56 2014 New Revision: 273594 URL: https://svnweb.freebsd.org/changeset/base/273594 Log: Fix documentation issue. PR: 194581 Submitted by: madpilot Modified: head/sbin/ipfw/ipfw.8 Modified: head/sbin/ipfw/ipfw.8 ============================================================================== --- head/sbin/ipfw/ipfw.8 Fri Oct 24 16:39:01 2014 (r273593) +++ head/sbin/ipfw/ipfw.8 Fri Oct 24 17:06:56 2014 (r273594) @@ -2014,7 +2014,7 @@ Shows generic table information and algo The following lookup algorithms are supported: .Bl -tag -width indent .It Ar algo-desc : algo-name | "algo-name algo-data" -.It Ar algo-name: Ar addr:radix | addr:hash | iface:arrray | number:array | flow:hash +.It Ar algo-name: Ar addr:radix | addr:hash | iface:array | number:array | flow:hash .It Cm addr:radix Separate Radix trees for IPv4 and IPv6, the same way as the routing table (see .Xr route 4 ) . @@ -2030,7 +2030,7 @@ Assume /32 and /128 masks by default. Search removes host bits (according to mask) from supplied address and checks resulting key in appropriate hash. Mostly optimized for /64 and byte-ranged IPv6 masks. -.It Cm iface:arrray +.It Cm iface:array Array storing sorted indexes for entries which are presented in the system. Optimized for very fast lookup. .It Cm number:array From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 17:24:30 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2320258A; Fri, 24 Oct 2014 17:24:30 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E86941EB; Fri, 24 Oct 2014 17:24:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OHOTr0043188; Fri, 24 Oct 2014 17:24:29 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OHOTOq043186; Fri, 24 Oct 2014 17:24:29 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201410241724.s9OHOTOq043186@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 24 Oct 2014 17:24:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273595 - stable/10/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 17:24:30 -0000 Author: markj Date: Fri Oct 24 17:24:29 2014 New Revision: 273595 URL: https://svnweb.freebsd.org/changeset/base/273595 Log: MFC r258902: The uaddr, ufunc, umod and usym functions all seem to work as expected on FreeBSD, so stop hiding them behind a "#if defined(sun)". Modified: stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Fri Oct 24 17:06:56 2014 (r273594) +++ stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Fri Oct 24 17:24:29 2014 (r273595) @@ -501,22 +501,16 @@ static const dt_ident_t _dtrace_globals[ DT_VERS_1_0, &dt_idops_func, "void(...)" }, { "typeref", DT_IDENT_FUNC, 0, DIF_SUBR_TYPEREF, DT_ATTR_STABCMN, DT_VERS_1_1, &dt_idops_func, "uintptr_t *(void *, size_t, string, size_t)" }, -#if defined(sun) { "uaddr", DT_IDENT_ACTFUNC, 0, DT_ACT_UADDR, DT_ATTR_STABCMN, DT_VERS_1_2, &dt_idops_func, "_usymaddr(uintptr_t)" }, -#endif { "ucaller", DT_IDENT_SCALAR, 0, DIF_VAR_UCALLER, DT_ATTR_STABCMN, DT_VERS_1_2, &dt_idops_type, "uint64_t" }, -#if defined(sun) { "ufunc", DT_IDENT_ACTFUNC, 0, DT_ACT_USYM, DT_ATTR_STABCMN, DT_VERS_1_2, &dt_idops_func, "_usymaddr(uintptr_t)" }, -#endif { "uid", DT_IDENT_SCALAR, 0, DIF_VAR_UID, DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_type, "uid_t" }, -#if defined(sun) { "umod", DT_IDENT_ACTFUNC, 0, DT_ACT_UMOD, DT_ATTR_STABCMN, DT_VERS_1_2, &dt_idops_func, "_usymaddr(uintptr_t)" }, -#endif { "uregs", DT_IDENT_ARRAY, 0, DIF_VAR_UREGS, DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_regs, NULL }, { "ustack", DT_IDENT_ACTFUNC, 0, DT_ACT_USTACK, DT_ATTR_STABCMN, DT_VERS_1_0, @@ -524,10 +518,8 @@ static const dt_ident_t _dtrace_globals[ { "ustackdepth", DT_IDENT_SCALAR, 0, DIF_VAR_USTACKDEPTH, DT_ATTR_STABCMN, DT_VERS_1_2, &dt_idops_type, "uint32_t" }, -#if defined(sun) { "usym", DT_IDENT_ACTFUNC, 0, DT_ACT_USYM, DT_ATTR_STABCMN, DT_VERS_1_2, &dt_idops_func, "_usymaddr(uintptr_t)" }, -#endif { "vtimestamp", DT_IDENT_SCALAR, 0, DIF_VAR_VTIMESTAMP, DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_type, "uint64_t" }, From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 17:24:30 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E653658B; Fri, 24 Oct 2014 17:24:30 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B7B0B1EC; Fri, 24 Oct 2014 17:24:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OHOUUn043211; Fri, 24 Oct 2014 17:24:30 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OHOU4l043210; Fri, 24 Oct 2014 17:24:30 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201410241724.s9OHOU4l043210@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 24 Oct 2014 17:24:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r273596 - stable/9/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 17:24:31 -0000 Author: markj Date: Fri Oct 24 17:24:29 2014 New Revision: 273596 URL: https://svnweb.freebsd.org/changeset/base/273596 Log: MFC r258902: The uaddr, ufunc, umod and usym functions all seem to work as expected on FreeBSD, so stop hiding them behind a "#if defined(sun)". Modified: stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Directory Properties: stable/9/cddl/contrib/opensolaris/ (props changed) stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/ (props changed) Modified: stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c ============================================================================== --- stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Fri Oct 24 17:24:29 2014 (r273595) +++ stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Fri Oct 24 17:24:29 2014 (r273596) @@ -487,22 +487,16 @@ static const dt_ident_t _dtrace_globals[ DT_VERS_1_0, &dt_idops_func, "void(...)" }, { "typeref", DT_IDENT_FUNC, 0, DIF_SUBR_TYPEREF, DT_ATTR_STABCMN, DT_VERS_1_1, &dt_idops_func, "uintptr_t *(void *, size_t, string, size_t)" }, -#if defined(sun) { "uaddr", DT_IDENT_ACTFUNC, 0, DT_ACT_UADDR, DT_ATTR_STABCMN, DT_VERS_1_2, &dt_idops_func, "_usymaddr(uintptr_t)" }, -#endif { "ucaller", DT_IDENT_SCALAR, 0, DIF_VAR_UCALLER, DT_ATTR_STABCMN, DT_VERS_1_2, &dt_idops_type, "uint64_t" }, -#if defined(sun) { "ufunc", DT_IDENT_ACTFUNC, 0, DT_ACT_USYM, DT_ATTR_STABCMN, DT_VERS_1_2, &dt_idops_func, "_usymaddr(uintptr_t)" }, -#endif { "uid", DT_IDENT_SCALAR, 0, DIF_VAR_UID, DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_type, "uid_t" }, -#if defined(sun) { "umod", DT_IDENT_ACTFUNC, 0, DT_ACT_UMOD, DT_ATTR_STABCMN, DT_VERS_1_2, &dt_idops_func, "_usymaddr(uintptr_t)" }, -#endif { "uregs", DT_IDENT_ARRAY, 0, DIF_VAR_UREGS, DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_regs, NULL }, { "ustack", DT_IDENT_ACTFUNC, 0, DT_ACT_USTACK, DT_ATTR_STABCMN, DT_VERS_1_0, @@ -510,10 +504,8 @@ static const dt_ident_t _dtrace_globals[ { "ustackdepth", DT_IDENT_SCALAR, 0, DIF_VAR_USTACKDEPTH, DT_ATTR_STABCMN, DT_VERS_1_2, &dt_idops_type, "uint32_t" }, -#if defined(sun) { "usym", DT_IDENT_ACTFUNC, 0, DT_ACT_USYM, DT_ATTR_STABCMN, DT_VERS_1_2, &dt_idops_func, "_usymaddr(uintptr_t)" }, -#endif { "vtimestamp", DT_IDENT_SCALAR, 0, DIF_VAR_VTIMESTAMP, DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_type, "uint64_t" }, From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 18:39:16 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9B29891B; Fri, 24 Oct 2014 18:39:16 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7C884BB7; Fri, 24 Oct 2014 18:39:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OIdG65077142; Fri, 24 Oct 2014 18:39:16 GMT (envelope-from rpaulo@FreeBSD.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OIdG0E077139; Fri, 24 Oct 2014 18:39:16 GMT (envelope-from rpaulo@FreeBSD.org) Message-Id: <201410241839.s9OIdG0E077139@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rpaulo set sender to rpaulo@FreeBSD.org using -f From: Rui Paulo Date: Fri, 24 Oct 2014 18:39:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273598 - in head: include sys/dev/acpica X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 18:39:16 -0000 Author: rpaulo Date: Fri Oct 24 18:39:15 2014 New Revision: 273598 URL: https://svnweb.freebsd.org/changeset/base/273598 Log: HPET: create /dev/hpetN as a way to access HPET from userland. In some cases, TSC is broken and special applications might benefit from memory mapping HPET and reading the registers to count time. Most often the main HPET counter is 32-bit only[1], so this only gives the application a 300 second window based on the default HPET interval. Other applications, such as Intel's DPDK, expect /dev/hpet to be present and use it to count time as well. Although we have an almost userland version of gettimeofday() which uses rdtsc in userland, it's not always possible to use it, depending on how broken the multi-socket hardware is. Install the acpi_hpet.h so that applications can use the HPET register definitions. [1] I haven't found a system where HPET's main counter uses more than 32 bit. There seems to be a discrepancy in the Intel documentation (claiming it's a 64-bit counter) and the actual implementation (a 32-bit counter in a 64-bit memory area). MFC after: 1 week Relnotes: yes Modified: head/include/Makefile head/sys/dev/acpica/acpi_hpet.c Modified: head/include/Makefile ============================================================================== --- head/include/Makefile Fri Oct 24 17:40:32 2014 (r273597) +++ head/include/Makefile Fri Oct 24 18:39:15 2014 (r273598) @@ -159,6 +159,8 @@ copies: cd ${.CURDIR}/../sys/dev/acpica; \ ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \ ${DESTDIR}${INCLUDEDIR}/dev/acpica + ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpi_hpet.h \ + ${DESTDIR}${INCLUDEDIR}/dev/acpica cd ${.CURDIR}/../sys/dev/agp; \ ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 agpreg.h \ ${DESTDIR}${INCLUDEDIR}/dev/agp @@ -243,7 +245,7 @@ symlinks: done .endfor cd ${.CURDIR}/../sys/dev/acpica; \ - for h in acpiio.h; do \ + for h in acpiio.h acpi_hpet.h; do \ ln -fs ../../../../sys/dev/acpica/$$h \ ${DESTDIR}${INCLUDEDIR}/dev/acpica; \ done Modified: head/sys/dev/acpica/acpi_hpet.c ============================================================================== --- head/sys/dev/acpica/acpi_hpet.c Fri Oct 24 17:40:32 2014 (r273597) +++ head/sys/dev/acpica/acpi_hpet.c Fri Oct 24 18:39:15 2014 (r273598) @@ -35,11 +35,13 @@ __FBSDID("$FreeBSD$"); #include "opt_apic.h" #endif #include +#include #include #include #include #include #include +#include #include #include #include @@ -106,6 +108,23 @@ struct hpet_softc { char name[8]; } t[32]; int num_timers; + struct cdev *pdev; + int mmap_allow; + int mmap_allow_write; + int devinuse; +}; + +static d_open_t hpet_open; +static d_close_t hpet_close; +static d_mmap_t hpet_mmap; + +static struct cdevsw hpet_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_TRACKCLOSE, + .d_name = "hpet", + .d_open = hpet_open, + .d_close = hpet_close, + .d_mmap = hpet_mmap, }; static u_int hpet_get_timecount(struct timecounter *tc); @@ -317,6 +336,47 @@ hpet_find_irq_rid(device_t dev, u_long s } } +static int +hpet_open(struct cdev *cdev, int oflags, int devtype, struct thread *td) +{ + struct hpet_softc *sc; + + sc = cdev->si_drv1; + if (!sc->mmap_allow) + return (EPERM); + if (atomic_cmpset_32(&sc->devinuse, 0, 1) == 0) + return (EBUSY); + else + return (0); +} + +static int +hpet_close(struct cdev *cdev, int fflag, int devtype, struct thread *td) +{ + struct hpet_softc *sc; + + sc = cdev->si_drv1; + sc->devinuse = 0; + + return (0); +} + +static int +hpet_mmap(struct cdev *cdev, vm_ooffset_t offset, vm_paddr_t *paddr, + int nprot, vm_memattr_t *memattr) +{ + struct hpet_softc *sc; + + sc = cdev->si_drv1; + if (offset > rman_get_size(sc->mem_res)) + return (EINVAL); + if (!sc->mmap_allow_write && (nprot & PROT_WRITE)) + return (EPERM); + *paddr = rman_get_start(sc->mem_res) + offset; + + return (0); +} + /* Discover the HPET via the ACPI table of the same name. */ static void hpet_identify(driver_t *driver, device_t parent) @@ -701,6 +761,26 @@ hpet_attach(device_t dev) maxhpetet++; } } + + sc->pdev = make_dev(&hpet_cdevsw, 0, UID_ROOT, GID_WHEEL, + 0600, "hpet%d", device_get_unit(dev)); + if (sc->pdev) { + sc->pdev->si_drv1 = sc; + sc->mmap_allow = 1; + TUNABLE_INT_FETCH("hw.acpi.hpet.mmap_allow", + &sc->mmap_allow); + sc->mmap_allow_write = 1; + TUNABLE_INT_FETCH("hw.acpi.hpet.mmap_allow_write", + &sc->mmap_allow_write); + SYSCTL_ADD_INT(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "mmap_allow", + CTLFLAG_RW, &sc->mmap_allow, 0, + "Allow userland to memory map HPET"); + } else + device_printf(dev, "could not create /dev/hpet%d\n", + device_get_unit(dev)); + return (0); } From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 18:47:02 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 733DAC45; Fri, 24 Oct 2014 18:47:02 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1DF05C9A; Fri, 24 Oct 2014 18:47:02 +0000 (UTC) Received: from ralph.baldwin.cx (pool-173-70-85-31.nwrknj.fios.verizon.net [173.70.85.31]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 3959CB968; Fri, 24 Oct 2014 14:47:00 -0400 (EDT) From: John Baldwin To: Marcelo Araujo Subject: Re: svn commit: r273576 - head/sys/dev/uart Date: Fri, 24 Oct 2014 12:14:48 -0400 Message-ID: <235737869.CpTJALnJpW@ralph.baldwin.cx> User-Agent: KMail/4.12.5 (FreeBSD/10.1-BETA2; KDE/4.12.5; amd64; ; ) In-Reply-To: <201410240539.s9O5dWWK002150@svn.freebsd.org> References: <201410240539.s9O5dWWK002150@svn.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 24 Oct 2014 14:47:00 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 18:47:02 -0000 On Friday, October 24, 2014 05:39:32 AM Marcelo Araujo wrote: > Author: araujo (ports committer) > Date: Fri Oct 24 05:39:32 2014 > New Revision: 273576 > URL: https://svnweb.freebsd.org/changeset/base/273576 > > Log: > Fix a leaked Storage Variable. > > Phabric: D981 > Submitted by: myself > Reported by: Coverity > CID: 1248848 > Reworked by: kevlo > Reviewed by: marcel, davide, ray, kevlo > Approved by: marcel, kevlo > > Modified: > head/sys/dev/uart/uart_subr.c > > Modified: head/sys/dev/uart/uart_subr.c > ============================================================================== > --- head/sys/dev/uart/uart_subr.c Fri Oct 24 04:01:14 2014 (r273575) > +++ head/sys/dev/uart/uart_subr.c Fri Oct 24 05:39:32 2014 (r273576) > @@ -196,7 +196,7 @@ out: > int > uart_getenv(int devtype, struct uart_devinfo *di, struct uart_class *class) > { > - const char *spec; > + const char *cp, *spec; Dropping const here is preferable to using __DECONST() for the freeenv() calls. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 19:04:09 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 702931A5; Fri, 24 Oct 2014 19:04:09 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4763EE5C; Fri, 24 Oct 2014 19:04:09 +0000 (UTC) Received: from ralph.baldwin.cx (pool-173-70-85-31.nwrknj.fios.verizon.net [173.70.85.31]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 56A94B945; Fri, 24 Oct 2014 15:04:08 -0400 (EDT) From: John Baldwin To: Rui Paulo Subject: Re: svn commit: r273598 - in head: include sys/dev/acpica Date: Fri, 24 Oct 2014 15:03:52 -0400 Message-ID: <21470251.4Nq3ilUAWE@ralph.baldwin.cx> User-Agent: KMail/4.12.5 (FreeBSD/10.1-BETA2; KDE/4.12.5; amd64; ; ) In-Reply-To: <201410241839.s9OIdG0E077139@svn.freebsd.org> References: <201410241839.s9OIdG0E077139@svn.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 24 Oct 2014 15:04:08 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 19:04:09 -0000 On Friday, October 24, 2014 06:39:16 PM Rui Paulo wrote: > Author: rpaulo > Date: Fri Oct 24 18:39:15 2014 > New Revision: 273598 > URL: https://svnweb.freebsd.org/changeset/base/273598 > > Log: > HPET: create /dev/hpetN as a way to access HPET from userland. > > In some cases, TSC is broken and special applications might benefit > from memory mapping HPET and reading the registers to count time. > Most often the main HPET counter is 32-bit only[1], so this only gives > the application a 300 second window based on the default HPET > interval. > Other applications, such as Intel's DPDK, expect /dev/hpet to be > present and use it to count time as well. > > Although we have an almost userland version of gettimeofday() which > uses rdtsc in userland, it's not always possible to use it, depending > on how broken the multi-socket hardware is. > > Install the acpi_hpet.h so that applications can use the HPET register > definitions. > > [1] I haven't found a system where HPET's main counter uses more than > 32 bit. There seems to be a discrepancy in the Intel documentation > (claiming it's a 64-bit counter) and the actual implementation (a > 32-bit counter in a 64-bit memory area). > > MFC after: 1 week > Relnotes: yes > > Modified: > head/include/Makefile > head/sys/dev/acpica/acpi_hpet.c > > Modified: head/sys/dev/acpica/acpi_hpet.c > ============================================================================== > --- head/sys/dev/acpica/acpi_hpet.c Fri Oct 24 17:40:32 2014 (r273597) > +++ head/sys/dev/acpica/acpi_hpet.c Fri Oct 24 18:39:15 2014 (r273598) > +static struct cdevsw hpet_cdevsw = { > + .d_version = D_VERSION, > + .d_flags = D_TRACKCLOSE, > + .d_name = "hpet", > + .d_open = hpet_open, > + .d_close = hpet_close, D_TRACKCLOSE isn't really reliable, and in this case it probably isn't what you want anyway (you want last close I think). If a process opens /dev/hpetN and then forks a child that calls closefrom() and then exec, close() from Closefrom() will invoke hpet_close() and clear devinuse even though the parent is still using it. Removing D_TRACKCLOSE would defer hpet_close() until all references to the fd were dropped. Alternatively, you might consider dropping the devinuse stuff entirely if you don't need it. It doesn't prevent the fd from being shared with child processes across fork(). -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 19:06:05 2014 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D71D3349; Fri, 24 Oct 2014 19:06:05 +0000 (UTC) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 8A35DE78; Fri, 24 Oct 2014 19:06:03 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id WAA12100; Fri, 24 Oct 2014 22:06:01 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1XhkBU-0006Tv-UP; Fri, 24 Oct 2014 22:06:00 +0300 Message-ID: <544AA2E1.7000508@FreeBSD.org> Date: Fri, 24 Oct 2014 22:05:05 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.1.2 MIME-Version: 1.0 To: Rui Paulo , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r273598 - in head: include sys/dev/acpica References: <201410241839.s9OIdG0E077139@svn.freebsd.org> In-Reply-To: <201410241839.s9OIdG0E077139@svn.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 19:06:06 -0000 On 24/10/2014 21:39, Rui Paulo wrote: > Author: rpaulo > Date: Fri Oct 24 18:39:15 2014 > New Revision: 273598 > URL: https://svnweb.freebsd.org/changeset/base/273598 > > Log: > HPET: create /dev/hpetN as a way to access HPET from userland. > > In some cases, TSC is broken and special applications might benefit > from memory mapping HPET and reading the registers to count time. > Most often the main HPET counter is 32-bit only[1], so this only gives > the application a 300 second window based on the default HPET > interval. > Other applications, such as Intel's DPDK, expect /dev/hpet to be > present and use it to count time as well. Does this device attempt to play nice with eventtimer infrastructure that may use the same timer? > Although we have an almost userland version of gettimeofday() which > uses rdtsc in userland, it's not always possible to use it, depending > on how broken the multi-socket hardware is. > > Install the acpi_hpet.h so that applications can use the HPET register > definitions. > > [1] I haven't found a system where HPET's main counter uses more than > 32 bit. There seems to be a discrepancy in the Intel documentation > (claiming it's a 64-bit counter) and the actual implementation (a > 32-bit counter in a 64-bit memory area). > > MFC after: 1 week > Relnotes: yes > > Modified: > head/include/Makefile > head/sys/dev/acpica/acpi_hpet.c > > Modified: head/include/Makefile > ============================================================================== > --- head/include/Makefile Fri Oct 24 17:40:32 2014 (r273597) > +++ head/include/Makefile Fri Oct 24 18:39:15 2014 (r273598) > @@ -159,6 +159,8 @@ copies: > cd ${.CURDIR}/../sys/dev/acpica; \ > ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \ > ${DESTDIR}${INCLUDEDIR}/dev/acpica > + ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpi_hpet.h \ > + ${DESTDIR}${INCLUDEDIR}/dev/acpica > cd ${.CURDIR}/../sys/dev/agp; \ > ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 agpreg.h \ > ${DESTDIR}${INCLUDEDIR}/dev/agp > @@ -243,7 +245,7 @@ symlinks: > done > .endfor > cd ${.CURDIR}/../sys/dev/acpica; \ > - for h in acpiio.h; do \ > + for h in acpiio.h acpi_hpet.h; do \ > ln -fs ../../../../sys/dev/acpica/$$h \ > ${DESTDIR}${INCLUDEDIR}/dev/acpica; \ > done > > Modified: head/sys/dev/acpica/acpi_hpet.c > ============================================================================== > --- head/sys/dev/acpica/acpi_hpet.c Fri Oct 24 17:40:32 2014 (r273597) > +++ head/sys/dev/acpica/acpi_hpet.c Fri Oct 24 18:39:15 2014 (r273598) > @@ -35,11 +35,13 @@ __FBSDID("$FreeBSD$"); > #include "opt_apic.h" > #endif > #include > +#include > #include > #include > #include > #include > #include > +#include > #include > #include > #include > @@ -106,6 +108,23 @@ struct hpet_softc { > char name[8]; > } t[32]; > int num_timers; > + struct cdev *pdev; > + int mmap_allow; > + int mmap_allow_write; > + int devinuse; > +}; > + > +static d_open_t hpet_open; > +static d_close_t hpet_close; > +static d_mmap_t hpet_mmap; > + > +static struct cdevsw hpet_cdevsw = { > + .d_version = D_VERSION, > + .d_flags = D_TRACKCLOSE, > + .d_name = "hpet", > + .d_open = hpet_open, > + .d_close = hpet_close, > + .d_mmap = hpet_mmap, > }; > > static u_int hpet_get_timecount(struct timecounter *tc); > @@ -317,6 +336,47 @@ hpet_find_irq_rid(device_t dev, u_long s > } > } > > +static int > +hpet_open(struct cdev *cdev, int oflags, int devtype, struct thread *td) > +{ > + struct hpet_softc *sc; > + > + sc = cdev->si_drv1; > + if (!sc->mmap_allow) > + return (EPERM); > + if (atomic_cmpset_32(&sc->devinuse, 0, 1) == 0) > + return (EBUSY); > + else > + return (0); > +} > + > +static int > +hpet_close(struct cdev *cdev, int fflag, int devtype, struct thread *td) > +{ > + struct hpet_softc *sc; > + > + sc = cdev->si_drv1; > + sc->devinuse = 0; > + > + return (0); > +} > + > +static int > +hpet_mmap(struct cdev *cdev, vm_ooffset_t offset, vm_paddr_t *paddr, > + int nprot, vm_memattr_t *memattr) > +{ > + struct hpet_softc *sc; > + > + sc = cdev->si_drv1; > + if (offset > rman_get_size(sc->mem_res)) > + return (EINVAL); > + if (!sc->mmap_allow_write && (nprot & PROT_WRITE)) > + return (EPERM); > + *paddr = rman_get_start(sc->mem_res) + offset; > + > + return (0); > +} > + > /* Discover the HPET via the ACPI table of the same name. */ > static void > hpet_identify(driver_t *driver, device_t parent) > @@ -701,6 +761,26 @@ hpet_attach(device_t dev) > maxhpetet++; > } > } > + > + sc->pdev = make_dev(&hpet_cdevsw, 0, UID_ROOT, GID_WHEEL, > + 0600, "hpet%d", device_get_unit(dev)); > + if (sc->pdev) { > + sc->pdev->si_drv1 = sc; > + sc->mmap_allow = 1; > + TUNABLE_INT_FETCH("hw.acpi.hpet.mmap_allow", > + &sc->mmap_allow); > + sc->mmap_allow_write = 1; > + TUNABLE_INT_FETCH("hw.acpi.hpet.mmap_allow_write", > + &sc->mmap_allow_write); > + SYSCTL_ADD_INT(device_get_sysctl_ctx(dev), > + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), > + OID_AUTO, "mmap_allow", > + CTLFLAG_RW, &sc->mmap_allow, 0, > + "Allow userland to memory map HPET"); > + } else > + device_printf(dev, "could not create /dev/hpet%d\n", > + device_get_unit(dev)); > + > return (0); > } > > -- Andriy Gapon From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 19:18:40 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D0108666; Fri, 24 Oct 2014 19:18:40 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BC88DFA8; Fri, 24 Oct 2014 19:18:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OJIeij095755; Fri, 24 Oct 2014 19:18:40 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OJIev4095754; Fri, 24 Oct 2014 19:18:40 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201410241918.s9OJIev4095754@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Fri, 24 Oct 2014 19:18:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273599 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 19:18:40 -0000 Author: loos Date: Fri Oct 24 19:18:39 2014 New Revision: 273599 URL: https://svnweb.freebsd.org/changeset/base/273599 Log: Fix a bug where DMA maps created with bus_dmamap_create() won't increment the map count and without being able to keep track of the current map allocation, bus_dma_tag_destroy() will fail to proceed and will return EBUSY even after all the maps have been correctly destroyed with bus_dmamap_destroy(). Found while testing the detach method of a NIC. Tested on: BBB (am335x) Reviewed by: cognet, ian MFC after: 1 week Modified: head/sys/arm/arm/busdma_machdep-v6.c Modified: head/sys/arm/arm/busdma_machdep-v6.c ============================================================================== --- head/sys/arm/arm/busdma_machdep-v6.c Fri Oct 24 18:39:15 2014 (r273598) +++ head/sys/arm/arm/busdma_machdep-v6.c Fri Oct 24 19:18:39 2014 (r273599) @@ -719,6 +719,8 @@ bus_dmamap_create(bus_dma_tag_t dmat, in if (map->flags & DMAMAP_COHERENT) atomic_add_32(&maps_coherent, 1); atomic_add_32(&maps_total, 1); + dmat->map_count++; + return (0); } From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 19:20:23 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8C5E77C3; Fri, 24 Oct 2014 19:20:23 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 146DDFB6; Fri, 24 Oct 2014 19:20:22 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id s9OJKGKn043108 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 24 Oct 2014 22:20:16 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua s9OJKGKn043108 Received: (from kostik@localhost) by tom.home (8.14.9/8.14.9/Submit) id s9OJKGmq043107; Fri, 24 Oct 2014 22:20:16 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 24 Oct 2014 22:20:16 +0300 From: Konstantin Belousov To: Rui Paulo Subject: Re: svn commit: r273598 - in head: include sys/dev/acpica Message-ID: <20141024192016.GD1877@kib.kiev.ua> References: <201410241839.s9OIdG0E077139@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201410241839.s9OIdG0E077139@svn.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 19:20:23 -0000 On Fri, Oct 24, 2014 at 06:39:16PM +0000, Rui Paulo wrote: > Author: rpaulo > Date: Fri Oct 24 18:39:15 2014 > New Revision: 273598 > URL: https://svnweb.freebsd.org/changeset/base/273598 > > Log: > HPET: create /dev/hpetN as a way to access HPET from userland. > > In some cases, TSC is broken and special applications might benefit > from memory mapping HPET and reading the registers to count time. > Most often the main HPET counter is 32-bit only[1], so this only gives > the application a 300 second window based on the default HPET > interval. > Other applications, such as Intel's DPDK, expect /dev/hpet to be > present and use it to count time as well. > > Although we have an almost userland version of gettimeofday() which > uses rdtsc in userland, it's not always possible to use it, depending > on how broken the multi-socket hardware is. Yes, and hpet userland mapping would be better handled through the same fake-vdso framework. As designed, it has discriminator to inform userspace about algorithm, and can happilly utilize HPET timecounter automatically mapped by kernel into the process address space. > > Install the acpi_hpet.h so that applications can use the HPET register > definitions. > > [1] I haven't found a system where HPET's main counter uses more than > 32 bit. There seems to be a discrepancy in the Intel documentation > (claiming it's a 64-bit counter) and the actual implementation (a > 32-bit counter in a 64-bit memory area). > > MFC after: 1 week > Relnotes: yes > > Modified: > head/include/Makefile > head/sys/dev/acpica/acpi_hpet.c > > Modified: head/include/Makefile > ============================================================================== > --- head/include/Makefile Fri Oct 24 17:40:32 2014 (r273597) > +++ head/include/Makefile Fri Oct 24 18:39:15 2014 (r273598) > @@ -159,6 +159,8 @@ copies: > cd ${.CURDIR}/../sys/dev/acpica; \ > ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \ > ${DESTDIR}${INCLUDEDIR}/dev/acpica > + ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpi_hpet.h \ > + ${DESTDIR}${INCLUDEDIR}/dev/acpica > cd ${.CURDIR}/../sys/dev/agp; \ > ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 agpreg.h \ > ${DESTDIR}${INCLUDEDIR}/dev/agp > @@ -243,7 +245,7 @@ symlinks: > done > .endfor > cd ${.CURDIR}/../sys/dev/acpica; \ > - for h in acpiio.h; do \ > + for h in acpiio.h acpi_hpet.h; do \ > ln -fs ../../../../sys/dev/acpica/$$h \ > ${DESTDIR}${INCLUDEDIR}/dev/acpica; \ > done > > Modified: head/sys/dev/acpica/acpi_hpet.c > ============================================================================== > --- head/sys/dev/acpica/acpi_hpet.c Fri Oct 24 17:40:32 2014 (r273597) > +++ head/sys/dev/acpica/acpi_hpet.c Fri Oct 24 18:39:15 2014 (r273598) > @@ -35,11 +35,13 @@ __FBSDID("$FreeBSD$"); > #include "opt_apic.h" > #endif > #include > +#include > #include > #include > #include > #include > #include > +#include > #include > #include > #include > @@ -106,6 +108,23 @@ struct hpet_softc { > char name[8]; > } t[32]; > int num_timers; > + struct cdev *pdev; > + int mmap_allow; > + int mmap_allow_write; > + int devinuse; > +}; > + > +static d_open_t hpet_open; > +static d_close_t hpet_close; > +static d_mmap_t hpet_mmap; > + > +static struct cdevsw hpet_cdevsw = { > + .d_version = D_VERSION, > + .d_flags = D_TRACKCLOSE, > + .d_name = "hpet", > + .d_open = hpet_open, > + .d_close = hpet_close, > + .d_mmap = hpet_mmap, > }; > > static u_int hpet_get_timecount(struct timecounter *tc); > @@ -317,6 +336,47 @@ hpet_find_irq_rid(device_t dev, u_long s > } > } > > +static int > +hpet_open(struct cdev *cdev, int oflags, int devtype, struct thread *td) > +{ > + struct hpet_softc *sc; > + > + sc = cdev->si_drv1; > + if (!sc->mmap_allow) > + return (EPERM); > + if (atomic_cmpset_32(&sc->devinuse, 0, 1) == 0) > + return (EBUSY); This is extra-weird. The devinuse business disallows simultaneous opens, which prevents other process from opening and mapping. But if the original caller does mmap and close, second process now is allowed to open and mmap. That said, why do you need this devinuse at all ? > + else > + return (0); > +} > + > +static int > +hpet_close(struct cdev *cdev, int fflag, int devtype, struct thread *td) > +{ > + struct hpet_softc *sc; > + > + sc = cdev->si_drv1; > + sc->devinuse = 0; > + > + return (0); > +} > + > +static int > +hpet_mmap(struct cdev *cdev, vm_ooffset_t offset, vm_paddr_t *paddr, > + int nprot, vm_memattr_t *memattr) > +{ > + struct hpet_softc *sc; > + > + sc = cdev->si_drv1; > + if (offset > rman_get_size(sc->mem_res)) > + return (EINVAL); > + if (!sc->mmap_allow_write && (nprot & PROT_WRITE)) > + return (EPERM); > + *paddr = rman_get_start(sc->mem_res) + offset; What is the memattr for the backing page ? Is it set to non-cached mode somehow ? I was not able to find place where would this happen. > + > + return (0); > +} > + > /* Discover the HPET via the ACPI table of the same name. */ > static void > hpet_identify(driver_t *driver, device_t parent) > @@ -701,6 +761,26 @@ hpet_attach(device_t dev) > maxhpetet++; > } > } > + > + sc->pdev = make_dev(&hpet_cdevsw, 0, UID_ROOT, GID_WHEEL, > + 0600, "hpet%d", device_get_unit(dev)); > + if (sc->pdev) { > + sc->pdev->si_drv1 = sc; > + sc->mmap_allow = 1; > + TUNABLE_INT_FETCH("hw.acpi.hpet.mmap_allow", > + &sc->mmap_allow); > + sc->mmap_allow_write = 1; > + TUNABLE_INT_FETCH("hw.acpi.hpet.mmap_allow_write", > + &sc->mmap_allow_write); > + SYSCTL_ADD_INT(device_get_sysctl_ctx(dev), > + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), > + OID_AUTO, "mmap_allow", > + CTLFLAG_RW, &sc->mmap_allow, 0, > + "Allow userland to memory map HPET"); Why is mmap_allow is per-instance, while mmap_allow_write taken from the global tunable ? > + } else > + device_printf(dev, "could not create /dev/hpet%d\n", > + device_get_unit(dev)); > + > return (0); > } > From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 19:33:16 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B9741BDF; Fri, 24 Oct 2014 19:33:16 +0000 (UTC) Received: from st11p02mm-asmtp001.mac.com (st11p02mm-asmtp001.mac.com [17.172.220.236]) (using TLSv1 with cipher DES-CBC3-SHA (112/168 bits)) (Client CN "smtp.me.com", Issuer "VeriSign Class 3 Extended Validation SSL SGC CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 85A591FF; Fri, 24 Oct 2014 19:33:15 +0000 (UTC) Received: from st11p02mm-spool002.mac.com ([17.172.220.247]) by st11p02mm-asmtp001.mac.com (Oracle Communications Messaging Server 7u4-27.10(7.0.4.27.9) 64bit (built Jun 6 2014)) with ESMTP id <0NDY00JY0RN68T20@st11p02mm-asmtp001.mac.com>; Fri, 24 Oct 2014 19:33:08 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.12.52,1.0.28,0.0.0000 definitions=2014-10-24_06:2014-10-24,2014-10-24,1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1408290000 definitions=main-1410240163 MIME-version: 1.0 Received: from localhost ([17.172.220.161]) by st11p02mm-spool002.mac.com (Oracle Communications Messaging Server 7u4-27.08(7.0.4.27.7) 64bit (built Aug 22 2013)) with ESMTP id <0NDY00FD7RN7A660@st11p02mm-spool002.mac.com>; Fri, 24 Oct 2014 19:33:07 +0000 (GMT) To: Konstantin Belousov From: Rui Paulo Subject: Re: svn commit: r273598 - in head: include sys/dev/acpica Date: Fri, 24 Oct 2014 19:33:07 +0000 (GMT) X-Mailer: iCloud MailClient14G39 MailServer14G.17174 X-Originating-IP: [12.218.212.178] Message-id: <33decfcd-e77c-4e4c-8161-9f4a232213c6@me.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Rui Paulo X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 19:33:16 -0000 On Oct 24, 2014, at 12:20 PM, Konstantin Belousov wr= ote:=0A=0AOn Fri, Oct 24, 2014 at 06:39:16PM +0000, Rui Paulo wrote:=0A> A= uthor: rpaulo=0A> Date: Fri Oct 24 18:39:15 2014=0A> New Revision: 273598=0A= > URL: https://svnweb.freebsd.org/changeset/base/273598=0A> =0A> Log:=0A> = HPET: create /dev/hpetN as a way to access HPET from userland.=0A> =0A> In= some cases, TSC is broken and special applications might benefit=0A> from= memory mapping HPET and reading the registers to count time.=0A> Most oft= en the main HPET counter is 32-bit only[1], so this only gives=0A> the app= lication a 300 second window based on the default HPET=0A> interval.=0A> O= ther applications, such as Intel's DPDK, expect /dev/hpet to be=0A> presen= t and use it to count time as well.=0A> =0A> Although we have an almost us= erland version of gettimeofday() which=0A> uses rdtsc in userland, it's no= t always possible to use it, depending=0A> on how broken the multi-socket = hardware is.=0AYes, and hpet userland mapping would be better handled thro= ugh the same=0Afake-vdso framework. As designed, it has discriminator to i= nform=0Auserspace about algorithm, and can happilly utilize HPET timecount= er=0Aautomatically mapped by kernel into the process address space.=0A=C2=A0= =0AI'm aware of that, but I found the vdso a bit confusing and decided to = work on that later.=0A=0A> +static int=0A> +hpet_open(struct cdev *cdev, i= nt oflags, int devtype, struct thread *td)=0A> +{=0A> + =C2=A0 =C2=A0 =C2=A0= struct hpet_softc *sc;=0A> +=0A> + =C2=A0 =C2=A0 =C2=A0 =C2=A0sc =3D cdev-= >si_drv1;=0A> + =C2=A0 =C2=A0 =C2=A0 =C2=A0if (!sc->mmap_allow)=0A> + =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0return (EPERM);=0A> + =C2=A0 =C2=A0 =C2=A0if (= atomic_cmpset_32(&sc->devinuse, 0, 1) =3D=3D 0)=0A> + =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0return (EBUSY);=0AThis is extra-weird.=0AThe devinuse= business disallows simultaneous opens, which prevents=0Aother process fro= m opening and mapping. But if the original caller=0Adoes mmap and close, s= econd process now is allowed to open and mmap.=0A=0AThat said, why do you = need this devinuse at all ?=0A=C2=A0=0AHmm, I wanted to avoid multiple mma= p's, but that doesn't work like you said. =C2=A0I may just remove this res= triction.=C2=A0=0A=0A> +static int=0A> +hpet_mmap(struct cdev *cdev, vm_oo= ffset_t offset, vm_paddr_t *paddr,=0A> + int nprot, vm_memattr_t *memattr)= =0A> +{=0A> + =C2=A0 =C2=A0struct hpet_softc *sc;=0A> +=0A> + =C2=A0 =C2=A0= sc =3D cdev->si_drv1;=0A> + =C2=A0 =C2=A0 =C2=A0 =C2=A0if (offset > rman_g= et_size(sc->mem_res))=0A> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0return (EINVAL);=0A> + =C2=A0 =C2=A0if (!sc->mmap_allow_write && (n= prot & PROT_WRITE))=0A> + =C2=A0 =C2=A0 =C2=A0return (EPERM);=0A> + =C2=A0= =C2=A0 =C2=A0*paddr =3D rman_get_start(sc->mem_res) + offset;=0AWhat is t= he memattr for the backing page ? Is it set to non-cached=0Amode somehow ?= I was not able to find place where would this happen.=0A=C2=A0=0AI expect= it to be set to non-cached since it's a device anyway, but I don't know w= here it is. =C2=A0During my testing, I did not see any problems with cache= d values, though.=0A=0A> + =C2=A0sc->pdev =3D make_dev(&hpet_cdevsw, 0, UI= D_ROOT, GID_WHEEL,=0A> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 0600, "hpet%d", devic= e_get_unit(dev));=0A> + =C2=A0 =C2=A0 =C2=A0 =C2=A0if (sc->pdev) {=0A> + =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0sc->pdev->si_drv1 =3D = sc;=0A> + =C2=A0 =C2=A0 =C2=A0sc->mmap_allow =3D 1;=0A> + =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0TUNABLE_INT_FETCH("hw.acpi.hpet.mmap= _allow",=0A> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &sc->mmap_allow);= =0A> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0sc->mmap_allow_write =3D 1= ;=0A> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0TUNABLE_INT_FETCH("hw.acp= i.hpet.mmap_allow_write",=0A> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 &sc->mmap_allow_write);=0A> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0SYSCTL_ADD_INT(device_get_sysctl_ctx(dev),=0A> + =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 SYSCTL_CHILDREN(devic= e_get_sysctl_tree(dev)),=0A> + =C2=A0 =C2=A0 =C2=A0 OID_AUTO, "mmap_allow"= ,=0A> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 CTLFLAG_RW, &sc->mmap_allow, 0,= =0A> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "Allow user= land to memory map HPET");=0AWhy is mmap_allow is per-instance, while mmap= _allow_write taken from=0Athe global tunable ?=0A=C2=A0=0AAre you asking w= hy there's no sysctl for it?= From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 19:45:08 2014 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3065A372; Fri, 24 Oct 2014 19:45:08 +0000 (UTC) Received: from st11p02mm-asmtp002.mac.com (st11p02mm-asmtpout002.mac.com [17.172.220.237]) (using TLSv1 with cipher DES-CBC3-SHA (112/168 bits)) (Client CN "smtp.me.com", Issuer "VeriSign Class 3 Extended Validation SSL SGC CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EC39C359; Fri, 24 Oct 2014 19:45:07 +0000 (UTC) Received: from st11p02mm-spool002.mac.com ([17.172.220.247]) by st11p02mm-asmtp002.mac.com (Oracle Communications Messaging Server 7u4-27.10(7.0.4.27.9) 64bit (built Jun 6 2014)) with ESMTP id <0NDY000M1S70XD80@st11p02mm-asmtp002.mac.com>; Fri, 24 Oct 2014 19:45:01 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.12.52,1.0.28,0.0.0000 definitions=2014-10-24_06:2014-10-24,2014-10-24,1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1408290000 definitions=main-1410240166 MIME-version: 1.0 Received: from localhost ([17.172.220.161]) by st11p02mm-spool002.mac.com (Oracle Communications Messaging Server 7u4-27.08(7.0.4.27.7) 64bit (built Aug 22 2013)) with ESMTP id <0NDY00FYTS70A660@st11p02mm-spool002.mac.com>; Fri, 24 Oct 2014 19:45:00 +0000 (GMT) To: Andriy Gapon From: Rui Paulo Subject: Re: svn commit: r273598 - in head: include sys/dev/acpica Date: Fri, 24 Oct 2014 19:45:00 +0000 (GMT) X-Mailer: iCloud MailClient14G39 MailServer14G.17174 X-Originating-IP: [12.218.212.178] Message-id: <2f9b110c-2681-4e3d-b9e0-5ca0eb2763f9@me.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Rui Paulo X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 19:45:08 -0000 On Oct 24, 2014, at 12:06 PM, Andriy Gapon wrote:=0A=0AO= n 24/10/2014 21:39, Rui Paulo wrote:=0A> Author: rpaulo=0A> Date: Fri Oct = 24 18:39:15 2014=0A> New Revision: 273598=0A> URL: https://svnweb.freebsd.= org/changeset/base/273598=0A> =0A> Log:=0A> HPET: create /dev/hpetN as a w= ay to access HPET from userland.=0A> =0A> In some cases, TSC is broken and= special applications might benefit=0A> from memory mapping HPET and readi= ng the registers to count time.=0A> Most often the main HPET counter is 32= -bit only[1], so this only gives=0A> the application a 300 second window b= ased on the default HPET=0A> interval.=0A> Other applications, such as Int= el's DPDK, expect /dev/hpet to be=0A> present and use it to count time as = well.=0A=0ADoes this device attempt to play nice with eventtimer infrastru= cture that may=0Ause the same timer?=0A=C2=A0=0ANo. =C2=A0That's up to the= userland applications and that's why I implemented the read-only restrict= ion.= From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 19:45:52 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AF7CB4B4; Fri, 24 Oct 2014 19:45:52 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3A0EF361; Fri, 24 Oct 2014 19:45:52 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id s9OJjkbs049020 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 24 Oct 2014 22:45:46 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua s9OJjkbs049020 Received: (from kostik@localhost) by tom.home (8.14.9/8.14.9/Submit) id s9OJjkgY049019; Fri, 24 Oct 2014 22:45:46 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 24 Oct 2014 22:45:46 +0300 From: Konstantin Belousov To: Rui Paulo Subject: Re: svn commit: r273598 - in head: include sys/dev/acpica Message-ID: <20141024194546.GE1877@kib.kiev.ua> References: <33decfcd-e77c-4e4c-8161-9f4a232213c6@me.com> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <33decfcd-e77c-4e4c-8161-9f4a232213c6@me.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Rui Paulo X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 19:45:52 -0000 On Fri, Oct 24, 2014 at 07:33:07PM +0000, Rui Paulo wrote: > On Oct 24, 2014, at 12:20 PM, Konstantin Belousov wrote: > > On Fri, Oct 24, 2014 at 06:39:16PM +0000, Rui Paulo wrote: > > Author: rpaulo > > Date: Fri Oct 24 18:39:15 2014 > > New Revision: 273598 > > URL: https://svnweb.freebsd.org/changeset/base/273598 > > > > Log: > > HPET: create /dev/hpetN as a way to access HPET from userland. > > > > In some cases, TSC is broken and special applications might benefit > > from memory mapping HPET and reading the registers to count time. > > Most often the main HPET counter is 32-bit only[1], so this only gives > > the application a 300 second window based on the default HPET > > interval. > > Other applications, such as Intel's DPDK, expect /dev/hpet to be > > present and use it to count time as well. > > > > Although we have an almost userland version of gettimeofday() which > > uses rdtsc in userland, it's not always possible to use it, depending > > on how broken the multi-socket hardware is. > Yes, and hpet userland mapping would be better handled through the same > fake-vdso framework. As designed, it has discriminator to inform > userspace about algorithm, and can happilly utilize HPET timecounter > automatically mapped by kernel into the process address space. > š > I'm aware of that, but I found the vdso a bit confusing and decided to work on that later. > > > +static int > > +hpet_open(struct cdev *cdev, int oflags, int devtype, struct thread *td) > > +{ > > + š š šstruct hpet_softc *sc; > > + > > + š š š šsc = cdev->si_drv1; > > + š š š šif (!sc->mmap_allow) > > + š š š š šreturn (EPERM); > > + š š šif (atomic_cmpset_32(&sc->devinuse, 0, 1) == 0) > > + š š š š š šreturn (EBUSY); > This is extra-weird. > The devinuse business disallows simultaneous opens, which prevents > other process from opening and mapping. But if the original caller > does mmap and close, second process now is allowed to open and mmap. > > That said, why do you need this devinuse at all ? > š > Hmm, I wanted to avoid multiple mmap's, but that doesn't work like you said. šI may just remove this restriction.š > This is probably best. > > +static int > > +hpet_mmap(struct cdev *cdev, vm_ooffset_t offset, vm_paddr_t *paddr, > > + int nprot, vm_memattr_t *memattr) > > +{ > > + š šstruct hpet_softc *sc; > > + > > + š šsc = cdev->si_drv1; > > + š š š šif (offset > rman_get_size(sc->mem_res)) > > + š š š š š š š šreturn (EINVAL); > > + š šif (!sc->mmap_allow_write && (nprot & PROT_WRITE)) > > + š š šreturn (EPERM); > > + š š š*paddr = rman_get_start(sc->mem_res) + offset; > What is the memattr for the backing page ? Is it set to non-cached > mode somehow ? I was not able to find place where would this happen. > š > I expect it to be set to non-cached since it's a device anyway, but I don't know where it is. šDuring my testing, I did not see any problems with cached values, though. > I am not claiming that it is wrong, only that I do not see an easy reason why it is right. Just printing the *memattr would provide the confidence. > > + šsc->pdev = make_dev(&hpet_cdevsw, 0, UID_ROOT, GID_WHEEL, > > + š š š š 0600, "hpet%d", device_get_unit(dev)); > > + š š š šif (sc->pdev) { > > + š š š š š š š šsc->pdev->si_drv1 = sc; > > + š š šsc->mmap_allow = 1; > > + š š š š š š š šTUNABLE_INT_FETCH("hw.acpi.hpet.mmap_allow", > > + š š š š š š &sc->mmap_allow); > > + š š š š š šsc->mmap_allow_write = 1; > > + š š š š š šTUNABLE_INT_FETCH("hw.acpi.hpet.mmap_allow_write", > > + š š š š š š š š &sc->mmap_allow_write); > > + š š š š š š š šSYSCTL_ADD_INT(device_get_sysctl_ctx(dev), > > + š š š š š š š š SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), > > + š š š OID_AUTO, "mmap_allow", > > + š š š š š CTLFLAG_RW, &sc->mmap_allow, 0, > > + š š š š š š š š "Allow userland to memory map HPET"); > Why is mmap_allow is per-instance, while mmap_allow_write taken from > the global tunable ? > š > Are you asking why there's no sysctl for it? IMO the allow-write must be controllable per-instance, or just managed by /dev/hpet* unix permissions. Having one global knob, which is consulted at the module load, is not flexible. What is the use-case for writing to HPET page ? To manually micro-adjust the timer ? Then, you probably want to disable write for instance used by system timecounter or eventtimer, but allow for HPET utilized by other consumers. From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 19:55:51 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 890B66CD; Fri, 24 Oct 2014 19:55:51 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 750AB63E; Fri, 24 Oct 2014 19:55:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OJtp6G014245; Fri, 24 Oct 2014 19:55:51 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OJtnbm014234; Fri, 24 Oct 2014 19:55:49 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201410241955.s9OJtnbm014234@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 24 Oct 2014 19:55:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273601 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 19:55:51 -0000 Author: jhb Date: Fri Oct 24 19:55:49 2014 New Revision: 273601 URL: https://svnweb.freebsd.org/changeset/base/273601 Log: Don't reference sem(4) from the POSIX semaphore pages. POSIX semaphores were reimplemented using umtx in FreeBSD 9 and no longer use sem(4). Modified: head/lib/libc/gen/sem_destroy.3 head/lib/libc/gen/sem_getvalue.3 head/lib/libc/gen/sem_init.3 head/lib/libc/gen/sem_open.3 head/lib/libc/gen/sem_post.3 head/lib/libc/gen/sem_timedwait.3 head/lib/libc/gen/sem_wait.3 Modified: head/lib/libc/gen/sem_destroy.3 ============================================================================== --- head/lib/libc/gen/sem_destroy.3 Fri Oct 24 19:38:05 2014 (r273600) +++ head/lib/libc/gen/sem_destroy.3 Fri Oct 24 19:55:49 2014 (r273601) @@ -67,8 +67,7 @@ There are currently threads blocked on t points to. .El .Sh SEE ALSO -.Xr sem_init 3 , -.Xr sem 4 +.Xr sem_init 3 .Sh STANDARDS The .Fn sem_destroy Modified: head/lib/libc/gen/sem_getvalue.3 ============================================================================== --- head/lib/libc/gen/sem_getvalue.3 Fri Oct 24 19:38:05 2014 (r273600) +++ head/lib/libc/gen/sem_getvalue.3 Fri Oct 24 19:55:49 2014 (r273601) @@ -65,8 +65,7 @@ points to an invalid semaphore. .Sh SEE ALSO .Xr sem_post 3 , .Xr sem_trywait 3 , -.Xr sem_wait 3 , -.Xr sem 4 +.Xr sem_wait 3 .Sh STANDARDS The .Fn sem_getvalue Modified: head/lib/libc/gen/sem_init.3 ============================================================================== --- head/lib/libc/gen/sem_init.3 Fri Oct 24 19:38:05 2014 (r273600) +++ head/lib/libc/gen/sem_init.3 Fri Oct 24 19:55:49 2014 (r273601) @@ -93,8 +93,7 @@ Memory allocation error. .Xr sem_getvalue 3 , .Xr sem_post 3 , .Xr sem_trywait 3 , -.Xr sem_wait 3 , -.Xr sem 4 +.Xr sem_wait 3 .Sh STANDARDS The .Fn sem_init Modified: head/lib/libc/gen/sem_open.3 ============================================================================== --- head/lib/libc/gen/sem_open.3 Fri Oct 24 19:38:05 2014 (r273600) +++ head/lib/libc/gen/sem_open.3 Fri Oct 24 19:55:49 2014 (r273601) @@ -210,8 +210,7 @@ The named semaphore does not exist. .Xr sem_getvalue 3 , .Xr sem_post 3 , .Xr sem_trywait 3 , -.Xr sem_wait 3 , -.Xr sem 4 +.Xr sem_wait 3 .Sh STANDARDS The .Fn sem_open , Modified: head/lib/libc/gen/sem_post.3 ============================================================================== --- head/lib/libc/gen/sem_post.3 Fri Oct 24 19:38:05 2014 (r273600) +++ head/lib/libc/gen/sem_post.3 Fri Oct 24 19:55:49 2014 (r273601) @@ -69,8 +69,7 @@ points to an invalid semaphore. .Sh SEE ALSO .Xr sem_getvalue 3 , .Xr sem_trywait 3 , -.Xr sem_wait 3 , -.Xr sem 4 +.Xr sem_wait 3 .Sh STANDARDS The .Fn sem_post Modified: head/lib/libc/gen/sem_timedwait.3 ============================================================================== --- head/lib/libc/gen/sem_timedwait.3 Fri Oct 24 19:38:05 2014 (r273600) +++ head/lib/libc/gen/sem_timedwait.3 Fri Oct 24 19:55:49 2014 (r273601) @@ -108,8 +108,7 @@ A signal interrupted this function. .Sh SEE ALSO .Xr sem_post 3 , .Xr sem_trywait 3 , -.Xr sem_wait 3 , -.Xr sem 4 +.Xr sem_wait 3 .Sh STANDARDS The .Fn sem_timedwait Modified: head/lib/libc/gen/sem_wait.3 ============================================================================== --- head/lib/libc/gen/sem_wait.3 Fri Oct 24 19:38:05 2014 (r273600) +++ head/lib/libc/gen/sem_wait.3 Fri Oct 24 19:55:49 2014 (r273601) @@ -92,8 +92,7 @@ The semaphore value was zero, and thus c .Sh SEE ALSO .Xr sem_getvalue 3 , .Xr sem_post 3 , -.Xr sem_timedwait 3 , -.Xr sem 4 +.Xr sem_timedwait 3 .Sh STANDARDS The .Fn sem_wait From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 19:58:01 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 60C1984B; Fri, 24 Oct 2014 19:58:01 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 330AA658; Fri, 24 Oct 2014 19:58:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OJw1qK014546; Fri, 24 Oct 2014 19:58:01 GMT (envelope-from rpaulo@FreeBSD.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OJw1em014545; Fri, 24 Oct 2014 19:58:01 GMT (envelope-from rpaulo@FreeBSD.org) Message-Id: <201410241958.s9OJw1em014545@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rpaulo set sender to rpaulo@FreeBSD.org using -f From: Rui Paulo Date: Fri, 24 Oct 2014 19:58:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273602 - head/sys/dev/acpica X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 19:58:01 -0000 Author: rpaulo Date: Fri Oct 24 19:58:00 2014 New Revision: 273602 URL: https://svnweb.freebsd.org/changeset/base/273602 Log: HPET: avoid handling the multiple file-descriptor case. It had two bugs: one where mmap was still allowed and another where D_TRACKCLOSE doesn't handle all cases. Thanks to jhb and kib for pointing them out. MFC after: 1 week Modified: head/sys/dev/acpica/acpi_hpet.c Modified: head/sys/dev/acpica/acpi_hpet.c ============================================================================== --- head/sys/dev/acpica/acpi_hpet.c Fri Oct 24 19:55:49 2014 (r273601) +++ head/sys/dev/acpica/acpi_hpet.c Fri Oct 24 19:58:00 2014 (r273602) @@ -111,19 +111,15 @@ struct hpet_softc { struct cdev *pdev; int mmap_allow; int mmap_allow_write; - int devinuse; }; static d_open_t hpet_open; -static d_close_t hpet_close; static d_mmap_t hpet_mmap; static struct cdevsw hpet_cdevsw = { .d_version = D_VERSION, - .d_flags = D_TRACKCLOSE, .d_name = "hpet", .d_open = hpet_open, - .d_close = hpet_close, .d_mmap = hpet_mmap, }; @@ -344,24 +340,11 @@ hpet_open(struct cdev *cdev, int oflags, sc = cdev->si_drv1; if (!sc->mmap_allow) return (EPERM); - if (atomic_cmpset_32(&sc->devinuse, 0, 1) == 0) - return (EBUSY); else return (0); } static int -hpet_close(struct cdev *cdev, int fflag, int devtype, struct thread *td) -{ - struct hpet_softc *sc; - - sc = cdev->si_drv1; - sc->devinuse = 0; - - return (0); -} - -static int hpet_mmap(struct cdev *cdev, vm_ooffset_t offset, vm_paddr_t *paddr, int nprot, vm_memattr_t *memattr) { @@ -378,7 +361,7 @@ hpet_mmap(struct cdev *cdev, vm_ooffset_ } /* Discover the HPET via the ACPI table of the same name. */ -static void +static void hpet_identify(driver_t *driver, device_t parent) { ACPI_TABLE_HPET *hpet; @@ -710,8 +693,8 @@ hpet_attach(device_t dev) #ifdef DEV_APIC if ((t->caps & HPET_TCAP_FSB_INT_DEL) && t->irq >= 0) { uint64_t addr; - uint32_t data; - + uint32_t data; + if (PCIB_MAP_MSI( device_get_parent(device_get_parent(dev)), dev, t->irq, &addr, &data) == 0) { @@ -825,8 +808,8 @@ hpet_resume(device_t dev) #ifdef DEV_APIC if (t->irq >= 0 && (sc->legacy_route == 0 || i >= 2)) { uint64_t addr; - uint32_t data; - + uint32_t data; + if (PCIB_MAP_MSI( device_get_parent(device_get_parent(dev)), dev, t->irq, &addr, &data) == 0) { @@ -897,7 +880,7 @@ hpet_remap_intr(device_t dev, device_t c struct hpet_softc *sc = device_get_softc(dev); struct hpet_timer *t; uint64_t addr; - uint32_t data; + uint32_t data; int error, i; for (i = 0; i < sc->num_timers; i++) { From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 19:58:27 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E7C16989; Fri, 24 Oct 2014 19:58:27 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CA96765E; Fri, 24 Oct 2014 19:58:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OJwRJx014666; Fri, 24 Oct 2014 19:58:27 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OJwPpd014649; Fri, 24 Oct 2014 19:58:25 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201410241958.s9OJwPpd014649@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 24 Oct 2014 19:58:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273603 - in head/sys: amd64/conf arm/conf conf i386/conf pc98/conf powerpc/conf sparc64/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 19:58:28 -0000 Author: jhb Date: Fri Oct 24 19:58:24 2014 New Revision: 273603 URL: https://svnweb.freebsd.org/changeset/base/273603 Log: Add COMPAT_FREEBSD9 and COMPAT_FREEBSD10 options to wrap code that provides compatability for FreeBSD 9.x and 10.x binaries. Enable these options in kernel configs that enable other COMPAT_FREEBSD options. Modified: head/sys/amd64/conf/GENERIC head/sys/arm/conf/ATMEL head/sys/conf/NOTES head/sys/conf/options head/sys/i386/conf/GENERIC head/sys/i386/conf/XEN head/sys/pc98/conf/GENERIC head/sys/powerpc/conf/GENERIC head/sys/powerpc/conf/GENERIC64 head/sys/sparc64/conf/GENERIC Modified: head/sys/amd64/conf/GENERIC ============================================================================== --- head/sys/amd64/conf/GENERIC Fri Oct 24 19:58:00 2014 (r273602) +++ head/sys/amd64/conf/GENERIC Fri Oct 24 19:58:24 2014 (r273603) @@ -53,6 +53,8 @@ options COMPAT_FREEBSD4 # Compatible w options COMPAT_FREEBSD5 # Compatible with FreeBSD5 options COMPAT_FREEBSD6 # Compatible with FreeBSD6 options COMPAT_FREEBSD7 # Compatible with FreeBSD7 +options COMPAT_FREEBSD9 # Compatible with FreeBSD9 +options COMPAT_FREEBSD10 # Compatible with FreeBSD10 options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI options KTRACE # ktrace(1) support options STACK # stack(9) support Modified: head/sys/arm/conf/ATMEL ============================================================================== --- head/sys/arm/conf/ATMEL Fri Oct 24 19:58:00 2014 (r273602) +++ head/sys/arm/conf/ATMEL Fri Oct 24 19:58:24 2014 (r273603) @@ -60,6 +60,8 @@ options GEOM_LABEL # Provides labeliza options COMPAT_FREEBSD5 # Compatible with FreeBSD5 options COMPAT_FREEBSD6 # Compatible with FreeBSD6 options COMPAT_FREEBSD7 # Compatible with FreeBSD7 +options COMPAT_FREEBSD9 # Compatible with FreeBSD9 +options COMPAT_FREEBSD10 # Compatible with FreeBSD10 options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI options KTRACE # ktrace(1) support options STACK # stack(9) support Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Fri Oct 24 19:58:00 2014 (r273602) +++ head/sys/conf/NOTES Fri Oct 24 19:58:24 2014 (r273603) @@ -351,6 +351,12 @@ options COMPAT_FREEBSD6 # Enable FreeBSD7 compatibility syscalls options COMPAT_FREEBSD7 +# Enable FreeBSD9 compatibility syscalls +options COMPAT_FREEBSD9 + +# Enable FreeBSD10 compatibility syscalls +options COMPAT_FREEBSD10 + # # These three options provide support for System V Interface # Definition-style interprocess communication, in the form of shared Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Fri Oct 24 19:58:00 2014 (r273602) +++ head/sys/conf/options Fri Oct 24 19:58:24 2014 (r273603) @@ -83,6 +83,8 @@ COMPAT_FREEBSD4 opt_compat.h COMPAT_FREEBSD5 opt_compat.h COMPAT_FREEBSD6 opt_compat.h COMPAT_FREEBSD7 opt_compat.h +COMPAT_FREEBSD9 opt_compat.h +COMPAT_FREEBSD10 opt_compat.h COMPILING_LINT opt_global.h COMPRESS_USER_CORES opt_core.h CY_PCI_FASTINTR Modified: head/sys/i386/conf/GENERIC ============================================================================== --- head/sys/i386/conf/GENERIC Fri Oct 24 19:58:00 2014 (r273602) +++ head/sys/i386/conf/GENERIC Fri Oct 24 19:58:24 2014 (r273603) @@ -54,6 +54,8 @@ options COMPAT_FREEBSD4 # Compatible w options COMPAT_FREEBSD5 # Compatible with FreeBSD5 options COMPAT_FREEBSD6 # Compatible with FreeBSD6 options COMPAT_FREEBSD7 # Compatible with FreeBSD7 +options COMPAT_FREEBSD9 # Compatible with FreeBSD9 +options COMPAT_FREEBSD10 # Compatible with FreeBSD10 options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI options KTRACE # ktrace(1) support options STACK # stack(9) support Modified: head/sys/i386/conf/XEN ============================================================================== --- head/sys/i386/conf/XEN Fri Oct 24 19:58:00 2014 (r273602) +++ head/sys/i386/conf/XEN Fri Oct 24 19:58:24 2014 (r273603) @@ -36,6 +36,8 @@ options COMPAT_FREEBSD4 # Compatible w options COMPAT_FREEBSD5 # Compatible with FreeBSD5 options COMPAT_FREEBSD6 # Compatible with FreeBSD6 options COMPAT_FREEBSD7 # Compatible with FreeBSD7 +options COMPAT_FREEBSD9 # Compatible with FreeBSD9 +options COMPAT_FREEBSD10 # Compatible with FreeBSD10 options KTRACE # ktrace(1) support options STACK # stack(9) support options SYSVSHM # SYSV-style shared memory Modified: head/sys/pc98/conf/GENERIC ============================================================================== --- head/sys/pc98/conf/GENERIC Fri Oct 24 19:58:00 2014 (r273602) +++ head/sys/pc98/conf/GENERIC Fri Oct 24 19:58:24 2014 (r273603) @@ -51,6 +51,8 @@ options COMPAT_FREEBSD4 # Compatible w options COMPAT_FREEBSD5 # Compatible with FreeBSD5 options COMPAT_FREEBSD6 # Compatible with FreeBSD6 options COMPAT_FREEBSD7 # Compatible with FreeBSD7 +options COMPAT_FREEBSD9 # Compatible with FreeBSD9 +options COMPAT_FREEBSD10 # Compatible with FreeBSD10 options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI options EPSON_BOUNCEDMA # use bounce buffer for 15-16M #options EPSON_MEMWIN # EPSON memory window support Modified: head/sys/powerpc/conf/GENERIC ============================================================================== --- head/sys/powerpc/conf/GENERIC Fri Oct 24 19:58:00 2014 (r273602) +++ head/sys/powerpc/conf/GENERIC Fri Oct 24 19:58:24 2014 (r273603) @@ -59,6 +59,8 @@ options COMPAT_FREEBSD4 #Keep this for options COMPAT_FREEBSD5 #Compatible with FreeBSD5 options COMPAT_FREEBSD6 #Compatible with FreeBSD6 options COMPAT_FREEBSD7 #Compatible with FreeBSD7 +options COMPAT_FREEBSD9 # Compatible with FreeBSD9 +options COMPAT_FREEBSD10 # Compatible with FreeBSD10 options SCSI_DELAY=5000 #Delay (in ms) before probing SCSI options KTRACE #ktrace(1) syscall trace support options STACK #stack(9) support Modified: head/sys/powerpc/conf/GENERIC64 ============================================================================== --- head/sys/powerpc/conf/GENERIC64 Fri Oct 24 19:58:00 2014 (r273602) +++ head/sys/powerpc/conf/GENERIC64 Fri Oct 24 19:58:24 2014 (r273603) @@ -59,6 +59,8 @@ options COMPAT_FREEBSD32 #Compatible wi options COMPAT_FREEBSD5 #Compatible with FreeBSD5 options COMPAT_FREEBSD6 #Compatible with FreeBSD6 options COMPAT_FREEBSD7 #Compatible with FreeBSD7 +options COMPAT_FREEBSD9 # Compatible with FreeBSD9 +options COMPAT_FREEBSD10 # Compatible with FreeBSD10 options SCSI_DELAY=5000 #Delay (in ms) before probing SCSI options KTRACE #ktrace(1) syscall trace support options STACK #stack(9) support Modified: head/sys/sparc64/conf/GENERIC ============================================================================== --- head/sys/sparc64/conf/GENERIC Fri Oct 24 19:58:00 2014 (r273602) +++ head/sys/sparc64/conf/GENERIC Fri Oct 24 19:58:24 2014 (r273603) @@ -51,6 +51,8 @@ options GEOM_LABEL # Provides labeliza options COMPAT_FREEBSD5 # Compatible with FreeBSD5 options COMPAT_FREEBSD6 # Compatible with FreeBSD6 options COMPAT_FREEBSD7 # Compatible with FreeBSD7 +options COMPAT_FREEBSD9 # Compatible with FreeBSD9 +options COMPAT_FREEBSD10 # Compatible with FreeBSD10 options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI options KTRACE # ktrace(1) support options STACK # stack(9) support From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 20:02:46 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5914BB07; Fri, 24 Oct 2014 20:02:46 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 43CC6765; Fri, 24 Oct 2014 20:02:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OK2kuJ018824; Fri, 24 Oct 2014 20:02:46 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OK2i3w018818; Fri, 24 Oct 2014 20:02:44 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201410242002.s9OK2i3w018818@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 24 Oct 2014 20:02:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273604 - in head: include lib/libc/gen sys/kern sys/sys usr.bin/truss X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 20:02:46 -0000 Author: jhb Date: Fri Oct 24 20:02:44 2014 New Revision: 273604 URL: https://svnweb.freebsd.org/changeset/base/273604 Log: The current POSIX semaphore implementation stores the _has_waiters flag in a separate word from the _count. This does not permit both items to be updated atomically in a portable manner. As a result, sem_post() must always perform a system call to safely clear _has_waiters. This change removes the _has_waiters field and instead uses the high bit of _count as the _has_waiters flag. A new umtx object type (_usem2) and two new umtx operations are added (SEM_WAIT2 and SEM_WAKE2) to implement these semantics. The older operations are still supported under the COMPAT_FREEBSD9/10 options. The POSIX semaphore API in libc has been updated to use the new implementation. Note that the new implementation is not compatible with the previous implementation. However, this only affects static binaries (which cannot be helped by symbol versioning). Binaries using a dynamic libc will continue to work fine. SEM_MAGIC has been bumped so that mismatched binaries will error rather than corrupting a shared semaphore. In addition, a padding field has been added to sem_t so that it remains the same size. Differential Revision: https://reviews.freebsd.org/D961 Reported by: adrian Reviewed by: kib, jilles (earlier version) Sponsored by: Norse Modified: head/include/semaphore.h head/lib/libc/gen/sem_new.c head/sys/kern/kern_umtx.c head/sys/sys/_umtx.h head/sys/sys/umtx.h head/usr.bin/truss/syscalls.c Modified: head/include/semaphore.h ============================================================================== --- head/include/semaphore.h Fri Oct 24 19:58:24 2014 (r273603) +++ head/include/semaphore.h Fri Oct 24 20:02:44 2014 (r273604) @@ -38,7 +38,8 @@ struct _sem { __uint32_t _magic; - struct _usem _kern; + struct _usem2 _kern; + __uint32_t _padding; /* Preserve structure size */ }; typedef struct _sem sem_t; Modified: head/lib/libc/gen/sem_new.c ============================================================================== --- head/lib/libc/gen/sem_new.c Fri Oct 24 19:58:24 2014 (r273603) +++ head/lib/libc/gen/sem_new.c Fri Oct 24 20:02:44 2014 (r273604) @@ -61,7 +61,9 @@ __weak_reference(_sem_unlink, sem_unlink __weak_reference(_sem_wait, sem_wait); #define SEM_PREFIX "/tmp/SEMD" -#define SEM_MAGIC ((u_int32_t)0x73656d31) +#define SEM_MAGIC ((u_int32_t)0x73656d32) + +_Static_assert(SEM_VALUE_MAX <= USEM_MAX_COUNT, "SEM_VALUE_MAX too large"); struct sem_nameinfo { int open_count; @@ -131,7 +133,6 @@ _sem_init(sem_t *sem, int pshared, unsig bzero(sem, sizeof(sem_t)); sem->_magic = SEM_MAGIC; sem->_kern._count = (u_int32_t)value; - sem->_kern._has_waiters = 0; sem->_kern._flags = pshared ? USYNC_PROCESS_SHARED : 0; return (0); } @@ -212,7 +213,6 @@ _sem_open(const char *name, int flags, . sem_t tmp; tmp._magic = SEM_MAGIC; - tmp._kern._has_waiters = 0; tmp._kern._count = value; tmp._kern._flags = USYNC_PROCESS_SHARED | SEM_NAMED; if (_write(fd, &tmp, sizeof(tmp)) != sizeof(tmp)) @@ -332,18 +332,18 @@ _sem_getvalue(sem_t * __restrict sem, in if (sem_check_validity(sem) != 0) return (-1); - *sval = (int)sem->_kern._count; + *sval = (int)USEM_COUNT(sem->_kern._count); return (0); } static __inline int -usem_wake(struct _usem *sem) +usem_wake(struct _usem2 *sem) { - return _umtx_op(sem, UMTX_OP_SEM_WAKE, 0, NULL, NULL); + return _umtx_op(sem, UMTX_OP_SEM2_WAKE, 0, NULL, NULL); } static __inline int -usem_wait(struct _usem *sem, const struct timespec *abstime) +usem_wait(struct _usem2 *sem, const struct timespec *abstime) { struct _umtx_time *tm_p, timeout; size_t tm_size; @@ -358,7 +358,7 @@ usem_wait(struct _usem *sem, const struc tm_p = &timeout; tm_size = sizeof(timeout); } - return _umtx_op(sem, UMTX_OP_SEM_WAIT, 0, + return _umtx_op(sem, UMTX_OP_SEM2_WAIT, 0, (void *)tm_size, __DECONST(void*, tm_p)); } @@ -370,7 +370,7 @@ _sem_trywait(sem_t *sem) if (sem_check_validity(sem) != 0) return (-1); - while ((val = sem->_kern._count) > 0) { + while (USEM_COUNT(val = sem->_kern._count) > 0) { if (atomic_cmpset_acq_int(&sem->_kern._count, val, val - 1)) return (0); } @@ -390,7 +390,7 @@ _sem_timedwait(sem_t * __restrict sem, retval = 0; _pthread_testcancel(); for (;;) { - while ((val = sem->_kern._count) > 0) { + while (USEM_COUNT(val = sem->_kern._count) > 0) { if (atomic_cmpset_acq_int(&sem->_kern._count, val, val - 1)) return (0); } @@ -439,9 +439,10 @@ _sem_post(sem_t *sem) do { count = sem->_kern._count; - if (count + 1 > SEM_VALUE_MAX) + if (USEM_COUNT(count) + 1 > SEM_VALUE_MAX) return (EOVERFLOW); - } while(!atomic_cmpset_rel_int(&sem->_kern._count, count, count+1)); - (void)usem_wake(&sem->_kern); + } while (!atomic_cmpset_rel_int(&sem->_kern._count, count, count + 1)); + if (count & USEM_HAS_WAITERS) + usem_wake(&sem->_kern); return (0); } Modified: head/sys/kern/kern_umtx.c ============================================================================== --- head/sys/kern/kern_umtx.c Fri Oct 24 19:58:24 2014 (r273603) +++ head/sys/kern/kern_umtx.c Fri Oct 24 20:02:44 2014 (r273604) @@ -2710,6 +2710,7 @@ out: return (error); } +#if defined(COMPAT_FREEBSD9) || defined(COMPAT_FREEBSD10) static int do_sem_wait(struct thread *td, struct _usem *sem, struct _umtx_time *timeout) { @@ -2731,7 +2732,7 @@ do_sem_wait(struct thread *td, struct _u umtxq_busy(&uq->uq_key); umtxq_insert(uq); umtxq_unlock(&uq->uq_key); - casuword32(__DEVOLATILE(uint32_t *, &sem->_has_waiters), 0, 1); + casuword32(&sem->_has_waiters, 0, 1); count = fuword32(__DEVOLATILE(uint32_t *, &sem->_count)); if (count != 0) { umtxq_lock(&uq->uq_key); @@ -2761,7 +2762,7 @@ do_sem_wait(struct thread *td, struct _u } /* - * Signal a userland condition variable. + * Signal a userland semaphore. */ static int do_sem_wake(struct thread *td, struct _usem *sem) @@ -2795,6 +2796,119 @@ do_sem_wake(struct thread *td, struct _u umtx_key_release(&key); return (error); } +#endif + +static int +do_sem2_wait(struct thread *td, struct _usem2 *sem, struct _umtx_time *timeout) +{ + struct abs_timeout timo; + struct umtx_q *uq; + uint32_t count, flags; + int error; + + uq = td->td_umtxq; + flags = fuword32(&sem->_flags); + error = umtx_key_get(sem, TYPE_SEM, GET_SHARE(flags), &uq->uq_key); + if (error != 0) + return (error); + + if (timeout != NULL) + abs_timeout_init2(&timo, timeout); + + umtxq_lock(&uq->uq_key); + umtxq_busy(&uq->uq_key); + umtxq_insert(uq); + umtxq_unlock(&uq->uq_key); + count = fuword32(__DEVOLATILE(uint32_t *, &sem->_count)); + if (count == -1) { + umtxq_lock(&uq->uq_key); + umtxq_unbusy(&uq->uq_key); + umtxq_remove(uq); + umtxq_unlock(&uq->uq_key); + umtx_key_release(&uq->uq_key); + return (EFAULT); + } + for (;;) { + if (USEM_COUNT(count) != 0) { + umtxq_lock(&uq->uq_key); + umtxq_unbusy(&uq->uq_key); + umtxq_remove(uq); + umtxq_unlock(&uq->uq_key); + umtx_key_release(&uq->uq_key); + return (0); + } + if (count == USEM_HAS_WAITERS) + break; + count = casuword32(&sem->_count, 0, USEM_HAS_WAITERS); + if (count == -1) { + umtxq_lock(&uq->uq_key); + umtxq_unbusy(&uq->uq_key); + umtxq_remove(uq); + umtxq_unlock(&uq->uq_key); + umtx_key_release(&uq->uq_key); + return (EFAULT); + } + if (count == 0) + break; + } + umtxq_lock(&uq->uq_key); + umtxq_unbusy(&uq->uq_key); + + error = umtxq_sleep(uq, "usem", timeout == NULL ? NULL : &timo); + + if ((uq->uq_flags & UQF_UMTXQ) == 0) + error = 0; + else { + umtxq_remove(uq); + /* A relative timeout cannot be restarted. */ + if (error == ERESTART && timeout != NULL && + (timeout->_flags & UMTX_ABSTIME) == 0) + error = EINTR; + } + umtxq_unlock(&uq->uq_key); + umtx_key_release(&uq->uq_key); + return (error); +} + +/* + * Signal a userland semaphore. + */ +static int +do_sem2_wake(struct thread *td, struct _usem2 *sem) +{ + struct umtx_key key; + int error, cnt; + uint32_t count, flags; + + flags = fuword32(&sem->_flags); + if ((error = umtx_key_get(sem, TYPE_SEM, GET_SHARE(flags), &key)) != 0) + return (error); + umtxq_lock(&key); + umtxq_busy(&key); + cnt = umtxq_count(&key); + if (cnt > 0) { + umtxq_signal(&key, 1); + + /* + * If this was the last sleeping thread, clear the waiters + * flag in _count. + */ + if (cnt == 1) { + umtxq_unlock(&key); + count = fuword32(&sem->_count); + while (count != -1 && count & USEM_HAS_WAITERS) + count = casuword32(&sem->_count, count, + count & ~USEM_HAS_WAITERS); + if (count == -1) + error = EFAULT; + umtxq_lock(&key); + } + } + umtxq_unbusy(&key); + umtxq_unlock(&key); + umtx_key_release(&key); + return (error); +} inline int umtx_copyin_timeout(const void *addr, struct timespec *tsp) @@ -3066,6 +3180,7 @@ __umtx_op_rw_unlock(struct thread *td, s return do_rw_unlock(td, uap->obj); } +#if defined(COMPAT_FREEBSD9) || defined(COMPAT_FREEBSD10) static int __umtx_op_sem_wait(struct thread *td, struct _umtx_op_args *uap) { @@ -3090,6 +3205,7 @@ __umtx_op_sem_wake(struct thread *td, st { return do_sem_wake(td, uap->obj); } +#endif static int __umtx_op_wake2_umutex(struct thread *td, struct _umtx_op_args *uap) @@ -3097,6 +3213,31 @@ __umtx_op_wake2_umutex(struct thread *td return do_wake2_umutex(td, uap->obj, uap->val); } +static int +__umtx_op_sem2_wait(struct thread *td, struct _umtx_op_args *uap) +{ + struct _umtx_time *tm_p, timeout; + int error; + + /* Allow a null timespec (wait forever). */ + if (uap->uaddr2 == NULL) + tm_p = NULL; + else { + error = umtx_copyin_umtx_time( + uap->uaddr2, (size_t)uap->uaddr1, &timeout); + if (error != 0) + return (error); + tm_p = &timeout; + } + return (do_sem2_wait(td, uap->obj, tm_p)); +} + +static int +__umtx_op_sem2_wake(struct thread *td, struct _umtx_op_args *uap) +{ + return do_sem2_wake(td, uap->obj); +} + typedef int (*_umtx_op_func)(struct thread *td, struct _umtx_op_args *uap); static _umtx_op_func op_table[] = { @@ -3119,10 +3260,17 @@ static _umtx_op_func op_table[] = { __umtx_op_wake_private, /* UMTX_OP_WAKE_PRIVATE */ __umtx_op_wait_umutex, /* UMTX_OP_MUTEX_WAIT */ __umtx_op_wake_umutex, /* UMTX_OP_MUTEX_WAKE */ +#if defined(COMPAT_FREEBSD9) || defined(COMPAT_FREEBSD10) __umtx_op_sem_wait, /* UMTX_OP_SEM_WAIT */ __umtx_op_sem_wake, /* UMTX_OP_SEM_WAKE */ +#else + __umtx_op_unimpl, /* UMTX_OP_SEM_WAIT */ + __umtx_op_unimpl, /* UMTX_OP_SEM_WAKE */ +#endif __umtx_op_nwake_private, /* UMTX_OP_NWAKE_PRIVATE */ - __umtx_op_wake2_umutex /* UMTX_OP_MUTEX_WAKE2 */ + __umtx_op_wake2_umutex, /* UMTX_OP_MUTEX_WAKE2 */ + __umtx_op_sem2_wait, /* UMTX_OP_SEM2_WAIT */ + __umtx_op_sem2_wake, /* UMTX_OP_SEM2_WAKE */ }; int @@ -3320,6 +3468,7 @@ __umtx_op_wait_uint_private_compat32(str return do_wait(td, uap->obj, uap->val, tm_p, 1, 1); } +#if defined(COMPAT_FREEBSD9) || defined(COMPAT_FREEBSD10) static int __umtx_op_sem_wait_compat32(struct thread *td, struct _umtx_op_args *uap) { @@ -3338,6 +3487,26 @@ __umtx_op_sem_wait_compat32(struct threa } return (do_sem_wait(td, uap->obj, tm_p)); } +#endif + +static int +__umtx_op_sem2_wait_compat32(struct thread *td, struct _umtx_op_args *uap) +{ + struct _umtx_time *tm_p, timeout; + int error; + + /* Allow a null timespec (wait forever). */ + if (uap->uaddr2 == NULL) + tm_p = NULL; + else { + error = umtx_copyin_umtx_time32(uap->uaddr2, + (size_t)uap->uaddr1, &timeout); + if (error != 0) + return (error); + tm_p = &timeout; + } + return (do_sem2_wait(td, uap->obj, tm_p)); +} static int __umtx_op_nwake_private32(struct thread *td, struct _umtx_op_args *uap) @@ -3385,10 +3554,17 @@ static _umtx_op_func op_table_compat32[] __umtx_op_wake_private, /* UMTX_OP_WAKE_PRIVATE */ __umtx_op_wait_umutex_compat32, /* UMTX_OP_MUTEX_WAIT */ __umtx_op_wake_umutex, /* UMTX_OP_MUTEX_WAKE */ +#if defined(COMPAT_FREEBSD9) || defined(COMPAT_FREEBSD10) __umtx_op_sem_wait_compat32, /* UMTX_OP_SEM_WAIT */ __umtx_op_sem_wake, /* UMTX_OP_SEM_WAKE */ +#else + __umtx_op_unimpl, /* UMTX_OP_SEM_WAIT */ + __umtx_op_unimpl, /* UMTX_OP_SEM_WAKE */ +#endif __umtx_op_nwake_private32, /* UMTX_OP_NWAKE_PRIVATE */ - __umtx_op_wake2_umutex /* UMTX_OP_MUTEX_WAKE2 */ + __umtx_op_wake2_umutex, /* UMTX_OP_MUTEX_WAKE2 */ + __umtx_op_sem2_wait_compat32, /* UMTX_OP_SEM2_WAIT */ + __umtx_op_sem2_wake, /* UMTX_OP_SEM2_WAKE */ }; int Modified: head/sys/sys/_umtx.h ============================================================================== --- head/sys/sys/_umtx.h Fri Oct 24 19:58:24 2014 (r273603) +++ head/sys/sys/_umtx.h Fri Oct 24 20:02:44 2014 (r273604) @@ -61,6 +61,11 @@ struct _usem { __uint32_t _flags; }; +struct _usem2 { + volatile __uint32_t _count; /* Waiters flag in high bit. */ + __uint32_t _flags; +}; + struct _umtx_time { struct timespec _timeout; __uint32_t _flags; Modified: head/sys/sys/umtx.h ============================================================================== --- head/sys/sys/umtx.h Fri Oct 24 19:58:24 2014 (r273603) +++ head/sys/sys/umtx.h Fri Oct 24 20:02:44 2014 (r273604) @@ -52,6 +52,11 @@ /* _usem flags */ #define SEM_NAMED 0x0002 +/* _usem2 count field */ +#define USEM_HAS_WAITERS 0x80000000U +#define USEM_MAX_COUNT 0x7fffffffU +#define USEM_COUNT(c) ((c) & USEM_MAX_COUNT) + /* op code for _umtx_op */ #define UMTX_OP_RESERVED0 0 #define UMTX_OP_RESERVED1 1 @@ -72,11 +77,13 @@ #define UMTX_OP_WAKE_PRIVATE 16 #define UMTX_OP_MUTEX_WAIT 17 #define UMTX_OP_MUTEX_WAKE 18 /* deprecated */ -#define UMTX_OP_SEM_WAIT 19 -#define UMTX_OP_SEM_WAKE 20 +#define UMTX_OP_SEM_WAIT 19 /* deprecated */ +#define UMTX_OP_SEM_WAKE 20 /* deprecated */ #define UMTX_OP_NWAKE_PRIVATE 21 #define UMTX_OP_MUTEX_WAKE2 22 -#define UMTX_OP_MAX 23 +#define UMTX_OP_SEM2_WAIT 23 +#define UMTX_OP_SEM2_WAKE 24 +#define UMTX_OP_MAX 25 /* Flags for UMTX_OP_CV_WAIT */ #define CVWAIT_CHECK_UNPARKING 0x01 Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Fri Oct 24 19:58:24 2014 (r273603) +++ head/usr.bin/truss/syscalls.c Fri Oct 24 20:02:44 2014 (r273604) @@ -424,6 +424,7 @@ static struct xlat umtx_ops[] = { X(UMTX_OP_WAIT_UINT_PRIVATE) X(UMTX_OP_WAKE_PRIVATE) X(UMTX_OP_MUTEX_WAIT) X(UMTX_OP_MUTEX_WAKE) X(UMTX_OP_SEM_WAIT) X(UMTX_OP_SEM_WAKE) X(UMTX_OP_NWAKE_PRIVATE) X(UMTX_OP_MUTEX_WAKE2) + X(UMTX_OP_SEM2_WAIT) X(UMTX_OP_SEM2_WAKE) XEND }; From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 20:29:15 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8B5DA3A5; Fri, 24 Oct 2014 20:29:15 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5C3C59C7; Fri, 24 Oct 2014 20:29:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OKTFsD029035; Fri, 24 Oct 2014 20:29:15 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OKTF5D029034; Fri, 24 Oct 2014 20:29:15 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201410242029.s9OKTF5D029034@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 24 Oct 2014 20:29:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273605 - head/lib/libc/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 20:29:15 -0000 Author: markj Date: Fri Oct 24 20:29:14 2014 New Revision: 273605 URL: https://svnweb.freebsd.org/changeset/base/273605 Log: Eliminate conf_lock and instead rely on the NSS write lock to protect NSS configuration state. As a side effect, this fixes a race condition which can occur if multiple threads call nsdispatch(3) concurrently before nsswitch.conf has been parsed. Previously, the thread holding conf_lock could cause other threads to return from nss_configure() before nsswitch.conf had been parsed, forcing them to fall back to the default sources for their NSS methods. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D994 MFC after: 1 month Sponsored by: EMC / Isilon Storage Division Modified: head/lib/libc/net/nsdispatch.c Modified: head/lib/libc/net/nsdispatch.c ============================================================================== --- head/lib/libc/net/nsdispatch.c Fri Oct 24 20:02:44 2014 (r273604) +++ head/lib/libc/net/nsdispatch.c Fri Oct 24 20:29:14 2014 (r273605) @@ -329,7 +329,6 @@ _nsdbtdump(const ns_dbt *dbt) static int nss_configure(void) { - static pthread_mutex_t conf_lock = PTHREAD_MUTEX_INITIALIZER; static time_t confmod; struct stat statbuf; int result, isthreaded; @@ -353,13 +352,14 @@ nss_configure(void) if (statbuf.st_mtime <= confmod) return (0); if (isthreaded) { - result = _pthread_mutex_trylock(&conf_lock); - if (result != 0) - return (0); (void)_pthread_rwlock_unlock(&nss_lock); result = _pthread_rwlock_wrlock(&nss_lock); if (result != 0) - goto fin2; + return (result); + if (stat(path, &statbuf) != 0) + goto fin; + if (statbuf.st_mtime <= confmod) + goto fin; } _nsyyin = fopen(path, "re"); if (_nsyyin == NULL) @@ -390,9 +390,6 @@ fin: if (result == 0) result = _pthread_rwlock_rdlock(&nss_lock); } -fin2: - if (isthreaded) - (void)_pthread_mutex_unlock(&conf_lock); return (result); } From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 21:08:03 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9250EB4C; Fri, 24 Oct 2014 21:08:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 64BBBD6E; Fri, 24 Oct 2014 21:08:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OL83O3047420; Fri, 24 Oct 2014 21:08:03 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OL83v2047419; Fri, 24 Oct 2014 21:08:03 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201410242108.s9OL83v2047419@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Fri, 24 Oct 2014 21:08:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273606 - head/sys/arm/ti/cpsw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 21:08:03 -0000 Author: loos Date: Fri Oct 24 21:08:02 2014 New Revision: 273606 URL: https://svnweb.freebsd.org/changeset/base/273606 Log: Fix cpsw_detach() to not panic when called from cpsw_attach(). For an unkown reason (at moment), sometimes if_cpsw cannot read from PHY and fails to attach calling cpsw_detach() which end up in a panic. Fix it by doing the proper check before detach the miibus and also fix the leak of few variables. And to actually make it work, ether_ifattach() has to be moved to the end of cpsw_attach() to avoid a race where calling ether_ifdetach() before domain_init() (which will only run later on) would make it crash at INP_INFO_RLOCK() on in_pcbpurgeif0(). Tested on: BBB (am335x) MFC after: 1 week Modified: head/sys/arm/ti/cpsw/if_cpsw.c Modified: head/sys/arm/ti/cpsw/if_cpsw.c ============================================================================== --- head/sys/arm/ti/cpsw/if_cpsw.c Fri Oct 24 20:29:14 2014 (r273605) +++ head/sys/arm/ti/cpsw/if_cpsw.c Fri Oct 24 21:08:02 2014 (r273606) @@ -666,9 +666,6 @@ cpsw_attach(device_t dev) sc->mac_addr[4] = reg & 0xFF; sc->mac_addr[5] = (reg >> 8) & 0xFF; - ether_ifattach(ifp, sc->mac_addr); - callout_init(&sc->watchdog.callout, 0); - /* Initialze MDIO - ENABLE, PREAMBLE=0, FAULTENB, CLKDIV=0xFF */ /* TODO Calculate MDCLK=CLK/(CLKDIV+1) */ cpsw_write_4(sc, MDIOCONTROL, 1 << 30 | 1 << 18 | 0xFF); @@ -703,6 +700,9 @@ cpsw_attach(device_t dev) return (ENXIO); } + ether_ifattach(ifp, sc->mac_addr); + callout_init(&sc->watchdog.callout, 0); + return (0); } @@ -740,15 +740,21 @@ cpsw_detach(device_t dev) } bus_generic_detach(dev); - device_delete_child(dev, sc->miibus); + if (sc->miibus) + device_delete_child(dev, sc->miibus); /* Stop and release all interrupts */ cpsw_detach_interrupts(sc); /* Free dmamaps and mbufs */ - for (i = 0; i < sizeof(sc->_slots) / sizeof(sc->_slots[0]); ++i) { + for (i = 0; i < sizeof(sc->_slots) / sizeof(sc->_slots[0]); ++i) cpsw_free_slot(sc, &sc->_slots[i]); + if (sc->null_mbuf_dmamap) { + error = bus_dmamap_destroy(sc->mbuf_dtag, sc->null_mbuf_dmamap); + KASSERT(error == 0, ("Mapping still active")); } + if (sc->null_mbuf) + m_freem(sc->null_mbuf); /* Free DMA tag */ error = bus_dma_tag_destroy(sc->mbuf_dtag); @@ -757,6 +763,9 @@ cpsw_detach(device_t dev) /* Free IO memory handler */ bus_release_resources(dev, res_spec, sc->res); + if (sc->ifp != NULL) + if_free(sc->ifp); + /* Destroy mutexes */ mtx_destroy(&sc->rx.lock); mtx_destroy(&sc->tx.lock); From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 21:08:37 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 42349CBB; Fri, 24 Oct 2014 21:08:37 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2EBDDD7C; Fri, 24 Oct 2014 21:08:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OL8bes047526; Fri, 24 Oct 2014 21:08:37 GMT (envelope-from rpaulo@FreeBSD.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OL8bgt047525; Fri, 24 Oct 2014 21:08:37 GMT (envelope-from rpaulo@FreeBSD.org) Message-Id: <201410242108.s9OL8bgt047525@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rpaulo set sender to rpaulo@FreeBSD.org using -f From: Rui Paulo Date: Fri, 24 Oct 2014 21:08:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273607 - head/sys/dev/acpica X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 21:08:37 -0000 Author: rpaulo Date: Fri Oct 24 21:08:36 2014 New Revision: 273607 URL: https://svnweb.freebsd.org/changeset/base/273607 Log: Add a sysctl to control the HPET allow_write behaviour. Requested by: kib Modified: head/sys/dev/acpica/acpi_hpet.c Modified: head/sys/dev/acpica/acpi_hpet.c ============================================================================== --- head/sys/dev/acpica/acpi_hpet.c Fri Oct 24 21:08:02 2014 (r273606) +++ head/sys/dev/acpica/acpi_hpet.c Fri Oct 24 21:08:36 2014 (r273607) @@ -760,6 +760,11 @@ hpet_attach(device_t dev) OID_AUTO, "mmap_allow", CTLFLAG_RW, &sc->mmap_allow, 0, "Allow userland to memory map HPET"); + SYSCTL_ADD_INT(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "mmap_allow_write", + CTLFLAG_RW, &sc->mmap_allow_write, 0, + "Allow userland write to the HPET register space"); } else device_printf(dev, "could not create /dev/hpet%d\n", device_get_unit(dev)); From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 21:40:45 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 805162D3; Fri, 24 Oct 2014 21:40:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6C26D131; Fri, 24 Oct 2014 21:40:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OLejUp062173; Fri, 24 Oct 2014 21:40:45 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OLejVH062172; Fri, 24 Oct 2014 21:40:45 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201410242140.s9OLejVH062172@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 24 Oct 2014 21:40:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r273608 - releng/10.1/release/doc/en_US.ISO8859-1/relnotes X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 21:40:45 -0000 Author: gjb Date: Fri Oct 24 21:40:44 2014 New Revision: 273608 URL: https://svnweb.freebsd.org/changeset/base/273608 Log: Document r273399, OpenSSL updated to version 1.0.1j. Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: releng/10.1/release/doc/en_US.ISO8859-1/relnotes/article.xml Modified: releng/10.1/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- releng/10.1/release/doc/en_US.ISO8859-1/relnotes/article.xml Fri Oct 24 21:08:36 2014 (r273607) +++ releng/10.1/release/doc/en_US.ISO8859-1/relnotes/article.xml Fri Oct 24 21:40:44 2014 (r273608) @@ -1621,9 +1621,6 @@ ldns have been updated to version 1.4.22. - OpenSSL has - been updated to version 1.0.1i. - The lite version of Subversion included in the &os; base system and its dependencies have been @@ -1666,6 +1663,9 @@ OpenPAM has been updated to Ourouparia (20140912). + + OpenSSL has + been updated to version 1.0.1j. From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 22:06:22 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C4509A67; Fri, 24 Oct 2014 22:06:22 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AFDE95F1; Fri, 24 Oct 2014 22:06:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OM6M1b075385; Fri, 24 Oct 2014 22:06:22 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OM6MxU075383; Fri, 24 Oct 2014 22:06:22 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201410242206.s9OM6MxU075383@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Fri, 24 Oct 2014 22:06:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273610 - head/sys/arm/broadcom/bcm2835 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 22:06:23 -0000 Author: loos Date: Fri Oct 24 22:06:21 2014 New Revision: 273610 URL: https://svnweb.freebsd.org/changeset/base/273610 Log: Add an iicbus_reset() method to bcm2835_bsc. While it is generally not used for kernel devices it is used by i2c(8). This fix the 'error: Device not configured' when i2c(8) tries to reset the controller, as an example: # i2c -r Resetting I2C controller on /dev/iic0: error: Device not configured For now use conservative settings for default i2c speeds. MFC after: 1 week Modified: head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c head/sys/arm/broadcom/bcm2835/bcm2835_bscvar.h Modified: head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Fri Oct 24 22:00:25 2014 (r273609) +++ head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Fri Oct 24 22:06:21 2014 (r273610) @@ -210,6 +210,8 @@ static void bcm_bsc_reset(struct bcm_bsc_softc *sc) { + /* Enable the BSC Controller, disable interrupts. */ + BCM_BSC_WRITE(sc, BCM_BSC_CTRL, BCM_BSC_CTRL_I2CEN); /* Clear pending interrupts. */ BCM_BSC_WRITE(sc, BCM_BSC_STATUS, BCM_BSC_STATUS_CLKT | BCM_BSC_STATUS_ERR | BCM_BSC_STATUS_DONE); @@ -302,7 +304,6 @@ bcm_bsc_attach(device_t dev) /* Enable the BSC controller. Flush the FIFO. */ BCM_BSC_LOCK(sc); - BCM_BSC_WRITE(sc, BCM_BSC_CTRL, BCM_BSC_CTRL_I2CEN); bcm_bsc_reset(sc); BCM_BSC_UNLOCK(sc); @@ -351,9 +352,8 @@ bcm_bsc_intr(void *arg) /* Check for errors. */ if (status & (BCM_BSC_STATUS_CLKT | BCM_BSC_STATUS_ERR)) { /* Disable interrupts. */ - BCM_BSC_WRITE(sc, BCM_BSC_CTRL, BCM_BSC_CTRL_I2CEN); - sc->sc_flags |= BCM_I2C_ERROR; bcm_bsc_reset(sc); + sc->sc_flags |= BCM_I2C_ERROR; wakeup(sc->sc_dev); BCM_BSC_UNLOCK(sc); return; @@ -375,7 +375,6 @@ bcm_bsc_intr(void *arg) if (status & BCM_BSC_STATUS_DONE) { /* Disable interrupts. */ - BCM_BSC_WRITE(sc, BCM_BSC_CTRL, BCM_BSC_CTRL_I2CEN); bcm_bsc_reset(sc); wakeup(sc->sc_dev); } @@ -459,6 +458,38 @@ bcm_bsc_transfer(device_t dev, struct ii return (err); } +static int +bcm_bsc_iicbus_reset(device_t dev, u_char speed, u_char addr, u_char *oldaddr) +{ + struct bcm_bsc_softc *sc; + uint32_t freq; + + sc = device_get_softc(dev); + BCM_BSC_LOCK(sc); + bcm_bsc_reset(sc); + freq = 0; + switch (speed) { + case IIC_SLOW: + freq = BCM_BSC_SLOW; + break; + case IIC_FAST: + freq = BCM_BSC_FAST; + break; + case IIC_FASTEST: + freq = BCM_BSC_FASTEST; + break; + case IIC_UNKNOWN: + default: + /* Reuse last frequency. */ + break; + } + if (freq != 0) + BCM_BSC_WRITE(sc, BCM_BSC_CLOCK, BCM_BSC_CORE_CLK / freq); + BCM_BSC_UNLOCK(sc); + + return (IIC_ENOADDR); +} + static phandle_t bcm_bsc_get_node(device_t bus, device_t dev) { @@ -474,6 +505,7 @@ static device_method_t bcm_bsc_methods[] DEVMETHOD(device_detach, bcm_bsc_detach), /* iicbus interface */ + DEVMETHOD(iicbus_reset, bcm_bsc_iicbus_reset), DEVMETHOD(iicbus_callback, iicbus_null_callback), DEVMETHOD(iicbus_transfer, bcm_bsc_transfer), Modified: head/sys/arm/broadcom/bcm2835/bcm2835_bscvar.h ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_bscvar.h Fri Oct 24 22:00:25 2014 (r273609) +++ head/sys/arm/broadcom/bcm2835/bcm2835_bscvar.h Fri Oct 24 22:06:21 2014 (r273610) @@ -56,6 +56,10 @@ struct bcm_bsc_softc { #define BCM_I2C_READ 0x02 #define BCM_I2C_ERROR 0x04 +#define BCM_BSC_SLOW 10000 /* 10 kHz. */ +#define BCM_BSC_FAST 50000 /* 50 kHz. */ +#define BCM_BSC_FASTEST 100000 /* 100 kHz. */ + #define BCM_BSC_WRITE(_sc, _off, _val) \ bus_space_write_4(_sc->sc_bst, _sc->sc_bsh, _off, _val) #define BCM_BSC_READ(_sc, _off) \ From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 23:24:48 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 27A76B5F; Fri, 24 Oct 2014 23:24:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 13F13D3F; Fri, 24 Oct 2014 23:24:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9ONOlvO013612; Fri, 24 Oct 2014 23:24:47 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9ONOlYs013611; Fri, 24 Oct 2014 23:24:47 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201410242324.s9ONOlYs013611@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Fri, 24 Oct 2014 23:24:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273612 - head/lib/libc/rpc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 23:24:48 -0000 Author: brooks Date: Fri Oct 24 23:24:47 2014 New Revision: 273612 URL: https://svnweb.freebsd.org/changeset/base/273612 Log: Remove an unused variable that would be better spelled __func__. Sponsored by: DARPA, AFRL Modified: head/lib/libc/rpc/clnt_vc.c Modified: head/lib/libc/rpc/clnt_vc.c ============================================================================== --- head/lib/libc/rpc/clnt_vc.c Fri Oct 24 23:08:44 2014 (r273611) +++ head/lib/libc/rpc/clnt_vc.c Fri Oct 24 23:24:47 2014 (r273612) @@ -141,7 +141,6 @@ static cond_t *vc_cv; static const char clnt_vc_errstr[] = "%s : %s"; static const char clnt_vc_str[] = "clnt_vc_create"; -static const char clnt_read_vc_str[] = "read_vc"; static const char __no_mem_str[] = "out of memory"; /* From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 23:25:12 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CBEE2C9B; Fri, 24 Oct 2014 23:25:12 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B8417D44; Fri, 24 Oct 2014 23:25:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9ONPCOf013746; Fri, 24 Oct 2014 23:25:12 GMT (envelope-from rpaulo@FreeBSD.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9ONPC0a013745; Fri, 24 Oct 2014 23:25:12 GMT (envelope-from rpaulo@FreeBSD.org) Message-Id: <201410242325.s9ONPC0a013745@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rpaulo set sender to rpaulo@FreeBSD.org using -f From: Rui Paulo Date: Fri, 24 Oct 2014 23:25:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273613 - head/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 23:25:12 -0000 Author: rpaulo Date: Fri Oct 24 23:25:11 2014 New Revision: 273613 URL: https://svnweb.freebsd.org/changeset/base/273613 Log: Fix the build by installing acpi_hpet.h correctly. Submitted by: jase MFC after: 1 week Modified: head/include/Makefile Modified: head/include/Makefile ============================================================================== --- head/include/Makefile Fri Oct 24 23:24:47 2014 (r273612) +++ head/include/Makefile Fri Oct 24 23:25:11 2014 (r273613) @@ -158,7 +158,7 @@ copies: .endfor cd ${.CURDIR}/../sys/dev/acpica; \ ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \ - ${DESTDIR}${INCLUDEDIR}/dev/acpica + ${DESTDIR}${INCLUDEDIR}/dev/acpica; \ ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpi_hpet.h \ ${DESTDIR}${INCLUDEDIR}/dev/acpica cd ${.CURDIR}/../sys/dev/agp; \ From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 23:25:45 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BB9CBDD8; Fri, 24 Oct 2014 23:25:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A79ECD49; Fri, 24 Oct 2014 23:25:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9ONPjGL013856; Fri, 24 Oct 2014 23:25:45 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9ONPjF8013855; Fri, 24 Oct 2014 23:25:45 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201410242325.s9ONPjF8013855@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Fri, 24 Oct 2014 23:25:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273614 - head/lib/libc/stdlib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 23:25:45 -0000 Author: brooks Date: Fri Oct 24 23:25:44 2014 New Revision: 273614 URL: https://svnweb.freebsd.org/changeset/base/273614 Log: Use the __DECONST macro rather than hand rolling the same thing. Sponsored by: DARPA, AFRL Modified: head/lib/libc/stdlib/lsearch.c Modified: head/lib/libc/stdlib/lsearch.c ============================================================================== --- head/lib/libc/stdlib/lsearch.c Fri Oct 24 23:25:11 2014 (r273613) +++ head/lib/libc/stdlib/lsearch.c Fri Oct 24 23:25:44 2014 (r273614) @@ -39,11 +39,7 @@ lwork(const void *key, const void *base, { uint8_t *ep, *endp; - /* - * Cast to an integer value first to avoid the warning for removing - * 'const' via a cast. - */ - ep = (uint8_t *)(uintptr_t)base; + ep = __DECONST(uint8_t *, base); for (endp = (uint8_t *)(ep + width * *nelp); ep < endp; ep += width) { if (compar(key, ep) == 0) return (ep); From owner-svn-src-all@FreeBSD.ORG Sat Oct 25 00:14:45 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 584746A4; Sat, 25 Oct 2014 00:14:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4467F1EC; Sat, 25 Oct 2014 00:14:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9P0Ejub038220; Sat, 25 Oct 2014 00:14:45 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9P0EiRs038218; Sat, 25 Oct 2014 00:14:44 GMT (envelope-from np@FreeBSD.org) Message-Id: <201410250014.s9P0EiRs038218@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Sat, 25 Oct 2014 00:14:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273615 - head/sys/dev/cxgbe/firmware X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 00:14:45 -0000 Author: np Date: Sat Oct 25 00:14:44 2014 New Revision: 273615 URL: https://svnweb.freebsd.org/changeset/base/273615 Log: cxgbe(4): bump up PF4's share of some global resources. This increases the size of the per-port RSS slice and also allows the driver to use a larger number of tx and rx queues. MFC after: 2 weeks Modified: head/sys/dev/cxgbe/firmware/t4fw_cfg.txt head/sys/dev/cxgbe/firmware/t5fw_cfg.txt Modified: head/sys/dev/cxgbe/firmware/t4fw_cfg.txt ============================================================================== --- head/sys/dev/cxgbe/firmware/t4fw_cfg.txt Fri Oct 24 23:25:44 2014 (r273614) +++ head/sys/dev/cxgbe/firmware/t4fw_cfg.txt Sat Oct 25 00:14:44 2014 (r273615) @@ -41,26 +41,34 @@ [function "0"] nvf = 16 nvi = 1 + rssnvi = 0 [function "0/*"] nvi = 1 + rssnvi = 0 [function "1"] nvf = 16 nvi = 1 + rssnvi = 0 [function "1/*"] nvi = 1 + rssnvi = 0 [function "2"] nvf = 16 nvi = 1 + rssnvi = 0 [function "2/*"] nvi = 1 + rssnvi = 0 [function "3"] nvf = 16 nvi = 1 + rssnvi = 0 [function "3/*"] nvi = 1 + rssnvi = 0 # PF4 is the resource-rich PF that the bus/nexus driver attaches to. # It gets 32 MSI/128 MSI-X vectors. @@ -68,9 +76,10 @@ wx_caps = all r_caps = all nvi = 32 - niqflint = 256 - nethctrl = 128 - neq = 256 + rssnvi = 8 + niqflint = 512 + nethctrl = 1024 + neq = 2048 nexactf = 328 cmask = all pmask = all @@ -94,11 +103,13 @@ # Not used right now. [function "5"] nvi = 1 + rssnvi = 0 # PF6 is the FCoE Controller PF. It gets 32 MSI/40 MSI-X vectors. # Not used right now. [function "6"] nvi = 1 + rssnvi = 0 # The following function, 1023, is not an actual PCIE function but is used to # configure and reserve firmware internal resources that come from the global @@ -107,6 +118,7 @@ wx_caps = all r_caps = all nvi = 4 + rssnvi = 0 cmask = all pmask = all nexactf = 8 @@ -148,7 +160,7 @@ [fini] version = 0x1 - checksum = 0x6f516705 + checksum = 0x6a1f8858 # # $FreeBSD$ # Modified: head/sys/dev/cxgbe/firmware/t5fw_cfg.txt ============================================================================== --- head/sys/dev/cxgbe/firmware/t5fw_cfg.txt Fri Oct 24 23:25:44 2014 (r273614) +++ head/sys/dev/cxgbe/firmware/t5fw_cfg.txt Sat Oct 25 00:14:44 2014 (r273615) @@ -5,7 +5,7 @@ # niqflint = 1023 ingress queues with freelists and/or interrupts # nethctrl = 64K Ethernet or ctrl egress queues # neq = 64K egress queues of all kinds, including freelists -# nexactf = 336 MPS TCAM entries, can oversubscribe. +# nexactf = 512 MPS TCAM entries, can oversubscribe. # [global] @@ -54,26 +54,34 @@ [function "0"] nvf = 16 nvi = 1 + rssnvi = 0 [function "0/*"] nvi = 1 + rssnvi = 0 [function "1"] nvf = 16 nvi = 1 + rssnvi = 0 [function "1/*"] nvi = 1 + rssnvi = 0 [function "2"] nvf = 16 nvi = 1 + rssnvi = 0 [function "2/*"] nvi = 1 + rssnvi = 0 [function "3"] nvf = 16 nvi = 1 + rssnvi = 0 [function "3/*"] nvi = 1 + rssnvi = 0 # PF4 is the resource-rich PF that the bus/nexus driver attaches to. # It gets 32 MSI/128 MSI-X vectors. @@ -81,9 +89,10 @@ wx_caps = all r_caps = all nvi = 32 - niqflint = 256 - nethctrl = 128 - neq = 256 + rssnvi = 8 + niqflint = 512 + nethctrl = 1024 + neq = 2048 nexactf = 328 cmask = all pmask = all @@ -107,11 +116,13 @@ # Not used right now. [function "5"] nvi = 1 + rssnvi = 0 # PF6 is the FCoE Controller PF. It gets 32 MSI/40 MSI-X vectors. # Not used right now. [function "6"] nvi = 1 + rssnvi = 0 # The following function, 1023, is not an actual PCIE function but is used to # configure and reserve firmware internal resources that come from the global @@ -120,6 +131,7 @@ wx_caps = all r_caps = all nvi = 4 + rssnvi = 0 cmask = all pmask = all nexactf = 8 @@ -161,7 +173,7 @@ [fini] version = 0x1 - checksum = 0x9f27febc + checksum = 0xa0ee1715 # # $FreeBSD$ # From owner-svn-src-all@FreeBSD.ORG Sat Oct 25 00:16:36 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E8017887; Sat, 25 Oct 2014 00:16:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D3F71206; Sat, 25 Oct 2014 00:16:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9P0Gage038543; Sat, 25 Oct 2014 00:16:36 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9P0Gaq4038542; Sat, 25 Oct 2014 00:16:36 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410250016.s9P0Gaq4038542@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sat, 25 Oct 2014 00:16:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273616 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 00:16:37 -0000 Author: delphij Date: Sat Oct 25 00:16:36 2014 New Revision: 273616 URL: https://svnweb.freebsd.org/changeset/base/273616 Log: Fix build. Modified: head/sys/kern/kern_umtx.c Modified: head/sys/kern/kern_umtx.c ============================================================================== --- head/sys/kern/kern_umtx.c Sat Oct 25 00:14:44 2014 (r273615) +++ head/sys/kern/kern_umtx.c Sat Oct 25 00:16:36 2014 (r273616) @@ -2895,7 +2895,7 @@ do_sem2_wake(struct thread *td, struct _ */ if (cnt == 1) { umtxq_unlock(&key); - count = fuword32(&sem->_count); + count = fuword32(__DEVOLATILE(void *, &sem->_count)); while (count != -1 && count & USEM_HAS_WAITERS) count = casuword32(&sem->_count, count, count & ~USEM_HAS_WAITERS); From owner-svn-src-all@FreeBSD.ORG Sat Oct 25 00:32:06 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AE0ECBA0; Sat, 25 Oct 2014 00:32:06 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 811A43FB; Sat, 25 Oct 2014 00:32:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9P0W6Bd047324; Sat, 25 Oct 2014 00:32:06 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9P0W6gu047323; Sat, 25 Oct 2014 00:32:06 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410250032.s9P0W6gu047323@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sat, 25 Oct 2014 00:32:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r273617 - vendor/netcat/dist X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 00:32:06 -0000 Author: delphij Date: Sat Oct 25 00:32:05 2014 New Revision: 273617 URL: https://svnweb.freebsd.org/changeset/base/273617 Log: Vendor import nc(1) from OPENBSD_5_6. Modified: vendor/netcat/dist/netcat.c Modified: vendor/netcat/dist/netcat.c ============================================================================== --- vendor/netcat/dist/netcat.c Sat Oct 25 00:16:36 2014 (r273616) +++ vendor/netcat/dist/netcat.c Sat Oct 25 00:32:05 2014 (r273617) @@ -1,4 +1,4 @@ -/* $OpenBSD: netcat.c,v 1.117 2013/10/26 21:33:29 sthen Exp $ */ +/* $OpenBSD: netcat.c,v 1.122 2014/07/20 01:38:40 guenther Exp $ */ /* * Copyright (c) 2001 Eric Jackson * @@ -133,7 +133,6 @@ main(int argc, char *argv[]) host = NULL; uport = NULL; sv = NULL; - rtableid = getrtable(); while ((ch = getopt(argc, argv, "46DdFhI:i:klNnO:P:p:rSs:tT:UuV:vw:X:x:z")) != -1) { @@ -609,7 +608,7 @@ remote_connect(const char *host, const c if (bind(s, (struct sockaddr *)ares->ai_addr, ares->ai_addrlen) < 0) - errx(1, "bind failed: %s", strerror(errno)); + err(1, "bind failed"); freeaddrinfo(ares); } @@ -698,7 +697,7 @@ local_listen(char *host, char *port, str res0->ai_protocol)) < 0) continue; - if (rtableid >= 0 && (setsockopt(s, IPPROTO_IP, SO_RTABLE, + if (rtableid >= 0 && (setsockopt(s, SOL_SOCKET, SO_RTABLE, &rtableid, sizeof(rtableid)) == -1)) err(1, "setsockopt SO_RTABLE"); @@ -734,12 +733,12 @@ void readwrite(int nfd) { struct pollfd pfd[2]; - unsigned char buf[16384]; + unsigned char buf[16 * 1024]; int n, wfd = fileno(stdin); int lfd = fileno(stdout); int plen; - plen = 2048; + plen = sizeof(buf); /* Setup Network FD */ pfd[0].fd = nfd; @@ -754,8 +753,9 @@ readwrite(int nfd) sleep(iflag); if ((n = poll(pfd, 2 - dflag, timeout)) < 0) { + int saved_errno = errno; close(nfd); - err(1, "Polling Error"); + errc(1, saved_errno, "Polling Error"); } if (n == 0) From owner-svn-src-all@FreeBSD.ORG Sat Oct 25 00:32:31 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6C6C1CC5; Sat, 25 Oct 2014 00:32:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3F1A93FE; Sat, 25 Oct 2014 00:32:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9P0WVTR047416; Sat, 25 Oct 2014 00:32:31 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9P0WV40047415; Sat, 25 Oct 2014 00:32:31 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410250032.s9P0WV40047415@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sat, 25 Oct 2014 00:32:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r273618 - vendor/netcat/5.6 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 00:32:31 -0000 Author: delphij Date: Sat Oct 25 00:32:30 2014 New Revision: 273618 URL: https://svnweb.freebsd.org/changeset/base/273618 Log: Tag netcat from OpenBSD 5.6. Added: vendor/netcat/5.6/ - copied from r273617, vendor/netcat/dist/ From owner-svn-src-all@FreeBSD.ORG Sat Oct 25 00:37:36 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 32612E64; Sat, 25 Oct 2014 00:37:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 04C735FB; Sat, 25 Oct 2014 00:37:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9P0bZBv048108; Sat, 25 Oct 2014 00:37:35 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9P0bZUo048107; Sat, 25 Oct 2014 00:37:35 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410250037.s9P0bZUo048107@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sat, 25 Oct 2014 00:37:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273619 - head/contrib/netcat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 00:37:36 -0000 Author: delphij Date: Sat Oct 25 00:37:35 2014 New Revision: 273619 URL: https://svnweb.freebsd.org/changeset/base/273619 Log: MFV r273617: netcat from OpenBSD 5.6. MFC after: 2 weeks Modified: head/contrib/netcat/netcat.c Directory Properties: head/contrib/netcat/ (props changed) Modified: head/contrib/netcat/netcat.c ============================================================================== --- head/contrib/netcat/netcat.c Sat Oct 25 00:32:30 2014 (r273618) +++ head/contrib/netcat/netcat.c Sat Oct 25 00:37:35 2014 (r273619) @@ -1,4 +1,4 @@ -/* $OpenBSD: netcat.c,v 1.117 2013/10/26 21:33:29 sthen Exp $ */ +/* $OpenBSD: netcat.c,v 1.122 2014/07/20 01:38:40 guenther Exp $ */ /* * Copyright (c) 2001 Eric Jackson * @@ -155,9 +155,6 @@ main(int argc, char *argv[]) host = NULL; uport = NULL; sv = NULL; -#if 0 - rtableid = getrtable(); -#endif while ((ch = getopt_long(argc, argv, "46DdEe:FhI:i:klNnoO:P:p:rSs:tT:UuV:vw:X:x:z", @@ -662,7 +659,7 @@ remote_connect(const char *host, const c if (bind(s, (struct sockaddr *)ares->ai_addr, ares->ai_addrlen) < 0) - errx(1, "bind failed: %s", strerror(errno)); + err(1, "bind failed"); freeaddrinfo(ares); } @@ -751,7 +748,7 @@ local_listen(char *host, char *port, str res0->ai_protocol)) < 0) continue; - if (rtableid >= 0 && (setsockopt(s, IPPROTO_IP, SO_SETFIB, + if (rtableid >= 0 && (setsockopt(s, SOL_SOCKET, SO_SETFIB, &rtableid, sizeof(rtableid)) == -1)) err(1, "setsockopt SO_SETFIB"); @@ -796,12 +793,12 @@ void readwrite(int nfd) { struct pollfd pfd[2]; - unsigned char buf[16384]; + unsigned char buf[16 * 1024]; int n, wfd = fileno(stdin); int lfd = fileno(stdout); int plen; - plen = 2048; + plen = sizeof(buf); /* Setup Network FD */ pfd[0].fd = nfd; @@ -816,8 +813,9 @@ readwrite(int nfd) sleep(iflag); if ((n = poll(pfd, 2 - dflag, timeout)) < 0) { + int saved_errno = errno; close(nfd); - err(1, "Polling Error"); + errc(1, saved_errno, "Polling Error"); } if (n == 0) From owner-svn-src-all@FreeBSD.ORG Sat Oct 25 01:17:30 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CFEDB2AA; Sat, 25 Oct 2014 01:17:30 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A1FB896E; Sat, 25 Oct 2014 01:17:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9P1HUaV066780; Sat, 25 Oct 2014 01:17:30 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9P1HUAl066779; Sat, 25 Oct 2014 01:17:30 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201410250117.s9P1HUAl066779@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Sat, 25 Oct 2014 01:17:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r273620 - releng/10.1/release/doc/en_US.ISO8859-1/errata X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 01:17:30 -0000 Author: gjb Date: Sat Oct 25 01:17:29 2014 New Revision: 273620 URL: https://svnweb.freebsd.org/changeset/base/273620 Log: Note to avoid using GENERIC kernel on i386 when using multi-disk ZFS pools, referencing an old UPDATING entry that predates 10.0-RELEASE. Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: releng/10.1/release/doc/en_US.ISO8859-1/errata/article.xml Modified: releng/10.1/release/doc/en_US.ISO8859-1/errata/article.xml ============================================================================== --- releng/10.1/release/doc/en_US.ISO8859-1/errata/article.xml Sat Oct 25 00:37:35 2014 (r273619) +++ releng/10.1/release/doc/en_US.ISO8859-1/errata/article.xml Sat Oct 25 01:17:29 2014 (r273620) @@ -132,6 +132,49 @@ boot instability may be present on virtual machines running on other hypervisors, such as Xen or KVM. + + + &os;/&arch.i386; &release.current; configured with + a multi-disk ZFS dataset (mirror, raidz1, raidz2, raidz3) + may crash during boot when the ZFS pool mount is attempted + while booting an unmodified GENERIC + kernel. + + As described in /usr/src/UPDATING + entry 20121223, rebuilding the kernel + with options KSTACK_PAGES=4 has been + observed to resolve the boot-time crash. This, however, is + not an ideal solution for inclusion in the + GENERIC kernel configuration, as + increasing KSTACK_PAGES implicitly + decreases available usermode threads in an environment that + is already resource-starved. + + Taking into account the heavy resource requirements of + ZFS, in addition to the &arch.i386;-specific tuning + requirements for general workloads, using ZFS with the + &os;/&arch.i386; GENERIC kernel + is strongly discouraged. + + + It is extremely important to take note that, by + default, &man.freebsd-update.8; will install the + GENERIC kernel configuration, and + as such, &man.freebsd-update.8; consumers are strongly + encouraged to avoid &os;-provided kernel binary upgrades + with such configurations. + + + + Although there is slight change in how the crash + manifests on &os;/&arch.i386; between &release.prev; and + &release.current;, and given the date of the + /usr/src/UPDATING entry, there is no + evidence suggesting this is a regression between + &os; &release.prev; and &os; &release.current; + directly. + + From owner-svn-src-all@FreeBSD.ORG Sat Oct 25 01:36:36 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C348F683; Sat, 25 Oct 2014 01:36:36 +0000 (UTC) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 2061AAE8; Sat, 25 Oct 2014 01:36:36 +0000 (UTC) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 7C83225D3A92; Sat, 25 Oct 2014 01:36:32 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id A4AE8C77020; Sat, 25 Oct 2014 01:36:31 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id EFw2k0eHRWzO; Sat, 25 Oct 2014 01:36:27 +0000 (UTC) Received: from [IPv6:fde9:577b:c1a9:4410:9d45:f8c9:ce47:f6c6] (unknown [IPv6:fde9:577b:c1a9:4410:9d45:f8c9:ce47:f6c6]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id B7671C76FD6; Sat, 25 Oct 2014 01:36:25 +0000 (UTC) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: svn commit: r273604 - in head: include lib/libc/gen sys/kern sys/sys usr.bin/truss From: "Bjoern A. Zeeb" In-Reply-To: <201410242002.s9OK2i3w018818@svn.freebsd.org> Date: Sat, 25 Oct 2014 01:35:22 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <88B273DE-C9EB-4C11-AE9E-0136BC2324C2@FreeBSD.org> References: <201410242002.s9OK2i3w018818@svn.freebsd.org> To: John Baldwin X-Mailer: Apple Mail (2.1878.6) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 01:36:37 -0000 On 24 Oct 2014, at 20:02 , John Baldwin wrote: > Author: jhb > Date: Fri Oct 24 20:02:44 2014 > New Revision: 273604 > URL: https://svnweb.freebsd.org/changeset/base/273604 >=20 > Log: > The current POSIX semaphore implementation stores the _has_waiters = flag > in a separate word from the _count. This does not permit both items = to > be updated atomically in a portable manner. As a result, sem_post() > must always perform a system call to safely clear _has_waiters. >=20 > This change removes the _has_waiters field and instead uses the high = bit > of _count as the _has_waiters flag. A new umtx object type (_usem2) = and > two new umtx operations are added (SEM_WAIT2 and SEM_WAKE2) to = implement > these semantics. The older operations are still supported under the > COMPAT_FREEBSD9/10 options. The POSIX semaphore API in libc has > been updated to use the new implementation. Note that the new > implementation is not compatible with the previous implementation. > However, this only affects static binaries (which cannot be helped by > symbol versioning). Binaries using a dynamic libc will continue to = work > fine. SEM_MAGIC has been bumped so that mismatched binaries will = error > rather than corrupting a shared semaphore. In addition, a padding = field > has been added to sem_t so that it remains the same size. >=20 > Differential Revision: https://reviews.freebsd.org/D961 > Reported by: adrian > Reviewed by: kib, jilles (earlier version) > Sponsored by: Norse >=20 > Modified: > head/include/semaphore.h > head/lib/libc/gen/sem_new.c > head/sys/kern/kern_umtx.c > head/sys/sys/_umtx.h > head/sys/sys/umtx.h > head/usr.bin/truss/syscalls.c >=20 Has anyone fixed this: /scratch/tmp/bz/head.svn/sys/kern/kern_umtx.c:2898:21: error: passing = 'volatile __uint32_t *' (aka 'volatile unsigned int *') to parameter of = type 'const void *' discards qualifiers = [-Werror,-Wincompatible-pointer-types-discards-qualifier s] count =3D fuword32(&sem->_count); ^~~~~~~~~~~~ /scratch/tmp/bz/head.svn/sys/sys/systm.h:258:30: note: passing argument = to parameter 'base' here int32_t fuword32(const void *base); ^ 1 error generated. --- kern_umtx.o --- *** [kern_umtx.o] Error code 1 cc1: warnings being treated as errors /scratch/tmp/bz/head.svn/sys/kern/kern_umtx.c: In function = 'do_sem2_wake': /scratch/tmp/bz/head.svn/sys/kern/kern_umtx.c:2898: warning: passing = argument 1 of 'fuword32' discards qualifiers from pointer target type --- kern_umtx.o --- *** [kern_umtx.o] Error code 1 > Modified: head/sys/kern/kern_umtx.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/kern/kern_umtx.c Fri Oct 24 19:58:24 2014 = (r273603) > +++ head/sys/kern/kern_umtx.c Fri Oct 24 20:02:44 2014 = (r273604) > @@ -2710,6 +2710,7 @@ out: > return (error); > } >=20 > +#if defined(COMPAT_FREEBSD9) || defined(COMPAT_FREEBSD10) > static int > do_sem_wait(struct thread *td, struct _usem *sem, struct _umtx_time = *timeout) > { > @@ -2731,7 +2732,7 @@ do_sem_wait(struct thread *td, struct _u > umtxq_busy(&uq->uq_key); > umtxq_insert(uq); > umtxq_unlock(&uq->uq_key); > - casuword32(__DEVOLATILE(uint32_t *, &sem->_has_waiters), 0, 1); > + casuword32(&sem->_has_waiters, 0, 1); > count =3D fuword32(__DEVOLATILE(uint32_t *, &sem->_count)); > if (count !=3D 0) { > umtxq_lock(&uq->uq_key); > @@ -2761,7 +2762,7 @@ do_sem_wait(struct thread *td, struct _u > } >=20 > /* > - * Signal a userland condition variable. > + * Signal a userland semaphore. > */ > static int > do_sem_wake(struct thread *td, struct _usem *sem) > @@ -2795,6 +2796,119 @@ do_sem_wake(struct thread *td, struct _u > umtx_key_release(&key); > return (error); > } > +#endif > + > +static int > +do_sem2_wait(struct thread *td, struct _usem2 *sem, struct _umtx_time = *timeout) > +{ > + struct abs_timeout timo; > + struct umtx_q *uq; > + uint32_t count, flags; > + int error; > + > + uq =3D td->td_umtxq; > + flags =3D fuword32(&sem->_flags); > + error =3D umtx_key_get(sem, TYPE_SEM, GET_SHARE(flags), = &uq->uq_key); > + if (error !=3D 0) > + return (error); > + > + if (timeout !=3D NULL) > + abs_timeout_init2(&timo, timeout); > + > + umtxq_lock(&uq->uq_key); > + umtxq_busy(&uq->uq_key); > + umtxq_insert(uq); > + umtxq_unlock(&uq->uq_key); > + count =3D fuword32(__DEVOLATILE(uint32_t *, &sem->_count)); > + if (count =3D=3D -1) { > + umtxq_lock(&uq->uq_key); > + umtxq_unbusy(&uq->uq_key); > + umtxq_remove(uq); > + umtxq_unlock(&uq->uq_key); > + umtx_key_release(&uq->uq_key); > + return (EFAULT); > + } > + for (;;) { > + if (USEM_COUNT(count) !=3D 0) { > + umtxq_lock(&uq->uq_key); > + umtxq_unbusy(&uq->uq_key); > + umtxq_remove(uq); > + umtxq_unlock(&uq->uq_key); > + umtx_key_release(&uq->uq_key); > + return (0); > + } > + if (count =3D=3D USEM_HAS_WAITERS) > + break; > + count =3D casuword32(&sem->_count, 0, USEM_HAS_WAITERS); > + if (count =3D=3D -1) { > + umtxq_lock(&uq->uq_key); > + umtxq_unbusy(&uq->uq_key); > + umtxq_remove(uq); > + umtxq_unlock(&uq->uq_key); > + umtx_key_release(&uq->uq_key); > + return (EFAULT); > + } > + if (count =3D=3D 0) > + break; > + } > + umtxq_lock(&uq->uq_key); > + umtxq_unbusy(&uq->uq_key); > + > + error =3D umtxq_sleep(uq, "usem", timeout =3D=3D NULL ? NULL : = &timo); > + > + if ((uq->uq_flags & UQF_UMTXQ) =3D=3D 0) > + error =3D 0; > + else { > + umtxq_remove(uq); > + /* A relative timeout cannot be restarted. */ > + if (error =3D=3D ERESTART && timeout !=3D NULL && > + (timeout->_flags & UMTX_ABSTIME) =3D=3D 0) > + error =3D EINTR; > + } > + umtxq_unlock(&uq->uq_key); > + umtx_key_release(&uq->uq_key); > + return (error); > +} > + > +/* > + * Signal a userland semaphore. > + */ > +static int > +do_sem2_wake(struct thread *td, struct _usem2 *sem) > +{ > + struct umtx_key key; > + int error, cnt; > + uint32_t count, flags; > + > + flags =3D fuword32(&sem->_flags); > + if ((error =3D umtx_key_get(sem, TYPE_SEM, GET_SHARE(flags), = &key)) !=3D 0) > + return (error);=09 > + umtxq_lock(&key); > + umtxq_busy(&key); > + cnt =3D umtxq_count(&key); > + if (cnt > 0) { > + umtxq_signal(&key, 1); > + > + /* > + * If this was the last sleeping thread, clear the = waiters > + * flag in _count. > + */ > + if (cnt =3D=3D 1) { > + umtxq_unlock(&key); > + count =3D fuword32(&sem->_count); > + while (count !=3D -1 && count & = USEM_HAS_WAITERS) > + count =3D casuword32(&sem->_count, = count, > + count & ~USEM_HAS_WAITERS); > + if (count =3D=3D -1) > + error =3D EFAULT; > + umtxq_lock(&key); > + } > + } > + umtxq_unbusy(&key); > + umtxq_unlock(&key); > + umtx_key_release(&key); > + return (error); > +} >=20 > inline int > umtx_copyin_timeout(const void *addr, struct timespec *tsp) > @@ -3066,6 +3180,7 @@ __umtx_op_rw_unlock(struct thread *td, s > return do_rw_unlock(td, uap->obj); > } >=20 > +#if defined(COMPAT_FREEBSD9) || defined(COMPAT_FREEBSD10) > static int > __umtx_op_sem_wait(struct thread *td, struct _umtx_op_args *uap) > { > @@ -3090,6 +3205,7 @@ __umtx_op_sem_wake(struct thread *td, st > { > return do_sem_wake(td, uap->obj); > } > +#endif >=20 > static int > __umtx_op_wake2_umutex(struct thread *td, struct _umtx_op_args *uap) > @@ -3097,6 +3213,31 @@ __umtx_op_wake2_umutex(struct thread *td > return do_wake2_umutex(td, uap->obj, uap->val); > } >=20 > +static int > +__umtx_op_sem2_wait(struct thread *td, struct _umtx_op_args *uap) > +{ > + struct _umtx_time *tm_p, timeout; > + int error; > + > + /* Allow a null timespec (wait forever). */ > + if (uap->uaddr2 =3D=3D NULL) > + tm_p =3D NULL; > + else { > + error =3D umtx_copyin_umtx_time( > + uap->uaddr2, (size_t)uap->uaddr1, &timeout); > + if (error !=3D 0) > + return (error); > + tm_p =3D &timeout; > + } > + return (do_sem2_wait(td, uap->obj, tm_p)); > +} > + > +static int > +__umtx_op_sem2_wake(struct thread *td, struct _umtx_op_args *uap) > +{ > + return do_sem2_wake(td, uap->obj); > +} > + > typedef int (*_umtx_op_func)(struct thread *td, struct _umtx_op_args = *uap); >=20 > static _umtx_op_func op_table[] =3D { > @@ -3119,10 +3260,17 @@ static _umtx_op_func op_table[] =3D { > __umtx_op_wake_private, /* UMTX_OP_WAKE_PRIVATE */ > __umtx_op_wait_umutex, /* UMTX_OP_MUTEX_WAIT */ > __umtx_op_wake_umutex, /* UMTX_OP_MUTEX_WAKE */ > +#if defined(COMPAT_FREEBSD9) || defined(COMPAT_FREEBSD10) > __umtx_op_sem_wait, /* UMTX_OP_SEM_WAIT */ > __umtx_op_sem_wake, /* UMTX_OP_SEM_WAKE */ > +#else > + __umtx_op_unimpl, /* UMTX_OP_SEM_WAIT */ > + __umtx_op_unimpl, /* UMTX_OP_SEM_WAKE */ > +#endif > __umtx_op_nwake_private, /* UMTX_OP_NWAKE_PRIVATE */ > - __umtx_op_wake2_umutex /* UMTX_OP_MUTEX_WAKE2 */ > + __umtx_op_wake2_umutex, /* UMTX_OP_MUTEX_WAKE2 */ > + __umtx_op_sem2_wait, /* UMTX_OP_SEM2_WAIT */ > + __umtx_op_sem2_wake, /* UMTX_OP_SEM2_WAKE */ > }; >=20 > int > @@ -3320,6 +3468,7 @@ __umtx_op_wait_uint_private_compat32(str > return do_wait(td, uap->obj, uap->val, tm_p, 1, 1); > } >=20 > +#if defined(COMPAT_FREEBSD9) || defined(COMPAT_FREEBSD10) > static int > __umtx_op_sem_wait_compat32(struct thread *td, struct _umtx_op_args = *uap) > { > @@ -3338,6 +3487,26 @@ __umtx_op_sem_wait_compat32(struct threa > } > return (do_sem_wait(td, uap->obj, tm_p)); > } > +#endif > + > +static int > +__umtx_op_sem2_wait_compat32(struct thread *td, struct _umtx_op_args = *uap) > +{ > + struct _umtx_time *tm_p, timeout; > + int error; > + > + /* Allow a null timespec (wait forever). */ > + if (uap->uaddr2 =3D=3D NULL) > + tm_p =3D NULL; > + else { > + error =3D umtx_copyin_umtx_time32(uap->uaddr2, > + (size_t)uap->uaddr1, &timeout); > + if (error !=3D 0) > + return (error); > + tm_p =3D &timeout; > + } > + return (do_sem2_wait(td, uap->obj, tm_p)); > +} >=20 > static int > __umtx_op_nwake_private32(struct thread *td, struct _umtx_op_args = *uap) > @@ -3385,10 +3554,17 @@ static _umtx_op_func op_table_compat32[] > __umtx_op_wake_private, /* UMTX_OP_WAKE_PRIVATE */ > __umtx_op_wait_umutex_compat32, /* UMTX_OP_MUTEX_WAIT */ > __umtx_op_wake_umutex, /* UMTX_OP_MUTEX_WAKE */ > +#if defined(COMPAT_FREEBSD9) || defined(COMPAT_FREEBSD10) > __umtx_op_sem_wait_compat32, /* UMTX_OP_SEM_WAIT */ > __umtx_op_sem_wake, /* UMTX_OP_SEM_WAKE */ > +#else > + __umtx_op_unimpl, /* UMTX_OP_SEM_WAIT */ > + __umtx_op_unimpl, /* UMTX_OP_SEM_WAKE */ > +#endif > __umtx_op_nwake_private32, /* UMTX_OP_NWAKE_PRIVATE */ > - __umtx_op_wake2_umutex /* UMTX_OP_MUTEX_WAKE2 */ > + __umtx_op_wake2_umutex, /* UMTX_OP_MUTEX_WAKE2 */ > + __umtx_op_sem2_wait_compat32, /* UMTX_OP_SEM2_WAIT */ > + __umtx_op_sem2_wake, /* UMTX_OP_SEM2_WAKE */ > }; >=20 > int =97=20 Bjoern A. Zeeb "Come on. Learn, goddamn it.", WarGames, 1983 From owner-svn-src-all@FreeBSD.ORG Sat Oct 25 01:38:59 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 976747FF; Sat, 25 Oct 2014 01:38:59 +0000 (UTC) Received: from mail-ig0-x235.google.com (mail-ig0-x235.google.com [IPv6:2607:f8b0:4001:c05::235]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5D376AFC; Sat, 25 Oct 2014 01:38:59 +0000 (UTC) Received: by mail-ig0-f181.google.com with SMTP id l13so1443224iga.14 for ; Fri, 24 Oct 2014 18:38:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=JjpTQ2kTSQpN8tj7u7SQ3BhUBnVTGeTn2bHe8nelu5A=; b=dm4Fsmbwvi23PxXowcFs7MIIXWT2Mh70lM+BtYyyaIUewTEAEPy1Ig+TEzc57NrZWm nZ11S9qc+taGb9Li3PQg6I16b5GMPIi6/in+dSa8uhk3MoGkou1ZccYNzvKTJ2bRWDiF rrtKqdQM7//81t59AgrgvdbPYnM4WuQmhfTErdukzVSFG/4ppLf2Lliex1gcnixomKnt Ku3+4wLC10XF/b/DQ2i/EEARTq+R8gDrI6EO03yAW2djThGZ+/C2eWKTiwmD7T1k9fkZ 5W7+jbA/Lc7fv+9nc7E1xkNz5DSuk8rLXN7LMmz40xv83FOpvPr/C1hHtrAyErU7IBkU iBFQ== MIME-Version: 1.0 X-Received: by 10.43.90.198 with SMTP id bj6mr6596527icc.4.1414201138854; Fri, 24 Oct 2014 18:38:58 -0700 (PDT) Received: by 10.50.193.135 with HTTP; Fri, 24 Oct 2014 18:38:58 -0700 (PDT) In-Reply-To: <88B273DE-C9EB-4C11-AE9E-0136BC2324C2@FreeBSD.org> References: <201410242002.s9OK2i3w018818@svn.freebsd.org> <88B273DE-C9EB-4C11-AE9E-0136BC2324C2@FreeBSD.org> Date: Fri, 24 Oct 2014 18:38:58 -0700 Message-ID: Subject: Re: svn commit: r273604 - in head: include lib/libc/gen sys/kern sys/sys usr.bin/truss From: NGie Cooper To: "Bjoern A. Zeeb" Content-Type: text/plain; charset=UTF-8 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , John Baldwin X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 01:38:59 -0000 On Fri, Oct 24, 2014 at 6:35 PM, Bjoern A. Zeeb wrote: ... > Has anyone fixed this: > > /scratch/tmp/bz/head.svn/sys/kern/kern_umtx.c:2898:21: error: passing 'volatile __uint32_t *' (aka 'volatile unsigned int *') to parameter of type 'const void *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifier > s] > count = fuword32(&sem->_count); > ^~~~~~~~~~~~ > /scratch/tmp/bz/head.svn/sys/sys/systm.h:258:30: note: passing argument to parameter 'base' here > int32_t fuword32(const void *base); > ^ > 1 error generated. > --- kern_umtx.o --- > *** [kern_umtx.o] Error code 1 Xin did in r273616. Cheers! From owner-svn-src-all@FreeBSD.ORG Sat Oct 25 01:59:03 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F1E10C29; Sat, 25 Oct 2014 01:59:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DD4BDC84; Sat, 25 Oct 2014 01:59:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9P1x2ug085445; Sat, 25 Oct 2014 01:59:02 GMT (envelope-from rpaulo@FreeBSD.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9P1x28A085442; Sat, 25 Oct 2014 01:59:02 GMT (envelope-from rpaulo@FreeBSD.org) Message-Id: <201410250159.s9P1x28A085442@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rpaulo set sender to rpaulo@FreeBSD.org using -f From: Rui Paulo Date: Sat, 25 Oct 2014 01:59:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273621 - stable/10/usr.sbin/watchdogd X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 01:59:03 -0000 Author: rpaulo Date: Sat Oct 25 01:59:01 2014 New Revision: 273621 URL: https://svnweb.freebsd.org/changeset/base/273621 Log: MFC r273247: Fix the watchdog/watchdog man pages. The default timeout is 128 seconds. Modified: stable/10/usr.sbin/watchdogd/watchdog.8 stable/10/usr.sbin/watchdogd/watchdogd.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/watchdogd/watchdog.8 ============================================================================== --- stable/10/usr.sbin/watchdogd/watchdog.8 Sat Oct 25 01:17:29 2014 (r273620) +++ stable/10/usr.sbin/watchdogd/watchdog.8 Sat Oct 25 01:59:01 2014 (r273621) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 2, 2006 +.Dd October 18, 2014 .Dt WATCHDOG 8 .Os .Sh NAME @@ -50,7 +50,7 @@ The option specifies the desired timeout period in seconds, a value of zero will disable the watchdog. -The default timeout is 16 seconds. +The default timeout is 128 seconds. .Sh SEE ALSO .Xr watchdog 4 , .Xr watchdogd 8 , Modified: stable/10/usr.sbin/watchdogd/watchdogd.8 ============================================================================== --- stable/10/usr.sbin/watchdogd/watchdogd.8 Sat Oct 25 01:17:29 2014 (r273620) +++ stable/10/usr.sbin/watchdogd/watchdogd.8 Sat Oct 25 01:59:01 2014 (r273621) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 27, 2013 +.Dd October 18, 2014 .Dt WATCHDOGD 8 .Os .Sh NAME @@ -84,7 +84,7 @@ of the check and defaults to one second. The .Fl t Ar timeout specifies the desired timeout period in seconds. -The default timeout is 16 seconds. +The default timeout is 128 seconds. .Pp One possible circumstance which will cause a watchdog timeout is an interrupt storm. From owner-svn-src-all@FreeBSD.ORG Sat Oct 25 02:00:33 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1DB43E5C; Sat, 25 Oct 2014 02:00:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 09B05CA0; Sat, 25 Oct 2014 02:00:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9P20WSO088205; Sat, 25 Oct 2014 02:00:32 GMT (envelope-from rpaulo@FreeBSD.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9P20Wkw088204; Sat, 25 Oct 2014 02:00:32 GMT (envelope-from rpaulo@FreeBSD.org) Message-Id: <201410250200.s9P20Wkw088204@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rpaulo set sender to rpaulo@FreeBSD.org using -f From: Rui Paulo Date: Sat, 25 Oct 2014 02:00:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273622 - stable/10/sys/boot/fdt/dts/arm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 02:00:33 -0000 Author: rpaulo Date: Sat Oct 25 02:00:32 2014 New Revision: 273622 URL: https://svnweb.freebsd.org/changeset/base/273622 Log: MFC r273248: AM335x FDT: add an entry for the watchdog. Modified: stable/10/sys/boot/fdt/dts/arm/am335x.dtsi Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/boot/fdt/dts/arm/am335x.dtsi ============================================================================== --- stable/10/sys/boot/fdt/dts/arm/am335x.dtsi Sat Oct 25 01:59:01 2014 (r273621) +++ stable/10/sys/boot/fdt/dts/arm/am335x.dtsi Sat Oct 25 02:00:32 2014 (r273622) @@ -81,6 +81,13 @@ interrupts = < 16 >; interrupt-parent = <&AINTC>; }; + + wdt1@44E35000 { + compatible = "ti,wdt"; + reg = <0x44E35000 0x1000>; + interrupts = <91>; + interrupt-parent = <&AINTC>; + }; GPIO: gpio { #gpio-cells = <3>; From owner-svn-src-all@FreeBSD.ORG Sat Oct 25 02:02:21 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 40C2BF9A; Sat, 25 Oct 2014 02:02:21 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2C54CD33; Sat, 25 Oct 2014 02:02:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9P22LmN089540; Sat, 25 Oct 2014 02:02:21 GMT (envelope-from rpaulo@FreeBSD.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9P22LuT089539; Sat, 25 Oct 2014 02:02:21 GMT (envelope-from rpaulo@FreeBSD.org) Message-Id: <201410250202.s9P22LuT089539@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rpaulo set sender to rpaulo@FreeBSD.org using -f From: Rui Paulo Date: Sat, 25 Oct 2014 02:02:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273623 - stable/10/sys/boot/fdt/dts/arm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 02:02:21 -0000 Author: rpaulo Date: Sat Oct 25 02:02:20 2014 New Revision: 273623 URL: https://svnweb.freebsd.org/changeset/base/273623 Log: MFC r273256: AM335X FDT: use the omap3-wdt string for compatibility with Linux. Modified: stable/10/sys/boot/fdt/dts/arm/am335x.dtsi Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/boot/fdt/dts/arm/am335x.dtsi ============================================================================== --- stable/10/sys/boot/fdt/dts/arm/am335x.dtsi Sat Oct 25 02:00:32 2014 (r273622) +++ stable/10/sys/boot/fdt/dts/arm/am335x.dtsi Sat Oct 25 02:02:20 2014 (r273623) @@ -83,7 +83,7 @@ }; wdt1@44E35000 { - compatible = "ti,wdt"; + compatible = "ti,omap3-wdt"; reg = <0x44E35000 0x1000>; interrupts = <91>; interrupt-parent = <&AINTC>; From owner-svn-src-all@FreeBSD.ORG Sat Oct 25 02:05:23 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8DEC317F; Sat, 25 Oct 2014 02:05:23 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6ECB3D45; Sat, 25 Oct 2014 02:05:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9P25Nq3089964; Sat, 25 Oct 2014 02:05:23 GMT (envelope-from rpaulo@FreeBSD.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9P25Msb089958; Sat, 25 Oct 2014 02:05:22 GMT (envelope-from rpaulo@FreeBSD.org) Message-Id: <201410250205.s9P25Msb089958@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rpaulo set sender to rpaulo@FreeBSD.org using -f From: Rui Paulo Date: Sat, 25 Oct 2014 02:05:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273624 - in stable/10/sys/arm: conf ti X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 02:05:23 -0000 Author: rpaulo Date: Sat Oct 25 02:05:21 2014 New Revision: 273624 URL: https://svnweb.freebsd.org/changeset/base/273624 Log: MFC r273257: Add a driver for the TI watchdog. The TI watchdog timer is present on BeagleBone's. Since 2014, U-Boot has been booting the BeagleBone with the watchdog enabled. We need to disable it on boot to avoid a spurious reset. The timer isn't exactly precise, but it will do as a watchdog. This is also a reflection of the watchdog(9) API. In the future, we could handle interrupts, but the watchdog(9) API needs to be a bit smarter before that can happen. Added: stable/10/sys/arm/ti/ti_wdt.c - copied unchanged from r273257, head/sys/arm/ti/ti_wdt.c stable/10/sys/arm/ti/ti_wdt.h - copied unchanged from r273257, head/sys/arm/ti/ti_wdt.h Modified: stable/10/sys/arm/conf/BEAGLEBONE stable/10/sys/arm/ti/files.ti Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/conf/BEAGLEBONE ============================================================================== --- stable/10/sys/arm/conf/BEAGLEBONE Sat Oct 25 02:02:20 2014 (r273623) +++ stable/10/sys/arm/conf/BEAGLEBONE Sat Oct 25 02:05:21 2014 (r273624) @@ -108,6 +108,12 @@ device gpioled # ADC support device ti_adc +# Watchdog support +# If we don't enable the watchdog driver, the system could potentially +# reboot automatically because the boot loader might have enabled the +# watchdog. +device ti_wdt + # USB support device usb options USB_HOST_ALIGN=64 # Cacheline size is 64 on AM335x. Modified: stable/10/sys/arm/ti/files.ti ============================================================================== --- stable/10/sys/arm/ti/files.ti Sat Oct 25 02:02:20 2014 (r273623) +++ stable/10/sys/arm/ti/files.ti Sat Oct 25 02:05:21 2014 (r273624) @@ -19,6 +19,8 @@ dev/mbox/mbox_if.m standard arm/ti/ti_mbox.c standard arm/ti/ti_pruss.c standard +arm/ti/ti_wdt.c optional ti_wdt + arm/ti/ti_adc.c optional ti_adc arm/ti/ti_gpio.c optional gpio arm/ti/ti_i2c.c optional ti_i2c Copied: stable/10/sys/arm/ti/ti_wdt.c (from r273257, head/sys/arm/ti/ti_wdt.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/arm/ti/ti_wdt.c Sat Oct 25 02:05:21 2014 (r273624, copy of r273257, head/sys/arm/ti/ti_wdt.c) @@ -0,0 +1,275 @@ +/*- + * Copyright (c) 2014 Rui Paulo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include + +#ifdef DEBUG +#define DPRINTF(fmt, ...) do { \ + printf("%s: ", __func__); \ + printf(fmt, __VA_ARGS__); \ +} while (0) +#else +#define DPRINTF(fmt, ...) +#endif + +static device_probe_t ti_wdt_probe; +static device_attach_t ti_wdt_attach; +static device_detach_t ti_wdt_detach; +static void ti_wdt_intr(void *); +static void ti_wdt_event(void *, unsigned int, int *); + +struct ti_wdt_softc { + struct mtx sc_mtx; + struct resource *sc_mem_res; + struct resource *sc_irq_res; + void *sc_intr; + bus_space_tag_t sc_bt; + bus_space_handle_t sc_bh; + eventhandler_tag sc_ev_tag; +}; + +static device_method_t ti_wdt_methods[] = { + DEVMETHOD(device_probe, ti_wdt_probe), + DEVMETHOD(device_attach, ti_wdt_attach), + DEVMETHOD(device_detach, ti_wdt_detach), + + DEVMETHOD_END +}; + +static driver_t ti_wdt_driver = { + "ti_wdt", + ti_wdt_methods, + sizeof(struct ti_wdt_softc) +}; + +static devclass_t ti_wdt_devclass; + +DRIVER_MODULE(ti_wdt, simplebus, ti_wdt_driver, ti_wdt_devclass, 0, 0); + +static volatile __inline uint32_t +ti_wdt_reg_read(struct ti_wdt_softc *sc, uint32_t reg) +{ + return (bus_space_read_4(sc->sc_bt, sc->sc_bh, reg)); +} + +static __inline void +ti_wdt_reg_write(struct ti_wdt_softc *sc, uint32_t reg, uint32_t val) +{ + bus_space_write_4(sc->sc_bt, sc->sc_bh, reg, val); +} + +/* + * Wait for the write to a specific synchronised register to complete. + */ +static __inline void +ti_wdt_reg_wait(struct ti_wdt_softc *sc, uint32_t bit) +{ + while (ti_wdt_reg_read(sc, TI_WDT_WWPS) & bit) + DELAY(10); + +} + +static __inline void +ti_wdt_disable(struct ti_wdt_softc *sc) +{ + DPRINTF("disabling watchdog %p\n", sc); + ti_wdt_reg_write(sc, TI_WDT_WSPR, 0xAAAA); + ti_wdt_reg_wait(sc, TI_W_PEND_WSPR); + ti_wdt_reg_write(sc, TI_WDT_WSPR, 0x5555); + ti_wdt_reg_wait(sc, TI_W_PEND_WSPR); +} + +static __inline void +ti_wdt_enable(struct ti_wdt_softc *sc) +{ + DPRINTF("enabling watchdog %p\n", sc); + ti_wdt_reg_write(sc, TI_WDT_WSPR, 0xBBBB); + ti_wdt_reg_wait(sc, TI_W_PEND_WSPR); + ti_wdt_reg_write(sc, TI_WDT_WSPR, 0x4444); + ti_wdt_reg_wait(sc, TI_W_PEND_WSPR); +} + +static int +ti_wdt_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + if (ofw_bus_is_compatible(dev, "ti,omap3-wdt")) { + device_set_desc(dev, "TI Watchdog Timer"); + return (BUS_PROBE_DEFAULT); + } + + return (ENXIO); +} + +static int +ti_wdt_attach(device_t dev) +{ + struct ti_wdt_softc *sc; + int rid; + + sc = device_get_softc(dev); + rid = 0; + mtx_init(&sc->sc_mtx, "TI WDT", NULL, MTX_DEF); + sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->sc_mem_res == NULL) { + device_printf(dev, "could not allocate memory resource\n"); + return (ENXIO); + } + sc->sc_bt = rman_get_bustag(sc->sc_mem_res); + sc->sc_bh = rman_get_bushandle(sc->sc_mem_res); + sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE); + if (sc->sc_irq_res == NULL) { + device_printf(dev, "could not allocate interrupt resource\n"); + ti_wdt_detach(dev); + return (ENXIO); + } + if (bus_setup_intr(dev, sc->sc_irq_res, INTR_MPSAFE | INTR_TYPE_MISC, + NULL, ti_wdt_intr, sc, &sc->sc_intr) != 0) { + device_printf(dev, + "unable to setup the interrupt handler\n"); + ti_wdt_detach(dev); + return (ENXIO); + } + /* Reset, enable interrupts and stop the watchdog. */ + ti_wdt_reg_write(sc, TI_WDT_WDSC, + ti_wdt_reg_read(sc, TI_WDT_WDSC) | TI_WDSC_SR); + while (ti_wdt_reg_read(sc, TI_WDT_WDSC) & TI_WDSC_SR) + DELAY(10); + ti_wdt_reg_write(sc, TI_WDT_WIRQENSET, TI_IRQ_EN_OVF | TI_IRQ_EN_DLY); + ti_wdt_disable(sc); + if (bootverbose) + device_printf(dev, "revision: 0x%x\n", + ti_wdt_reg_read(sc, TI_WDT_WIDR)); + sc->sc_ev_tag = EVENTHANDLER_REGISTER(watchdog_list, ti_wdt_event, sc, + 0); + + return (0); +} + +static int +ti_wdt_detach(device_t dev) +{ + struct ti_wdt_softc *sc; + + sc = device_get_softc(dev); + if (sc->sc_ev_tag) + EVENTHANDLER_DEREGISTER(watchdog_list, sc->sc_ev_tag); + if (sc->sc_intr) + bus_teardown_intr(dev, sc->sc_irq_res, sc->sc_intr); + if (sc->sc_irq_res) + bus_release_resource(dev, SYS_RES_IRQ, + rman_get_rid(sc->sc_irq_res), sc->sc_irq_res); + if (sc->sc_mem_res) + bus_release_resource(dev, SYS_RES_MEMORY, + rman_get_rid(sc->sc_mem_res), sc->sc_mem_res); + + return (0); +} + +static void +ti_wdt_intr(void *arg) +{ + struct ti_wdt_softc *sc; + + sc = arg; + DPRINTF("interrupt %p", sc); + ti_wdt_reg_write(sc, TI_WDT_WIRQSTAT, TI_IRQ_EV_OVF | TI_IRQ_EV_DLY); + /* TODO: handle interrupt */ +} + +static void +ti_wdt_event(void *arg, unsigned int cmd, int *error) +{ + struct ti_wdt_softc *sc; + uint8_t s; + uint32_t wldr; + uint32_t ptv; + + sc = arg; + ti_wdt_disable(sc); + if (cmd == WD_TO_NEVER) { + *error = 0; + return; + } + DPRINTF("cmd 0x%x\n", cmd); + cmd &= WD_INTERVAL; + if (cmd < WD_TO_1SEC) { + *error = EINVAL; + return; + } + s = 1 << (cmd - WD_TO_1SEC); + DPRINTF("seconds %u\n", s); + /* + * Leave the pre-scaler with its default values: + * PTV = 0 == 2**0 == 1 + * PRE = 1 (enabled) + * + * Compute the load register value assuming a 32kHz clock. + * See OVF_Rate in the WDT section of the AM335x TRM. + */ + ptv = 0; + wldr = 0xffffffff - (s * (32768 / (1 << ptv))) + 1; + DPRINTF("wldr 0x%x\n", wldr); + ti_wdt_reg_write(sc, TI_WDT_WLDR, wldr); + /* + * Trigger a timer reload. + */ + ti_wdt_reg_write(sc, TI_WDT_WTGR, + ti_wdt_reg_read(sc, TI_WDT_WTGR) + 1); + ti_wdt_reg_wait(sc, TI_W_PEND_WTGR); + ti_wdt_enable(sc); + *error = 0; +} Copied: stable/10/sys/arm/ti/ti_wdt.h (from r273257, head/sys/arm/ti/ti_wdt.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/arm/ti/ti_wdt.h Sat Oct 25 02:05:21 2014 (r273624, copy of r273257, head/sys/arm/ti/ti_wdt.h) @@ -0,0 +1,74 @@ +/*- + * Copyright (c) 2014 Rui Paulo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ +#ifndef _TI_WDT_H_ +#define _TI_WDT_H_ + +/* TI WDT registers */ +#define TI_WDT_WIDR 0x00 /* Watchdog Identification Register */ +#define TI_WDT_WDSC 0x10 /* Watchdog System Control Register */ +#define TI_WDT_WDST 0x14 /* Watchdog Status Register */ +#define TI_WDT_WISR 0x18 /* Watchdog Interrupt Status Register */ +#define TI_WDT_WIER 0x1c /* Watchdog Interrupt Enable Register */ +#define TI_WDT_WCLR 0x24 /* Watchdog Control Register */ +#define TI_WDT_WCRR 0x28 /* Watchdog Counter Register */ +#define TI_WDT_WLDR 0x2c /* Watchdog Load Register */ +#define TI_WDT_WTGR 0x30 /* Watchdog Trigger Register */ +#define TI_WDT_WWPS 0x34 /* Watchdog Write Posting Register */ +#define TI_WDT_WDLY 0x44 /* Watchdog Delay Configuration Reg */ +#define TI_WDT_WSPR 0x48 /* Watchdog Start/Stop Register */ +#define TI_WDT_WIRQSTATRAW 0x54 /* Watchdog Raw Interrupt Status Reg. */ +#define TI_WDT_WIRQSTAT 0x58 /* Watchdog Int. Status Register */ +#define TI_WDT_WIRQENSET 0x5c /* Watchdog Int. Enable Set Register */ +#define TI_WDT_WIRQENCLR 0x60 /* Watchdog Int. Enable Clear Reg. */ + +/* WDT_WDSC Register */ +#define TI_WDSC_SR (1 << 1) /* Soft reset */ + +/* + * WDT_WWPS Register + * + * Writes to some registers require synchronisation with a different clock + * domain. The WDT_WWPS register is the place where this synchronisation + * happens. + */ +#define TI_W_PEND_WCLR (1 << 0) +#define TI_W_PEND_WCRR (1 << 1) +#define TI_W_PEND_WLDR (1 << 2) +#define TI_W_PEND_WTGR (1 << 3) +#define TI_W_PEND_WSPR (1 << 4) +#define TI_W_PEND_WDLY (1 << 5) + +/* WDT_WIRQENSET Register */ +#define TI_IRQ_EN_OVF (1 << 0) /* Overflow interrupt */ +#define TI_IRQ_EN_DLY (1 << 1) /* Delay interrupt */ + +/* WDT_WIRQSTAT Register */ +#define TI_IRQ_EV_OVF (1 << 0) /* Overflow event */ +#define TI_IRQ_EV_DLY (1 << 1) /* Delay event */ + +#endif /* _TI_WDT_H_ */ From owner-svn-src-all@FreeBSD.ORG Sat Oct 25 02:06:41 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C1F7D2C2; Sat, 25 Oct 2014 02:06:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AD99FD57; Sat, 25 Oct 2014 02:06:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9P26fKW090160; Sat, 25 Oct 2014 02:06:41 GMT (envelope-from rpaulo@FreeBSD.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9P26f3o090158; Sat, 25 Oct 2014 02:06:41 GMT (envelope-from rpaulo@FreeBSD.org) Message-Id: <201410250206.s9P26f3o090158@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rpaulo set sender to rpaulo@FreeBSD.org using -f From: Rui Paulo Date: Sat, 25 Oct 2014 02:06:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273625 - in stable/10/sys/arm: conf ti X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 02:06:41 -0000 Author: rpaulo Date: Sat Oct 25 02:06:40 2014 New Revision: 273625 URL: https://svnweb.freebsd.org/changeset/base/273625 Log: MFC r273258: Make the ti_mbox and ti_pruss drivers optional. Modified: stable/10/sys/arm/conf/BEAGLEBONE stable/10/sys/arm/ti/files.ti Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/conf/BEAGLEBONE ============================================================================== --- stable/10/sys/arm/conf/BEAGLEBONE Sat Oct 25 02:05:21 2014 (r273624) +++ stable/10/sys/arm/conf/BEAGLEBONE Sat Oct 25 02:06:40 2014 (r273625) @@ -114,6 +114,12 @@ device ti_adc # watchdog. device ti_wdt +# TI Programmable Realtime Unit support +device ti_pruss + +# Mailbox support +device ti_mbox + # USB support device usb options USB_HOST_ALIGN=64 # Cacheline size is 64 on AM335x. Modified: stable/10/sys/arm/ti/files.ti ============================================================================== --- stable/10/sys/arm/ti/files.ti Sat Oct 25 02:05:21 2014 (r273624) +++ stable/10/sys/arm/ti/files.ti Sat Oct 25 02:06:40 2014 (r273625) @@ -15,12 +15,10 @@ arm/ti/ti_cpuid.c standard arm/ti/ti_machdep.c standard arm/ti/ti_prcm.c standard arm/ti/ti_scm.c standard -dev/mbox/mbox_if.m standard -arm/ti/ti_mbox.c standard -arm/ti/ti_pruss.c standard - +dev/mbox/mbox_if.m optional ti_mbox +arm/ti/ti_mbox.c optional ti_mbox +arm/ti/ti_pruss.c optional ti_pruss arm/ti/ti_wdt.c optional ti_wdt - arm/ti/ti_adc.c optional ti_adc arm/ti/ti_gpio.c optional gpio arm/ti/ti_i2c.c optional ti_i2c From owner-svn-src-all@FreeBSD.ORG Sat Oct 25 02:08:03 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1ED1A415; Sat, 25 Oct 2014 02:08:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0A803D6B; Sat, 25 Oct 2014 02:08:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9P282ei090386; Sat, 25 Oct 2014 02:08:02 GMT (envelope-from rpaulo@FreeBSD.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9P2824a090385; Sat, 25 Oct 2014 02:08:02 GMT (envelope-from rpaulo@FreeBSD.org) Message-Id: <201410250208.s9P2824a090385@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rpaulo set sender to rpaulo@FreeBSD.org using -f From: Rui Paulo Date: Sat, 25 Oct 2014 02:08:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273626 - stable/10/sys/arm/ti X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 02:08:03 -0000 Author: rpaulo Date: Sat Oct 25 02:08:02 2014 New Revision: 273626 URL: https://svnweb.freebsd.org/changeset/base/273626 Log: MFC r273261: Remove an unused mutex. Modified: stable/10/sys/arm/ti/ti_wdt.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/ti/ti_wdt.c ============================================================================== --- stable/10/sys/arm/ti/ti_wdt.c Sat Oct 25 02:06:40 2014 (r273625) +++ stable/10/sys/arm/ti/ti_wdt.c Sat Oct 25 02:08:02 2014 (r273626) @@ -69,7 +69,6 @@ static void ti_wdt_intr(void *); static void ti_wdt_event(void *, unsigned int, int *); struct ti_wdt_softc { - struct mtx sc_mtx; struct resource *sc_mem_res; struct resource *sc_irq_res; void *sc_intr; @@ -161,7 +160,6 @@ ti_wdt_attach(device_t dev) sc = device_get_softc(dev); rid = 0; - mtx_init(&sc->sc_mtx, "TI WDT", NULL, MTX_DEF); sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); if (sc->sc_mem_res == NULL) { From owner-svn-src-all@FreeBSD.ORG Sat Oct 25 02:21:46 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8D724612 for ; Sat, 25 Oct 2014 02:21:46 +0000 (UTC) Received: from mail-lb0-f172.google.com (mail-lb0-f172.google.com [209.85.217.172]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 12CA5EC8 for ; Sat, 25 Oct 2014 02:21:45 +0000 (UTC) Received: by mail-lb0-f172.google.com with SMTP id b6so3427929lbj.31 for ; Fri, 24 Oct 2014 19:21:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=IvbLD0YpZF2UHRGMP+nVo/jDVEM0SHVubs5JOuRsFTo=; b=XUDQbiTOZwkzKqHww4lgxj36o/LGtjoi6gV2uqIdfLBOBel9WPWK4KUijlApzYTRj8 nvV0xnffzYoAESlKDSI1uX7uQqASJtnQ/iacLytyoGxtC6X8aiwaZS4UaoAv1kY8IgUs HEIhNLRaPZhHagh9j/PNaHHPRamzc5vP0kTi26fxHKhmaqGT2+dMKjaBvgzb4PFX76t6 5rWIxe+QaNJl/QZ5ghuPmd1FKUeH6JoXz3jCoEnX4Dk/wwRwyNq5pVYc91PDJnJqyca3 qwBW7zxl9QIKNW/4Wgsx75gSYZiTavaWRSCcAgva+UgtT/mcAYelIL3tcfP8ebw3nbq0 xIjg== X-Gm-Message-State: ALoCoQnLeiZy0Kiusgmfi5L8PdF5WOH/7LpNSmy6QRsqXEx9cJUl6GliVs/rv6xSnqywDeqbK2Y4 X-Received: by 10.152.5.129 with SMTP id s1mr8186724las.59.1414203697777; Fri, 24 Oct 2014 19:21:37 -0700 (PDT) Received: from [192.168.1.2] ([89.169.173.68]) by mx.google.com with ESMTPSA id je9sm2431544lac.6.2014.10.24.19.21.36 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Oct 2014 19:21:37 -0700 (PDT) Message-ID: <544B0930.8010004@freebsd.org> Date: Sat, 25 Oct 2014 06:21:36 +0400 From: Andrey Chernov User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: John Baldwin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r273601 - head/lib/libc/gen References: <201410241955.s9OJtnbm014234@svn.freebsd.org> In-Reply-To: <201410241955.s9OJtnbm014234@svn.freebsd.org> Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 02:21:46 -0000 On 24.10.2014 23:55, John Baldwin wrote: > Author: jhb > Date: Fri Oct 24 19:55:49 2014 > New Revision: 273601 > URL: https://svnweb.freebsd.org/changeset/base/273601 > > Log: > Don't reference sem(4) from the POSIX semaphore pages. POSIX semaphores > were reimplemented using umtx in FreeBSD 9 and no longer use sem(4). sem kernel module referenced in sem(4) uses the same uipc_sem.c file as kernel's P1003_1B_SEMAPHORES option, so they both use the same code and better be cross-linked since sem(4) explains how to turn it on. -- http://ache.vniz.net/ From owner-svn-src-all@FreeBSD.ORG Sat Oct 25 03:42:54 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BC59D303 for ; Sat, 25 Oct 2014 03:42:54 +0000 (UTC) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com [209.85.217.181]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 42467906 for ; Sat, 25 Oct 2014 03:42:54 +0000 (UTC) Received: by mail-lb0-f181.google.com with SMTP id l4so3416745lbv.26 for ; Fri, 24 Oct 2014 20:42:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=5fcAsW4xMkQE6xLWVtBV0GdBfRuMLcZ3Hc29zhkzPgg=; b=CsGxkpXpiVNO50XmmZltSZcMdKlg2yY7QLGPZ4c1YfyAH1SrvFWMG950gFv6s46JUG XIPcBbUVnLoDn+fDjhkH/xmZ5stWdKppZTh6xVMBlKb+rrtX/dv5GzXzxDwoi5FyV953 NncTTwp5nJKMiqn/u/yLKtYpgneSG9zbaYb5jVzoddlQCcy9ypQ+crX7x2mpU9gxtjlq QvB9jQUscsntrqVUEvNHyZwrtNlJgYnfpXy2JZZULUmeOB3/KIBUdr5GDg55GJ8TN68F 5caoMaV2jhoXhRUIpbzA7Wu+M4dgfXg+oA4WWPEvUUpMYD5kNSuAcswKnF2LoonBc+3W ttvw== X-Gm-Message-State: ALoCoQlDiYrj00gRoo1h2Z1g1QUbSGPJNRcyqdzXQGri96UHijiwZ9Ka5GThOMe+SzKLrLeh4EXz X-Received: by 10.112.38.67 with SMTP id e3mr8598190lbk.6.1414208565743; Fri, 24 Oct 2014 20:42:45 -0700 (PDT) Received: from [192.168.1.2] ([89.169.173.68]) by mx.google.com with ESMTPSA id i6sm2469274laf.47.2014.10.24.20.42.44 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Oct 2014 20:42:45 -0700 (PDT) Message-ID: <544B1C34.1020204@freebsd.org> Date: Sat, 25 Oct 2014 07:42:44 +0400 From: Andrey Chernov User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: John Baldwin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r273601 - head/lib/libc/gen References: <201410241955.s9OJtnbm014234@svn.freebsd.org> <544B0930.8010004@freebsd.org> In-Reply-To: <544B0930.8010004@freebsd.org> Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 03:42:54 -0000 On 25.10.2014 6:21, Andrey Chernov wrote: > On 24.10.2014 23:55, John Baldwin wrote: >> Author: jhb >> Date: Fri Oct 24 19:55:49 2014 >> New Revision: 273601 >> URL: https://svnweb.freebsd.org/changeset/base/273601 >> >> Log: >> Don't reference sem(4) from the POSIX semaphore pages. POSIX semaphores >> were reimplemented using umtx in FreeBSD 9 and no longer use sem(4). > > sem kernel module referenced in sem(4) uses the same uipc_sem.c file as > kernel's P1003_1B_SEMAPHORES option, so they both use the same code and > better be cross-linked since sem(4) explains how to turn it on. > >From the first glance I can't determine, is libc implementation better than kernel one or not. BTW, firefox port still recommends sem_load="YES" -- http://ache.vniz.net/ From owner-svn-src-all@FreeBSD.ORG Sat Oct 25 04:52:49 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8068F3A7; Sat, 25 Oct 2014 04:52:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6CEA2F9C; Sat, 25 Oct 2014 04:52:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9P4qnKn069048; Sat, 25 Oct 2014 04:52:49 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9P4qniG069046; Sat, 25 Oct 2014 04:52:49 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410250452.s9P4qniG069046@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sat, 25 Oct 2014 04:52:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273627 - head/tools/regression/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 04:52:49 -0000 Author: ngie Date: Sat Oct 25 04:52:48 2014 New Revision: 273627 URL: https://svnweb.freebsd.org/changeset/base/273627 Log: - Print out "Bail out!" in die(..) so prove terminates immediately - Handle the output from newer versions of openssl md5, similar to what pjd@ did in r248304 MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Division Modified: head/tools/regression/zfs/misc.sh Modified: head/tools/regression/zfs/misc.sh ============================================================================== --- head/tools/regression/zfs/misc.sh Sat Oct 25 02:08:02 2014 (r273626) +++ head/tools/regression/zfs/misc.sh Sat Oct 25 04:52:48 2014 (r273627) @@ -39,6 +39,7 @@ fi die() { echo "${1}" > /dev/stderr + echo "Bail out!" exit 1 } @@ -363,7 +364,7 @@ files_destroy() name_create() { - echo "zfstest_`dd if=/dev/urandom bs=1k count=1 2>/dev/null | openssl md5 | cut -b -8`" + echo "zfstest_`dd if=/dev/urandom bs=1k count=1 2>/dev/null | openssl md5 | awk '{ print $NF }'`" } names_create() From owner-svn-src-all@FreeBSD.ORG Sat Oct 25 05:31:19 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 83BB187B; Sat, 25 Oct 2014 05:31:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 703BF2BA; Sat, 25 Oct 2014 05:31:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9P5VJLw087164; Sat, 25 Oct 2014 05:31:19 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9P5VJxu087163; Sat, 25 Oct 2014 05:31:19 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410250531.s9P5VJxu087163@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sat, 25 Oct 2014 05:31:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273628 - head/tools/regression/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 05:31:19 -0000 Author: ngie Date: Sat Oct 25 05:31:18 2014 New Revision: 273628 URL: https://svnweb.freebsd.org/changeset/base/273628 Log: Move the redirection to stderr out of the cmd variable assignment Putting 2>/dev/null in cmd= escapes the redirection operation, which causes mdconfig to think it's a filename MFC after: 2 weeks X-MFC with: r273627 Sponsored by: EMC / Isilon Storage Division Modified: head/tools/regression/zfs/misc.sh Modified: head/tools/regression/zfs/misc.sh ============================================================================== --- head/tools/regression/zfs/misc.sh Sat Oct 25 04:52:48 2014 (r273627) +++ head/tools/regression/zfs/misc.sh Sat Oct 25 05:31:18 2014 (r273628) @@ -167,8 +167,8 @@ create_memdisk() if [ -n "${devname}" ]; then devparam="-u ${devname}" fi - cmd="mdconfig -a -t swap -s ${size} ${devparam} 2>/dev/null" - DISKNAME=`${cmd}` || die "failed: ${cmd}" + cmd="mdconfig -a -t swap -s ${size} ${devparam}" + DISKNAME=`$cmd 2>/dev/null` || die "failed: ${cmd}" if [ -n "${devname}" ]; then DISKNAME="${devname}" fi From owner-svn-src-all@FreeBSD.ORG Sat Oct 25 05:56:22 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AA0FAC42; Sat, 25 Oct 2014 05:56:22 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9675B6D9; Sat, 25 Oct 2014 05:56:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9P5uMhc096601; Sat, 25 Oct 2014 05:56:22 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9P5uMrx096600; Sat, 25 Oct 2014 05:56:22 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410250556.s9P5uMrx096600@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 25 Oct 2014 05:56:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273629 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 05:56:22 -0000 Author: mjg Date: Sat Oct 25 05:56:21 2014 New Revision: 273629 URL: https://svnweb.freebsd.org/changeset/base/273629 Log: rlimit: plug duplicate assertion counter sanity is already checked by refcount_release. Modified: head/sys/kern/kern_resource.c Modified: head/sys/kern/kern_resource.c ============================================================================== --- head/sys/kern/kern_resource.c Sat Oct 25 05:31:18 2014 (r273628) +++ head/sys/kern/kern_resource.c Sat Oct 25 05:56:21 2014 (r273629) @@ -1168,7 +1168,6 @@ lim_free(limp) struct plimit *limp; { - KASSERT(limp->pl_refcnt > 0, ("plimit refcnt underflow")); if (refcount_release(&limp->pl_refcnt)) free((void *)limp, M_PLIMIT); } From owner-svn-src-all@FreeBSD.ORG Sat Oct 25 06:10:02 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B9007120; Sat, 25 Oct 2014 06:10:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A53EF829; Sat, 25 Oct 2014 06:10:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9P6A2bX001879; Sat, 25 Oct 2014 06:10:02 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9P6A2GP001878; Sat, 25 Oct 2014 06:10:02 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410250610.s9P6A2GP001878@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sat, 25 Oct 2014 06:10:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273630 - head/tools/regression/zfs/zpool/add X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 06:10:02 -0000 Author: ngie Date: Sat Oct 25 06:10:01 2014 New Revision: 273630 URL: https://svnweb.freebsd.org/changeset/base/273630 Log: Bail out of the script on FreeBSD due to deterministic panic issue PR: 191573 Sponsored by: EMC / Isilon Storage Division Modified: head/tools/regression/zfs/zpool/add/files.t Modified: head/tools/regression/zfs/zpool/add/files.t ============================================================================== --- head/tools/regression/zfs/zpool/add/files.t Sat Oct 25 05:56:21 2014 (r273629) +++ head/tools/regression/zfs/zpool/add/files.t Sat Oct 25 06:10:01 2014 (r273630) @@ -4,6 +4,8 @@ dir=`dirname $0` . ${dir}/../../misc.sh +[ "${os}" = "FreeBSD" ] && die "panics FreeBSD; see bug # 191573" + echo "1..54" files_create 8 From owner-svn-src-all@FreeBSD.ORG Sat Oct 25 06:28:49 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 93D6A398; Sat, 25 Oct 2014 06:28:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 804A9993; Sat, 25 Oct 2014 06:28:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9P6Sn5t010698; Sat, 25 Oct 2014 06:28:49 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9P6SnTD010697; Sat, 25 Oct 2014 06:28:49 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410250628.s9P6SnTD010697@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sat, 25 Oct 2014 06:28:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273631 - head/tools/regression/zfs/zpool/add X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 06:28:49 -0000 Author: ngie Date: Sat Oct 25 06:28:48 2014 New Revision: 273631 URL: https://svnweb.freebsd.org/changeset/base/273631 Log: Bail out of the script on FreeBSD due to deterministic panic issue PR: 194586 Sponsored by: EMC / Isilon Storage Division Modified: head/tools/regression/zfs/zpool/add/option-f_size_mismatch.t Modified: head/tools/regression/zfs/zpool/add/option-f_size_mismatch.t ============================================================================== --- head/tools/regression/zfs/zpool/add/option-f_size_mismatch.t Sat Oct 25 06:10:01 2014 (r273630) +++ head/tools/regression/zfs/zpool/add/option-f_size_mismatch.t Sat Oct 25 06:28:48 2014 (r273631) @@ -4,6 +4,8 @@ dir=`dirname $0` . ${dir}/../../misc.sh +[ "${os}" = "FreeBSD" ] && die "panics FreeBSD; see bug # 194586" + echo "1..100" disks_create 7 From owner-svn-src-all@FreeBSD.ORG Sat Oct 25 06:33:01 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A773C5A3; Sat, 25 Oct 2014 06:33:01 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 93D29A42; Sat, 25 Oct 2014 06:33:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9P6X1sp014717; Sat, 25 Oct 2014 06:33:01 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9P6X1eu014716; Sat, 25 Oct 2014 06:33:01 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410250633.s9P6X1eu014716@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sat, 25 Oct 2014 06:33:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273632 - head/tools/regression/zfs/zpool/add X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 06:33:01 -0000 Author: ngie Date: Sat Oct 25 06:33:00 2014 New Revision: 273632 URL: https://svnweb.freebsd.org/changeset/base/273632 Log: Bail out of the script on FreeBSD due to deterministic panic issue PR: 194587 Sponsored by: EMC / Isilon Storage Division Modified: head/tools/regression/zfs/zpool/add/option-f_type_mismatch.t Modified: head/tools/regression/zfs/zpool/add/option-f_type_mismatch.t ============================================================================== --- head/tools/regression/zfs/zpool/add/option-f_type_mismatch.t Sat Oct 25 06:28:48 2014 (r273631) +++ head/tools/regression/zfs/zpool/add/option-f_type_mismatch.t Sat Oct 25 06:33:00 2014 (r273632) @@ -4,6 +4,8 @@ dir=`dirname $0` . ${dir}/../../misc.sh +[ "${os}" = "FreeBSD" ] && die "panics FreeBSD; see bug # 194587" + echo "1..100" disks_create 7 From owner-svn-src-all@FreeBSD.ORG Sat Oct 25 07:20:47 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 94DFE1F2; Sat, 25 Oct 2014 07:20:47 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 80D98E3F; Sat, 25 Oct 2014 07:20:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9P7Klf0039077; Sat, 25 Oct 2014 07:20:47 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9P7KlTX039076; Sat, 25 Oct 2014 07:20:47 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410250720.s9P7KlTX039076@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sat, 25 Oct 2014 07:20:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273633 - head/tools/regression/zfs/zpool/create X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 07:20:47 -0000 Author: ngie Date: Sat Oct 25 07:20:46 2014 New Revision: 273633 URL: https://svnweb.freebsd.org/changeset/base/273633 Log: Bail out of the script on FreeBSD due to deterministic panic issue PR: 194589 Sponsored by: EMC / Isilon Storage Division Modified: head/tools/regression/zfs/zpool/create/files.t Modified: head/tools/regression/zfs/zpool/create/files.t ============================================================================== --- head/tools/regression/zfs/zpool/create/files.t Sat Oct 25 06:33:00 2014 (r273632) +++ head/tools/regression/zfs/zpool/create/files.t Sat Oct 25 07:20:46 2014 (r273633) @@ -4,6 +4,8 @@ dir=`dirname $0` . ${dir}/../../misc.sh +[ "${os}" = "FreeBSD" ] && die "panics FreeBSD; see bug # 194589" + echo "1..59" files_create 5 From owner-svn-src-all@FreeBSD.ORG Sat Oct 25 09:00:09 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 332C9F2; Sat, 25 Oct 2014 09:00:09 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CA69C8F1; Sat, 25 Oct 2014 09:00:08 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id s9P902jw031429 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 25 Oct 2014 12:00:02 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua s9P902jw031429 Received: (from kostik@localhost) by tom.home (8.14.9/8.14.9/Submit) id s9P900hQ031428; Sat, 25 Oct 2014 12:00:00 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 25 Oct 2014 12:00:00 +0300 From: Konstantin Belousov To: Rui Paulo Subject: Re: svn commit: r273598 - in head: include sys/dev/acpica Message-ID: <20141025090000.GG1877@kib.kiev.ua> References: <33decfcd-e77c-4e4c-8161-9f4a232213c6@me.com> <20141024194546.GE1877@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20141024194546.GE1877@kib.kiev.ua> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Rui Paulo X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 09:00:09 -0000 On Fri, Oct 24, 2014 at 10:45:46PM +0300, Konstantin Belousov wrote: > On Fri, Oct 24, 2014 at 07:33:07PM +0000, Rui Paulo wrote: > > On Oct 24, 2014, at 12:20 PM, Konstantin Belousov wrote: > > > > > +static int > > > +hpet_mmap(struct cdev *cdev, vm_ooffset_t offset, vm_paddr_t *paddr, > > > + int nprot, vm_memattr_t *memattr) > > > +{ > > > + š šstruct hpet_softc *sc; > > > + > > > + š šsc = cdev->si_drv1; > > > + š š š šif (offset > rman_get_size(sc->mem_res)) > > > + š š š š š š š šreturn (EINVAL); > > > + š šif (!sc->mmap_allow_write && (nprot & PROT_WRITE)) > > > + š š šreturn (EPERM); > > > + š š š*paddr = rman_get_start(sc->mem_res) + offset; > > What is the memattr for the backing page ? Is it set to non-cached > > mode somehow ? I was not able to find place where would this happen. > > š > > I expect it to be set to non-cached since it's a device anyway, but I don't know where it is. šDuring my testing, I did not see any problems with cached values, though. > > > I am not claiming that it is wrong, only that I do not see an easy reason > why it is right. Just printing the *memattr would provide the confidence. > Ok, I did looked at the pte of the HPET page. I get the value 0x80000000fed00025 which coincides with the resource address 0xfed00000 reported by devinfo -vr for hpet (to double-check my findings). The low bits indicate that PAT0 pat entry is used for the page caching mode. Corresponding PAT MSR 0x277 has the following value: sandy% sudo cpucontrol -m 0x277 /dev/cpuctl0 MSR 0x277: 0x00010506 0x00070406 i.e. memory type is 6, which is write-back, according to SDM. This is wrong, as I feared. The patch below fixes the issue. The pte for HPET page is equal to 0x80000000fed0003d after the patch is applied, PAT3 is used, and its value is 0 == UNCACHEABLE, as it must be. Do you agree with the patch ? diff --git a/sys/dev/acpica/acpi_hpet.c b/sys/dev/acpica/acpi_hpet.c index 6b35f5c..0da8bae 100644 --- a/sys/dev/acpica/acpi_hpet.c +++ b/sys/dev/acpica/acpi_hpet.c @@ -356,6 +356,7 @@ hpet_mmap(struct cdev *cdev, vm_ooffset_t offset, vm_paddr_t *paddr, if (!sc->mmap_allow_write && (nprot & PROT_WRITE)) return (EPERM); *paddr = rman_get_start(sc->mem_res) + offset; + *memattr = VM_MEMATTR_UNCACHEABLE; return (0); } From owner-svn-src-all@FreeBSD.ORG Sat Oct 25 09:25:30 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5A578482; Sat, 25 Oct 2014 09:25:30 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46904B58; Sat, 25 Oct 2014 09:25:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9P9PUqv095274; Sat, 25 Oct 2014 09:25:30 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9P9PULY095273; Sat, 25 Oct 2014 09:25:30 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201410250925.s9P9PULY095273@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 25 Oct 2014 09:25:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273634 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 09:25:30 -0000 Author: tuexen Date: Sat Oct 25 09:25:29 2014 New Revision: 273634 URL: https://svnweb.freebsd.org/changeset/base/273634 Log: Fix a use of an uninitialized variable by makeing sure that sctp_med_chunk_output() always initialized the reason_code instead of relying on the caller. The variable is only used for debugging purpose. This issue was reported by Peter Bostroem from Google. MFC after: 3 days Modified: head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Sat Oct 25 07:20:46 2014 (r273633) +++ head/sys/netinet/sctp_output.c Sat Oct 25 09:25:29 2014 (r273634) @@ -6748,7 +6748,7 @@ sctp_sendall_iterator(struct sctp_inpcb if (do_chunk_output) sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_USR_SEND, SCTP_SO_NOT_LOCKED); else if (added_control) { - int num_out = 0, reason = 0, now_filled = 0; + int num_out, reason, now_filled = 0; struct timeval now; int frag_point; @@ -7814,6 +7814,7 @@ sctp_med_chunk_output(struct sctp_inpcb int quit_now = 0; *num_out = 0; + *reason_code = 0; auth_keyid = stcb->asoc.authinfo.active_keyid; if ((asoc->state & SCTP_STATE_SHUTDOWN_PENDING) || (asoc->state & SCTP_STATE_SHUTDOWN_RECEIVED) || @@ -9945,7 +9946,7 @@ sctp_chunk_output(struct sctp_inpcb *inp */ struct sctp_association *asoc; struct sctp_nets *net; - int error = 0, num_out = 0, tot_out = 0, ret = 0, reason_code = 0; + int error = 0, num_out, tot_out = 0, ret = 0, reason_code; unsigned int burst_cnt = 0; struct timeval now; int now_filled = 0; From owner-svn-src-all@FreeBSD.ORG Sat Oct 25 12:50:28 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 58E81CB9; Sat, 25 Oct 2014 12:50:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 43E672A1; Sat, 25 Oct 2014 12:50:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9PCoS4U089612; Sat, 25 Oct 2014 12:50:28 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9PCoQaL089386; Sat, 25 Oct 2014 12:50:26 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410251250.s9PCoQaL089386@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 25 Oct 2014 12:50:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273635 - head/usr.sbin/ctld X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 12:50:28 -0000 Author: mav Date: Sat Oct 25 12:50:26 2014 New Revision: 273635 URL: https://svnweb.freebsd.org/changeset/base/273635 Log: Add basic iSNS client to the iSCSI target. This makes ctld(8) register its iSCSI targets and portals on configured iSNS servers to allow initiators find them without active discovery. Fetching of allowed initiators from iSNS is not implemented now, so target ACLs still should be configured manually. Reviewed by: trasz@ MFC after: 1 month Sponsored by: iXsystems, Inc. Added: head/usr.sbin/ctld/isns.c (contents, props changed) head/usr.sbin/ctld/isns.h (contents, props changed) Modified: head/usr.sbin/ctld/Makefile head/usr.sbin/ctld/ctl.conf.5 head/usr.sbin/ctld/ctld.c head/usr.sbin/ctld/ctld.h head/usr.sbin/ctld/parse.y head/usr.sbin/ctld/token.l Modified: head/usr.sbin/ctld/Makefile ============================================================================== --- head/usr.sbin/ctld/Makefile Sat Oct 25 09:25:29 2014 (r273634) +++ head/usr.sbin/ctld/Makefile Sat Oct 25 12:50:26 2014 (r273635) @@ -1,7 +1,8 @@ # $FreeBSD$ PROG= ctld -SRCS= chap.c ctld.c discovery.c kernel.c keys.c log.c login.c parse.y pdu.c token.l y.tab.h +SRCS= chap.c ctld.c discovery.c isns.c kernel.c keys.c log.c +SRCS+= login.c parse.y pdu.c token.l y.tab.h CFLAGS+= -I${.CURDIR} CFLAGS+= -I${.CURDIR}/../../sys CFLAGS+= -I${.CURDIR}/../../sys/cam/ctl Modified: head/usr.sbin/ctld/ctl.conf.5 ============================================================================== --- head/usr.sbin/ctld/ctl.conf.5 Sat Oct 25 09:25:29 2014 (r273634) +++ head/usr.sbin/ctld/ctl.conf.5 Sat Oct 25 12:50:26 2014 (r273635) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 22, 2014 +.Dd October 23, 2014 .Dt CTL.CONF 5 .Os .Sh NAME @@ -106,6 +106,13 @@ The timeout for login sessions, after wh will be forcibly terminated. The default is 60. A setting of 0 disables the timeout. +.It Ic isns-server Ar address +An IPv4 or IPv6 address and optionally port of iSNS server to register on. +.It Ic isns-period Ar seconds +iSNS registration period. +Registered Network Entity not updated during this period will be unregistered. +.It Ic isns-timeout Ar seconds +Timeout for iSNS requests. .El .Ss auth-group Context .Bl -tag -width indent Modified: head/usr.sbin/ctld/ctld.c ============================================================================== --- head/usr.sbin/ctld/ctld.c Sat Oct 25 09:25:29 2014 (r273634) +++ head/usr.sbin/ctld/ctld.c Sat Oct 25 12:50:26 2014 (r273635) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include "ctld.h" +#include "isns.h" bool proxy_mode = false; @@ -89,7 +90,10 @@ conf_new(void) TAILQ_INIT(&conf->conf_targets); TAILQ_INIT(&conf->conf_auth_groups); TAILQ_INIT(&conf->conf_portal_groups); + TAILQ_INIT(&conf->conf_isns); + conf->conf_isns_period = 900; + conf->conf_isns_timeout = 5; conf->conf_debug = 0; conf->conf_timeout = 60; conf->conf_maxproc = 30; @@ -103,6 +107,7 @@ conf_delete(struct conf *conf) struct target *targ, *tmp; struct auth_group *ag, *cagtmp; struct portal_group *pg, *cpgtmp; + struct isns *is, *istmp; assert(conf->conf_pidfh == NULL); @@ -112,6 +117,8 @@ conf_delete(struct conf *conf) auth_group_delete(ag); TAILQ_FOREACH_SAFE(pg, &conf->conf_portal_groups, pg_next, cpgtmp) portal_group_delete(pg); + TAILQ_FOREACH_SAFE(is, &conf->conf_isns, i_next, istmp) + isns_delete(is); free(conf->conf_pidfile_path); free(conf); } @@ -644,47 +651,28 @@ portal_group_find(const struct conf *con return (NULL); } -int -portal_group_add_listen(struct portal_group *pg, const char *value, bool iser) +static int +parse_addr_port(char *arg, const char *def_port, struct addrinfo **ai) { struct addrinfo hints; - struct portal *portal; - char *addr, *ch, *arg; + char *addr, *ch; const char *port; int error, colons = 0; - portal = portal_new(pg); - portal->p_listen = checked_strdup(value); - portal->p_iser = iser; - - arg = portal->p_listen; - if (arg[0] == '\0') { - log_warnx("empty listen address"); - portal_delete(portal); - return (1); - } if (arg[0] == '[') { /* * IPv6 address in square brackets, perhaps with port. */ arg++; addr = strsep(&arg, "]"); - if (arg == NULL) { - log_warnx("invalid listen address %s", - portal->p_listen); - portal_delete(portal); + if (arg == NULL) return (1); - } if (arg[0] == '\0') { - port = "3260"; + port = def_port; } else if (arg[0] == ':') { port = arg + 1; - } else { - log_warnx("invalid listen address %s", - portal->p_listen); - portal_delete(portal); + } else return (1); - } } else { /* * Either IPv6 address without brackets - and without @@ -696,11 +684,11 @@ portal_group_add_listen(struct portal_gr } if (colons > 1) { addr = arg; - port = "3260"; + port = def_port; } else { addr = strsep(&arg, ":"); if (arg == NULL) - port = "3260"; + port = def_port; else port = arg; } @@ -710,11 +698,23 @@ portal_group_add_listen(struct portal_gr hints.ai_family = PF_UNSPEC; hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_PASSIVE; + error = getaddrinfo(addr, port, &hints, ai); + if (error != 0) + return (1); + return (0); +} - error = getaddrinfo(addr, port, &hints, &portal->p_ai); - if (error != 0) { - log_warnx("getaddrinfo for %s failed: %s", - portal->p_listen, gai_strerror(error)); +int +portal_group_add_listen(struct portal_group *pg, const char *value, bool iser) +{ + struct portal *portal; + + portal = portal_new(pg); + portal->p_listen = checked_strdup(value); + portal->p_iser = iser; + + if (parse_addr_port(portal->p_listen, "3260", &portal->p_ai)) { + log_warnx("invalid listen address %s", portal->p_listen); portal_delete(portal); return (1); } @@ -727,6 +727,258 @@ portal_group_add_listen(struct portal_gr return (0); } +int +isns_new(struct conf *conf, const char *addr) +{ + struct isns *isns; + + isns = calloc(1, sizeof(*isns)); + if (isns == NULL) + log_err(1, "calloc"); + isns->i_conf = conf; + TAILQ_INSERT_TAIL(&conf->conf_isns, isns, i_next); + isns->i_addr = checked_strdup(addr); + + if (parse_addr_port(isns->i_addr, "3205", &isns->i_ai)) { + log_warnx("invalid iSNS address %s", isns->i_addr); + isns_delete(isns); + return (1); + } + + /* + * XXX: getaddrinfo(3) may return multiple addresses; we should turn + * those into multiple servers. + */ + + return (0); +} + +void +isns_delete(struct isns *isns) +{ + + TAILQ_REMOVE(&isns->i_conf->conf_isns, isns, i_next); + free(isns->i_addr); + if (isns->i_ai != NULL) + freeaddrinfo(isns->i_ai); + free(isns); +} + +static int +isns_do_connect(struct isns *isns) +{ + int s; + + s = socket(isns->i_ai->ai_family, isns->i_ai->ai_socktype, + isns->i_ai->ai_protocol); + if (s < 0) { + log_warn("socket(2) failed for %s", isns->i_addr); + return (-1); + } + if (connect(s, isns->i_ai->ai_addr, isns->i_ai->ai_addrlen)) { + log_warn("connect(2) failed for %s", isns->i_addr); + close(s); + return (-1); + } + return(s); +} + +static int +isns_do_register(struct isns *isns, int s, const char *hostname) +{ + struct conf *conf = isns->i_conf; + struct target *target; + struct portal *portal; + struct portal_group *pg; + struct isns_req *req; + int res = 0; + uint32_t error; + + req = isns_req_create(ISNS_FUNC_DEVATTRREG, ISNS_FLAG_CLIENT); + isns_req_add_str(req, 32, TAILQ_FIRST(&conf->conf_targets)->t_name); + isns_req_add_delim(req); + isns_req_add_str(req, 1, hostname); + isns_req_add_32(req, 2, 2); /* 2 -- iSCSI */ + isns_req_add_32(req, 6, conf->conf_isns_period); + TAILQ_FOREACH(pg, &conf->conf_portal_groups, pg_next) { + if (pg->pg_unassigned) + continue; + TAILQ_FOREACH(portal, &pg->pg_portals, p_next) { + isns_req_add_addr(req, 16, portal->p_ai); + isns_req_add_port(req, 17, portal->p_ai); + } + } + TAILQ_FOREACH(target, &conf->conf_targets, t_next) { + isns_req_add_str(req, 32, target->t_name); + isns_req_add_32(req, 33, 1); /* 1 -- Target*/ + if (target->t_alias != NULL) + isns_req_add_str(req, 34, target->t_alias); + pg = target->t_portal_group; + isns_req_add_32(req, 51, pg->pg_tag); + TAILQ_FOREACH(portal, &pg->pg_portals, p_next) { + isns_req_add_addr(req, 49, portal->p_ai); + isns_req_add_port(req, 50, portal->p_ai); + } + } + res = isns_req_send(s, req); + if (res < 0) { + log_warn("send(2) failed for %s", isns->i_addr); + goto quit; + } + res = isns_req_receive(s, req); + if (res < 0) { + log_warn("receive(2) failed for %s", isns->i_addr); + goto quit; + } + error = isns_req_get_status(req); + if (error != 0) { + log_warnx("iSNS register error %d for %s", error, isns->i_addr); + res = -1; + } +quit: + isns_req_free(req); + return (res); +} + +static int +isns_do_check(struct isns *isns, int s, const char *hostname) +{ + struct conf *conf = isns->i_conf; + struct isns_req *req; + int res = 0; + uint32_t error; + + req = isns_req_create(ISNS_FUNC_DEVATTRQRY, ISNS_FLAG_CLIENT); + isns_req_add_str(req, 32, TAILQ_FIRST(&conf->conf_targets)->t_name); + isns_req_add_str(req, 1, hostname); + isns_req_add_delim(req); + isns_req_add(req, 2, 0, NULL); + res = isns_req_send(s, req); + if (res < 0) { + log_warn("send(2) failed for %s", isns->i_addr); + goto quit; + } + res = isns_req_receive(s, req); + if (res < 0) { + log_warn("receive(2) failed for %s", isns->i_addr); + goto quit; + } + error = isns_req_get_status(req); + if (error != 0) { + log_warnx("iSNS check error %d for %s", error, isns->i_addr); + res = -1; + } +quit: + isns_req_free(req); + return (res); +} + +static int +isns_do_deregister(struct isns *isns, int s, const char *hostname) +{ + struct conf *conf = isns->i_conf; + struct isns_req *req; + int res = 0; + uint32_t error; + + req = isns_req_create(ISNS_FUNC_DEVDEREG, ISNS_FLAG_CLIENT); + isns_req_add_str(req, 32, TAILQ_FIRST(&conf->conf_targets)->t_name); + isns_req_add_delim(req); + isns_req_add_str(req, 1, hostname); + res = isns_req_send(s, req); + if (res < 0) { + log_warn("send(2) failed for %s", isns->i_addr); + goto quit; + } + res = isns_req_receive(s, req); + if (res < 0) { + log_warn("receive(2) failed for %s", isns->i_addr); + goto quit; + } + error = isns_req_get_status(req); + if (error != 0) { + log_warnx("iSNS deregister error %d for %s", error, isns->i_addr); + res = -1; + } +quit: + isns_req_free(req); + return (res); +} + +void +isns_register(struct isns *isns, struct isns *oldisns) +{ + struct conf *conf = isns->i_conf; + int s, res; + char hostname[256]; + + if (TAILQ_EMPTY(&conf->conf_targets) || + TAILQ_EMPTY(&conf->conf_portal_groups)) + return; + set_timeout(conf->conf_isns_timeout, false); + s = isns_do_connect(isns); + if (s < 0) { + set_timeout(0, false); + return; + } + gethostname(hostname, sizeof(hostname)); + + if (oldisns == NULL || TAILQ_EMPTY(&oldisns->i_conf->conf_targets)) + oldisns = isns; + res = isns_do_deregister(oldisns, s, hostname); + res = isns_do_register(isns, s, hostname); + close(s); + set_timeout(0, false); +} + +void +isns_check(struct isns *isns) +{ + struct conf *conf = isns->i_conf; + int s, res; + char hostname[256]; + + if (TAILQ_EMPTY(&conf->conf_targets) || + TAILQ_EMPTY(&conf->conf_portal_groups)) + return; + set_timeout(conf->conf_isns_timeout, false); + s = isns_do_connect(isns); + if (s < 0) { + set_timeout(0, false); + return; + } + gethostname(hostname, sizeof(hostname)); + + res = isns_do_check(isns, s, hostname); + if (res < 0) { + res = isns_do_deregister(isns, s, hostname); + res = isns_do_register(isns, s, hostname); + } + close(s); + set_timeout(0, false); +} + +void +isns_deregister(struct isns *isns) +{ + struct conf *conf = isns->i_conf; + int s, res; + char hostname[256]; + + if (TAILQ_EMPTY(&conf->conf_targets) || + TAILQ_EMPTY(&conf->conf_portal_groups)) + return; + set_timeout(conf->conf_isns_timeout, false); + s = isns_do_connect(isns); + if (s < 0) + return; + gethostname(hostname, sizeof(hostname)); + + res = isns_do_deregister(isns, s, hostname); + close(s); + set_timeout(0, false); +} + static bool valid_hex(const char ch) { @@ -1276,6 +1528,7 @@ conf_apply(struct conf *oldconf, struct struct lun *oldlun, *newlun, *tmplun; struct portal_group *oldpg, *newpg; struct portal *oldp, *newp; + struct isns *oldns, *newns; pid_t otherpid; int changed, cumulated_error = 0, error; int one = 1; @@ -1313,6 +1566,16 @@ conf_apply(struct conf *oldconf, struct } } + /* Deregister on removed iSNS servers. */ + TAILQ_FOREACH(oldns, &oldconf->conf_isns, i_next) { + TAILQ_FOREACH(newns, &newconf->conf_isns, i_next) { + if (strcmp(oldns->i_addr, newns->i_addr) == 0) + break; + } + if (newns == NULL) + isns_deregister(oldns); + } + /* * XXX: If target or lun removal fails, we should somehow "move" * the old lun or target into newconf, so that subsequent @@ -1342,10 +1605,8 @@ conf_apply(struct conf *oldconf, struct oldlun->l_ctl_lun); cumulated_error++; } - lun_delete(oldlun); } kernel_port_remove(oldtarg); - target_delete(oldtarg); continue; } @@ -1368,7 +1629,6 @@ conf_apply(struct conf *oldconf, struct oldlun->l_ctl_lun); cumulated_error++; } - lun_delete(oldlun); continue; } @@ -1594,6 +1854,19 @@ conf_apply(struct conf *oldconf, struct } } + /* (Re-)Register on remaining/new iSNS servers. */ + TAILQ_FOREACH(newns, &newconf->conf_isns, i_next) { + TAILQ_FOREACH(oldns, &oldconf->conf_isns, i_next) { + if (strcmp(oldns->i_addr, newns->i_addr) == 0) + break; + } + isns_register(newns, oldns); + } + + /* Schedule iSNS update */ + if (!TAILQ_EMPTY(&newconf->conf_isns)) + set_timeout((newconf->conf_isns_period + 2) / 3, false); + return (cumulated_error); } @@ -1605,7 +1878,7 @@ timed_out(void) } static void -sigalrm_handler(int dummy __unused) +sigalrm_handler_fatal(int dummy __unused) { /* * It would be easiest to just log an error and exit. We can't @@ -1625,19 +1898,35 @@ sigalrm_handler(int dummy __unused) } static void -set_timeout(const struct conf *conf) +sigalrm_handler(int dummy __unused) +{ + + sigalrm_received = true; +} + +void +set_timeout(int timeout, int fatal) { struct sigaction sa; struct itimerval itv; int error; - if (conf->conf_timeout <= 0) { + if (timeout <= 0) { log_debugx("session timeout disabled"); + bzero(&itv, sizeof(itv)); + error = setitimer(ITIMER_REAL, &itv, NULL); + if (error != 0) + log_err(1, "setitimer"); + sigalrm_received = false; return; } + sigalrm_received = false; bzero(&sa, sizeof(sa)); - sa.sa_handler = sigalrm_handler; + if (fatal) + sa.sa_handler = sigalrm_handler_fatal; + else + sa.sa_handler = sigalrm_handler; sigfillset(&sa.sa_mask); error = sigaction(SIGALRM, &sa, NULL); if (error != 0) @@ -1647,12 +1936,10 @@ set_timeout(const struct conf *conf) * First SIGALRM will arive after conf_timeout seconds. * If we do nothing, another one will arrive a second later. */ + log_debugx("setting session timeout to %d seconds", timeout); bzero(&itv, sizeof(itv)); itv.it_interval.tv_sec = 1; - itv.it_value.tv_sec = conf->conf_timeout; - - log_debugx("setting session timeout to %d seconds", - conf->conf_timeout); + itv.it_value.tv_sec = timeout; error = setitimer(ITIMER_REAL, &itv, NULL); if (error != 0) log_err(1, "setitimer"); @@ -1738,7 +2025,7 @@ handle_connection(struct portal *portal, setproctitle("%s", host); conn = connection_new(portal, fd, host, client_sa); - set_timeout(conf); + set_timeout(conf->conf_timeout, true); kernel_capsicate(); login(conn); if (conn->conn_session_type == CONN_SESSION_TYPE_NORMAL) { @@ -1785,7 +2072,7 @@ main_loop(struct conf *conf, bool dont_f pidfile_write(conf->conf_pidfh); for (;;) { - if (sighup_received || sigterm_received) + if (sighup_received || sigterm_received || timed_out()) return; #ifdef ICL_KERNEL_PROXY @@ -1909,6 +2196,7 @@ int main(int argc, char **argv) { struct conf *oldconf, *newconf, *tmpconf; + struct isns *newns; const char *config_path = DEFAULT_CONFIG_PATH; int debug = 0, ch, error; bool dont_daemonize = false; @@ -1968,6 +2256,10 @@ main(int argc, char **argv) } } + /* Schedule iSNS update */ + if (!TAILQ_EMPTY(&newconf->conf_isns)) + set_timeout((newconf->conf_isns_period + 2) / 3, false); + for (;;) { main_loop(newconf, dont_daemonize); if (sighup_received) { @@ -2003,12 +2295,25 @@ main(int argc, char **argv) error = conf_apply(oldconf, newconf); if (error != 0) log_warnx("failed to apply configuration"); + conf_delete(oldconf); + oldconf = NULL; log_warnx("exiting on signal"); exit(0); } else { nchildren -= wait_for_children(false); assert(nchildren >= 0); + if (timed_out()) { + set_timeout(0, false); + TAILQ_FOREACH(newns, &newconf->conf_isns, i_next) + isns_check(newns); + /* Schedule iSNS update */ + if (!TAILQ_EMPTY(&newconf->conf_isns)) { + set_timeout((newconf->conf_isns_period + + 2) / 3, + false); + } + } } } /* NOTREACHED */ Modified: head/usr.sbin/ctld/ctld.h ============================================================================== --- head/usr.sbin/ctld/ctld.h Sat Oct 25 09:25:29 2014 (r273634) +++ head/usr.sbin/ctld/ctld.h Sat Oct 25 12:50:26 2014 (r273635) @@ -146,11 +146,21 @@ struct target { char *t_alias; }; +struct isns { + TAILQ_ENTRY(isns) i_next; + struct conf *i_conf; + char *i_addr; + struct addrinfo *i_ai; +}; + struct conf { char *conf_pidfile_path; TAILQ_HEAD(, target) conf_targets; TAILQ_HEAD(, auth_group) conf_auth_groups; TAILQ_HEAD(, portal_group) conf_portal_groups; + TAILQ_HEAD(, isns) conf_isns; + int conf_isns_period; + int conf_isns_timeout; int conf_debug; int conf_timeout; int conf_maxproc; @@ -281,6 +291,12 @@ struct portal_group *portal_group_find(c int portal_group_add_listen(struct portal_group *pg, const char *listen, bool iser); +int isns_new(struct conf *conf, const char *addr); +void isns_delete(struct isns *is); +void isns_register(struct isns *isns, struct isns *oldisns); +void isns_check(struct isns *isns); +void isns_deregister(struct isns *isns); + struct target *target_new(struct conf *conf, const char *name); void target_delete(struct target *target); struct target *target_find(struct conf *conf, @@ -358,6 +374,7 @@ void log_debugx(const char *, ...) __p char *checked_strdup(const char *); bool valid_iscsi_name(const char *name); +void set_timeout(int timeout, int fatal); bool timed_out(void); #endif /* !CTLD_H */ Added: head/usr.sbin/ctld/isns.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/ctld/isns.c Sat Oct 25 12:50:26 2014 (r273635) @@ -0,0 +1,258 @@ +/*- + * Copyright (c) 2014 Alexander Motin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ctld.h" +#include "isns.h" + +struct isns_req * +isns_req_alloc(void) +{ + struct isns_req *req; + + req = calloc(sizeof(struct isns_req), 1); + if (req == NULL) { + log_err(1, "calloc"); + return (NULL); + } + req->ir_buflen = sizeof(struct isns_hdr); + req->ir_usedlen = 0; + req->ir_buf = calloc(req->ir_buflen, 1); + if (req == NULL) { + free(req); + log_err(1, "calloc"); + return (NULL); + } + return (req); +} + +struct isns_req * +isns_req_create(uint16_t func, uint16_t flags) +{ + struct isns_req *req; + struct isns_hdr *hdr; + + req = isns_req_alloc(); + req->ir_usedlen = sizeof(struct isns_hdr); + hdr = (struct isns_hdr *)req->ir_buf; + be16enc(hdr->ih_version, ISNS_VERSION); + be16enc(hdr->ih_function, func); + be16enc(hdr->ih_flags, flags); + return (req); +} + +void +isns_req_free(struct isns_req *req) +{ + + free(req->ir_buf); + free(req); +} + +static int +isns_req_getspace(struct isns_req *req, uint32_t len) +{ + void *newbuf; + int newlen; + + if (req->ir_usedlen + len <= req->ir_buflen) + return (0); + newlen = 1 << flsl(req->ir_usedlen + len); + newbuf = realloc(req->ir_buf, newlen); + if (newbuf == NULL) { + log_err(1, "realloc"); + return (1); + } + req->ir_buf = newbuf; + req->ir_buflen = newlen; + return (0); +} + +void +isns_req_add(struct isns_req *req, uint32_t tag, uint32_t len, + const void *value) +{ + struct isns_tlv *tlv; + uint32_t vlen; + + vlen = len + ((len & 3) ? (4 - (len & 3)) : 0); + isns_req_getspace(req, sizeof(*tlv) + vlen); + tlv = (struct isns_tlv *)&req->ir_buf[req->ir_usedlen]; + be32enc(tlv->it_tag, tag); + be32enc(tlv->it_length, vlen); + memcpy(tlv->it_value, value, len); + if (vlen != len) + memset(&tlv->it_value[len], 0, vlen - len); + req->ir_usedlen += sizeof(*tlv) + vlen; +} + +void +isns_req_add_delim(struct isns_req *req) +{ + + isns_req_add(req, 0, 0, NULL); +} + +void +isns_req_add_str(struct isns_req *req, uint32_t tag, const char *value) +{ + + isns_req_add(req, tag, strlen(value) + 1, value); +} + +void +isns_req_add_32(struct isns_req *req, uint32_t tag, uint32_t value) +{ + uint32_t beval; + + be32enc(&beval, value); + isns_req_add(req, tag, sizeof(value), &beval); +} + +void +isns_req_add_addr(struct isns_req *req, uint32_t tag, struct addrinfo *ai) +{ + struct sockaddr_in *in4; + struct sockaddr_in6 *in6; + uint8_t buf[16]; + + switch (ai->ai_addr->sa_family) { + case AF_INET: + in4 = (struct sockaddr_in *)(void *)ai->ai_addr; + memset(buf, 0, 10); + buf[10] = 0xff; + buf[11] = 0xff; + memcpy(&buf[12], &in4->sin_addr, sizeof(in4->sin_addr)); + isns_req_add(req, tag, sizeof(buf), buf); + break; + case AF_INET6: + in6 = (struct sockaddr_in6 *)(void *)ai->ai_addr; + isns_req_add(req, tag, sizeof(in6->sin6_addr), &in6->sin6_addr); + break; + default: + log_errx(1, "Unsupported address family %d", + ai->ai_addr->sa_family); + } +} + +void +isns_req_add_port(struct isns_req *req, uint32_t tag, struct addrinfo *ai) +{ + struct sockaddr_in *in4; + struct sockaddr_in6 *in6; + uint32_t buf; + + switch (ai->ai_addr->sa_family) { + case AF_INET: + in4 = (struct sockaddr_in *)(void *)ai->ai_addr; + be32enc(&buf, ntohs(in4->sin_port)); + isns_req_add(req, tag, sizeof(buf), &buf); + break; + case AF_INET6: + in6 = (struct sockaddr_in6 *)(void *)ai->ai_addr; + be32enc(&buf, ntohs(in6->sin6_port)); + isns_req_add(req, tag, sizeof(buf), &buf); + break; + default: + log_errx(1, "Unsupported address family %d", + ai->ai_addr->sa_family); + } +} + +int +isns_req_send(int s, struct isns_req *req) +{ + struct isns_hdr *hdr; + int res; + + hdr = (struct isns_hdr *)req->ir_buf; + be16enc(hdr->ih_length, req->ir_usedlen - sizeof(*hdr)); + be16enc(hdr->ih_flags, be16dec(hdr->ih_flags) | + ISNS_FLAG_LAST | ISNS_FLAG_FIRST); + be16enc(hdr->ih_transaction, 0); + be16enc(hdr->ih_sequence, 0); + + res = write(s, req->ir_buf, req->ir_usedlen); + return ((res < 0) ? -1 : 0); +} + +int +isns_req_receive(int s, struct isns_req *req) +{ + struct isns_hdr *hdr; + ssize_t res, len; + + req->ir_usedlen = 0; + isns_req_getspace(req, sizeof(*hdr)); + res = read(s, req->ir_buf, sizeof(*hdr)); + if (res < (ssize_t)sizeof(*hdr)) + return (-1); + req->ir_usedlen = sizeof(*hdr); + hdr = (struct isns_hdr *)req->ir_buf; + if (be16dec(hdr->ih_version) != ISNS_VERSION) + return (-1); + if ((be16dec(hdr->ih_flags) & (ISNS_FLAG_LAST | ISNS_FLAG_FIRST)) != + (ISNS_FLAG_LAST | ISNS_FLAG_FIRST)) + return (-1); + len = be16dec(hdr->ih_length); + isns_req_getspace(req, len); + res = read(s, &req->ir_buf[req->ir_usedlen], len); + if (res < len) + return (-1); + req->ir_usedlen += len; + return (0); +} + +uint32_t +isns_req_get_status(struct isns_req *req) +{ + + if (req->ir_usedlen < sizeof(struct isns_hdr) + 4) + return (-1); + return (be32dec(&req->ir_buf[sizeof(struct isns_hdr)])); +} Added: head/usr.sbin/ctld/isns.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/ctld/isns.h Sat Oct 25 12:50:26 2014 (r273635) @@ -0,0 +1,92 @@ +/*- + * Copyright (c) 2014 Alexander Motin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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$ + */ + +#ifndef _ISNS_H +#define _ISNS_H + +#define ISNS_VERSION 0x0001 + +#define ISNS_FUNC_DEVATTRREG 0x0001 +#define ISNS_FUNC_DEVATTRQRY 0x0002 +#define ISNS_FUNC_DEVGETNEXT 0x0003 +#define ISNS_FUNC_DEVDEREG 0x0004 +#define ISNS_FUNC_SCNREG 0x0005 +#define ISNS_FUNC_SCNDEREG 0x0006 +#define ISNS_FUNC_SCNEVENT 0x0007 +#define ISNS_FUNC_SCN 0x0008 +#define ISNS_FUNC_DDREG 0x0009 +#define ISNS_FUNC_DDDEREG 0x000a +#define ISNS_FUNC_DDSREG 0x000b +#define ISNS_FUNC_DDSDEREG 0x000c +#define ISNS_FUNC_ESI 0x000d +#define ISNS_FUNC_HEARTBEAT 0x000e +#define ISNS_FUNC_RESPONSE 0x8000 + +#define ISNS_FLAG_CLIENT 0x8000 +#define ISNS_FLAG_SERVER 0x4000 +#define ISNS_FLAG_AUTH 0x2000 +#define ISNS_FLAG_REPLACE 0x1000 +#define ISNS_FLAG_LAST 0x0800 +#define ISNS_FLAG_FIRST 0x0400 + +struct isns_hdr { + uint8_t ih_version[2]; + uint8_t ih_function[2]; + uint8_t ih_length[2]; + uint8_t ih_flags[2]; + uint8_t ih_transaction[2]; + uint8_t ih_sequence[2]; +}; + +struct isns_tlv { + uint8_t it_tag[4]; + uint8_t it_length[4]; + uint8_t it_value[]; +}; + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sat Oct 25 15:06:10 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9744A53A; Sat, 25 Oct 2014 15:06:10 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 82CB0126; Sat, 25 Oct 2014 15:06:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9PF6AaT054256; Sat, 25 Oct 2014 15:06:10 GMT (envelope-from kevlo@FreeBSD.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9PF6ACu054255; Sat, 25 Oct 2014 15:06:10 GMT (envelope-from kevlo@FreeBSD.org) Message-Id: <201410251506.s9PF6ACu054255@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kevlo set sender to kevlo@FreeBSD.org using -f From: Kevin Lo Date: Sat, 25 Oct 2014 15:06:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273636 - stable/10/sys/dev/usb/wlan X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 15:06:10 -0000 Author: kevlo Date: Sat Oct 25 15:06:09 2014 New Revision: 273636 URL: https://svnweb.freebsd.org/changeset/base/273636 Log: MFC r273448: Fix the kernel panic in hostap mode. rvp->beacon_mbuf was NULL in run_update_beacon(). PR: 189405 Submitted by: Gabor Simon Modified: stable/10/sys/dev/usb/wlan/if_run.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/wlan/if_run.c ============================================================================== --- stable/10/sys/dev/usb/wlan/if_run.c Sat Oct 25 12:50:26 2014 (r273635) +++ stable/10/sys/dev/usb/wlan/if_run.c Sat Oct 25 15:06:09 2014 (r273636) @@ -4911,6 +4911,12 @@ run_update_beacon(struct ieee80211vap *v } setbit(rvp->bo.bo_flags, item); + if (rvp->beacon_mbuf == NULL) { + rvp->beacon_mbuf = ieee80211_beacon_alloc(vap->iv_bss, + &rvp->bo); + if (rvp->beacon_mbuf == NULL) + return; + } ieee80211_beacon_update(vap->iv_bss, &rvp->bo, rvp->beacon_mbuf, mcast); i = RUN_CMDQ_GET(&sc->cmdq_store); From owner-svn-src-all@FreeBSD.ORG Sat Oct 25 15:14:20 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 20074738; Sat, 25 Oct 2014 15:14:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0B98420B; Sat, 25 Oct 2014 15:14:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9PFEJvE058849; Sat, 25 Oct 2014 15:14:19 GMT (envelope-from kevlo@FreeBSD.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9PFEJmp058848; Sat, 25 Oct 2014 15:14:19 GMT (envelope-from kevlo@FreeBSD.org) Message-Id: <201410251514.s9PFEJmp058848@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kevlo set sender to kevlo@FreeBSD.org using -f From: Kevin Lo Date: Sat, 25 Oct 2014 15:14:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r273637 - stable/9/sys/dev/usb/wlan X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 15:14:20 -0000 Author: kevlo Date: Sat Oct 25 15:14:19 2014 New Revision: 273637 URL: https://svnweb.freebsd.org/changeset/base/273637 Log: MFC r270643, r273448: - Fix typo: s/mac_rev/mac_ver/ - Fix the kernel panic in hostap mode. rvp->beacon_mbuf was NULL in run_update_beacon(). Modified: stable/9/sys/dev/usb/wlan/if_run.c (contents, props changed) Modified: stable/9/sys/dev/usb/wlan/if_run.c ============================================================================== --- stable/9/sys/dev/usb/wlan/if_run.c Sat Oct 25 15:06:09 2014 (r273636) +++ stable/9/sys/dev/usb/wlan/if_run.c Sat Oct 25 15:14:19 2014 (r273637) @@ -4910,6 +4910,12 @@ run_update_beacon(struct ieee80211vap *v } setbit(rvp->bo.bo_flags, item); + if (rvp->beacon_mbuf == NULL) { + rvp->beacon_mbuf = ieee80211_beacon_alloc(vap->iv_bss, + &rvp->bo); + if (rvp->beacon_mbuf == NULL) + return; + } ieee80211_beacon_update(vap->iv_bss, &rvp->bo, rvp->beacon_mbuf, mcast); i = RUN_CMDQ_GET(&sc->cmdq_store); @@ -5487,7 +5493,7 @@ run_rt3070_rf_init(struct run_softc *sc) run_rt3070_rf_write(sc, 17, rf); } - if (sc->mac_rev == 0x3071) { + if (sc->mac_ver == 0x3071) { run_rt3070_rf_read(sc, 1, &rf); rf &= ~(RT3070_RX0_PD | RT3070_TX0_PD); rf |= RT3070_RF_BLOCK | RT3070_RX1_PD | RT3070_TX1_PD; From owner-svn-src-all@FreeBSD.ORG Sat Oct 25 15:16:21 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DC8E689F; Sat, 25 Oct 2014 15:16:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C8CB2220; Sat, 25 Oct 2014 15:16:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9PFGK18059263; Sat, 25 Oct 2014 15:16:20 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9PFGKuN059261; Sat, 25 Oct 2014 15:16:20 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410251516.s9PFGKuN059261@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 25 Oct 2014 15:16:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273638 - in head/sys: geom kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 15:16:21 -0000 Author: mav Date: Sat Oct 25 15:16:19 2014 New Revision: 273638 URL: https://svnweb.freebsd.org/changeset/base/273638 Log: Revert somewhat hackish geom_disk optimization, committed as part of r256880, and the following r273143 commit, supposed to workaround introduced issue by quite innocent-looking change. While there is no clear understanding why, but r273143 is accused in data corruption in some environments with high I/O load. I personally don't see any problem in that commit, and possibly it is just a trigger to some other bug somewhere, but better safe then sorry for now. Requested by: scottl@ MFC after: 3 days Modified: head/sys/geom/geom_disk.c head/sys/kern/vfs_bio.c Modified: head/sys/geom/geom_disk.c ============================================================================== --- head/sys/geom/geom_disk.c Sat Oct 25 15:14:19 2014 (r273637) +++ head/sys/geom/geom_disk.c Sat Oct 25 15:16:19 2014 (r273638) @@ -235,25 +235,6 @@ g_disk_done(struct bio *bp) g_destroy_bio(bp); } -static void -g_disk_done_single(struct bio *bp) -{ - struct bintime now; - struct g_disk_softc *sc; - - bp->bio_completed = bp->bio_length - bp->bio_resid; - bp->bio_done = (void *)bp->bio_to; - bp->bio_to = LIST_FIRST(&bp->bio_disk->d_geom->provider); - if ((bp->bio_cmd & (BIO_READ|BIO_WRITE|BIO_DELETE|BIO_FLUSH)) != 0) { - binuptime(&now); - sc = bp->bio_to->private; - mtx_lock(&sc->done_mtx); - devstat_end_transaction_bio_bt(sc->dp->d_devstat, bp, &now); - mtx_unlock(&sc->done_mtx); - } - g_io_deliver(bp, bp->bio_error); -} - static int g_disk_ioctl(struct g_provider *pp, u_long cmd, void * data, int fflag, struct thread *td) { @@ -277,7 +258,7 @@ g_disk_start(struct bio *bp) struct disk *dp; struct g_disk_softc *sc; int error; - off_t d_maxsize, off; + off_t off; sc = bp->bio_to->private; if (sc == NULL || (dp = sc->dp) == NULL || dp->d_destroyed) { @@ -294,20 +275,6 @@ g_disk_start(struct bio *bp) /* fall-through */ case BIO_READ: case BIO_WRITE: - d_maxsize = (bp->bio_cmd == BIO_DELETE) ? - dp->d_delmaxsize : dp->d_maxsize; - if (bp->bio_length <= d_maxsize) { - bp->bio_disk = dp; - bp->bio_to = (void *)bp->bio_done; - bp->bio_done = g_disk_done_single; - bp->bio_pblkno = bp->bio_offset / dp->d_sectorsize; - bp->bio_bcount = bp->bio_length; - mtx_lock(&sc->start_mtx); - devstat_start_transaction_bio(dp->d_devstat, bp); - mtx_unlock(&sc->start_mtx); - dp->d_strategy(bp); - break; - } off = 0; bp3 = NULL; bp2 = g_clone_bio(bp); @@ -316,6 +283,10 @@ g_disk_start(struct bio *bp) break; } do { + off_t d_maxsize; + + d_maxsize = (bp->bio_cmd == BIO_DELETE) ? + dp->d_delmaxsize : dp->d_maxsize; bp2->bio_offset += off; bp2->bio_length -= off; if ((bp->bio_flags & BIO_UNMAPPED) == 0) { @@ -415,13 +386,17 @@ g_disk_start(struct bio *bp) error = EOPNOTSUPP; break; } - bp->bio_disk = dp; - bp->bio_to = (void *)bp->bio_done; - bp->bio_done = g_disk_done_single; - mtx_lock(&sc->start_mtx); - devstat_start_transaction_bio(dp->d_devstat, bp); - mtx_unlock(&sc->start_mtx); - dp->d_strategy(bp); + bp2 = g_clone_bio(bp); + if (bp2 == NULL) { + g_io_deliver(bp, ENOMEM); + return; + } + bp2->bio_done = g_disk_done; + bp2->bio_disk = dp; + mtx_lock(&sc->start_mtx); + devstat_start_transaction_bio(dp->d_devstat, bp2); + mtx_unlock(&sc->start_mtx); + dp->d_strategy(bp2); break; default: error = EOPNOTSUPP; Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Sat Oct 25 15:14:19 2014 (r273637) +++ head/sys/kern/vfs_bio.c Sat Oct 25 15:16:19 2014 (r273638) @@ -3618,8 +3618,10 @@ biodone(struct bio *bp) bp->bio_flags |= BIO_DONE; wakeup(bp); mtx_unlock(mtxp); - } else + } else { + bp->bio_flags |= BIO_DONE; done(bp); + } } /* From owner-svn-src-all@FreeBSD.ORG Sat Oct 25 16:34:29 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 71FDE881; Sat, 25 Oct 2014 16:34:29 +0000 (UTC) Received: from st11p02mm-asmtp001.mac.com (st11p02mm-asmtp001.mac.com [17.172.220.236]) (using TLSv1 with cipher DES-CBC3-SHA (112/168 bits)) (Client CN "smtp.me.com", Issuer "VeriSign Class 3 Extended Validation SSL SGC CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 44081BA4; Sat, 25 Oct 2014 16:34:28 +0000 (UTC) Received: from fukuyama.hsd1.ca.comcast.net (unknown [73.162.13.215]) by st11p02mm-asmtp001.mac.com (Oracle Communications Messaging Server 7u4-27.10(7.0.4.27.9) 64bit (built Jun 6 2014)) with ESMTPSA id <0NE000MSPE17S780@st11p02mm-asmtp001.mac.com>; Sat, 25 Oct 2014 16:34:21 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.12.52,1.0.28,0.0.0000 definitions=2014-10-25_03:2014-10-24,2014-10-25,1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1408290000 definitions=main-1410250174 Content-type: text/plain; charset=us-ascii MIME-version: 1.0 (Mac OS X Mail 8.0 \(1990.1\)) Subject: Re: svn commit: r273598 - in head: include sys/dev/acpica From: Rui Paulo In-reply-to: <20141025090000.GG1877@kib.kiev.ua> Date: Sat, 25 Oct 2014 09:34:18 -0700 Content-transfer-encoding: 7bit Message-id: <855B73E0-3073-407C-9A42-AEBE9B6744D6@me.com> References: <33decfcd-e77c-4e4c-8161-9f4a232213c6@me.com> <20141024194546.GE1877@kib.kiev.ua> <20141025090000.GG1877@kib.kiev.ua> To: Konstantin Belousov X-Mailer: Apple Mail (2.1990.1) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 16:34:29 -0000 On Oct 25, 2014, at 02:00, Konstantin Belousov wrote: > > Ok, I did looked at the pte of the HPET page. I get the value > 0x80000000fed00025 > which coincides with the resource address 0xfed00000 reported > by devinfo -vr for hpet (to double-check my findings). The low > bits indicate that PAT0 pat entry is used for the page caching > mode. Corresponding PAT MSR 0x277 has the following value: > sandy% sudo cpucontrol -m 0x277 /dev/cpuctl0 > MSR 0x277: 0x00010506 0x00070406 > i.e. memory type is 6, which is write-back, according to SDM. > This is wrong, as I feared. > > The patch below fixes the issue. The pte for HPET page is equal to > 0x80000000fed0003d > after the patch is applied, PAT3 is used, and its value is 0 == > UNCACHEABLE, as it must be. > > Do you agree with the patch ? Yes, thanks for working on this! -- Rui Paulo From owner-svn-src-all@FreeBSD.ORG Sat Oct 25 17:07:36 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8AFDA328; Sat, 25 Oct 2014 17:07:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6BA7BE93; Sat, 25 Oct 2014 17:07:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9PH7aca011623; Sat, 25 Oct 2014 17:07:36 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9PH7aQG011622; Sat, 25 Oct 2014 17:07:36 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410251707.s9PH7aQG011622@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 25 Oct 2014 17:07:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273640 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 17:07:36 -0000 Author: mav Date: Sat Oct 25 17:07:35 2014 New Revision: 273640 URL: https://svnweb.freebsd.org/changeset/base/273640 Log: Add support for 12/16-byte EUI and 16-byte NAA IDs. MFC after: 1 week Modified: head/sys/cam/ctl/ctl.c Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Sat Oct 25 15:32:56 2014 (r273639) +++ head/sys/cam/ctl/ctl.c Sat Oct 25 17:07:35 2014 (r273640) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -4349,6 +4350,36 @@ ctl_init_log_page_index(struct ctl_lun * return (CTL_RETVAL_COMPLETE); } +static int +hex2bin(const char *str, uint8_t *buf, int buf_size) +{ + int i; + u_char c; + + memset(buf, 0, buf_size); + while (isspace(str[0])) + str++; + if (str[0] == '0' && (str[1] == 'x' || str[1] == 'X')) + str += 2; + buf_size *= 2; + for (i = 0; str[i] != 0 && i < buf_size; i++) { + c = str[i]; + if (isdigit(c)) + c -= '0'; + else if (isalpha(c)) + c -= isupper(c) ? 'A' - 10 : 'a' - 10; + else + break; + if (c >= 16) + break; + if ((i & 1) == 0) + buf[i / 2] |= (c << 4); + else + buf[i / 2] |= c; + } + return ((i + 1) / 2); +} + /* * LUN allocation. * @@ -4414,15 +4445,14 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft } eui = ctl_get_opt(&be_lun->options, "eui"); if (eui != NULL) { - len += sizeof(struct scsi_vpd_id_descriptor) + 8; + len += sizeof(struct scsi_vpd_id_descriptor) + 16; } naa = ctl_get_opt(&be_lun->options, "naa"); if (naa != NULL) { - len += sizeof(struct scsi_vpd_id_descriptor) + 8; + len += sizeof(struct scsi_vpd_id_descriptor) + 16; } lun->lun_devid = malloc(sizeof(struct ctl_devid) + len, M_CTL, M_WAITOK | M_ZERO); - lun->lun_devid->len = len; desc = (struct scsi_vpd_id_descriptor *)lun->lun_devid->data; desc->proto_codeset = SVPD_ID_CODESET_ASCII; desc->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_LUN | SVPD_ID_TYPE_T10; @@ -4452,8 +4482,10 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft desc->proto_codeset = SVPD_ID_CODESET_BINARY; desc->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_LUN | SVPD_ID_TYPE_EUI64; - desc->length = 8; - scsi_u64to8b(strtouq(eui, NULL, 0), desc->identifier); + desc->length = hex2bin(eui, desc->identifier, 16); + desc->length = desc->length > 12 ? 16 : + (desc->length > 8 ? 12 : 8); + len -= 16 - desc->length; } if (naa != NULL) { desc = (struct scsi_vpd_id_descriptor *)(&desc->identifier[0] + @@ -4461,9 +4493,11 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft desc->proto_codeset = SVPD_ID_CODESET_BINARY; desc->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_LUN | SVPD_ID_TYPE_NAA; - desc->length = 8; - scsi_u64to8b(strtouq(naa, NULL, 0), desc->identifier); + desc->length = hex2bin(naa, desc->identifier, 16); + desc->length = desc->length > 8 ? 16 : 8; + len -= 16 - desc->length; } + lun->lun_devid->len = len; mtx_lock(&ctl_softc->ctl_lock); /* From owner-svn-src-all@FreeBSD.ORG Sat Oct 25 17:42:46 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 564376C7; Sat, 25 Oct 2014 17:42:46 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 36C1B21B; Sat, 25 Oct 2014 17:42:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9PHgkiR029491; Sat, 25 Oct 2014 17:42:46 GMT (envelope-from jpaetzel@FreeBSD.org) Received: (from jpaetzel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9PHgjwf029487; Sat, 25 Oct 2014 17:42:45 GMT (envelope-from jpaetzel@FreeBSD.org) Message-Id: <201410251742.s9PHgjwf029487@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jpaetzel set sender to jpaetzel@FreeBSD.org using -f From: Josh Paetzel Date: Sat, 25 Oct 2014 17:42:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273641 - in head/sys/cddl: compat/opensolaris/kern contrib/opensolaris/uts/common/fs contrib/opensolaris/uts/common/fs/zfs contrib/opensolaris/uts/common/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 17:42:46 -0000 Author: jpaetzel Date: Sat Oct 25 17:42:44 2014 New Revision: 273641 URL: https://svnweb.freebsd.org/changeset/base/273641 Log: This change addresses 4 bugs in ZFS exposed by Richard Kojedzinszky's crash.sh script attached to FreeNAS bug 4109: https://bugs.freenas.org/issues/4109 Three are in the snapshot layer: a) AVG explains in his notes: https://wiki.freebsd.org/AvgVfsSolarisVsFreeBSD "VOP_INACTIVE must not do any destructive actions to a vnode and its filesystem node, nor invalidate them in any way." gfs_vop_inactive and zfsctl_snapshot_inactive did just that. In OpenSolaris VOP_INACTIVE is much closer to FreeBSD's VOP_RECLAIM. Rename & move them to gfs_vop_reclaim and zfsctl_snapshot_reclaim and merge in the requisite vnode_destroy from zfsctl_common_reclaim. b) gfs_lookup_dot and various zfsctl functions do not honor the FreeBSD VFS convention of only locking from the root downward. When looking up ".." the convention is to drop the current leaf vnode lock before acquiring the directory vnode and then subsequently re-acquiring the lock on the leaf vnode. This fixes that in all the places that our exercised by crash.sh. c) The snapshot may already be unmounted when the directory vnode is reclaimed. Check for this case and return. One in the common layer: d) Callers of traverse expect the reference to the vnode passed in to be maintained. Don't release it. This last one may be an unclear contract. There may in fact be some callers that do expect the reference to be dropped on success in addition to callers that expect it to be released. In this case a further audit of the callers is needed and a consensus on the correct behavior. PR: 184677 Submitted by: kmacy Reviewed by: delphij, will, avg MFC after: 2 weeks Sponsored by: iXsystems Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c head/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c head/sys/cddl/contrib/opensolaris/uts/common/sys/gfs.h Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c Sat Oct 25 17:07:35 2014 (r273640) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c Sat Oct 25 17:42:44 2014 (r273641) @@ -91,11 +91,11 @@ traverse(vnode_t **cvpp, int lktype) error = vfs_busy(vfsp, 0); /* * tvp is NULL for *cvpp vnode, which we can't unlock. + * At least some callers expect the reference to be + * maintained to the original *cvpp */ if (tvp != NULL) vput(cvp); - else - vrele(cvp); if (error) return (error); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c Sat Oct 25 17:07:35 2014 (r273640) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c Sat Oct 25 17:42:44 2014 (r273641) @@ -90,7 +90,7 @@ * gfs_dir_lookup() * gfs_dir_readdir() * - * gfs_vop_inactive() + * gfs_vop_reclaim() * gfs_vop_lookup() * gfs_vop_readdir() * gfs_vop_map() @@ -435,6 +435,8 @@ gfs_readdir_fini(gfs_readdir_state_t *st int gfs_lookup_dot(vnode_t **vpp, vnode_t *dvp, vnode_t *pvp, const char *nm) { + int ltype; + if (*nm == '\0' || strcmp(nm, ".") == 0) { VN_HOLD(dvp); *vpp = dvp; @@ -444,11 +446,15 @@ gfs_lookup_dot(vnode_t **vpp, vnode_t *d ASSERT(dvp->v_flag & VROOT); VN_HOLD(dvp); *vpp = dvp; + ASSERT_VOP_ELOCKED(dvp, "gfs_lookup_dot: non-locked dvp"); } else { + ltype = VOP_ISLOCKED(dvp); + VOP_UNLOCK(dvp, 0); VN_HOLD(pvp); *vpp = pvp; + vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY); + vn_lock(dvp, ltype | LK_RETRY); } - vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY); return (0); } @@ -618,7 +624,7 @@ gfs_root_create_file(size_t size, vfs_t /* * gfs_file_inactive() * - * Called from the VOP_INACTIVE() routine. If necessary, this routine will + * Called from the VOP_RECLAIM() routine. If necessary, this routine will * remove the given vnode from the parent directory and clean up any references * in the VFS layer. * @@ -1215,15 +1221,15 @@ gfs_vop_map(vnode_t *vp, offset_t off, s #endif /* sun */ /* - * gfs_vop_inactive: VOP_INACTIVE() entry point + * gfs_vop_reclaim: VOP_RECLAIM() entry point (solaris' VOP_INACTIVE()) * * Given a vnode that is a GFS file or directory, call gfs_file_inactive() or * gfs_dir_inactive() as necessary, and kmem_free()s associated private data. */ /* ARGSUSED */ int -gfs_vop_inactive(ap) - struct vop_inactive_args /* { +gfs_vop_reclaim(ap) + struct vop_reclaim_args /* { struct vnode *a_vp; struct thread *a_td; } */ *ap; @@ -1236,6 +1242,7 @@ gfs_vop_inactive(ap) else gfs_file_inactive(vp); + vnode_destroy_vobject(vp); VI_LOCK(vp); vp->v_data = NULL; VI_UNLOCK(vp); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Sat Oct 25 17:07:35 2014 (r273640) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Sat Oct 25 17:42:44 2014 (r273641) @@ -603,16 +603,27 @@ zfsctl_freebsd_root_lookup(ap) int nameiop = ap->a_cnp->cn_nameiop; char nm[NAME_MAX + 1]; int err; + int ltype; if ((flags & ISLASTCN) && (nameiop == RENAME || nameiop == CREATE)) return (EOPNOTSUPP); ASSERT(ap->a_cnp->cn_namelen < sizeof(nm)); strlcpy(nm, ap->a_cnp->cn_nameptr, ap->a_cnp->cn_namelen + 1); - err = zfsctl_root_lookup(dvp, nm, vpp, NULL, 0, NULL, cr, NULL, NULL, NULL); - if (err == 0 && (nm[0] != '.' || nm[1] != '\0')) + if (err == 0 && (nm[0] != '.' || nm[1] != '\0')) { + ltype = VOP_ISLOCKED(dvp); + if (flags & ISDOTDOT) { + VN_HOLD(*vpp); + VOP_UNLOCK(dvp, 0); + } vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY); + if (flags & ISDOTDOT) { + VN_RELE(*vpp); + vn_lock(dvp, ltype| LK_RETRY); + } + } + return (err); } @@ -625,8 +636,8 @@ static struct vop_vector zfsctl_ops_root .vop_access = zfsctl_common_access, .vop_readdir = gfs_vop_readdir, .vop_lookup = zfsctl_freebsd_root_lookup, - .vop_inactive = gfs_vop_inactive, - .vop_reclaim = zfsctl_common_reclaim, + .vop_inactive = VOP_NULL, + .vop_reclaim = gfs_vop_reclaim, #ifdef TODO .vop_pathconf = zfsctl_pathconf, #endif @@ -679,7 +690,7 @@ zfsctl_unmount_snap(zfs_snapentry_t *sep * the sd_lock mutex held by our caller. */ ASSERT(svp->v_count == 1); - gfs_vop_inactive(svp, cr, NULL); + gfs_vop_reclaim(svp, cr, NULL); kmem_free(sep->se_name, strlen(sep->se_name) + 1); kmem_free(sep, sizeof (zfs_snapentry_t)); @@ -949,7 +960,7 @@ zfsctl_snapdir_lookup(ap) avl_index_t where; zfsvfs_t *zfsvfs = dvp->v_vfsp->vfs_data; int err; - int flags = 0; + int ltype, flags = 0; /* * No extended attributes allowed under .zfs @@ -973,7 +984,6 @@ zfsctl_snapdir_lookup(ap) return (SET_ERROR(ENOENT)); ZFS_ENTER(zfsvfs); - if (gfs_lookup_dot(vpp, dvp, zfsvfs->z_ctldir, nm) == 0) { ZFS_EXIT(zfsvfs); return (0); @@ -1420,8 +1430,8 @@ static struct vop_vector zfsctl_ops_shar .vop_access = zfsctl_common_access, .vop_readdir = zfsctl_shares_readdir, .vop_lookup = zfsctl_shares_lookup, - .vop_inactive = gfs_vop_inactive, - .vop_reclaim = zfsctl_common_reclaim, + .vop_inactive = VOP_NULL, + .vop_reclaim = gfs_vop_reclaim, .vop_fid = zfsctl_shares_fid, }; #endif /* !sun */ @@ -1449,8 +1459,9 @@ zfsctl_snapshot_mknode(vnode_t *pvp, uin return (vp); } + static int -zfsctl_snapshot_inactive(ap) +zfsctl_snapshot_reclaim(ap) struct vop_inactive_args /* { struct vnode *a_vp; struct thread *a_td; @@ -1458,19 +1469,20 @@ zfsctl_snapshot_inactive(ap) { vnode_t *vp = ap->a_vp; cred_t *cr = ap->a_td->td_ucred; - struct vop_inactive_args iap; + struct vop_reclaim_args iap; zfsctl_snapdir_t *sdp; zfs_snapentry_t *sep, *next; int locked; vnode_t *dvp; - if (vp->v_count > 0) - goto end; - VERIFY(gfs_dir_lookup(vp, "..", &dvp, cr, 0, NULL, NULL) == 0); sdp = dvp->v_data; VOP_UNLOCK(dvp, 0); - + /* this may already have been unmounted */ + if (sdp == NULL) { + VN_RELE(dvp); + return (0); + } if (!(locked = MUTEX_HELD(&sdp->sd_lock))) mutex_enter(&sdp->sd_lock); @@ -1494,7 +1506,6 @@ zfsctl_snapshot_inactive(ap) mutex_exit(&sdp->sd_lock); VN_RELE(dvp); -end: /* * Dispose of the vnode for the snapshot mount point. * This is safe to do because once this entry has been removed @@ -1503,7 +1514,9 @@ end: * creating a new vnode. */ iap.a_vp = vp; - return (gfs_vop_inactive(&iap)); + gfs_vop_reclaim(&iap); + return (0); + } static int @@ -1587,8 +1600,15 @@ zfsctl_snapshot_lookup(ap) error = zfsctl_root_lookup(zfsvfs->z_ctldir, "snapshot", vpp, NULL, 0, NULL, cr, NULL, NULL, NULL); - if (error == 0) + if (error == 0) { + int ltype = VOP_ISLOCKED(dvp); + VN_HOLD(*vpp); + VOP_UNLOCK(dvp, 0); vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY); + VN_RELE(*vpp); + vn_lock(dvp, ltype | LK_RETRY); + } + return (error); } @@ -1640,9 +1660,9 @@ zfsctl_snapshot_vptocnp(struct vop_vptoc */ static struct vop_vector zfsctl_ops_snapshot = { .vop_default = &default_vnodeops, - .vop_inactive = zfsctl_snapshot_inactive, + .vop_inactive = VOP_NULL, .vop_lookup = zfsctl_snapshot_lookup, - .vop_reclaim = zfsctl_common_reclaim, + .vop_reclaim = zfsctl_snapshot_reclaim, .vop_getattr = zfsctl_snapshot_getattr, .vop_fid = zfsctl_snapshot_fid, .vop_vptocnp = zfsctl_snapshot_vptocnp, Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/gfs.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/gfs.h Sat Oct 25 17:07:35 2014 (r273640) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/gfs.h Sat Oct 25 17:42:44 2014 (r273641) @@ -149,7 +149,7 @@ extern int gfs_get_parent_ino(vnode_t *, extern int gfs_lookup_dot(vnode_t **, vnode_t *, vnode_t *, const char *); extern int gfs_vop_readdir(struct vop_readdir_args *); -extern int gfs_vop_inactive(struct vop_inactive_args *); +extern int gfs_vop_reclaim(struct vop_reclaim_args *); #ifdef __cplusplus From owner-svn-src-all@FreeBSD.ORG Sat Oct 25 19:31:35 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 551B1FB0; Sat, 25 Oct 2014 19:31:35 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 282ACE54; Sat, 25 Oct 2014 19:31:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9PJVZWf080555; Sat, 25 Oct 2014 19:31:35 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9PJVYIk080552; Sat, 25 Oct 2014 19:31:34 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201410251931.s9PJVYIk080552@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 25 Oct 2014 19:31:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273644 - head/share/man/man3 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 19:31:35 -0000 Author: jhb Date: Sat Oct 25 19:31:34 2014 New Revision: 273644 URL: https://svnweb.freebsd.org/changeset/base/273644 Log: Clarify that pthread_cleanup_push()/pop() are implemented as macros that create a new code block and thus must be balanced at the same lexical scope. (This is also a requirement in POSIX.) PR: 194280 Submitted by: dr2867.business@pacbell.net MFC after: 1 week Modified: head/share/man/man3/pthread_cleanup_pop.3 head/share/man/man3/pthread_cleanup_push.3 Modified: head/share/man/man3/pthread_cleanup_pop.3 ============================================================================== --- head/share/man/man3/pthread_cleanup_pop.3 Sat Oct 25 19:01:02 2014 (r273643) +++ head/share/man/man3/pthread_cleanup_pop.3 Sat Oct 25 19:31:34 2014 (r273644) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 30, 1998 +.Dd October 25, 2014 .Dt PTHREAD_CLEANUP_POP 3 .Os .Sh NAME @@ -50,6 +50,14 @@ If there is no cleanup routine then .Fn pthread_cleanup_pop does nothing. +.Pp +The +.Fn pthread_cleanup_push +function is implemented as a macro that closes a block. +Invocations of this function must appear as standalone statements that are +paired with an earlier call of +.Xr pthread_cleanup_push 3 +in the same lexical scope. .Sh RETURN VALUES The .Fn pthread_cleanup_pop Modified: head/share/man/man3/pthread_cleanup_push.3 ============================================================================== --- head/share/man/man3/pthread_cleanup_push.3 Sat Oct 25 19:01:02 2014 (r273643) +++ head/share/man/man3/pthread_cleanup_push.3 Sat Oct 25 19:31:34 2014 (r273644) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 30, 1998 +.Dd October 25, 2014 .Dt PTHREAD_CLEANUP_PUSH 3 .Os .Sh NAME @@ -52,6 +52,14 @@ When is called, it is passed .Fa arg as its only argument. +.Pp +The +.Fn pthread_cleanup_push +function is implemented as a macro that opens a new block. +Invocations of this function must appear as standalone statements that are +paired with a later call of +.Xr pthread_cleanup_pop 3 +in the same lexical scope. .Sh RETURN VALUES The .Fn pthread_cleanup_push From owner-svn-src-all@FreeBSD.ORG Sat Oct 25 19:36:43 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2D532216; Sat, 25 Oct 2014 19:36:43 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 063CAF0E; Sat, 25 Oct 2014 19:36:43 +0000 (UTC) Received: from ralph.baldwin.cx (pool-173-70-85-31.nwrknj.fios.verizon.net [173.70.85.31]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 55BEBB926; Sat, 25 Oct 2014 15:36:41 -0400 (EDT) From: John Baldwin To: Andrey Chernov Subject: Re: svn commit: r273601 - head/lib/libc/gen Date: Sat, 25 Oct 2014 15:28:22 -0400 Message-ID: <94327674.WeLfOcjE9r@ralph.baldwin.cx> User-Agent: KMail/4.12.5 (FreeBSD/10.1-BETA2; KDE/4.12.5; amd64; ; ) In-Reply-To: <544B1C34.1020204@freebsd.org> References: <201410241955.s9OJtnbm014234@svn.freebsd.org> <544B0930.8010004@freebsd.org> <544B1C34.1020204@freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Sat, 25 Oct 2014 15:36:41 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 19:36:43 -0000 On Saturday, October 25, 2014 07:42:44 AM Andrey Chernov wrote: > On 25.10.2014 6:21, Andrey Chernov wrote: > > On 24.10.2014 23:55, John Baldwin wrote: > >> Author: jhb > >> Date: Fri Oct 24 19:55:49 2014 > >> New Revision: 273601 > >> URL: https://svnweb.freebsd.org/changeset/base/273601 > >> > >> Log: > >> Don't reference sem(4) from the POSIX semaphore pages. POSIX > >> semaphores > >> were reimplemented using umtx in FreeBSD 9 and no longer use sem(4). > > > > sem kernel module referenced in sem(4) uses the same uipc_sem.c file as > > kernel's P1003_1B_SEMAPHORES option, so they both use the same code and > > better be cross-linked since sem(4) explains how to turn it on. > > From the first glance I can't determine, is libc implementation better > than kernel one or not. BTW, firefox port still recommends sem_load="YES" The sem_init/open/unlike/destroy/post/*wait() API used to use sem(4) (which is sem.ko and the kernel option) from FreeBSD 5 up through FreeBSD 8. These functions have used umtx_op() instead of sem(4) since FreeBSD 9.0. Note that libc/gen/sem_new.c does not call ksem_*. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Sat Oct 25 19:36:43 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3A987219; Sat, 25 Oct 2014 19:36:43 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 13C0DF0F; Sat, 25 Oct 2014 19:36:43 +0000 (UTC) Received: from ralph.baldwin.cx (pool-173-70-85-31.nwrknj.fios.verizon.net [173.70.85.31]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id E6922B98A; Sat, 25 Oct 2014 15:36:41 -0400 (EDT) From: John Baldwin To: Xin LI Subject: Re: svn commit: r273616 - head/sys/kern Date: Sat, 25 Oct 2014 15:25:07 -0400 Message-ID: <4239953.NCThceJcDS@ralph.baldwin.cx> User-Agent: KMail/4.12.5 (FreeBSD/10.1-BETA2; KDE/4.12.5; amd64; ; ) In-Reply-To: <201410250016.s9P0Gaq4038542@svn.freebsd.org> References: <201410250016.s9P0Gaq4038542@svn.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Sat, 25 Oct 2014 15:36:42 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 19:36:43 -0000 On Saturday, October 25, 2014 12:16:36 AM Xin LI wrote: > Author: delphij > Date: Sat Oct 25 00:16:36 2014 > New Revision: 273616 > URL: https://svnweb.freebsd.org/changeset/base/273616 > > Log: > Fix build. Thanks, I had this fixed in the tree I used for testing but it didn't get committed into my test branch. :( -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Sat Oct 25 20:11:38 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 68FE5AB8; Sat, 25 Oct 2014 20:11:38 +0000 (UTC) Received: from mho-02-ewr.mailhop.org (mho-02-ewr.mailhop.org [204.13.248.72]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2B017331; Sat, 25 Oct 2014 20:11:38 +0000 (UTC) Received: from [73.34.117.227] (helo=ilsoft.org) by mho-02-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1Xi7gX-000AKH-3H; Sat, 25 Oct 2014 20:11:37 +0000 Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by ilsoft.org (8.14.9/8.14.9) with ESMTP id s9PKBaIx072808; Sat, 25 Oct 2014 14:11:36 -0600 (MDT) (envelope-from ian@FreeBSD.org) X-Mail-Handler: Dyn Standard SMTP by Dyn X-Originating-IP: 73.34.117.227 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX1+7zj/cN6prOY2+ZU8JLbpr X-Authentication-Warning: paranoia.hippie.lan: Host revolution.hippie.lan [172.22.42.240] claimed to be [172.22.42.240] Subject: Re: svn commit: r273644 - head/share/man/man3 From: Ian Lepore To: John Baldwin In-Reply-To: <201410251931.s9PJVYIk080552@svn.freebsd.org> References: <201410251931.s9PJVYIk080552@svn.freebsd.org> Content-Type: text/plain; charset="us-ascii" Date: Sat, 25 Oct 2014 14:11:36 -0600 Message-ID: <1414267896.12052.652.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 20:11:38 -0000 On Sat, 2014-10-25 at 19:31 +0000, John Baldwin wrote: > Author: jhb > Date: Sat Oct 25 19:31:34 2014 > New Revision: 273644 > URL: https://svnweb.freebsd.org/changeset/base/273644 > > Log: > Clarify that pthread_cleanup_push()/pop() are implemented as macros that > create a new code block and thus must be balanced at the same lexical > scope. (This is also a requirement in POSIX.) > > PR: 194280 > Submitted by: dr2867.business@pacbell.net > MFC after: 1 week > > Modified: > head/share/man/man3/pthread_cleanup_pop.3 > head/share/man/man3/pthread_cleanup_push.3 > > Modified: head/share/man/man3/pthread_cleanup_pop.3 > ============================================================================== > --- head/share/man/man3/pthread_cleanup_pop.3 Sat Oct 25 19:01:02 2014 (r273643) > +++ head/share/man/man3/pthread_cleanup_pop.3 Sat Oct 25 19:31:34 2014 (r273644) > @@ -27,7 +27,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd July 30, 1998 > +.Dd October 25, 2014 > .Dt PTHREAD_CLEANUP_POP 3 > .Os > .Sh NAME > @@ -50,6 +50,14 @@ If there is no cleanup routine > then > .Fn pthread_cleanup_pop > does nothing. > +.Pp > +The > +.Fn pthread_cleanup_push Should be pop? -- Ian > +function is implemented as a macro that closes a block. > +Invocations of this function must appear as standalone statements that are > +paired with an earlier call of > +.Xr pthread_cleanup_push 3 > +in the same lexical scope. > .Sh RETURN VALUES > The > .Fn pthread_cleanup_pop > > Modified: head/share/man/man3/pthread_cleanup_push.3 > ============================================================================== > --- head/share/man/man3/pthread_cleanup_push.3 Sat Oct 25 19:01:02 2014 (r273643) > +++ head/share/man/man3/pthread_cleanup_push.3 Sat Oct 25 19:31:34 2014 (r273644) > @@ -27,7 +27,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd July 30, 1998 > +.Dd October 25, 2014 > .Dt PTHREAD_CLEANUP_PUSH 3 > .Os > .Sh NAME > @@ -52,6 +52,14 @@ When > is called, it is passed > .Fa arg > as its only argument. > +.Pp > +The > +.Fn pthread_cleanup_push > +function is implemented as a macro that opens a new block. > +Invocations of this function must appear as standalone statements that are > +paired with a later call of > +.Xr pthread_cleanup_pop 3 > +in the same lexical scope. > .Sh RETURN VALUES > The > .Fn pthread_cleanup_push > From owner-svn-src-all@FreeBSD.ORG Sat Oct 25 20:34:12 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DB28C301; Sat, 25 Oct 2014 20:34:12 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C549C772; Sat, 25 Oct 2014 20:34:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9PKYCKs008765; Sat, 25 Oct 2014 20:34:12 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9PKYBYA008753; Sat, 25 Oct 2014 20:34:11 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201410252034.s9PKYBYA008753@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 25 Oct 2014 20:34:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273645 - in stable/10/sys: arm/conf arm/xilinx boot/fdt/dts/arm dev/cadence X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 20:34:13 -0000 Author: ian Date: Sat Oct 25 20:34:10 2014 New Revision: 273645 URL: https://svnweb.freebsd.org/changeset/base/273645 Log: MFC r268633, r271046: Fixes and enhancements for the if_cgem driver... - miibus fixes as suggested by Yonghyeon Pyun. - enable VLAN MTU support. - fix a few WITNESS complaints in cgem_attach(). - have cgem_attach() properly init the ifnet struct before calling mii_attach() to fix panic when using e1000phy. - fix ethernet address changing. - fix transmit queue overflow handling. - tweak receive queue handling to reduce receive overflows. - bring out MAC statistic counters to sysctls. - add e1000phy to config file. - implement receive hang work-around described in reference guide. - change device name from if_cgem to cgem to be consistent with other interfaces. Fix the Zedboard/Zynq ethernet driver to handle media speed changes so that it can connect to switches at speeds other than 1gb. Modified: stable/10/sys/arm/conf/ZEDBOARD stable/10/sys/arm/xilinx/files.zynq7 stable/10/sys/arm/xilinx/zy7_slcr.c stable/10/sys/arm/xilinx/zy7_slcr.h stable/10/sys/boot/fdt/dts/arm/zedboard.dts stable/10/sys/dev/cadence/if_cgem.c stable/10/sys/dev/cadence/if_cgem_hw.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/conf/ZEDBOARD ============================================================================== --- stable/10/sys/arm/conf/ZEDBOARD Sat Oct 25 19:31:34 2014 (r273644) +++ stable/10/sys/arm/conf/ZEDBOARD Sat Oct 25 20:34:10 2014 (r273645) @@ -72,8 +72,9 @@ options KDB device loop device random device ether -device if_cgem # Zynq-7000 gig ethernet device +device cgem # Zynq-7000 gig ethernet device device mii +device e1000phy device pty device uart device gpio Modified: stable/10/sys/arm/xilinx/files.zynq7 ============================================================================== --- stable/10/sys/arm/xilinx/files.zynq7 Sat Oct 25 19:31:34 2014 (r273644) +++ stable/10/sys/arm/xilinx/files.zynq7 Sat Oct 25 20:34:10 2014 (r273645) @@ -23,7 +23,7 @@ arm/xilinx/zy7_slcr.c standard arm/xilinx/zy7_devcfg.c standard arm/xilinx/zy7_mp.c optional smp -dev/cadence/if_cgem.c optional if_cgem +dev/cadence/if_cgem.c optional cgem dev/sdhci/sdhci_fdt.c optional sdhci arm/xilinx/zy7_ehci.c optional ehci arm/xilinx/uart_dev_cdnc.c optional uart Modified: stable/10/sys/arm/xilinx/zy7_slcr.c ============================================================================== --- stable/10/sys/arm/xilinx/zy7_slcr.c Sat Oct 25 19:31:34 2014 (r273644) +++ stable/10/sys/arm/xilinx/zy7_slcr.c Sat Oct 25 20:34:10 2014 (r273645) @@ -71,12 +71,14 @@ extern void (*zynq7_cpu_reset); #define ZSLCR_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx) #define ZSLCR_LOCK_INIT(sc) \ mtx_init(&(sc)->sc_mtx, device_get_nameunit((sc)->dev), \ - "zy7_slcr", MTX_SPIN) + "zy7_slcr", MTX_DEF) #define ZSLCR_LOCK_DESTROY(_sc) mtx_destroy(&_sc->sc_mtx); #define RD4(sc, off) (bus_read_4((sc)->mem_res, (off))) #define WR4(sc, off, val) (bus_write_4((sc)->mem_res, (off), (val))) +#define ZYNQ_DEFAULT_PS_CLK_FREQUENCY 33333333 /* 33.3 Mhz */ + SYSCTL_NODE(_hw, OID_AUTO, zynq, CTLFLAG_RD, 0, "Xilinx Zynq-7000"); @@ -84,7 +86,7 @@ static char zynq_bootmode[64]; SYSCTL_STRING(_hw_zynq, OID_AUTO, bootmode, CTLFLAG_RD, zynq_bootmode, 0, "Zynq boot mode"); -static char zynq_pssid[80]; +static char zynq_pssid[100]; SYSCTL_STRING(_hw_zynq, OID_AUTO, pssid, CTLFLAG_RD, zynq_pssid, 0, "Zynq PSS IDCODE"); @@ -92,6 +94,22 @@ static uint32_t zynq_reboot_status; SYSCTL_INT(_hw_zynq, OID_AUTO, reboot_status, CTLFLAG_RD, &zynq_reboot_status, 0, "Zynq REBOOT_STATUS register"); +static int ps_clk_frequency; +SYSCTL_INT(_hw_zynq, OID_AUTO, ps_clk_frequency, CTLFLAG_RD, &ps_clk_frequency, + 0, "Zynq PS_CLK Frequency"); + +static int io_pll_frequency; +SYSCTL_INT(_hw_zynq, OID_AUTO, io_pll_frequency, CTLFLAG_RD, &io_pll_frequency, + 0, "Zynq IO PLL Frequency"); + +static int arm_pll_frequency; +SYSCTL_INT(_hw_zynq, OID_AUTO, arm_pll_frequency, CTLFLAG_RD, + &arm_pll_frequency, 0, "Zynq ARM PLL Frequency"); + +static int ddr_pll_frequency; +SYSCTL_INT(_hw_zynq, OID_AUTO, ddr_pll_frequency, CTLFLAG_RD, + &ddr_pll_frequency, 0, "Zynq DDR PLL Frequency"); + static void zy7_slcr_unlock(struct zy7_slcr_softc *sc) { @@ -189,6 +207,54 @@ zy7_slcr_postload_pl(int en_level_shifte ZSLCR_UNLOCK(sc); } +/* Override cgem_set_refclk() in gigabit ethernet driver + * (sys/dev/cadence/if_cgem.c). This function is called to + * request a change in the gem's reference clock speed. + */ +int +cgem_set_ref_clk(int unit, int frequency) +{ + struct zy7_slcr_softc *sc = zy7_slcr_softc_p; + int div0, div1; + + if (!sc) + return (-1); + + /* Find suitable divisor pairs. Round result to nearest khz + * to test for match. + */ + for (div1 = 1; div1 <= ZY7_SLCR_GEM_CLK_CTRL_DIVISOR1_MAX; div1++) { + div0 = (io_pll_frequency + div1 * frequency / 2) / + div1 / frequency; + if (div0 > 0 && div0 <= ZY7_SLCR_GEM_CLK_CTRL_DIVISOR_MAX && + ((io_pll_frequency / div0 / div1) + 500) / 1000 == + (frequency + 500) / 1000) + break; + } + + if (div1 > ZY7_SLCR_GEM_CLK_CTRL_DIVISOR1_MAX) + return (-1); + + ZSLCR_LOCK(sc); + + /* Unlock SLCR registers. */ + zy7_slcr_unlock(sc); + + /* Modify GEM reference clock. */ + WR4(sc, unit ? ZY7_SLCR_GEM1_CLK_CTRL : ZY7_SLCR_GEM0_CLK_CTRL, + (div1 << ZY7_SLCR_GEM_CLK_CTRL_DIVISOR1_SHIFT) | + (div0 << ZY7_SLCR_GEM_CLK_CTRL_DIVISOR_SHIFT) | + ZY7_SLCR_GEM_CLK_CTRL_SRCSEL_IO_PLL | + ZY7_SLCR_GEM_CLK_CTRL_CLKACT); + + /* Lock SLCR registers. */ + zy7_slcr_lock(sc); + + ZSLCR_UNLOCK(sc); + + return (0); +} + static int zy7_slcr_probe(device_t dev) { @@ -208,8 +274,13 @@ zy7_slcr_attach(device_t dev) { struct zy7_slcr_softc *sc = device_get_softc(dev); int rid; + phandle_t node; + pcell_t cell; uint32_t bootmode; uint32_t pss_idcode; + uint32_t arm_pll_ctrl; + uint32_t ddr_pll_ctrl; + uint32_t io_pll_ctrl; static char *bootdev_names[] = { "JTAG", "Quad-SPI", "NOR", "(3?)", "NAND", "SD Card", "(6?)", "(7?)" @@ -260,6 +331,53 @@ zy7_slcr_attach(device_t dev) zynq_reboot_status = RD4(sc, ZY7_SLCR_REBOOT_STAT); + /* Derive PLL frequencies from PS_CLK. */ + node = ofw_bus_get_node(dev); + if (OF_getprop(node, "clock-frequency", &cell, sizeof(cell)) > 0) + ps_clk_frequency = fdt32_to_cpu(cell); + else + ps_clk_frequency = ZYNQ_DEFAULT_PS_CLK_FREQUENCY; + + arm_pll_ctrl = RD4(sc, ZY7_SLCR_ARM_PLL_CTRL); + ddr_pll_ctrl = RD4(sc, ZY7_SLCR_DDR_PLL_CTRL); + io_pll_ctrl = RD4(sc, ZY7_SLCR_IO_PLL_CTRL); + + /* Determine ARM PLL frequency. */ + if (((arm_pll_ctrl & ZY7_SLCR_PLL_CTRL_BYPASS_QUAL) == 0 && + (arm_pll_ctrl & ZY7_SLCR_PLL_CTRL_BYPASS_FORCE) != 0) || + ((arm_pll_ctrl & ZY7_SLCR_PLL_CTRL_BYPASS_QUAL) != 0 && + (bootmode & ZY7_SLCR_BOOT_MODE_PLL_BYPASS) != 0)) + /* PLL is bypassed. */ + arm_pll_frequency = ps_clk_frequency; + else + arm_pll_frequency = ps_clk_frequency * + ((arm_pll_ctrl & ZY7_SLCR_PLL_CTRL_FDIV_MASK) >> + ZY7_SLCR_PLL_CTRL_FDIV_SHIFT); + + /* Determine DDR PLL frequency. */ + if (((ddr_pll_ctrl & ZY7_SLCR_PLL_CTRL_BYPASS_QUAL) == 0 && + (ddr_pll_ctrl & ZY7_SLCR_PLL_CTRL_BYPASS_FORCE) != 0) || + ((ddr_pll_ctrl & ZY7_SLCR_PLL_CTRL_BYPASS_QUAL) != 0 && + (bootmode & ZY7_SLCR_BOOT_MODE_PLL_BYPASS) != 0)) + /* PLL is bypassed. */ + ddr_pll_frequency = ps_clk_frequency; + else + ddr_pll_frequency = ps_clk_frequency * + ((ddr_pll_ctrl & ZY7_SLCR_PLL_CTRL_FDIV_MASK) >> + ZY7_SLCR_PLL_CTRL_FDIV_SHIFT); + + /* Determine IO PLL frequency. */ + if (((io_pll_ctrl & ZY7_SLCR_PLL_CTRL_BYPASS_QUAL) == 0 && + (io_pll_ctrl & ZY7_SLCR_PLL_CTRL_BYPASS_FORCE) != 0) || + ((io_pll_ctrl & ZY7_SLCR_PLL_CTRL_BYPASS_QUAL) != 0 && + (bootmode & ZY7_SLCR_BOOT_MODE_PLL_BYPASS) != 0)) + /* PLL is bypassed. */ + io_pll_frequency = ps_clk_frequency; + else + io_pll_frequency = ps_clk_frequency * + ((io_pll_ctrl & ZY7_SLCR_PLL_CTRL_FDIV_MASK) >> + ZY7_SLCR_PLL_CTRL_FDIV_SHIFT); + /* Lock SLCR registers. */ zy7_slcr_lock(sc); Modified: stable/10/sys/arm/xilinx/zy7_slcr.h ============================================================================== --- stable/10/sys/arm/xilinx/zy7_slcr.h Sat Oct 25 19:31:34 2014 (r273644) +++ stable/10/sys/arm/xilinx/zy7_slcr.h Sat Oct 25 20:34:10 2014 (r273645) @@ -126,6 +126,18 @@ #define ZY7_SLCR_GEM1_RCLK_CTRL 0x013c #define ZY7_SLCR_GEM0_CLK_CTRL 0x0140 #define ZY7_SLCR_GEM1_CLK_CTRL 0x0144 +#define ZY7_SLCR_GEM_CLK_CTRL_DIVISOR1_MASK (0x3f<<20) +#define ZY7_SLCR_GEM_CLK_CTRL_DIVISOR1_SHIFT 20 +#define ZY7_SLCR_GEM_CLK_CTRL_DIVISOR1_MAX 0x3f +#define ZY7_SLCR_GEM_CLK_CTRL_DIVISOR_MASK (0x3f<<8) +#define ZY7_SLCR_GEM_CLK_CTRL_DIVISOR_SHIFT 8 +#define ZY7_SLCR_GEM_CLK_CTRL_DIVISOR_MAX 0x3f +#define ZY7_SLCR_GEM_CLK_CTRL_SRCSEL_MASK (7<<4) +#define ZY7_SLCR_GEM_CLK_CTRL_SRCSEL_IO_PLL (0<<4) +#define ZY7_SLCR_GEM_CLK_CTRL_SRCSEL_ARM_PLL (2<<4) +#define ZY7_SLCR_GEM_CLK_CTRL_SRCSEL_DDR_PLL (3<<4) +#define ZY7_SLCR_GEM_CLK_CTRL_SRCSEL_EMIO_CLK (4<<4) +#define ZY7_SLCR_GEM_CLK_CTRL_CLKACT 1 #define ZY7_SLCR_SMC_CLK_CTRL 0x0148 #define ZY7_SLCR_LQSPI_CLK_CTRL 0x014c #define ZY7_SLCR_SDIO_CLK_CTRL 0x0150 @@ -274,6 +286,7 @@ #ifdef _KERNEL extern void zy7_slcr_preload_pl(void); -extern void zy7_slcr_postload_pl(int); +extern void zy7_slcr_postload_pl(int en_level_shifters); +extern int cgem_set_ref_clk(int unit, int frequency); #endif #endif /* _ZY7_SLCR_H_ */ Modified: stable/10/sys/boot/fdt/dts/arm/zedboard.dts ============================================================================== --- stable/10/sys/boot/fdt/dts/arm/zedboard.dts Sat Oct 25 19:31:34 2014 (r273644) +++ stable/10/sys/boot/fdt/dts/arm/zedboard.dts Sat Oct 25 20:34:10 2014 (r273645) @@ -63,6 +63,7 @@ slcr: slcr@7000 { compatible = "xlnx,zy7_slcr"; reg = <0x0 0x1000>; + clock-frequency = <33333333>; // 33Mhz PS_CLK }; // Interrupt controller @@ -175,6 +176,7 @@ reg = <0xb000 0x1000>; interrupts = <54 55>; interrupt-parent = <&GIC>; + ref-clock-num = <0>; }; // SDIO Modified: stable/10/sys/dev/cadence/if_cgem.c ============================================================================== --- stable/10/sys/dev/cadence/if_cgem.c Sat Oct 25 19:31:34 2014 (r273644) +++ stable/10/sys/dev/cadence/if_cgem.c Sat Oct 25 20:34:10 2014 (r273645) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2012-2013 Thomas Skibo + * Copyright (c) 2012-2014 Thomas Skibo * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -81,17 +81,17 @@ __FBSDID("$FreeBSD$"); #define IF_CGEM_NAME "cgem" -#define CGEM_NUM_RX_DESCS 256 /* size of receive descriptor ring */ -#define CGEM_NUM_TX_DESCS 256 /* size of transmit descriptor ring */ +#define CGEM_NUM_RX_DESCS 512 /* size of receive descriptor ring */ +#define CGEM_NUM_TX_DESCS 512 /* size of transmit descriptor ring */ #define MAX_DESC_RING_SIZE (MAX(CGEM_NUM_RX_DESCS*sizeof(struct cgem_rx_desc),\ CGEM_NUM_TX_DESCS*sizeof(struct cgem_tx_desc))) /* Default for sysctl rxbufs. Must be < CGEM_NUM_RX_DESCS of course. */ -#define DEFAULT_NUM_RX_BUFS 64 /* number of receive bufs to queue. */ +#define DEFAULT_NUM_RX_BUFS 256 /* number of receive bufs to queue. */ -#define TX_MAX_DMA_SEGS 4 /* maximum segs in a tx mbuf dma */ +#define TX_MAX_DMA_SEGS 8 /* maximum segs in a tx mbuf dma */ #define CGEM_CKSUM_ASSIST (CSUM_IP | CSUM_TCP | CSUM_UDP | \ CSUM_TCP_IPV6 | CSUM_UDP_IPV6) @@ -101,12 +101,14 @@ struct cgem_softc { struct mtx sc_mtx; device_t dev; device_t miibus; + u_int mii_media_active; /* last active media */ int if_old_flags; struct resource *mem_res; struct resource *irq_res; void *intrhand; struct callout tick_ch; uint32_t net_ctl_shadow; + int ref_clk_num; u_char eaddr[6]; bus_dma_tag_t desc_dma_tag; @@ -122,7 +124,11 @@ struct cgem_softc { int rxring_queued; /* how many rcv bufs queued */ bus_dmamap_t rxring_dma_map; int rxbufs; /* tunable number rcv bufs */ - int rxoverruns; /* rx ring overruns */ + int rxhangwar; /* rx hang work-around */ + u_int rxoverruns; /* rx overruns */ + u_int rxnobufs; /* rx buf ring empty events */ + u_int rxdmamapfails; /* rx dmamap failures */ + uint32_t rx_frames_prev; /* transmit descriptor ring */ struct cgem_tx_desc *txring; @@ -133,6 +139,56 @@ struct cgem_softc { int txring_tl_ptr; /* next xmit mbuf to free */ int txring_queued; /* num xmits segs queued */ bus_dmamap_t txring_dma_map; + u_int txfull; /* tx ring full events */ + u_int txdefrags; /* tx calls to m_defrag() */ + u_int txdefragfails; /* tx m_defrag() failures */ + u_int txdmamapfails; /* tx dmamap failures */ + + /* hardware provided statistics */ + struct cgem_hw_stats { + uint64_t tx_bytes; + uint32_t tx_frames; + uint32_t tx_frames_bcast; + uint32_t tx_frames_multi; + uint32_t tx_frames_pause; + uint32_t tx_frames_64b; + uint32_t tx_frames_65to127b; + uint32_t tx_frames_128to255b; + uint32_t tx_frames_256to511b; + uint32_t tx_frames_512to1023b; + uint32_t tx_frames_1024to1536b; + uint32_t tx_under_runs; + uint32_t tx_single_collisn; + uint32_t tx_multi_collisn; + uint32_t tx_excsv_collisn; + uint32_t tx_late_collisn; + uint32_t tx_deferred_frames; + uint32_t tx_carrier_sense_errs; + + uint64_t rx_bytes; + uint32_t rx_frames; + uint32_t rx_frames_bcast; + uint32_t rx_frames_multi; + uint32_t rx_frames_pause; + uint32_t rx_frames_64b; + uint32_t rx_frames_65to127b; + uint32_t rx_frames_128to255b; + uint32_t rx_frames_256to511b; + uint32_t rx_frames_512to1023b; + uint32_t rx_frames_1024to1536b; + uint32_t rx_frames_undersize; + uint32_t rx_frames_oversize; + uint32_t rx_frames_jabber; + uint32_t rx_frames_fcs_errs; + uint32_t rx_frames_length_errs; + uint32_t rx_symbol_errs; + uint32_t rx_align_errs; + uint32_t rx_resource_errs; + uint32_t rx_overrun_errs; + uint32_t rx_ip_hdr_csum_errs; + uint32_t rx_tcp_csum_errs; + uint32_t rx_udp_csum_errs; + } stats; }; #define RD4(sc, off) (bus_read_4((sc)->mem_res, (off))) @@ -148,6 +204,9 @@ struct cgem_softc { #define CGEM_LOCK_DESTROY(sc) mtx_destroy(&(sc)->sc_mtx) #define CGEM_ASSERT_LOCKED(sc) mtx_assert(&(sc)->sc_mtx, MA_OWNED) +/* Allow platforms to optionally provide a way to set the reference clock. */ +int cgem_set_ref_clk(int unit, int frequency); + static devclass_t cgem_devclass; static int cgem_probe(device_t dev); @@ -156,6 +215,8 @@ static int cgem_detach(device_t dev); static void cgem_tick(void *); static void cgem_intr(void *); +static void cgem_mediachange(struct cgem_softc *, struct mii_data *); + static void cgem_get_mac(struct cgem_softc *sc, u_char eaddr[]) { @@ -192,10 +253,16 @@ cgem_get_mac(struct cgem_softc *sc, u_ch "random: %02x:%02x:%02x:%02x:%02x:%02x\n", eaddr[0], eaddr[1], eaddr[2], eaddr[3], eaddr[4], eaddr[5]); + } - WR4(sc, CGEM_SPEC_ADDR_LOW(0), (eaddr[3] << 24) | - (eaddr[2] << 16) | (eaddr[1] << 8) | eaddr[0]); - WR4(sc, CGEM_SPEC_ADDR_HI(0), (eaddr[5] << 8) | eaddr[4]); + /* Move address to first slot and zero out the rest. */ + WR4(sc, CGEM_SPEC_ADDR_LOW(0), (eaddr[3] << 24) | + (eaddr[2] << 16) | (eaddr[1] << 8) | eaddr[0]); + WR4(sc, CGEM_SPEC_ADDR_HI(0), (eaddr[5] << 8) | eaddr[4]); + + for (i = 1; i < 4; i++) { + WR4(sc, CGEM_SPEC_ADDR_LOW(i), 0); + WR4(sc, CGEM_SPEC_ADDR_HI(i), 0); } } @@ -421,7 +488,7 @@ cgem_fill_rqueue(struct cgem_softc *sc) if (bus_dmamap_load_mbuf_sg(sc->mbuf_dma_tag, sc->rxring_m_dmamap[sc->rxring_hd_ptr], m, segs, &nsegs, BUS_DMA_NOWAIT)) { - /* XXX: warn? */ + sc->rxdmamapfails++; m_free(m); break; } @@ -450,12 +517,14 @@ static void cgem_recv(struct cgem_softc *sc) { struct ifnet *ifp = sc->ifp; - struct mbuf *m; + struct mbuf *m, *m_hd, **m_tl; uint32_t ctl; CGEM_ASSERT_LOCKED(sc); /* Pick up all packets in which the OWN bit is set. */ + m_hd = NULL; + m_tl = &m_hd; while (sc->rxring_queued > 0 && (sc->rxring[sc->rxring_tl_ptr].addr & CGEM_RXDESC_OWN) != 0) { @@ -492,7 +561,7 @@ cgem_recv(struct cgem_softc *sc) continue; } - /* Hand it off to upper layers. */ + /* Ready it to hand off to upper layers. */ m->m_data += ETHER_ALIGN; m->m_len = (ctl & CGEM_RXDESC_LENGTH_MASK); m->m_pkthdr.rcvif = ifp; @@ -520,11 +589,24 @@ cgem_recv(struct cgem_softc *sc) } } + /* Queue it up for delivery below. */ + *m_tl = m; + m_tl = &m->m_next; + } + + /* Replenish receive buffers. */ + cgem_fill_rqueue(sc); + + /* Unlock and send up packets. */ + CGEM_UNLOCK(sc); + while (m_hd != NULL) { + m = m_hd; + m_hd = m_hd->m_next; + m->m_next = NULL; ifp->if_ipackets++; - CGEM_UNLOCK(sc); (*ifp->if_input)(ifp, m); - CGEM_LOCK(sc); } + CGEM_LOCK(sc); } /* Find completed transmits and free their mbufs. */ @@ -590,6 +672,8 @@ cgem_clean_tx(struct cgem_softc *sc) else sc->txring_tl_ptr++; sc->txring_queued--; + + sc->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; } } @@ -610,16 +694,17 @@ cgem_start_locked(struct ifnet *ifp) for (;;) { /* Check that there is room in the descriptor ring. */ - if (sc->txring_queued >= CGEM_NUM_TX_DESCS - - TX_MAX_DMA_SEGS - 1) { + if (sc->txring_queued >= + CGEM_NUM_TX_DESCS - TX_MAX_DMA_SEGS * 2) { /* Try to make room. */ cgem_clean_tx(sc); /* Still no room? */ - if (sc->txring_queued >= CGEM_NUM_TX_DESCS - - TX_MAX_DMA_SEGS - 1) { + if (sc->txring_queued >= + CGEM_NUM_TX_DESCS - TX_MAX_DMA_SEGS * 2) { ifp->if_drv_flags |= IFF_DRV_OACTIVE; + sc->txfull++; break; } } @@ -638,6 +723,7 @@ cgem_start_locked(struct ifnet *ifp) struct mbuf *m2 = m_defrag(m, M_NOWAIT); if (m2 == NULL) { + sc->txdefragfails++; m_freem(m); continue; } @@ -645,10 +731,12 @@ cgem_start_locked(struct ifnet *ifp) err = bus_dmamap_load_mbuf_sg(sc->mbuf_dma_tag, sc->txring_m_dmamap[sc->txring_hd_ptr], m, segs, &nsegs, BUS_DMA_NOWAIT); + sc->txdefrags++; } if (err) { /* Give up. */ m_freem(m); + sc->txdmamapfails++; continue; } sc->txring_m[sc->txring_hd_ptr] = m; @@ -692,8 +780,10 @@ cgem_start_locked(struct ifnet *ifp) /* Kick the transmitter. */ WR4(sc, CGEM_NET_CTRL, sc->net_ctl_shadow | CGEM_NET_CTRL_START_TX); - } + /* If there is a BPF listener, bounce a copy to to him. */ + ETHER_BPF_MTAP(ifp, m); + } } static void @@ -706,27 +796,69 @@ cgem_start(struct ifnet *ifp) CGEM_UNLOCK(sc); } -/* Respond to changes in media. */ static void -cgem_media_update(struct cgem_softc *sc, int active) +cgem_poll_hw_stats(struct cgem_softc *sc) { - uint32_t net_cfg; + uint32_t n; CGEM_ASSERT_LOCKED(sc); - /* Update hardware to reflect phy status. */ - net_cfg = RD4(sc, CGEM_NET_CFG); - net_cfg &= ~(CGEM_NET_CFG_SPEED100 | CGEM_NET_CFG_GIGE_EN | - CGEM_NET_CFG_FULL_DUPLEX); - - if (IFM_SUBTYPE(active) == IFM_1000_T) - net_cfg |= (CGEM_NET_CFG_SPEED100 | CGEM_NET_CFG_GIGE_EN); - else if (IFM_SUBTYPE(active) == IFM_100_TX) - net_cfg |= CGEM_NET_CFG_SPEED100; + sc->stats.tx_bytes += RD4(sc, CGEM_OCTETS_TX_BOT); + sc->stats.tx_bytes += (uint64_t)RD4(sc, CGEM_OCTETS_TX_TOP) << 32; - if ((active & IFM_FDX) != 0) - net_cfg |= CGEM_NET_CFG_FULL_DUPLEX; - WR4(sc, CGEM_NET_CFG, net_cfg); + sc->stats.tx_frames += RD4(sc, CGEM_FRAMES_TX); + sc->stats.tx_frames_bcast += RD4(sc, CGEM_BCAST_FRAMES_TX); + sc->stats.tx_frames_multi += RD4(sc, CGEM_MULTI_FRAMES_TX); + sc->stats.tx_frames_pause += RD4(sc, CGEM_PAUSE_FRAMES_TX); + sc->stats.tx_frames_64b += RD4(sc, CGEM_FRAMES_64B_TX); + sc->stats.tx_frames_65to127b += RD4(sc, CGEM_FRAMES_65_127B_TX); + sc->stats.tx_frames_128to255b += RD4(sc, CGEM_FRAMES_128_255B_TX); + sc->stats.tx_frames_256to511b += RD4(sc, CGEM_FRAMES_256_511B_TX); + sc->stats.tx_frames_512to1023b += RD4(sc, CGEM_FRAMES_512_1023B_TX); + sc->stats.tx_frames_1024to1536b += RD4(sc, CGEM_FRAMES_1024_1518B_TX); + sc->stats.tx_under_runs += RD4(sc, CGEM_TX_UNDERRUNS); + + n = RD4(sc, CGEM_SINGLE_COLL_FRAMES); + sc->stats.tx_single_collisn += n; + sc->ifp->if_collisions += n; + n = RD4(sc, CGEM_MULTI_COLL_FRAMES); + sc->stats.tx_multi_collisn += n; + sc->ifp->if_collisions += n; + n = RD4(sc, CGEM_EXCESSIVE_COLL_FRAMES); + sc->stats.tx_excsv_collisn += n; + sc->ifp->if_collisions += n; + n = RD4(sc, CGEM_LATE_COLL); + sc->stats.tx_late_collisn += n; + sc->ifp->if_collisions += n; + + sc->stats.tx_deferred_frames += RD4(sc, CGEM_DEFERRED_TX_FRAMES); + sc->stats.tx_carrier_sense_errs += RD4(sc, CGEM_CARRIER_SENSE_ERRS); + + sc->stats.rx_bytes += RD4(sc, CGEM_OCTETS_RX_BOT); + sc->stats.rx_bytes += (uint64_t)RD4(sc, CGEM_OCTETS_RX_TOP) << 32; + + sc->stats.rx_frames += RD4(sc, CGEM_FRAMES_RX); + sc->stats.rx_frames_bcast += RD4(sc, CGEM_BCAST_FRAMES_RX); + sc->stats.rx_frames_multi += RD4(sc, CGEM_MULTI_FRAMES_RX); + sc->stats.rx_frames_pause += RD4(sc, CGEM_PAUSE_FRAMES_RX); + sc->stats.rx_frames_64b += RD4(sc, CGEM_FRAMES_64B_RX); + sc->stats.rx_frames_65to127b += RD4(sc, CGEM_FRAMES_65_127B_RX); + sc->stats.rx_frames_128to255b += RD4(sc, CGEM_FRAMES_128_255B_RX); + sc->stats.rx_frames_256to511b += RD4(sc, CGEM_FRAMES_256_511B_RX); + sc->stats.rx_frames_512to1023b += RD4(sc, CGEM_FRAMES_512_1023B_RX); + sc->stats.rx_frames_1024to1536b += RD4(sc, CGEM_FRAMES_1024_1518B_RX); + sc->stats.rx_frames_undersize += RD4(sc, CGEM_UNDERSZ_RX); + sc->stats.rx_frames_oversize += RD4(sc, CGEM_OVERSZ_RX); + sc->stats.rx_frames_jabber += RD4(sc, CGEM_JABBERS_RX); + sc->stats.rx_frames_fcs_errs += RD4(sc, CGEM_FCS_ERRS); + sc->stats.rx_frames_length_errs += RD4(sc, CGEM_LENGTH_FIELD_ERRS); + sc->stats.rx_symbol_errs += RD4(sc, CGEM_RX_SYMBOL_ERRS); + sc->stats.rx_align_errs += RD4(sc, CGEM_ALIGN_ERRS); + sc->stats.rx_resource_errs += RD4(sc, CGEM_RX_RESOURCE_ERRS); + sc->stats.rx_overrun_errs += RD4(sc, CGEM_RX_OVERRUN_ERRS); + sc->stats.rx_ip_hdr_csum_errs += RD4(sc, CGEM_IP_HDR_CKSUM_ERRS); + sc->stats.rx_tcp_csum_errs += RD4(sc, CGEM_TCP_CKSUM_ERRS); + sc->stats.rx_udp_csum_errs += RD4(sc, CGEM_UDP_CKSUM_ERRS); } static void @@ -734,21 +866,32 @@ cgem_tick(void *arg) { struct cgem_softc *sc = (struct cgem_softc *)arg; struct mii_data *mii; - int active; CGEM_ASSERT_LOCKED(sc); /* Poll the phy. */ if (sc->miibus != NULL) { mii = device_get_softc(sc->miibus); - active = mii->mii_media_active; mii_tick(mii); - if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == - (IFM_ACTIVE | IFM_AVALID) && - active != mii->mii_media_active) - cgem_media_update(sc, mii->mii_media_active); } + /* Poll statistics registers. */ + cgem_poll_hw_stats(sc); + + /* Check for receiver hang. */ + if (sc->rxhangwar && sc->rx_frames_prev == sc->stats.rx_frames) { + /* + * Reset receiver logic by toggling RX_EN bit. 1usec + * delay is necessary especially when operating at 100mbps + * and 10mbps speeds. + */ + WR4(sc, CGEM_NET_CTRL, sc->net_ctl_shadow & + ~CGEM_NET_CTRL_RX_EN); + DELAY(1); + WR4(sc, CGEM_NET_CTRL, sc->net_ctl_shadow); + } + sc->rx_frames_prev = sc->stats.rx_frames; + /* Next callout in one second. */ callout_reset(&sc->tick_ch, hz, cgem_tick, sc); } @@ -767,33 +910,43 @@ cgem_intr(void *arg) return; } + /* Read interrupt status and immediately clear the bits. */ istatus = RD4(sc, CGEM_INTR_STAT); - WR4(sc, CGEM_INTR_STAT, istatus & - (CGEM_INTR_RX_COMPLETE | CGEM_INTR_TX_USED_READ | - CGEM_INTR_RX_OVERRUN | CGEM_INTR_HRESP_NOT_OK)); + WR4(sc, CGEM_INTR_STAT, istatus); - /* Hresp not ok. Something very bad with DMA. Try to clear. */ + /* Packets received. */ + if ((istatus & CGEM_INTR_RX_COMPLETE) != 0) + cgem_recv(sc); + + /* Free up any completed transmit buffers. */ + cgem_clean_tx(sc); + + /* Hresp not ok. Something is very bad with DMA. Try to clear. */ if ((istatus & CGEM_INTR_HRESP_NOT_OK) != 0) { - printf("cgem_intr: hresp not okay! rx_status=0x%x\n", - RD4(sc, CGEM_RX_STAT)); + device_printf(sc->dev, "cgem_intr: hresp not okay! " + "rx_status=0x%x\n", RD4(sc, CGEM_RX_STAT)); WR4(sc, CGEM_RX_STAT, CGEM_RX_STAT_HRESP_NOT_OK); } - /* Transmitter has idled. Free up any spent transmit buffers. */ - if ((istatus & CGEM_INTR_TX_USED_READ) != 0) - cgem_clean_tx(sc); + /* Receiver overrun. */ + if ((istatus & CGEM_INTR_RX_OVERRUN) != 0) { + /* Clear status bit. */ + WR4(sc, CGEM_RX_STAT, CGEM_RX_STAT_OVERRUN); + sc->rxoverruns++; + } - /* Packets received or overflow. */ - if ((istatus & (CGEM_INTR_RX_COMPLETE | CGEM_INTR_RX_OVERRUN)) != 0) { - cgem_recv(sc); + /* Receiver ran out of bufs. */ + if ((istatus & CGEM_INTR_RX_USED_READ) != 0) { + WR4(sc, CGEM_NET_CTRL, sc->net_ctl_shadow | + CGEM_NET_CTRL_FLUSH_DPRAM_PKT); cgem_fill_rqueue(sc); - if ((istatus & CGEM_INTR_RX_OVERRUN) != 0) { - /* Clear rx status register. */ - sc->rxoverruns++; - WR4(sc, CGEM_RX_STAT, CGEM_RX_STAT_ALL); - } + sc->rxnobufs++; } + /* Restart transmitter if needed. */ + if (!IFQ_DRV_IS_EMPTY(&sc->ifp->if_snd)) + cgem_start_locked(sc->ifp); + CGEM_UNLOCK(sc); } @@ -830,6 +983,7 @@ cgem_config(struct cgem_softc *sc) { uint32_t net_cfg; uint32_t dma_cfg; + u_char *eaddr = IF_LLADDR(sc->ifp); CGEM_ASSERT_LOCKED(sc); @@ -839,6 +993,7 @@ cgem_config(struct cgem_softc *sc) CGEM_NET_CFG_FCS_REMOVE | CGEM_NET_CFG_RX_BUF_OFFSET(ETHER_ALIGN) | CGEM_NET_CFG_GIGE_EN | + CGEM_NET_CFG_1536RXEN | CGEM_NET_CFG_FULL_DUPLEX | CGEM_NET_CFG_SPEED100; @@ -852,7 +1007,8 @@ cgem_config(struct cgem_softc *sc) dma_cfg = CGEM_DMA_CFG_RX_BUF_SIZE(MCLBYTES) | CGEM_DMA_CFG_RX_PKTBUF_MEMSZ_SEL_8K | CGEM_DMA_CFG_TX_PKTBUF_MEMSZ_SEL | - CGEM_DMA_CFG_AHB_FIXED_BURST_LEN_16; + CGEM_DMA_CFG_AHB_FIXED_BURST_LEN_16 | + CGEM_DMA_CFG_DISC_WHEN_NO_AHB; /* Enable transmit checksum offloading? */ if ((sc->ifp->if_capenable & IFCAP_TXCSUM) != 0) @@ -868,10 +1024,16 @@ cgem_config(struct cgem_softc *sc) sc->net_ctl_shadow |= (CGEM_NET_CTRL_TX_EN | CGEM_NET_CTRL_RX_EN); WR4(sc, CGEM_NET_CTRL, sc->net_ctl_shadow); + /* Set receive address in case it changed. */ + WR4(sc, CGEM_SPEC_ADDR_LOW(0), (eaddr[3] << 24) | + (eaddr[2] << 16) | (eaddr[1] << 8) | eaddr[0]); + WR4(sc, CGEM_SPEC_ADDR_HI(0), (eaddr[5] << 8) | eaddr[4]); + /* Set up interrupts. */ WR4(sc, CGEM_INTR_EN, - CGEM_INTR_RX_COMPLETE | CGEM_INTR_TX_USED_READ | - CGEM_INTR_RX_OVERRUN | CGEM_INTR_HRESP_NOT_OK); + CGEM_INTR_RX_COMPLETE | CGEM_INTR_RX_OVERRUN | + CGEM_INTR_TX_USED_READ | CGEM_INTR_RX_USED_READ | + CGEM_INTR_HRESP_NOT_OK); } /* Turn on interface and load up receive ring with buffers. */ @@ -892,9 +1054,7 @@ cgem_init_locked(struct cgem_softc *sc) sc->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; mii = device_get_softc(sc->miibus); - mii_pollstat(mii); - cgem_media_update(sc, mii->mii_media_active); - cgem_start_locked(sc->ifp); + mii_mediachg(mii); callout_reset(&sc->tick_ch, hz, cgem_tick, sc); } @@ -957,6 +1117,9 @@ cgem_stop(struct cgem_softc *sc) sc->rxring_hd_ptr = 0; sc->rxring_tl_ptr = 0; sc->rxring_queued = 0; + + /* Force next statchg or linkchg to program net config register. */ + sc->mii_media_active = 0; } @@ -1046,6 +1209,11 @@ cgem_ioctl(struct ifnet *ifp, u_long cmd ~CGEM_NET_CFG_RX_CHKSUM_OFFLD_EN); } } + if ((ifp->if_capenable & (IFCAP_RXCSUM | IFCAP_TXCSUM)) == + (IFCAP_RXCSUM | IFCAP_TXCSUM)) + ifp->if_capenable |= IFCAP_VLAN_HWCSUM; + else + ifp->if_capenable &= ~IFCAP_VLAN_HWCSUM; CGEM_UNLOCK(sc); break; @@ -1063,6 +1231,7 @@ static void cgem_child_detached(device_t dev, device_t child) { struct cgem_softc *sc = device_get_softc(dev); + if (child == sc->miibus) sc->miibus = NULL; } @@ -1072,12 +1241,19 @@ cgem_ifmedia_upd(struct ifnet *ifp) { struct cgem_softc *sc = (struct cgem_softc *) ifp->if_softc; struct mii_data *mii; + struct mii_softc *miisc; + int error = 0; mii = device_get_softc(sc->miibus); CGEM_LOCK(sc); - mii_mediachg(mii); + if ((ifp->if_flags & IFF_UP) != 0) { + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) + PHY_RESET(miisc); + error = mii_mediachg(mii); + } CGEM_UNLOCK(sc); - return (0); + + return (error); } static void @@ -1118,6 +1294,13 @@ cgem_miibus_readreg(device_t dev, int ph val = RD4(sc, CGEM_PHY_MAINT) & CGEM_PHY_MAINT_DATA_MASK; + if (reg == MII_EXTSR) + /* + * MAC does not support half-duplex at gig speeds. + * Let mii(4) exclude the capability. + */ + val &= ~(EXTSR_1000XHDX | EXTSR_1000THDX); + return (val); } @@ -1147,6 +1330,265 @@ cgem_miibus_writereg(device_t dev, int p return (0); } +static void +cgem_miibus_statchg(device_t dev) +{ + struct cgem_softc *sc = device_get_softc(dev); + struct mii_data *mii = device_get_softc(sc->miibus); + + CGEM_ASSERT_LOCKED(sc); + + if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == + (IFM_ACTIVE | IFM_AVALID) && + sc->mii_media_active != mii->mii_media_active) + cgem_mediachange(sc, mii); +} + +static void +cgem_miibus_linkchg(device_t dev) +{ + struct cgem_softc *sc = device_get_softc(dev); + struct mii_data *mii = device_get_softc(sc->miibus); + + CGEM_ASSERT_LOCKED(sc); + + if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == + (IFM_ACTIVE | IFM_AVALID) && + sc->mii_media_active != mii->mii_media_active) + cgem_mediachange(sc, mii); +} + +/* + * Overridable weak symbol cgem_set_ref_clk(). This allows platforms to + * provide a function to set the cgem's reference clock. + */ +static int __used +cgem_default_set_ref_clk(int unit, int frequency) +{ + + return 0; +} +__weak_reference(cgem_default_set_ref_clk, cgem_set_ref_clk); + +/* Call to set reference clock and network config bits according to media. */ +static void +cgem_mediachange(struct cgem_softc *sc, struct mii_data *mii) +{ + uint32_t net_cfg; + int ref_clk_freq; + + CGEM_ASSERT_LOCKED(sc); + + /* Update hardware to reflect media. */ + net_cfg = RD4(sc, CGEM_NET_CFG); + net_cfg &= ~(CGEM_NET_CFG_SPEED100 | CGEM_NET_CFG_GIGE_EN | + CGEM_NET_CFG_FULL_DUPLEX); + + switch (IFM_SUBTYPE(mii->mii_media_active)) { + case IFM_1000_T: + net_cfg |= (CGEM_NET_CFG_SPEED100 | + CGEM_NET_CFG_GIGE_EN); + ref_clk_freq = 125000000; + break; + case IFM_100_TX: + net_cfg |= CGEM_NET_CFG_SPEED100; + ref_clk_freq = 25000000; + break; + default: + ref_clk_freq = 2500000; + } + + if ((mii->mii_media_active & IFM_FDX) != 0) + net_cfg |= CGEM_NET_CFG_FULL_DUPLEX; + + WR4(sc, CGEM_NET_CFG, net_cfg); + + /* Set the reference clock if necessary. */ + if (cgem_set_ref_clk(sc->ref_clk_num, ref_clk_freq)) + device_printf(sc->dev, "cgem_mediachange: " + "could not set ref clk%d to %d.\n", + sc->ref_clk_num, ref_clk_freq); + + sc->mii_media_active = mii->mii_media_active; +} + +static void +cgem_add_sysctls(device_t dev) +{ + struct cgem_softc *sc = device_get_softc(dev); + struct sysctl_ctx_list *ctx; + struct sysctl_oid_list *child; + struct sysctl_oid *tree; + + ctx = device_get_sysctl_ctx(dev); + child = SYSCTL_CHILDREN(device_get_sysctl_tree(dev)); + + SYSCTL_ADD_INT(ctx, child, OID_AUTO, "rxbufs", CTLFLAG_RW, + &sc->rxbufs, 0, + "Number receive buffers to provide"); + + SYSCTL_ADD_INT(ctx, child, OID_AUTO, "rxhangwar", CTLFLAG_RW, + &sc->rxhangwar, 0, + "Enable receive hang work-around"); + + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "_rxoverruns", CTLFLAG_RD, + &sc->rxoverruns, 0, + "Receive overrun events"); + + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "_rxnobufs", CTLFLAG_RD, + &sc->rxnobufs, 0, + "Receive buf queue empty events"); + + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "_rxdmamapfails", CTLFLAG_RD, + &sc->rxdmamapfails, 0, + "Receive DMA map failures"); + + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "_txfull", CTLFLAG_RD, + &sc->txfull, 0, + "Transmit ring full events"); + + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "_txdmamapfails", CTLFLAG_RD, + &sc->txdmamapfails, 0, + "Transmit DMA map failures"); + + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "_txdefrags", CTLFLAG_RD, + &sc->txdefrags, 0, + "Transmit m_defrag() calls"); + + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "_txdefragfails", CTLFLAG_RD, + &sc->txdefragfails, 0, + "Transmit m_defrag() failures"); + + tree = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "stats", CTLFLAG_RD, + NULL, "GEM statistics"); + child = SYSCTL_CHILDREN(tree); + + SYSCTL_ADD_UQUAD(ctx, child, OID_AUTO, "tx_bytes", CTLFLAG_RD, + &sc->stats.tx_bytes, "Total bytes transmitted"); + + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tx_frames", CTLFLAG_RD, + &sc->stats.tx_frames, 0, "Total frames transmitted"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tx_frames_bcast", CTLFLAG_RD, + &sc->stats.tx_frames_bcast, 0, + "Number broadcast frames transmitted"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tx_frames_multi", CTLFLAG_RD, + &sc->stats.tx_frames_multi, 0, + "Number multicast frames transmitted"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tx_frames_pause", + CTLFLAG_RD, &sc->stats.tx_frames_pause, 0, + "Number pause frames transmitted"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tx_frames_64b", CTLFLAG_RD, + &sc->stats.tx_frames_64b, 0, + "Number frames transmitted of size 64 bytes or less"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tx_frames_65to127b", CTLFLAG_RD, + &sc->stats.tx_frames_65to127b, 0, + "Number frames transmitted of size 65-127 bytes"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tx_frames_128to255b", + CTLFLAG_RD, &sc->stats.tx_frames_128to255b, 0, + "Number frames transmitted of size 128-255 bytes"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tx_frames_256to511b", + CTLFLAG_RD, &sc->stats.tx_frames_256to511b, 0, + "Number frames transmitted of size 256-511 bytes"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tx_frames_512to1023b", + CTLFLAG_RD, &sc->stats.tx_frames_512to1023b, 0, + "Number frames transmitted of size 512-1023 bytes"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tx_frames_1024to1536b", + CTLFLAG_RD, &sc->stats.tx_frames_1024to1536b, 0, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sat Oct 25 20:42:48 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 822F0594; Sat, 25 Oct 2014 20:42:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6F13B888; Sat, 25 Oct 2014 20:42:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9PKgmKJ013213; Sat, 25 Oct 2014 20:42:48 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9PKgm8h013212; Sat, 25 Oct 2014 20:42:48 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201410252042.s9PKgm8h013212@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 25 Oct 2014 20:42:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273646 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 20:42:48 -0000 Author: jhb Date: Sat Oct 25 20:42:47 2014 New Revision: 273646 URL: https://svnweb.freebsd.org/changeset/base/273646 Log: Use correct type in __DEVOLATILE(). Modified: head/sys/kern/kern_umtx.c Modified: head/sys/kern/kern_umtx.c ============================================================================== --- head/sys/kern/kern_umtx.c Sat Oct 25 20:34:10 2014 (r273645) +++ head/sys/kern/kern_umtx.c Sat Oct 25 20:42:47 2014 (r273646) @@ -2895,7 +2895,8 @@ do_sem2_wake(struct thread *td, struct _ */ if (cnt == 1) { umtxq_unlock(&key); - count = fuword32(__DEVOLATILE(void *, &sem->_count)); + count = fuword32(__DEVOLATILE(uint32_t *, + &sem->_count)); while (count != -1 && count & USEM_HAS_WAITERS) count = casuword32(&sem->_count, count, count & ~USEM_HAS_WAITERS); From owner-svn-src-all@FreeBSD.ORG Sat Oct 25 21:01:51 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 84D46C7E; Sat, 25 Oct 2014 21:01:51 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 713D6A43; Sat, 25 Oct 2014 21:01:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9PL1pGl022007; Sat, 25 Oct 2014 21:01:51 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9PL1pnm022006; Sat, 25 Oct 2014 21:01:51 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201410252101.s9PL1pnm022006@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 25 Oct 2014 21:01:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273647 - head/sys/dev/acpica X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 21:01:51 -0000 Author: kib Date: Sat Oct 25 21:01:50 2014 New Revision: 273647 URL: https://svnweb.freebsd.org/changeset/base/273647 Log: Set the caching mode for the usermode mapping of the HPET registers page to uncached. Reviewed by: rpaulo Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/dev/acpica/acpi_hpet.c Modified: head/sys/dev/acpica/acpi_hpet.c ============================================================================== --- head/sys/dev/acpica/acpi_hpet.c Sat Oct 25 20:42:47 2014 (r273646) +++ head/sys/dev/acpica/acpi_hpet.c Sat Oct 25 21:01:50 2014 (r273647) @@ -356,6 +356,7 @@ hpet_mmap(struct cdev *cdev, vm_ooffset_ if (!sc->mmap_allow_write && (nprot & PROT_WRITE)) return (EPERM); *paddr = rman_get_start(sc->mem_res) + offset; + *memattr = VM_MEMATTR_UNCACHEABLE; return (0); }