From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 00:36:27 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 43EEC106566C; Sun, 19 Sep 2010 00:36:27 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 33CF48FC14; Sun, 19 Sep 2010 00:36:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8J0aRpp083214; Sun, 19 Sep 2010 00:36:27 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8J0aRoI083212; Sun, 19 Sep 2010 00:36:27 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201009190036.o8J0aRoI083212@svn.freebsd.org> From: "David E. O'Brien" Date: Sun, 19 Sep 2010 00:36:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212832 - head/usr.bin/script X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 00:36:27 -0000 Author: obrien Date: Sun Sep 19 00:36:26 2010 New Revision: 212832 URL: http://svn.freebsd.org/changeset/base/212832 Log: Fix the grammar after I added a second environmental variable. Submitted by: wxs Modified: head/usr.bin/script/script.1 Modified: head/usr.bin/script/script.1 ============================================================================== --- head/usr.bin/script/script.1 Sat Sep 18 23:38:21 2010 (r212831) +++ head/usr.bin/script/script.1 Sun Sep 19 00:36:26 2010 (r212832) @@ -114,7 +114,7 @@ The utility works best with commands that do not manipulate the screen. The results are meant to emulate a hardcopy terminal, not an addressable one. .Sh ENVIRONMENT -The following environment variable is utilized by +The following environment variables are utilized by .Nm : .Bl -tag -width SHELL .It Ev SCRIPT From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 01:05:19 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AB5C3106566B; Sun, 19 Sep 2010 01:05:19 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9AEDE8FC12; Sun, 19 Sep 2010 01:05:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8J15JuR084026; Sun, 19 Sep 2010 01:05:19 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8J15JRv084024; Sun, 19 Sep 2010 01:05:19 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201009190105.o8J15JRv084024@svn.freebsd.org> From: Rick Macklem Date: Sun, 19 Sep 2010 01:05:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212833 - head/sys/fs/nfsserver X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 01:05:19 -0000 Author: rmacklem Date: Sun Sep 19 01:05:19 2010 New Revision: 212833 URL: http://svn.freebsd.org/changeset/base/212833 Log: Fix the experimental NFSv4 server so that it performs local VOP_ADVLOCK() unlock operations correctly. It was passing in F_SETLK instead of F_UNLCK as the operation for the unlock case. This only affected operation when local locking (vfs.newnfs.enable_locallocks=1) was enabled. MFC after: 1 week Modified: head/sys/fs/nfsserver/nfs_nfsdport.c Modified: head/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdport.c Sun Sep 19 00:36:26 2010 (r212832) +++ head/sys/fs/nfsserver/nfs_nfsdport.c Sun Sep 19 01:05:19 2010 (r212833) @@ -2825,7 +2825,7 @@ nfsvno_advlock(struct vnode *vp, int fty struct flock fl; u_int64_t tlen; - if (!nfsrv_dolocallocks) + if (nfsrv_dolocallocks == 0) return (0); fl.l_whence = SEEK_SET; fl.l_type = ftype; @@ -2850,8 +2850,12 @@ nfsvno_advlock(struct vnode *vp, int fty fl.l_sysid = (int)nfsv4_sysid; NFSVOPUNLOCK(vp, 0, td); - error = VOP_ADVLOCK(vp, (caddr_t)td->td_proc, F_SETLK, &fl, - (F_POSIX | F_REMOTE)); + if (ftype == F_UNLCK) + error = VOP_ADVLOCK(vp, (caddr_t)td->td_proc, F_UNLCK, &fl, + (F_POSIX | F_REMOTE)); + else + error = VOP_ADVLOCK(vp, (caddr_t)td->td_proc, F_SETLK, &fl, + (F_POSIX | F_REMOTE)); NFSVOPLOCK(vp, LK_EXCLUSIVE | LK_RETRY, td); return (error); } From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 01:18:03 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 825CA106564A; Sun, 19 Sep 2010 01:18:03 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 721A98FC0C; Sun, 19 Sep 2010 01:18:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8J1I3sp084312; Sun, 19 Sep 2010 01:18:03 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8J1I3wD084310; Sun, 19 Sep 2010 01:18:03 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201009190118.o8J1I3wD084310@svn.freebsd.org> From: Rick Macklem Date: Sun, 19 Sep 2010 01:18:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212834 - head/sys/fs/nfsserver X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 01:18:03 -0000 Author: rmacklem Date: Sun Sep 19 01:18:03 2010 New Revision: 212834 URL: http://svn.freebsd.org/changeset/base/212834 Log: Fix nfsrv_freeallnfslocks() in the experimental NFSv4 server so that it frees local locks correctly upon close. In order for nfsrv_localunlock() to work correctly, the lock can no longer be in the lockowner's stateid list. As such, nfsrv_freenfslock() has to be called before nfsrv_localunlock(), to get rid of the lock structure on the lockowner's stateid list. This only affected operation when local locks (vfs.newnfs.enable_locallocks=1) are enabled, which is not the default at this time. MFC after: 1 week Modified: head/sys/fs/nfsserver/nfs_nfsdstate.c Modified: head/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdstate.c Sun Sep 19 01:05:19 2010 (r212833) +++ head/sys/fs/nfsserver/nfs_nfsdstate.c Sun Sep 19 01:18:03 2010 (r212834) @@ -1137,6 +1137,7 @@ nfsrv_freeallnfslocks(struct nfsstate *s struct nfslockfile *lfp = NULL; int gottvp = 0; vnode_t tvp = NULL; + uint64_t first, end; lop = LIST_FIRST(&stp->ls_lock); while (lop != LIST_END(&stp->ls_lock)) { @@ -1167,14 +1168,16 @@ nfsrv_freeallnfslocks(struct nfsstate *s if (tvp != NULL) { if (cansleep == 0) panic("allnfs2"); - nfsrv_localunlock(tvp, lfp, lop->lo_first, - lop->lo_end, p); + first = lop->lo_first; + end = lop->lo_end; + nfsrv_freenfslock(lop); + nfsrv_localunlock(tvp, lfp, first, end, p); LIST_FOREACH_SAFE(rlp, &lfp->lf_rollback, rlck_list, nrlp) free(rlp, M_NFSDROLLBACK); LIST_INIT(&lfp->lf_rollback); - } - nfsrv_freenfslock(lop); + } else + nfsrv_freenfslock(lop); lop = nlop; } if (vp == NULL && tvp != NULL) From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 01:41:49 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C3A0D1065696; Sun, 19 Sep 2010 01:41:49 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B2C9F8FC12; Sun, 19 Sep 2010 01:41:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8J1fnIH084813; Sun, 19 Sep 2010 01:41:49 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8J1fnA1084811; Sun, 19 Sep 2010 01:41:49 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201009190141.o8J1fnA1084811@svn.freebsd.org> From: Rick Macklem Date: Sun, 19 Sep 2010 01:41:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212835 - stable/8/sys/fs/nfsclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 01:41:49 -0000 Author: rmacklem Date: Sun Sep 19 01:41:49 2010 New Revision: 212835 URL: http://svn.freebsd.org/changeset/base/212835 Log: MFC: r212216 Disable use of the NLM in the experimental NFS client, since it will crash the kernel because it uses the nfsmount and nfsnode structures of the regular NFS client. Modified: stable/8/sys/fs/nfsclient/nfs_clvnops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clvnops.c Sun Sep 19 01:18:03 2010 (r212834) +++ stable/8/sys/fs/nfsclient/nfs_clvnops.c Sun Sep 19 01:41:49 2010 (r212835) @@ -84,7 +84,7 @@ __FBSDID("$FreeBSD$"); extern struct nfsstats newnfsstats; MALLOC_DECLARE(M_NEWNFSREQ); -vop_advlock_t *ncl_advlock_p = nfs_dolock; +vop_advlock_t *ncl_advlock_p = NULL; /* * Ifdef for FreeBSD-current merged buffer cache. It is unfortunate that these From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 02:07:30 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3D411065670; Sun, 19 Sep 2010 02:07:30 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C2BEE8FC0C; Sun, 19 Sep 2010 02:07:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8J27UUA085455; Sun, 19 Sep 2010 02:07:30 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8J27Uix085453; Sun, 19 Sep 2010 02:07:30 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201009190207.o8J27Uix085453@svn.freebsd.org> From: Rick Macklem Date: Sun, 19 Sep 2010 02:07:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212836 - stable/8/sys/fs/nfsclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 02:07:31 -0000 Author: rmacklem Date: Sun Sep 19 02:07:30 2010 New Revision: 212836 URL: http://svn.freebsd.org/changeset/base/212836 Log: MFC: r212217 Change the code in ncl_bioread() in the experimental NFS client to return an error when rabp is not set, so it behaves the same way as the regular NFS client for this case. It does not affect NFSv4, since nfs_getcacheblk() only fails for "intr" mounts and NFSv4 can't use the "intr" mount option. Modified: stable/8/sys/fs/nfsclient/nfs_clbio.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/fs/nfsclient/nfs_clbio.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clbio.c Sun Sep 19 01:41:49 2010 (r212835) +++ stable/8/sys/fs/nfsclient/nfs_clbio.c Sun Sep 19 02:07:30 2010 (r212836) @@ -506,10 +506,7 @@ ncl_bioread(struct vnode *vp, struct uio rabp = nfs_getcacheblk(vp, rabn, biosize, td); if (!rabp) { error = newnfs_sigintr(nmp, td); - if (error) - return (error); - else - break; + return (error ? error : EINTR); } if ((rabp->b_flags & (B_CACHE|B_DELWRI)) == 0) { rabp->b_flags |= B_ASYNC; From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 05:19:47 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E6486106566B; Sun, 19 Sep 2010 05:19:47 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D62CB8FC0A; Sun, 19 Sep 2010 05:19:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8J5Jl4I090111; Sun, 19 Sep 2010 05:19:47 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8J5JlOx090109; Sun, 19 Sep 2010 05:19:47 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201009190519.o8J5JlOx090109@svn.freebsd.org> From: David Xu Date: Sun, 19 Sep 2010 05:19:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212837 - head/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 05:19:48 -0000 Author: davidxu Date: Sun Sep 19 05:19:47 2010 New Revision: 212837 URL: http://svn.freebsd.org/changeset/base/212837 Log: Fix a race condition when finding stack unwinding functions. Modified: head/lib/libthr/thread/thr_exit.c Modified: head/lib/libthr/thread/thr_exit.c ============================================================================== --- head/lib/libthr/thread/thr_exit.c Sun Sep 19 02:07:30 2010 (r212836) +++ head/lib/libthr/thread/thr_exit.c Sun Sep 19 05:19:47 2010 (r212837) @@ -70,18 +70,31 @@ static void thread_uw_init(void) { static int inited = 0; + Dl_info dlinfo; void *handle; + void *forcedunwind, *resume, *getcfa; if (inited) - return; - inited = 1; + return; handle = RTLD_DEFAULT; - if ((uwl_forcedunwind = dlsym(handle, "_Unwind_ForcedUnwind")) == NULL|| - (uwl_resume = dlsym(handle, "_Unwind_Resume")) == NULL || - (uwl_getcfa = dlsym(handle, "_Unwind_GetCFA")) == NULL) { - uwl_forcedunwind = NULL; - return; + if ((forcedunwind = dlsym(handle, "_Unwind_ForcedUnwind")) != NULL) { + if (dladdr(forcedunwind, &dlinfo)) { + if ((handle = dlopen(dlinfo.dli_fname, RTLD_LAZY)) != NULL) { + forcedunwind = dlsym(handle, "_Unwind_ForcedUnwind"); + resume = dlsym(handle, "_Unwind_Resume"); + getcfa = dlsym(handle, "_Unwind_GetCFA"); + if (forcedunwind != NULL && resume != NULL && + getcfa != NULL) { + uwl_forcedunwind = forcedunwind; + uwl_resume = resume; + uwl_getcfa = getcfa; + } else { + dlclose(handle); + } + } + } } + inited = 1; } void From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 05:42:29 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C98E71065672; Sun, 19 Sep 2010 05:42:29 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9F0A68FC1B; Sun, 19 Sep 2010 05:42:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8J5gTbN090590; Sun, 19 Sep 2010 05:42:29 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8J5gTjE090588; Sun, 19 Sep 2010 05:42:29 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201009190542.o8J5gTjE090588@svn.freebsd.org> From: David Xu Date: Sun, 19 Sep 2010 05:42:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212838 - head/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 05:42:29 -0000 Author: davidxu Date: Sun Sep 19 05:42:29 2010 New Revision: 212838 URL: http://svn.freebsd.org/changeset/base/212838 Log: - _Unwind_Resume function is not used, remove it. - Use a store barrier to make sure uwl_forcedunwind is lastest thing other threads can see. - Add some comments. Modified: head/lib/libthr/thread/thr_exit.c Modified: head/lib/libthr/thread/thr_exit.c ============================================================================== --- head/lib/libthr/thread/thr_exit.c Sun Sep 19 05:19:47 2010 (r212837) +++ head/lib/libthr/thread/thr_exit.c Sun Sep 19 05:42:29 2010 (r212838) @@ -63,7 +63,6 @@ static _Unwind_Reason_Code thread_unwind /* unwind library pointers */ static _Unwind_Reason_Code (*uwl_forcedunwind)(struct _Unwind_Exception *, _Unwind_Stop_Fn, void *); -static void (*uwl_resume)(struct _Unwind_Exception *exc); static _Unwind_Word (*uwl_getcfa)(struct _Unwind_Context *); static void @@ -72,22 +71,24 @@ thread_uw_init(void) static int inited = 0; Dl_info dlinfo; void *handle; - void *forcedunwind, *resume, *getcfa; + void *forcedunwind, *getcfa; if (inited) return; handle = RTLD_DEFAULT; if ((forcedunwind = dlsym(handle, "_Unwind_ForcedUnwind")) != NULL) { if (dladdr(forcedunwind, &dlinfo)) { + /* + * Make sure the address is always valid by holding the library, + * also assume functions are in same library. + */ if ((handle = dlopen(dlinfo.dli_fname, RTLD_LAZY)) != NULL) { forcedunwind = dlsym(handle, "_Unwind_ForcedUnwind"); - resume = dlsym(handle, "_Unwind_Resume"); getcfa = dlsym(handle, "_Unwind_GetCFA"); - if (forcedunwind != NULL && resume != NULL && - getcfa != NULL) { - uwl_forcedunwind = forcedunwind; - uwl_resume = resume; + if (forcedunwind != NULL && getcfa != NULL) { uwl_getcfa = getcfa; + atomic_store_rel_ptr((volatile void *)&uwl_forcedunwind, + (uintptr_t)forcedunwind); } else { dlclose(handle); } @@ -97,12 +98,6 @@ thread_uw_init(void) inited = 1; } -void -_Unwind_Resume(struct _Unwind_Exception *ex) -{ - (*uwl_resume)(ex); -} - _Unwind_Reason_Code _Unwind_ForcedUnwind(struct _Unwind_Exception *ex, _Unwind_Stop_Fn stop_func, void *stop_arg) @@ -118,7 +113,6 @@ _Unwind_GetCFA(struct _Unwind_Context *c #else #pragma weak _Unwind_GetCFA #pragma weak _Unwind_ForcedUnwind -#pragma weak _Unwind_Resume #endif /* PIC */ static void From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 08:01:51 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD906106564A; Sun, 19 Sep 2010 08:01:51 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-qy0-f182.google.com (mail-qy0-f182.google.com [209.85.216.182]) by mx1.freebsd.org (Postfix) with ESMTP id 66CE58FC14; Sun, 19 Sep 2010 08:01:51 +0000 (UTC) Received: by qyk4 with SMTP id 4so3941293qyk.13 for ; Sun, 19 Sep 2010 01:01:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=t/yyu4+4RjUbaZP6G0w61Iplr8QG9BDutPYUgM15u1U=; b=xO+TdIwWWfpU1sK0bHb3EJgLWsmsJNZjpdlnHb+pgT8WtJMx5UZfgAzR5FSMx+eJFO vcuOX54NExh1vfB5FAtlI7dVD4ijwZOMnck0NgXgn9FPCcKfWxBL2KF6FwSFJkyfo5eV 33qkzOaxmvqlxiENr0G7QFIxiiR9zj+tBLvxc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=Dsc0ritLD+GytiNESfaEVTDO0MU631GmLfyjxrAF7geGn2IloUAXj9Ja57Wt1X6ew0 eWHxLvTbaQYgocVsvCKso7Su4Bfge1mPsilKn+uFc8MrVcDXRsNQBwMgtYnt13NfzQ5F uca+S+UyY7GT9/R29OYoBIDa5wh0Bjebe5VeA= MIME-Version: 1.0 Received: by 10.229.95.73 with SMTP id c9mr5122902qcn.111.1284883310400; Sun, 19 Sep 2010 01:01:50 -0700 (PDT) Received: by 10.229.19.206 with HTTP; Sun, 19 Sep 2010 01:01:50 -0700 (PDT) In-Reply-To: <201009182338.o8INcLF8081790@svn.freebsd.org> References: <201009182338.o8INcLF8081790@svn.freebsd.org> Date: Sun, 19 Sep 2010 12:01:50 +0400 Message-ID: From: pluknet To: Rui Paulo Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212831 - head/lib/libproc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 08:01:52 -0000 On 19 September 2010 03:38, Rui Paulo wrote: > Author: rpaulo > Date: Sat Sep 18 23:38:21 2010 > New Revision: 212831 > URL: http://svn.freebsd.org/changeset/base/212831 > > Log: > =A0Ignore EINTR when calling waitpid. > > Modified: > =A0head/lib/libproc/proc_util.c > > Modified: head/lib/libproc/proc_util.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/lib/libproc/proc_util.c =A0 =A0 =A0 =A0Sat Sep 18 22:37:47 2010 = =A0 =A0 =A0 =A0(r212830) > +++ head/lib/libproc/proc_util.c =A0 =A0 =A0 =A0Sat Sep 18 23:38:21 2010 = =A0 =A0 =A0 =A0(r212831) > @@ -145,7 +145,8 @@ proc_wstatus(struct proc_handle *phdl) > =A0 =A0 =A0 =A0if (phdl =3D=3D NULL) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return (-1); > =A0 =A0 =A0 =A0if (waitpid(phdl->pid, &status, WUNTRACED) < 0) { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 warn("waitpid"); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (errno !=3D EINTR) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 warn("waitpid"); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return (-1); > =A0 =A0 =A0 =A0} > =A0 =A0 =A0 =A0if (WIFSTOPPED(status)) Hi. After this change the waitpid() error handling still doesn't ignore EINTR (well, only warn() ignores EINTR now), but it rather returns with -1. Is it intentional? I though something more like this was meant in svn log: while (waitpid(...) < 0) if (errno !=3D EINTR) { warn("waitpid"); return (-1); } --=20 wbr, pluknet From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 08:18:56 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 642C5106566C; Sun, 19 Sep 2010 08:18:56 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 524758FC15; Sun, 19 Sep 2010 08:18:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8J8IuaI094052; Sun, 19 Sep 2010 08:18:56 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8J8IuZR094047; Sun, 19 Sep 2010 08:18:56 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <201009190818.o8J8IuZR094047@svn.freebsd.org> From: Brian Somers Date: Sun, 19 Sep 2010 08:18:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212839 - in head: sbin/growfs tools/regression/sbin tools/regression/sbin/growfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 08:18:56 -0000 Author: brian Date: Sun Sep 19 08:18:56 2010 New Revision: 212839 URL: http://svn.freebsd.org/changeset/base/212839 Log: Revise r197763 which fixes filesystem corruption when extending into un-zeroed storage. The original patch was questioned by Kirk as it forces the filesystem to do excessive work initialising inodes on first use, and was never MFC'd. This change mimics the newfs(8) approach of zeroing two blocks of inodes for each new cylinder group. Reviewed by: mckusick MFC after: 3 weeks Added: head/tools/regression/sbin/ head/tools/regression/sbin/Makefile (contents, props changed) head/tools/regression/sbin/growfs/ head/tools/regression/sbin/growfs/Makefile (contents, props changed) head/tools/regression/sbin/growfs/regress.t (contents, props changed) Modified: head/sbin/growfs/growfs.c Modified: head/sbin/growfs/growfs.c ============================================================================== --- head/sbin/growfs/growfs.c Sun Sep 19 05:42:29 2010 (r212838) +++ head/sbin/growfs/growfs.c Sun Sep 19 08:18:56 2010 (r212839) @@ -371,16 +371,16 @@ static void initcg(int cylno, time_t utime, int fso, unsigned int Nflag) { DBG_FUNC("initcg") - static void *iobuf; + static caddr_t iobuf; long blkno, start; ufs2_daddr_t i, cbase, dmax; struct ufs1_dinode *dp1; struct csum *cs; uint d, dupper, dlower; - if (iobuf == NULL && (iobuf = malloc(sblock.fs_bsize)) == NULL) { + if (iobuf == NULL && (iobuf = malloc(sblock.fs_bsize * 3)) == NULL) errx(37, "panic: cannot allocate I/O buffer"); - } + /* * Determine block bounds for cylinder group. * Allow space for super block summary information in first @@ -396,17 +396,12 @@ initcg(int cylno, time_t utime, int fso, dupper += howmany(sblock.fs_cssize, sblock.fs_fsize); cs = &fscs[cylno]; memset(&acg, 0, sblock.fs_cgsize); - /* - * Note that we do not set cg_initediblk at all. - * In this extension of a previous filesystem - * we have no inodes initialized for the cylinder - * group at all. The first access to that cylinder - * group will do the correct initialization. - */ acg.cg_time = utime; acg.cg_magic = CG_MAGIC; acg.cg_cgx = cylno; acg.cg_niblk = sblock.fs_ipg; + acg.cg_initediblk = sblock.fs_ipg < 2 * INOPB(&sblock) ? + sblock.fs_ipg : 2 * INOPB(&sblock); acg.cg_ndblk = dmax - cbase; if (sblock.fs_contigsumsize > 0) acg.cg_nclusterblks = acg.cg_ndblk / sblock.fs_frag; @@ -419,6 +414,7 @@ initcg(int cylno, time_t utime, int fso, acg.cg_time = 0; acg.cg_old_niblk = acg.cg_niblk; acg.cg_niblk = 0; + acg.cg_initediblk = 0; acg.cg_old_btotoff = start; acg.cg_old_boff = acg.cg_old_btotoff + sblock.fs_old_cpg * sizeof(int32_t); @@ -538,11 +534,14 @@ initcg(int cylno, time_t utime, int fso, sblock.fs_cstotal.cs_nbfree += acg.cg_cs.cs_nbfree; sblock.fs_cstotal.cs_nifree += acg.cg_cs.cs_nifree; *cs = acg.cg_cs; + + memcpy(iobuf, &acg, sblock.fs_cgsize); + memset(iobuf + sblock.fs_cgsize, '\0', + sblock.fs_bsize * 3 - sblock.fs_cgsize); + wtfs(fsbtodb(&sblock, cgtod(&sblock, cylno)), - sblock.fs_bsize, (char *)&acg, fso, Nflag); - DBG_DUMP_CG(&sblock, - "new cg", - &acg); + sblock.fs_bsize * 3, iobuf, fso, Nflag); + DBG_DUMP_CG(&sblock, "new cg", &acg); DBG_LEAVE; return; Added: head/tools/regression/sbin/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/sbin/Makefile Sun Sep 19 08:18:56 2010 (r212839) @@ -0,0 +1,5 @@ +# $FreeBSD$ + +SUBDIR= growfs + +.include Added: head/tools/regression/sbin/growfs/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/sbin/growfs/Makefile Sun Sep 19 08:18:56 2010 (r212839) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +all test: + prove -vmw regress.t + +clean: Added: head/tools/regression/sbin/growfs/regress.t ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/sbin/growfs/regress.t Sun Sep 19 08:18:56 2010 (r212839) @@ -0,0 +1,91 @@ +#! /usr/bin/perl +# +# $FreeBSD$ + +use strict; +use warnings; +use Test::More tests => 19; +use Fcntl qw(:DEFAULT :seek); + +use constant BLK => 512; +use constant BLKS_PER_MB => 2048; + +my $unit; +END { system "mdconfig -du$unit" if defined $unit }; + +sub setsize { + my ($partszMB, $unitszMB) = @_; + + open my $fd, "|-", "disklabel -R md$unit /dev/stdin" or die; + print $fd "a: ", ($partszMB * BLKS_PER_MB), " 0 4.2BSD 1024 8192\n"; + print $fd "c: ", ($unitszMB * BLKS_PER_MB), " 0 unused 0 0\n"; + close $fd; +} + +sub fill { + my ($start, $size, $content) = @_; + + my $content512 = $content x (int(512 / length $content) + 1); + substr($content512, 512) = ""; + sysopen my $fd, "/dev/md$unit", O_RDWR or die "/dev/md$unit: $!"; + seek($fd, $start * BLK, SEEK_SET); + while ($size) { + syswrite($fd, $content512) == 512 or die "write: $!"; + $size--; + } +} + +SKIP: { + skip "Cannot test without UID 0", 19 if $<; + + chomp(my $md = `mdconfig -s40m`); + like($md, qr/^md\d+$/, "Created $md with size 40m") or die; + $unit = substr $md, 2; + + for my $type (1..2) { + + initialise: { + ok(setsize(10, 40), "Sized ${md}a to 10m"); + system "newfs -O $type -U ${md}a >/dev/null"; + is($?, 0, "Initialised the filesystem on ${md}a as UFS$type"); + chomp(my @out = `fsck -tufs -y ${md}a`); + ok(!grep(/MODIFIED/, @out), "fsck says ${md}a is clean, " . + scalar(@out) . " lines of output"); + } + + extend20_zeroed: { + ok(setsize(20, 40), "Sized ${md}a to 20m"); + diag "Filling the extent with zeros"; + fill(10 * BLKS_PER_MB, 10 * BLKS_PER_MB, chr(0)); + my $out = `growfs -y ${md}a`; + is($?, 0, "Extended the filesystem on ${md}a") or print $out; + + my ($unallocated) = $out =~ m{\d+ sectors cannot be allocated}; + fill(30 * BLKS_PER_MB - $unallocated, $unallocated, chr(0)) + if $unallocated; + + chomp(my @out = `fsck -tufs -y ${md}a`); + ok(!grep(/MODIFIED/, @out), "fsck says ${md}a is clean, " . + scalar(@out) . " lines of output"); + } + + extend30_garbaged: { + ok(setsize(30, 40), "Sized ${md}a to 30m"); + diag "Filling the extent with garbage"; + fill(20 * BLKS_PER_MB, 10 * BLKS_PER_MB, chr(0xaa) . chr(0x55)); + my $out = `growfs -y ${md}a`; + is($?, 0, "Extended the filesystem on ${md}a") or print $out; + + my ($unallocated) = $out =~ m{\d+ sectors cannot be allocated}; + fill(30 * BLKS_PER_MB - $unallocated, $unallocated, chr(0)) + if $unallocated; + + chomp(my @out = `fsck -tufs -y ${md}a`); + ok(!grep(/MODIFIED/, @out), "fsck says ${md}a is clean, " . + scalar(@out) . " lines of output"); + } + } + + system "mdconfig -du$unit"; + undef $unit; +} From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 08:55:36 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C58FE106564A; Sun, 19 Sep 2010 08:55:36 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B57F28FC08; Sun, 19 Sep 2010 08:55:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8J8taQf094999; Sun, 19 Sep 2010 08:55:36 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8J8taEk094997; Sun, 19 Sep 2010 08:55:36 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201009190855.o8J8taEk094997@svn.freebsd.org> From: David Xu Date: Sun, 19 Sep 2010 08:55:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212840 - head/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 08:55:36 -0000 Author: davidxu Date: Sun Sep 19 08:55:36 2010 New Revision: 212840 URL: http://svn.freebsd.org/changeset/base/212840 Log: Fix typo. Modified: head/lib/libthr/thread/thr_join.c Modified: head/lib/libthr/thread/thr_join.c ============================================================================== --- head/lib/libthr/thread/thr_join.c Sun Sep 19 08:18:56 2010 (r212839) +++ head/lib/libthr/thread/thr_join.c Sun Sep 19 08:55:36 2010 (r212840) @@ -48,7 +48,7 @@ static void backout_join(void *arg) THR_THREAD_LOCK(curthread, pthread); pthread->joiner = NULL; - THR_THREAD_LOCK(curthread, pthread); + THR_THREAD_UNLOCK(curthread, pthread); } int From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 09:03:11 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DED41106566B; Sun, 19 Sep 2010 09:03:11 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CE6B18FC17; Sun, 19 Sep 2010 09:03:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8J93B7X095214; Sun, 19 Sep 2010 09:03:11 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8J93BTx095209; Sun, 19 Sep 2010 09:03:11 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201009190903.o8J93BTx095209@svn.freebsd.org> From: David Xu Date: Sun, 19 Sep 2010 09:03:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212841 - head/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 09:03:12 -0000 Author: davidxu Date: Sun Sep 19 09:03:11 2010 New Revision: 212841 URL: http://svn.freebsd.org/changeset/base/212841 Log: Because atfork lock is held while forking, a thread cancellation triggered by atfork handler is unsafe, use intenal flag no_cancel to disable it. Modified: head/lib/libthr/thread/thr_exit.c head/lib/libthr/thread/thr_fork.c head/lib/libthr/thread/thr_private.h head/lib/libthr/thread/thr_sig.c Modified: head/lib/libthr/thread/thr_exit.c ============================================================================== --- head/lib/libthr/thread/thr_exit.c Sun Sep 19 08:55:36 2010 (r212840) +++ head/lib/libthr/thread/thr_exit.c Sun Sep 19 09:03:11 2010 (r212841) @@ -206,7 +206,7 @@ _pthread_exit_mask(void *status, sigset_ /* Flag this thread as exiting. */ curthread->cancelling = 1; - curthread->cancel_enable = 0; + curthread->no_cancel = 1; curthread->cancel_async = 0; curthread->cancel_point = 0; if (mask != NULL) Modified: head/lib/libthr/thread/thr_fork.c ============================================================================== --- head/lib/libthr/thread/thr_fork.c Sun Sep 19 08:55:36 2010 (r212840) +++ head/lib/libthr/thread/thr_fork.c Sun Sep 19 09:03:11 2010 (r212841) @@ -137,7 +137,7 @@ _fork(void) struct pthread *curthread; struct pthread_atfork *af; pid_t ret; - int errsave; + int errsave, cancelsave; int was_threaded; int rtld_locks[MAX_RTLD_LOCKS]; @@ -145,7 +145,8 @@ _fork(void) return (__sys_fork()); curthread = _get_curthread(); - + cancelsave = curthread->no_cancel; + curthread->no_cancel = 1; _thr_rwl_rdlock(&_thr_atfork_lock); /* Run down atfork prepare handlers. */ @@ -223,6 +224,7 @@ _fork(void) af->child(); } _thr_rwlock_unlock(&_thr_atfork_lock); + curthread->no_cancel = cancelsave; } else { /* Parent process */ errsave = errno; @@ -244,6 +246,9 @@ _fork(void) } _thr_rwlock_unlock(&_thr_atfork_lock); + curthread->no_cancel = cancelsave; + /* test async cancel */ + _thr_testcancel(curthread); } errno = errsave; Modified: head/lib/libthr/thread/thr_private.h ============================================================================== --- head/lib/libthr/thread/thr_private.h Sun Sep 19 08:55:36 2010 (r212840) +++ head/lib/libthr/thread/thr_private.h Sun Sep 19 09:03:11 2010 (r212841) @@ -356,9 +356,9 @@ struct pthread { struct pthread_attr attr; #define SHOULD_CANCEL(thr) \ - ((thr)->cancel_pending && \ + ((thr)->cancel_pending && (thr)->cancel_enable && \ ((thr)->cancel_point || (thr)->cancel_async) && \ - (thr)->cancel_enable && (thr)->cancelling == 0) + (thr)->no_cancel == 0) /* Cancellation is enabled */ int cancel_enable; @@ -369,8 +369,8 @@ struct pthread { /* Thread is at cancellation point */ int cancel_point; - /* Cancellation should be synchoronized */ - int cancel_defer; + /* Cancellation is temporarily disabled */ + int no_cancel; /* Asynchronouse cancellation is enabled */ int cancel_async; Modified: head/lib/libthr/thread/thr_sig.c ============================================================================== --- head/lib/libthr/thread/thr_sig.c Sun Sep 19 08:55:36 2010 (r212840) +++ head/lib/libthr/thread/thr_sig.c Sun Sep 19 09:03:11 2010 (r212841) @@ -187,7 +187,6 @@ handle_signal(struct sigaction *actp, in struct pthread *curthread = _get_curthread(); ucontext_t uc2; __siginfohandler_t *sigfunc; - int cancel_defer; int cancel_point; int cancel_async; int cancel_enable; @@ -213,12 +212,10 @@ handle_signal(struct sigaction *actp, in * cancellation is pending, to avoid this problem while thread is in * deferring mode, cancellation is temporarily disabled. */ - cancel_defer = curthread->cancel_defer; cancel_point = curthread->cancel_point; cancel_async = curthread->cancel_async; cancel_enable = curthread->cancel_enable; curthread->cancel_point = 0; - curthread->cancel_defer = 0; if (!cancel_async) curthread->cancel_enable = 0; @@ -245,7 +242,6 @@ handle_signal(struct sigaction *actp, in err = errno; curthread->in_sigsuspend = in_sigsuspend; - curthread->cancel_defer = cancel_defer; curthread->cancel_point = cancel_point; curthread->cancel_enable = cancel_enable; @@ -275,7 +271,7 @@ check_cancel(struct pthread *curthread, { if (__predict_true(!curthread->cancel_pending || !curthread->cancel_enable || - curthread->cancelling)) + curthread->no_cancel)) return; if (curthread->cancel_async) { From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 09:18:07 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6AE5E106566C; Sun, 19 Sep 2010 09:18:07 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5A9D48FC19; Sun, 19 Sep 2010 09:18:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8J9I7op095577; Sun, 19 Sep 2010 09:18:07 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8J9I7PD095575; Sun, 19 Sep 2010 09:18:07 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201009190918.o8J9I7PD095575@svn.freebsd.org> From: Juli Mallett Date: Sun, 19 Sep 2010 09:18:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212842 - head/sys/mips/cavium X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 09:18:07 -0000 Author: jmallett Date: Sun Sep 19 09:18:07 2010 New Revision: 212842 URL: http://svn.freebsd.org/changeset/base/212842 Log: Don't use memory that can't be direct-mapped on !n64. Modified: head/sys/mips/cavium/octeon_machdep.c Modified: head/sys/mips/cavium/octeon_machdep.c ============================================================================== --- head/sys/mips/cavium/octeon_machdep.c Sun Sep 19 09:03:11 2010 (r212841) +++ head/sys/mips/cavium/octeon_machdep.c Sun Sep 19 09:18:07 2010 (r212842) @@ -286,6 +286,18 @@ octeon_memory_init(void) if (addr == -1) break; + /* + * The SDK needs to be able to easily map any memory that might + * come to it e.g. in the form of an mbuf. Because on !n64 we + * can't direct-map some addresses and we don't want to manage + * temporary mappings within the SDK, don't feed memory that + * can't be direct-mapped to the kernel. + */ +#if !defined(__mips_n64) + if (!MIPS_DIRECT_MAPPABLE(addr + (1 << 20) - 1)) + continue; +#endif + physmem += btoc(1 << 20); if (i > 0 && phys_avail[i - 1] == addr) { From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 09:18:28 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 00BBD10658E8; Sun, 19 Sep 2010 09:18:28 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E4EF48FC1C; Sun, 19 Sep 2010 09:18:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8J9IRPJ095624; Sun, 19 Sep 2010 09:18:27 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8J9IRAQ095621; Sun, 19 Sep 2010 09:18:27 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201009190918.o8J9IRAQ095621@svn.freebsd.org> From: Juli Mallett Date: Sun, 19 Sep 2010 09:18:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212843 - head/sys/mips/cavium X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 09:18:28 -0000 Author: jmallett Date: Sun Sep 19 09:18:27 2010 New Revision: 212843 URL: http://svn.freebsd.org/changeset/base/212843 Log: Fix to specify generic bus_add_child. Modified: head/sys/mips/cavium/obio.c head/sys/mips/cavium/octopci.c Modified: head/sys/mips/cavium/obio.c ============================================================================== --- head/sys/mips/cavium/obio.c Sun Sep 19 09:18:07 2010 (r212842) +++ head/sys/mips/cavium/obio.c Sun Sep 19 09:18:27 2010 (r212843) @@ -192,6 +192,8 @@ static device_method_t obio_methods[] = DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), + DEVMETHOD(bus_add_child, bus_generic_add_child), + {0, 0}, }; Modified: head/sys/mips/cavium/octopci.c ============================================================================== --- head/sys/mips/cavium/octopci.c Sun Sep 19 09:18:07 2010 (r212842) +++ head/sys/mips/cavium/octopci.c Sun Sep 19 09:18:27 2010 (r212843) @@ -384,6 +384,8 @@ static device_method_t octopci_methods[] DEVMETHOD(bus_deactivate_resource,bus_generic_deactivate_resource), DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), + DEVMETHOD(bus_add_child, bus_generic_add_child), + /* pcib interface */ DEVMETHOD(pcib_maxslots, octopci_maxslots), DEVMETHOD(pcib_read_config, octopci_read_config), From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 09:19:39 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5C2A91065672; Sun, 19 Sep 2010 09:19:39 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4B9178FC32; Sun, 19 Sep 2010 09:19:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8J9JdUI095688; Sun, 19 Sep 2010 09:19:39 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8J9Jd2I095682; Sun, 19 Sep 2010 09:19:39 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201009190919.o8J9Jd2I095682@svn.freebsd.org> From: Juli Mallett Date: Sun, 19 Sep 2010 09:19:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212844 - head/sys/contrib/octeon-sdk X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 09:19:39 -0000 Author: jmallett Date: Sun Sep 19 09:19:38 2010 New Revision: 212844 URL: http://svn.freebsd.org/changeset/base/212844 Log: Add preliminary support for the Lanner MR-955. It boots multi-user but there seem to be problems both with the on-board Ethernet interfaces and the em(4) interfaces on PCI under FreeBSD. Thanks to Lanner for providing access to hardware. Modified: head/sys/contrib/octeon-sdk/cvmx-app-init.h head/sys/contrib/octeon-sdk/cvmx-helper-board.c head/sys/contrib/octeon-sdk/cvmx-helper-spi.c head/sys/contrib/octeon-sdk/cvmx-helper.c head/sys/contrib/octeon-sdk/cvmx-spi.c Modified: head/sys/contrib/octeon-sdk/cvmx-app-init.h ============================================================================== --- head/sys/contrib/octeon-sdk/cvmx-app-init.h Sun Sep 19 09:18:27 2010 (r212843) +++ head/sys/contrib/octeon-sdk/cvmx-app-init.h Sun Sep 19 09:19:38 2010 (r212844) @@ -182,7 +182,11 @@ enum cvmx_board_types_enum { CVMX_BOARD_TYPE_CUST_ITB101 = 10005, CVMX_BOARD_TYPE_CUST_NTE102 = 10006, CVMX_BOARD_TYPE_CUST_AGS103 = 10007, +#if !defined(OCTEON_VENDOR_LANNER) CVMX_BOARD_TYPE_CUST_GST104 = 10008, +#else + CVMX_BOARD_TYPE_CUST_LANNER_MR955= 10008, +#endif CVMX_BOARD_TYPE_CUST_GCT105 = 10009, CVMX_BOARD_TYPE_CUST_AGS106 = 10010, CVMX_BOARD_TYPE_CUST_SGM107 = 10011, @@ -257,7 +261,11 @@ static inline const char *cvmx_board_typ ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_ITB101) ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_NTE102) ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_AGS103) +#if !defined(OCTEON_VENDOR_LANNER) ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_GST104) +#else + ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_LANNER_MR955) +#endif ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_GCT105) ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_AGS106) ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_SGM107) Modified: head/sys/contrib/octeon-sdk/cvmx-helper-board.c ============================================================================== --- head/sys/contrib/octeon-sdk/cvmx-helper-board.c Sun Sep 19 09:18:27 2010 (r212843) +++ head/sys/contrib/octeon-sdk/cvmx-helper-board.c Sun Sep 19 09:19:38 2010 (r212844) @@ -114,6 +114,9 @@ int cvmx_helper_board_get_mii_address(in case CVMX_BOARD_TYPE_EBT5800: case CVMX_BOARD_TYPE_THUNDER: case CVMX_BOARD_TYPE_NICPRO2: +#if defined(OCTEON_VENDOR_LANNER) + case CVMX_BOARD_TYPE_CUST_LANNER_MR955: +#endif /* Interface 0 is SPI4, interface 1 is RGMII */ if ((ipd_port >= 16) && (ipd_port < 20)) return ipd_port - 16; @@ -616,6 +619,12 @@ int __cvmx_helper_board_interface_probe( if (interface == 1) return 0; break; +#if defined(OCTEON_VENDOR_LANNER) + case CVMX_BOARD_TYPE_CUST_LANNER_MR955: + if (interface == 1) + return 12; + break; +#endif } #ifdef CVMX_BUILD_FOR_UBOOT if (CVMX_HELPER_INTERFACE_MODE_SPI == cvmx_helper_interface_get_mode(interface) && getenv("disable_spi")) Modified: head/sys/contrib/octeon-sdk/cvmx-helper-spi.c ============================================================================== --- head/sys/contrib/octeon-sdk/cvmx-helper-spi.c Sun Sep 19 09:18:27 2010 (r212843) +++ head/sys/contrib/octeon-sdk/cvmx-helper-spi.c Sun Sep 19 09:19:38 2010 (r212844) @@ -82,6 +82,21 @@ int __cvmx_helper_spi_probe(int interfac { num_ports = 10; } +#if defined(OCTEON_VENDOR_LANNER) + else if (cvmx_sysinfo_get()->board_type == CVMX_BOARD_TYPE_CUST_LANNER_MR955) + { + cvmx_pko_reg_crc_enable_t enable; + if (interface == 1) { + num_ports = 12; + } else { + /* XXX This is not entirely true. */ + num_ports = 0; + } + enable.u64 = cvmx_read_csr(CVMX_PKO_REG_CRC_ENABLE); + enable.s.enable &= 0xffff << (16 - (interface*16)); + cvmx_write_csr(CVMX_PKO_REG_CRC_ENABLE, enable.u64); + } +#endif else { cvmx_pko_reg_crc_enable_t enable; Modified: head/sys/contrib/octeon-sdk/cvmx-helper.c ============================================================================== --- head/sys/contrib/octeon-sdk/cvmx-helper.c Sun Sep 19 09:18:27 2010 (r212843) +++ head/sys/contrib/octeon-sdk/cvmx-helper.c Sun Sep 19 09:19:38 2010 (r212844) @@ -101,6 +101,15 @@ static CVMX_SHARED cvmx_helper_link_info */ int cvmx_helper_get_number_of_interfaces(void) { + switch (cvmx_sysinfo_get()->board_type) { +#if defined(OCTEON_VENDOR_LANNER) + case CVMX_BOARD_TYPE_CUST_LANNER_MR955: + return 2; +#endif + default: + break; + } + if (OCTEON_IS_MODEL(OCTEON_CN56XX) || OCTEON_IS_MODEL(OCTEON_CN52XX)) return 4; else Modified: head/sys/contrib/octeon-sdk/cvmx-spi.c ============================================================================== --- head/sys/contrib/octeon-sdk/cvmx-spi.c Sun Sep 19 09:18:27 2010 (r212843) +++ head/sys/contrib/octeon-sdk/cvmx-spi.c Sun Sep 19 09:19:38 2010 (r212844) @@ -515,7 +515,11 @@ int cvmx_spi_training_cb(int interface, // Wait for the training sequence to complete cvmx_dprintf ("SPI%d: Waiting for training\n", interface); cvmx_wait (1000 * MS); +#if !defined(OCTEON_VENDOR_LANNER) timeout_time = cvmx_get_cycle() + 1000ull * MS * 600; /* Wait a really long time here */ +#else + timeout_time = cvmx_get_cycle() + 1000ull * MS * 10; +#endif /* The HRM says we must wait for 34 + 16 * MAXDIST training sequences. We'll be pessimistic and wait for a lot more */ rx_training_needed = 500; From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 09:47:21 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 157A0106566C; Sun, 19 Sep 2010 09:47:21 +0000 (UTC) (envelope-from rpaulo@freebsd.org) Received: from karen.lavabit.com (karen.lavabit.com [72.249.41.33]) by mx1.freebsd.org (Postfix) with ESMTP id E08998FC1B; Sun, 19 Sep 2010 09:47:20 +0000 (UTC) Received: from d.earth.lavabit.com (d.earth.lavabit.com [192.168.111.13]) by karen.lavabit.com (Postfix) with ESMTP id CB82E11B851; Sun, 19 Sep 2010 04:47:19 -0500 (CDT) Received: from 10.0.10.3 (221.163.108.93.rev.vodafone.pt [93.108.163.221]) by lavabit.com with ESMTP id 41VM947P2XGD; Sun, 19 Sep 2010 04:47:19 -0500 Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: text/plain; charset=us-ascii From: Rui Paulo In-Reply-To: Date: Sun, 19 Sep 2010 10:47:16 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201009182338.o8INcLF8081790@svn.freebsd.org> To: pluknet X-Mailer: Apple Mail (2.1081) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212831 - head/lib/libproc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 09:47:21 -0000 On 19 Sep 2010, at 09:01, pluknet wrote: > On 19 September 2010 03:38, Rui Paulo wrote: >> Author: rpaulo >> Date: Sat Sep 18 23:38:21 2010 >> New Revision: 212831 >> URL: http://svn.freebsd.org/changeset/base/212831 >>=20 >> Log: >> Ignore EINTR when calling waitpid. >>=20 >> Modified: >> head/lib/libproc/proc_util.c >>=20 >> Modified: head/lib/libproc/proc_util.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/lib/libproc/proc_util.c Sat Sep 18 22:37:47 2010 = (r212830) >> +++ head/lib/libproc/proc_util.c Sat Sep 18 23:38:21 2010 = (r212831) >> @@ -145,7 +145,8 @@ proc_wstatus(struct proc_handle *phdl) >> if (phdl =3D=3D NULL) >> return (-1); >> if (waitpid(phdl->pid, &status, WUNTRACED) < 0) { >> - warn("waitpid"); >> + if (errno !=3D EINTR) >> + warn("waitpid"); >> return (-1); >> } >> if (WIFSTOPPED(status)) >=20 > Hi. >=20 > After this change the waitpid() error handling still doesn't > ignore EINTR (well, only warn() ignores EINTR now), > but it rather returns with -1. Is it intentional? > I though something more like this was meant in svn log: >=20 > while (waitpid(...) < 0) > if (errno !=3D EINTR) { > warn("waitpid"); > return (-1); > } Maybe the log was badly worded, but the code is right. Regards, -- Rui Paulo From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 10:45:54 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E510106564A; Sun, 19 Sep 2010 10:45:54 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0DF368FC13; Sun, 19 Sep 2010 10:45:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JAjr4q098982; Sun, 19 Sep 2010 10:45:53 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JAjrud098980; Sun, 19 Sep 2010 10:45:53 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <201009191045.o8JAjrud098980@svn.freebsd.org> From: Brian Somers Date: Sun, 19 Sep 2010 10:45:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212845 - head/sys/geom/eli X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 10:45:54 -0000 Author: brian Date: Sun Sep 19 10:45:53 2010 New Revision: 212845 URL: http://svn.freebsd.org/changeset/base/212845 Log: Support attaching version 4 metadata Reviewed by: pjd Modified: head/sys/geom/eli/g_eli.h Modified: head/sys/geom/eli/g_eli.h ============================================================================== --- head/sys/geom/eli/g_eli.h Sun Sep 19 09:19:38 2010 (r212844) +++ head/sys/geom/eli/g_eli.h Sun Sep 19 10:45:53 2010 (r212845) @@ -228,8 +228,9 @@ eli_metadata_decode_v0(const u_char *dat return (EINVAL); return (0); } + static __inline int -eli_metadata_decode_v1v2v3(const u_char *data, struct g_eli_metadata *md) +eli_metadata_decode_v1v2v3v4(const u_char *data, struct g_eli_metadata *md) { MD5_CTX ctx; const u_char *p; @@ -266,7 +267,8 @@ eli_metadata_decode(const u_char *data, case 1: case 2: case 3: - error = eli_metadata_decode_v1v2v3(data, md); + case 4: + error = eli_metadata_decode_v1v2v3v4(data, md); break; default: error = EINVAL; From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 10:51:28 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CE43A106566B; Sun, 19 Sep 2010 10:51:28 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from tarsier.geekcn.org (tarsier.geekcn.org [IPv6:2001:470:a803::1]) by mx1.freebsd.org (Postfix) with ESMTP id 330748FC0A; Sun, 19 Sep 2010 10:51:28 +0000 (UTC) Received: from mail.geekcn.org (tarsier.geekcn.org [211.166.10.233]) by tarsier.geekcn.org (Postfix) with ESMTP id 25921A6A8E5; Sun, 19 Sep 2010 18:51:26 +0800 (CST) X-Virus-Scanned: amavisd-new at geekcn.org Received: from tarsier.geekcn.org ([211.166.10.233]) by mail.geekcn.org (mail.geekcn.org [211.166.10.233]) (amavisd-new, port 10024) with LMTP id O0S082CB36nL; Sun, 19 Sep 2010 18:51:18 +0800 (CST) Received: from delta.delphij.net (c-76-102-48-203.hsd1.ca.comcast.net [76.102.48.203]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tarsier.geekcn.org (Postfix) with ESMTPSA id BF91EA6A8DC; Sun, 19 Sep 2010 18:51:16 +0800 (CST) DomainKey-Signature: a=rsa-sha1; s=default; d=delphij.net; c=nofws; q=dns; h=message-id:date:from:reply-to:organization:user-agent: mime-version:to:cc:subject:references:in-reply-to: x-enigmail-version:openpgp:content-type:content-transfer-encoding; b=hWjobpvnYMwMLcUbZwTJ3Cnt/fghrlkPhimnpABEmMVg0eKyfUp8+0TQCHjdH6GW1 +TFzUdqqvHp2ljxYecSRA== Message-ID: <4C95EB21.1030304@delphij.net> Date: Sun, 19 Sep 2010 03:51:13 -0700 From: Xin LI Organization: The Geek China Organization User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.1.12) Gecko/20100909 Thunderbird/3.0.7 ThunderBrowse/3.3.2 MIME-Version: 1.0 To: Warner Losh References: <201009130144.o8D1i7jr045217@svn.freebsd.org> In-Reply-To: <201009130144.o8D1i7jr045217@svn.freebsd.org> X-Enigmail-Version: 1.0.1 OpenPGP: id=3FCA37C1; url=http://www.delphij.net/delphij.asc Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG Subject: Re: svn commit: r212517 - head/lib/libz X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: d@delphij.net List-Id: "SVN commit messages 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 Sep 2010 10:51:28 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 2010/09/12 18:44, Warner Losh wrote: > Author: imp > Date: Mon Sep 13 01:44:07 2010 > New Revision: 212517 > URL: http://svn.freebsd.org/changeset/base/212517 > > Log: > Include FreeBSD svn tag The file was completely the same with libz vendor version now (except your addition of $FreeBSD$ tag). Plus: [delphij@delta] /usr/src/lib/libz> svn pl minigzip.c Properties on 'minigzip.c': fbsd:nokeywords Or, do we require $FreeBSD$ tags for every files? > Modified: > head/lib/libz/minigzip.c > Cheers, - -- Xin LI http://www.delphij.net/ FreeBSD - The Power to Serve! Live free or die -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (FreeBSD) iQEcBAEBCAAGBQJMleshAAoJEATO+BI/yjfB9U4IAIodWHl2YHawJfru3Tpd4GQW MVuHGjPGyV8rkB/ABntFZ4u+nDxwn9gah2f4CXfKnQx5+49QMaie4ubQEbAzFvZF a/hanbix4keiJIsHXBfm+r3NStMUtw9rgDjs+j73j0qNjkya62FlvbMF6Q7FeWsw Z5LTrH7bNBhfLqAkbVcyvqHqajsjAh025UQ/2Z9in38f3P+8FTSWBXWeunHNfsAr q+F8lEftrFH9+PIweBV18D0RReSTE9XKq448lJeeKQN9n26Zjgari7j+FEsWlzQj WyZK/YOQNMOUCQQB/FWmBHOlHh0qaOSitWyYvMzIilfNR3ercQpT8oIZOLc91j8= =EZjg -----END PGP SIGNATURE----- From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 10:51:55 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 734F51065703; Sun, 19 Sep 2010 10:51:55 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 47F568FC12; Sun, 19 Sep 2010 10:51:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JAptxa099149; Sun, 19 Sep 2010 10:51:55 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JAptS7099147; Sun, 19 Sep 2010 10:51:55 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009191051.o8JAptS7099147@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 19 Sep 2010 10:51:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212846 - head/sbin/geom/class/eli X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 10:51:55 -0000 Author: pjd Date: Sun Sep 19 10:51:55 2010 New Revision: 212846 URL: http://svn.freebsd.org/changeset/base/212846 Log: Fix indent. Modified: head/sbin/geom/class/eli/geli.8 Modified: head/sbin/geom/class/eli/geli.8 ============================================================================== --- head/sbin/geom/class/eli/geli.8 Sun Sep 19 10:45:53 2010 (r212845) +++ head/sbin/geom/class/eli/geli.8 Sun Sep 19 10:51:55 2010 (r212846) @@ -217,7 +217,7 @@ The metadata can be recovered with the subcommand described below. .Pp Additional options include: -.Bl -tag -width ".Fl a Ar aalgo" +.Bl -tag -width ".Fl a Ar newkeyfile" .It Fl a Ar aalgo Enable data integrity verification (authentication) using the given algorithm. This will reduce size of available storage and also reduce speed. @@ -302,7 +302,7 @@ provider's name with an suffix. .Pp Additional options include: -.Bl -tag -width ".Fl a Ar algo" +.Bl -tag -width ".Fl a Ar keyfile" .It Fl d If specified, a decrypted provider will be detached automatically on last close. This can help with short memory - user does not have to remember to detach the @@ -332,7 +332,7 @@ Detach the given providers, which means and clear the keys from memory. .Pp Additional options include: -.Bl -tag -width ".Fl a Ar algo" +.Bl -tag -width ".Fl f" .It Fl f Force detach - detach even if the provider is open. .It Fl l @@ -347,7 +347,7 @@ Attach the given providers with random, The command can be used to encrypt swap partitions or temporary file systems. .Pp Additional options include: -.Bl -tag -width ".Fl a Ar aalgo" +.Bl -tag -width ".Fl a Ar sectorsize" .It Fl a Ar aalgo Enable data integrity verification (authentication). For more information, see the description of the @@ -402,7 +402,7 @@ When a provider is attached, the user do an old passphrase/keyfile. .Pp Additional options include: -.Bl -tag -width ".Fl a Ar algo" +.Bl -tag -width ".Fl a Ar iterations" .It Fl i Ar iterations Number of iterations to use with PKCS#5v2. If 0 is given, PKCS#5v2 will not be used. @@ -432,7 +432,7 @@ will not be detached even if all keys wi It can be even rescued with the .Cm setkey subcommand. -.Bl -tag -width ".Fl a Ar algo" +.Bl -tag -width ".Fl a Ar keyno" .It Fl a Destroy all keys (does not need .Fl f @@ -456,7 +456,7 @@ backup, your data is gone for good. In case the provider was attached with the .Fl r flag, the keys will not be destroyed, only the provider will be detached. -.Bl -tag -width ".Fl a Ar algo" +.Bl -tag -width ".Fl a" .It Fl a If specified, all currently attached providers will be killed. .El From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 10:54:58 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A58D106564A; Sun, 19 Sep 2010 10:54:58 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 77AB78FC12; Sun, 19 Sep 2010 10:54:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JAswtJ099279; Sun, 19 Sep 2010 10:54:58 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JAswIL099270; Sun, 19 Sep 2010 10:54:58 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201009191054.o8JAswIL099270@svn.freebsd.org> From: Dimitry Andric Date: Sun, 19 Sep 2010 10:54:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212847 - in head/lib/clang: libllvmarmasmparser libllvmarminfo libllvmbitreader libllvminstcombine libllvmmipsinfo libllvmpowerpcinfo libllvmx86asmparser libllvmx86info X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 10:54:58 -0000 Author: dim Date: Sun Sep 19 10:54:58 2010 New Revision: 212847 URL: http://svn.freebsd.org/changeset/base/212847 Log: In all Makefiles under lib/clang, consistently use tabs instead of spaces after the '=' sign in macro assignments. Approved-by: rpaulo (mentor) Modified: head/lib/clang/libllvmarmasmparser/Makefile head/lib/clang/libllvmarminfo/Makefile head/lib/clang/libllvmbitreader/Makefile head/lib/clang/libllvminstcombine/Makefile head/lib/clang/libllvmmipsinfo/Makefile head/lib/clang/libllvmpowerpcinfo/Makefile head/lib/clang/libllvmx86asmparser/Makefile head/lib/clang/libllvmx86info/Makefile Modified: head/lib/clang/libllvmarmasmparser/Makefile ============================================================================== --- head/lib/clang/libllvmarmasmparser/Makefile Sun Sep 19 10:51:55 2010 (r212846) +++ head/lib/clang/libllvmarmasmparser/Makefile Sun Sep 19 10:54:58 2010 (r212847) @@ -7,7 +7,7 @@ INCDIR= lib/Target/ARM SRCS= ARMAsmParser.cpp \ ARMAsmLexer.cpp -TGHDRS= ARMGenInstrNames \ +TGHDRS= ARMGenInstrNames \ ARMGenRegisterInfo.h \ ARMGenRegisterNames Modified: head/lib/clang/libllvmarminfo/Makefile ============================================================================== --- head/lib/clang/libllvmarminfo/Makefile Sun Sep 19 10:51:55 2010 (r212846) +++ head/lib/clang/libllvmarminfo/Makefile Sun Sep 19 10:54:58 2010 (r212847) @@ -6,7 +6,7 @@ SRCDIR= lib/Target/ARM/TargetInfo/ INCDIR= lib/Target/ARM SRCS= ARMTargetInfo.cpp -TGHDRS= ARMGenInstrNames \ +TGHDRS= ARMGenInstrNames \ ARMGenRegisterNames .include "../clang.lib.mk" Modified: head/lib/clang/libllvmbitreader/Makefile ============================================================================== --- head/lib/clang/libllvmbitreader/Makefile Sun Sep 19 10:51:55 2010 (r212846) +++ head/lib/clang/libllvmbitreader/Makefile Sun Sep 19 10:54:58 2010 (r212847) @@ -6,6 +6,6 @@ SRCDIR= lib/Bitcode/Reader SRCS= BitReader.cpp \ BitcodeReader.cpp -TGHDRS= Intrinsics +TGHDRS= Intrinsics .include "../clang.lib.mk" Modified: head/lib/clang/libllvminstcombine/Makefile ============================================================================== --- head/lib/clang/libllvminstcombine/Makefile Sun Sep 19 10:51:55 2010 (r212846) +++ head/lib/clang/libllvminstcombine/Makefile Sun Sep 19 10:54:58 2010 (r212847) @@ -17,6 +17,6 @@ SRCS= InstCombineAddSub.cpp \ InstCombineVectorOps.cpp \ InstructionCombining.cpp -TGHDRS= Intrinsics +TGHDRS= Intrinsics .include "../clang.lib.mk" Modified: head/lib/clang/libllvmmipsinfo/Makefile ============================================================================== --- head/lib/clang/libllvmmipsinfo/Makefile Sun Sep 19 10:51:55 2010 (r212846) +++ head/lib/clang/libllvmmipsinfo/Makefile Sun Sep 19 10:54:58 2010 (r212847) @@ -6,7 +6,7 @@ SRCDIR= lib/Target/Mips/TargetInfo/ INCDIR= lib/Target/Mips SRCS= MipsTargetInfo.cpp -TGHDRS= MipsGenRegisterNames \ +TGHDRS= MipsGenRegisterNames \ MipsGenInstrNames .include "../clang.lib.mk" Modified: head/lib/clang/libllvmpowerpcinfo/Makefile ============================================================================== --- head/lib/clang/libllvmpowerpcinfo/Makefile Sun Sep 19 10:51:55 2010 (r212846) +++ head/lib/clang/libllvmpowerpcinfo/Makefile Sun Sep 19 10:54:58 2010 (r212847) @@ -6,7 +6,7 @@ SRCDIR= lib/Target/PowerPC/TargetInfo/ INCDIR= lib/Target/PowerPC SRCS= PowerPCTargetInfo.cpp -TGHDRS= PPCGenRegisterNames \ +TGHDRS= PPCGenRegisterNames \ PPCGenInstrNames .include "../clang.lib.mk" Modified: head/lib/clang/libllvmx86asmparser/Makefile ============================================================================== --- head/lib/clang/libllvmx86asmparser/Makefile Sun Sep 19 10:51:55 2010 (r212846) +++ head/lib/clang/libllvmx86asmparser/Makefile Sun Sep 19 10:54:58 2010 (r212847) @@ -7,7 +7,7 @@ INCDIR= lib/Target/X86 SRCS= X86AsmLexer.cpp \ X86AsmParser.cpp -TGHDRS= X86GenAsmMatcher \ +TGHDRS= X86GenAsmMatcher \ X86GenInstrNames \ X86GenRegisterNames Modified: head/lib/clang/libllvmx86info/Makefile ============================================================================== --- head/lib/clang/libllvmx86info/Makefile Sun Sep 19 10:51:55 2010 (r212846) +++ head/lib/clang/libllvmx86info/Makefile Sun Sep 19 10:54:58 2010 (r212847) @@ -6,7 +6,7 @@ SRCDIR= lib/Target/X86/TargetInfo/ INCDIR= lib/Target/X86 SRCS= X86TargetInfo.cpp -TGHDRS= X86GenInstrNames \ +TGHDRS= X86GenInstrNames \ X86GenRegisterNames .include "../clang.lib.mk" From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 11:16:50 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0483E106564A; Sun, 19 Sep 2010 11:16:50 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E49018FC15; Sun, 19 Sep 2010 11:16:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JBGnCe099780; Sun, 19 Sep 2010 11:16:49 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JBGnBi099775; Sun, 19 Sep 2010 11:16:49 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <201009191116.o8JBGnBi099775@svn.freebsd.org> From: Brian Somers Date: Sun, 19 Sep 2010 11:16:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212848 - in stable/8: bin/pax tools/regression/bin tools/regression/bin/pax tools/regression/lib/msun tools/regression/usr.bin/pkill tools/tools/ath/common tools/tools/termcap X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 11:16:50 -0000 Author: brian Date: Sun Sep 19 11:16:49 2010 New Revision: 212848 URL: http://svn.freebsd.org/changeset/base/212848 Log: MFC r211864,211963,211964,211965, don't mis-handle path names of 101 characters beginning with '/'. Added: stable/8/tools/regression/bin/Makefile - copied unchanged from r211964, head/tools/regression/bin/Makefile stable/8/tools/regression/bin/pax/ - copied from r211963, head/tools/regression/bin/pax/ Modified: stable/8/bin/pax/pax.1 stable/8/bin/pax/tar.c stable/8/tools/regression/bin/pax/Makefile Directory Properties: stable/8/bin/pax/ (props changed) stable/8/tools/ (props changed) stable/8/tools/build/mk/ (props changed) stable/8/tools/build/options/ (props changed) stable/8/tools/debugscripts/ (props changed) stable/8/tools/kerneldoc/subsys/ (props changed) stable/8/tools/regression/acltools/ (props changed) stable/8/tools/regression/aio/aiotest/ (props changed) stable/8/tools/regression/bin/sh/ (props changed) stable/8/tools/regression/fifo/ (props changed) stable/8/tools/regression/geom/ (props changed) stable/8/tools/regression/lib/libc/ (props changed) stable/8/tools/regression/lib/msun/test-conj.t (props changed) stable/8/tools/regression/mqueue/mqtest1/ (props changed) stable/8/tools/regression/mqueue/mqtest2/ (props changed) stable/8/tools/regression/mqueue/mqtest3/ (props changed) stable/8/tools/regression/mqueue/mqtest4/ (props changed) stable/8/tools/regression/mqueue/mqtest5/ (props changed) stable/8/tools/regression/poll/ (props changed) stable/8/tools/regression/posixsem/ (props changed) stable/8/tools/regression/priv/ (props changed) stable/8/tools/regression/usr.bin/ (props changed) stable/8/tools/regression/usr.bin/pkill/pgrep-_g.t (props changed) stable/8/tools/regression/usr.bin/pkill/pgrep-_s.t (props changed) stable/8/tools/regression/usr.bin/pkill/pkill-_g.t (props changed) stable/8/tools/regression/usr.bin/sed/ (props changed) stable/8/tools/test/ (props changed) stable/8/tools/tools/ath/ (props changed) stable/8/tools/tools/ath/common/dumpregs.h (props changed) stable/8/tools/tools/ath/common/dumpregs_5210.c (props changed) stable/8/tools/tools/ath/common/dumpregs_5211.c (props changed) stable/8/tools/tools/ath/common/dumpregs_5212.c (props changed) stable/8/tools/tools/ath/common/dumpregs_5416.c (props changed) stable/8/tools/tools/nanobsd/ (props changed) stable/8/tools/tools/netrate/tcpp/ (props changed) stable/8/tools/tools/termcap/termcap.pl (props changed) stable/8/tools/tools/vimage/ (props changed) Modified: stable/8/bin/pax/pax.1 ============================================================================== --- stable/8/bin/pax/pax.1 Sun Sep 19 10:54:58 2010 (r212847) +++ stable/8/bin/pax/pax.1 Sun Sep 19 11:16:49 2010 (r212848) @@ -33,7 +33,7 @@ .\" @(#)pax.1 8.4 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd July 3, 2004 +.Dd August 29, 2010 .Dt PAX 1 .Os .Sh NAME @@ -748,7 +748,9 @@ The extended tar interchange format spec .St -p1003.2 standard. The default blocksize for this format is 10240 bytes. -Pathnames stored by this format must be 250 characters or less in length. +Pathnames stored by this format must be 255 characters or less in length. +The directory part may be at most 155 characters and each path component +must be less than 100 characters. .El .Pp The Modified: stable/8/bin/pax/tar.c ============================================================================== --- stable/8/bin/pax/tar.c Sun Sep 19 10:54:58 2010 (r212847) +++ stable/8/bin/pax/tar.c Sun Sep 19 11:16:49 2010 (r212848) @@ -1086,7 +1086,7 @@ name_split(char *name, int len) */ if (len <= TNMSZ) return(name); - if (len > (TPFSZ + TNMSZ + 1)) + if (len > TPFSZ + TNMSZ) return(NULL); /* @@ -1095,7 +1095,7 @@ name_split(char *name, int len) * to find the biggest piece to fit in the name field (or the smallest * prefix we can find) */ - start = name + len - TNMSZ - 1; + start = name + len - TNMSZ; while ((*start != '\0') && (*start != '/')) ++start; Copied: stable/8/tools/regression/bin/Makefile (from r211964, head/tools/regression/bin/Makefile) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/Makefile Sun Sep 19 11:16:49 2010 (r212848, copy of r211964, head/tools/regression/bin/Makefile) @@ -0,0 +1,5 @@ +# $FreeBSD$ + +SUBDIR= date mv pax sh + +.include Modified: stable/8/tools/regression/bin/pax/Makefile ============================================================================== --- head/tools/regression/bin/pax/Makefile Sun Aug 29 11:56:56 2010 (r211963) +++ stable/8/tools/regression/bin/pax/Makefile Sun Sep 19 11:16:49 2010 (r212848) @@ -1,6 +1,6 @@ # $FreeBSD$ -test: +all test: prove -vmw regress.t clean: From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 11:22:23 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5C9CE106566C; Sun, 19 Sep 2010 11:22:23 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 49EB88FC1C; Sun, 19 Sep 2010 11:22:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JBMNhn000101; Sun, 19 Sep 2010 11:22:23 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JBMNc3099995; Sun, 19 Sep 2010 11:22:23 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <201009191122.o8JBMNc3099995@svn.freebsd.org> From: Brian Somers Date: Sun, 19 Sep 2010 11:22:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212849 - in stable/7: bin/pax tools/regression/bin tools/regression/bin/pax tools/tools/nanobsd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 11:22:23 -0000 Author: brian Date: Sun Sep 19 11:22:22 2010 New Revision: 212849 URL: http://svn.freebsd.org/changeset/base/212849 Log: MFC r211864,211963,211964,211965, don't mis-handle path names of 101 characters beginning with '/'. Added: stable/7/tools/regression/bin/Makefile - copied unchanged from r211964, head/tools/regression/bin/Makefile stable/7/tools/regression/bin/pax/ - copied from r211963, head/tools/regression/bin/pax/ Modified: stable/7/bin/pax/pax.1 stable/7/bin/pax/tar.c stable/7/tools/regression/bin/pax/Makefile Directory Properties: stable/7/bin/pax/ (props changed) stable/7/tools/ (props changed) stable/7/tools/build/ (props changed) stable/7/tools/build/options/ (props changed) stable/7/tools/debugscripts/ (props changed) stable/7/tools/regression/atm/ (props changed) stable/7/tools/regression/bin/sh/ (props changed) stable/7/tools/regression/file/ (props changed) stable/7/tools/regression/file/flock/ (props changed) stable/7/tools/regression/usr.bin/ (props changed) stable/7/tools/regression/usr.bin/jot/ (props changed) stable/7/tools/regression/usr.bin/tr/ (props changed) stable/7/tools/sched/ (props changed) stable/7/tools/test/ (props changed) stable/7/tools/tools/aac/ (props changed) stable/7/tools/tools/crypto/ (props changed) stable/7/tools/tools/editing/ (props changed) stable/7/tools/tools/nanobsd/ (props changed) stable/7/tools/tools/nanobsd/FlashDevice.sub (props changed) stable/7/tools/tools/nanobsd/nanobsd.sh (props changed) stable/7/tools/tools/usb/ (props changed) Modified: stable/7/bin/pax/pax.1 ============================================================================== --- stable/7/bin/pax/pax.1 Sun Sep 19 11:16:49 2010 (r212848) +++ stable/7/bin/pax/pax.1 Sun Sep 19 11:22:22 2010 (r212849) @@ -33,7 +33,7 @@ .\" @(#)pax.1 8.4 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd July 3, 2004 +.Dd August 29, 2010 .Dt PAX 1 .Os .Sh NAME @@ -748,7 +748,9 @@ The extended tar interchange format spec .St -p1003.2 standard. The default blocksize for this format is 10240 bytes. -Pathnames stored by this format must be 250 characters or less in length. +Pathnames stored by this format must be 255 characters or less in length. +The directory part may be at most 155 characters and each path component +must be less than 100 characters. .El .Pp The Modified: stable/7/bin/pax/tar.c ============================================================================== --- stable/7/bin/pax/tar.c Sun Sep 19 11:16:49 2010 (r212848) +++ stable/7/bin/pax/tar.c Sun Sep 19 11:22:22 2010 (r212849) @@ -1086,7 +1086,7 @@ name_split(char *name, int len) */ if (len <= TNMSZ) return(name); - if (len > (TPFSZ + TNMSZ + 1)) + if (len > TPFSZ + TNMSZ) return(NULL); /* @@ -1095,7 +1095,7 @@ name_split(char *name, int len) * to find the biggest piece to fit in the name field (or the smallest * prefix we can find) */ - start = name + len - TNMSZ - 1; + start = name + len - TNMSZ; while ((*start != '\0') && (*start != '/')) ++start; Copied: stable/7/tools/regression/bin/Makefile (from r211964, head/tools/regression/bin/Makefile) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/tools/regression/bin/Makefile Sun Sep 19 11:22:22 2010 (r212849, copy of r211964, head/tools/regression/bin/Makefile) @@ -0,0 +1,5 @@ +# $FreeBSD$ + +SUBDIR= date mv pax sh + +.include Modified: stable/7/tools/regression/bin/pax/Makefile ============================================================================== --- head/tools/regression/bin/pax/Makefile Sun Aug 29 11:56:56 2010 (r211963) +++ stable/7/tools/regression/bin/pax/Makefile Sun Sep 19 11:22:22 2010 (r212849) @@ -1,6 +1,6 @@ # $FreeBSD$ -test: +all test: prove -vmw regress.t clean: From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 11:42:17 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 42CBA106564A; Sun, 19 Sep 2010 11:42:17 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 17B158FC13; Sun, 19 Sep 2010 11:42:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JBgG3p000546; Sun, 19 Sep 2010 11:42:16 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JBgGbx000543; Sun, 19 Sep 2010 11:42:16 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201009191142.o8JBgGbx000543@svn.freebsd.org> From: Michael Tuexen Date: Sun, 19 Sep 2010 11:42:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212850 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 11:42:17 -0000 Author: tuexen Date: Sun Sep 19 11:42:16 2010 New Revision: 212850 URL: http://svn.freebsd.org/changeset/base/212850 Log: Fix a locking issue which shows up when the code is used on Mac OS X. MFC after: 2 weeks. Modified: head/sys/netinet/sctp_auth.c head/sys/netinet/sctp_pcb.c Modified: head/sys/netinet/sctp_auth.c ============================================================================== --- head/sys/netinet/sctp_auth.c Sun Sep 19 11:22:22 2010 (r212849) +++ head/sys/netinet/sctp_auth.c Sun Sep 19 11:42:16 2010 (r212850) @@ -614,7 +614,7 @@ sctp_auth_key_release(struct sctp_tcb *s if ((skey->refcount <= 1) && (skey->deactivated)) { /* notify ULP that key is no longer used */ sctp_ulp_notify(SCTP_NOTIFY_AUTH_FREE_KEY, stcb, - key_id, 0, SCTP_SO_NOT_LOCKED); + key_id, 0, SCTP_SO_LOCKED); SCTPDBG(SCTP_DEBUG_AUTH2, "%s: stcb %p key %u no longer used, %d\n", __FUNCTION__, stcb, key_id, skey->refcount); Modified: head/sys/netinet/sctp_pcb.c ============================================================================== --- head/sys/netinet/sctp_pcb.c Sun Sep 19 11:22:22 2010 (r212849) +++ head/sys/netinet/sctp_pcb.c Sun Sep 19 11:42:16 2010 (r212850) @@ -4822,7 +4822,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, /* Still an open socket - report */ sctp_ulp_notify(SCTP_NOTIFY_SPECIAL_SP_FAIL, stcb, SCTP_NOTIFY_DATAGRAM_UNSENT, - (void *)sp, 0); + (void *)sp, SCTP_SO_LOCKED); } if (sp->data) { sctp_m_freem(sp->data); @@ -4894,7 +4894,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, if (so) { /* Still a socket? */ sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, stcb, - SCTP_NOTIFY_DATAGRAM_UNSENT, chk, 0); + SCTP_NOTIFY_DATAGRAM_UNSENT, chk, SCTP_SO_LOCKED); } if (chk->data) { sctp_m_freem(chk->data); @@ -4929,7 +4929,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, if (so) { /* Still a socket? */ sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, stcb, - SCTP_NOTIFY_DATAGRAM_SENT, chk, 0); + SCTP_NOTIFY_DATAGRAM_SENT, chk, SCTP_SO_LOCKED); } if (chk->data) { sctp_m_freem(chk->data); From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 11:57:21 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D1CE4106566C; Sun, 19 Sep 2010 11:57:21 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C10BB8FC12; Sun, 19 Sep 2010 11:57:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JBvLuL000976; Sun, 19 Sep 2010 11:57:21 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JBvLeT000974; Sun, 19 Sep 2010 11:57:21 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201009191157.o8JBvLeT000974@svn.freebsd.org> From: Michael Tuexen Date: Sun, 19 Sep 2010 11:57:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212851 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 11:57:21 -0000 Author: tuexen Date: Sun Sep 19 11:57:21 2010 New Revision: 212851 URL: http://svn.freebsd.org/changeset/base/212851 Log: Allow the initial congestion window to be configure to one MTU. Improve the description. MFC after: 2 weeks. Modified: head/sys/netinet/sctp_sysctl.h Modified: head/sys/netinet/sctp_sysctl.h ============================================================================== --- head/sys/netinet/sctp_sysctl.h Sun Sep 19 11:42:16 2010 (r212850) +++ head/sys/netinet/sctp_sysctl.h Sun Sep 19 11:57:21 2010 (r212851) @@ -499,8 +499,8 @@ struct sctp_sysctl { #define SCTPCTL_BUFFER_SPLITTING_DEFAULT SCTPCTL_BUFFER_SPLITTING_MIN /* Initial congestion window in MTU */ -#define SCTPCTL_INITIAL_CWND_DESC "Initial congestion window in MTU" -#define SCTPCTL_INITIAL_CWND_MIN 2 +#define SCTPCTL_INITIAL_CWND_DESC "Initial congestion window in MTUs" +#define SCTPCTL_INITIAL_CWND_MIN 1 #define SCTPCTL_INITIAL_CWND_MAX 0xffffffff #define SCTPCTL_INITIAL_CWND_DEFAULT 3 From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 12:01:50 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 74D9610656B1; Sun, 19 Sep 2010 12:01:50 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6432B8FC35; Sun, 19 Sep 2010 12:01:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JC1ogH001120; Sun, 19 Sep 2010 12:01:50 GMT (envelope-from tijl@svn.freebsd.org) Received: (from tijl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JC1oaa001118; Sun, 19 Sep 2010 12:01:50 GMT (envelope-from tijl@svn.freebsd.org) Message-Id: <201009191201.o8JC1oaa001118@svn.freebsd.org> From: Tijl Coosemans Date: Sun, 19 Sep 2010 12:01:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212852 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 12:01:50 -0000 Author: tijl Date: Sun Sep 19 12:01:50 2010 New Revision: 212852 URL: http://svn.freebsd.org/changeset/base/212852 Log: Indicate that POSIX semaphores are always supported. Reported by: avilla Reviewed by: davidxu Approved by: kib (mentor) Modified: head/sys/sys/unistd.h Modified: head/sys/sys/unistd.h ============================================================================== --- head/sys/sys/unistd.h Sun Sep 19 11:57:21 2010 (r212851) +++ head/sys/sys/unistd.h Sun Sep 19 12:01:50 2010 (r212852) @@ -68,7 +68,7 @@ #define _POSIX_PRIORITY_SCHEDULING 200112L #define _POSIX_RAW_SOCKETS 200112L #define _POSIX_REALTIME_SIGNALS 200112L -#define _POSIX_SEMAPHORES -1 +#define _POSIX_SEMAPHORES 200112L #define _POSIX_SHARED_MEMORY_OBJECTS 200112L #define _POSIX_SPORADIC_SERVER -1 #define _POSIX_SYNCHRONIZED_IO -1 From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 12:39:05 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 062F41065672; Sun, 19 Sep 2010 12:39:05 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E8B2F8FC08; Sun, 19 Sep 2010 12:39:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JCd4ao001914; Sun, 19 Sep 2010 12:39:04 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JCd4gG001912; Sun, 19 Sep 2010 12:39:04 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201009191239.o8JCd4gG001912@svn.freebsd.org> From: Bernhard Schmidt Date: Sun, 19 Sep 2010 12:39:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212853 - head/sys/dev/iwn X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 12:39:05 -0000 Author: bschmidt Date: Sun Sep 19 12:39:04 2010 New Revision: 212853 URL: http://svn.freebsd.org/changeset/base/212853 Log: Group functions used for initial calibration. Modified: head/sys/dev/iwn/if_iwn.c Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Sun Sep 19 12:01:50 2010 (r212852) +++ head/sys/dev/iwn/if_iwn.c Sun Sep 19 12:39:04 2010 (r212853) @@ -135,8 +135,6 @@ static void iwn_rx_done(struct iwn_softc static void iwn_rx_compressed_ba(struct iwn_softc *, struct iwn_rx_desc *, struct iwn_rx_data *); #endif -static void iwn5000_rx_calib_results(struct iwn_softc *, - struct iwn_rx_desc *, struct iwn_rx_data *); static void iwn_rx_statistics(struct iwn_softc *, struct iwn_rx_desc *, struct iwn_rx_data *); static void iwn4965_tx_done(struct iwn_softc *, struct iwn_rx_desc *, @@ -220,8 +218,10 @@ static void iwn5000_ampdu_tx_start(struc struct ieee80211_node *, uint8_t, uint16_t); static void iwn5000_ampdu_tx_stop(struct iwn_softc *, uint8_t, uint16_t); #endif -static int iwn5000_query_calibration(struct iwn_softc *); static int iwn5000_send_calibration(struct iwn_softc *); +static int iwn5000_query_calibration(struct iwn_softc *); +static void iwn5000_rx_calib_results(struct iwn_softc *, + struct iwn_rx_desc *, struct iwn_rx_data *); static int iwn5000_send_wimax_coex(struct iwn_softc *); static int iwn4965_post_alive(struct iwn_softc *); static int iwn5000_post_alive(struct iwn_softc *); @@ -2196,64 +2196,6 @@ iwn_rx_compressed_ba(struct iwn_softc *s #endif /* - * Process a CALIBRATION_RESULT notification sent by the initialization - * firmware on response to a CMD_CALIB_CONFIG command (5000 only.) - */ -static void -iwn5000_rx_calib_results(struct iwn_softc *sc, struct iwn_rx_desc *desc, - struct iwn_rx_data *data) -{ - struct iwn_phy_calib *calib = (struct iwn_phy_calib *)(desc + 1); - int len, idx = -1; - - /* Runtime firmware should not send such a notification. */ - if (sc->sc_flags & IWN_FLAG_CALIB_DONE) - return; - - bus_dmamap_sync(sc->rxq.data_dmat, data->map, BUS_DMASYNC_POSTREAD); - len = (le32toh(desc->len) & 0x3fff) - 4; - - switch (calib->code) { - case IWN5000_PHY_CALIB_DC: - if (sc->hw_type == IWN_HW_REV_TYPE_5150 || - sc->hw_type == IWN_HW_REV_TYPE_6050) - idx = 0; - break; - case IWN5000_PHY_CALIB_LO: - idx = 1; - break; - case IWN5000_PHY_CALIB_TX_IQ: - idx = 2; - break; - case IWN5000_PHY_CALIB_TX_IQ_PERIODIC: - if (sc->hw_type < IWN_HW_REV_TYPE_6000 && - sc->hw_type != IWN_HW_REV_TYPE_5150) - idx = 3; - break; - case IWN5000_PHY_CALIB_BASE_BAND: - idx = 4; - break; - } - if (idx == -1) /* Ignore other results. */ - return; - - /* Save calibration result. */ - if (sc->calibcmd[idx].buf != NULL) - free(sc->calibcmd[idx].buf, M_DEVBUF); - sc->calibcmd[idx].buf = malloc(len, M_DEVBUF, M_NOWAIT); - if (sc->calibcmd[idx].buf == NULL) { - DPRINTF(sc, IWN_DEBUG_CALIBRATE, - "not enough memory for calibration result %d\n", - calib->code); - return; - } - DPRINTF(sc, IWN_DEBUG_CALIBRATE, - "saving calibration result code=%d len=%d\n", calib->code, len); - sc->calibcmd[idx].len = len; - memcpy(sc->calibcmd[idx].buf, calib, len); -} - -/* * Process an RX_STATISTICS or BEACON_STATISTICS firmware notification. * The latter is sent by the firmware after each received beacon. */ @@ -5239,6 +5181,33 @@ iwn5000_ampdu_tx_stop(struct iwn_softc * #endif /* + * Send calibration results to the runtime firmware. These results were + * obtained on first boot from the initialization firmware. + */ +static int +iwn5000_send_calibration(struct iwn_softc *sc) +{ + int idx, error; + + for (idx = 0; idx < 5; idx++) { + if (sc->calibcmd[idx].buf == NULL) + continue; /* No results available. */ + DPRINTF(sc, IWN_DEBUG_CALIBRATE, + "send calibration result idx=%d len=%d\n", + idx, sc->calibcmd[idx].len); + error = iwn_cmd(sc, IWN_CMD_PHY_CALIB, sc->calibcmd[idx].buf, + sc->calibcmd[idx].len, 0); + if (error != 0) { + device_printf(sc->sc_dev, + "%s: could not send calibration result, error %d\n", + __func__, error); + return error; + } + } + return 0; +} + +/* * Query calibration tables from the initialization firmware. We do this * only once at first boot. Called from a process context. */ @@ -5266,30 +5235,61 @@ iwn5000_query_calibration(struct iwn_sof } /* - * Send calibration results to the runtime firmware. These results were - * obtained on first boot from the initialization firmware. + * Process a CALIBRATION_RESULT notification sent by the initialization + * firmware on response to a CMD_CALIB_CONFIG command (5000 only.) */ -static int -iwn5000_send_calibration(struct iwn_softc *sc) +static void +iwn5000_rx_calib_results(struct iwn_softc *sc, struct iwn_rx_desc *desc, + struct iwn_rx_data *data) { - int idx, error; + struct iwn_phy_calib *calib = (struct iwn_phy_calib *)(desc + 1); + int len, idx = -1; - for (idx = 0; idx < 5; idx++) { - if (sc->calibcmd[idx].buf == NULL) - continue; /* No results available. */ + /* Runtime firmware should not send such a notification. */ + if (sc->sc_flags & IWN_FLAG_CALIB_DONE) + return; + + bus_dmamap_sync(sc->rxq.data_dmat, data->map, BUS_DMASYNC_POSTREAD); + len = (le32toh(desc->len) & 0x3fff) - 4; + + switch (calib->code) { + case IWN5000_PHY_CALIB_DC: + if (sc->hw_type == IWN_HW_REV_TYPE_5150 || + sc->hw_type == IWN_HW_REV_TYPE_6050) + idx = 0; + break; + case IWN5000_PHY_CALIB_LO: + idx = 1; + break; + case IWN5000_PHY_CALIB_TX_IQ: + idx = 2; + break; + case IWN5000_PHY_CALIB_TX_IQ_PERIODIC: + if (sc->hw_type < IWN_HW_REV_TYPE_6000 && + sc->hw_type != IWN_HW_REV_TYPE_5150) + idx = 3; + break; + case IWN5000_PHY_CALIB_BASE_BAND: + idx = 4; + break; + } + if (idx == -1) /* Ignore other results. */ + return; + + /* Save calibration result. */ + if (sc->calibcmd[idx].buf != NULL) + free(sc->calibcmd[idx].buf, M_DEVBUF); + sc->calibcmd[idx].buf = malloc(len, M_DEVBUF, M_NOWAIT); + if (sc->calibcmd[idx].buf == NULL) { DPRINTF(sc, IWN_DEBUG_CALIBRATE, - "send calibration result idx=%d len=%d\n", - idx, sc->calibcmd[idx].len); - error = iwn_cmd(sc, IWN_CMD_PHY_CALIB, sc->calibcmd[idx].buf, - sc->calibcmd[idx].len, 0); - if (error != 0) { - device_printf(sc->sc_dev, - "%s: could not send calibration result, error %d\n", - __func__, error); - return error; - } + "not enough memory for calibration result %d\n", + calib->code); + return; } - return 0; + DPRINTF(sc, IWN_DEBUG_CALIBRATE, + "saving calibration result code=%d len=%d\n", calib->code, len); + sc->calibcmd[idx].len = len; + memcpy(sc->calibcmd[idx].buf, calib, len); } static int From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 12:47:41 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 72F98106564A; Sun, 19 Sep 2010 12:47:41 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 60FFB8FC15; Sun, 19 Sep 2010 12:47:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JClfsH002185; Sun, 19 Sep 2010 12:47:41 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JClfu9002182; Sun, 19 Sep 2010 12:47:41 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201009191247.o8JClfu9002182@svn.freebsd.org> From: Bernhard Schmidt Date: Sun, 19 Sep 2010 12:47:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212854 - head/sys/dev/iwn X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 12:47:41 -0000 Author: bschmidt Date: Sun Sep 19 12:47:41 2010 New Revision: 212854 URL: http://svn.freebsd.org/changeset/base/212854 Log: Rewrite parts of the calibration code which is run while bringing up the device: - unobscure some of the code by moving it into its own functions - get rid of some magic numbers - create similar structure as the reference driver has, this should make further syncs easier Modified: head/sys/dev/iwn/if_iwn.c head/sys/dev/iwn/if_iwnvar.h Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Sun Sep 19 12:39:04 2010 (r212853) +++ head/sys/dev/iwn/if_iwn.c Sun Sep 19 12:47:41 2010 (r212854) @@ -218,9 +218,13 @@ static void iwn5000_ampdu_tx_start(struc struct ieee80211_node *, uint8_t, uint16_t); static void iwn5000_ampdu_tx_stop(struct iwn_softc *, uint8_t, uint16_t); #endif -static int iwn5000_send_calibration(struct iwn_softc *); -static int iwn5000_query_calibration(struct iwn_softc *); -static void iwn5000_rx_calib_results(struct iwn_softc *, +static int iwn5000_send_calib_results(struct iwn_softc *); +static int iwn5000_save_calib_result(struct iwn_softc *, + struct iwn_phy_calib *, int, int); +static void iwn5000_free_calib_results(struct iwn_softc *); +static int iwn5000_chrystal_calib(struct iwn_softc *); +static int iwn5000_send_calib_query(struct iwn_softc *); +static int iwn5000_rx_calib_result(struct iwn_softc *, struct iwn_rx_desc *, struct iwn_rx_data *); static int iwn5000_send_wimax_coex(struct iwn_softc *); static int iwn4965_post_alive(struct iwn_softc *); @@ -705,6 +709,9 @@ iwn_hal_attach(struct iwn_softc *sc) sc->fwname = "iwn5000fw"; sc->txchainmask = IWN_ANT_B; sc->rxchainmask = IWN_ANT_AB; + sc->calib_init = IWN_CALIB_XTAL | IWN_CALIB_LO | + IWN_CALIB_TX_IQ | IWN_CALIB_TX_IQ_PERIODIC | + IWN_CALIB_BASE_BAND; break; case IWN_HW_REV_TYPE_5150: sc->sc_hal = &iwn5000_hal; @@ -712,6 +719,8 @@ iwn_hal_attach(struct iwn_softc *sc) sc->fwname = "iwn5150fw"; sc->txchainmask = IWN_ANT_A; sc->rxchainmask = IWN_ANT_AB; + sc->calib_init = IWN_CALIB_DC | IWN_CALIB_LO | + IWN_CALIB_TX_IQ | IWN_CALIB_BASE_BAND; break; case IWN_HW_REV_TYPE_5300: case IWN_HW_REV_TYPE_5350: @@ -720,6 +729,9 @@ iwn_hal_attach(struct iwn_softc *sc) sc->fwname = "iwn5000fw"; sc->txchainmask = IWN_ANT_ABC; sc->rxchainmask = IWN_ANT_ABC; + sc->calib_init = IWN_CALIB_XTAL | IWN_CALIB_LO | + IWN_CALIB_TX_IQ | IWN_CALIB_TX_IQ_PERIODIC | + IWN_CALIB_BASE_BAND; break; case IWN_HW_REV_TYPE_1000: sc->sc_hal = &iwn5000_hal; @@ -727,6 +739,9 @@ iwn_hal_attach(struct iwn_softc *sc) sc->fwname = "iwn1000fw"; sc->txchainmask = IWN_ANT_A; sc->rxchainmask = IWN_ANT_AB; + sc->calib_init = IWN_CALIB_XTAL | IWN_CALIB_LO | + IWN_CALIB_TX_IQ | IWN_CALIB_TX_IQ_PERIODIC | + IWN_CALIB_BASE_BAND; break; case IWN_HW_REV_TYPE_6000: sc->sc_hal = &iwn5000_hal; @@ -744,6 +759,8 @@ iwn_hal_attach(struct iwn_softc *sc) sc->rxchainmask = IWN_ANT_ABC; break; } + sc->calib_init = IWN_CALIB_XTAL | IWN_CALIB_LO | + IWN_CALIB_TX_IQ | IWN_CALIB_BASE_BAND; break; case IWN_HW_REV_TYPE_6050: sc->sc_hal = &iwn5000_hal; @@ -751,6 +768,8 @@ iwn_hal_attach(struct iwn_softc *sc) sc->fwname = "iwn6050fw"; sc->txchainmask = IWN_ANT_AB; sc->rxchainmask = IWN_ANT_AB; + sc->calib_init = IWN_CALIB_XTAL | IWN_CALIB_DC | IWN_CALIB_LO | + IWN_CALIB_TX_IQ | IWN_CALIB_BASE_BAND; break; case IWN_HW_REV_TYPE_6005: sc->sc_hal = &iwn5000_hal; @@ -758,6 +777,8 @@ iwn_hal_attach(struct iwn_softc *sc) sc->fwname = "iwn6005fw"; sc->txchainmask = IWN_ANT_AB; sc->rxchainmask = IWN_ANT_AB; + sc->calib_init = IWN_CALIB_XTAL | IWN_CALIB_LO | + IWN_CALIB_TX_IQ | IWN_CALIB_BASE_BAND; break; default: device_printf(sc->sc_dev, "adapter type %d not supported\n", @@ -842,6 +863,8 @@ iwn_cleanup(device_t dev) ieee80211_ifdetach(ic); } + iwn5000_free_calib_results(sc); + /* Free DMA resources. */ iwn_free_rx_ring(sc, &sc->rxq); if (sc->sc_hal != NULL) @@ -1697,12 +1720,6 @@ iwn5000_read_eeprom(struct iwn_softc *sc sc->temp_off = temp - (volt / -5); DPRINTF(sc, IWN_DEBUG_CALIBRATE, "temp=%d volt=%d offset=%dK\n", temp, volt, sc->temp_off); - } else { - /* Read crystal calibration. */ - iwn_read_prom_data(sc, base + IWN5000_EEPROM_CRYSTAL, - &sc->eeprom_crystal, sizeof (uint32_t)); - DPRINTF(sc, IWN_DEBUG_CALIBRATE, "crystal calibration 0x%08x\n", - le32toh(sc->eeprom_crystal)); } } @@ -2550,7 +2567,7 @@ iwn_notif_intr(struct iwn_softc *sc) break; } case IWN5000_CALIBRATION_RESULT: - iwn5000_rx_calib_results(sc, desc, data); + iwn5000_rx_calib_result(sc, desc, data); break; case IWN5000_CALIBRATION_DONE: @@ -5182,25 +5199,37 @@ iwn5000_ampdu_tx_stop(struct iwn_softc * /* * Send calibration results to the runtime firmware. These results were - * obtained on first boot from the initialization firmware. + * obtained on first boot from the initialization firmware, or by reading + * the EEPROM for crystal calibration. */ static int -iwn5000_send_calibration(struct iwn_softc *sc) +iwn5000_send_calib_results(struct iwn_softc *sc) { + struct iwn_calib_info *calib_result; int idx, error; - for (idx = 0; idx < 5; idx++) { - if (sc->calibcmd[idx].buf == NULL) - continue; /* No results available. */ + for (idx = 0; idx < IWN_CALIB_NUM; idx++) { + calib_result = &sc->calib_results[idx]; + + /* No support for this type of calibration. */ + if ((sc->calib_init & (1 << idx)) == 0) + continue; + + /* No calibration result available. */ + if (calib_result->buf == NULL) + continue; + DPRINTF(sc, IWN_DEBUG_CALIBRATE, - "send calibration result idx=%d len=%d\n", - idx, sc->calibcmd[idx].len); - error = iwn_cmd(sc, IWN_CMD_PHY_CALIB, sc->calibcmd[idx].buf, - sc->calibcmd[idx].len, 0); + "%s: send calibration result idx=%d, len=%d\n", + __func__, idx, calib_result->len); + + error = iwn_cmd(sc, IWN_CMD_PHY_CALIB, calib_result->buf, + calib_result->len, 0); if (error != 0) { device_printf(sc->sc_dev, - "%s: could not send calibration result, error %d\n", - __func__, error); + "%s: could not send calibration result " + "idx=%d, error=%d\n", + __func__, idx, error); return error; } } @@ -5208,22 +5237,101 @@ iwn5000_send_calibration(struct iwn_soft } /* - * Query calibration tables from the initialization firmware. We do this - * only once at first boot. Called from a process context. + * Save calibration result at the given index. The index determines + * in which order the results are sent to the runtime firmware. */ static int -iwn5000_query_calibration(struct iwn_softc *sc) +iwn5000_save_calib_result(struct iwn_softc *sc, struct iwn_phy_calib *calib, + int len, int idx) { + struct iwn_calib_info *calib_result = &sc->calib_results[idx]; + + DPRINTF(sc, IWN_DEBUG_CALIBRATE, + "%s: saving calibration result code=%d, idx=%d, len=%d\n", + __func__, calib->code, idx, len); + + if (calib_result->buf != NULL) + free(calib_result->buf, M_DEVBUF); + + calib_result->buf = malloc(len, M_DEVBUF, M_NOWAIT); + if (calib_result->buf == NULL) { + device_printf(sc->sc_dev, + "%s: not enough memory for calibration result " + "code=%d, len=%d\n", __func__, calib->code, len); + return ENOMEM; + } + + calib_result->len = len; + memcpy(calib_result->buf, calib, len); + return 0; +} + +static void +iwn5000_free_calib_results(struct iwn_softc *sc) +{ + struct iwn_calib_info *calib_result; + int idx; + + for (idx = 0; idx < IWN_CALIB_NUM; idx++) { + calib_result = &sc->calib_results[idx]; + + if (calib_result->buf != NULL) + free(calib_result->buf, M_DEVBUF); + + calib_result->buf = NULL; + calib_result->len = 0; + } +} + +/* + * Obtain the crystal calibration result from the EEPROM. + */ +static int +iwn5000_chrystal_calib(struct iwn_softc *sc) +{ + struct iwn5000_phy_calib_crystal cmd; + uint32_t base, crystal; + uint16_t val; + + /* Read crystal calibration. */ + iwn_read_prom_data(sc, IWN5000_EEPROM_CAL, &val, 2); + base = le16toh(val); + iwn_read_prom_data(sc, base + IWN5000_EEPROM_CRYSTAL, &crystal, + sizeof(uint32_t)); + DPRINTF(sc, IWN_DEBUG_CALIBRATE, "%s: crystal calibration=0x%08x\n", + __func__, le32toh(crystal)); + + memset(&cmd, 0, sizeof cmd); + cmd.code = IWN5000_PHY_CALIB_CRYSTAL; + cmd.ngroups = 1; + cmd.isvalid = 1; + cmd.cap_pin[0] = le32toh(crystal) & 0xff; + cmd.cap_pin[1] = (le32toh(crystal) >> 16) & 0xff; + + return iwn5000_save_calib_result(sc, (struct iwn_phy_calib *)&cmd, + sizeof cmd, IWN_CALIB_IDX_XTAL); +} + +/* + * Query calibration results from the initialization firmware. We do this + * only once at first boot. + */ +static int +iwn5000_send_calib_query(struct iwn_softc *sc) +{ +#define CALIB_INIT_CFG 0xffffffff; struct iwn5000_calib_config cmd; int error; memset(&cmd, 0, sizeof cmd); - cmd.ucode.once.enable = 0xffffffff; - cmd.ucode.once.start = 0xffffffff; - cmd.ucode.once.send = 0xffffffff; - cmd.ucode.flags = 0xffffffff; - DPRINTF(sc, IWN_DEBUG_CALIBRATE, "%s: sending calibration query\n", + cmd.ucode.once.enable = CALIB_INIT_CFG; + cmd.ucode.once.start = CALIB_INIT_CFG; + cmd.ucode.once.send = CALIB_INIT_CFG; + cmd.ucode.flags = CALIB_INIT_CFG; + + DPRINTF(sc, IWN_DEBUG_CALIBRATE, "%s: query calibration results\n", __func__); + error = iwn_cmd(sc, IWN5000_CMD_CALIB_CONFIG, &cmd, sizeof cmd, 0); if (error != 0) return error; @@ -5231,65 +5339,56 @@ iwn5000_query_calibration(struct iwn_sof /* Wait at most two seconds for calibration to complete. */ if (!(sc->sc_flags & IWN_FLAG_CALIB_DONE)) error = msleep(sc, &sc->sc_mtx, PCATCH, "iwninit", 2 * hz); + return error; +#undef CALIB_INIT_CFG } /* * Process a CALIBRATION_RESULT notification sent by the initialization - * firmware on response to a CMD_CALIB_CONFIG command (5000 only.) + * firmware on response to a CMD_CALIB_CONFIG command. */ -static void -iwn5000_rx_calib_results(struct iwn_softc *sc, struct iwn_rx_desc *desc, +static int +iwn5000_rx_calib_result(struct iwn_softc *sc, struct iwn_rx_desc *desc, struct iwn_rx_data *data) { +#define FRAME_SIZE_MASK 0x3fff struct iwn_phy_calib *calib = (struct iwn_phy_calib *)(desc + 1); - int len, idx = -1; - - /* Runtime firmware should not send such a notification. */ - if (sc->sc_flags & IWN_FLAG_CALIB_DONE) - return; + int len, idx; bus_dmamap_sync(sc->rxq.data_dmat, data->map, BUS_DMASYNC_POSTREAD); - len = (le32toh(desc->len) & 0x3fff) - 4; + len = (le32toh(desc->len) & FRAME_SIZE_MASK); + /* Remove length filed itself. */ + len -= 4; + + /* + * Determine the order in which the results will be send to the + * runtime firmware. + */ switch (calib->code) { case IWN5000_PHY_CALIB_DC: - if (sc->hw_type == IWN_HW_REV_TYPE_5150 || - sc->hw_type == IWN_HW_REV_TYPE_6050) - idx = 0; + idx = IWN_CALIB_IDX_DC; break; case IWN5000_PHY_CALIB_LO: - idx = 1; + idx = IWN_CALIB_IDX_LO; break; case IWN5000_PHY_CALIB_TX_IQ: - idx = 2; + idx = IWN_CALIB_IDX_TX_IQ; break; case IWN5000_PHY_CALIB_TX_IQ_PERIODIC: - if (sc->hw_type < IWN_HW_REV_TYPE_6000 && - sc->hw_type != IWN_HW_REV_TYPE_5150) - idx = 3; + idx = IWN_CALIB_IDX_TX_IQ_PERIODIC; break; case IWN5000_PHY_CALIB_BASE_BAND: - idx = 4; + idx = IWN_CALIB_IDX_BASE_BAND; break; - } - if (idx == -1) /* Ignore other results. */ - return; - - /* Save calibration result. */ - if (sc->calibcmd[idx].buf != NULL) - free(sc->calibcmd[idx].buf, M_DEVBUF); - sc->calibcmd[idx].buf = malloc(len, M_DEVBUF, M_NOWAIT); - if (sc->calibcmd[idx].buf == NULL) { + default: DPRINTF(sc, IWN_DEBUG_CALIBRATE, - "not enough memory for calibration result %d\n", - calib->code); - return; + "%s: unknown calibration code=%d\n", __func__, calib->code); + return EINVAL; } - DPRINTF(sc, IWN_DEBUG_CALIBRATE, - "saving calibration result code=%d len=%d\n", calib->code, len); - sc->calibcmd[idx].len = len; - memcpy(sc->calibcmd[idx].buf, calib, len); + return iwn5000_save_calib_result(sc, calib, len, idx); +#undef FRAME_SIZE_MASK } static int @@ -5435,36 +5534,40 @@ iwn5000_post_alive(struct iwn_softc *sc) __func__, error); return error; } - if (sc->hw_type != IWN_HW_REV_TYPE_5150) { - struct iwn5000_phy_calib_crystal cmd; - /* Perform crystal calibration. */ - memset(&cmd, 0, sizeof cmd); - cmd.code = IWN5000_PHY_CALIB_CRYSTAL; - cmd.ngroups = 1; - cmd.isvalid = 1; - cmd.cap_pin[0] = le32toh(sc->eeprom_crystal) & 0xff; - cmd.cap_pin[1] = (le32toh(sc->eeprom_crystal) >> 16) & 0xff; - DPRINTF(sc, IWN_DEBUG_CALIBRATE, - "sending crystal calibration %d, %d\n", - cmd.cap_pin[0], cmd.cap_pin[1]); - error = iwn_cmd(sc, IWN_CMD_PHY_CALIB, &cmd, sizeof cmd, 0); + if (!(sc->sc_flags & IWN_FLAG_CALIB_DONE)) { + /* + * Start calibration by setting and sending the chrystal + * calibration first, this must be done before we are able + * to query the other calibration results. + */ + error = iwn5000_chrystal_calib(sc); if (error != 0) { device_printf(sc->sc_dev, - "%s: crystal calibration failed, error %d\n", - __func__, error); + "%s: could not set chrystal calibration, " + "error=%d\n", __func__, error); return error; } - } - if (!(sc->sc_flags & IWN_FLAG_CALIB_DONE)) { - /* Query calibration from the initialization firmware. */ - error = iwn5000_query_calibration(sc); + error = iwn5000_send_calib_results(sc); if (error != 0) { device_printf(sc->sc_dev, - "%s: could not query calibration, error %d\n", + "%s: could not send chrystal calibration, " + "error=%d\n", __func__, error); + return error; + } + + /* + * Query other calibration results from the initialization + * firmware. + */ + error = iwn5000_send_calib_query(sc); + if (error != 0) { + device_printf(sc->sc_dev, + "%s: could not query calibration, error=%d\n", __func__, error); return error; } + /* * We have the calibration results now, reboot with the * runtime firmware (call ourselves recursively!) @@ -5472,8 +5575,11 @@ iwn5000_post_alive(struct iwn_softc *sc) iwn_hw_stop(sc); error = iwn_hw_init(sc); } else { - /* Send calibration results to runtime firmware. */ - error = iwn5000_send_calibration(sc); + /* + * Send calibration results obtained from the initialization + * firmware to the runtime firmware. + */ + error = iwn5000_send_calib_results(sc); } return error; } Modified: head/sys/dev/iwn/if_iwnvar.h ============================================================================== --- head/sys/dev/iwn/if_iwnvar.h Sun Sep 19 12:39:04 2010 (r212853) +++ head/sys/dev/iwn/if_iwnvar.h Sun Sep 19 12:47:41 2010 (r212854) @@ -263,9 +263,23 @@ struct iwn_softc { int calib_cnt; struct iwn_calib_state calib; + u_int calib_init; +#define IWN_CALIB_XTAL (1 << IWN_CALIB_IDX_XTAL) +#define IWN_CALIB_DC (1 << IWN_CALIB_IDX_DC) +#define IWN_CALIB_LO (1 << IWN_CALIB_IDX_LO) +#define IWN_CALIB_TX_IQ (1 << IWN_CALIB_IDX_TX_IQ) +#define IWN_CALIB_TX_IQ_PERIODIC (1 << IWN_CALIB_IDX_TX_IQ_PERIODIC) +#define IWN_CALIB_BASE_BAND (1 << IWN_CALIB_IDX_BASE_BAND) +#define IWN_CALIB_NUM 6 + struct iwn_calib_info calib_results[IWN_CALIB_NUM]; +#define IWN_CALIB_IDX_XTAL 0 +#define IWN_CALIB_IDX_DC 1 +#define IWN_CALIB_IDX_LO 2 +#define IWN_CALIB_IDX_TX_IQ 3 +#define IWN_CALIB_IDX_TX_IQ_PERIODIC 4 +#define IWN_CALIB_IDX_BASE_BAND 5 struct iwn_fw_info fw; - struct iwn_calib_info calibcmd[5]; uint32_t errptr; struct iwn_rx_stat last_rx_stat; @@ -284,7 +298,6 @@ struct iwn_softc { uint16_t rfcfg; uint8_t calib_ver; char eeprom_domain[4]; - uint32_t eeprom_crystal; int16_t eeprom_voltage; int8_t maxpwr2GHz; int8_t maxpwr5GHz; From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 12:52:23 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C2F72106564A; Sun, 19 Sep 2010 12:52:23 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B24858FC12; Sun, 19 Sep 2010 12:52:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JCqN8F002335; Sun, 19 Sep 2010 12:52:23 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JCqNK6002333; Sun, 19 Sep 2010 12:52:23 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201009191252.o8JCqNK6002333@svn.freebsd.org> From: Bernhard Schmidt Date: Sun, 19 Sep 2010 12:52:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212855 - head/sys/dev/iwn X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 12:52:23 -0000 Author: bschmidt Date: Sun Sep 19 12:52:23 2010 New Revision: 212855 URL: http://svn.freebsd.org/changeset/base/212855 Log: Fix typo in previous commit. Modified: head/sys/dev/iwn/if_iwn.c Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Sun Sep 19 12:47:41 2010 (r212854) +++ head/sys/dev/iwn/if_iwn.c Sun Sep 19 12:52:23 2010 (r212855) @@ -5359,7 +5359,7 @@ iwn5000_rx_calib_result(struct iwn_softc bus_dmamap_sync(sc->rxq.data_dmat, data->map, BUS_DMASYNC_POSTREAD); len = (le32toh(desc->len) & FRAME_SIZE_MASK); - /* Remove length filed itself. */ + /* Remove length field itself. */ len -= 4; /* From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 12:54:18 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7D3CB1065670; Sun, 19 Sep 2010 12:54:18 +0000 (UTC) (envelope-from anchie@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6B9048FC15; Sun, 19 Sep 2010 12:54:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JCsInw002425; Sun, 19 Sep 2010 12:54:18 GMT (envelope-from anchie@svn.freebsd.org) Received: (from anchie@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JCsIlw002422; Sun, 19 Sep 2010 12:54:18 GMT (envelope-from anchie@svn.freebsd.org) Message-Id: <201009191254.o8JCsIlw002422@svn.freebsd.org> From: Ana Kukec Date: Sun, 19 Sep 2010 12:54:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212856 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 12:54:18 -0000 Author: anchie Date: Sun Sep 19 12:54:18 2010 New Revision: 212856 URL: http://svn.freebsd.org/changeset/base/212856 Log: Manual page for the kernel side Secure Neighbor Discovery support. Reviewed by: brueffer Approved by: bz (mentor) Added: head/share/man/man4/send.4 (contents, props changed) Modified: head/share/man/man4/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Sun Sep 19 12:52:23 2010 (r212855) +++ head/share/man/man4/Makefile Sun Sep 19 12:54:18 2010 (r212856) @@ -357,6 +357,7 @@ MAN= aac.4 \ sctp.4 \ sdhci.4 \ sem.4 \ + send.4 \ ses.4 \ sf.4 \ sge.4 \ Added: head/share/man/man4/send.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/send.4 Sun Sep 19 12:54:18 2010 (r212856) @@ -0,0 +1,218 @@ +.\"- +.\" Copyright (c) 2010 Ana Kukec +.\" 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 September 19, 2010 +.Dt SEND 4 +.Os +.Sh NAME +.Nm send +.Nd "Kernel side support for Secure Neighbor Discovery (SeND)" +.Sh SYNOPSIS +.In sys/socket.h +.In netinet/in.h +.In netinet6/send.h +.Ft int +.Fn socket PF_INET6 SOCK_RAW IPPROTO_SEND +.Pp +To enable +.Ns Nm +support, load the kernel side SeND as a module. +To load it at boot time, add the following line to +.Xr loader.conf 5 : +.Bd -literal -offset indent +send_load="YES" +.Ed +.Sh DESCRIPTION +IPv6 nodes use the Neighbor Discovery Protocol (NDP) to discover other nodes +on the link, to determine their link-layer addresses to find routers, and +to maintain reachability information about the paths to active members. +NDP is vulnerable to various attacks [RFC3756]. +Secure Neighbor Discovery is a set of extensions to NDP that counter threats +to NDP [RFC3971]. +.Pp +Kernel side support for SeND consists of a kernel module with hooks that +divert relevant packets (Neighbor Solicitations, Neighbor Advertisements, +Router Solicitations, Router Advertisements and Redirects) from the NDP stack, +send them to user space on a dedicated socket and reinject them back for +further processing. +Hooks are triggered only if the +.Nm +module is loaded. +.Pp +The native SeND socket is similar to a raw IP socket, but with its own, +internal pseudo-protocol (IPPROTO_SEND). +Struct sockaddr_send is defined in +.In netinet6/send.h . +It defines the total length of the structure, the address family, packet's +incoming or outgoing direction from the interface's point of view, and the +interface index. +.Pp +.Bd -literal +struct sockaddr_send { + unsigned char send_len; /* total length */ + sa_family_t send_family; /* address family */ + int send_direction; + int send_ifidx; + char send_zero[8]; +}; +.Ed +.Pp +The address family is always +.Va AF_INET6 . +The +.Va send_direction +variable denotes the direction of the packet from the interface's +point of view and has either the value +.Dv SND_IN +or +.Dv SND_OUT . +The +.Va send_ifidx +variable is the interface index of the receiving or sending interface. +The +.Va send_zero +variable is padding and must always be zero. +.Pp +In case that no user space application is connected to the send socket, +processing continues normally as if the module was not loaded. +.Sh INPUT HOOK +The input hook is named after the input path of the incoming or outgoing +NDP packets, on the way from the wire, through the nd6 stack, to user +space. +Relevant packets are identified by adding an mbuf_tag +(see +.Xr mbuf_tags 9 ) +to the +.Xr mbuf 9 , +if the +.Nm +module is loaded. +It is then passed on to the kernel-userland interface +for either cryptographic protection or validation by the SeND application. +The hook takes an argument that describes the direction of the packet, both +in case of incoming and outgoing packets. +.Dv SND_IN +is the direction of the incoming packets that are usually protected +by the SeND options and then sent to user space for cryptographic validation. +.Dv SND_OUT +is the outgoing direction. +It describes both reply and locally +originated outgoing packets that are sent to user space for the addition +of SeND options. +.Sh INCOMING PACKETS +The incoming ND packet from the wire: +.Bd -literal + kernelspace ( userspace + ) + incoming SeND/ND packet ( + | ) + v ( SND_IN ) ( + icmp6_input() -> send_input_hook ---> send socket ----+ + : ) | + : # # ( | + normal : # # ) v + processing : # send.ko # ( SeND application + path : # # ) | + : # # ( | + v ) | + icmp6/nd6_??_input() <- protocol switch <--- send socket <---+ + | structure (IPPPROTO_SEND) ) + | ( SND_IN ) ( + v ) + continue normal ND processing ( +.Ed +.Sh OUTGOING PACKETS +Outgoing ND packet (reply or locally triggered): +.Bd -literal + kernelspace ( userspace + ) + nd6_na_input() ( + +PACKET_TAG_ND_OUTGOING ) + | ) + | outgoing packet ( + | | ) + | v ( + | icmp6_redirect_output() ) + | nd6_ns_output() ( + | nd6_na_output() ) + | +PACKET_TAG_ND_OUTGOING ( + | | ) + | +-----------<- rip6_output() <----------)----- rtsol/rtadvd/.. + | | +PACKET_TAG_ND_OUTGOING ( + | v ) + | ip6_output() ( + | | ) + +-------->-+ ( + | ) + v ( SND_OUT ) ( + nd6_output_lle() -> send_input_hook ---> send socket ----+ + -PACKET_TAG_ND_OUTGOING ) | + : # # ( | + normal : # # ) v + processing : # send.ko # ( SeND application + path : # # ) | + : # # ( | + v ) | + (*ifp->if_output)() <- protocol switch <--- send socket <---+ + | structure (IPPPROTO_SEND) ) + | ( SND_OUT ) ( + v ) + continue with normal packet output ( +.Ed +.Sh ERRORS +A socket operation may fail with one of the following errors returned: +.Bl -tag -width Er +.It Bq Er EEXIST +Another user space SeND application is bound to the socket. +.It Bq Er ENOBUFS +Shortage of space to receive the incoming (SeND-protected) or outgoing +(SeND-validated) packet from the SeND application. +.It Bq Er ENOSYS +A packet received from user space and passed to the NDP stack for further +processing is neither Neighbor Solicitation, Neighbor Advertisement, +Router Solicitation, Router Advertisement nor Redirect. +.It Bq Er ENOENT +Occurs if interface output routines fail to send the packet out of the +interface. +.El +.Sh SEE ALSO +.Xr recvfrom 2 +.Xr sendto 2 +.Xr socket 2 +.Xr loader.conf 5 +.Sh HISTORY +The +.Nm +module first appeared in +.Fx 9.0 . +.Sh AUTHORS +.An Ana Kukec Aq anchie@FreeBSD.org , +University of Zagreb +.Sh BUGS +Due to the lack of NDP locking, it is currently not possible to unload the +.Nm +module. From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 13:42:05 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B88C3106566B; Sun, 19 Sep 2010 13:42:05 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 658C58FC08; Sun, 19 Sep 2010 13:42:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JDg5q2003471; Sun, 19 Sep 2010 13:42:05 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JDg5io003469; Sun, 19 Sep 2010 13:42:05 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009191342.o8JDg5io003469@svn.freebsd.org> From: Alexander Motin Date: Sun, 19 Sep 2010 13:42:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212857 - stable/7/sys/dev/hptmv X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 13:42:05 -0000 Author: mav Date: Sun Sep 19 13:42:05 2010 New Revision: 212857 URL: http://svn.freebsd.org/changeset/base/212857 Log: MFC r194900: Remove unused ATAPI definitions, conflicting with ata.h. Modified: stable/7/sys/dev/hptmv/atapi.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/hptmv/atapi.h ============================================================================== --- stable/7/sys/dev/hptmv/atapi.h Sun Sep 19 12:54:18 2010 (r212856) +++ stable/7/sys/dev/hptmv/atapi.h Sun Sep 19 13:42:05 2010 (r212857) @@ -180,200 +180,6 @@ typedef struct _IDE_REGISTERS_2 { #define MSNS_WRITE_PROTECT 0x40 #define MSNS_READ_PROTECT 0x80 -/*************************************************************************** - * ATAPI IO Register File - ***************************************************************************/ - -/* - * ATAPI register definition - */ - -typedef struct _ATAPI_REGISTERS_1 { - USHORT Data; - UCHAR InterruptReason; /* Atapi Phase Port */ - UCHAR Unused1; - UCHAR ByteCountLow; /* Byte Count LSB */ - UCHAR ByteCountHigh; /* Byte Count MSB */ - UCHAR DriveSelect; - UCHAR Command; -} ATAPI_REGISTERS_1, *PATAPI_REGISTERS_1; - -/* - * Atapi Error Status - */ -#define IDE_ERROR_END_OF_MEDIA IDE_ERROR_TRACK0_NOT_FOUND -#define IDE_ERROR_ILLEGAL_LENGTH IDE_ERROR_ADDRESS_NOT_FOUND - -/* - * ATAPI interrupt reasons - */ -#define ATAPI_IR_COD 0x01 -#define ATAPI_IR_IO 0x02 - -/* sense key */ -#define ATAPI_SENSE_NO_SENSE 0x00 -#define ATAPI_SENSE_RECOVERED_ERROR 0x01 -#define ATAPI_SENSE_NOT_READY 0x02 -#define ATAPI_SENSE_MEDIUM_ERROR 0x03 -#define ATAPI_SENSE_HARDWARE_ERROR 0x04 -#define ATAPI_SENSE_ILLEGAL_REQUEST 0x05 -#define ATAPI_SENSE_UNIT_ATTENTION 0x06 -#define ATAPI_SENSE_DATA_PROTECT 0x07 -#define ATAPI_SENSE_BLANK_CHECK 0x08 -#define ATAPI_SENSE_UNIQUE 0x09 -#define ATAPI_SENSE_COPY_ABORTED 0x0A -#define ATAPI_SENSE_ABORTED_COMMAND 0x0B -#define ATAPI_SENSE_EQUAL 0x0C -#define ATAPI_SENSE_VOL_OVERFLOW 0x0D -#define ATAPI_SENSE_MISCOMPARE 0x0E -#define ATAPI_SENSE_RESERVED 0x0F - -/* Additional Sense codes */ -#define ATAPI_ASC_NO_SENSE 0x00 -#define ATAPI_ASC_LUN_NOT_READY 0x04 -#define ATAPI_ASC_TRACK_ERROR 0x14 -#define ATAPI_ASC_SEEK_ERROR 0x15 -#define ATAPI_ASC_REC_DATA_NOECC 0x17 -#define ATAPI_ASC_REC_DATA_ECC 0x18 -#define ATAPI_ASC_ILLEGAL_COMMAND 0x20 -#define ATAPI_ASC_ILLEGAL_BLOCK 0x21 -#define ATAPI_ASC_INVALID_CDB 0x24 -#define ATAPI_ASC_INVALID_LUN 0x25 -#define ATAPI_ASC_PROTECT 0x27 -#define ATAPI_ASC_MEDIUM_CHANGED 0x28 -#define ATAPI_ASC_BUS_RESET 0x29 -#define ATAPI_ASC_NO_MEDIA_IN_DEVICE 0x3a -#define ATAPI_ASC_MUSIC_AREA 0xA0 -#define ATAPI_ASC_DATA_AREA 0xA1 -#define ATAPI_ASC_VOLUME_OVERFLOW 0xA7 - -/* - * IDE command definitions ( for ATAPI ) - */ - -#define IDE_COMMAND_ATAPI_RESET 0x08 /* Atapi Software Reset command */ -#define IDE_COMMAND_ATAPI_PACKET 0xA0 /* Atapi Identify command */ -#define IDE_COMMAND_ATAPI_IDENTIFY 0xA1 /* Atapi Packet Command */ - - -/* - * ATAPI command definitions - */ - -#define ATAPI_TEST_UNIT_READY 0x00 -#define ATAPI_REZERO_UNIT 0x01 -#define ATAPI_REQUEST_SENSE 0x03 -#define ATAPI_FORMAT_UNIT6 0x04 -#define ATAPI_FORMAT_UNIT 0x24 -#define ATAPI_INQUIRY 0x12 -#define ATAPI_MODE_SELECT 0x15 -#define ATAPI_RELEASE6 0x17 -#define ATAPI_MODE_SENSE 0x1A -#define ATAPI_START_STOP_UNIT 0x1B -#define ATAPI_LOAD_UNLOAD 0x1B -#define ATAPI_RECEIVE_DIAGNOSTIC 0x1C -#define ATAPI_SEND_DIAGNOSTIC 0x1D -#define ATAPI_MEDIUM_REMOVAL 0x1E -#define ATAPI_READ_FORMAT_CAPACITY 0x23 -#define ATAPI_READ_CAPACITY 0x25 -#define ATAPI_READ 0x28 -#define ATAPI_WRITE 0x2A -#define ATAPI_SEEK 0x2B -#define ATAPI_ERASE 0x2C -#define ATAPI_VERIFY 0x2F -#define ATAPI_WRITE_VERIFY 0x2E -#define ATAPI_SYNCHRONIZE_CACHE 0x35 -#define ATAPI_LOCK_CACHE 0x36 -#define ATAPI_COMPARE 0x39 -#define ATAPI_WRITE_BUFFER 0x3B -#define ATAPI_READ_DATA_BUFF 0x3C -#define ATAPI_READ_SUB_CHANNEL 0x42 -#define ATAPI_READ_TOC 0x43 -#define ATAPI_READ_HEADER 0x44 -#define ATAPI_PLAY_AUDIO10 0x45 -#define ATAPI_GET_CONFIGURATION 0x46 -#define ATAPI_PLAY_AUDIO_MSF 0x47 -#define ATAPI_GET_EVENT_STATUS_NOTIFICATION 0x4A -#define ATAPI_PAUSE_RESUME 0x4B -#define ATAPI_LOG_SELECT 0x4C -#define ATAPI_LOG_SENSE 0x4D -#define ATAPI_STOP_PLAY_SCAN 0x4E -#define ATAPI_READ_DISK_INFORMATION 0x51 -#define ATAPI_READ_TRACK_INFORMATION 0x52 -#define ATAPI_RESERVE_TRACK_RZONE 0x53 -#define ATAPI_SEND_OPC_INFORMATION 0x54 -#define ATAPI_MODE_SELECT10 0x55 -#define ATAPI_RELEASE10 0x57 -#define ATAPI_REPAIR_ZONE 0x58 -#define ATAPI_MODE_SENSE10 0x5A -#define ATAPI_CLOSE_TRACK_SESSION 0x5B -#define ATAPI_READ_BUFFER_CAPACITY 0x5C -#define ATAPI_SEND_CUE_SHEET 0x5D -#define ATAPI_BLANK_COMMAND 0xA1 /*Provide the ability to erase any part of a CD-RW disc.*/ -#define ATAPI_SEND_EVENT 0xA2 /* add for DVD */ -#define ATAPI_SEND_KEY 0xA3 /* add for DVD */ -#define ATAPI_REPORT_KEY 0xA4 -#define ATAPI_PLAY_AUDIO 0xA5 -#define ATAPI_LOAD_UNLOAD_MEDIUM 0xA6 -#define ATAPI_SET_READ_AHEAD 0xA7 -#define ATAPI_READ12 0xA8 -#define ATAPI_READ_DVD_STRUCTURE 0xAD -#define ATAPI_WRITE12 0xAA -#define ATAPI_GET_PERFORM_NOTIFICATION 0xAC /* add for DVD-RW */ -#define ATAPI_SET_STREAM 0xB6 /* add for DVD-RW */ -#define ATAPI_READ_CD_MSF 0xB9 -#define ATAPI_SCAN 0xBA -#define ATAPI_SET_SPEED 0xBB /* no payload */ -#define ATAPI_MECHANISM_STATUS 0xBD -#define ATAPI_READ_CD 0xBE -#define ATAPI_SEND_DVD_STRUCTURE 0xBF -#define ATAPI_SET_CDRW_SPEED 0xDA /*WindowsXP need*/ - -#define MODE_DSP_WRITE_PROTECT 0x80 - - -/*************************************************************************** - * ATAPI IO Register File - ***************************************************************************/ - - -typedef struct _ATAPI_REGISTERS_2 { - UCHAR AlternateStatus; -} ATAPI_REGISTERS_2, *PATAPI_REGISTERS_2; - - -/*************************************************************************** - * ATAPI packets - ***************************************************************************/ -typedef struct _ATAPI_SENSE_DATA { -#ifdef __BIG_ENDIAN_BITFIELD - UCHAR Valid:1; - UCHAR ErrorCode:7; - UCHAR SegmentNumber; - UCHAR FileMark:1; - UCHAR EndOfMedia:1; - UCHAR IncorrectLength:1; - UCHAR Reserved:1; - UCHAR SenseKey:4; -#else - UCHAR ErrorCode:7; - UCHAR Valid:1; - UCHAR SegmentNumber; - UCHAR SenseKey:4; - UCHAR Reserved:1; - UCHAR IncorrectLength:1; - UCHAR EndOfMedia:1; - UCHAR FileMark:1; -#endif - UCHAR Information[4]; - UCHAR AdditionalSenseLength; - UCHAR CommandSpecificInformation[4]; - UCHAR AdditionalSenseCode; - UCHAR AdditionalSenseCodeQualifier; - UCHAR FieldReplaceableUnitCode; - UCHAR SenseKeySpecific[3]; -} ATAPI_SENSE_DATA, *PATAPI_SENSE_DATA; - /* * IDENTIFY data */ @@ -580,6 +386,3 @@ typedef enum _DISK_MODE #pragma pack() #endif - - - From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 13:44:47 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 328E7106566B; Sun, 19 Sep 2010 13:44:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 215F18FC0C; Sun, 19 Sep 2010 13:44:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JDilEE003585; Sun, 19 Sep 2010 13:44:47 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JDilpg003583; Sun, 19 Sep 2010 13:44:47 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009191344.o8JDilpg003583@svn.freebsd.org> From: Alexander Motin Date: Sun, 19 Sep 2010 13:44:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212858 - stable/7/sys/dev/hptmv X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 13:44:47 -0000 Author: mav Date: Sun Sep 19 13:44:46 2010 New Revision: 212858 URL: http://svn.freebsd.org/changeset/base/212858 Log: MFC r209341: Report transport type in XPT_PATH_INQ. Modified: stable/7/sys/dev/hptmv/entry.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/hptmv/entry.c ============================================================================== --- stable/7/sys/dev/hptmv/entry.c Sun Sep 19 13:42:05 2010 (r212857) +++ stable/7/sys/dev/hptmv/entry.c Sun Sep 19 13:44:46 2010 (r212858) @@ -2420,6 +2420,10 @@ hpt_action(struct cam_sim *sim, union cc strncpy(cpi->hba_vid, "HPT ", HBA_IDLEN); strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); cpi->unit_number = cam_sim_unit(sim); + cpi->transport = XPORT_SPI; + cpi->transport_version = 2; + cpi->protocol = PROTO_SCSI; + cpi->protocol_version = SCSI_REV_2; cpi->ccb_h.status = CAM_REQ_CMP; xpt_done(ccb); break; From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 13:49:02 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 664A7106564A; Sun, 19 Sep 2010 13:49:02 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 529E68FC0A; Sun, 19 Sep 2010 13:49:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JDn2LS003774; Sun, 19 Sep 2010 13:49:02 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JDn2sq003772; Sun, 19 Sep 2010 13:49:02 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009191349.o8JDn2sq003772@svn.freebsd.org> From: Alexander Motin Date: Sun, 19 Sep 2010 13:49:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212859 - stable/7/sys/dev/hptiop X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 13:49:02 -0000 Author: mav Date: Sun Sep 19 13:49:02 2010 New Revision: 212859 URL: http://svn.freebsd.org/changeset/base/212859 Log: MFC r209340: Report transport type in XPT_PATH_INQ. Modified: stable/7/sys/dev/hptiop/hptiop.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/hptiop/hptiop.c ============================================================================== --- stable/7/sys/dev/hptiop/hptiop.c Sun Sep 19 13:44:46 2010 (r212858) +++ stable/7/sys/dev/hptiop/hptiop.c Sun Sep 19 13:49:02 2010 (r212859) @@ -1836,6 +1836,10 @@ scsi_done: strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); strncpy(cpi->hba_vid, "HPT ", HBA_IDLEN); strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); + cpi->transport = XPORT_SPI; + cpi->transport_version = 2; + cpi->protocol = PROTO_SCSI; + cpi->protocol_version = SCSI_REV_2; cpi->ccb_h.status = CAM_REQ_CMP; break; } From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 14:21:39 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 83632106566C; Sun, 19 Sep 2010 14:21:39 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 735F08FC08; Sun, 19 Sep 2010 14:21:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JELdTj004588; Sun, 19 Sep 2010 14:21:39 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JELdNY004586; Sun, 19 Sep 2010 14:21:39 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201009191421.o8JELdNY004586@svn.freebsd.org> From: Ed Schouten Date: Sun, 19 Sep 2010 14:21:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212860 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 14:21:39 -0000 Author: ed Date: Sun Sep 19 14:21:39 2010 New Revision: 212860 URL: http://svn.freebsd.org/changeset/base/212860 Log: Ignore DCD handling on /dev/console entirely. This makes /dev/console more fail-safe and prevents a potential console lock-up during boot. Discussed on: stable@ Tested by: koitsu@ MFC after: 1 week Modified: head/sys/kern/tty.c Modified: head/sys/kern/tty.c ============================================================================== --- head/sys/kern/tty.c Sun Sep 19 13:49:02 2010 (r212859) +++ head/sys/kern/tty.c Sun Sep 19 14:21:39 2010 (r212860) @@ -282,7 +282,8 @@ ttydev_open(struct cdev *dev, int oflags /* Wait for Carrier Detect. */ if (!TTY_CALLOUT(tp, dev) && (oflags & O_NONBLOCK) == 0 && - (tp->t_termios.c_cflag & CLOCAL) == 0) { + (tp->t_termios.c_cflag & CLOCAL) == 0 && + dev != dev_console) { while ((ttydevsw_modem(tp, 0, 0) & SER_DCD) == 0) { error = tty_wait(tp, &tp->t_dcdwait); if (error != 0) From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 14:30:51 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D28F21065670; Sun, 19 Sep 2010 14:30:51 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 448288FC1A; Sun, 19 Sep 2010 14:30:50 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id o8JEUl9g068047 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 19 Sep 2010 17:30:47 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id o8JEUl6I043750; Sun, 19 Sep 2010 17:30:47 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id o8JEUlAr043749; Sun, 19 Sep 2010 17:30:47 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 19 Sep 2010 17:30:47 +0300 From: Kostik Belousov To: Ed Schouten Message-ID: <20100919143047.GB2389@deviant.kiev.zoral.com.ua> References: <201009191421.o8JELdNY004586@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="BKMA2OjimIttCqMD" Content-Disposition: inline In-Reply-To: <201009191421.o8JELdNY004586@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_20, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212860 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 14:30:51 -0000 --BKMA2OjimIttCqMD Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Sep 19, 2010 at 02:21:39PM +0000, Ed Schouten wrote: > Author: ed > Date: Sun Sep 19 14:21:39 2010 > New Revision: 212860 > URL: http://svn.freebsd.org/changeset/base/212860 >=20 > Log: > Ignore DCD handling on /dev/console entirely. > =20 > This makes /dev/console more fail-safe and prevents a potential console > lock-up during boot. > =20 > Discussed on: stable@ > Tested by: koitsu@ > MFC after: 1 week >=20 > Modified: > head/sys/kern/tty.c >=20 > Modified: head/sys/kern/tty.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/tty.c Sun Sep 19 13:49:02 2010 (r212859) > +++ head/sys/kern/tty.c Sun Sep 19 14:21:39 2010 (r212860) > @@ -282,7 +282,8 @@ ttydev_open(struct cdev *dev, int oflags > =20 > /* Wait for Carrier Detect. */ > if (!TTY_CALLOUT(tp, dev) && (oflags & O_NONBLOCK) =3D=3D 0 && > - (tp->t_termios.c_cflag & CLOCAL) =3D=3D 0) { > + (tp->t_termios.c_cflag & CLOCAL) =3D=3D 0 && > + dev !=3D dev_console) { > while ((ttydevsw_modem(tp, 0, 0) & SER_DCD) =3D=3D 0) { > error =3D tty_wait(tp, &tp->t_dcdwait); > if (error !=3D 0) Shouldn't you always report CLOCAL for console then ? --BKMA2OjimIttCqMD Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkyWHpYACgkQC3+MBN1Mb4gzhQCg7k1qEYnTi0AHaBEysuKkvBzo xgEAnj21FwfS0AVskjI0/DY/5HntZmTu =zoAg -----END PGP SIGNATURE----- --BKMA2OjimIttCqMD-- From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 14:40:38 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4CBEE1065670; Sun, 19 Sep 2010 14:40:38 +0000 (UTC) (envelope-from nork@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 325BF8FC13; Sun, 19 Sep 2010 14:40:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JEecAf005009; Sun, 19 Sep 2010 14:40:38 GMT (envelope-from nork@svn.freebsd.org) Received: (from nork@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JEech5005004; Sun, 19 Sep 2010 14:40:38 GMT (envelope-from nork@svn.freebsd.org) Message-Id: <201009191440.o8JEech5005004@svn.freebsd.org> From: Norikatsu Shigemura Date: Sun, 19 Sep 2010 14:40:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212861 - in head/sys: amd64/conf boot/forth conf i386/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 14:40:38 -0000 Author: nork Date: Sun Sep 19 14:40:37 2010 New Revision: 212861 URL: http://svn.freebsd.org/changeset/base/212861 Log: Add support 'device tpm' for amd64. Add tpm(4)'s default setting to /boot/defaults/loader.conf. Add 'device tpm' to NOTES for amd64 and i386. Discussed with: takawata Approved by: imp (mentor) Modified: head/sys/amd64/conf/NOTES head/sys/boot/forth/loader.conf head/sys/conf/files.amd64 head/sys/i386/conf/NOTES Modified: head/sys/amd64/conf/NOTES ============================================================================== --- head/sys/amd64/conf/NOTES Sun Sep 19 14:21:39 2010 (r212860) +++ head/sys/amd64/conf/NOTES Sun Sep 19 14:40:37 2010 (r212861) @@ -421,6 +421,7 @@ options SAFE_RNDTEST # enable rndtest s # vpd: Vital Product Data kernel interface # asmc: Apple System Management Controller # si: Specialix International SI/XIO or SX intelligent serial card +# tpm: Trusted Platform Module # Notes on the Specialix SI/XIO driver: # The host card is memory, not IO mapped. @@ -436,6 +437,7 @@ device smbios device vpd device asmc #device si +device tpm # # Laptop/Notebook options: Modified: head/sys/boot/forth/loader.conf ============================================================================== --- head/sys/boot/forth/loader.conf Sun Sep 19 14:21:39 2010 (r212860) +++ head/sys/boot/forth/loader.conf Sun Sep 19 14:40:37 2010 (r212861) @@ -473,6 +473,7 @@ vkbd_load="NO" # Virtual AT keyboard i vpd_load="NO" # Vital Product Data kernel interface vpo_load="NO" # Parallel to SCSI interface driver amdtemp_load="NO" # AMD K8/K10/K11 temperature monitor +tpm_load="NO" # Trusted Platform Module ############################################################## ### ACPI settings ########################################## Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Sun Sep 19 14:21:39 2010 (r212860) +++ head/sys/conf/files.amd64 Sun Sep 19 14:40:37 2010 (r212861) @@ -229,6 +229,9 @@ dev/syscons/scterm-teken.c optional sc dev/syscons/scvesactl.c optional sc vga vesa dev/syscons/scvgarndr.c optional sc vga dev/syscons/scvtb.c optional sc +dev/tpm/tpm.c optional tpm +dev/tpm/tpm_acpi.c optional tpm acpi +dev/tpm/tpm_isa.c optional tpm isa dev/uart/uart_cpu_amd64.c optional uart dev/wpi/if_wpi.c optional wpi isa/syscons_isa.c optional sc Modified: head/sys/i386/conf/NOTES ============================================================================== --- head/sys/i386/conf/NOTES Sun Sep 19 14:21:39 2010 (r212860) +++ head/sys/i386/conf/NOTES Sun Sep 19 14:40:37 2010 (r212861) @@ -751,6 +751,7 @@ device glxsb # AMD Geode LX Security B # spic: Sony Programmable I/O controller (VAIO notebooks) # asmc: Apple System Management Controller # si: Specialix International SI/XIO or SX intelligent serial card driver +# tpm: Trusted Platform Module # Notes on APM # The flags takes the following meaning for apm0: @@ -789,6 +790,7 @@ hint.spic.0.at="isa" hint.spic.0.port="0x10a0" device asmc #device si +device tpm # # Laptop/Notebook options: From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 15:06:21 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A5B0A1065672; Sun, 19 Sep 2010 15:06:21 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 692AC8FC0A; Sun, 19 Sep 2010 15:06:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id o8JF0L6d045218; Sun, 19 Sep 2010 09:00:23 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Sun, 19 Sep 2010 09:00:28 -0600 (MDT) Message-Id: <20100919.090028.242248466057853766.imp@bsdimp.com> To: d@delphij.net, delphij@delphij.net From: "M. Warner Losh" In-Reply-To: <4C95EB21.1030304@delphij.net> References: <201009130144.o8D1i7jr045217@svn.freebsd.org> <4C95EB21.1030304@delphij.net> X-Mailer: Mew version 6.3 on Emacs 22.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212517 - head/lib/libz X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 15:06:21 -0000 In message: <4C95EB21.1030304@delphij.net> Xin LI writes: : -----BEGIN PGP SIGNED MESSAGE----- : Hash: SHA256 : : On 2010/09/12 18:44, Warner Losh wrote: : > Author: imp : > Date: Mon Sep 13 01:44:07 2010 : > New Revision: 212517 : > URL: http://svn.freebsd.org/changeset/base/212517 : > : > Log: : > Include FreeBSD svn tag : : The file was completely the same with libz vendor version now (except : your addition of $FreeBSD$ tag). Plus: : : [delphij@delta] /usr/src/lib/libz> svn pl minigzip.c : Properties on 'minigzip.c': : fbsd:nokeywords : : Or, do we require $FreeBSD$ tags for every files? Well, we usually do. However, this may have been a mistake on my part while cleaning up a tree before I deleted it. If the omission was intentional, then it was a mistake on my part, and should be backed out. Should I do the honors, or will that mess something else up? Warner From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 15:06:30 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1EC6B10657B0; Sun, 19 Sep 2010 15:06:30 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from mx0.hoeg.nl (unknown [IPv6:2a01:4f8:101:5343::aa]) by mx1.freebsd.org (Postfix) with ESMTP id A46258FC12; Sun, 19 Sep 2010 15:06:29 +0000 (UTC) Received: by mx0.hoeg.nl (Postfix, from userid 1000) id AAA042A28D28; Sun, 19 Sep 2010 17:06:28 +0200 (CEST) Date: Sun, 19 Sep 2010 17:06:28 +0200 From: Ed Schouten To: Kostik Belousov Message-ID: <20100919150628.GN56986@hoeg.nl> References: <201009191421.o8JELdNY004586@svn.freebsd.org> <20100919143047.GB2389@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="HPvEMLO7QB7Fh5r+" Content-Disposition: inline In-Reply-To: <20100919143047.GB2389@deviant.kiev.zoral.com.ua> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212860 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 15:06:30 -0000 --HPvEMLO7QB7Fh5r+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Kostik Belousov wrote: > Shouldn't you always report CLOCAL for console then ? Hmmm... That would be a lot more elegant, also for callout devices. The change I just committed, doesn't take a loss of SER_DCD into account after opening the device. Any comments on the following patch? %%% Index: sys/kern/tty.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/tty.c (revision 212860) +++ sys/kern/tty.c (working copy) @@ -263,12 +263,14 @@ =20 if (!tty_opened(tp)) { /* Set proper termios flags. */ - if (TTY_CALLOUT(tp, dev)) { + if (TTY_CALLOUT(tp, dev)) tp->t_termios =3D tp->t_termios_init_out; - } else { + else tp->t_termios =3D tp->t_termios_init_in; - } ttydevsw_param(tp, &tp->t_termios); + /* Prevent modem control on callout devices and /dev/console. */ + if (TTY_CALLOUT(tp, dev) || dev =3D=3D dev_console) + tp->t_termios.c_cflag |=3D CLOCAL; =20 ttydevsw_modem(tp, SER_DTR|SER_RTS, 0); =20 @@ -281,9 +283,8 @@ } =20 /* Wait for Carrier Detect. */ - if (!TTY_CALLOUT(tp, dev) && (oflags & O_NONBLOCK) =3D=3D 0 && - (tp->t_termios.c_cflag & CLOCAL) =3D=3D 0 && - dev !=3D dev_console) { + if ((oflags & O_NONBLOCK) =3D=3D 0 && + (tp->t_termios.c_cflag & CLOCAL) =3D=3D 0) { while ((ttydevsw_modem(tp, 0, 0) & SER_DCD) =3D=3D 0) { error =3D tty_wait(tp, &tp->t_dcdwait); if (error !=3D 0) %%% --=20 Ed Schouten WWW: http://80386.nl/ --HPvEMLO7QB7Fh5r+ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (FreeBSD) iEYEARECAAYFAkyWJvQACgkQ52SDGA2eCwVNxgCeOOk0PdC1GeNPwxLCmNsaXJoc 4ngAnijmnHSg0Aj3Yrvhi+BdkAVgffRq =hMVG -----END PGP SIGNATURE----- --HPvEMLO7QB7Fh5r+-- From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 15:36:40 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1451A106566B; Sun, 19 Sep 2010 15:36:40 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id A102E8FC1B; Sun, 19 Sep 2010 15:36:39 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id o8JFaOuZ072163 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 19 Sep 2010 18:36:24 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id o8JFaONx044060; Sun, 19 Sep 2010 18:36:24 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id o8JFaOGL044059; Sun, 19 Sep 2010 18:36:24 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 19 Sep 2010 18:36:24 +0300 From: Kostik Belousov To: Ed Schouten Message-ID: <20100919153624.GD2389@deviant.kiev.zoral.com.ua> References: <201009191421.o8JELdNY004586@svn.freebsd.org> <20100919143047.GB2389@deviant.kiev.zoral.com.ua> <20100919150628.GN56986@hoeg.nl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Rln2GmQ7CFmDhc9B" Content-Disposition: inline In-Reply-To: <20100919150628.GN56986@hoeg.nl> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-2.1 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_50, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212860 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 15:36:40 -0000 --Rln2GmQ7CFmDhc9B Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Sep 19, 2010 at 05:06:28PM +0200, Ed Schouten wrote: > * Kostik Belousov wrote: > > Shouldn't you always report CLOCAL for console then ? >=20 > Hmmm... That would be a lot more elegant, also for callout devices. The > change I just committed, doesn't take a loss of SER_DCD into account > after opening the device. >=20 > Any comments on the following patch? It looks very similar to what I proposed. Thanks. >=20 > %%% > Index: sys/kern/tty.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/tty.c (revision 212860) > +++ sys/kern/tty.c (working copy) > @@ -263,12 +263,14 @@ > =20 > if (!tty_opened(tp)) { > /* Set proper termios flags. */ > - if (TTY_CALLOUT(tp, dev)) { > + if (TTY_CALLOUT(tp, dev)) > tp->t_termios =3D tp->t_termios_init_out; > - } else { > + else > tp->t_termios =3D tp->t_termios_init_in; > - } > ttydevsw_param(tp, &tp->t_termios); > + /* Prevent modem control on callout devices and /dev/console. */ > + if (TTY_CALLOUT(tp, dev) || dev =3D=3D dev_console) > + tp->t_termios.c_cflag |=3D CLOCAL; > =20 > ttydevsw_modem(tp, SER_DTR|SER_RTS, 0); > =20 > @@ -281,9 +283,8 @@ > } > =20 > /* Wait for Carrier Detect. */ > - if (!TTY_CALLOUT(tp, dev) && (oflags & O_NONBLOCK) =3D=3D 0 && > - (tp->t_termios.c_cflag & CLOCAL) =3D=3D 0 && > - dev !=3D dev_console) { > + if ((oflags & O_NONBLOCK) =3D=3D 0 && > + (tp->t_termios.c_cflag & CLOCAL) =3D=3D 0) { > while ((ttydevsw_modem(tp, 0, 0) & SER_DCD) =3D=3D 0) { > error =3D tty_wait(tp, &tp->t_dcdwait); > if (error !=3D 0) > %%% >=20 > --=20 > Ed Schouten > WWW: http://80386.nl/ --Rln2GmQ7CFmDhc9B Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkyWLfcACgkQC3+MBN1Mb4i0nwCeP+3QoGQfJ+PaCcY7vm64OVft pGcAnjXKaxDGDazl3bmpPSTyVeQxOwN5 =TpEh -----END PGP SIGNATURE----- --Rln2GmQ7CFmDhc9B-- From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 16:06:32 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 84BA81065673; Sun, 19 Sep 2010 16:06:32 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 73CCD8FC0C; Sun, 19 Sep 2010 16:06:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JG6Wep007536; Sun, 19 Sep 2010 16:06:32 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JG6WOV007534; Sun, 19 Sep 2010 16:06:32 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201009191606.o8JG6WOV007534@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 19 Sep 2010 16:06:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212864 - stable/8/bin/sh X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 16:06:32 -0000 Author: jilles Date: Sun Sep 19 16:06:32 2010 New Revision: 212864 URL: http://svn.freebsd.org/changeset/base/212864 Log: MFC r212417: sh(1): Remove xrefs for expr(1) and getopt(1). expr(1) should usually not be used as various forms of parameter expansion and arithmetic expansion replicate most of its functionality in an easier way. getopt(1) should not be used at all in new code. Instead, getopts(1) or entirely manual parsing should be used. Modified: stable/8/bin/sh/sh.1 Directory Properties: stable/8/bin/sh/ (props changed) Modified: stable/8/bin/sh/sh.1 ============================================================================== --- stable/8/bin/sh/sh.1 Sun Sep 19 15:20:52 2010 (r212863) +++ stable/8/bin/sh/sh.1 Sun Sep 19 16:06:32 2010 (r212864) @@ -32,7 +32,7 @@ .\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95 .\" $FreeBSD$ .\" -.Dd January 8, 2010 +.Dd September 10, 2010 .Dt SH 1 .Os .Sh NAME @@ -2369,8 +2369,6 @@ will return the argument. .Xr echo 1 , .Xr ed 1 , .Xr emacs 1 , -.Xr expr 1 , -.Xr getopt 1 , .Xr pwd 1 , .Xr test 1 , .Xr vi 1 , From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 16:13:48 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1D026106566C; Sun, 19 Sep 2010 16:13:48 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0C3468FC15; Sun, 19 Sep 2010 16:13:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JGDlh9007735; Sun, 19 Sep 2010 16:13:47 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JGDlWZ007733; Sun, 19 Sep 2010 16:13:47 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201009191613.o8JGDlWZ007733@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 19 Sep 2010 16:13:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212865 - stable/8/bin/test X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 16:13:48 -0000 Author: jilles Date: Sun Sep 19 16:13:47 2010 New Revision: 212865 URL: http://svn.freebsd.org/changeset/base/212865 Log: MFC r212418: test(1): Clarify grammar ambiguity and -a/-o vs shell &&/||. Modified: stable/8/bin/test/test.1 Directory Properties: stable/8/bin/test/ (props changed) Modified: stable/8/bin/test/test.1 ============================================================================== --- stable/8/bin/test/test.1 Sun Sep 19 16:06:32 2010 (r212864) +++ stable/8/bin/test/test.1 Sun Sep 19 16:13:47 2010 (r212865) @@ -32,7 +32,7 @@ .\" @(#)test.1 8.1 (Berkeley) 5/31/93 .\" $FreeBSD$ .\" -.Dd July 31, 2006 +.Dd September 10, 2010 .Dt TEST 1 .Os .Sh NAME @@ -310,6 +310,14 @@ are evaluated consistently according to standards document. All other cases are subject to the ambiguity in the command semantics. +.Pp +In particular, only expressions containing +.Fl a , +.Fl o , +.Cm \&( +or +.Cm \&) +can be ambiguous. .Sh EXIT STATUS The .Nm @@ -338,12 +346,11 @@ specification. Both sides are always evaluated in .Fl a and -.Fl o , -unlike in the logical operators of -.Xr sh 1 . +.Fl o . For instance, the writable status of .Pa file will be tested by the following command even though the former expression indicated false, which results in a gratuitous access to the file system: -.Pp .Dl "[ -z abc -a -w file ]" +To avoid this, write +.Dl "[ -z abc ] && [ -w file ]" From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 16:15:43 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 373A1106564A; Sun, 19 Sep 2010 16:15:43 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 266E18FC17; Sun, 19 Sep 2010 16:15:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JGFhtj007831; Sun, 19 Sep 2010 16:15:43 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JGFhD8007829; Sun, 19 Sep 2010 16:15:43 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201009191615.o8JGFhD8007829@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 19 Sep 2010 16:15:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212866 - stable/8/bin/test X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 16:15:43 -0000 Author: jilles Date: Sun Sep 19 16:15:42 2010 New Revision: 212866 URL: http://svn.freebsd.org/changeset/base/212866 Log: MFC r212419: test(1): Fix markup, ( and ) must be separate arguments so leave spaces. Modified: stable/8/bin/test/test.1 Directory Properties: stable/8/bin/test/ (props changed) Modified: stable/8/bin/test/test.1 ============================================================================== --- stable/8/bin/test/test.1 Sun Sep 19 16:13:47 2010 (r212865) +++ stable/8/bin/test/test.1 Sun Sep 19 16:15:42 2010 (r212866) @@ -282,7 +282,7 @@ True if either or .Ar expression2 are true. -.It Cm \&( Ns Ar expression Ns Cm \&) +.It Cm \&( Ar expression Cm \&) True if expression is true. .El .Pp From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 16:35:42 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E3E64106566B; Sun, 19 Sep 2010 16:35:42 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D3DA08FC0A; Sun, 19 Sep 2010 16:35:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JGZgV1008284; Sun, 19 Sep 2010 16:35:42 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JGZgF3008282; Sun, 19 Sep 2010 16:35:42 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201009191635.o8JGZgF3008282@svn.freebsd.org> From: Ed Schouten Date: Sun, 19 Sep 2010 16:35:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212867 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 16:35:43 -0000 Author: ed Date: Sun Sep 19 16:35:42 2010 New Revision: 212867 URL: http://svn.freebsd.org/changeset/base/212867 Log: Just make callout devices and /dev/console force CLOCAL on open(). Instead of adding custom checks to wait for DCD on open(), just modify the termios structure to set CLOCAL. This means SIGHUP is no longer generated when losing DCD as well. Reviewed by: kib@ MFC after: 1 week Modified: head/sys/kern/tty.c Modified: head/sys/kern/tty.c ============================================================================== --- head/sys/kern/tty.c Sun Sep 19 16:15:42 2010 (r212866) +++ head/sys/kern/tty.c Sun Sep 19 16:35:42 2010 (r212867) @@ -263,12 +263,14 @@ ttydev_open(struct cdev *dev, int oflags if (!tty_opened(tp)) { /* Set proper termios flags. */ - if (TTY_CALLOUT(tp, dev)) { + if (TTY_CALLOUT(tp, dev)) tp->t_termios = tp->t_termios_init_out; - } else { + else tp->t_termios = tp->t_termios_init_in; - } ttydevsw_param(tp, &tp->t_termios); + /* Prevent modem control on callout devices and /dev/console. */ + if (TTY_CALLOUT(tp, dev) || dev == dev_console) + tp->t_termios.c_cflag |= CLOCAL; ttydevsw_modem(tp, SER_DTR|SER_RTS, 0); @@ -281,9 +283,8 @@ ttydev_open(struct cdev *dev, int oflags } /* Wait for Carrier Detect. */ - if (!TTY_CALLOUT(tp, dev) && (oflags & O_NONBLOCK) == 0 && - (tp->t_termios.c_cflag & CLOCAL) == 0 && - dev != dev_console) { + if ((oflags & O_NONBLOCK) == 0 && + (tp->t_termios.c_cflag & CLOCAL) == 0) { while ((ttydevsw_modem(tp, 0, 0) & SER_DCD) == 0) { error = tty_wait(tp, &tp->t_dcdwait); if (error != 0) From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 17:43:22 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9A6FB1065675; Sun, 19 Sep 2010 17:43:22 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 89C718FC26; Sun, 19 Sep 2010 17:43:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JHhM6P009892; Sun, 19 Sep 2010 17:43:22 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JHhMpT009889; Sun, 19 Sep 2010 17:43:22 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201009191743.o8JHhMpT009889@svn.freebsd.org> From: Alan Cox Date: Sun, 19 Sep 2010 17:43:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212868 - head/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 17:43:22 -0000 Author: alc Date: Sun Sep 19 17:43:22 2010 New Revision: 212868 URL: http://svn.freebsd.org/changeset/base/212868 Log: Make refinements to r212824. In particular, don't make vm_map_unlock_nodefer() part of the synchronization interface for maps. Add comments to vm_map_unlock_and_wait() and vm_map_wakeup() describing how they should be used. In particular, describe the deferred deallocations issue with vm_map_unlock_and_wait(). Redo the implementation of vm_map_unlock_and_wait() so that it passes along the caller's file and line information, just like the other map locking primitives. Reviewed by: kib X-MFC after: r212824 Modified: head/sys/vm/vm_map.c head/sys/vm/vm_map.h Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Sun Sep 19 16:35:42 2010 (r212867) +++ head/sys/vm/vm_map.c Sun Sep 19 17:43:22 2010 (r212868) @@ -470,16 +470,6 @@ vm_map_process_deferred(void) } void -_vm_map_unlock_nodefer(vm_map_t map, const char *file, int line) -{ - - if (map->system_map) - _mtx_unlock_flags(&map->system_mtx, 0, file, line); - else - _sx_xunlock(&map->lock, file, line); -} - -void _vm_map_unlock(vm_map_t map, const char *file, int line) { @@ -637,19 +627,37 @@ _vm_map_assert_locked_read(vm_map_t map, #endif /* - * vm_map_unlock_and_wait: + * _vm_map_unlock_and_wait: + * + * Atomically releases the lock on the specified map and puts the calling + * thread to sleep. The calling thread will remain asleep until either + * vm_map_wakeup() is performed on the map or the specified timeout is + * exceeded. + * + * WARNING! This function does not perform deferred deallocations of + * objects and map entries. Therefore, the calling thread is expected to + * reacquire the map lock after reawakening and later perform an ordinary + * unlock operation, such as vm_map_unlock(), before completing its + * operation on the map. */ int -vm_map_unlock_and_wait(vm_map_t map, int timo) +_vm_map_unlock_and_wait(vm_map_t map, int timo, const char *file, int line) { mtx_lock(&map_sleep_mtx); - vm_map_unlock_nodefer(map); - return (msleep(&map->root, &map_sleep_mtx, PDROP | PVM, "vmmaps", timo)); + if (map->system_map) + _mtx_unlock_flags(&map->system_mtx, 0, file, line); + else + _sx_xunlock(&map->lock, file, line); + return (msleep(&map->root, &map_sleep_mtx, PDROP | PVM, "vmmaps", + timo)); } /* * vm_map_wakeup: + * + * Awaken any threads that have slept on the map using + * vm_map_unlock_and_wait(). */ void vm_map_wakeup(vm_map_t map) @@ -657,8 +665,8 @@ vm_map_wakeup(vm_map_t map) /* * Acquire and release map_sleep_mtx to prevent a wakeup() - * from being performed (and lost) between the vm_map_unlock() - * and the msleep() in vm_map_unlock_and_wait(). + * from being performed (and lost) between the map unlock + * and the msleep() in _vm_map_unlock_and_wait(). */ mtx_lock(&map_sleep_mtx); mtx_unlock(&map_sleep_mtx); Modified: head/sys/vm/vm_map.h ============================================================================== --- head/sys/vm/vm_map.h Sun Sep 19 16:35:42 2010 (r212867) +++ head/sys/vm/vm_map.h Sun Sep 19 17:43:22 2010 (r212868) @@ -266,7 +266,7 @@ vmspace_pmap(struct vmspace *vmspace) void _vm_map_lock(vm_map_t map, const char *file, int line); void _vm_map_unlock(vm_map_t map, const char *file, int line); -void _vm_map_unlock_nodefer(vm_map_t map, const char *file, int line); +int _vm_map_unlock_and_wait(vm_map_t map, int timo, const char *file, int line); void _vm_map_lock_read(vm_map_t map, const char *file, int line); void _vm_map_unlock_read(vm_map_t map, const char *file, int line); int _vm_map_trylock(vm_map_t map, const char *file, int line); @@ -274,13 +274,12 @@ int _vm_map_trylock_read(vm_map_t map, c int _vm_map_lock_upgrade(vm_map_t map, const char *file, int line); void _vm_map_lock_downgrade(vm_map_t map, const char *file, int line); int vm_map_locked(vm_map_t map); -int vm_map_unlock_and_wait(vm_map_t map, int timo); void vm_map_wakeup(vm_map_t map); #define vm_map_lock(map) _vm_map_lock(map, LOCK_FILE, LOCK_LINE) #define vm_map_unlock(map) _vm_map_unlock(map, LOCK_FILE, LOCK_LINE) -#define vm_map_unlock_nodefer(map) \ - _vm_map_unlock_nodefer(map, LOCK_FILE, LOCK_LINE) +#define vm_map_unlock_and_wait(map, timo) \ + _vm_map_unlock_and_wait(map, timo, LOCK_FILE, LOCK_LINE) #define vm_map_lock_read(map) _vm_map_lock_read(map, LOCK_FILE, LOCK_LINE) #define vm_map_unlock_read(map) _vm_map_unlock_read(map, LOCK_FILE, LOCK_LINE) #define vm_map_trylock(map) _vm_map_trylock(map, LOCK_FILE, LOCK_LINE) From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 18:21:59 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CD7791065675; Sun, 19 Sep 2010 18:21:59 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail08.syd.optusnet.com.au (mail08.syd.optusnet.com.au [211.29.132.189]) by mx1.freebsd.org (Postfix) with ESMTP id 4F57B8FC1C; Sun, 19 Sep 2010 18:21:58 +0000 (UTC) Received: from c122-107-116-249.carlnfd1.nsw.optusnet.com.au (c122-107-116-249.carlnfd1.nsw.optusnet.com.au [122.107.116.249]) by mail08.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o8JILVel016446 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 20 Sep 2010 04:21:42 +1000 Date: Mon, 20 Sep 2010 04:21:31 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Ed Schouten In-Reply-To: <20100919150628.GN56986@hoeg.nl> Message-ID: <20100920021713.Y950@delplex.bde.org> References: <201009191421.o8JELdNY004586@svn.freebsd.org> <20100919143047.GB2389@deviant.kiev.zoral.com.ua> <20100919150628.GN56986@hoeg.nl> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Kostik Belousov , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212860 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 18:21:59 -0000 On Sun, 19 Sep 2010, Ed Schouten wrote: > * Kostik Belousov wrote: >> Shouldn't you always report CLOCAL for console then ? > > Hmmm... That would be a lot more elegant, also for callout devices. The > change I just committed, doesn't take a loss of SER_DCD into account > after opening the device. This should be handled like it was by non-broken serial device drivers: - CLOCAL defaults to on for the console only - CLOCAL is also locked on for the console only - otherwise, CLOCAL is not specially handled. If the user wants to default and lock it differently, then he changes these defaults in the initial and lock state devices - locking the speed for the console only is even more important - locking of other termios state (parity and stop bits...) is also important, but has never been done by default AFAIK. This can be fixed by programming the lock state device at boot time using rc.d/serial or directly, but this is unobvious and painful. > Any comments on the following patch? > > %%% > Index: sys/kern/tty.c > =================================================================== > --- sys/kern/tty.c (revision 212860) > +++ sys/kern/tty.c (working copy) > @@ -263,12 +263,14 @@ > > if (!tty_opened(tp)) { > /* Set proper termios flags. */ > - if (TTY_CALLOUT(tp, dev)) { > + if (TTY_CALLOUT(tp, dev)) > tp->t_termios = tp->t_termios_init_out; > - } else { > + else > tp->t_termios = tp->t_termios_init_in; > - } > ttydevsw_param(tp, &tp->t_termios); > + /* Prevent modem control on callout devices and /dev/console. */ > + if (TTY_CALLOUT(tp, dev) || dev == dev_console) > + tp->t_termios.c_cflag |= CLOCAL; This seems to just break the user's defaults set in the initial state devices. The uart driver even refuses to honor the users changes of CLOCAL, HUPCL and the speed for consoles at tcsetattr() time. Normally it is a mistake for the user to change these, but if he has reprogrammed the lock state device so that changes are possible, then the changes should be honored. Not honoring the changes in the driver is equivalent to having a lock on parts of the lock device, with bugs in reads of the locked device (parts of it that are effectively locked can be changed, but such changes don't work). CLOCAL doesn't seem to be set in the lock device anywhere, but it is set for the initial state device for consoles. This is enough for open() (since changing it in the initial state device should require the same privilege as changing it in the lock device. But users should be especially careful in changing it for the console, since for the console its setting should start as locked on, and this locking becomes negatively useful if the initial state is changed to off so that the full setting becomes locked off). Defaulting to CLOCAL for the callout device is wrong. Callout devices should only ignore carrier in open(). Then open() normally succeeds without carrier, and any off-to-on transition of carrier has little effect. But on-to-off transitions of carrier should be handled, according to the user's setting of CLOCAL, and this setting should not normally be locked (unlike in the callin case where locking it may be good). If the device is actually local, then hanging up is not very useful, but callout devices aren't really needed for that case either (I use them out of habit, but almost the same behaviour can be obtained using callin devices with CLOCAL set in their initial state and unset after open()). > > ttydevsw_modem(tp, SER_DTR|SER_RTS, 0); > > @@ -281,9 +283,8 @@ > } > > /* Wait for Carrier Detect. */ > - if (!TTY_CALLOUT(tp, dev) && (oflags & O_NONBLOCK) == 0 && > - (tp->t_termios.c_cflag & CLOCAL) == 0 && > - dev != dev_console) { > + if ((oflags & O_NONBLOCK) == 0 && > + (tp->t_termios.c_cflag & CLOCAL) == 0) { > while ((ttydevsw_modem(tp, 0, 0) & SER_DCD) == 0) { > error = tty_wait(tp, &tp->t_dcdwait); > if (error != 0) > %%% It has always intentionally not been done like this, so that CLOCAL works normally for callout devices except for open. CLOCAL is in effect forced to be temporarily ignored during open. This is called "SOFT_CARRIER" in the sio driver: from a lost comment: % /* % * Handle initial DCD. Callout devices get a fake initial % * DCD (trapdoor DCD). If we are callout, then any sleeping % * callin opens get woken up and resume sleeping on "siobi" % * instead of "siodcd". % */ % /* % * XXX `mynor & CALLOUT_MASK' should be % * `tp->t_cflag & (SOFT_CARRIER | TRAPDOOR_CARRIER) where % * TRAPDOOR_CARRIER is the default initial state for callout % * devices and SOFT_CARRIER is like CLOCAL except it hides % * the true carrier. % */ I never got around to de-magicing this by putting SOFT_CARRIER in t_cflag and somehow making the callout'ness more programmable using TRAPDOOR_CARRIER. Most systems never needed both the callin and callout devices, and it would have been nice to able to create a callout device on demand for occasional use (no devfs please, but without creating a new device it is hard to find a context for the existing callin device users (blocked in open) to sleep in). Now, even fewer systems need both. Linux axed callout devices about 15 years ago. Serial modem connections were still useful then, so I think this mainly moved the complications to userland where they are larger. Other termios flags defaults lossage: >From the detached sio driver: % /* % * We don't use all the flags from since they % * are only relevant for logins. It's important to have echo off % * initially so that the line doesn't start blathering before the % * echo flag can be turned off. % */ % com->it_in.c_iflag = 0; % com->it_in.c_oflag = 0; % com->it_in.c_cflag = TTYDEF_CFLAG; % com->it_in.c_lflag = 0; (We should actually use the "raw" flags, which aren't quite all 0's -- see cfmakeraw().) >From -current: % static void % tty_init_termios(struct tty *tp) % { % struct termios *t = &tp->t_termios_init_in; % % t->c_cflag = TTYDEF_CFLAG; % t->c_iflag = TTYDEF_IFLAG; % t->c_lflag = TTYDEF_LFLAG; % t->c_oflag = TTYDEF_OFLAG; Even the comment saying why these defaults are unusable in the kernel has been detached. An intermediate stage lost the comment but avoided the problem with echos by using TTYDEF_LFLAG for consoles only and TTYDEF_LFLAG_NOECHO otherwise. Now, TTYDEF_LFLAG_NOECHO is still defined, but is no longer used. Bad defaults for all the flags can be fixed by reprogramming at boot time, except possibly if an echo war makes the system unbootable, but this is just as painful as for the missing console lock device initialization. I have many sloppy test scripts that depend on the default state being raw. Bruce From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 18:55:48 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6135410656C1; Sun, 19 Sep 2010 18:55:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 349C98FC15; Sun, 19 Sep 2010 18:55:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JItmW4011710; Sun, 19 Sep 2010 18:55:48 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JItm37011709; Sun, 19 Sep 2010 18:55:48 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009191855.o8JItm37011709@svn.freebsd.org> From: Alexander Motin Date: Sun, 19 Sep 2010 18:55:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212869 - in stable/7: sbin/atacontrol sys sys/cddl/contrib/opensolaris sys/contrib/dev/acpica sys/contrib/pf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 18:55:48 -0000 Author: mav Date: Sun Sep 19 18:55:47 2010 New Revision: 212869 URL: http://svn.freebsd.org/changeset/base/212869 Log: Mark r172606, r174682, r177298 as merged. Modified: Directory Properties: stable/7/sbin/atacontrol/ (props changed) stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 19:02:14 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 86A85106566B; Sun, 19 Sep 2010 19:02:14 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 754FC8FC0C; Sun, 19 Sep 2010 19:02:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JJ2EhZ011936; Sun, 19 Sep 2010 19:02:14 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JJ2EfA011934; Sun, 19 Sep 2010 19:02:14 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009191902.o8JJ2EfA011934@svn.freebsd.org> From: Alexander Motin Date: Sun, 19 Sep 2010 19:02:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212870 - stable/7/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:02:14 -0000 Author: mav Date: Sun Sep 19 19:02:14 2010 New Revision: 212870 URL: http://svn.freebsd.org/changeset/base/212870 Log: MFC r194902, r197540, r198587, r198865: Define some ATA IDENTIFY fields and bits. Modified: stable/7/sys/sys/ata.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/sys/ata.h ============================================================================== --- stable/7/sys/sys/ata.h Sun Sep 19 18:55:47 2010 (r212869) +++ stable/7/sys/sys/ata.h Sun Sep 19 19:02:14 2010 (r212870) @@ -67,6 +67,8 @@ struct ata_params { /*049*/ u_int16_t capabilities1; #define ATA_SUPPORT_DMA 0x0100 #define ATA_SUPPORT_LBA 0x0200 +#define ATA_SUPPORT_IORDY 0x0400 +#define ATA_SUPPORT_IORDYDIS 0x0800 #define ATA_SUPPORT_OVERLAP 0x4000 /*050*/ u_int16_t capabilities2; @@ -108,19 +110,31 @@ struct ata_params { /*075*/ u_int16_t queue; #define ATA_QUEUE_LEN(x) ((x) & 0x001f) - u_int16_t satacapabilities; +/*76*/ u_int16_t satacapabilities; #define ATA_SATA_GEN1 0x0002 #define ATA_SATA_GEN2 0x0004 +#define ATA_SATA_GEN3 0x0008 #define ATA_SUPPORT_NCQ 0x0100 #define ATA_SUPPORT_IFPWRMNGTRCV 0x0200 - - u_int16_t reserved77; - u_int16_t satasupport; +#define ATA_SUPPORT_PHYEVENTCNT 0x0400 +#define ATA_SUPPORT_NCQ_UNLOAD 0x0800 +#define ATA_SUPPORT_NCQ_PRIO 0x1000 +#define ATA_SUPPORT_HAPST 0x2000 +#define ATA_SUPPORT_DAPST 0x4000 +#define ATA_SUPPORT_READLOGDMAEXT 0x8000 + +/*77*/ u_int16_t satacapabilities2; +#define ATA_SATA_CURR_GEN_MASK 0x0006 +#define ATA_SUPPORT_NCQ_STREAM 0x0010 +#define ATA_SUPPORT_NCQ_QMANAGEMENT 0x0020 +/*78*/ u_int16_t satasupport; #define ATA_SUPPORT_NONZERO 0x0002 #define ATA_SUPPORT_AUTOACTIVATE 0x0004 #define ATA_SUPPORT_IFPWRMNGT 0x0008 #define ATA_SUPPORT_INORDERDATA 0x0010 - u_int16_t sataenabled; +#define ATA_SUPPORT_SOFTSETPRESERVE 0x0040 +/*79*/ u_int16_t sataenabled; +#define ATA_ENABLED_DAPST 0x0080 /*080*/ u_int16_t version_major; /*081*/ u_int16_t version_minor; @@ -158,8 +172,8 @@ struct ata_params { #define ATA_SUPPORT_FLUSHCACHE48 0x2000 /*084/087*/ u_int16_t extension; -#define ATA_SUPPORT_SMARTTEST 0x0001 -#define ATA_SUPPORT_SMARTLOG 0x0002 +#define ATA_SUPPORT_SMARTLOG 0x0001 +#define ATA_SUPPORT_SMARTTEST 0x0002 #define ATA_SUPPORT_MEDIASN 0x0004 #define ATA_SUPPORT_MEDIAPASS 0x0008 #define ATA_SUPPORT_STREAMING 0x0010 @@ -167,6 +181,7 @@ struct ata_params { #define ATA_SUPPORT_WRITEDMAFUAEXT 0x0040 #define ATA_SUPPORT_WRITEDMAQFUAEXT 0x0080 #define ATA_SUPPORT_64BITWWN 0x0100 +#define ATA_SUPPORT_UNLOAD 0x2000 } __packed support, enabled; /*088*/ u_int16_t udmamodes; /* UltraDMA modes */ @@ -189,14 +204,52 @@ struct ata_params { u_int16_t lba_size48_2; u_int16_t lba_size48_3; u_int16_t lba_size48_4; - u_int16_t reserved104[23]; + u_int16_t reserved104[2]; +/*106*/ u_int16_t pss; +#define ATA_PSS_LSPPS 0x000F +#define ATA_PSS_LSSABOVE512 0x1000 +#define ATA_PSS_MULTLS 0x2000 +/*107*/ u_int16_t isd; +/*108*/ u_int16_t wwn[4]; + u_int16_t reserved112[5]; +/*117*/ u_int16_t lss_1; +/*118*/ u_int16_t lss_2; +/*119*/ u_int16_t support2; +#define ATA_SUPPORT_WRITEREADVERIFY 0x0002 +#define ATA_SUPPORT_WRITEUNCORREXT 0x0004 +#define ATA_SUPPORT_RWLOGDMAEXT 0x0008 +#define ATA_SUPPORT_MICROCODE3 0x0010 +#define ATA_SUPPORT_FREEFALL 0x0020 +/*120*/ u_int16_t enabled2; + u_int16_t reserved121[6]; /*127*/ u_int16_t removable_status; /*128*/ u_int16_t security_status; u_int16_t reserved129[31]; /*160*/ u_int16_t cfa_powermode1; - u_int16_t reserved161[15]; -/*176*/ u_int16_t media_serial[30]; - u_int16_t reserved206[49]; + u_int16_t reserved161; +/*162*/ u_int16_t cfa_kms_support; +/*163*/ u_int16_t cfa_trueide_modes; +/*164*/ u_int16_t cfa_memory_modes; + u_int16_t reserved165[11]; +/*176*/ u_int8_t media_serial[60]; +/*206*/ u_int16_t sct; + u_int16_t reserved206[2]; +/*209*/ u_int16_t lbalign; +/*210*/ u_int16_t wrv_sectors_m3_1; + u_int16_t wrv_sectors_m3_2; +/*212*/ u_int16_t wrv_sectors_m2_1; + u_int16_t wrv_sectors_m2_2; +/*214*/ u_int16_t nv_cache_caps; +/*215*/ u_int16_t nv_cache_size_1; + u_int16_t nv_cache_size_2; +/*217*/ u_int16_t media_rotation_rate; + u_int16_t reserved218; +/*219*/ u_int16_t nv_cache_opt; +/*220*/ u_int16_t wrv_mode; + u_int16_t reserved221; +/*222*/ u_int16_t transport_major; +/*223*/ u_int16_t transport_minor; + u_int16_t reserved224[31]; /*255*/ u_int16_t integrity; } __packed; From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 19:16:28 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 283F3106564A; Sun, 19 Sep 2010 19:16:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F11798FC0A; Sun, 19 Sep 2010 19:16:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JJGRxo012356; Sun, 19 Sep 2010 19:16:27 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JJGRhk012355; Sun, 19 Sep 2010 19:16:27 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009191916.o8JJGRhk012355@svn.freebsd.org> From: Alexander Motin Date: Sun, 19 Sep 2010 19:16:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212871 - stable/7/sbin/atacontrol X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:16:28 -0000 Author: mav Date: Sun Sep 19 19:16:27 2010 New Revision: 212871 URL: http://svn.freebsd.org/changeset/base/212871 Log: Mark r174034,174665,174683,177262 as merged. Modified: Directory Properties: stable/7/sbin/atacontrol/ (props changed) From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 19:18:35 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C284C1065670; Sun, 19 Sep 2010 19:18:35 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B16A68FC1F; Sun, 19 Sep 2010 19:18:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JJIZ8l012467; Sun, 19 Sep 2010 19:18:35 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JJIZwr012465; Sun, 19 Sep 2010 19:18:35 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009191918.o8JJIZwr012465@svn.freebsd.org> From: Alexander Motin Date: Sun, 19 Sep 2010 19:18:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212872 - stable/7/sbin/atacontrol X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:18:36 -0000 Author: mav Date: Sun Sep 19 19:18:35 2010 New Revision: 212872 URL: http://svn.freebsd.org/changeset/base/212872 Log: MFC r199644: Add some missing WDMA/UDMA modes. Modified: stable/7/sbin/atacontrol/atacontrol.c Directory Properties: stable/7/sbin/atacontrol/ (props changed) Modified: stable/7/sbin/atacontrol/atacontrol.c ============================================================================== --- stable/7/sbin/atacontrol/atacontrol.c Sun Sep 19 19:16:27 2010 (r212871) +++ stable/7/sbin/atacontrol/atacontrol.c Sun Sep 19 19:18:35 2010 (r212872) @@ -49,8 +49,13 @@ mode2str(int mode) case ATA_PIO2: return "PIO2"; case ATA_PIO3: return "PIO3"; case ATA_PIO4: return "PIO4"; + case ATA_WDMA0: return "WDMA0"; + case ATA_WDMA1: return "WDMA1"; case ATA_WDMA2: return "WDMA2"; + case ATA_UDMA0: return "UDMA0"; + case ATA_UDMA1: return "UDMA1"; case ATA_UDMA2: return "UDMA33"; + case ATA_UDMA3: return "UDMA44"; case ATA_UDMA4: return "UDMA66"; case ATA_UDMA5: return "UDMA100"; case ATA_UDMA6: return "UDMA133"; @@ -73,9 +78,15 @@ str2mode(char *str) if (!strcasecmp(str, "PIO2")) return ATA_PIO2; if (!strcasecmp(str, "PIO3")) return ATA_PIO3; if (!strcasecmp(str, "PIO4")) return ATA_PIO4; + if (!strcasecmp(str, "WDMA0")) return ATA_WDMA0; + if (!strcasecmp(str, "WDMA1")) return ATA_WDMA1; if (!strcasecmp(str, "WDMA2")) return ATA_WDMA2; + if (!strcasecmp(str, "UDMA0")) return ATA_UDMA0; + if (!strcasecmp(str, "UDMA1")) return ATA_UDMA1; if (!strcasecmp(str, "UDMA2")) return ATA_UDMA2; if (!strcasecmp(str, "UDMA33")) return ATA_UDMA2; + if (!strcasecmp(str, "UDMA3")) return ATA_UDMA3; + if (!strcasecmp(str, "UDMA44")) return ATA_UDMA3; if (!strcasecmp(str, "UDMA4")) return ATA_UDMA4; if (!strcasecmp(str, "UDMA66")) return ATA_UDMA4; if (!strcasecmp(str, "UDMA5")) return ATA_UDMA5; From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 19:42:05 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2108E1065674; Sun, 19 Sep 2010 19:42:05 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 10B968FC0A; Sun, 19 Sep 2010 19:42:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JJg4sk013377; Sun, 19 Sep 2010 19:42:04 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JJg4QO013375; Sun, 19 Sep 2010 19:42:04 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201009191942.o8JJg4QO013375@svn.freebsd.org> From: Alan Cox Date: Sun, 19 Sep 2010 19:42:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212873 - head/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:42:05 -0000 Author: alc Date: Sun Sep 19 19:42:04 2010 New Revision: 212873 URL: http://svn.freebsd.org/changeset/base/212873 Log: Allow a POSIX shared memory object that is opened for read but not for write to nonetheless be mapped PROT_WRITE and MAP_PRIVATE, i.e., copy-on-write. (This is a regression in the new implementation of POSIX shared memory objects that is used by HEAD and RELENG_8. This bug does not exist in RELENG_7's user-level, file-based implementation.) PR: 150260 MFC after: 3 weeks Modified: head/sys/vm/vm_mmap.c Modified: head/sys/vm/vm_mmap.c ============================================================================== --- head/sys/vm/vm_mmap.c Sun Sep 19 19:18:35 2010 (r212872) +++ head/sys/vm/vm_mmap.c Sun Sep 19 19:42:04 2010 (r212873) @@ -1373,7 +1373,8 @@ vm_mmap_shm(struct thread *td, vm_size_t { int error; - if ((*maxprotp & VM_PROT_WRITE) == 0 && + if ((*flagsp & MAP_SHARED) != 0 && + (*maxprotp & VM_PROT_WRITE) == 0 && (prot & PROT_WRITE) != 0) return (EACCES); #ifdef MAC From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 19:43:05 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 675761065698; Sun, 19 Sep 2010 19:43:05 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 55EA78FC0A; Sun, 19 Sep 2010 19:43:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JJh5G1013431; Sun, 19 Sep 2010 19:43:05 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JJh52m013429; Sun, 19 Sep 2010 19:43:05 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009191943.o8JJh52m013429@svn.freebsd.org> From: Alexander Motin Date: Sun, 19 Sep 2010 19:43:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212874 - stable/7/sys/geom/mirror X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:43:05 -0000 Author: mav Date: Sun Sep 19 19:43:05 2010 New Revision: 212874 URL: http://svn.freebsd.org/changeset/base/212874 Log: MFC r201566: Move wakeup() out of mutex to reduce contention. Modified: stable/7/sys/geom/mirror/g_mirror.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/geom/mirror/g_mirror.c ============================================================================== --- stable/7/sys/geom/mirror/g_mirror.c Sun Sep 19 19:42:04 2010 (r212873) +++ stable/7/sys/geom/mirror/g_mirror.c Sun Sep 19 19:43:05 2010 (r212874) @@ -853,8 +853,8 @@ g_mirror_done(struct bio *bp) bp->bio_cflags = G_MIRROR_BIO_FLAG_REGULAR; mtx_lock(&sc->sc_queue_mtx); bioq_disksort(&sc->sc_queue, bp); - wakeup(sc); mtx_unlock(&sc->sc_queue_mtx); + wakeup(sc); } static void @@ -939,9 +939,9 @@ g_mirror_regular_request(struct bio *bp) pbp->bio_error = 0; mtx_lock(&sc->sc_queue_mtx); bioq_disksort(&sc->sc_queue, pbp); + mtx_unlock(&sc->sc_queue_mtx); G_MIRROR_DEBUG(4, "%s: Waking up %p.", __func__, sc); wakeup(sc); - mtx_unlock(&sc->sc_queue_mtx); } break; case BIO_DELETE: @@ -979,8 +979,8 @@ g_mirror_sync_done(struct bio *bp) bp->bio_cflags = G_MIRROR_BIO_FLAG_SYNC; mtx_lock(&sc->sc_queue_mtx); bioq_disksort(&sc->sc_queue, bp); - wakeup(sc); mtx_unlock(&sc->sc_queue_mtx); + wakeup(sc); } static void @@ -1092,9 +1092,9 @@ g_mirror_start(struct bio *bp) } mtx_lock(&sc->sc_queue_mtx); bioq_disksort(&sc->sc_queue, bp); + mtx_unlock(&sc->sc_queue_mtx); G_MIRROR_DEBUG(4, "%s: Waking up %p.", __func__, sc); wakeup(sc); - mtx_unlock(&sc->sc_queue_mtx); } /* From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 19:51:15 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4A906106564A; Sun, 19 Sep 2010 19:51:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 392338FC18; Sun, 19 Sep 2010 19:51:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JJpFnq013841; Sun, 19 Sep 2010 19:51:15 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JJpFGR013839; Sun, 19 Sep 2010 19:51:15 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009191951.o8JJpFGR013839@svn.freebsd.org> From: Alexander Motin Date: Sun, 19 Sep 2010 19:51:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212875 - stable/7/sys/geom X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:51:15 -0000 Author: mav Date: Sun Sep 19 19:51:14 2010 New Revision: 212875 URL: http://svn.freebsd.org/changeset/base/212875 Log: MFC r196904: Remove msleep() timeout from g_io_schedule_up/down(). It works fine without it, saving few percents of CPU on high request rates without need to rearm callout twice per request. Modified: stable/7/sys/geom/geom_io.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/geom/geom_io.c ============================================================================== --- stable/7/sys/geom/geom_io.c Sun Sep 19 19:43:05 2010 (r212874) +++ stable/7/sys/geom/geom_io.c Sun Sep 19 19:51:14 2010 (r212875) @@ -485,7 +485,7 @@ g_io_schedule_down(struct thread *tp __u if (bp == NULL) { CTR0(KTR_GEOM, "g_down going to sleep"); msleep(&g_wait_down, &g_bio_run_down.bio_queue_lock, - PRIBIO | PDROP, "-", hz/10); + PRIBIO | PDROP, "-", 0); continue; } CTR0(KTR_GEOM, "g_down has work to do"); @@ -590,7 +590,7 @@ g_io_schedule_up(struct thread *tp __unu } CTR0(KTR_GEOM, "g_up going to sleep"); msleep(&g_wait_up, &g_bio_run_up.bio_queue_lock, - PRIBIO | PDROP, "-", hz/10); + PRIBIO | PDROP, "-", 0); } } From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 19:52:26 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BF99D1065673; Sun, 19 Sep 2010 19:52:26 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AE3348FC0C; Sun, 19 Sep 2010 19:52:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JJqQjU013910; Sun, 19 Sep 2010 19:52:26 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JJqQYK013908; Sun, 19 Sep 2010 19:52:26 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009191952.o8JJqQYK013908@svn.freebsd.org> From: Alexander Motin Date: Sun, 19 Sep 2010 19:52:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212876 - stable/7/sys/geom X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:52:27 -0000 Author: mav Date: Sun Sep 19 19:52:26 2010 New Revision: 212876 URL: http://svn.freebsd.org/changeset/base/212876 Log: MFC r201264: Call wakeup() only for the first request on the queue. Modified: stable/7/sys/geom/geom_io.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/geom/geom_io.c ============================================================================== --- stable/7/sys/geom/geom_io.c Sun Sep 19 19:51:14 2010 (r212875) +++ stable/7/sys/geom/geom_io.c Sun Sep 19 19:52:26 2010 (r212876) @@ -322,6 +322,7 @@ void g_io_request(struct bio *bp, struct g_consumer *cp) { struct g_provider *pp; + int first; KASSERT(cp != NULL, ("NULL cp in g_io_request")); KASSERT(bp != NULL, ("NULL bp in g_io_request")); @@ -388,12 +389,14 @@ g_io_request(struct bio *bp, struct g_co pp->nstart++; cp->nstart++; + first = TAILQ_EMPTY(&g_bio_run_down.bio_queue); TAILQ_INSERT_TAIL(&g_bio_run_down.bio_queue, bp, bio_queue); g_bio_run_down.bio_queue_length++; g_bioq_unlock(&g_bio_run_down); /* Pass it on down. */ - wakeup(&g_wait_down); + if (first) + wakeup(&g_wait_down); } void @@ -401,6 +404,7 @@ g_io_deliver(struct bio *bp, int error) { struct g_consumer *cp; struct g_provider *pp; + int first; KASSERT(bp != NULL, ("NULL bp in g_io_deliver")); pp = bp->bio_to; @@ -454,11 +458,13 @@ g_io_deliver(struct bio *bp, int error) pp->nend++; if (error != ENOMEM) { bp->bio_error = error; + first = TAILQ_EMPTY(&g_bio_run_up.bio_queue); TAILQ_INSERT_TAIL(&g_bio_run_up.bio_queue, bp, bio_queue); bp->bio_flags |= BIO_ONQUEUE; g_bio_run_up.bio_queue_length++; g_bioq_unlock(&g_bio_run_up); - wakeup(&g_wait_up); + if (first) + wakeup(&g_wait_up); return; } g_bioq_unlock(&g_bio_run_up); From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 19:53:42 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 48178106566B; Sun, 19 Sep 2010 19:53:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 370368FC16; Sun, 19 Sep 2010 19:53:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JJrgFb013981; Sun, 19 Sep 2010 19:53:42 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JJrgZp013979; Sun, 19 Sep 2010 19:53:42 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009191953.o8JJrgZp013979@svn.freebsd.org> From: Alexander Motin Date: Sun, 19 Sep 2010 19:53:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212877 - stable/7/sys/geom X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:53:42 -0000 Author: mav Date: Sun Sep 19 19:53:41 2010 New Revision: 212877 URL: http://svn.freebsd.org/changeset/base/212877 Log: MFC r205619: Do not fetch precise time of request start when stats collection disabled. Modified: stable/7/sys/geom/geom_io.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/geom/geom_io.c ============================================================================== --- stable/7/sys/geom/geom_io.c Sun Sep 19 19:52:26 2010 (r212876) +++ stable/7/sys/geom/geom_io.c Sun Sep 19 19:53:41 2010 (r212877) @@ -374,7 +374,10 @@ g_io_request(struct bio *bp, struct g_co ("Bio already on queue bp=%p", bp)); bp->bio_flags |= BIO_ONQUEUE; - binuptime(&bp->bio_t0); + if (g_collectstats) + binuptime(&bp->bio_t0); + else + getbinuptime(&bp->bio_t0); /* * The statistics collection is lockless, as such, but we From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 19:57:16 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2427A106564A; Sun, 19 Sep 2010 19:57:16 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 12FC28FC0A; Sun, 19 Sep 2010 19:57:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JJvFV4014129; Sun, 19 Sep 2010 19:57:15 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JJvFNX014126; Sun, 19 Sep 2010 19:57:15 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009191957.o8JJvFNX014126@svn.freebsd.org> From: Alexander Motin Date: Sun, 19 Sep 2010 19:57:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212878 - stable/7/sys/geom X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:57:16 -0000 Author: mav Date: Sun Sep 19 19:57:15 2010 New Revision: 212878 URL: http://svn.freebsd.org/changeset/base/212878 Log: MFC r174669: Don't limit BIO_DELETE requests to MAXPHYS, they perform no data transfers, so they are not subject to the VM system limitation. Modified: stable/7/sys/geom/geom_dev.c stable/7/sys/geom/geom_io.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/geom/geom_dev.c ============================================================================== --- stable/7/sys/geom/geom_dev.c Sun Sep 19 19:53:41 2010 (r212877) +++ stable/7/sys/geom/geom_dev.c Sun Sep 19 19:57:15 2010 (r212878) @@ -314,8 +314,7 @@ g_dev_ioctl(struct cdev *dev, u_long cmd offset = ((off_t *)data)[0]; length = ((off_t *)data)[1]; if ((offset % cp->provider->sectorsize) != 0 || - (length % cp->provider->sectorsize) != 0 || - length <= 0 || length > MAXPHYS) { + (length % cp->provider->sectorsize) != 0 || length <= 0) { printf("%s: offset=%jd length=%jd\n", __func__, offset, length); error = EINVAL; Modified: stable/7/sys/geom/geom_io.c ============================================================================== --- stable/7/sys/geom/geom_io.c Sun Sep 19 19:53:41 2010 (r212877) +++ stable/7/sys/geom/geom_io.c Sun Sep 19 19:57:15 2010 (r212878) @@ -661,9 +661,8 @@ g_delete_data(struct g_consumer *cp, off struct bio *bp; int error; - KASSERT(length > 0 && length >= cp->provider->sectorsize && - length <= MAXPHYS, ("g_delete_data(): invalid length %jd", - (intmax_t)length)); + KASSERT(length > 0 && length >= cp->provider->sectorsize, + ("g_delete_data(): invalid length %jd", (intmax_t)length)); bp = g_alloc_bio(); bp->bio_cmd = BIO_DELETE; From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 20:02:31 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 67E051065672; Sun, 19 Sep 2010 20:02:31 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 56AB68FC08; Sun, 19 Sep 2010 20:02:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JK2Vi3014378; Sun, 19 Sep 2010 20:02:31 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JK2VcK014376; Sun, 19 Sep 2010 20:02:31 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009192002.o8JK2VcK014376@svn.freebsd.org> From: Alexander Motin Date: Sun, 19 Sep 2010 20:02:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212879 - stable/7/sys/geom X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 20:02:31 -0000 Author: mav Date: Sun Sep 19 20:02:31 2010 New Revision: 212879 URL: http://svn.freebsd.org/changeset/base/212879 Log: MFC r196964: Do not check proper request alignment here in geom_dev in production. It will be checked any way later by g_io_check() in g_io_schedule_down(). It is only needed here to not trigger panic from additional check, when INVARIANTS enabled. So cover it with #ifdef INVARIANTS. It saves two 64bit divisions per request. Modified: stable/7/sys/geom/geom_dev.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/geom/geom_dev.c ============================================================================== --- stable/7/sys/geom/geom_dev.c Sun Sep 19 19:57:15 2010 (r212878) +++ stable/7/sys/geom/geom_dev.c Sun Sep 19 20:02:31 2010 (r212879) @@ -373,14 +373,14 @@ g_dev_strategy(struct bio *bp) cp = dev->si_drv2; KASSERT(cp->acr || cp->acw, ("Consumer with zero access count in g_dev_strategy")); - +#ifdef INVARIANTS if ((bp->bio_offset % cp->provider->sectorsize) != 0 || (bp->bio_bcount % cp->provider->sectorsize) != 0) { bp->bio_resid = bp->bio_bcount; biofinish(bp, NULL, EINVAL); return; } - +#endif for (;;) { /* * XXX: This is not an ideal solution, but I belive it to From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 20:07:41 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 26E871065674; Sun, 19 Sep 2010 20:07:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 154DF8FC15; Sun, 19 Sep 2010 20:07:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JK7exQ014585; Sun, 19 Sep 2010 20:07:40 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JK7eDv014583; Sun, 19 Sep 2010 20:07:40 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009192007.o8JK7eDv014583@svn.freebsd.org> From: Alexander Motin Date: Sun, 19 Sep 2010 20:07:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212880 - stable/7/sys/geom/raid3 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 20:07:41 -0000 Author: mav Date: Sun Sep 19 20:07:40 2010 New Revision: 212880 URL: http://svn.freebsd.org/changeset/base/212880 Log: MFC r201545: Slightly optimize XOR calculation. Modified: stable/7/sys/geom/raid3/g_raid3.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/geom/raid3/g_raid3.c ============================================================================== --- stable/7/sys/geom/raid3/g_raid3.c Sun Sep 19 20:02:31 2010 (r212879) +++ stable/7/sys/geom/raid3/g_raid3.c Sun Sep 19 20:07:40 2010 (r212880) @@ -231,31 +231,31 @@ g_raid3_uma_dtor(void *mem, int size, vo sz->sz_inuse--; } -#define g_raid3_xor(src1, src2, dst, size) \ - _g_raid3_xor((uint64_t *)(src1), (uint64_t *)(src2), \ +#define g_raid3_xor(src, dst, size) \ + _g_raid3_xor((uint64_t *)(src), \ (uint64_t *)(dst), (size_t)size) static void -_g_raid3_xor(uint64_t *src1, uint64_t *src2, uint64_t *dst, size_t size) +_g_raid3_xor(uint64_t *src, uint64_t *dst, size_t size) { KASSERT((size % 128) == 0, ("Invalid size: %zu.", size)); for (; size > 0; size -= 128) { - *dst++ = (*src1++) ^ (*src2++); - *dst++ = (*src1++) ^ (*src2++); - *dst++ = (*src1++) ^ (*src2++); - *dst++ = (*src1++) ^ (*src2++); - *dst++ = (*src1++) ^ (*src2++); - *dst++ = (*src1++) ^ (*src2++); - *dst++ = (*src1++) ^ (*src2++); - *dst++ = (*src1++) ^ (*src2++); - *dst++ = (*src1++) ^ (*src2++); - *dst++ = (*src1++) ^ (*src2++); - *dst++ = (*src1++) ^ (*src2++); - *dst++ = (*src1++) ^ (*src2++); - *dst++ = (*src1++) ^ (*src2++); - *dst++ = (*src1++) ^ (*src2++); - *dst++ = (*src1++) ^ (*src2++); - *dst++ = (*src1++) ^ (*src2++); + *dst++ ^= (*src++); + *dst++ ^= (*src++); + *dst++ ^= (*src++); + *dst++ ^= (*src++); + *dst++ ^= (*src++); + *dst++ ^= (*src++); + *dst++ ^= (*src++); + *dst++ ^= (*src++); + *dst++ ^= (*src++); + *dst++ ^= (*src++); + *dst++ ^= (*src++); + *dst++ ^= (*src++); + *dst++ ^= (*src++); + *dst++ ^= (*src++); + *dst++ ^= (*src++); + *dst++ ^= (*src++); } } @@ -1049,6 +1049,7 @@ g_raid3_scatter(struct bio *pbp) struct g_raid3_disk *disk; struct bio *bp, *cbp, *tmpbp; off_t atom, cadd, padd, left; + int first; sc = pbp->bio_to->geom->softc; bp = NULL; @@ -1079,12 +1080,18 @@ g_raid3_scatter(struct bio *pbp) /* * Calculate parity. */ - bzero(bp->bio_data, bp->bio_length); + first = 1; G_RAID3_FOREACH_SAFE_BIO(pbp, cbp, tmpbp) { if (cbp == bp) continue; - g_raid3_xor(cbp->bio_data, bp->bio_data, bp->bio_data, - bp->bio_length); + if (first) { + bcopy(cbp->bio_data, bp->bio_data, + bp->bio_length); + first = 0; + } else { + g_raid3_xor(cbp->bio_data, bp->bio_data, + bp->bio_length); + } if ((cbp->bio_cflags & G_RAID3_BIO_CFLAG_NODISK) != 0) g_raid3_destroy_bio(sc, cbp); } @@ -1216,7 +1223,7 @@ g_raid3_gather(struct bio *pbp) G_RAID3_FOREACH_BIO(pbp, cbp) { if ((cbp->bio_cflags & G_RAID3_BIO_CFLAG_PARITY) != 0) continue; - g_raid3_xor(cbp->bio_data, xbp->bio_data, xbp->bio_data, + g_raid3_xor(cbp->bio_data, xbp->bio_data, xbp->bio_length); } xbp->bio_cflags &= ~G_RAID3_BIO_CFLAG_PARITY; @@ -1639,7 +1646,7 @@ g_raid3_sync_request(struct bio *bp) bcopy(src, dst, atom); src += atom; for (n = 1; n < sc->sc_ndisks - 1; n++) { - g_raid3_xor(src, dst, dst, atom); + g_raid3_xor(src, dst, atom); src += atom; } dst += atom; From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 20:08:46 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F208106564A; Sun, 19 Sep 2010 20:08:46 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2DE688FC12; Sun, 19 Sep 2010 20:08:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JK8kKl014654; Sun, 19 Sep 2010 20:08:46 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JK8kcg014652; Sun, 19 Sep 2010 20:08:46 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009192008.o8JK8kcg014652@svn.freebsd.org> From: Alexander Motin Date: Sun, 19 Sep 2010 20:08:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212881 - stable/7/sys/geom/raid3 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 20:08:46 -0000 Author: mav Date: Sun Sep 19 20:08:45 2010 New Revision: 212881 URL: http://svn.freebsd.org/changeset/base/212881 Log: MFC r201567: Move wakeup() out of mutex to reduce contention. Modified: stable/7/sys/geom/raid3/g_raid3.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/geom/raid3/g_raid3.c ============================================================================== --- stable/7/sys/geom/raid3/g_raid3.c Sun Sep 19 20:07:40 2010 (r212880) +++ stable/7/sys/geom/raid3/g_raid3.c Sun Sep 19 20:08:45 2010 (r212881) @@ -1271,9 +1271,9 @@ g_raid3_done(struct bio *bp) G_RAID3_LOGREQ(3, bp, "Regular request done (error=%d).", bp->bio_error); mtx_lock(&sc->sc_queue_mtx); bioq_insert_head(&sc->sc_queue, bp); + mtx_unlock(&sc->sc_queue_mtx); wakeup(sc); wakeup(&sc->sc_queue); - mtx_unlock(&sc->sc_queue_mtx); } static void @@ -1379,9 +1379,9 @@ g_raid3_sync_done(struct bio *bp) bp->bio_cflags |= G_RAID3_BIO_CFLAG_SYNC; mtx_lock(&sc->sc_queue_mtx); bioq_insert_head(&sc->sc_queue, bp); + mtx_unlock(&sc->sc_queue_mtx); wakeup(sc); wakeup(&sc->sc_queue); - mtx_unlock(&sc->sc_queue_mtx); } static void @@ -1459,9 +1459,9 @@ g_raid3_start(struct bio *bp) } mtx_lock(&sc->sc_queue_mtx); bioq_insert_tail(&sc->sc_queue, bp); + mtx_unlock(&sc->sc_queue_mtx); G_RAID3_DEBUG(4, "%s: Waking up %p.", __func__, sc); wakeup(sc); - mtx_unlock(&sc->sc_queue_mtx); } /* From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 20:22:49 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 43258106566B; Sun, 19 Sep 2010 20:22:49 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 176498FC0C; Sun, 19 Sep 2010 20:22:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JKMmeO015304; Sun, 19 Sep 2010 20:22:48 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JKMmIu015302; Sun, 19 Sep 2010 20:22:48 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201009192022.o8JKMmIu015302@svn.freebsd.org> From: Navdeep Parhar Date: Sun, 19 Sep 2010 20:22:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212882 - stable/8/sys/dev/cxgb/common X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 20:22:49 -0000 Author: np Date: Sun Sep 19 20:22:48 2010 New Revision: 212882 URL: http://svn.freebsd.org/changeset/base/212882 Log: MFC r212710 Fix t3_gate_rx_traffic and t3_open_rx_traffic. Parts of them always operated on XGMAC0 instead of the specified XGMAC. Modified: stable/8/sys/dev/cxgb/common/cxgb_t3_hw.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/cxgb/common/cxgb_t3_hw.c ============================================================================== --- stable/8/sys/dev/cxgb/common/cxgb_t3_hw.c Sun Sep 19 20:08:45 2010 (r212881) +++ stable/8/sys/dev/cxgb/common/cxgb_t3_hw.c Sun Sep 19 20:22:48 2010 (r212882) @@ -1441,16 +1441,18 @@ static void t3_gate_rx_traffic(struct cm t3_mac_disable_exact_filters(mac); /* stop broadcast, multicast, promiscuous mode traffic */ - *rx_cfg = t3_read_reg(mac->adapter, A_XGM_RX_CFG); - t3_set_reg_field(mac->adapter, A_XGM_RX_CFG, + *rx_cfg = t3_read_reg(mac->adapter, A_XGM_RX_CFG + mac->offset); + t3_set_reg_field(mac->adapter, A_XGM_RX_CFG + mac->offset, F_ENHASHMCAST | F_DISBCAST | F_COPYALLFRAMES, F_DISBCAST); - *rx_hash_high = t3_read_reg(mac->adapter, A_XGM_RX_HASH_HIGH); - t3_write_reg(mac->adapter, A_XGM_RX_HASH_HIGH, 0); - - *rx_hash_low = t3_read_reg(mac->adapter, A_XGM_RX_HASH_LOW); - t3_write_reg(mac->adapter, A_XGM_RX_HASH_LOW, 0); + *rx_hash_high = t3_read_reg(mac->adapter, A_XGM_RX_HASH_HIGH + + mac->offset); + t3_write_reg(mac->adapter, A_XGM_RX_HASH_HIGH + mac->offset, 0); + + *rx_hash_low = t3_read_reg(mac->adapter, A_XGM_RX_HASH_LOW + + mac->offset); + t3_write_reg(mac->adapter, A_XGM_RX_HASH_LOW + mac->offset, 0); /* Leave time to drain max RX fifo */ msleep(1); @@ -1460,11 +1462,13 @@ static void t3_open_rx_traffic(struct cm u32 rx_hash_high, u32 rx_hash_low) { t3_mac_enable_exact_filters(mac); - t3_set_reg_field(mac->adapter, A_XGM_RX_CFG, + t3_set_reg_field(mac->adapter, A_XGM_RX_CFG + mac->offset, F_ENHASHMCAST | F_DISBCAST | F_COPYALLFRAMES, rx_cfg); - t3_write_reg(mac->adapter, A_XGM_RX_HASH_HIGH, rx_hash_high); - t3_write_reg(mac->adapter, A_XGM_RX_HASH_LOW, rx_hash_low); + t3_write_reg(mac->adapter, A_XGM_RX_HASH_HIGH + mac->offset, + rx_hash_high); + t3_write_reg(mac->adapter, A_XGM_RX_HASH_LOW + mac->offset, + rx_hash_low); } static int t3_detect_link_fault(adapter_t *adapter, int port_id) From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 20:38:35 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB9D0106566C; Sun, 19 Sep 2010 20:38:34 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BFBEB8FC15; Sun, 19 Sep 2010 20:38:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JKcYRa016126; Sun, 19 Sep 2010 20:38:34 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JKcYZm016124; Sun, 19 Sep 2010 20:38:34 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201009192038.o8JKcYZm016124@svn.freebsd.org> From: Navdeep Parhar Date: Sun, 19 Sep 2010 20:38:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212883 - stable/7/sys/dev/cxgb/common X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 20:38:35 -0000 Author: np Date: Sun Sep 19 20:38:34 2010 New Revision: 212883 URL: http://svn.freebsd.org/changeset/base/212883 Log: MFC r212710 Fix t3_gate_rx_traffic and t3_open_rx_traffic. Parts of them always operated on XGMAC0 instead of the specified XGMAC. Modified: stable/7/sys/dev/cxgb/common/cxgb_t3_hw.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/cxgb/common/cxgb_t3_hw.c ============================================================================== --- stable/7/sys/dev/cxgb/common/cxgb_t3_hw.c Sun Sep 19 20:22:48 2010 (r212882) +++ stable/7/sys/dev/cxgb/common/cxgb_t3_hw.c Sun Sep 19 20:38:34 2010 (r212883) @@ -1444,16 +1444,18 @@ static void t3_gate_rx_traffic(struct cm t3_mac_disable_exact_filters(mac); /* stop broadcast, multicast, promiscuous mode traffic */ - *rx_cfg = t3_read_reg(mac->adapter, A_XGM_RX_CFG); - t3_set_reg_field(mac->adapter, A_XGM_RX_CFG, + *rx_cfg = t3_read_reg(mac->adapter, A_XGM_RX_CFG + mac->offset); + t3_set_reg_field(mac->adapter, A_XGM_RX_CFG + mac->offset, F_ENHASHMCAST | F_DISBCAST | F_COPYALLFRAMES, F_DISBCAST); - *rx_hash_high = t3_read_reg(mac->adapter, A_XGM_RX_HASH_HIGH); - t3_write_reg(mac->adapter, A_XGM_RX_HASH_HIGH, 0); - - *rx_hash_low = t3_read_reg(mac->adapter, A_XGM_RX_HASH_LOW); - t3_write_reg(mac->adapter, A_XGM_RX_HASH_LOW, 0); + *rx_hash_high = t3_read_reg(mac->adapter, A_XGM_RX_HASH_HIGH + + mac->offset); + t3_write_reg(mac->adapter, A_XGM_RX_HASH_HIGH + mac->offset, 0); + + *rx_hash_low = t3_read_reg(mac->adapter, A_XGM_RX_HASH_LOW + + mac->offset); + t3_write_reg(mac->adapter, A_XGM_RX_HASH_LOW + mac->offset, 0); /* Leave time to drain max RX fifo */ msleep(1); @@ -1463,11 +1465,13 @@ static void t3_open_rx_traffic(struct cm u32 rx_hash_high, u32 rx_hash_low) { t3_mac_enable_exact_filters(mac); - t3_set_reg_field(mac->adapter, A_XGM_RX_CFG, + t3_set_reg_field(mac->adapter, A_XGM_RX_CFG + mac->offset, F_ENHASHMCAST | F_DISBCAST | F_COPYALLFRAMES, rx_cfg); - t3_write_reg(mac->adapter, A_XGM_RX_HASH_HIGH, rx_hash_high); - t3_write_reg(mac->adapter, A_XGM_RX_HASH_LOW, rx_hash_low); + t3_write_reg(mac->adapter, A_XGM_RX_HASH_HIGH + mac->offset, + rx_hash_high); + t3_write_reg(mac->adapter, A_XGM_RX_HASH_LOW + mac->offset, + rx_hash_low); } static int t3_detect_link_fault(adapter_t *adapter, int port_id) From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 20:49:15 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EA8AD1065672; Sun, 19 Sep 2010 20:49:15 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 0D16C8FC12; Sun, 19 Sep 2010 20:49:15 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 737D745C89; Sun, 19 Sep 2010 22:49:13 +0200 (CEST) Received: from localhost (chello089077043238.chello.pl [89.77.43.238]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id 5F80945685; Sun, 19 Sep 2010 22:49:08 +0200 (CEST) Date: Sun, 19 Sep 2010 22:48:47 +0200 From: Pawel Jakub Dawidek To: Alexander Motin Message-ID: <20100919204847.GA21347@garage.freebsd.pl> References: <201009191957.o8JJvFNX014126@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="mP3DRpeJDSE+ciuQ" Content-Disposition: inline In-Reply-To: <201009191957.o8JJvFNX014126@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 9.0-CURRENT amd64 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-0.6 required=4.5 tests=BAYES_00,RCVD_IN_SORBS_DUL autolearn=no version=3.0.4 Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-7@freebsd.org Subject: Re: svn commit: r212878 - stable/7/sys/geom X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 20:49:16 -0000 --mP3DRpeJDSE+ciuQ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Sep 19, 2010 at 07:57:15PM +0000, Alexander Motin wrote: > - KASSERT(length > 0 && length >=3D cp->provider->sectorsize && > - length <=3D MAXPHYS, ("g_delete_data(): invalid length %jd", > - (intmax_t)length)); > + KASSERT(length > 0 && length >=3D cp->provider->sectorsize, > + ("g_delete_data(): invalid length %jd", (intmax_t)length)); This check looks a bit strange. Leaving only 'length >=3D cp->provider->sectorsize' part should be enough. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --mP3DRpeJDSE+ciuQ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkyWdy8ACgkQForvXbEpPzR8AACcC9Wz829XIgQQzm6qkbek5oN+ lokAnjH/lEGEgQ1bCqDCXgmFInsHkg5I =rN7L -----END PGP SIGNATURE----- --mP3DRpeJDSE+ciuQ-- From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 21:38:12 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E498E106564A; Sun, 19 Sep 2010 21:38:12 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B88AC8FC12; Sun, 19 Sep 2010 21:38:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JLcCvb017474; Sun, 19 Sep 2010 21:38:12 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JLcCpC017472; Sun, 19 Sep 2010 21:38:12 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201009192138.o8JLcCpC017472@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 19 Sep 2010 21:38:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212884 - stable/8/bin/sh X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 21:38:13 -0000 Author: jilles Date: Sun Sep 19 21:38:12 2010 New Revision: 212884 URL: http://svn.freebsd.org/changeset/base/212884 Log: MFC r211621: sh(1): Add a brief summary of arithmetic expressions. Modified: stable/8/bin/sh/sh.1 Directory Properties: stable/8/bin/sh/ (props changed) Modified: stable/8/bin/sh/sh.1 ============================================================================== --- stable/8/bin/sh/sh.1 Sun Sep 19 20:38:34 2010 (r212883) +++ stable/8/bin/sh/sh.1 Sun Sep 19 21:38:12 2010 (r212884) @@ -1148,7 +1148,7 @@ Quote Removal. The .Ql $ character is used to introduce parameter expansion, command -substitution, or arithmetic evaluation. +substitution, or arithmetic expansion. .Ss Tilde Expansion (substituting a user's home directory) A word beginning with an unquoted tilde character .Pq Ql ~ @@ -1363,10 +1363,41 @@ The shell expands all tokens in the .Ar expression for parameter expansion, -command substitution, and quote removal. +command substitution, +arithmetic expansion +and quote removal. +.Pp +The allowed expressions are a subset of C expressions, +summarized below. +.Bl -tag -width "Variables" -offset indent +.It Values +All values are of type +.Ft intmax_t . +.It Constants +Decimal, octal (starting with +.Li 0 ) +and hexadecimal (starting with +.Li 0x ) +integer constants. +.It Variables +Shell variables can be read and written +and contain integer constants. +.It Unary operators +.Li "! ~ + -" +.It Binary operators +.Li "* / % + - << >> < <= > >= == != & ^ | && ||" +.It Assignment operators +.Li "= += -= *= /= %= <<= >>= &= ^= |=" +.It Short-circuit evaluation +The +.Li && +and +.Li || +operators always evaluate both sides. +This is a bug. +.El .Pp -Next, the shell treats this as an arithmetic expression and -substitutes the value of the expression. +The result of the expression is substituted in decimal. .Ss White Space Splitting (Field Splitting) After parameter expansion, command substitution, and arithmetic expansion the shell scans the results of From owner-svn-src-all@FreeBSD.ORG Sun Sep 19 21:56:42 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 666BD106566B; Sun, 19 Sep 2010 21:56:42 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3A6378FC15; Sun, 19 Sep 2010 21:56:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8JLugKX017938; Sun, 19 Sep 2010 21:56:42 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JLug4s017936; Sun, 19 Sep 2010 21:56:42 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201009192156.o8JLug4s017936@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 19 Sep 2010 21:56:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212885 - stable/8/bin/sh X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 21:56:42 -0000 Author: jilles Date: Sun Sep 19 21:56:41 2010 New Revision: 212885 URL: http://svn.freebsd.org/changeset/base/212885 Log: MFC r207831: sh(1): Fix "reserved word" vs "keyword" inconsistency. Use "keyword" everywhere, like the output of the 'type' builtin, and only mention "reserved word" once to say it is the same thing. Modified: stable/8/bin/sh/sh.1 Directory Properties: stable/8/bin/sh/ (props changed) Modified: stable/8/bin/sh/sh.1 ============================================================================== --- stable/8/bin/sh/sh.1 Sun Sep 19 21:38:12 2010 (r212884) +++ stable/8/bin/sh/sh.1 Sun Sep 19 21:56:41 2010 (r212885) @@ -411,11 +411,11 @@ character, with the exception of the new .Pq Ql \en . A backslash preceding a newline is treated as a line continuation. .El -.Ss Reserved Words -Reserved words are words that have special meaning to the +.Ss Keywords +Keywords or reserved words are words that have special meaning to the shell and are recognized at the beginning of a line and after a control operator. -The following are reserved words: +The following are keywords: .Bl -column "doneXX" "elifXX" "elseXX" "untilXX" "whileX" -offset center .It Li \&! Ta { Ta } Ta Ic case Ta Ic do .It Ic done Ta Ic elif Ta Ic else Ta Ic esac Ta Ic fi @@ -425,8 +425,8 @@ The following are reserved words: An alias is a name and corresponding value set using the .Ic alias built-in command. -Whenever a reserved word may occur (see above), -and after checking for reserved words, the shell +Whenever a keyword may occur (see above), +and after checking for keywords, the shell checks the word to see if it matches an alias. If it does, it replaces it in the input stream with its value. For example, if there is an alias called @@ -465,7 +465,7 @@ of this man page (refer to the BNF in th document). Essentially though, a line is read and if the first word of the line (or after a control operator) -is not a reserved word, then the shell has recognized a +is not a keyword, then the shell has recognized a simple command. Otherwise, a complex command or some other special construct may have been recognized. @@ -691,7 +691,7 @@ Signal numbers are defined in the header .In sys/signal.h . .Ss Complex Commands Complex commands are combinations of simple commands -with control operators or reserved words, together creating a larger complex +with control operators or keywords, together creating a larger complex command. More generally, a command is one of the following: .Bl -item -offset indent @@ -735,7 +735,7 @@ operators that are part of the command. If the pipeline is not in the background (discussed later), the shell waits for all commands to complete. .Pp -If the reserved word +If the keyword .Ic !\& does not precede the pipeline, the exit status is the exit status of the last command specified From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 04:20:56 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BDC5F1065670; Mon, 20 Sep 2010 04:20:56 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 40DCA8FC1A; Mon, 20 Sep 2010 04:20:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8K4KtCZ026516; Mon, 20 Sep 2010 04:20:55 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8K4KtKn026514; Mon, 20 Sep 2010 04:20:55 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201009200420.o8K4KtKn026514@svn.freebsd.org> From: Marcel Moolenaar Date: Mon, 20 Sep 2010 04:20:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212886 - head/sbin/growfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 04:20:56 -0000 Author: marcel Date: Mon Sep 20 04:20:55 2010 New Revision: 212886 URL: http://svn.freebsd.org/changeset/base/212886 Log: Unbreak the build on strong-aligned architectures (arm, ia64). Casting from (char *) to (struct ufs1_dinode *) changes the alignment requirement of the pointer and GCC does not know that the pointer is adequately aligned (due to malloc(3)), and warns about it. Cast to (void *) first to by-pass the check. Modified: head/sbin/growfs/growfs.c Modified: head/sbin/growfs/growfs.c ============================================================================== --- head/sbin/growfs/growfs.c Sun Sep 19 21:56:41 2010 (r212885) +++ head/sbin/growfs/growfs.c Mon Sep 20 04:20:55 2010 (r212886) @@ -452,7 +452,7 @@ initcg(int cylno, time_t utime, int fso, bzero(iobuf, sblock.fs_bsize); for (i = 0; i < sblock.fs_ipg / INOPF(&sblock); i += sblock.fs_frag) { - dp1 = (struct ufs1_dinode *)iobuf; + dp1 = (struct ufs1_dinode *)(void *)iobuf; #ifdef FSIRAND for (j = 0; j < INOPB(&sblock); j++) { dp1->di_gen = random(); From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 05:39:51 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D4FC106567A; Mon, 20 Sep 2010 05:39:51 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F02A88FC22; Mon, 20 Sep 2010 05:39:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8K5doZv028206; Mon, 20 Sep 2010 05:39:50 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8K5doEM028204; Mon, 20 Sep 2010 05:39:50 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201009200539.o8K5doEM028204@svn.freebsd.org> From: Andriy Gapon Date: Mon, 20 Sep 2010 05:39:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212887 - stable/8/sys/dev/acpica X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 05:39:51 -0000 Author: avg Date: Mon Sep 20 05:39:50 2010 New Revision: 212887 URL: http://svn.freebsd.org/changeset/base/212887 Log: MFC r212549: acpi_cpu: do not apply P_LVLx_LAT rules to latencies returned by _CST Modified: stable/8/sys/dev/acpica/acpi_cpu.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/acpica/acpi_cpu.c ============================================================================== --- stable/8/sys/dev/acpica/acpi_cpu.c Mon Sep 20 04:20:55 2010 (r212886) +++ stable/8/sys/dev/acpica/acpi_cpu.c Mon Sep 20 05:39:50 2010 (r212887) @@ -692,19 +692,11 @@ acpi_cpu_cx_cst(struct acpi_cpu_softc *s sc->cpu_cx_count++; continue; case ACPI_STATE_C2: - if (cx_ptr->trans_lat > 100) { - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "acpi_cpu%d: C2[%d] not available.\n", - device_get_unit(sc->cpu_dev), i)); - continue; - } sc->cpu_non_c3 = i; break; case ACPI_STATE_C3: default: - if (cx_ptr->trans_lat > 1000 || - (cpu_quirks & CPU_QUIRK_NO_C3) != 0) { - + if ((cpu_quirks & CPU_QUIRK_NO_C3) != 0) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "acpi_cpu%d: C3[%d] not available.\n", device_get_unit(sc->cpu_dev), i)); From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 05:46:15 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5CF14106566B; Mon, 20 Sep 2010 05:46:15 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4BEF08FC12; Mon, 20 Sep 2010 05:46:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8K5kFsu028404; Mon, 20 Sep 2010 05:46:15 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8K5kFgl028402; Mon, 20 Sep 2010 05:46:15 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201009200546.o8K5kFgl028402@svn.freebsd.org> From: Andriy Gapon Date: Mon, 20 Sep 2010 05:46:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212888 - stable/7/sys/dev/acpica X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 05:46:15 -0000 Author: avg Date: Mon Sep 20 05:46:15 2010 New Revision: 212888 URL: http://svn.freebsd.org/changeset/base/212888 Log: MFC r212549: acpi_cpu: do not apply P_LVLx_LAT rules to latencies returned by _CST Modified: stable/7/sys/dev/acpica/acpi_cpu.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/acpica/acpi_cpu.c ============================================================================== --- stable/7/sys/dev/acpica/acpi_cpu.c Mon Sep 20 05:39:50 2010 (r212887) +++ stable/7/sys/dev/acpica/acpi_cpu.c Mon Sep 20 05:46:15 2010 (r212888) @@ -671,19 +671,11 @@ acpi_cpu_cx_cst(struct acpi_cpu_softc *s sc->cpu_cx_count++; continue; case ACPI_STATE_C2: - if (cx_ptr->trans_lat > 100) { - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "acpi_cpu%d: C2[%d] not available.\n", - device_get_unit(sc->cpu_dev), i)); - continue; - } sc->cpu_non_c3 = i; break; case ACPI_STATE_C3: default: - if (cx_ptr->trans_lat > 1000 || - (cpu_quirks & CPU_QUIRK_NO_C3) != 0) { - + if ((cpu_quirks & CPU_QUIRK_NO_C3) != 0) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "acpi_cpu%d: C3[%d] not available.\n", device_get_unit(sc->cpu_dev), i)); From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 05:56:10 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A207106566C; Mon, 20 Sep 2010 05:56:10 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3E7D68FC08; Mon, 20 Sep 2010 05:56:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8K5uASC028671; Mon, 20 Sep 2010 05:56:10 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8K5uARc028668; Mon, 20 Sep 2010 05:56:10 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201009200556.o8K5uARc028668@svn.freebsd.org> From: Andriy Gapon Date: Mon, 20 Sep 2010 05:56:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212889 - in stable/8/sys: kern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 05:56:10 -0000 Author: avg Date: Mon Sep 20 05:56:09 2010 New Revision: 212889 URL: http://svn.freebsd.org/changeset/base/212889 Log: MFC r212213: struct device: widen type of flags and order fields to u_int Modified: stable/8/sys/kern/subr_bus.c stable/8/sys/sys/bus.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/kern/subr_bus.c ============================================================================== --- stable/8/sys/kern/subr_bus.c Mon Sep 20 05:46:15 2010 (r212888) +++ stable/8/sys/kern/subr_bus.c Mon Sep 20 05:56:09 2010 (r212889) @@ -121,7 +121,7 @@ struct device { int busy; /**< count of calls to device_busy() */ device_state_t state; /**< current device state */ u_int32_t devflags; /**< api level flags for device_get_flags() */ - u_short flags; /**< internal device flags */ + u_int flags; /**< internal device flags */ #define DF_ENABLED 1 /* device should be probed/attached */ #define DF_FIXEDCLASS 2 /* devclass specified at create time */ #define DF_WILDCARD 4 /* unit was originally wildcard */ @@ -130,8 +130,7 @@ struct device { #define DF_DONENOMATCH 32 /* don't execute DEVICE_NOMATCH again */ #define DF_EXTERNALSOFTC 64 /* softc not allocated by us */ #define DF_REBID 128 /* Can rebid after attach */ - u_char order; /**< order from device_add_child_ordered() */ - u_char pad; + u_int order; /**< order from device_add_child_ordered() */ void *ivars; /**< instance variables */ void *softc; /**< current driver's variables */ @@ -1787,12 +1786,12 @@ device_add_child(device_t dev, const cha * @returns the new device */ device_t -device_add_child_ordered(device_t dev, int order, const char *name, int unit) +device_add_child_ordered(device_t dev, u_int order, const char *name, int unit) { device_t child; device_t place; - PDEBUG(("%s at %s with order %d as unit %d", + PDEBUG(("%s at %s with order %u as unit %d", name, DEVICENAME(dev), order, unit)); child = make_device(dev, name, unit); Modified: stable/8/sys/sys/bus.h ============================================================================== --- stable/8/sys/sys/bus.h Mon Sep 20 05:46:15 2010 (r212888) +++ stable/8/sys/sys/bus.h Mon Sep 20 05:56:09 2010 (r212889) @@ -393,7 +393,7 @@ bus_alloc_resource_any(device_t dev, int * Access functions for device. */ device_t device_add_child(device_t dev, const char *name, int unit); -device_t device_add_child_ordered(device_t dev, int order, +device_t device_add_child_ordered(device_t dev, u_int order, const char *name, int unit); void device_busy(device_t dev); int device_delete_child(device_t dev, device_t child); From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 05:58:56 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 43F361065672; Mon, 20 Sep 2010 05:58:56 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 180C58FC0C; Mon, 20 Sep 2010 05:58:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8K5wtWU028783; Mon, 20 Sep 2010 05:58:55 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8K5wtZY028780; Mon, 20 Sep 2010 05:58:55 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201009200558.o8K5wtZY028780@svn.freebsd.org> From: Andriy Gapon Date: Mon, 20 Sep 2010 05:58:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212890 - in stable/7/sys: kern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 05:58:56 -0000 Author: avg Date: Mon Sep 20 05:58:55 2010 New Revision: 212890 URL: http://svn.freebsd.org/changeset/base/212890 Log: MFC r212213: struct device: widen type of flags and order fields to u_int Modified: stable/7/sys/kern/subr_bus.c stable/7/sys/sys/bus.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/kern/subr_bus.c ============================================================================== --- stable/7/sys/kern/subr_bus.c Mon Sep 20 05:56:09 2010 (r212889) +++ stable/7/sys/kern/subr_bus.c Mon Sep 20 05:58:55 2010 (r212890) @@ -117,7 +117,7 @@ struct device { int busy; /**< count of calls to device_busy() */ device_state_t state; /**< current device state */ u_int32_t devflags; /**< api level flags for device_get_flags() */ - u_short flags; /**< internal device flags */ + u_int flags; /**< internal device flags */ #define DF_ENABLED 1 /* device should be probed/attached */ #define DF_FIXEDCLASS 2 /* devclass specified at create time */ #define DF_WILDCARD 4 /* unit was originally wildcard */ @@ -126,8 +126,7 @@ struct device { #define DF_DONENOMATCH 32 /* don't execute DEVICE_NOMATCH again */ #define DF_EXTERNALSOFTC 64 /* softc not allocated by us */ #define DF_REBID 128 /* Can rebid after attach */ - u_char order; /**< order from device_add_child_ordered() */ - u_char pad; + u_int order; /**< order from device_add_child_ordered() */ void *ivars; /**< instance variables */ void *softc; /**< current driver's variables */ @@ -1573,12 +1572,12 @@ device_add_child(device_t dev, const cha * @returns the new device */ device_t -device_add_child_ordered(device_t dev, int order, const char *name, int unit) +device_add_child_ordered(device_t dev, u_int order, const char *name, int unit) { device_t child; device_t place; - PDEBUG(("%s at %s with order %d as unit %d", + PDEBUG(("%s at %s with order %u as unit %d", name, DEVICENAME(dev), order, unit)); child = make_device(dev, name, unit); Modified: stable/7/sys/sys/bus.h ============================================================================== --- stable/7/sys/sys/bus.h Mon Sep 20 05:56:09 2010 (r212889) +++ stable/7/sys/sys/bus.h Mon Sep 20 05:58:55 2010 (r212890) @@ -388,7 +388,7 @@ bus_alloc_resource_any(device_t dev, int * Access functions for device. */ device_t device_add_child(device_t dev, const char *name, int unit); -device_t device_add_child_ordered(device_t dev, int order, +device_t device_add_child_ordered(device_t dev, u_int order, const char *name, int unit); void device_busy(device_t dev); int device_delete_child(device_t dev, device_t child); From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 06:56:01 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EC05D1065675; Mon, 20 Sep 2010 06:56:01 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail09.syd.optusnet.com.au (mail09.syd.optusnet.com.au [211.29.132.190]) by mx1.freebsd.org (Postfix) with ESMTP id 6C62C8FC15; Mon, 20 Sep 2010 06:56:01 +0000 (UTC) Received: from besplex.bde.org (c122-107-116-249.carlnfd1.nsw.optusnet.com.au [122.107.116.249]) by mail09.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o8K6tvnH003125 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 20 Sep 2010 16:55:59 +1000 Date: Mon, 20 Sep 2010 16:55:57 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Marcel Moolenaar In-Reply-To: <201009200420.o8K4KtKn026514@svn.freebsd.org> Message-ID: <20100920163758.A788@besplex.bde.org> References: <201009200420.o8K4KtKn026514@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r212886 - head/sbin/growfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 06:56:02 -0000 On Mon, 20 Sep 2010, Marcel Moolenaar wrote: > Log: > Unbreak the build on strong-aligned architectures (arm, ia64). > Casting from (char *) to (struct ufs1_dinode *) changes the > alignment requirement of the pointer and GCC does not know that > the pointer is adequately aligned (due to malloc(3)), and warns > about it. Cast to (void *) first to by-pass the check. A previous version in which the pointer (iobuf) the correct type to begin with was better. It used to have type void *, but now has type caddr_t (whose existence is a bug), in order to abuse caddr_t by assuming that it is char * to do pointer arithmetic on it in 1 place (iobuf + sblock.fs_cgsize). The 7 other places where iobuf is used only assume that caddr_t is a pointer (or perhaps a [u]intptr_t). growfs has no other instances of caddr_t. Bruce From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 07:23:45 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6EF651065673; Mon, 20 Sep 2010 07:23:45 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5D1AF8FC15; Mon, 20 Sep 2010 07:23:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8K7NjBG038584; Mon, 20 Sep 2010 07:23:45 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8K7Njgh038582; Mon, 20 Sep 2010 07:23:45 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201009200723.o8K7Njgh038582@svn.freebsd.org> From: Martin Matuska Date: Mon, 20 Sep 2010 07:23:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212891 - stable/8/cddl/contrib/opensolaris/lib/libzfs/common X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 07:23:45 -0000 Author: mm Date: Mon Sep 20 07:23:45 2010 New Revision: 212891 URL: http://svn.freebsd.org/changeset/base/212891 Log: MFC r212791: Remove duplicate include of Approved by: delphij (mentor) Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Mon Sep 20 05:58:55 2010 (r212890) +++ stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Mon Sep 20 07:23:45 2010 (r212891) @@ -40,7 +40,6 @@ #include #include #include -#include #include #include "zfs_namecheck.h" From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 07:31:09 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 532D110656A8; Mon, 20 Sep 2010 07:31:09 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3D7BE8FC1F; Mon, 20 Sep 2010 07:31:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8K7V927039481; Mon, 20 Sep 2010 07:31:09 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8K7V8ju039449; Mon, 20 Sep 2010 07:31:08 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201009200731.o8K7V8ju039449@svn.freebsd.org> From: Andriy Gapon Date: Mon, 20 Sep 2010 07:31:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212892 - in stable/8/sys: amd64/amd64 arm/arm arm/xscale/ixp425 dev/acpica dev/atkbdc dev/firewire dev/iicbus dev/ofw dev/ppbus dev/siba dev/spibus i386/i386 ia64/ia64 isa kern mips/ad... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 07:31:09 -0000 Author: avg Date: Mon Sep 20 07:31:08 2010 New Revision: 212892 URL: http://svn.freebsd.org/changeset/base/212892 Log: MFC r212413: bus_add_child: change type of order parameter to u_int Modified: stable/8/sys/amd64/amd64/legacy.c stable/8/sys/amd64/amd64/nexus.c stable/8/sys/arm/arm/nexus.c stable/8/sys/arm/xscale/ixp425/ixp425.c stable/8/sys/dev/acpica/acpi.c stable/8/sys/dev/acpica/acpi_cpu.c stable/8/sys/dev/atkbdc/atkbdc_isa.c stable/8/sys/dev/firewire/firewire.c stable/8/sys/dev/firewire/fwohci_pci.c stable/8/sys/dev/iicbus/iicbus.c stable/8/sys/dev/ofw/ofw_iicbus.c stable/8/sys/dev/ppbus/ppbconf.c stable/8/sys/dev/siba/siba.c stable/8/sys/dev/spibus/spibus.c stable/8/sys/i386/i386/legacy.c stable/8/sys/i386/i386/nexus.c stable/8/sys/ia64/ia64/nexus.c stable/8/sys/isa/isa_common.c stable/8/sys/kern/bus_if.m stable/8/sys/kern/subr_bus.c stable/8/sys/mips/adm5120/obio.c stable/8/sys/mips/idt/obio.c stable/8/sys/mips/mips/mainbus.c stable/8/sys/mips/mips/nexus.c stable/8/sys/pc98/pc98/canbus.c stable/8/sys/powerpc/aim/nexus.c stable/8/sys/sparc64/sparc64/nexus.c stable/8/sys/sun4v/sun4v/nexus.c stable/8/sys/sun4v/sun4v/vnex.c stable/8/sys/sys/bus.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/amd64/amd64/legacy.c ============================================================================== --- stable/8/sys/amd64/amd64/legacy.c Mon Sep 20 07:23:45 2010 (r212891) +++ stable/8/sys/amd64/amd64/legacy.c Mon Sep 20 07:31:08 2010 (r212892) @@ -60,7 +60,7 @@ struct legacy_device { static int legacy_probe(device_t); static int legacy_attach(device_t); static int legacy_print_child(device_t, device_t); -static device_t legacy_add_child(device_t bus, int order, const char *name, +static device_t legacy_add_child(device_t bus, u_int order, const char *name, int unit); static int legacy_read_ivar(device_t, device_t, int, uintptr_t *); static int legacy_write_ivar(device_t, device_t, int, uintptr_t); @@ -149,7 +149,7 @@ legacy_print_child(device_t bus, device_ } static device_t -legacy_add_child(device_t bus, int order, const char *name, int unit) +legacy_add_child(device_t bus, u_int order, const char *name, int unit) { device_t child; struct legacy_device *atdev; @@ -213,7 +213,7 @@ legacy_write_ivar(device_t dev, device_t static void cpu_identify(driver_t *driver, device_t parent); static int cpu_read_ivar(device_t dev, device_t child, int index, uintptr_t *result); -static device_t cpu_add_child(device_t bus, int order, const char *name, +static device_t cpu_add_child(device_t bus, u_int order, const char *name, int unit); static struct resource_list *cpu_get_rlist(device_t dev, device_t child); @@ -278,7 +278,7 @@ cpu_identify(driver_t *driver, device_t } static device_t -cpu_add_child(device_t bus, int order, const char *name, int unit) +cpu_add_child(device_t bus, u_int order, const char *name, int unit) { struct cpu_device *cd; device_t child; Modified: stable/8/sys/amd64/amd64/nexus.c ============================================================================== --- stable/8/sys/amd64/amd64/nexus.c Mon Sep 20 07:23:45 2010 (r212891) +++ stable/8/sys/amd64/amd64/nexus.c Mon Sep 20 07:31:08 2010 (r212892) @@ -83,7 +83,7 @@ static int nexus_probe(device_t); static int nexus_attach(device_t); static int nexus_print_all_resources(device_t dev); static int nexus_print_child(device_t, device_t); -static device_t nexus_add_child(device_t bus, int order, const char *name, +static device_t nexus_add_child(device_t bus, u_int order, const char *name, int unit); static struct resource *nexus_alloc_resource(device_t, device_t, int, int *, u_long, u_long, u_long, u_int); @@ -293,7 +293,7 @@ nexus_print_child(device_t bus, device_t } static device_t -nexus_add_child(device_t bus, int order, const char *name, int unit) +nexus_add_child(device_t bus, u_int order, const char *name, int unit) { device_t child; struct nexus_device *ndev; Modified: stable/8/sys/arm/arm/nexus.c ============================================================================== --- stable/8/sys/arm/arm/nexus.c Mon Sep 20 07:23:45 2010 (r212891) +++ stable/8/sys/arm/arm/nexus.c Mon Sep 20 07:31:08 2010 (r212892) @@ -74,7 +74,7 @@ static struct rman mem_rman; static int nexus_probe(device_t); static int nexus_attach(device_t); static int nexus_print_child(device_t, device_t); -static device_t nexus_add_child(device_t, int, const char *, int); +static device_t nexus_add_child(device_t, u_int, const char *, int); static struct resource *nexus_alloc_resource(device_t, device_t, int, int *, u_long, u_long, u_long, u_int); static int nexus_activate_resource(device_t, device_t, int, int, @@ -165,7 +165,7 @@ nexus_print_child(device_t bus, device_t } static device_t -nexus_add_child(device_t bus, int order, const char *name, int unit) +nexus_add_child(device_t bus, u_int order, const char *name, int unit) { device_t child; struct nexus_device *ndev; Modified: stable/8/sys/arm/xscale/ixp425/ixp425.c ============================================================================== --- stable/8/sys/arm/xscale/ixp425/ixp425.c Mon Sep 20 07:23:45 2010 (r212891) +++ stable/8/sys/arm/xscale/ixp425/ixp425.c Mon Sep 20 07:31:08 2010 (r212892) @@ -369,7 +369,7 @@ ixp425_hinted_child(device_t bus, const } static device_t -ixp425_add_child(device_t dev, int order, const char *name, int unit) +ixp425_add_child(device_t dev, u_int order, const char *name, int unit) { device_t child; struct ixp425_ivar *ivar; Modified: stable/8/sys/dev/acpica/acpi.c ============================================================================== --- stable/8/sys/dev/acpica/acpi.c Mon Sep 20 07:23:45 2010 (r212891) +++ stable/8/sys/dev/acpica/acpi.c Mon Sep 20 07:31:08 2010 (r212892) @@ -105,7 +105,7 @@ static int acpi_attach(device_t dev); static int acpi_suspend(device_t dev); static int acpi_resume(device_t dev); static int acpi_shutdown(device_t dev); -static device_t acpi_add_child(device_t bus, int order, const char *name, +static device_t acpi_add_child(device_t bus, u_int order, const char *name, int unit); static int acpi_print_child(device_t bus, device_t child); static void acpi_probe_nomatch(device_t bus, device_t child); @@ -784,7 +784,7 @@ acpi_shutdown(device_t dev) * Handle a new device being added */ static device_t -acpi_add_child(device_t bus, int order, const char *name, int unit) +acpi_add_child(device_t bus, u_int order, const char *name, int unit) { struct acpi_device *ad; device_t child; Modified: stable/8/sys/dev/acpica/acpi_cpu.c ============================================================================== --- stable/8/sys/dev/acpica/acpi_cpu.c Mon Sep 20 07:23:45 2010 (r212891) +++ stable/8/sys/dev/acpica/acpi_cpu.c Mon Sep 20 07:31:08 2010 (r212892) @@ -148,7 +148,7 @@ static int acpi_cpu_resume(device_t dev) static int acpi_pcpu_get_id(uint32_t idx, uint32_t *acpi_id, uint32_t *cpu_id); static struct resource_list *acpi_cpu_get_rlist(device_t dev, device_t child); -static device_t acpi_cpu_add_child(device_t dev, int order, const char *name, +static device_t acpi_cpu_add_child(device_t dev, u_int order, const char *name, int unit); static int acpi_cpu_read_ivar(device_t dev, device_t child, int index, uintptr_t *result); @@ -481,7 +481,7 @@ acpi_cpu_get_rlist(device_t dev, device_ } static device_t -acpi_cpu_add_child(device_t dev, int order, const char *name, int unit) +acpi_cpu_add_child(device_t dev, u_int order, const char *name, int unit) { struct acpi_cpu_device *ad; device_t child; Modified: stable/8/sys/dev/atkbdc/atkbdc_isa.c ============================================================================== --- stable/8/sys/dev/atkbdc/atkbdc_isa.c Mon Sep 20 07:23:45 2010 (r212891) +++ stable/8/sys/dev/atkbdc/atkbdc_isa.c Mon Sep 20 07:31:08 2010 (r212892) @@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$"); static int atkbdc_isa_probe(device_t dev); static int atkbdc_isa_attach(device_t dev); -static device_t atkbdc_isa_add_child(device_t bus, int order, const char *name, +static device_t atkbdc_isa_add_child(device_t bus, u_int order, const char *name, int unit); static device_method_t atkbdc_isa_methods[] = { @@ -227,7 +227,7 @@ atkbdc_isa_attach(device_t dev) } static device_t -atkbdc_isa_add_child(device_t bus, int order, const char *name, int unit) +atkbdc_isa_add_child(device_t bus, u_int order, const char *name, int unit) { atkbdc_device_t *ivar; device_t child; Modified: stable/8/sys/dev/firewire/firewire.c ============================================================================== --- stable/8/sys/dev/firewire/firewire.c Mon Sep 20 07:23:45 2010 (r212891) +++ stable/8/sys/dev/firewire/firewire.c Mon Sep 20 07:31:08 2010 (r212892) @@ -102,7 +102,7 @@ static void firewire_xfer_timeout(void * #if 0 static int firewire_shutdown (device_t); #endif -static device_t firewire_add_child (device_t, int, const char *, int); +static device_t firewire_add_child(device_t, u_int, const char *, int); static void fw_try_bmr (void *); static void fw_try_bmr_callback (struct fw_xfer *); static void fw_asystart (struct fw_xfer *); @@ -488,7 +488,7 @@ firewire_attach(device_t dev) * Attach it as child. */ static device_t -firewire_add_child(device_t dev, int order, const char *name, int unit) +firewire_add_child(device_t dev, u_int order, const char *name, int unit) { device_t child; struct firewire_softc *sc; Modified: stable/8/sys/dev/firewire/fwohci_pci.c ============================================================================== --- stable/8/sys/dev/firewire/fwohci_pci.c Mon Sep 20 07:23:45 2010 (r212891) +++ stable/8/sys/dev/firewire/fwohci_pci.c Mon Sep 20 07:31:08 2010 (r212892) @@ -487,7 +487,7 @@ fwohci_pci_shutdown(device_t dev) } static device_t -fwohci_pci_add_child(device_t dev, int order, const char *name, int unit) +fwohci_pci_add_child(device_t dev, u_int order, const char *name, int unit) { struct fwohci_softc *sc; device_t child; Modified: stable/8/sys/dev/iicbus/iicbus.c ============================================================================== --- stable/8/sys/dev/iicbus/iicbus.c Mon Sep 20 07:23:45 2010 (r212891) +++ stable/8/sys/dev/iicbus/iicbus.c Mon Sep 20 07:31:08 2010 (r212892) @@ -188,7 +188,7 @@ iicbus_read_ivar(device_t bus, device_t } static device_t -iicbus_add_child(device_t dev, int order, const char *name, int unit) +iicbus_add_child(device_t dev, u_int order, const char *name, int unit) { device_t child; struct iicbus_ivar *devi; Modified: stable/8/sys/dev/ofw/ofw_iicbus.c ============================================================================== --- stable/8/sys/dev/ofw/ofw_iicbus.c Mon Sep 20 07:23:45 2010 (r212891) +++ stable/8/sys/dev/ofw/ofw_iicbus.c Mon Sep 20 07:31:08 2010 (r212892) @@ -46,8 +46,8 @@ __FBSDID("$FreeBSD$"); /* Methods */ static device_probe_t ofw_iicbus_probe; static device_attach_t ofw_iicbus_attach; -static device_t ofw_iicbus_add_child(device_t dev, int order, const char *name, - int unit); +static device_t ofw_iicbus_add_child(device_t dev, u_int order, + const char *name, int unit); static const struct ofw_bus_devinfo *ofw_iicbus_get_devinfo(device_t bus, device_t dev); @@ -147,7 +147,7 @@ ofw_iicbus_attach(device_t dev) } static device_t -ofw_iicbus_add_child(device_t dev, int order, const char *name, int unit) +ofw_iicbus_add_child(device_t dev, u_int order, const char *name, int unit) { device_t child; struct ofw_iicbus_devinfo *devi; Modified: stable/8/sys/dev/ppbus/ppbconf.c ============================================================================== --- stable/8/sys/dev/ppbus/ppbconf.c Mon Sep 20 07:23:45 2010 (r212891) +++ stable/8/sys/dev/ppbus/ppbconf.c Mon Sep 20 07:31:08 2010 (r212892) @@ -90,7 +90,7 @@ ppbus_probe(device_t dev) * Add a ppbus device, allocate/initialize the ivars */ static device_t -ppbus_add_child(device_t dev, int order, const char *name, int unit) +ppbus_add_child(device_t dev, u_int order, const char *name, int unit) { struct ppb_device *ppbdev; device_t child; Modified: stable/8/sys/dev/siba/siba.c ============================================================================== --- stable/8/sys/dev/siba/siba.c Mon Sep 20 07:23:45 2010 (r212891) +++ stable/8/sys/dev/siba/siba.c Mon Sep 20 07:31:08 2010 (r212892) @@ -90,7 +90,7 @@ static struct siba_devid siba_devids[] = static int siba_activate_resource(device_t, device_t, int, int, struct resource *); -static device_t siba_add_child(device_t, int, const char *, int); +static device_t siba_add_child(device_t, u_int, const char *, int); static struct resource * siba_alloc_resource(device_t, device_t, int, int *, u_long, u_long, u_long, u_int); @@ -505,7 +505,7 @@ siba_destroy_devinfo(struct siba_devinfo /* XXX is this needed? */ static device_t -siba_add_child(device_t dev, int order, const char *name, int unit) +siba_add_child(device_t dev, u_int order, const char *name, int unit) { #if 1 Modified: stable/8/sys/dev/spibus/spibus.c ============================================================================== --- stable/8/sys/dev/spibus/spibus.c Mon Sep 20 07:23:45 2010 (r212891) +++ stable/8/sys/dev/spibus/spibus.c Mon Sep 20 07:31:08 2010 (r212892) @@ -127,7 +127,7 @@ spibus_read_ivar(device_t bus, device_t } static device_t -spibus_add_child(device_t dev, int order, const char *name, int unit) +spibus_add_child(device_t dev, u_int order, const char *name, int unit) { device_t child; struct spibus_ivar *devi; Modified: stable/8/sys/i386/i386/legacy.c ============================================================================== --- stable/8/sys/i386/i386/legacy.c Mon Sep 20 07:23:45 2010 (r212891) +++ stable/8/sys/i386/i386/legacy.c Mon Sep 20 07:31:08 2010 (r212892) @@ -65,7 +65,7 @@ struct legacy_device { static int legacy_probe(device_t); static int legacy_attach(device_t); static int legacy_print_child(device_t, device_t); -static device_t legacy_add_child(device_t bus, int order, const char *name, +static device_t legacy_add_child(device_t bus, u_int order, const char *name, int unit); static int legacy_read_ivar(device_t, device_t, int, uintptr_t *); static int legacy_write_ivar(device_t, device_t, int, uintptr_t); @@ -170,7 +170,7 @@ legacy_print_child(device_t bus, device_ } static device_t -legacy_add_child(device_t bus, int order, const char *name, int unit) +legacy_add_child(device_t bus, u_int order, const char *name, int unit) { device_t child; struct legacy_device *atdev; @@ -234,7 +234,7 @@ legacy_write_ivar(device_t dev, device_t static void cpu_identify(driver_t *driver, device_t parent); static int cpu_read_ivar(device_t dev, device_t child, int index, uintptr_t *result); -static device_t cpu_add_child(device_t bus, int order, const char *name, +static device_t cpu_add_child(device_t bus, u_int order, const char *name, int unit); static struct resource_list *cpu_get_rlist(device_t dev, device_t child); @@ -299,7 +299,7 @@ cpu_identify(driver_t *driver, device_t } static device_t -cpu_add_child(device_t bus, int order, const char *name, int unit) +cpu_add_child(device_t bus, u_int order, const char *name, int unit) { struct cpu_device *cd; device_t child; Modified: stable/8/sys/i386/i386/nexus.c ============================================================================== --- stable/8/sys/i386/i386/nexus.c Mon Sep 20 07:23:45 2010 (r212891) +++ stable/8/sys/i386/i386/nexus.c Mon Sep 20 07:31:08 2010 (r212892) @@ -87,7 +87,7 @@ static int nexus_probe(device_t); static int nexus_attach(device_t); static int nexus_print_all_resources(device_t dev); static int nexus_print_child(device_t, device_t); -static device_t nexus_add_child(device_t bus, int order, const char *name, +static device_t nexus_add_child(device_t bus, u_int order, const char *name, int unit); static struct resource *nexus_alloc_resource(device_t, device_t, int, int *, u_long, u_long, u_long, u_int); @@ -305,7 +305,7 @@ nexus_print_child(device_t bus, device_t } static device_t -nexus_add_child(device_t bus, int order, const char *name, int unit) +nexus_add_child(device_t bus, u_int order, const char *name, int unit) { device_t child; struct nexus_device *ndev; Modified: stable/8/sys/ia64/ia64/nexus.c ============================================================================== --- stable/8/sys/ia64/ia64/nexus.c Mon Sep 20 07:23:45 2010 (r212891) +++ stable/8/sys/ia64/ia64/nexus.c Mon Sep 20 07:31:08 2010 (r212892) @@ -82,7 +82,7 @@ static struct rman irq_rman, port_rman, static int nexus_probe(device_t); static int nexus_attach(device_t); static int nexus_print_child(device_t, device_t); -static device_t nexus_add_child(device_t bus, int order, const char *name, +static device_t nexus_add_child(device_t bus, u_int order, const char *name, int unit); static struct resource *nexus_alloc_resource(device_t, device_t, int, int *, u_long, u_long, u_long, u_int); @@ -220,7 +220,7 @@ nexus_print_child(device_t bus, device_t } static device_t -nexus_add_child(device_t bus, int order, const char *name, int unit) +nexus_add_child(device_t bus, u_int order, const char *name, int unit) { device_t child; struct nexus_device *ndev; Modified: stable/8/sys/isa/isa_common.c ============================================================================== --- stable/8/sys/isa/isa_common.c Mon Sep 20 07:23:45 2010 (r212891) +++ stable/8/sys/isa/isa_common.c Mon Sep 20 07:31:08 2010 (r212892) @@ -597,7 +597,7 @@ isa_probe_children(device_t dev) * Add a new child with default ivars. */ static device_t -isa_add_child(device_t dev, int order, const char *name, int unit) +isa_add_child(device_t dev, u_int order, const char *name, int unit) { device_t child; struct isa_device *idev; Modified: stable/8/sys/kern/bus_if.m ============================================================================== --- stable/8/sys/kern/bus_if.m Mon Sep 20 07:23:45 2010 (r212891) +++ stable/8/sys/kern/bus_if.m Mon Sep 20 07:31:08 2010 (r212892) @@ -191,7 +191,7 @@ METHOD void driver_added { */ METHOD device_t add_child { device_t _dev; - int _order; + u_int _order; const char *_name; int _unit; }; Modified: stable/8/sys/kern/subr_bus.c ============================================================================== --- stable/8/sys/kern/subr_bus.c Mon Sep 20 07:23:45 2010 (r212891) +++ stable/8/sys/kern/subr_bus.c Mon Sep 20 07:31:08 2010 (r212892) @@ -3128,7 +3128,7 @@ resource_list_purge(struct resource_list } device_t -bus_generic_add_child(device_t dev, int order, const char *name, int unit) +bus_generic_add_child(device_t dev, u_int order, const char *name, int unit) { return (device_add_child_ordered(dev, order, name, unit)); Modified: stable/8/sys/mips/adm5120/obio.c ============================================================================== --- stable/8/sys/mips/adm5120/obio.c Mon Sep 20 07:23:45 2010 (r212891) +++ stable/8/sys/mips/adm5120/obio.c Mon Sep 20 07:31:08 2010 (r212892) @@ -101,7 +101,7 @@ int irq_priorities[NIRQS] = { static int obio_activate_resource(device_t, device_t, int, int, struct resource *); -static device_t obio_add_child(device_t, int, const char *, int); +static device_t obio_add_child(device_t, u_int, const char *, int); static struct resource * obio_alloc_resource(device_t, device_t, int, int *, u_long, u_long, u_long, u_int); @@ -437,7 +437,7 @@ obio_hinted_child(device_t bus, const ch } static device_t -obio_add_child(device_t bus, int order, const char *name, int unit) +obio_add_child(device_t bus, u_int order, const char *name, int unit) { device_t child; struct obio_ivar *ivar; Modified: stable/8/sys/mips/idt/obio.c ============================================================================== --- stable/8/sys/mips/idt/obio.c Mon Sep 20 07:23:45 2010 (r212891) +++ stable/8/sys/mips/idt/obio.c Mon Sep 20 07:31:08 2010 (r212892) @@ -57,7 +57,7 @@ __FBSDID("$FreeBSD$"); static int obio_activate_resource(device_t, device_t, int, int, struct resource *); -static device_t obio_add_child(device_t, int, const char *, int); +static device_t obio_add_child(device_t, u_int, const char *, int); static struct resource * obio_alloc_resource(device_t, device_t, int, int *, u_long, u_long, u_long, u_int); @@ -418,7 +418,7 @@ obio_hinted_child(device_t bus, const ch } static device_t -obio_add_child(device_t bus, int order, const char *name, int unit) +obio_add_child(device_t bus, u_int order, const char *name, int unit) { device_t child; struct obio_ivar *ivar; Modified: stable/8/sys/mips/mips/mainbus.c ============================================================================== --- stable/8/sys/mips/mips/mainbus.c Mon Sep 20 07:23:45 2010 (r212891) +++ stable/8/sys/mips/mips/mainbus.c Mon Sep 20 07:31:08 2010 (r212892) @@ -65,7 +65,7 @@ static struct rman irq_rman, port_rman, static int mainbus_probe(device_t); static int mainbus_attach(device_t); static int mainbus_print_child(device_t, device_t); -static device_t mainbus_add_child(device_t bus, int order, const char *name, +static device_t mainbus_add_child(device_t bus, u_int order, const char *name, int unit); static struct resource *mainbus_alloc_resource(device_t, device_t, int, int *, u_long, u_long, u_long, u_int); @@ -176,7 +176,7 @@ mainbus_print_child(device_t bus, device } static device_t -mainbus_add_child(device_t bus, int order, const char *name, int unit) +mainbus_add_child(device_t bus, u_int order, const char *name, int unit) { return device_add_child_ordered(bus, order, name, unit); } Modified: stable/8/sys/mips/mips/nexus.c ============================================================================== --- stable/8/sys/mips/mips/nexus.c Mon Sep 20 07:23:45 2010 (r212891) +++ stable/8/sys/mips/mips/nexus.c Mon Sep 20 07:31:08 2010 (r212892) @@ -96,7 +96,7 @@ static struct resource * u_long, u_long, u_int); static int nexus_activate_resource(device_t, device_t, int, int, struct resource *); -static device_t nexus_add_child(device_t, int, const char *, int); +static device_t nexus_add_child(device_t, u_int, const char *, int); static int nexus_attach(device_t); static int nexus_deactivate_resource(device_t, device_t, int, int, struct resource *); @@ -271,7 +271,7 @@ nexus_hinted_child(device_t bus, const c } static device_t -nexus_add_child(device_t bus, int order, const char *name, int unit) +nexus_add_child(device_t bus, u_int order, const char *name, int unit) { device_t child; struct nexus_device *ndev; Modified: stable/8/sys/pc98/pc98/canbus.c ============================================================================== --- stable/8/sys/pc98/pc98/canbus.c Mon Sep 20 07:23:45 2010 (r212891) +++ stable/8/sys/pc98/pc98/canbus.c Mon Sep 20 07:31:08 2010 (r212892) @@ -82,7 +82,7 @@ static int canbus_detach(device_t); /* Bus interface methods */ static int canbus_print_child(device_t, device_t); -static device_t canbus_add_child(device_t, int, const char *, int); +static device_t canbus_add_child(device_t, u_int, const char *, int); static struct resource * canbus_alloc_resource( device_t, device_t, int, int *, u_long, u_long, u_long, u_int); static int canbus_activate_resource( @@ -235,7 +235,7 @@ canbus_print_child(device_t dev, device_ } static device_t -canbus_add_child(device_t bus, int order, const char *name, int unit) +canbus_add_child(device_t bus, u_int order, const char *name, int unit) { device_t child; struct canbus_device *cbdev; Modified: stable/8/sys/powerpc/aim/nexus.c ============================================================================== --- stable/8/sys/powerpc/aim/nexus.c Mon Sep 20 07:23:45 2010 (r212891) +++ stable/8/sys/powerpc/aim/nexus.c Mon Sep 20 07:31:08 2010 (r212892) @@ -117,7 +117,7 @@ static int nexus_attach(device_t); /* * Bus interface */ -static device_t nexus_add_child(device_t, int, const char *, int); +static device_t nexus_add_child(device_t, u_int, const char *, int); static void nexus_probe_nomatch(device_t, device_t); static int nexus_read_ivar(device_t, device_t, int, uintptr_t *); static int nexus_write_ivar(device_t, device_t, int, uintptr_t); @@ -264,7 +264,7 @@ nexus_probe_nomatch(device_t dev, device } static device_t -nexus_add_child(device_t dev, int order, const char *name, int unit) +nexus_add_child(device_t dev, u_int order, const char *name, int unit) { device_t child; struct nexus_devinfo *dinfo; Modified: stable/8/sys/sparc64/sparc64/nexus.c ============================================================================== --- stable/8/sys/sparc64/sparc64/nexus.c Mon Sep 20 07:23:45 2010 (r212891) +++ stable/8/sys/sparc64/sparc64/nexus.c Mon Sep 20 07:31:08 2010 (r212892) @@ -258,7 +258,7 @@ nexus_attach(device_t dev) } static device_t -nexus_add_child(device_t dev, int order, const char *name, int unit) +nexus_add_child(device_t dev, u_int order, const char *name, int unit) { device_t cdev; struct nexus_devinfo *ndi; Modified: stable/8/sys/sun4v/sun4v/nexus.c ============================================================================== --- stable/8/sys/sun4v/sun4v/nexus.c Mon Sep 20 07:23:45 2010 (r212891) +++ stable/8/sys/sun4v/sun4v/nexus.c Mon Sep 20 07:31:08 2010 (r212892) @@ -234,7 +234,7 @@ nexus_attach(device_t dev) } static device_t -nexus_add_child(device_t dev, int order, const char *name, int unit) +nexus_add_child(device_t dev, u_int order, const char *name, int unit) { device_t cdev; struct nexus_devinfo *ndi; Modified: stable/8/sys/sun4v/sun4v/vnex.c ============================================================================== --- stable/8/sys/sun4v/sun4v/vnex.c Mon Sep 20 07:23:45 2010 (r212891) +++ stable/8/sys/sun4v/sun4v/vnex.c Mon Sep 20 07:31:08 2010 (r212892) @@ -204,7 +204,7 @@ vnex_attach(device_t dev) } static device_t -vnex_add_child(device_t dev, int order, const char *name, int unit) +vnex_add_child(device_t dev, u_int order, const char *name, int unit) { device_t cdev; struct vnex_devinfo *vndi; Modified: stable/8/sys/sys/bus.h ============================================================================== --- stable/8/sys/sys/bus.h Mon Sep 20 07:23:45 2010 (r212891) +++ stable/8/sys/sys/bus.h Mon Sep 20 07:31:08 2010 (r212892) @@ -283,7 +283,7 @@ void root_bus_configure(void); int bus_generic_activate_resource(device_t dev, device_t child, int type, int rid, struct resource *r); device_t - bus_generic_add_child(device_t dev, int order, const char *name, + bus_generic_add_child(device_t dev, u_int order, const char *name, int unit); struct resource * bus_generic_alloc_resource(device_t bus, device_t child, int type, From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 11:09:31 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B4E0B1065679; Mon, 20 Sep 2010 11:09:31 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9F8A58FC1C; Mon, 20 Sep 2010 11:09:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KB9VeI049570; Mon, 20 Sep 2010 11:09:31 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KB9Vj8049546; Mon, 20 Sep 2010 11:09:31 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201009201109.o8KB9Vj8049546@svn.freebsd.org> From: Andriy Gapon Date: Mon, 20 Sep 2010 11:09:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212893 - in stable/7/sys: amd64/amd64 arm/arm arm/xscale/ixp425 dev/acpica dev/atkbdc dev/firewire dev/iicbus dev/ppbus dev/spibus i386/i386 ia64/ia64 isa kern pc98/pc98 sparc64/sparc6... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 11:09:31 -0000 Author: avg Date: Mon Sep 20 11:09:31 2010 New Revision: 212893 URL: http://svn.freebsd.org/changeset/base/212893 Log: MFC r212413: bus_add_child: change type of order parameter to u_int Modified: stable/7/sys/amd64/amd64/legacy.c stable/7/sys/amd64/amd64/nexus.c stable/7/sys/arm/arm/nexus.c stable/7/sys/arm/xscale/ixp425/ixp425.c stable/7/sys/dev/acpica/acpi.c stable/7/sys/dev/acpica/acpi_cpu.c stable/7/sys/dev/atkbdc/atkbdc_isa.c stable/7/sys/dev/firewire/firewire.c stable/7/sys/dev/firewire/fwohci_pci.c stable/7/sys/dev/iicbus/iicbus.c stable/7/sys/dev/ppbus/ppbconf.c stable/7/sys/dev/spibus/spibus.c stable/7/sys/i386/i386/legacy.c stable/7/sys/i386/i386/nexus.c stable/7/sys/ia64/ia64/nexus.c stable/7/sys/isa/isa_common.c stable/7/sys/kern/bus_if.m stable/7/sys/kern/subr_bus.c stable/7/sys/pc98/pc98/canbus.c stable/7/sys/sparc64/sparc64/nexus.c stable/7/sys/sun4v/sun4v/nexus.c stable/7/sys/sun4v/sun4v/vnex.c stable/7/sys/sys/bus.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/amd64/amd64/legacy.c ============================================================================== --- stable/7/sys/amd64/amd64/legacy.c Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/amd64/amd64/legacy.c Mon Sep 20 11:09:31 2010 (r212893) @@ -61,7 +61,7 @@ static void legacy_identify(driver_t *dr static int legacy_probe(device_t); static int legacy_attach(device_t); static int legacy_print_child(device_t, device_t); -static device_t legacy_add_child(device_t bus, int order, const char *name, +static device_t legacy_add_child(device_t bus, u_int order, const char *name, int unit); static int legacy_read_ivar(device_t, device_t, int, uintptr_t *); static int legacy_write_ivar(device_t, device_t, int, uintptr_t); @@ -170,7 +170,7 @@ legacy_print_child(device_t bus, device_ } static device_t -legacy_add_child(device_t bus, int order, const char *name, int unit) +legacy_add_child(device_t bus, u_int order, const char *name, int unit) { device_t child; struct legacy_device *atdev; @@ -234,7 +234,7 @@ legacy_write_ivar(device_t dev, device_t static void cpu_identify(driver_t *driver, device_t parent); static int cpu_read_ivar(device_t dev, device_t child, int index, uintptr_t *result); -static device_t cpu_add_child(device_t bus, int order, const char *name, +static device_t cpu_add_child(device_t bus, u_int order, const char *name, int unit); static struct resource_list *cpu_get_rlist(device_t dev, device_t child); @@ -299,7 +299,7 @@ cpu_identify(driver_t *driver, device_t } static device_t -cpu_add_child(device_t bus, int order, const char *name, int unit) +cpu_add_child(device_t bus, u_int order, const char *name, int unit) { struct cpu_device *cd; device_t child; Modified: stable/7/sys/amd64/amd64/nexus.c ============================================================================== --- stable/7/sys/amd64/amd64/nexus.c Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/amd64/amd64/nexus.c Mon Sep 20 11:09:31 2010 (r212893) @@ -85,7 +85,7 @@ static int nexus_probe(device_t); static int nexus_attach(device_t); static int nexus_print_all_resources(device_t dev); static int nexus_print_child(device_t, device_t); -static device_t nexus_add_child(device_t bus, int order, const char *name, +static device_t nexus_add_child(device_t bus, u_int order, const char *name, int unit); static struct resource *nexus_alloc_resource(device_t, device_t, int, int *, u_long, u_long, u_long, u_int); @@ -286,7 +286,7 @@ nexus_print_child(device_t bus, device_t } static device_t -nexus_add_child(device_t bus, int order, const char *name, int unit) +nexus_add_child(device_t bus, u_int order, const char *name, int unit) { device_t child; struct nexus_device *ndev; Modified: stable/7/sys/arm/arm/nexus.c ============================================================================== --- stable/7/sys/arm/arm/nexus.c Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/arm/arm/nexus.c Mon Sep 20 11:09:31 2010 (r212893) @@ -74,7 +74,7 @@ static struct rman mem_rman; static int nexus_probe(device_t); static int nexus_attach(device_t); static int nexus_print_child(device_t, device_t); -static device_t nexus_add_child(device_t, int, const char *, int); +static device_t nexus_add_child(device_t, u_int, const char *, int); static struct resource *nexus_alloc_resource(device_t, device_t, int, int *, u_long, u_long, u_long, u_int); static int nexus_activate_resource(device_t, device_t, int, int, @@ -176,7 +176,7 @@ nexus_print_child(device_t bus, device_t static device_t -nexus_add_child(device_t bus, int order, const char *name, int unit) +nexus_add_child(device_t bus, u_int order, const char *name, int unit) { device_t child; struct nexus_device *ndev; Modified: stable/7/sys/arm/xscale/ixp425/ixp425.c ============================================================================== --- stable/7/sys/arm/xscale/ixp425/ixp425.c Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/arm/xscale/ixp425/ixp425.c Mon Sep 20 11:09:31 2010 (r212893) @@ -271,7 +271,7 @@ ixp425_hinted_child(device_t bus, const } static device_t -ixp425_add_child(device_t dev, int order, const char *name, int unit) +ixp425_add_child(device_t dev, u_int order, const char *name, int unit) { device_t child; struct ixp425_ivar *ivar; Modified: stable/7/sys/dev/acpica/acpi.c ============================================================================== --- stable/7/sys/dev/acpica/acpi.c Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/dev/acpica/acpi.c Mon Sep 20 11:09:31 2010 (r212893) @@ -100,7 +100,7 @@ static int acpi_attach(device_t dev); static int acpi_suspend(device_t dev); static int acpi_resume(device_t dev); static int acpi_shutdown(device_t dev); -static device_t acpi_add_child(device_t bus, int order, const char *name, +static device_t acpi_add_child(device_t bus, u_int order, const char *name, int unit); static int acpi_print_child(device_t bus, device_t child); static void acpi_probe_nomatch(device_t bus, device_t child); @@ -744,7 +744,7 @@ acpi_shutdown(device_t dev) * Handle a new device being added */ static device_t -acpi_add_child(device_t bus, int order, const char *name, int unit) +acpi_add_child(device_t bus, u_int order, const char *name, int unit) { struct acpi_device *ad; device_t child; Modified: stable/7/sys/dev/acpica/acpi_cpu.c ============================================================================== --- stable/7/sys/dev/acpica/acpi_cpu.c Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/dev/acpica/acpi_cpu.c Mon Sep 20 11:09:31 2010 (r212893) @@ -146,7 +146,7 @@ static int acpi_cpu_resume(device_t dev) static int acpi_pcpu_get_id(uint32_t idx, uint32_t *acpi_id, uint32_t *cpu_id); static struct resource_list *acpi_cpu_get_rlist(device_t dev, device_t child); -static device_t acpi_cpu_add_child(device_t dev, int order, const char *name, +static device_t acpi_cpu_add_child(device_t dev, u_int order, const char *name, int unit); static int acpi_cpu_read_ivar(device_t dev, device_t child, int index, uintptr_t *result); @@ -460,7 +460,7 @@ acpi_cpu_get_rlist(device_t dev, device_ } static device_t -acpi_cpu_add_child(device_t dev, int order, const char *name, int unit) +acpi_cpu_add_child(device_t dev, u_int order, const char *name, int unit) { struct acpi_cpu_device *ad; device_t child; Modified: stable/7/sys/dev/atkbdc/atkbdc_isa.c ============================================================================== --- stable/7/sys/dev/atkbdc/atkbdc_isa.c Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/dev/atkbdc/atkbdc_isa.c Mon Sep 20 11:09:31 2010 (r212893) @@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$"); static int atkbdc_isa_probe(device_t dev); static int atkbdc_isa_attach(device_t dev); -static device_t atkbdc_isa_add_child(device_t bus, int order, char *name, +static device_t atkbdc_isa_add_child(device_t bus, u_int order, char *name, int unit); static device_method_t atkbdc_isa_methods[] = { @@ -227,7 +227,7 @@ atkbdc_isa_attach(device_t dev) } static device_t -atkbdc_isa_add_child(device_t bus, int order, char *name, int unit) +atkbdc_isa_add_child(device_t bus, u_int order, char *name, int unit) { atkbdc_device_t *ivar; device_t child; Modified: stable/7/sys/dev/firewire/firewire.c ============================================================================== --- stable/7/sys/dev/firewire/firewire.c Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/dev/firewire/firewire.c Mon Sep 20 11:09:31 2010 (r212893) @@ -101,7 +101,7 @@ static void firewire_xfer_timeout(void * #if 0 static int firewire_shutdown (device_t); #endif -static device_t firewire_add_child (device_t, int, const char *, int); +static device_t firewire_add_child(device_t, u_int, const char *, int); static void fw_try_bmr (void *); static void fw_try_bmr_callback (struct fw_xfer *); static void fw_asystart (struct fw_xfer *); @@ -460,7 +460,7 @@ firewire_attach(device_t dev) * Attach it as child. */ static device_t -firewire_add_child(device_t dev, int order, const char *name, int unit) +firewire_add_child(device_t dev, u_int order, const char *name, int unit) { device_t child; struct firewire_softc *sc; Modified: stable/7/sys/dev/firewire/fwohci_pci.c ============================================================================== --- stable/7/sys/dev/firewire/fwohci_pci.c Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/dev/firewire/fwohci_pci.c Mon Sep 20 11:09:31 2010 (r212893) @@ -490,7 +490,7 @@ fwohci_pci_shutdown(device_t dev) } static device_t -fwohci_pci_add_child(device_t dev, int order, const char *name, int unit) +fwohci_pci_add_child(device_t dev, u_int order, const char *name, int unit) { struct fwohci_softc *sc; device_t child; Modified: stable/7/sys/dev/iicbus/iicbus.c ============================================================================== --- stable/7/sys/dev/iicbus/iicbus.c Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/dev/iicbus/iicbus.c Mon Sep 20 11:09:31 2010 (r212893) @@ -186,7 +186,7 @@ iicbus_read_ivar(device_t bus, device_t } static device_t -iicbus_add_child(device_t dev, int order, const char *name, int unit) +iicbus_add_child(device_t dev, u_int order, const char *name, int unit) { device_t child; struct iicbus_ivar *devi; Modified: stable/7/sys/dev/ppbus/ppbconf.c ============================================================================== --- stable/7/sys/dev/ppbus/ppbconf.c Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/dev/ppbus/ppbconf.c Mon Sep 20 11:09:31 2010 (r212893) @@ -85,7 +85,7 @@ ppbus_probe(device_t dev) * Add a ppbus device, allocate/initialize the ivars */ static device_t -ppbus_add_child(device_t dev, int order, const char *name, int unit) +ppbus_add_child(device_t dev, u_int order, const char *name, int unit) { struct ppb_device *ppbdev; device_t child; Modified: stable/7/sys/dev/spibus/spibus.c ============================================================================== --- stable/7/sys/dev/spibus/spibus.c Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/dev/spibus/spibus.c Mon Sep 20 11:09:31 2010 (r212893) @@ -127,7 +127,7 @@ spibus_read_ivar(device_t bus, device_t } static device_t -spibus_add_child(device_t dev, int order, const char *name, int unit) +spibus_add_child(device_t dev, u_int order, const char *name, int unit) { device_t child; struct spibus_ivar *devi; Modified: stable/7/sys/i386/i386/legacy.c ============================================================================== --- stable/7/sys/i386/i386/legacy.c Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/i386/i386/legacy.c Mon Sep 20 11:09:31 2010 (r212893) @@ -66,7 +66,7 @@ static void legacy_identify(driver_t *dr static int legacy_probe(device_t); static int legacy_attach(device_t); static int legacy_print_child(device_t, device_t); -static device_t legacy_add_child(device_t bus, int order, const char *name, +static device_t legacy_add_child(device_t bus, u_int order, const char *name, int unit); static int legacy_read_ivar(device_t, device_t, int, uintptr_t *); static int legacy_write_ivar(device_t, device_t, int, uintptr_t); @@ -191,7 +191,7 @@ legacy_print_child(device_t bus, device_ } static device_t -legacy_add_child(device_t bus, int order, const char *name, int unit) +legacy_add_child(device_t bus, u_int order, const char *name, int unit) { device_t child; struct legacy_device *atdev; @@ -255,7 +255,7 @@ legacy_write_ivar(device_t dev, device_t static void cpu_identify(driver_t *driver, device_t parent); static int cpu_read_ivar(device_t dev, device_t child, int index, uintptr_t *result); -static device_t cpu_add_child(device_t bus, int order, const char *name, +static device_t cpu_add_child(device_t bus, u_int order, const char *name, int unit); static struct resource_list *cpu_get_rlist(device_t dev, device_t child); @@ -320,7 +320,7 @@ cpu_identify(driver_t *driver, device_t } static device_t -cpu_add_child(device_t bus, int order, const char *name, int unit) +cpu_add_child(device_t bus, u_int order, const char *name, int unit) { struct cpu_device *cd; device_t child; Modified: stable/7/sys/i386/i386/nexus.c ============================================================================== --- stable/7/sys/i386/i386/nexus.c Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/i386/i386/nexus.c Mon Sep 20 11:09:31 2010 (r212893) @@ -89,7 +89,7 @@ static int nexus_probe(device_t); static int nexus_attach(device_t); static int nexus_print_all_resources(device_t dev); static int nexus_print_child(device_t, device_t); -static device_t nexus_add_child(device_t bus, int order, const char *name, +static device_t nexus_add_child(device_t bus, u_int order, const char *name, int unit); static struct resource *nexus_alloc_resource(device_t, device_t, int, int *, u_long, u_long, u_long, u_int); @@ -298,7 +298,7 @@ nexus_print_child(device_t bus, device_t } static device_t -nexus_add_child(device_t bus, int order, const char *name, int unit) +nexus_add_child(device_t bus, u_int order, const char *name, int unit) { device_t child; struct nexus_device *ndev; Modified: stable/7/sys/ia64/ia64/nexus.c ============================================================================== --- stable/7/sys/ia64/ia64/nexus.c Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/ia64/ia64/nexus.c Mon Sep 20 11:09:31 2010 (r212893) @@ -76,7 +76,7 @@ static struct rman irq_rman, drq_rman, p static int nexus_probe(device_t); static int nexus_attach(device_t); static int nexus_print_child(device_t, device_t); -static device_t nexus_add_child(device_t bus, int order, const char *name, +static device_t nexus_add_child(device_t bus, u_int order, const char *name, int unit); static struct resource *nexus_alloc_resource(device_t, device_t, int, int *, u_long, u_long, u_long, u_int); @@ -248,7 +248,7 @@ nexus_print_child(device_t bus, device_t } static device_t -nexus_add_child(device_t bus, int order, const char *name, int unit) +nexus_add_child(device_t bus, u_int order, const char *name, int unit) { device_t child; struct nexus_device *ndev; Modified: stable/7/sys/isa/isa_common.c ============================================================================== --- stable/7/sys/isa/isa_common.c Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/isa/isa_common.c Mon Sep 20 11:09:31 2010 (r212893) @@ -617,7 +617,7 @@ isa_probe_children(device_t dev) * Add a new child with default ivars. */ static device_t -isa_add_child(device_t dev, int order, const char *name, int unit) +isa_add_child(device_t dev, u_int order, const char *name, int unit) { device_t child; struct isa_device *idev; Modified: stable/7/sys/kern/bus_if.m ============================================================================== --- stable/7/sys/kern/bus_if.m Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/kern/bus_if.m Mon Sep 20 11:09:31 2010 (r212893) @@ -191,7 +191,7 @@ METHOD void driver_added { */ METHOD device_t add_child { device_t _dev; - int _order; + u_int _order; const char *_name; int _unit; }; Modified: stable/7/sys/kern/subr_bus.c ============================================================================== --- stable/7/sys/kern/subr_bus.c Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/kern/subr_bus.c Mon Sep 20 11:09:31 2010 (r212893) @@ -2879,7 +2879,7 @@ resource_list_purge(struct resource_list } device_t -bus_generic_add_child(device_t dev, int order, const char *name, int unit) +bus_generic_add_child(device_t dev, u_int order, const char *name, int unit) { return (device_add_child_ordered(dev, order, name, unit)); Modified: stable/7/sys/pc98/pc98/canbus.c ============================================================================== --- stable/7/sys/pc98/pc98/canbus.c Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/pc98/pc98/canbus.c Mon Sep 20 11:09:31 2010 (r212893) @@ -82,7 +82,7 @@ static int canbus_detach(device_t); /* Bus interface methods */ static int canbus_print_child(device_t, device_t); -static device_t canbus_add_child(device_t, int, const char *, int); +static device_t canbus_add_child(device_t, u_int, const char *, int); static struct resource * canbus_alloc_resource( device_t, device_t, int, int *, u_long, u_long, u_long, u_int); static int canbus_activate_resource( @@ -235,7 +235,7 @@ canbus_print_child(device_t dev, device_ } static device_t -canbus_add_child(device_t bus, int order, const char *name, int unit) +canbus_add_child(device_t bus, u_int order, const char *name, int unit) { device_t child; struct canbus_device *cbdev; Modified: stable/7/sys/sparc64/sparc64/nexus.c ============================================================================== --- stable/7/sys/sparc64/sparc64/nexus.c Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/sparc64/sparc64/nexus.c Mon Sep 20 11:09:31 2010 (r212893) @@ -257,7 +257,7 @@ nexus_attach(device_t dev) } static device_t -nexus_add_child(device_t dev, int order, const char *name, int unit) +nexus_add_child(device_t dev, u_int order, const char *name, int unit) { device_t cdev; struct nexus_devinfo *ndi; Modified: stable/7/sys/sun4v/sun4v/nexus.c ============================================================================== --- stable/7/sys/sun4v/sun4v/nexus.c Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/sun4v/sun4v/nexus.c Mon Sep 20 11:09:31 2010 (r212893) @@ -234,7 +234,7 @@ nexus_attach(device_t dev) } static device_t -nexus_add_child(device_t dev, int order, const char *name, int unit) +nexus_add_child(device_t dev, u_int order, const char *name, int unit) { device_t cdev; struct nexus_devinfo *ndi; Modified: stable/7/sys/sun4v/sun4v/vnex.c ============================================================================== --- stable/7/sys/sun4v/sun4v/vnex.c Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/sun4v/sun4v/vnex.c Mon Sep 20 11:09:31 2010 (r212893) @@ -204,7 +204,7 @@ vnex_attach(device_t dev) } static device_t -vnex_add_child(device_t dev, int order, const char *name, int unit) +vnex_add_child(device_t dev, u_int order, const char *name, int unit) { device_t cdev; struct vnex_devinfo *vndi; Modified: stable/7/sys/sys/bus.h ============================================================================== --- stable/7/sys/sys/bus.h Mon Sep 20 07:31:08 2010 (r212892) +++ stable/7/sys/sys/bus.h Mon Sep 20 11:09:31 2010 (r212893) @@ -279,7 +279,7 @@ void root_bus_configure(void); int bus_generic_activate_resource(device_t dev, device_t child, int type, int rid, struct resource *r); device_t - bus_generic_add_child(device_t dev, int order, const char *name, + bus_generic_add_child(device_t dev, u_int order, const char *name, int unit); struct resource * bus_generic_alloc_resource(device_t bus, device_t child, int type, From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 11:15:24 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1DE78106566C; Mon, 20 Sep 2010 11:15:24 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E6B3E8FC13; Mon, 20 Sep 2010 11:15:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KBFNvq049785; Mon, 20 Sep 2010 11:15:23 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KBFNYv049783; Mon, 20 Sep 2010 11:15:23 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201009201115.o8KBFNYv049783@svn.freebsd.org> From: Andriy Gapon Date: Mon, 20 Sep 2010 11:15:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212894 - stable/8/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 11:15:24 -0000 Author: avg Date: Mon Sep 20 11:15:23 2010 New Revision: 212894 URL: http://svn.freebsd.org/changeset/base/212894 Log: MFC r212325: subr_bus: use hexadecimal representation for bit flags Modified: stable/8/sys/kern/subr_bus.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/kern/subr_bus.c ============================================================================== --- stable/8/sys/kern/subr_bus.c Mon Sep 20 11:09:31 2010 (r212893) +++ stable/8/sys/kern/subr_bus.c Mon Sep 20 11:15:23 2010 (r212894) @@ -122,14 +122,14 @@ struct device { device_state_t state; /**< current device state */ u_int32_t devflags; /**< api level flags for device_get_flags() */ u_int flags; /**< internal device flags */ -#define DF_ENABLED 1 /* device should be probed/attached */ -#define DF_FIXEDCLASS 2 /* devclass specified at create time */ -#define DF_WILDCARD 4 /* unit was originally wildcard */ -#define DF_DESCMALLOCED 8 /* description was malloced */ -#define DF_QUIET 16 /* don't print verbose attach message */ -#define DF_DONENOMATCH 32 /* don't execute DEVICE_NOMATCH again */ -#define DF_EXTERNALSOFTC 64 /* softc not allocated by us */ -#define DF_REBID 128 /* Can rebid after attach */ +#define DF_ENABLED 0x01 /* device should be probed/attached */ +#define DF_FIXEDCLASS 0x02 /* devclass specified at create time */ +#define DF_WILDCARD 0x04 /* unit was originally wildcard */ +#define DF_DESCMALLOCED 0x08 /* description was malloced */ +#define DF_QUIET 0x10 /* don't print verbose attach message */ +#define DF_DONENOMATCH 0x20 /* don't execute DEVICE_NOMATCH again */ +#define DF_EXTERNALSOFTC 0x40 /* softc not allocated by us */ +#define DF_REBID 0x80 /* Can rebid after attach */ u_int order; /**< order from device_add_child_ordered() */ void *ivars; /**< instance variables */ void *softc; /**< current driver's variables */ From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 11:18:21 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 373AD1065781; Mon, 20 Sep 2010 11:18:21 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0C4068FC14; Mon, 20 Sep 2010 11:18:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KBIKG6049907; Mon, 20 Sep 2010 11:18:20 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KBIKd2049905; Mon, 20 Sep 2010 11:18:20 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201009201118.o8KBIKd2049905@svn.freebsd.org> From: Andriy Gapon Date: Mon, 20 Sep 2010 11:18:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212895 - stable/7/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 11:18:21 -0000 Author: avg Date: Mon Sep 20 11:18:20 2010 New Revision: 212895 URL: http://svn.freebsd.org/changeset/base/212895 Log: MFC r212325: subr_bus: use hexadecimal representation for bit flags Modified: stable/7/sys/kern/subr_bus.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/kern/subr_bus.c ============================================================================== --- stable/7/sys/kern/subr_bus.c Mon Sep 20 11:15:23 2010 (r212894) +++ stable/7/sys/kern/subr_bus.c Mon Sep 20 11:18:20 2010 (r212895) @@ -118,14 +118,14 @@ struct device { device_state_t state; /**< current device state */ u_int32_t devflags; /**< api level flags for device_get_flags() */ u_int flags; /**< internal device flags */ -#define DF_ENABLED 1 /* device should be probed/attached */ -#define DF_FIXEDCLASS 2 /* devclass specified at create time */ -#define DF_WILDCARD 4 /* unit was originally wildcard */ -#define DF_DESCMALLOCED 8 /* description was malloced */ -#define DF_QUIET 16 /* don't print verbose attach message */ -#define DF_DONENOMATCH 32 /* don't execute DEVICE_NOMATCH again */ -#define DF_EXTERNALSOFTC 64 /* softc not allocated by us */ -#define DF_REBID 128 /* Can rebid after attach */ +#define DF_ENABLED 0x01 /* device should be probed/attached */ +#define DF_FIXEDCLASS 0x02 /* devclass specified at create time */ +#define DF_WILDCARD 0x04 /* unit was originally wildcard */ +#define DF_DESCMALLOCED 0x08 /* description was malloced */ +#define DF_QUIET 0x10 /* don't print verbose attach message */ +#define DF_DONENOMATCH 0x20 /* don't execute DEVICE_NOMATCH again */ +#define DF_EXTERNALSOFTC 0x40 /* softc not allocated by us */ +#define DF_REBID 0x80 /* Can rebid after attach */ u_int order; /**< order from device_add_child_ordered() */ void *ivars; /**< instance variables */ void *softc; /**< current driver's variables */ From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 11:53:57 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BD5BC1065670; Mon, 20 Sep 2010 11:53:57 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AB8BD8FC19; Mon, 20 Sep 2010 11:53:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KBrvWZ050731; Mon, 20 Sep 2010 11:53:57 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KBrvVr050728; Mon, 20 Sep 2010 11:53:57 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201009201153.o8KBrvVr050728@svn.freebsd.org> From: "Jayachandran C." Date: Mon, 20 Sep 2010 11:53:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212896 - in head/sys/mips/rmi: . dev/nlge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 11:53:57 -0000 Author: jchandra Date: Mon Sep 20 11:53:57 2010 New Revision: 212896 URL: http://svn.freebsd.org/changeset/base/212896 Log: Add 64 bit support to nlge, and additional fixes - 64 bit fixes for ifnlge.c - Use m_nextpkt to save mbuf vaddr on 64 bit, we cannot store the 64 bit vaddr in the 40bit freeback field. - remove unused code and unnecessary variables. - use xlr_io_mmio macro instead of adding io base address - rewrite GPIO related code to fixup nlge using xlr_write_reg and DELAY - support for engg boards major num 11 and 12 - add xlr_paddr_lw() to load 32bit value from physical address, fix inline assembly - style fixes Modified: head/sys/mips/rmi/dev/nlge/if_nlge.c head/sys/mips/rmi/rmi_mips_exts.h Modified: head/sys/mips/rmi/dev/nlge/if_nlge.c ============================================================================== --- head/sys/mips/rmi/dev/nlge/if_nlge.c Mon Sep 20 11:18:20 2010 (r212895) +++ head/sys/mips/rmi/dev/nlge/if_nlge.c Mon Sep 20 11:53:57 2010 (r212896) @@ -381,8 +381,6 @@ nlna_attach(device_t dev) #ifdef DEBUG dump_board_info(&xlr_board_info); #endif - block_info->baseaddr += DEFAULT_XLR_IO_BASE; - /* Initialize nlna state in softc structure */ sc = nlna_sc_init(dev, block_info); @@ -621,21 +619,15 @@ nlge_msgring_handler(int bucket, int siz { struct nlna_softc *na_sc; struct nlge_softc *sc; - struct ifnet *ifp; + struct ifnet *ifp; + struct mbuf *m; vm_paddr_t phys_addr; - unsigned long addr; uint32_t length; int ctrl; - int cpu; int tx_error; int port; - int vcpu; int is_p2p; - cpu = xlr_core_id(); - vcpu = (cpu << 2) + xlr_thr_id(); - - addr = 0; is_p2p = 0; tx_error = 0; length = (msg->msg0 >> 40) & 0x3fff; @@ -667,7 +659,13 @@ nlge_msgring_handler(int bucket, int siz if (is_p2p) { release_tx_desc(phys_addr); } else { - m_freem((struct mbuf *)(uintptr_t)phys_addr); +#ifdef __mips64 + m = (struct mbuf *)(uintptr_t)xlr_paddr_ld(phys_addr); + m->m_nextpkt = NULL; +#else + m = (struct mbuf *)(uintptr_t)phys_addr; +#endif + m_freem(m); } NLGE_LOCK(sc); if (ifp->if_drv_flags & IFF_DRV_OACTIVE){ @@ -687,7 +685,7 @@ nlge_msgring_handler(int bucket, int siz nlge_rx(sc, phys_addr, length); nlna_submit_rx_free_desc(na_sc, 1); /* return free descr to NA */ } else { - printf("[%s]: unrecognized ctrl=%d!\n", __FUNCTION__, ctrl); + printf("[%s]: unrecognized ctrl=%d!\n", __func__, ctrl); } } @@ -801,8 +799,8 @@ nlge_rx(struct nlge_softc *sc, vm_paddr_ m = (struct mbuf *)(intptr_t)tm; if (mag != 0xf00bad) { /* somebody else's packet. Error - FIXME in intialization */ - printf("cpu %d: *ERROR* Not my packet paddr %llx\n", - xlr_core_id(), (uint64_t) paddr); + printf("cpu %d: *ERROR* Not my packet paddr %jx\n", + xlr_core_id(), (uintmax_t)paddr); return; } @@ -882,7 +880,7 @@ nlna_sc_init(device_t dev, struct xlr_gm sc = device_get_softc(dev); memset(sc, 0, sizeof(*sc)); sc->nlna_dev = dev; - sc->base = (xlr_reg_t *) blk->baseaddr; + sc->base = xlr_io_mmio(blk->baseaddr); sc->rfrbucket = blk->station_rfr; sc->station_id = blk->station_id; sc->na_type = blk->type; @@ -1302,10 +1300,7 @@ nlna_reset_ports(struct nlna_softc *sc, /* Refer Section 13.9.3 in the PRM for the reset sequence */ for (i = 0; i < sc->num_ports; i++) { - uint32_t base = (uint32_t)DEFAULT_XLR_IO_BASE; - - base += blk->gmac_port[i].base_addr; - addr = (xlr_reg_t *) base; + addr = xlr_io_mmio(blk->gmac_port[i].base_addr); /* 1. Reset RxEnable in MAC_CONFIG */ switch (sc->mac_type) { @@ -1359,10 +1354,7 @@ nlna_disable_ports(struct nlna_softc *sc blk = device_get_ivars(sc->nlna_dev); for (i = 0; i < sc->num_ports; i++) { - uint32_t base = (uint32_t)DEFAULT_XLR_IO_BASE; - - base += blk->gmac_port[i].base_addr; - addr = (xlr_reg_t *) base; + addr = xlr_io_mmio(blk->gmac_port[i].base_addr); nlge_port_disable(i, addr, blk->gmac_port[i].type); } } @@ -1473,7 +1465,6 @@ static void nlge_sgmii_init(struct nlge_softc *sc) { xlr_reg_t *mmio_gpio; - int i; int phy; if (sc->port_type != XLR_SGMII) @@ -1491,12 +1482,26 @@ nlge_sgmii_init(struct nlge_softc *sc) nlge_mii_write_internal(sc->serdes_addr, 26, 9, 0x0000); nlge_mii_write_internal(sc->serdes_addr, 26,10, 0x0000); - for(i=0;i<10000000;i++){} /* delay */ /* program GPIO values for serdes init parameters */ - mmio_gpio = (xlr_reg_t *) (DEFAULT_XLR_IO_BASE + XLR_IO_GPIO_OFFSET); - mmio_gpio[0x20] = 0x7e6802; - mmio_gpio[0x10] = 0x7104; - for(i=0;i<100000000;i++){} + DELAY(100); + mmio_gpio = xlr_io_mmio(XLR_IO_GPIO_OFFSET); + xlr_write_reg(mmio_gpio, 0x20, 0x7e6802); + xlr_write_reg(mmio_gpio, 0x10, 0x7104); + DELAY(100); + + /* + * This kludge is needed to setup serdes (?) clock correctly on some + * XLS boards + */ + if ((xlr_boot1_info.board_major_version == RMI_XLR_BOARD_ARIZONA_XI || + xlr_boot1_info.board_major_version == RMI_XLR_BOARD_ARIZONA_XII) && + xlr_boot1_info.board_minor_version == 4) { + /* use 125 Mhz instead of 156.25Mhz ref clock */ + DELAY(100); + xlr_write_reg(mmio_gpio, 0x10, 0x7103); + xlr_write_reg(mmio_gpio, 0x21, 0x7103); + DELAY(100); + } /* enable autoneg - more magic */ phy = sc->phy_addr % 4 + 27; @@ -1888,14 +1893,14 @@ prepare_fmn_message(struct nlge_softc *s struct mbuf *m; struct nlge_tx_desc *p2p; uint64_t *cur_p2d; + uint64_t fbpaddr; vm_offset_t buf; vm_paddr_t paddr; - int msg_sz, p2p_sz, is_p2p; - int len, frag_sz; + int msg_sz, p2p_sz, len, frag_sz; /* Num entries per FMN msg is 4 for XLR/XLS */ const int FMN_SZ = sizeof(*fmn_msg) / sizeof(uint64_t); - msg_sz = p2p_sz = is_p2p = 0; + msg_sz = p2p_sz = 0; p2p = NULL; cur_p2d = &fmn_msg->msg0; @@ -1916,10 +1921,9 @@ prepare_fmn_message(struct nlge_softc *s p2p->frag[XLR_MAX_TX_FRAGS] = (uint64_t)(vm_offset_t)p2p; cur_p2d = &p2p->frag[0]; - is_p2p = 1; } else if (msg_sz == (FMN_SZ - 2 + XLR_MAX_TX_FRAGS)) { uma_zfree(nl_tx_desc_zone, p2p); - return 1; + return (1); } paddr = vtophys(buf); frag_sz = PAGE_SIZE - (buf & PAGE_MASK); @@ -1928,7 +1932,7 @@ prepare_fmn_message(struct nlge_softc *s *cur_p2d++ = (127ULL << 54) | ((uint64_t)frag_sz << 40) | paddr; msg_sz++; - if (is_p2p) + if (p2p != NULL) p2p_sz++; len -= frag_sz; buf += frag_sz; @@ -1938,15 +1942,28 @@ prepare_fmn_message(struct nlge_softc *s if (msg_sz == 0) { printf("Zero-length mbuf chain ??\n"); *n_entries = msg_sz ; - return 0; + return (0); } - cur_p2d[-1] |= (1ULL << 63); /* set eop in most-recent p2d */ - *cur_p2d = (1ULL << 63) | ((uint64_t)fb_stn_id << 54) | - (vm_offset_t) mbuf_chain; /* XXX: fix 64 bit */ + /* set eop in most-recent p2d */ + cur_p2d[-1] |= (1ULL << 63); + +#ifdef __mips64 + /* + * On n64, we cannot store our mbuf pointer(64 bit) in the freeback + * message (40bit available), so we put the mbuf in m_nextpkt and + * use the physical addr of that in freeback message. + */ + mbuf_chain->m_nextpkt = mbuf_chain; + fbpaddr = vtophys(&mbuf_chain->m_nextpkt); +#else + /* Careful, don't sign extend when going to 64bit */ + fbpaddr = (uint64_t)(uintptr_t)mbuf_chain; +#endif + *cur_p2d = (1ULL << 63) | ((uint64_t)fb_stn_id << 54) | fbpaddr; *tx_desc = p2p; - if (is_p2p) { + if (p2p != NULL) { paddr = vtophys(p2p); p2p_sz++; fmn_msg->msg3 = (1ULL << 62) | ((uint64_t)fb_stn_id << 54) | @@ -1965,9 +1982,7 @@ send_fmn_msg_tx(struct nlge_softc *sc, s { uint32_t msgrng_flags; int ret; -#ifdef INVARIANTS int i = 0; -#endif do { msgrng_flags = msgrng_access_enable(); @@ -1979,7 +1994,7 @@ send_fmn_msg_tx(struct nlge_softc *sc, s i++; } while (i < 100000); - KASSERT(i < 100000, ("Too many credit fails in tx path\n")); + device_printf(sc->nlge_dev, "Too many credit fails in tx path\n"); return (1); } @@ -2012,7 +2027,7 @@ get_buf(void) if ((m_new = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR)) == NULL) return (NULL); m_new->m_len = m_new->m_pkthdr.len = MCLBYTES; - m_adj(m_new, XLR_CACHELINE_SIZE - ((unsigned int)m_new->m_data & 0x1f)); + m_adj(m_new, XLR_CACHELINE_SIZE - ((uintptr_t)m_new->m_data & 0x1f)); md = (uint64_t *)m_new->m_data; md[0] = (intptr_t)m_new; /* Back Ptr */ md[1] = 0xf00bad; @@ -2107,16 +2122,12 @@ nlge_set_port_attribs(struct nlge_softc { sc->instance = port_info->instance % 4; /* TBD: will not work for SPI-4 */ sc->port_type = port_info->type; - sc->base = (xlr_reg_t *) (port_info->base_addr + - (uint32_t)DEFAULT_XLR_IO_BASE); - sc->mii_base = (xlr_reg_t *) (port_info->mii_addr + - (uint32_t)DEFAULT_XLR_IO_BASE); + sc->base = xlr_io_mmio(port_info->base_addr); + sc->mii_base = xlr_io_mmio(port_info->mii_addr); if (port_info->pcs_addr != 0) - sc->pcs_addr = (xlr_reg_t *) (port_info->pcs_addr + - (uint32_t)DEFAULT_XLR_IO_BASE); + sc->pcs_addr = xlr_io_mmio(port_info->pcs_addr); if (port_info->serdes_addr != 0) - sc->serdes_addr = (xlr_reg_t *) (port_info->serdes_addr + - (uint32_t)DEFAULT_XLR_IO_BASE); + sc->serdes_addr = xlr_io_mmio(port_info->serdes_addr); sc->phy_addr = port_info->phy_addr; PDEBUG("Port%d: base=%p, mii_base=%p, phy_addr=%d\n", sc->id, sc->base, Modified: head/sys/mips/rmi/rmi_mips_exts.h ============================================================================== --- head/sys/mips/rmi/rmi_mips_exts.h Mon Sep 20 11:18:20 2010 (r212895) +++ head/sys/mips/rmi/rmi_mips_exts.h Mon Sep 20 11:53:57 2010 (r212896) @@ -418,6 +418,14 @@ xlr_ldaddwu(unsigned int value, unsigned } #if defined(__mips_n64) +static __inline uint32_t +xlr_paddr_lw(uint64_t paddr) +{ + + paddr |= 0x9800000000000000ULL; + return (*(uint32_t *)(uintptr_t)paddr); +} + static __inline uint64_t xlr_paddr_ld(uint64_t paddr) { @@ -427,6 +435,23 @@ xlr_paddr_ld(uint64_t paddr) } #elif defined(__mips_n32) +static __inline uint32_t +xlr_paddr_lw(uint32_t paddr) +{ + uint32_t val; + + paddr |= 0x9800000000000000ULL; + __asm__ __volatile__( + ".set push \n\t" + ".set mips64 \n\t" + "lw %0, 0(%1) \n\t" + ".set pop \n" + : "=r"(val) + : "r"(paddr)); + + return (val); +} + static __inline uint64_t xlr_paddr_ld(uint64_t paddr) { @@ -443,8 +468,33 @@ xlr_paddr_ld(uint64_t paddr) return (val); } -#else + +#else /* o32 compilation */ static __inline uint32_t +xlr_paddr_lw(uint64_t paddr) +{ + uint32_t addrh, addrl; + uint32_t val; + + addrh = 0x98000000 | (paddr >> 32); + addrl = paddr & 0xffffffff; + + __asm__ __volatile__( + ".set push \n\t" + ".set mips64 \n\t" + "dsll32 %1, %1, 0 \n\t" + "dsll32 %2, %2, 0 \n\t" /* get rid of the */ + "dsrl32 %2, %2, 0 \n\t" /* sign extend */ + "or %0, %1, %2 \n\t" + "lw %0, 0(%0) \n\t" + ".set pop \n" + : "=&r"(val) + : "r"(addrh), "r"(addrl)); + + return (val); +} + +static __inline uint64_t xlr_paddr_ld(uint64_t paddr) { uint32_t addrh, addrl; @@ -454,15 +504,15 @@ xlr_paddr_ld(uint64_t paddr) addrl = paddr & 0xffffffff; __asm__ __volatile__( - ".set push \n\t" - ".set mips64 \n\t" - "dsll32 %2, %2, 0 \n\t" - "dsll32 %3, %3, 0 \n\t" /* get rid of the */ - "dsrl32 %3, %3, 0 \n\t" /* sign extend */ - "or %2, %2, %3 \n\t" - "lw %0, 0(%2) \n\t" - "lw %1, 4(%2) \n\t" - ".set pop \n" + ".set push \n\t" + ".set mips64 \n\t" + "dsll32 %2, %2, 0 \n\t" + "dsll32 %3, %3, 0 \n\t" /* get rid of the */ + "dsrl32 %3, %3, 0 \n\t" /* sign extend */ + "or %0, %2, %3 \n\t" + "lw %1, 4(%0) \n\t" + "lw %0, 0(%0) \n\t" + ".set pop \n" : "=&r"(valh), "=r"(vall) : "r"(addrh), "r"(addrl)); @@ -485,7 +535,13 @@ static __inline void xlr_restore_kx(uint32_t sr) { } -#else + +#else /* !defined(__mips_n64) && !defined(__mips_n32) */ +/* + * o32 compilation, we will disable interrupts and enable + * the KX bit so that we can use XKPHYS to access any 40bit + * physical address + */ static __inline uint32_t xlr_enable_kx(void) { @@ -501,7 +557,7 @@ xlr_restore_kx(uint32_t sr) mips_wr_status(sr); } -#endif +#endif /* defined(__mips_n64) || defined(__mips_n32) */ /* for cpuid to hardware thread id mapping */ extern uint32_t xlr_hw_thread_mask; From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 12:19:11 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7B4D71065670; Mon, 20 Sep 2010 12:19:11 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6B1468FC14; Mon, 20 Sep 2010 12:19:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KCJBFm051530; Mon, 20 Sep 2010 12:19:11 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KCJBrp051528; Mon, 20 Sep 2010 12:19:11 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201009201219.o8KCJBrp051528@svn.freebsd.org> From: Michael Tuexen Date: Mon, 20 Sep 2010 12:19:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212897 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 12:19:11 -0000 Author: tuexen Date: Mon Sep 20 12:19:11 2010 New Revision: 212897 URL: http://svn.freebsd.org/changeset/base/212897 Log: Fix a locking issue which resulted in aborted associations due to a corrupted nr-mapping array. MFC after: 2 weeks. Modified: head/sys/netinet/sctp_indata.c Modified: head/sys/netinet/sctp_indata.c ============================================================================== --- head/sys/netinet/sctp_indata.c Mon Sep 20 11:53:57 2010 (r212896) +++ head/sys/netinet/sctp_indata.c Mon Sep 20 12:19:11 2010 (r212897) @@ -1776,6 +1776,10 @@ sctp_process_a_data_chunk(struct sctp_tc if (control == NULL) { goto failed_express_del; } + SCTP_SET_TSN_PRESENT(asoc->nr_mapping_array, gap); + if (compare_with_wrap(tsn, asoc->highest_tsn_inside_nr_map, MAX_TSN)) { + asoc->highest_tsn_inside_nr_map = tsn; + } sctp_add_to_readq(stcb->sctp_ep, stcb, control, &stcb->sctp_socket->so_rcv, 1, SCTP_READ_LOCK_NOT_HELD, SCTP_SO_NOT_LOCKED); @@ -1791,10 +1795,6 @@ sctp_process_a_data_chunk(struct sctp_tc } control = NULL; - SCTP_SET_TSN_PRESENT(asoc->nr_mapping_array, gap); - if (compare_with_wrap(tsn, asoc->highest_tsn_inside_nr_map, MAX_TSN)) { - asoc->highest_tsn_inside_nr_map = tsn; - } goto finish_express_del; } failed_express_del: From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 12:23:10 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EA22C1065670; Mon, 20 Sep 2010 12:23:10 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D9F548FC14; Mon, 20 Sep 2010 12:23:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KCNAxf051676; Mon, 20 Sep 2010 12:23:10 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KCNAJZ051674; Mon, 20 Sep 2010 12:23:10 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201009201223.o8KCNAJZ051674@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 20 Sep 2010 12:23:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212898 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 12:23:11 -0000 Author: glebius Date: Mon Sep 20 12:23:10 2010 New Revision: 212898 URL: http://svn.freebsd.org/changeset/base/212898 Log: Do not convert some meaningful error value to EINVAL. Reviewed by: will Modified: head/sys/netinet/ip_carp.c Modified: head/sys/netinet/ip_carp.c ============================================================================== --- head/sys/netinet/ip_carp.c Mon Sep 20 12:19:11 2010 (r212897) +++ head/sys/netinet/ip_carp.c Mon Sep 20 12:23:10 2010 (r212898) @@ -2358,13 +2358,13 @@ carp_mod_load(void) printf("carp: error %d attaching to PF_INET6\n", proto_reg[CARP_INET6]); carp_mod_cleanup(); - return (EINVAL); + return (proto_reg[CARP_INET6]); } err = ip6proto_register(IPPROTO_CARP); if (err) { printf("carp: error %d registering with INET6\n", err); carp_mod_cleanup(); - return (EINVAL); + return (err); } #endif #ifdef INET @@ -2374,13 +2374,13 @@ carp_mod_load(void) printf("carp: error %d attaching to PF_INET\n", proto_reg[CARP_INET]); carp_mod_cleanup(); - return (EINVAL); + return (proto_reg[CARP_INET]); } err = ipproto_register(IPPROTO_CARP); if (err) { printf("carp: error %d registering with INET\n", err); carp_mod_cleanup(); - return (EINVAL); + return (err); } #endif return 0; From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 12:44:31 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A2C371065670; Mon, 20 Sep 2010 12:44:31 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail04.syd.optusnet.com.au (mail04.syd.optusnet.com.au [211.29.132.185]) by mx1.freebsd.org (Postfix) with ESMTP id 234CB8FC19; Mon, 20 Sep 2010 12:44:30 +0000 (UTC) Received: from besplex.bde.org (c122-107-116-249.carlnfd1.nsw.optusnet.com.au [122.107.116.249]) by mail04.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o8KCiNJg029760 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 20 Sep 2010 22:44:28 +1000 Date: Mon, 20 Sep 2010 22:44:23 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Ed Schouten In-Reply-To: <201009191635.o8JGZgF3008282@svn.freebsd.org> Message-ID: <20100920224337.E63497@besplex.bde.org> References: <201009191635.o8JGZgF3008282@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r212867 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 12:44:31 -0000 On Sun, 19 Sep 2010, Ed Schouten wrote: > Log: > Just make callout devices and /dev/console force CLOCAL on open(). > > Instead of adding custom checks to wait for DCD on open(), just modify > the termios structure to set CLOCAL. This means SIGHUP is no longer > generated when losing DCD as well. > > Reviewed by: kib@ > MFC after: 1 week Er, my review explained how wrong this is. Please back it out. Bruce From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 13:23:43 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB7281065698; Mon, 20 Sep 2010 13:23:43 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DB72E8FC2A; Mon, 20 Sep 2010 13:23:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KDNhWP053071; Mon, 20 Sep 2010 13:23:43 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KDNhFT053068; Mon, 20 Sep 2010 13:23:43 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009201323.o8KDNhFT053068@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 20 Sep 2010 13:23:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212899 - head/sbin/hastd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 13:23:44 -0000 Author: pjd Date: Mon Sep 20 13:23:43 2010 New Revision: 212899 URL: http://svn.freebsd.org/changeset/base/212899 Log: Add __dead2 to functions that we know they are going to exit. MFC after: 3 days Modified: head/sbin/hastd/primary.c head/sbin/hastd/secondary.c Modified: head/sbin/hastd/primary.c ============================================================================== --- head/sbin/hastd/primary.c Mon Sep 20 12:23:10 2010 (r212898) +++ head/sbin/hastd/primary.c Mon Sep 20 13:23:43 2010 (r212899) @@ -258,7 +258,7 @@ cleanup(struct hast_resource *res) errno = rerrno; } -static void +static __dead2 void primary_exit(int exitcode, const char *fmt, ...) { va_list ap; @@ -271,7 +271,7 @@ primary_exit(int exitcode, const char *f exit(exitcode); } -static void +static __dead2 void primary_exitx(int exitcode, const char *fmt, ...) { va_list ap; Modified: head/sbin/hastd/secondary.c ============================================================================== --- head/sbin/hastd/secondary.c Mon Sep 20 12:23:10 2010 (r212898) +++ head/sbin/hastd/secondary.c Mon Sep 20 13:23:43 2010 (r212899) @@ -519,7 +519,7 @@ end: return (hio->hio_error); } -static void +static __dead2 void secondary_exit(int exitcode, const char *fmt, ...) { va_list ap; From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 13:48:07 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C3DD1065694; Mon, 20 Sep 2010 13:48:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6BAD28FC20; Mon, 20 Sep 2010 13:48:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KDm7AR053783; Mon, 20 Sep 2010 13:48:07 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KDm7TV053781; Mon, 20 Sep 2010 13:48:07 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009201348.o8KDm7TV053781@svn.freebsd.org> From: Alexander Motin Date: Mon, 20 Sep 2010 13:48:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212900 - stable/7/sys/dev/hptrr X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 13:48:07 -0000 Author: mav Date: Mon Sep 20 13:48:07 2010 New Revision: 212900 URL: http://svn.freebsd.org/changeset/base/212900 Log: MFC r196415: Fill cpi->transport in XPT_PATH_INQ. Modified: stable/7/sys/dev/hptrr/hptrr_osm_bsd.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/hptrr/hptrr_osm_bsd.c ============================================================================== --- stable/7/sys/dev/hptrr/hptrr_osm_bsd.c Mon Sep 20 13:23:43 2010 (r212899) +++ stable/7/sys/dev/hptrr/hptrr_osm_bsd.c Mon Sep 20 13:48:07 2010 (r212900) @@ -820,6 +820,10 @@ static void hpt_action(struct cam_sim *s strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); strncpy(cpi->hba_vid, "HPT ", HBA_IDLEN); strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); + cpi->transport = XPORT_SPI; + cpi->transport_version = 2; + cpi->protocol = PROTO_SCSI; + cpi->protocol_version = SCSI_REV_2; cpi->ccb_h.status = CAM_REQ_CMP; break; } From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 14:58:08 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A0337106566B; Mon, 20 Sep 2010 14:58:08 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 720DA8FC21; Mon, 20 Sep 2010 14:58:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KEw8eK055723; Mon, 20 Sep 2010 14:58:08 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KEw8qd055721; Mon, 20 Sep 2010 14:58:08 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201009201458.o8KEw8qd055721@svn.freebsd.org> From: Colin Percival Date: Mon, 20 Sep 2010 14:58:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212901 - head/contrib/bzip2 releng/6.4 releng/6.4/contrib/bzip2 releng/6.4/sys/conf releng/7.1 releng/7.1/contrib/bzip2 releng/7.1/sys/conf releng/7.3 releng/7.3/contrib/bzip2 releng/7... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 14:58:08 -0000 Author: cperciva Date: Mon Sep 20 14:58:08 2010 New Revision: 212901 URL: http://svn.freebsd.org/changeset/base/212901 Log: Fix an integer overflow in RLE length parsing when decompressing corrupt bzip2 data. Approved by: so (cperciva) Security: FreeBSD-SA-10:08.bzip2 Modified: stable/7/contrib/bzip2/decompress.c Changes in other areas also in this revision: Modified: head/contrib/bzip2/decompress.c releng/6.4/UPDATING releng/6.4/contrib/bzip2/decompress.c releng/6.4/sys/conf/newvers.sh releng/7.1/UPDATING releng/7.1/contrib/bzip2/decompress.c releng/7.1/sys/conf/newvers.sh releng/7.3/UPDATING releng/7.3/contrib/bzip2/decompress.c releng/7.3/sys/conf/newvers.sh releng/8.0/UPDATING releng/8.0/contrib/bzip2/decompress.c releng/8.0/sys/conf/newvers.sh releng/8.1/UPDATING releng/8.1/contrib/bzip2/decompress.c releng/8.1/sys/conf/newvers.sh stable/6/contrib/bzip2/decompress.c stable/8/contrib/bzip2/decompress.c Modified: stable/7/contrib/bzip2/decompress.c ============================================================================== --- stable/7/contrib/bzip2/decompress.c Mon Sep 20 13:48:07 2010 (r212900) +++ stable/7/contrib/bzip2/decompress.c Mon Sep 20 14:58:08 2010 (r212901) @@ -381,6 +381,13 @@ Int32 BZ2_decompress ( DState* s ) es = -1; N = 1; do { + /* Check that N doesn't get too big, so that es doesn't + go negative. The maximum value that can be + RUNA/RUNB encoded is equal to the block size (post + the initial RLE), viz, 900k, so bounding N at 2 + million should guard against overflow without + rejecting any legitimate inputs. */ + if (N >= 2*1024*1024) RETURN(BZ_DATA_ERROR); if (nextSym == BZ_RUNA) es = es + (0+1) * N; else if (nextSym == BZ_RUNB) es = es + (1+1) * N; N = N * 2; From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 14:58:08 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BE6AC1065670; Mon, 20 Sep 2010 14:58:08 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 921B88FC23; Mon, 20 Sep 2010 14:58:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KEw8mQ055729; Mon, 20 Sep 2010 14:58:08 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KEw8LA055727; Mon, 20 Sep 2010 14:58:08 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201009201458.o8KEw8LA055727@svn.freebsd.org> From: Colin Percival Date: Mon, 20 Sep 2010 14:58:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212901 - head/contrib/bzip2 releng/6.4 releng/6.4/contrib/bzip2 releng/6.4/sys/conf releng/7.1 releng/7.1/contrib/bzip2 releng/7.1/sys/conf releng/7.3 releng/7.3/contrib/bzip2 releng/7... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 14:58:08 -0000 Author: cperciva Date: Mon Sep 20 14:58:08 2010 New Revision: 212901 URL: http://svn.freebsd.org/changeset/base/212901 Log: Fix an integer overflow in RLE length parsing when decompressing corrupt bzip2 data. Approved by: so (cperciva) Security: FreeBSD-SA-10:08.bzip2 Modified: head/contrib/bzip2/decompress.c Changes in other areas also in this revision: Modified: releng/6.4/UPDATING releng/6.4/contrib/bzip2/decompress.c releng/6.4/sys/conf/newvers.sh releng/7.1/UPDATING releng/7.1/contrib/bzip2/decompress.c releng/7.1/sys/conf/newvers.sh releng/7.3/UPDATING releng/7.3/contrib/bzip2/decompress.c releng/7.3/sys/conf/newvers.sh releng/8.0/UPDATING releng/8.0/contrib/bzip2/decompress.c releng/8.0/sys/conf/newvers.sh releng/8.1/UPDATING releng/8.1/contrib/bzip2/decompress.c releng/8.1/sys/conf/newvers.sh stable/6/contrib/bzip2/decompress.c stable/7/contrib/bzip2/decompress.c stable/8/contrib/bzip2/decompress.c Modified: head/contrib/bzip2/decompress.c ============================================================================== --- head/contrib/bzip2/decompress.c Mon Sep 20 13:48:07 2010 (r212900) +++ head/contrib/bzip2/decompress.c Mon Sep 20 14:58:08 2010 (r212901) @@ -381,6 +381,13 @@ Int32 BZ2_decompress ( DState* s ) es = -1; N = 1; do { + /* Check that N doesn't get too big, so that es doesn't + go negative. The maximum value that can be + RUNA/RUNB encoded is equal to the block size (post + the initial RLE), viz, 900k, so bounding N at 2 + million should guard against overflow without + rejecting any legitimate inputs. */ + if (N >= 2*1024*1024) RETURN(BZ_DATA_ERROR); if (nextSym == BZ_RUNA) es = es + (0+1) * N; else if (nextSym == BZ_RUNB) es = es + (1+1) * N; N = N * 2; From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 14:58:08 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F05631065674; Mon, 20 Sep 2010 14:58:08 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DC6DE8FC29; Mon, 20 Sep 2010 14:58:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KEw8kC055749; Mon, 20 Sep 2010 14:58:08 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KEw8D3055733; Mon, 20 Sep 2010 14:58:08 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201009201458.o8KEw8D3055733@svn.freebsd.org> From: Colin Percival Date: Mon, 20 Sep 2010 14:58:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212901 - head/contrib/bzip2 releng/6.4 releng/6.4/contrib/bzip2 releng/6.4/sys/conf releng/7.1 releng/7.1/contrib/bzip2 releng/7.1/sys/conf releng/7.3 releng/7.3/contrib/bzip2 releng/7... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 14:58:09 -0000 Author: cperciva Date: Mon Sep 20 14:58:08 2010 New Revision: 212901 URL: http://svn.freebsd.org/changeset/base/212901 Log: Fix an integer overflow in RLE length parsing when decompressing corrupt bzip2 data. Approved by: so (cperciva) Security: FreeBSD-SA-10:08.bzip2 Modified: releng/6.4/UPDATING releng/6.4/contrib/bzip2/decompress.c releng/6.4/sys/conf/newvers.sh releng/7.1/UPDATING releng/7.1/contrib/bzip2/decompress.c releng/7.1/sys/conf/newvers.sh releng/7.3/UPDATING releng/7.3/contrib/bzip2/decompress.c releng/7.3/sys/conf/newvers.sh releng/8.0/UPDATING releng/8.0/contrib/bzip2/decompress.c releng/8.0/sys/conf/newvers.sh releng/8.1/UPDATING releng/8.1/contrib/bzip2/decompress.c releng/8.1/sys/conf/newvers.sh Changes in other areas also in this revision: Modified: head/contrib/bzip2/decompress.c stable/6/contrib/bzip2/decompress.c stable/7/contrib/bzip2/decompress.c stable/8/contrib/bzip2/decompress.c Modified: releng/6.4/UPDATING ============================================================================== --- releng/6.4/UPDATING Mon Sep 20 13:48:07 2010 (r212900) +++ releng/6.4/UPDATING Mon Sep 20 14:58:08 2010 (r212901) @@ -8,6 +8,10 @@ Items affecting the ports and packages s /usr/ports/UPDATING. Please read that file before running portupgrade. +20100920: p11 FreeBSD-SA-10:08.bzip2 + Fix an integer overflow in RLE length parsing when decompressing + corrupt bzip2 data. + 20100526: p10 FreeBSD-SA-10:05.opie Fix a one-NUL-byte buffer overflow in libopie. [10:05] Modified: releng/6.4/contrib/bzip2/decompress.c ============================================================================== --- releng/6.4/contrib/bzip2/decompress.c Mon Sep 20 13:48:07 2010 (r212900) +++ releng/6.4/contrib/bzip2/decompress.c Mon Sep 20 14:58:08 2010 (r212901) @@ -381,6 +381,13 @@ Int32 BZ2_decompress ( DState* s ) es = -1; N = 1; do { + /* Check that N doesn't get too big, so that es doesn't + go negative. The maximum value that can be + RUNA/RUNB encoded is equal to the block size (post + the initial RLE), viz, 900k, so bounding N at 2 + million should guard against overflow without + rejecting any legitimate inputs. */ + if (N >= 2*1024*1024) RETURN(BZ_DATA_ERROR); if (nextSym == BZ_RUNA) es = es + (0+1) * N; else if (nextSym == BZ_RUNB) es = es + (1+1) * N; N = N * 2; Modified: releng/6.4/sys/conf/newvers.sh ============================================================================== --- releng/6.4/sys/conf/newvers.sh Mon Sep 20 13:48:07 2010 (r212900) +++ releng/6.4/sys/conf/newvers.sh Mon Sep 20 14:58:08 2010 (r212901) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="6.4" -BRANCH="RELEASE-p10" +BRANCH="RELEASE-p11" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi Modified: releng/7.1/UPDATING ============================================================================== --- releng/7.1/UPDATING Mon Sep 20 13:48:07 2010 (r212900) +++ releng/7.1/UPDATING Mon Sep 20 14:58:08 2010 (r212901) @@ -8,6 +8,10 @@ Items affecting the ports and packages s /usr/ports/UPDATING. Please read that file before running portupgrade. +20100920: p14 FreeBSD-SA-10:08.bzip2 + Fix an integer overflow in RLE length parsing when decompressing + corrupt bzip2 data. + 20100713: p13 FreeBSD-SA-10:07.mbuf Correctly copy the M_RDONLY flag when duplicating a reference to an mbuf external buffer. Modified: releng/7.1/contrib/bzip2/decompress.c ============================================================================== --- releng/7.1/contrib/bzip2/decompress.c Mon Sep 20 13:48:07 2010 (r212900) +++ releng/7.1/contrib/bzip2/decompress.c Mon Sep 20 14:58:08 2010 (r212901) @@ -381,6 +381,13 @@ Int32 BZ2_decompress ( DState* s ) es = -1; N = 1; do { + /* Check that N doesn't get too big, so that es doesn't + go negative. The maximum value that can be + RUNA/RUNB encoded is equal to the block size (post + the initial RLE), viz, 900k, so bounding N at 2 + million should guard against overflow without + rejecting any legitimate inputs. */ + if (N >= 2*1024*1024) RETURN(BZ_DATA_ERROR); if (nextSym == BZ_RUNA) es = es + (0+1) * N; else if (nextSym == BZ_RUNB) es = es + (1+1) * N; N = N * 2; Modified: releng/7.1/sys/conf/newvers.sh ============================================================================== --- releng/7.1/sys/conf/newvers.sh Mon Sep 20 13:48:07 2010 (r212900) +++ releng/7.1/sys/conf/newvers.sh Mon Sep 20 14:58:08 2010 (r212901) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="7.1" -BRANCH="RELEASE-p13" +BRANCH="RELEASE-p14" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi Modified: releng/7.3/UPDATING ============================================================================== --- releng/7.3/UPDATING Mon Sep 20 13:48:07 2010 (r212900) +++ releng/7.3/UPDATING Mon Sep 20 14:58:08 2010 (r212901) @@ -8,6 +8,10 @@ Items affecting the ports and packages s /usr/ports/UPDATING. Please read that file before running portupgrade. +20100920: p3 FreeBSD-SA-10:08.bzip2 + Fix an integer overflow in RLE length parsing when decompressing + corrupt bzip2 data. + 20100713: p2 FreeBSD-SA-10:07.mbuf Correctly copy the M_RDONLY flag when duplicating a reference to an mbuf external buffer. Modified: releng/7.3/contrib/bzip2/decompress.c ============================================================================== --- releng/7.3/contrib/bzip2/decompress.c Mon Sep 20 13:48:07 2010 (r212900) +++ releng/7.3/contrib/bzip2/decompress.c Mon Sep 20 14:58:08 2010 (r212901) @@ -381,6 +381,13 @@ Int32 BZ2_decompress ( DState* s ) es = -1; N = 1; do { + /* Check that N doesn't get too big, so that es doesn't + go negative. The maximum value that can be + RUNA/RUNB encoded is equal to the block size (post + the initial RLE), viz, 900k, so bounding N at 2 + million should guard against overflow without + rejecting any legitimate inputs. */ + if (N >= 2*1024*1024) RETURN(BZ_DATA_ERROR); if (nextSym == BZ_RUNA) es = es + (0+1) * N; else if (nextSym == BZ_RUNB) es = es + (1+1) * N; N = N * 2; Modified: releng/7.3/sys/conf/newvers.sh ============================================================================== --- releng/7.3/sys/conf/newvers.sh Mon Sep 20 13:48:07 2010 (r212900) +++ releng/7.3/sys/conf/newvers.sh Mon Sep 20 14:58:08 2010 (r212901) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="7.3" -BRANCH="RELEASE-p2" +BRANCH="RELEASE-p3" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi Modified: releng/8.0/UPDATING ============================================================================== --- releng/8.0/UPDATING Mon Sep 20 13:48:07 2010 (r212900) +++ releng/8.0/UPDATING Mon Sep 20 14:58:08 2010 (r212901) @@ -15,6 +15,10 @@ 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. +20100920: p5 FreeBSD-SA-10:08.bzip2 + Fix an integer overflow in RLE length parsing when decompressing + corrupt bzip2 data. + 20100713: p4 FreeBSD-SA-10:07.mbuf Correctly copy the M_RDONLY flag when duplicating a reference to an mbuf external buffer. Modified: releng/8.0/contrib/bzip2/decompress.c ============================================================================== --- releng/8.0/contrib/bzip2/decompress.c Mon Sep 20 13:48:07 2010 (r212900) +++ releng/8.0/contrib/bzip2/decompress.c Mon Sep 20 14:58:08 2010 (r212901) @@ -381,6 +381,13 @@ Int32 BZ2_decompress ( DState* s ) es = -1; N = 1; do { + /* Check that N doesn't get too big, so that es doesn't + go negative. The maximum value that can be + RUNA/RUNB encoded is equal to the block size (post + the initial RLE), viz, 900k, so bounding N at 2 + million should guard against overflow without + rejecting any legitimate inputs. */ + if (N >= 2*1024*1024) RETURN(BZ_DATA_ERROR); if (nextSym == BZ_RUNA) es = es + (0+1) * N; else if (nextSym == BZ_RUNB) es = es + (1+1) * N; N = N * 2; Modified: releng/8.0/sys/conf/newvers.sh ============================================================================== --- releng/8.0/sys/conf/newvers.sh Mon Sep 20 13:48:07 2010 (r212900) +++ releng/8.0/sys/conf/newvers.sh Mon Sep 20 14:58:08 2010 (r212901) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="8.0" -BRANCH="RELEASE-p4" +BRANCH="RELEASE-p5" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi Modified: releng/8.1/UPDATING ============================================================================== --- releng/8.1/UPDATING Mon Sep 20 13:48:07 2010 (r212900) +++ releng/8.1/UPDATING Mon Sep 20 14:58:08 2010 (r212901) @@ -15,6 +15,10 @@ 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. +20100920: p1 FreeBSD-SA-10:08.bzip2 + Fix an integer overflow in RLE length parsing when decompressing + corrupt bzip2 data. + 20100720: 8.1-RELEASE. Modified: releng/8.1/contrib/bzip2/decompress.c ============================================================================== --- releng/8.1/contrib/bzip2/decompress.c Mon Sep 20 13:48:07 2010 (r212900) +++ releng/8.1/contrib/bzip2/decompress.c Mon Sep 20 14:58:08 2010 (r212901) @@ -381,6 +381,13 @@ Int32 BZ2_decompress ( DState* s ) es = -1; N = 1; do { + /* Check that N doesn't get too big, so that es doesn't + go negative. The maximum value that can be + RUNA/RUNB encoded is equal to the block size (post + the initial RLE), viz, 900k, so bounding N at 2 + million should guard against overflow without + rejecting any legitimate inputs. */ + if (N >= 2*1024*1024) RETURN(BZ_DATA_ERROR); if (nextSym == BZ_RUNA) es = es + (0+1) * N; else if (nextSym == BZ_RUNB) es = es + (1+1) * N; N = N * 2; Modified: releng/8.1/sys/conf/newvers.sh ============================================================================== --- releng/8.1/sys/conf/newvers.sh Mon Sep 20 13:48:07 2010 (r212900) +++ releng/8.1/sys/conf/newvers.sh Mon Sep 20 14:58:08 2010 (r212901) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="8.1" -BRANCH="RELEASE" +BRANCH="RELEASE-p1" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 14:58:09 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 363211065679; Mon, 20 Sep 2010 14:58:09 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 085198FC2A; Mon, 20 Sep 2010 14:58:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KEw8Bg055755; Mon, 20 Sep 2010 14:58:08 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KEw8ZR055753; Mon, 20 Sep 2010 14:58:08 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201009201458.o8KEw8ZR055753@svn.freebsd.org> From: Colin Percival Date: Mon, 20 Sep 2010 14:58:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212901 - head/contrib/bzip2 releng/6.4 releng/6.4/contrib/bzip2 releng/6.4/sys/conf releng/7.1 releng/7.1/contrib/bzip2 releng/7.1/sys/conf releng/7.3 releng/7.3/contrib/bzip2 releng/7... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 14:58:09 -0000 Author: cperciva Date: Mon Sep 20 14:58:08 2010 New Revision: 212901 URL: http://svn.freebsd.org/changeset/base/212901 Log: Fix an integer overflow in RLE length parsing when decompressing corrupt bzip2 data. Approved by: so (cperciva) Security: FreeBSD-SA-10:08.bzip2 Modified: stable/6/contrib/bzip2/decompress.c Changes in other areas also in this revision: Modified: head/contrib/bzip2/decompress.c releng/6.4/UPDATING releng/6.4/contrib/bzip2/decompress.c releng/6.4/sys/conf/newvers.sh releng/7.1/UPDATING releng/7.1/contrib/bzip2/decompress.c releng/7.1/sys/conf/newvers.sh releng/7.3/UPDATING releng/7.3/contrib/bzip2/decompress.c releng/7.3/sys/conf/newvers.sh releng/8.0/UPDATING releng/8.0/contrib/bzip2/decompress.c releng/8.0/sys/conf/newvers.sh releng/8.1/UPDATING releng/8.1/contrib/bzip2/decompress.c releng/8.1/sys/conf/newvers.sh stable/7/contrib/bzip2/decompress.c stable/8/contrib/bzip2/decompress.c Modified: stable/6/contrib/bzip2/decompress.c ============================================================================== --- stable/6/contrib/bzip2/decompress.c Mon Sep 20 13:48:07 2010 (r212900) +++ stable/6/contrib/bzip2/decompress.c Mon Sep 20 14:58:08 2010 (r212901) @@ -381,6 +381,13 @@ Int32 BZ2_decompress ( DState* s ) es = -1; N = 1; do { + /* Check that N doesn't get too big, so that es doesn't + go negative. The maximum value that can be + RUNA/RUNB encoded is equal to the block size (post + the initial RLE), viz, 900k, so bounding N at 2 + million should guard against overflow without + rejecting any legitimate inputs. */ + if (N >= 2*1024*1024) RETURN(BZ_DATA_ERROR); if (nextSym == BZ_RUNA) es = es + (0+1) * N; else if (nextSym == BZ_RUNB) es = es + (1+1) * N; N = N * 2; From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 14:58:09 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5594C106567A; Mon, 20 Sep 2010 14:58:09 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 289FB8FC2B; Mon, 20 Sep 2010 14:58:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KEw9nt055761; Mon, 20 Sep 2010 14:58:09 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KEw9E2055759; Mon, 20 Sep 2010 14:58:09 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201009201458.o8KEw9E2055759@svn.freebsd.org> From: Colin Percival Date: Mon, 20 Sep 2010 14:58:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212901 - head/contrib/bzip2 releng/6.4 releng/6.4/contrib/bzip2 releng/6.4/sys/conf releng/7.1 releng/7.1/contrib/bzip2 releng/7.1/sys/conf releng/7.3 releng/7.3/contrib/bzip2 releng/7... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 14:58:09 -0000 Author: cperciva Date: Mon Sep 20 14:58:08 2010 New Revision: 212901 URL: http://svn.freebsd.org/changeset/base/212901 Log: Fix an integer overflow in RLE length parsing when decompressing corrupt bzip2 data. Approved by: so (cperciva) Security: FreeBSD-SA-10:08.bzip2 Modified: stable/8/contrib/bzip2/decompress.c Changes in other areas also in this revision: Modified: head/contrib/bzip2/decompress.c releng/6.4/UPDATING releng/6.4/contrib/bzip2/decompress.c releng/6.4/sys/conf/newvers.sh releng/7.1/UPDATING releng/7.1/contrib/bzip2/decompress.c releng/7.1/sys/conf/newvers.sh releng/7.3/UPDATING releng/7.3/contrib/bzip2/decompress.c releng/7.3/sys/conf/newvers.sh releng/8.0/UPDATING releng/8.0/contrib/bzip2/decompress.c releng/8.0/sys/conf/newvers.sh releng/8.1/UPDATING releng/8.1/contrib/bzip2/decompress.c releng/8.1/sys/conf/newvers.sh stable/6/contrib/bzip2/decompress.c stable/7/contrib/bzip2/decompress.c Modified: stable/8/contrib/bzip2/decompress.c ============================================================================== --- stable/8/contrib/bzip2/decompress.c Mon Sep 20 13:48:07 2010 (r212900) +++ stable/8/contrib/bzip2/decompress.c Mon Sep 20 14:58:08 2010 (r212901) @@ -381,6 +381,13 @@ Int32 BZ2_decompress ( DState* s ) es = -1; N = 1; do { + /* Check that N doesn't get too big, so that es doesn't + go negative. The maximum value that can be + RUNA/RUNB encoded is equal to the block size (post + the initial RLE), viz, 900k, so bounding N at 2 + million should guard against overflow without + rejecting any legitimate inputs. */ + if (N >= 2*1024*1024) RETURN(BZ_DATA_ERROR); if (nextSym == BZ_RUNA) es = es + (0+1) * N; else if (nextSym == BZ_RUNB) es = es + (1+1) * N; N = N * 2; From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 16:04:44 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 779F71065695; Mon, 20 Sep 2010 16:04:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6562F8FC22; Mon, 20 Sep 2010 16:04:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KG4iHG057611; Mon, 20 Sep 2010 16:04:44 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KG4iUx057606; Mon, 20 Sep 2010 16:04:44 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201009201604.o8KG4iUx057606@svn.freebsd.org> From: John Baldwin Date: Mon, 20 Sep 2010 16:04:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212902 - head/sys/dev/e1000 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 16:04:44 -0000 Author: jhb Date: Mon Sep 20 16:04:44 2010 New Revision: 212902 URL: http://svn.freebsd.org/changeset/base/212902 Log: Tweak the stats exported by the e1000 drivers: - Add a single sysctl procedure to all three drivers to read an arbitrary register (the register is passed as arg2). Use it to replace existing routines in igb(4) that used a separate routine for each register, and to add support for missing stats in em(4) and lem(4). - Move the 'rx_overruns' and 'watchdog_timeouts' stats out of the MAC stats section as they are driver stats, not MAC counters. - Simplify the code that creates per-queue stats in igb(4) to use a single loop and remove duplicated code. - Properly read all 64 bits of the 'good octets received/transmitted' in em(4) and lem(4). - Actually read the interrupt count registers in em(4), and drop the 'host to card' sysctl stats from em(4) as they are not implemented in any of the hardware this driver supports. - Restore several stats to em(4) that were lost in the earlier stats conversion including per-queue stats. - Export several MAC stats in em(4) that were exported in igb(4) but not in em(4). - Export stats in lem(4) using individual sysctls as in em(4) and igb(4). Reviewed by: jfv MFC after: 1 week Modified: head/sys/dev/e1000/if_em.c head/sys/dev/e1000/if_igb.c head/sys/dev/e1000/if_lem.c head/sys/dev/e1000/if_lem.h Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Mon Sep 20 14:58:08 2010 (r212901) +++ head/sys/dev/e1000/if_em.c Mon Sep 20 16:04:44 2010 (r212902) @@ -4844,8 +4844,10 @@ em_update_stats_counters(struct adapter /* For the 64-bit byte counters the low dword must be read first. */ /* Both registers clear on the read of the high dword */ - adapter->stats.gorc += E1000_READ_REG(&adapter->hw, E1000_GORCH); - adapter->stats.gotc += E1000_READ_REG(&adapter->hw, E1000_GOTCH); + adapter->stats.gorc += E1000_READ_REG(&adapter->hw, E1000_GORCL) + + ((u64)E1000_READ_REG(&adapter->hw, E1000_GORCH) << 32); + adapter->stats.gotc += E1000_READ_REG(&adapter->hw, E1000_GOTCL) + + ((u64)E1000_READ_REG(&adapter->hw, E1000_GOTCH) << 32); adapter->stats.rnbc += E1000_READ_REG(&adapter->hw, E1000_RNBC); adapter->stats.ruc += E1000_READ_REG(&adapter->hw, E1000_RUC); @@ -4867,6 +4869,18 @@ em_update_stats_counters(struct adapter adapter->stats.mptc += E1000_READ_REG(&adapter->hw, E1000_MPTC); adapter->stats.bptc += E1000_READ_REG(&adapter->hw, E1000_BPTC); + /* Interrupt Counts */ + + adapter->stats.iac += E1000_READ_REG(&adapter->hw, E1000_IAC); + adapter->stats.icrxptc += E1000_READ_REG(&adapter->hw, E1000_ICRXPTC); + adapter->stats.icrxatc += E1000_READ_REG(&adapter->hw, E1000_ICRXATC); + adapter->stats.ictxptc += E1000_READ_REG(&adapter->hw, E1000_ICTXPTC); + adapter->stats.ictxatc += E1000_READ_REG(&adapter->hw, E1000_ICTXATC); + adapter->stats.ictxqec += E1000_READ_REG(&adapter->hw, E1000_ICTXQEC); + adapter->stats.ictxqmtc += E1000_READ_REG(&adapter->hw, E1000_ICTXQMTC); + adapter->stats.icrxdmtc += E1000_READ_REG(&adapter->hw, E1000_ICRXDMTC); + adapter->stats.icrxoc += E1000_READ_REG(&adapter->hw, E1000_ICRXOC); + if (adapter->hw.mac.type >= e1000_82543) { adapter->stats.algnerrc += E1000_READ_REG(&adapter->hw, E1000_ALGNERRC); @@ -4896,6 +4910,17 @@ em_update_stats_counters(struct adapter adapter->stats.latecol + adapter->watchdog_events; } +/* Export a single 32-bit register via a read-only sysctl. */ +static int +em_sysctl_reg_handler(SYSCTL_HANDLER_ARGS) +{ + struct adapter *adapter; + u_int val; + + adapter = oidp->oid_arg1; + val = E1000_READ_REG(&adapter->hw, oidp->oid_arg2); + return (sysctl_handle_int(oidp, &val, 0, req)); +} /* * Add sysctl variables, one per statistic, to the system. @@ -4903,17 +4928,22 @@ em_update_stats_counters(struct adapter static void em_add_hw_stats(struct adapter *adapter) { - device_t dev = adapter->dev; + struct tx_ring *txr = adapter->tx_rings; + struct rx_ring *rxr = adapter->rx_rings; + struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(dev); struct sysctl_oid *tree = device_get_sysctl_tree(dev); struct sysctl_oid_list *child = SYSCTL_CHILDREN(tree); struct e1000_hw_stats *stats = &adapter->stats; - struct sysctl_oid *stat_node, *int_node, *host_node; - struct sysctl_oid_list *stat_list, *int_list, *host_list; + struct sysctl_oid *stat_node, *queue_node, *int_node; + struct sysctl_oid_list *stat_list, *queue_list, *int_list; +#define QUEUE_NAME_LEN 32 + char namebuf[QUEUE_NAME_LEN]; + /* Driver Statistics */ SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "link_irq", CTLFLAG_RD, &adapter->link_irq, 0, @@ -4930,7 +4960,21 @@ em_add_hw_stats(struct adapter *adapter) SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "tx_dma_fail", CTLFLAG_RD, &adapter->no_tx_dma_setup, "Driver tx dma failure in xmit"); - + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "rx_overruns", + CTLFLAG_RD, &adapter->rx_overruns, + "RX overruns"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "watchdog_timeouts", + CTLFLAG_RD, &adapter->watchdog_events, + "Watchdog timeouts"); + + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "device_control", + CTLFLAG_RD, adapter, E1000_CTRL, + em_sysctl_reg_handler, "IU", + "Device Control Register"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rx_control", + CTLFLAG_RD, adapter, E1000_RCTL, + em_sysctl_reg_handler, "IU", + "Receiver Control Register"); SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "fc_high_water", CTLFLAG_RD, &adapter->hw.fc.high_water, 0, "Flow Control High Watermark"); @@ -4938,7 +4982,41 @@ em_add_hw_stats(struct adapter *adapter) CTLFLAG_RD, &adapter->hw.fc.low_water, 0, "Flow Control Low Watermark"); - /* MAC stats get the own sub node */ + for (int i = 0; i < adapter->num_queues; i++, rxr++, txr++) { + snprintf(namebuf, QUEUE_NAME_LEN, "queue%d", i); + queue_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, namebuf, + CTLFLAG_RD, NULL, "Queue Name"); + queue_list = SYSCTL_CHILDREN(queue_node); + + SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "txd_head", + CTLFLAG_RD, adapter, E1000_TDH(txr->me), + em_sysctl_reg_handler, "IU", + "Transmit Descriptor Head"); + SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "txd_tail", + CTLFLAG_RD, adapter, E1000_TDT(txr->me), + em_sysctl_reg_handler, "IU", + "Transmit Descriptor Tail"); + SYSCTL_ADD_ULONG(ctx, queue_list, OID_AUTO, "tx_irq", + CTLFLAG_RD, &txr->tx_irq, + "Queue MSI-X Transmit Interrupts"); + SYSCTL_ADD_ULONG(ctx, queue_list, OID_AUTO, "no_desc_avail", + CTLFLAG_RD, &txr->no_desc_avail, + "Queue No Descriptor Available"); + + SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "rxd_head", + CTLFLAG_RD, adapter, E1000_RDH(rxr->me), + em_sysctl_reg_handler, "IU", + "Receive Descriptor Head"); + SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "rxd_tail", + CTLFLAG_RD, adapter, E1000_RDT(rxr->me), + em_sysctl_reg_handler, "IU", + "Receive Descriptor Tail"); + SYSCTL_ADD_ULONG(ctx, queue_list, OID_AUTO, "rx_irq", + CTLFLAG_RD, &rxr->rx_irq, + "Queue MSI-X Receive Interrupts"); + } + + /* MAC stats get their own sub node */ stat_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "mac_stats", CTLFLAG_RD, NULL, "Statistics"); @@ -4947,6 +5025,18 @@ em_add_hw_stats(struct adapter *adapter) SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "excess_coll", CTLFLAG_RD, &stats->ecol, "Excessive collisions"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "single_coll", + CTLFLAG_RD, &stats->scc, + "Single collisions"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "multiple_coll", + CTLFLAG_RD, &stats->mcc, + "Multiple collisions"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "late_coll", + CTLFLAG_RD, &stats->latecol, + "Late collisions"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "collision_count", + CTLFLAG_RD, &stats->colc, + "Collision Count"); SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "symbol_errors", CTLFLAG_RD, &adapter->stats.symerrs, "Symbol Errors"); @@ -4962,11 +5052,18 @@ em_add_hw_stats(struct adapter *adapter) SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "recv_no_buff", CTLFLAG_RD, &adapter->stats.rnbc, "Receive No Buffers"); - /* RLEC is inaccurate on some hardware, calculate our own. */ -/* SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "recv_len_errs", */ -/* CTLFLAG_RD, adapter->stats.roc + adapter->stats.ruc, */ -/* "Receive Length Errors"); */ - + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "recv_undersize", + CTLFLAG_RD, &adapter->stats.ruc, + "Receive Undersize"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "recv_fragmented", + CTLFLAG_RD, &adapter->stats.rfc, + "Fragmented Packets Received "); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "recv_oversize", + CTLFLAG_RD, &adapter->stats.roc, + "Oversized Packets Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "recv_jabber", + CTLFLAG_RD, &adapter->stats.rjc, + "Recevied Jabber"); SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "recv_errs", CTLFLAG_RD, &adapter->stats.rxerrc, "Receive Errors"); @@ -4980,12 +5077,6 @@ em_add_hw_stats(struct adapter *adapter) SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "coll_ext_errs", CTLFLAG_RD, &adapter->stats.cexterr, "Collision/Carrier extension errors"); - SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "rx_overruns", - CTLFLAG_RD, &adapter->rx_overruns, - "RX overruns"); - SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "watchdog_timeouts", - CTLFLAG_RD, &adapter->watchdog_events, - "Watchdog timeouts"); SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "xon_recvd", CTLFLAG_RD, &adapter->stats.xonrxc, "XON Received"); @@ -5035,9 +5126,9 @@ em_add_hw_stats(struct adapter *adapter) "Good Octets Received"); /* Packet Transmission Stats */ - SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "good_octest_txd", + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "good_octets_txd", CTLFLAG_RD, &adapter->stats.gotc, - "Good Octest Transmitted"); + "Good Octets Transmitted"); SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "total_pkts_txd", CTLFLAG_RD, &adapter->stats.tpt, "Total Packets Transmitted"); @@ -5117,63 +5208,6 @@ em_add_hw_stats(struct adapter *adapter) SYSCTL_ADD_QUAD(ctx, int_list, OID_AUTO, "rx_overrun", CTLFLAG_RD, &adapter->stats.icrxoc, "Interrupt Cause Receiver Overrun Count"); - - /* Host to Card Stats */ - - host_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "host", - CTLFLAG_RD, NULL, - "Host to Card Statistics"); - - host_list = SYSCTL_CHILDREN(host_node); - - SYSCTL_ADD_QUAD(ctx, host_list, OID_AUTO, "breaker_tx_pkt", - CTLFLAG_RD, &adapter->stats.cbtmpc, - "Circuit Breaker Tx Packet Count"); - - SYSCTL_ADD_QUAD(ctx, host_list, OID_AUTO, "host_tx_pkt_discard", - CTLFLAG_RD, &adapter->stats.htdpmc, - "Host Transmit Discarded Packets"); - - SYSCTL_ADD_QUAD(ctx, host_list, OID_AUTO, "rx_pkt", - CTLFLAG_RD, &adapter->stats.rpthc, - "Rx Packets To Host"); - - SYSCTL_ADD_QUAD(ctx, host_list, OID_AUTO, "breaker_rx_pkts", - CTLFLAG_RD, &adapter->stats.cbrmpc, - "Circuit Breaker Rx Packet Count"); - - SYSCTL_ADD_QUAD(ctx, host_list, OID_AUTO, "breaker_rx_pkt_drop", - CTLFLAG_RD, &adapter->stats.cbrdpc, - "Circuit Breaker Rx Dropped Count"); - - SYSCTL_ADD_QUAD(ctx, host_list, OID_AUTO, "tx_good_pkt", - CTLFLAG_RD, &adapter->stats.hgptc, - "Host Good Packets Tx Count"); - - SYSCTL_ADD_QUAD(ctx, host_list, OID_AUTO, "breaker_tx_pkt_drop", - CTLFLAG_RD, &adapter->stats.htcbdpc, - "Host Tx Circuit Breaker Dropped Count"); - - SYSCTL_ADD_QUAD(ctx, host_list, OID_AUTO, "rx_good_bytes", - CTLFLAG_RD, &adapter->stats.hgorc, - "Host Good Octets Received Count"); - - SYSCTL_ADD_QUAD(ctx, host_list, OID_AUTO, "tx_good_bytes", - CTLFLAG_RD, &adapter->stats.hgotc, - "Host Good Octets Transmit Count"); - - SYSCTL_ADD_QUAD(ctx, host_list, OID_AUTO, "length_errors", - CTLFLAG_RD, &adapter->stats.lenerrs, - "Length Errors"); - - SYSCTL_ADD_QUAD(ctx, host_list, OID_AUTO, "serdes_violation_pkt", - CTLFLAG_RD, &adapter->stats.scvpc, - "SerDes/SGMII Code Violation Pkt Count"); - - SYSCTL_ADD_QUAD(ctx, host_list, OID_AUTO, "header_redir_missed", - CTLFLAG_RD, &adapter->stats.hrmpc, - "Header Redirection Missed Packet Count"); - } /********************************************************************** Modified: head/sys/dev/e1000/if_igb.c ============================================================================== --- head/sys/dev/e1000/if_igb.c Mon Sep 20 14:58:08 2010 (r212901) +++ head/sys/dev/e1000/if_igb.c Mon Sep 20 16:04:44 2010 (r212902) @@ -4823,9 +4823,9 @@ igb_update_stats_counters(struct adapter /* Both registers clear on the read of the high dword */ stats->gorc += E1000_READ_REG(hw, E1000_GORCL) + - ((u64)E1000_READ_REG(hw, E1000_GORCH) << 32); + ((u64)E1000_READ_REG(hw, E1000_GORCH) << 32); stats->gotc += E1000_READ_REG(hw, E1000_GOTCL) + - ((u64)E1000_READ_REG(hw, E1000_GOTCH) << 32) ; + ((u64)E1000_READ_REG(hw, E1000_GOTCH) << 32); stats->rnbc += E1000_READ_REG(hw, E1000_RNBC); stats->ruc += E1000_READ_REG(hw, E1000_RUC); @@ -4956,77 +4956,16 @@ igb_update_vf_stats_counters(struct adap stats->last_mprc, stats->mprc); } - -/** igb_sysctl_tdh_handler - Handler function - * Retrieves the TDH value from the hardware - */ -static int -igb_sysctl_tdh_handler(SYSCTL_HANDLER_ARGS) -{ - int error; - - struct tx_ring *txr = ((struct tx_ring *)oidp->oid_arg1); - if (!txr) return 0; - - unsigned val = E1000_READ_REG(&txr->adapter->hw, E1000_TDH(txr->me)); - error = sysctl_handle_int(oidp, &val, 0, req); - if (error || !req->newptr) - return error; - return 0; -} - -/** igb_sysctl_tdt_handler - Handler function - * Retrieves the TDT value from the hardware - */ -static int -igb_sysctl_tdt_handler(SYSCTL_HANDLER_ARGS) -{ - int error; - - struct tx_ring *txr = ((struct tx_ring *)oidp->oid_arg1); - if (!txr) return 0; - - unsigned val = E1000_READ_REG(&txr->adapter->hw, E1000_TDT(txr->me)); - error = sysctl_handle_int(oidp, &val, 0, req); - if (error || !req->newptr) - return error; - return 0; -} - -/** igb_sysctl_rdh_handler - Handler function - * Retrieves the RDH value from the hardware - */ -static int -igb_sysctl_rdh_handler(SYSCTL_HANDLER_ARGS) -{ - int error; - - struct rx_ring *rxr = ((struct rx_ring *)oidp->oid_arg1); - if (!rxr) return 0; - - unsigned val = E1000_READ_REG(&rxr->adapter->hw, E1000_RDH(rxr->me)); - error = sysctl_handle_int(oidp, &val, 0, req); - if (error || !req->newptr) - return error; - return 0; -} - -/** igb_sysctl_rdt_handler - Handler function - * Retrieves the RDT value from the hardware - */ -static int -igb_sysctl_rdt_handler(SYSCTL_HANDLER_ARGS) +/* Export a single 32-bit register via a read-only sysctl. */ +static int +igb_sysctl_reg_handler(SYSCTL_HANDLER_ARGS) { - int error; - - struct rx_ring *rxr = ((struct rx_ring *)oidp->oid_arg1); - if (!rxr) return 0; + struct adapter *adapter; + u_int val; - unsigned val = E1000_READ_REG(&rxr->adapter->hw, E1000_RDT(rxr->me)); - error = sysctl_handle_int(oidp, &val, 0, req); - if (error || !req->newptr) - return error; - return 0; + adapter = oidp->oid_arg1; + val = E1000_READ_REG(&adapter->hw, oidp->oid_arg2); + return (sysctl_handle_int(oidp, &val, 0, req)); } /* @@ -5035,7 +4974,6 @@ igb_sysctl_rdt_handler(SYSCTL_HANDLER_AR static void igb_add_hw_stats(struct adapter *adapter) { - device_t dev = adapter->dev; struct tx_ring *txr = adapter->tx_rings; @@ -5062,6 +5000,12 @@ igb_add_hw_stats(struct adapter *adapter SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "tx_dma_fail", CTLFLAG_RD, &adapter->no_tx_dma_setup, "Driver tx dma failure in xmit"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "rx_overruns", + CTLFLAG_RD, &adapter->rx_overruns, + "RX overruns"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "watchdog_timeouts", + CTLFLAG_RD, &adapter->watchdog_events, + "Watchdog timeouts"); SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "device_control", CTLFLAG_RD, &adapter->device_control, @@ -5088,19 +5032,21 @@ igb_add_hw_stats(struct adapter *adapter CTLFLAG_RD, &adapter->hw.fc.low_water, 0, "Flow Control Low Watermark"); - for (int i = 0; i < adapter->num_queues; i++, txr++) { + for (int i = 0; i < adapter->num_queues; i++, rxr++, txr++) { + struct lro_ctrl *lro = &rxr->lro; + snprintf(namebuf, QUEUE_NAME_LEN, "queue%d", i); queue_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, namebuf, CTLFLAG_RD, NULL, "Queue Name"); queue_list = SYSCTL_CHILDREN(queue_node); SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "txd_head", - CTLFLAG_RD, txr, sizeof(txr), - igb_sysctl_tdh_handler, "IU", + CTLFLAG_RD, adapter, E1000_TDH(txr->me), + igb_sysctl_reg_handler, "IU", "Transmit Descriptor Head"); SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "txd_tail", - CTLFLAG_RD, txr, sizeof(txr), - igb_sysctl_tdt_handler, "IU", + CTLFLAG_RD, adapter, E1000_TDT(txr->me), + igb_sysctl_reg_handler, "IU", "Transmit Descriptor Tail"); SYSCTL_ADD_QUAD(ctx, queue_list, OID_AUTO, "no_desc_avail", CTLFLAG_RD, &txr->no_desc_avail, @@ -5108,28 +5054,14 @@ igb_add_hw_stats(struct adapter *adapter SYSCTL_ADD_QUAD(ctx, queue_list, OID_AUTO, "tx_packets", CTLFLAG_RD, &txr->tx_packets, "Queue Packets Transmitted"); - } - - for (int i = 0; i < adapter->num_queues; i++, rxr++) { - snprintf(namebuf, QUEUE_NAME_LEN, "queue%d", i); - queue_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, namebuf, - CTLFLAG_RD, NULL, "Queue Name"); - queue_list = SYSCTL_CHILDREN(queue_node); - - struct lro_ctrl *lro = &rxr->lro; - - snprintf(namebuf, QUEUE_NAME_LEN, "queue%d", i); - queue_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, namebuf, - CTLFLAG_RD, NULL, "Queue Name"); - queue_list = SYSCTL_CHILDREN(queue_node); SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "rxd_head", - CTLFLAG_RD, rxr, sizeof(rxr), - igb_sysctl_rdh_handler, "IU", + CTLFLAG_RD, adapter, E1000_RDH(rxr->me), + igb_sysctl_reg_handler, "IU", "Receive Descriptor Head"); SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "rxd_tail", - CTLFLAG_RD, rxr, sizeof(rxr), - igb_sysctl_rdt_handler, "IU", + CTLFLAG_RD, adapter, E1000_RDT(rxr->me), + igb_sysctl_reg_handler, "IU", "Receive Descriptor Tail"); SYSCTL_ADD_QUAD(ctx, queue_list, OID_AUTO, "rx_packets", CTLFLAG_RD, &rxr->rx_packets, @@ -5145,7 +5077,7 @@ igb_add_hw_stats(struct adapter *adapter "LRO Flushed"); } - /* MAC stats get the own sub node */ + /* MAC stats get their own sub node */ stat_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "mac_stats", CTLFLAG_RD, NULL, "MAC Statistics"); @@ -5165,9 +5097,9 @@ igb_add_hw_stats(struct adapter *adapter SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "good_octets_recvd", CTLFLAG_RD, &stats->gorc, "Good Octets Received"); - SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "good_octest_txd", + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "good_octets_txd", CTLFLAG_RD, &stats->gotc, - "Good Octest Transmitted"); + "Good Octets Transmitted"); SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "mcast_pkts_recvd", CTLFLAG_RD, &stats->mprc, "Multicast Packets Received"); @@ -5229,12 +5161,6 @@ igb_add_hw_stats(struct adapter *adapter SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "coll_ext_errs", CTLFLAG_RD, &stats->cexterr, "Collision/Carrier extension errors"); - SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "rx_overruns", - CTLFLAG_RD, &adapter->rx_overruns, - "RX overruns"); - SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "watchdog_timeouts", - CTLFLAG_RD, &adapter->watchdog_events, - "Watchdog timeouts"); SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "xon_recvd", CTLFLAG_RD, &stats->xonrxc, "XON Received"); @@ -5283,9 +5209,9 @@ igb_add_hw_stats(struct adapter *adapter "Good Octets Received"); /* Packet Transmission Stats */ - SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "good_octest_txd", + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "good_octets_txd", CTLFLAG_RD, &stats->gotc, - "Good Octest Transmitted"); + "Good Octets Transmitted"); SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "total_pkts_txd", CTLFLAG_RD, &stats->tpt, "Total Packets Transmitted"); Modified: head/sys/dev/e1000/if_lem.c ============================================================================== --- head/sys/dev/e1000/if_lem.c Mon Sep 20 14:58:08 2010 (r212901) +++ head/sys/dev/e1000/if_lem.c Mon Sep 20 16:04:44 2010 (r212902) @@ -84,11 +84,6 @@ #include "if_lem.h" /********************************************************************* - * Set this to one to display debug statistics - *********************************************************************/ -int lem_display_debug_stats = 0; - -/********************************************************************* * Legacy Em Driver version: *********************************************************************/ char lem_driver_version[] = "1.0.1"; @@ -196,6 +191,7 @@ static void lem_disable_intr(struct adap static void lem_free_transmit_structures(struct adapter *); static void lem_free_receive_structures(struct adapter *); static void lem_update_stats_counters(struct adapter *); +static void lem_add_hw_stats(struct adapter *adapter); static void lem_txeof(struct adapter *); static void lem_tx_purge(struct adapter *); static int lem_allocate_receive_structures(struct adapter *); @@ -211,7 +207,6 @@ static void lem_transmit_checksum_setup( static void lem_set_promisc(struct adapter *); static void lem_disable_promisc(struct adapter *); static void lem_set_multi(struct adapter *); -static void lem_print_hw_stats(struct adapter *); static void lem_update_link_status(struct adapter *); static int lem_get_buf(struct adapter *, int); #if __FreeBSD_version >= 700029 @@ -228,11 +223,9 @@ static void lem_82547_move_tail(void *); static int lem_dma_malloc(struct adapter *, bus_size_t, struct em_dma_alloc *, int); static void lem_dma_free(struct adapter *, struct em_dma_alloc *); -static void lem_print_debug_info(struct adapter *); +static int lem_sysctl_nvm_info(SYSCTL_HANDLER_ARGS); static void lem_print_nvm_info(struct adapter *); static int lem_is_valid_ether_addr(u8 *); -static int lem_sysctl_stats(SYSCTL_HANDLER_ARGS); -static int lem_sysctl_debug_info(SYSCTL_HANDLER_ARGS); static u32 lem_fill_descriptors (bus_addr_t address, u32 length, PDESC_ARRAY desc_array); static int lem_sysctl_int_delay(SYSCTL_HANDLER_ARGS); @@ -417,13 +410,8 @@ lem_attach(device_t dev) /* SYSCTL stuff */ SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - OID_AUTO, "debug", CTLTYPE_INT|CTLFLAG_RW, adapter, 0, - lem_sysctl_debug_info, "I", "Debug Information"); - - SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), - SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - OID_AUTO, "stats", CTLTYPE_INT|CTLFLAG_RW, adapter, 0, - lem_sysctl_stats, "I", "Statistics"); + OID_AUTO, "nvm", CTLTYPE_INT|CTLFLAG_RW, adapter, 0, + lem_sysctl_nvm_info, "I", "NVM Information"); callout_init_mtx(&adapter->timer, &adapter->core_mtx, 0); callout_init_mtx(&adapter->tx_fifo_timer, &adapter->tx_mtx, 0); @@ -658,6 +646,8 @@ lem_attach(device_t dev) lem_unregister_vlan, adapter, EVENTHANDLER_PRI_FIRST); #endif + lem_add_hw_stats(adapter); + /* Non-AMT based hardware can now take control from firmware */ if (adapter->has_manage && !adapter->has_amt) lem_get_hw_control(adapter); @@ -2017,7 +2007,6 @@ static void lem_local_timer(void *arg) { struct adapter *adapter = arg; - struct ifnet *ifp = adapter->ifp; EM_CORE_LOCK_ASSERT(adapter); @@ -2026,9 +2015,6 @@ lem_local_timer(void *arg) lem_update_link_status(adapter); lem_update_stats_counters(adapter); - if (lem_display_debug_stats && ifp->if_drv_flags & IFF_DRV_RUNNING) - lem_print_hw_stats(adapter); - lem_smartspeed(adapter); /* @@ -4268,8 +4254,10 @@ lem_update_stats_counters(struct adapter /* For the 64-bit byte counters the low dword must be read first. */ /* Both registers clear on the read of the high dword */ - adapter->stats.gorc += E1000_READ_REG(&adapter->hw, E1000_GORCH); - adapter->stats.gotc += E1000_READ_REG(&adapter->hw, E1000_GOTCH); + adapter->stats.gorc += E1000_READ_REG(&adapter->hw, E1000_GORCL) + + ((u64)E1000_READ_REG(&adapter->hw, E1000_GORCH) << 32); + adapter->stats.gotc += E1000_READ_REG(&adapter->hw, E1000_GOTCL) + + ((u64)E1000_READ_REG(&adapter->hw, E1000_GOTCH) << 32); adapter->stats.rnbc += E1000_READ_REG(&adapter->hw, E1000_RNBC); adapter->stats.ruc += E1000_READ_REG(&adapter->hw, E1000_RUC); @@ -4320,109 +4308,247 @@ lem_update_stats_counters(struct adapter adapter->stats.latecol + adapter->watchdog_events; } - -/********************************************************************** - * - * This routine is called only when lem_display_debug_stats is enabled. - * This routine provides a way to take a look at important statistics - * maintained by the driver and hardware. - * - **********************************************************************/ -static void -lem_print_debug_info(struct adapter *adapter) +/* Export a single 32-bit register via a read-only sysctl. */ +static int +lem_sysctl_reg_handler(SYSCTL_HANDLER_ARGS) { - device_t dev = adapter->dev; - u8 *hw_addr = adapter->hw.hw_addr; + struct adapter *adapter; + u_int val; - device_printf(dev, "Adapter hardware address = %p \n", hw_addr); - device_printf(dev, "CTRL = 0x%x RCTL = 0x%x \n", - E1000_READ_REG(&adapter->hw, E1000_CTRL), - E1000_READ_REG(&adapter->hw, E1000_RCTL)); - device_printf(dev, "Packet buffer = Tx=%dk Rx=%dk \n", - ((E1000_READ_REG(&adapter->hw, E1000_PBA) & 0xffff0000) >> 16),\ - (E1000_READ_REG(&adapter->hw, E1000_PBA) & 0xffff) ); - device_printf(dev, "Flow control watermarks high = %d low = %d\n", - adapter->hw.fc.high_water, - adapter->hw.fc.low_water); - device_printf(dev, "tx_int_delay = %d, tx_abs_int_delay = %d\n", - E1000_READ_REG(&adapter->hw, E1000_TIDV), - E1000_READ_REG(&adapter->hw, E1000_TADV)); - device_printf(dev, "rx_int_delay = %d, rx_abs_int_delay = %d\n", - E1000_READ_REG(&adapter->hw, E1000_RDTR), - E1000_READ_REG(&adapter->hw, E1000_RADV)); - device_printf(dev, "fifo workaround = %lld, fifo_reset_count = %lld\n", - (long long)adapter->tx_fifo_wrk_cnt, - (long long)adapter->tx_fifo_reset_cnt); - device_printf(dev, "hw tdh = %d, hw tdt = %d\n", - E1000_READ_REG(&adapter->hw, E1000_TDH(0)), - E1000_READ_REG(&adapter->hw, E1000_TDT(0))); - device_printf(dev, "hw rdh = %d, hw rdt = %d\n", - E1000_READ_REG(&adapter->hw, E1000_RDH(0)), - E1000_READ_REG(&adapter->hw, E1000_RDT(0))); - device_printf(dev, "Num Tx descriptors avail = %d\n", - adapter->num_tx_desc_avail); - device_printf(dev, "Tx Descriptors not avail1 = %ld\n", - adapter->no_tx_desc_avail1); - device_printf(dev, "Tx Descriptors not avail2 = %ld\n", - adapter->no_tx_desc_avail2); - device_printf(dev, "Std mbuf failed = %ld\n", - adapter->mbuf_alloc_failed); - device_printf(dev, "Std mbuf cluster failed = %ld\n", - adapter->mbuf_cluster_failed); - device_printf(dev, "Driver dropped packets = %ld\n", - adapter->dropped_pkts); - device_printf(dev, "Driver tx dma failure in encap = %ld\n", - adapter->no_tx_dma_setup); + adapter = oidp->oid_arg1; + val = E1000_READ_REG(&adapter->hw, oidp->oid_arg2); + return (sysctl_handle_int(oidp, &val, 0, req)); } +/* + * Add sysctl variables, one per statistic, to the system. + */ static void -lem_print_hw_stats(struct adapter *adapter) +lem_add_hw_stats(struct adapter *adapter) { device_t dev = adapter->dev; - device_printf(dev, "Excessive collisions = %lld\n", - (long long)adapter->stats.ecol); -#if (DEBUG_HW > 0) /* Dont output these errors normally */ - device_printf(dev, "Symbol errors = %lld\n", - (long long)adapter->stats.symerrs); -#endif - device_printf(dev, "Sequence errors = %lld\n", - (long long)adapter->stats.sec); - device_printf(dev, "Defer count = %lld\n", - (long long)adapter->stats.dc); - device_printf(dev, "Missed Packets = %lld\n", - (long long)adapter->stats.mpc); - device_printf(dev, "Receive No Buffers = %lld\n", - (long long)adapter->stats.rnbc); - /* RLEC is inaccurate on some hardware, calculate our own. */ - device_printf(dev, "Receive Length Errors = %lld\n", - ((long long)adapter->stats.roc + (long long)adapter->stats.ruc)); - device_printf(dev, "Receive errors = %lld\n", - (long long)adapter->stats.rxerrc); - device_printf(dev, "Crc errors = %lld\n", - (long long)adapter->stats.crcerrs); - device_printf(dev, "Alignment errors = %lld\n", - (long long)adapter->stats.algnerrc); - device_printf(dev, "Collision/Carrier extension errors = %lld\n", - (long long)adapter->stats.cexterr); - device_printf(dev, "RX overruns = %ld\n", adapter->rx_overruns); - device_printf(dev, "watchdog timeouts = %ld\n", - adapter->watchdog_events); - device_printf(dev, "RX MSIX IRQ = %ld TX MSIX IRQ = %ld" - " LINK MSIX IRQ = %ld\n", adapter->rx_irq, - adapter->tx_irq , adapter->link_irq); - device_printf(dev, "XON Rcvd = %lld\n", - (long long)adapter->stats.xonrxc); - device_printf(dev, "XON Xmtd = %lld\n", - (long long)adapter->stats.xontxc); - device_printf(dev, "XOFF Rcvd = %lld\n", - (long long)adapter->stats.xoffrxc); - device_printf(dev, "XOFF Xmtd = %lld\n", - (long long)adapter->stats.xofftxc); - device_printf(dev, "Good Packets Rcvd = %lld\n", - (long long)adapter->stats.gprc); - device_printf(dev, "Good Packets Xmtd = %lld\n", - (long long)adapter->stats.gptc); + struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(dev); + struct sysctl_oid *tree = device_get_sysctl_tree(dev); + struct sysctl_oid_list *child = SYSCTL_CHILDREN(tree); + struct e1000_hw_stats *stats = &adapter->stats; + + struct sysctl_oid *stat_node; + struct sysctl_oid_list *stat_list; + + /* Driver Statistics */ + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "mbuf_alloc_fail", + CTLFLAG_RD, &adapter->mbuf_alloc_failed, + "Std mbuf failed"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "cluster_alloc_fail", + CTLFLAG_RD, &adapter->mbuf_cluster_failed, + "Std mbuf cluster failed"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "dropped", + CTLFLAG_RD, &adapter->dropped_pkts, + "Driver dropped packets"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "tx_dma_fail", + CTLFLAG_RD, &adapter->no_tx_dma_setup, + "Driver tx dma failure in xmit"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "tx_desc_fail1", + CTLFLAG_RD, &adapter->no_tx_desc_avail1, + "Not enough tx descriptors failure in xmit"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "tx_desc_fail2", + CTLFLAG_RD, &adapter->no_tx_desc_avail2, + "Not enough tx descriptors failure in xmit"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "rx_overruns", + CTLFLAG_RD, &adapter->rx_overruns, + "RX overruns"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "watchdog_timeouts", + CTLFLAG_RD, &adapter->watchdog_events, + "Watchdog timeouts"); + + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "device_control", + CTLFLAG_RD, adapter, E1000_CTRL, + lem_sysctl_reg_handler, "IU", + "Device Control Register"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rx_control", + CTLFLAG_RD, adapter, E1000_RCTL, + lem_sysctl_reg_handler, "IU", + "Receiver Control Register"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "fc_high_water", + CTLFLAG_RD, &adapter->hw.fc.high_water, 0, + "Flow Control High Watermark"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "fc_low_water", + CTLFLAG_RD, &adapter->hw.fc.low_water, 0, + "Flow Control Low Watermark"); + SYSCTL_ADD_QUAD(ctx, child, OID_AUTO, "fifo_workaround", + CTLFLAG_RD, &adapter->tx_fifo_wrk_cnt, + "TX FIFO workaround events"); + SYSCTL_ADD_QUAD(ctx, child, OID_AUTO, "fifo_reset", + CTLFLAG_RD, &adapter->tx_fifo_reset_cnt, + "TX FIFO resets"); + + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "txd_head", + CTLFLAG_RD, adapter, E1000_TDH(0), + lem_sysctl_reg_handler, "IU", + "Transmit Descriptor Head"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "txd_tail", + CTLFLAG_RD, adapter, E1000_TDT(0), + lem_sysctl_reg_handler, "IU", + "Transmit Descriptor Tail"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rxd_head", + CTLFLAG_RD, adapter, E1000_RDH(0), + lem_sysctl_reg_handler, "IU", + "Receive Descriptor Head"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rxd_tail", + CTLFLAG_RD, adapter, E1000_RDT(0), + lem_sysctl_reg_handler, "IU", + "Receive Descriptor Tail"); + + + /* MAC stats get their own sub node */ + + stat_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "mac_stats", + CTLFLAG_RD, NULL, "Statistics"); + stat_list = SYSCTL_CHILDREN(stat_node); + + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "excess_coll", + CTLFLAG_RD, &stats->ecol, + "Excessive collisions"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "single_coll", + CTLFLAG_RD, &stats->scc, + "Single collisions"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "multiple_coll", + CTLFLAG_RD, &stats->mcc, + "Multiple collisions"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "late_coll", + CTLFLAG_RD, &stats->latecol, + "Late collisions"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "collision_count", + CTLFLAG_RD, &stats->colc, + "Collision Count"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "symbol_errors", + CTLFLAG_RD, &adapter->stats.symerrs, + "Symbol Errors"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "sequence_errors", + CTLFLAG_RD, &adapter->stats.sec, + "Sequence Errors"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "defer_count", + CTLFLAG_RD, &adapter->stats.dc, + "Defer Count"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "missed_packets", + CTLFLAG_RD, &adapter->stats.mpc, + "Missed Packets"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "recv_no_buff", + CTLFLAG_RD, &adapter->stats.rnbc, + "Receive No Buffers"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "recv_undersize", + CTLFLAG_RD, &adapter->stats.ruc, + "Receive Undersize"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "recv_fragmented", + CTLFLAG_RD, &adapter->stats.rfc, + "Fragmented Packets Received "); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "recv_oversize", + CTLFLAG_RD, &adapter->stats.roc, + "Oversized Packets Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "recv_jabber", + CTLFLAG_RD, &adapter->stats.rjc, + "Recevied Jabber"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "recv_errs", + CTLFLAG_RD, &adapter->stats.rxerrc, + "Receive Errors"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "crc_errs", + CTLFLAG_RD, &adapter->stats.crcerrs, + "CRC errors"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "alignment_errs", + CTLFLAG_RD, &adapter->stats.algnerrc, + "Alignment Errors"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "coll_ext_errs", + CTLFLAG_RD, &adapter->stats.cexterr, + "Collision/Carrier extension errors"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "xon_recvd", + CTLFLAG_RD, &adapter->stats.xonrxc, + "XON Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "xon_txd", + CTLFLAG_RD, &adapter->stats.xontxc, + "XON Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "xoff_recvd", + CTLFLAG_RD, &adapter->stats.xoffrxc, + "XOFF Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "xoff_txd", + CTLFLAG_RD, &adapter->stats.xofftxc, + "XOFF Transmitted"); + + /* Packet Reception Stats */ + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "total_pkts_recvd", + CTLFLAG_RD, &adapter->stats.tpr, + "Total Packets Received "); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "good_pkts_recvd", + CTLFLAG_RD, &adapter->stats.gprc, + "Good Packets Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "bcast_pkts_recvd", + CTLFLAG_RD, &adapter->stats.bprc, + "Broadcast Packets Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "mcast_pkts_recvd", + CTLFLAG_RD, &adapter->stats.mprc, + "Multicast Packets Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "rx_frames_64", + CTLFLAG_RD, &adapter->stats.prc64, + "64 byte frames received "); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "rx_frames_65_127", + CTLFLAG_RD, &adapter->stats.prc127, + "65-127 byte frames received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "rx_frames_128_255", + CTLFLAG_RD, &adapter->stats.prc255, + "128-255 byte frames received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "rx_frames_256_511", + CTLFLAG_RD, &adapter->stats.prc511, + "256-511 byte frames received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "rx_frames_512_1023", + CTLFLAG_RD, &adapter->stats.prc1023, + "512-1023 byte frames received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "rx_frames_1024_1522", + CTLFLAG_RD, &adapter->stats.prc1522, + "1023-1522 byte frames received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "good_octets_recvd", + CTLFLAG_RD, &adapter->stats.gorc, + "Good Octets Received"); + + /* Packet Transmission Stats */ + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "good_octets_txd", + CTLFLAG_RD, &adapter->stats.gotc, + "Good Octets Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "total_pkts_txd", + CTLFLAG_RD, &adapter->stats.tpt, + "Total Packets Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "good_pkts_txd", + CTLFLAG_RD, &adapter->stats.gptc, + "Good Packets Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "bcast_pkts_txd", + CTLFLAG_RD, &adapter->stats.bptc, + "Broadcast Packets Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "mcast_pkts_txd", + CTLFLAG_RD, &adapter->stats.mptc, + "Multicast Packets Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tx_frames_64", + CTLFLAG_RD, &adapter->stats.ptc64, + "64 byte frames transmitted "); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tx_frames_65_127", + CTLFLAG_RD, &adapter->stats.ptc127, + "65-127 byte frames transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tx_frames_128_255", + CTLFLAG_RD, &adapter->stats.ptc255, + "128-255 byte frames transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tx_frames_256_511", + CTLFLAG_RD, &adapter->stats.ptc511, + "256-511 byte frames transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tx_frames_512_1023", + CTLFLAG_RD, &adapter->stats.ptc1023, + "512-1023 byte frames transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tx_frames_1024_1522", + CTLFLAG_RD, &adapter->stats.ptc1522, + "1024-1522 byte frames transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tso_txd", + CTLFLAG_RD, &adapter->stats.tsctc, + "TSO Contexts Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tso_ctx_fail", + CTLFLAG_RD, &adapter->stats.tsctfc, + "TSO Contexts Failed"); } /********************************************************************** @@ -4432,28 +4558,9 @@ lem_print_hw_stats(struct adapter *adapt * 32 words, stuff that matters is in that extent. * **********************************************************************/ -static void -lem_print_nvm_info(struct adapter *adapter) -{ - u16 eeprom_data; - int i, j, row = 0; - - /* Its a bit crude, but it gets the job done */ - printf("\nInterface EEPROM Dump:\n"); - printf("Offset\n0x0000 "); - for (i = 0, j = 0; i < 32; i++, j++) { - if (j == 8) { /* Make the offset block */ - j = 0; ++row; - printf("\n0x00%x0 ",row); - } - e1000_read_nvm(&adapter->hw, i, 1, &eeprom_data); - printf("%04x ", eeprom_data); - } - printf("\n"); -} static int -lem_sysctl_debug_info(SYSCTL_HANDLER_ARGS) +lem_sysctl_nvm_info(SYSCTL_HANDLER_ARGS) { struct adapter *adapter; int error; @@ -4465,16 +4572,12 @@ lem_sysctl_debug_info(SYSCTL_HANDLER_ARG if (error || !req->newptr) return (error); - if (result == 1) { - adapter = (struct adapter *)arg1; - lem_print_debug_info(adapter); - } /* * This value will cause a hex dump of the * first 32 16-bit words of the EEPROM to * the screen. */ - if (result == 2) { + if (result == 1) { adapter = (struct adapter *)arg1; lem_print_nvm_info(adapter); } @@ -4482,26 +4585,24 @@ lem_sysctl_debug_info(SYSCTL_HANDLER_ARG return (error); } - -static int -lem_sysctl_stats(SYSCTL_HANDLER_ARGS) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 16:10:08 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8CB9510656B6; Mon, 20 Sep 2010 16:10:08 +0000 (UTC) (envelope-from xcllnt@mac.com) Received: from asmtpout030.mac.com (asmtpout030.mac.com [17.148.16.105]) by mx1.freebsd.org (Postfix) with ESMTP id 6F8AD8FC16; Mon, 20 Sep 2010 16:10:08 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=us-ascii Received: from macbook-pro.jnpr.net (natint3.juniper.net [66.129.224.36]) by asmtp030.mac.com (Sun Java(tm) System Messaging Server 6.3-8.01 (built Dec 16 2008; 32bit)) with ESMTPSA id <0L9100LRWZK8CX00@asmtp030.mac.com>; Mon, 20 Sep 2010 09:09:45 -0700 (PDT) X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 ipscore=0 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx engine=6.0.2-1004200000 definitions=main-1009200075 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.0.10011,1.0.148,0.0.0000 definitions=2010-09-20_11:2010-09-20, 2010-09-20, 1970-01-01 signatures=0 From: Marcel Moolenaar In-reply-to: <20100920163758.A788@besplex.bde.org> Date: Mon, 20 Sep 2010 09:09:43 -0700 Message-id: <11C42F9D-7201-4804-8923-430F28E58C57@mac.com> References: <201009200420.o8K4KtKn026514@svn.freebsd.org> <20100920163758.A788@besplex.bde.org> To: Bruce Evans X-Mailer: Apple Mail (2.1081) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, Marcel Moolenaar , src-committers@FreeBSD.org Subject: Re: svn commit: r212886 - head/sbin/growfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 16:10:08 -0000 On Sep 19, 2010, at 11:55 PM, Bruce Evans wrote: > On Mon, 20 Sep 2010, Marcel Moolenaar wrote: > >> Log: >> Unbreak the build on strong-aligned architectures (arm, ia64). >> Casting from (char *) to (struct ufs1_dinode *) changes the >> alignment requirement of the pointer and GCC does not know that >> the pointer is adequately aligned (due to malloc(3)), and warns >> about it. Cast to (void *) first to by-pass the check. > > A previous version in which the pointer (iobuf) the correct type to > begin with was better. It used to have type void *, but now has type > caddr_t (whose existence is a bug), in order to abuse caddr_t by > assuming that it is char * to do pointer arithmetic on it in 1 place > (iobuf + sblock.fs_cgsize). The 7 other places where iobuf is used > only assume that caddr_t is a pointer (or perhaps a [u]intptr_t). > > growfs has no other instances of caddr_t. My first instinct was to retype iobuf as (void *), but saw the pointer arithmetic and decided against it. If we had a macro that one can use to add X number of bytes to a pointer to any, I would have used that. Other macros to add X number of short, int, long, could be handy too, but that may not be as useful as for bytes. Would it be useful to add a macro like (don't mind the name): #define ADDBYTESTOPOINTER(ptr, cnt) \ ((__typeof(ptr))(void *)((uintptr_t)(void *)(ptr) + (cnt))) ? -- Marcel Moolenaar xcllnt@mac.com From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 16:43:19 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 839191065675; Mon, 20 Sep 2010 16:43:19 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6D3718FC17; Mon, 20 Sep 2010 16:43:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KGhJZE058849; Mon, 20 Sep 2010 16:43:19 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KGhJ95058838; Mon, 20 Sep 2010 16:43:19 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201009201643.o8KGhJ95058838@svn.freebsd.org> From: Dimitry Andric Date: Mon, 20 Sep 2010 16:43:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212904 - in head: contrib/llvm contrib/llvm/autoconf contrib/llvm/autoconf/m4 contrib/llvm/bindings/ada/llvm contrib/llvm/bindings/ocaml/llvm contrib/llvm/include/llvm contrib/llvm/inc... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 16:43:19 -0000 Author: dim Date: Mon Sep 20 16:43:17 2010 New Revision: 212904 URL: http://svn.freebsd.org/changeset/base/212904 Log: Upgrade our Clang in base to r114020, from upstream's release_28 branch. Approved-by: rpaulo (mentor) Added: head/contrib/llvm/include/llvm/ADT/NullablePtr.h - copied unchanged from r212799, vendor/llvm/dist/include/llvm/ADT/NullablePtr.h head/contrib/llvm/include/llvm/Analysis/RegionInfo.h - copied unchanged from r212799, vendor/llvm/dist/include/llvm/Analysis/RegionInfo.h head/contrib/llvm/include/llvm/Analysis/RegionIterator.h - copied unchanged from r212799, vendor/llvm/dist/include/llvm/Analysis/RegionIterator.h head/contrib/llvm/include/llvm/Analysis/RegionPrinter.h - copied unchanged from r212799, vendor/llvm/dist/include/llvm/Analysis/RegionPrinter.h head/contrib/llvm/include/llvm/Assembly/AssemblyAnnotationWriter.h - copied unchanged from r212799, vendor/llvm/dist/include/llvm/Assembly/AssemblyAnnotationWriter.h head/contrib/llvm/include/llvm/CompilerDriver/AutoGenerated.h - copied unchanged from r212799, vendor/llvm/dist/include/llvm/CompilerDriver/AutoGenerated.h head/contrib/llvm/include/llvm/CompilerDriver/Main.h - copied unchanged from r212799, vendor/llvm/dist/include/llvm/CompilerDriver/Main.h head/contrib/llvm/include/llvm/Config/llvm-config.h.cmake - copied unchanged from r212799, vendor/llvm/dist/include/llvm/Config/llvm-config.h.cmake head/contrib/llvm/include/llvm/Config/llvm-config.h.in - copied unchanged from r212799, vendor/llvm/dist/include/llvm/Config/llvm-config.h.in head/contrib/llvm/include/llvm/MC/ELFObjectWriter.h - copied unchanged from r212799, vendor/llvm/dist/include/llvm/MC/ELFObjectWriter.h head/contrib/llvm/include/llvm/MC/MCDwarf.h - copied unchanged from r212799, vendor/llvm/dist/include/llvm/MC/MCDwarf.h head/contrib/llvm/include/llvm/MC/MCELFSymbolFlags.h - copied unchanged from r212799, vendor/llvm/dist/include/llvm/MC/MCELFSymbolFlags.h head/contrib/llvm/include/llvm/PassRegistry.h - copied unchanged from r212799, vendor/llvm/dist/include/llvm/PassRegistry.h head/contrib/llvm/include/llvm/Support/CrashRecoveryContext.h - copied unchanged from r212799, vendor/llvm/dist/include/llvm/Support/CrashRecoveryContext.h head/contrib/llvm/include/llvm/Transforms/Utils/ValueMapper.h - copied unchanged from r212799, vendor/llvm/dist/include/llvm/Transforms/Utils/ValueMapper.h head/contrib/llvm/lib/Analysis/RegionInfo.cpp - copied unchanged from r212799, vendor/llvm/dist/lib/Analysis/RegionInfo.cpp head/contrib/llvm/lib/Analysis/RegionPrinter.cpp - copied unchanged from r212799, vendor/llvm/dist/lib/Analysis/RegionPrinter.cpp head/contrib/llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp - copied unchanged from r212799, vendor/llvm/dist/lib/Analysis/TypeBasedAliasAnalysis.cpp head/contrib/llvm/lib/CodeGen/LocalStackSlotAllocation.cpp - copied unchanged from r212799, vendor/llvm/dist/lib/CodeGen/LocalStackSlotAllocation.cpp head/contrib/llvm/lib/CodeGen/PeepholeOptimizer.cpp - copied unchanged from r212799, vendor/llvm/dist/lib/CodeGen/PeepholeOptimizer.cpp head/contrib/llvm/lib/CodeGen/RenderMachineFunction.cpp - copied unchanged from r212799, vendor/llvm/dist/lib/CodeGen/RenderMachineFunction.cpp head/contrib/llvm/lib/CodeGen/RenderMachineFunction.h - copied unchanged from r212799, vendor/llvm/dist/lib/CodeGen/RenderMachineFunction.h head/contrib/llvm/lib/CodeGen/SplitKit.cpp - copied unchanged from r212799, vendor/llvm/dist/lib/CodeGen/SplitKit.cpp head/contrib/llvm/lib/CodeGen/SplitKit.h - copied unchanged from r212799, vendor/llvm/dist/lib/CodeGen/SplitKit.h head/contrib/llvm/lib/CodeGen/Splitter.cpp - copied unchanged from r212799, vendor/llvm/dist/lib/CodeGen/Splitter.cpp head/contrib/llvm/lib/CodeGen/Splitter.h - copied unchanged from r212799, vendor/llvm/dist/lib/CodeGen/Splitter.h head/contrib/llvm/lib/MC/ELFObjectWriter.cpp - copied unchanged from r212799, vendor/llvm/dist/lib/MC/ELFObjectWriter.cpp head/contrib/llvm/lib/MC/MCDisassembler/ - copied from r212799, vendor/llvm/dist/lib/MC/MCDisassembler/ head/contrib/llvm/lib/MC/MCDwarf.cpp - copied unchanged from r212799, vendor/llvm/dist/lib/MC/MCDwarf.cpp head/contrib/llvm/lib/MC/MCELFStreamer.cpp - copied unchanged from r212799, vendor/llvm/dist/lib/MC/MCELFStreamer.cpp head/contrib/llvm/lib/Support/CrashRecoveryContext.cpp - copied unchanged from r212799, vendor/llvm/dist/lib/Support/CrashRecoveryContext.cpp head/contrib/llvm/lib/Target/ARM/ARMAsmPrinter.cpp - copied unchanged from r212799, vendor/llvm/dist/lib/Target/ARM/ARMAsmPrinter.cpp head/contrib/llvm/lib/Target/ARM/ARMFastISel.cpp - copied unchanged from r212799, vendor/llvm/dist/lib/Target/ARM/ARMFastISel.cpp head/contrib/llvm/lib/Target/ARM/ARMGlobalMerge.cpp - copied unchanged from r212799, vendor/llvm/dist/lib/Target/ARM/ARMGlobalMerge.cpp head/contrib/llvm/lib/Target/ARM/ARMMCInstLower.cpp - copied unchanged from r212799, vendor/llvm/dist/lib/Target/ARM/ARMMCInstLower.cpp head/contrib/llvm/lib/Target/ARM/ARMMCInstLower.h - copied unchanged from r212799, vendor/llvm/dist/lib/Target/ARM/ARMMCInstLower.h head/contrib/llvm/lib/Target/X86/AsmPrinter/X86InstComments.cpp - copied unchanged from r212799, vendor/llvm/dist/lib/Target/X86/AsmPrinter/X86InstComments.cpp head/contrib/llvm/lib/Target/X86/AsmPrinter/X86InstComments.h - copied unchanged from r212799, vendor/llvm/dist/lib/Target/X86/AsmPrinter/X86InstComments.h head/contrib/llvm/lib/Target/X86/X86AsmPrinter.cpp - copied unchanged from r212799, vendor/llvm/dist/lib/Target/X86/X86AsmPrinter.cpp head/contrib/llvm/lib/Target/X86/X86AsmPrinter.h - copied unchanged from r212799, vendor/llvm/dist/lib/Target/X86/X86AsmPrinter.h head/contrib/llvm/lib/Target/X86/X86InstrFMA.td - copied unchanged from r212799, vendor/llvm/dist/lib/Target/X86/X86InstrFMA.td head/contrib/llvm/lib/Target/X86/X86MCInstLower.cpp - copied unchanged from r212799, vendor/llvm/dist/lib/Target/X86/X86MCInstLower.cpp head/contrib/llvm/lib/Target/X86/X86MCInstLower.h - copied unchanged from r212799, vendor/llvm/dist/lib/Target/X86/X86MCInstLower.h head/contrib/llvm/lib/Target/X86/X86ShuffleDecode.h - copied unchanged from r212799, vendor/llvm/dist/lib/Target/X86/X86ShuffleDecode.h head/contrib/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp - copied unchanged from r212799, vendor/llvm/dist/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp head/contrib/llvm/lib/Transforms/Scalar/LowerAtomic.cpp - copied unchanged from r212799, vendor/llvm/dist/lib/Transforms/Scalar/LowerAtomic.cpp head/contrib/llvm/lib/VMCore/PassRegistry.cpp - copied unchanged from r212799, vendor/llvm/dist/lib/VMCore/PassRegistry.cpp head/contrib/llvm/runtime/libprofile/libprofile.exports - copied unchanged from r212799, vendor/llvm/dist/runtime/libprofile/libprofile.exports head/contrib/llvm/tools/bugpoint-passes/ - copied from r212799, vendor/llvm/dist/tools/bugpoint-passes/ head/contrib/llvm/tools/clang/include/clang/AST/OperationKinds.h - copied unchanged from r212799, vendor/clang/dist/include/clang/AST/OperationKinds.h head/contrib/llvm/tools/clang/include/clang/Analysis/Analyses/FormatString.h - copied, changed from r212799, vendor/clang/dist/include/clang/Analysis/Analyses/FormatString.h head/contrib/llvm/tools/clang/include/clang/Analysis/Analyses/PseudoConstantAnalysis.h - copied unchanged from r212799, vendor/clang/dist/include/clang/Analysis/Analyses/PseudoConstantAnalysis.h head/contrib/llvm/tools/clang/include/clang/Analysis/CFGStmtMap.h - copied unchanged from r212799, vendor/clang/dist/include/clang/Analysis/CFGStmtMap.h head/contrib/llvm/tools/clang/include/clang/Checker/PathSensitive/CheckerHelpers.h - copied unchanged from r212799, vendor/clang/dist/include/clang/Checker/PathSensitive/CheckerHelpers.h head/contrib/llvm/tools/clang/include/clang/FrontendTool/ - copied from r212799, vendor/clang/dist/include/clang/FrontendTool/ head/contrib/llvm/tools/clang/include/clang/Lex/CodeCompletionHandler.h - copied unchanged from r212799, vendor/clang/dist/include/clang/Lex/CodeCompletionHandler.h head/contrib/llvm/tools/clang/include/clang/Parse/ParseAST.h - copied unchanged from r212799, vendor/clang/dist/include/clang/Parse/ParseAST.h head/contrib/llvm/tools/clang/include/clang/Sema/AnalysisBasedWarnings.h - copied unchanged from r212799, vendor/clang/dist/include/clang/Sema/AnalysisBasedWarnings.h head/contrib/llvm/tools/clang/include/clang/Sema/AttributeList.h - copied unchanged from r212799, vendor/clang/dist/include/clang/Sema/AttributeList.h head/contrib/llvm/tools/clang/include/clang/Sema/CXXFieldCollector.h - copied unchanged from r212799, vendor/clang/dist/include/clang/Sema/CXXFieldCollector.h head/contrib/llvm/tools/clang/include/clang/Sema/DeclSpec.h - copied unchanged from r212799, vendor/clang/dist/include/clang/Sema/DeclSpec.h head/contrib/llvm/tools/clang/include/clang/Sema/DelayedDiagnostic.h - copied unchanged from r212799, vendor/clang/dist/include/clang/Sema/DelayedDiagnostic.h head/contrib/llvm/tools/clang/include/clang/Sema/Designator.h - copied unchanged from r212799, vendor/clang/dist/include/clang/Sema/Designator.h head/contrib/llvm/tools/clang/include/clang/Sema/IdentifierResolver.h - copied unchanged from r212799, vendor/clang/dist/include/clang/Sema/IdentifierResolver.h head/contrib/llvm/tools/clang/include/clang/Sema/Initialization.h - copied unchanged from r212799, vendor/clang/dist/include/clang/Sema/Initialization.h head/contrib/llvm/tools/clang/include/clang/Sema/Lookup.h - copied unchanged from r212799, vendor/clang/dist/include/clang/Sema/Lookup.h head/contrib/llvm/tools/clang/include/clang/Sema/ObjCMethodList.h - copied unchanged from r212799, vendor/clang/dist/include/clang/Sema/ObjCMethodList.h head/contrib/llvm/tools/clang/include/clang/Sema/Overload.h - copied unchanged from r212799, vendor/clang/dist/include/clang/Sema/Overload.h head/contrib/llvm/tools/clang/include/clang/Sema/Ownership.h - copied unchanged from r212799, vendor/clang/dist/include/clang/Sema/Ownership.h head/contrib/llvm/tools/clang/include/clang/Sema/ParsedTemplate.h - copied unchanged from r212799, vendor/clang/dist/include/clang/Sema/ParsedTemplate.h head/contrib/llvm/tools/clang/include/clang/Sema/PrettyDeclStackTrace.h - copied unchanged from r212799, vendor/clang/dist/include/clang/Sema/PrettyDeclStackTrace.h head/contrib/llvm/tools/clang/include/clang/Sema/Scope.h - copied unchanged from r212799, vendor/clang/dist/include/clang/Sema/Scope.h head/contrib/llvm/tools/clang/include/clang/Sema/ScopeInfo.h - copied unchanged from r212799, vendor/clang/dist/include/clang/Sema/ScopeInfo.h head/contrib/llvm/tools/clang/include/clang/Sema/Sema.h - copied unchanged from r212799, vendor/clang/dist/include/clang/Sema/Sema.h head/contrib/llvm/tools/clang/include/clang/Sema/SemaInternal.h - copied unchanged from r212799, vendor/clang/dist/include/clang/Sema/SemaInternal.h head/contrib/llvm/tools/clang/include/clang/Sema/Template.h - copied unchanged from r212799, vendor/clang/dist/include/clang/Sema/Template.h head/contrib/llvm/tools/clang/include/clang/Sema/TemplateDeduction.h - copied unchanged from r212799, vendor/clang/dist/include/clang/Sema/TemplateDeduction.h head/contrib/llvm/tools/clang/include/clang/Serialization/ - copied from r212799, vendor/clang/dist/include/clang/Serialization/ head/contrib/llvm/tools/clang/lib/AST/CXXABI.h - copied unchanged from r212799, vendor/clang/dist/lib/AST/CXXABI.h head/contrib/llvm/tools/clang/lib/AST/ItaniumCXXABI.cpp - copied unchanged from r212799, vendor/clang/dist/lib/AST/ItaniumCXXABI.cpp head/contrib/llvm/tools/clang/lib/AST/MicrosoftCXXABI.cpp - copied unchanged from r212799, vendor/clang/dist/lib/AST/MicrosoftCXXABI.cpp head/contrib/llvm/tools/clang/lib/Analysis/CFGStmtMap.cpp - copied unchanged from r212799, vendor/clang/dist/lib/Analysis/CFGStmtMap.cpp head/contrib/llvm/tools/clang/lib/Analysis/FormatString.cpp - copied unchanged from r212799, vendor/clang/dist/lib/Analysis/FormatString.cpp head/contrib/llvm/tools/clang/lib/Analysis/FormatStringParsing.h - copied unchanged from r212799, vendor/clang/dist/lib/Analysis/FormatStringParsing.h head/contrib/llvm/tools/clang/lib/Analysis/PseudoConstantAnalysis.cpp - copied unchanged from r212799, vendor/clang/dist/lib/Analysis/PseudoConstantAnalysis.cpp head/contrib/llvm/tools/clang/lib/Analysis/ScanfFormatString.cpp - copied unchanged from r212799, vendor/clang/dist/lib/Analysis/ScanfFormatString.cpp head/contrib/llvm/tools/clang/lib/Checker/AnalysisManager.cpp - copied unchanged from r212799, vendor/clang/dist/lib/Checker/AnalysisManager.cpp head/contrib/llvm/tools/clang/lib/Checker/CheckerHelpers.cpp - copied unchanged from r212799, vendor/clang/dist/lib/Checker/CheckerHelpers.cpp head/contrib/llvm/tools/clang/lib/Checker/UnreachableCodeChecker.cpp - copied unchanged from r212799, vendor/clang/dist/lib/Checker/UnreachableCodeChecker.cpp head/contrib/llvm/tools/clang/lib/FrontendTool/ - copied from r212799, vendor/clang/dist/lib/FrontendTool/ head/contrib/llvm/tools/clang/lib/Headers/avxintrin.h - copied unchanged from r212799, vendor/clang/dist/lib/Headers/avxintrin.h head/contrib/llvm/tools/clang/lib/Headers/immintrin.h - copied unchanged from r212799, vendor/clang/dist/lib/Headers/immintrin.h head/contrib/llvm/tools/clang/lib/Headers/x86intrin.h - copied unchanged from r212799, vendor/clang/dist/lib/Headers/x86intrin.h head/contrib/llvm/tools/clang/lib/Parse/ParseAST.cpp - copied unchanged from r212799, vendor/clang/dist/lib/Parse/ParseAST.cpp head/contrib/llvm/tools/clang/lib/Sema/AttributeList.cpp - copied unchanged from r212799, vendor/clang/dist/lib/Sema/AttributeList.cpp head/contrib/llvm/tools/clang/lib/Sema/DeclSpec.cpp - copied unchanged from r212799, vendor/clang/dist/lib/Sema/DeclSpec.cpp head/contrib/llvm/tools/clang/lib/Serialization/ - copied from r212799, vendor/clang/dist/lib/Serialization/ head/contrib/llvm/tools/clang/tools/driver/Info.plist.in - copied unchanged from r212799, vendor/clang/dist/tools/driver/Info.plist.in head/contrib/llvm/tools/clang/tools/libclang/CIndexCXX.cpp - copied unchanged from r212799, vendor/clang/dist/tools/libclang/CIndexCXX.cpp head/contrib/llvm/tools/clang/tools/libclang/CXType.cpp - copied unchanged from r212799, vendor/clang/dist/tools/libclang/CXType.cpp head/contrib/llvm/tools/clang/tools/libclang/CXType.h - copied unchanged from r212799, vendor/clang/dist/tools/libclang/CXType.h head/contrib/llvm/tools/llvm-diff/ - copied from r212799, vendor/llvm/dist/tools/llvm-diff/ head/contrib/llvm/tools/llvmc/examples/ - copied from r212799, vendor/llvm/dist/tools/llvmc/examples/ head/contrib/llvm/tools/llvmc/src/ - copied from r212799, vendor/llvm/dist/tools/llvmc/src/ head/contrib/llvm/utils/lit/lit/ExampleTests/required-and-missing.c - copied unchanged from r212799, vendor/llvm/dist/utils/lit/lit/ExampleTests/required-and-missing.c head/contrib/llvm/utils/lit/lit/ExampleTests/required-and-present.c - copied unchanged from r212799, vendor/llvm/dist/utils/lit/lit/ExampleTests/required-and-present.c head/contrib/llvm/utils/llvm-lit/ - copied from r212799, vendor/llvm/dist/utils/llvm-lit/ head/lib/clang/include/ARMGenAsmMatcher.inc (contents, props changed) head/lib/clang/include/ARMGenFastISel.inc (contents, props changed) head/lib/clang/include/X86GenDisassemblerTables.inc (contents, props changed) head/lib/clang/include/X86GenEDInfo.inc (contents, props changed) head/lib/clang/include/clang/AST/AttrImpl.inc (contents, props changed) head/lib/clang/include/clang/Serialization/ head/lib/clang/include/clang/Serialization/AttrPCHRead.inc (contents, props changed) head/lib/clang/include/clang/Serialization/AttrPCHWrite.inc (contents, props changed) head/lib/clang/include/llvm/Config/llvm-config.h (contents, props changed) head/lib/clang/libclangfrontendtool/ head/lib/clang/libclangfrontendtool/Makefile (contents, props changed) head/lib/clang/libclangindex/ head/lib/clang/libclangindex/Makefile (contents, props changed) head/lib/clang/libclangserialization/ head/lib/clang/libclangserialization/Makefile (contents, props changed) head/lib/clang/libllvmx86disassembler/ head/lib/clang/libllvmx86disassembler/Makefile (contents, props changed) Deleted: head/contrib/llvm/autoconf/m4/bison.m4 head/contrib/llvm/autoconf/m4/cxx_bidi_iterator.m4 head/contrib/llvm/autoconf/m4/cxx_fwd_iterator.m4 head/contrib/llvm/autoconf/m4/cxx_namespaces.m4 head/contrib/llvm/autoconf/m4/cxx_std_iterator.m4 head/contrib/llvm/autoconf/m4/flex.m4 head/contrib/llvm/include/llvm/ADT/iterator.cmake head/contrib/llvm/include/llvm/ADT/iterator.h.in head/contrib/llvm/include/llvm/Assembly/AsmAnnotationWriter.h head/contrib/llvm/include/llvm/CompilerDriver/ForceLinkage.h head/contrib/llvm/include/llvm/CompilerDriver/ForceLinkageMacros.h head/contrib/llvm/include/llvm/CompilerDriver/Plugin.h head/contrib/llvm/include/llvm/MC/MCParser/AsmParser.h head/contrib/llvm/include/llvm/Support/DataTypes.h.cmake head/contrib/llvm/include/llvm/Support/DataTypes.h.in head/contrib/llvm/include/llvm/Support/SlowOperationInformer.h head/contrib/llvm/include/llvm/Transforms/Utils/SSI.h head/contrib/llvm/lib/CodeGen/OptimizeExts.cpp head/contrib/llvm/lib/CompilerDriver/Plugin.cpp head/contrib/llvm/lib/Support/SlowOperationInformer.cpp head/contrib/llvm/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp head/contrib/llvm/lib/Target/ARM/AsmPrinter/ARMMCInstLower.cpp head/contrib/llvm/lib/Target/ARM/AsmPrinter/ARMMCInstLower.h head/contrib/llvm/lib/Target/MSIL/ head/contrib/llvm/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp head/contrib/llvm/lib/Target/X86/AsmPrinter/X86AsmPrinter.h head/contrib/llvm/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp head/contrib/llvm/lib/Target/X86/AsmPrinter/X86MCInstLower.h head/contrib/llvm/lib/Target/X86/X86FloatingPointRegKill.cpp head/contrib/llvm/lib/Transforms/Scalar/ABCD.cpp head/contrib/llvm/lib/Transforms/Utils/SSI.cpp head/contrib/llvm/lib/Transforms/Utils/ValueMapper.h head/contrib/llvm/mklib head/contrib/llvm/runtime/libprofile/BlockProfiling.c head/contrib/llvm/runtime/libprofile/FunctionProfiling.c head/contrib/llvm/runtime/libprofile/exported_symbols.lst head/contrib/llvm/tools/bugpoint/TestPasses.cpp head/contrib/llvm/tools/clang/VER head/contrib/llvm/tools/clang/include/clang/AST/DeclNodes.def head/contrib/llvm/tools/clang/include/clang/AST/StmtNodes.def head/contrib/llvm/tools/clang/include/clang/Analysis/Analyses/PrintfFormatString.h head/contrib/llvm/tools/clang/include/clang/Frontend/PCHBitCodes.h head/contrib/llvm/tools/clang/include/clang/Frontend/PCHDeserializationListener.h head/contrib/llvm/tools/clang/include/clang/Frontend/PCHReader.h head/contrib/llvm/tools/clang/include/clang/Frontend/PCHWriter.h head/contrib/llvm/tools/clang/include/clang/Index/Utils.h head/contrib/llvm/tools/clang/include/clang/Parse/Action.h head/contrib/llvm/tools/clang/include/clang/Parse/AttributeList.h head/contrib/llvm/tools/clang/include/clang/Parse/DeclSpec.h head/contrib/llvm/tools/clang/include/clang/Parse/Designator.h head/contrib/llvm/tools/clang/include/clang/Parse/Ownership.h head/contrib/llvm/tools/clang/include/clang/Parse/Scope.h head/contrib/llvm/tools/clang/include/clang/Parse/Template.h head/contrib/llvm/tools/clang/include/clang/Sema/ParseAST.h head/contrib/llvm/tools/clang/lib/Checker/CallInliner.cpp head/contrib/llvm/tools/clang/lib/Frontend/GeneratePCH.cpp head/contrib/llvm/tools/clang/lib/Frontend/PCHReader.cpp head/contrib/llvm/tools/clang/lib/Frontend/PCHReaderDecl.cpp head/contrib/llvm/tools/clang/lib/Frontend/PCHReaderStmt.cpp head/contrib/llvm/tools/clang/lib/Frontend/PCHWriter.cpp head/contrib/llvm/tools/clang/lib/Frontend/PCHWriterDecl.cpp head/contrib/llvm/tools/clang/lib/Frontend/PCHWriterStmt.cpp head/contrib/llvm/tools/clang/lib/Frontend/PrintParserCallbacks.cpp head/contrib/llvm/tools/clang/lib/Headers/arm_neon.h head/contrib/llvm/tools/clang/lib/Headers/arm_neon.td head/contrib/llvm/tools/clang/lib/Index/ResolveLocation.cpp head/contrib/llvm/tools/clang/lib/Parse/AttributeList.cpp head/contrib/llvm/tools/clang/lib/Parse/DeclSpec.cpp head/contrib/llvm/tools/clang/lib/Parse/MinimalAction.cpp head/contrib/llvm/tools/clang/lib/Runtime/ head/contrib/llvm/tools/clang/lib/Sema/AnalysisBasedWarnings.h head/contrib/llvm/tools/clang/lib/Sema/CXXFieldCollector.h head/contrib/llvm/tools/clang/lib/Sema/IdentifierResolver.h head/contrib/llvm/tools/clang/lib/Sema/Lookup.h head/contrib/llvm/tools/clang/lib/Sema/ParseAST.cpp head/contrib/llvm/tools/clang/lib/Sema/Sema.h head/contrib/llvm/tools/clang/lib/Sema/SemaInit.h head/contrib/llvm/tools/clang/lib/Sema/SemaOverload.h head/contrib/llvm/tools/clang/lib/Sema/SemaTemplate.h head/contrib/llvm/tools/clang/tools/CIndex/ head/contrib/llvm/tools/clang/tools/index-test/ head/contrib/llvm/tools/clang/tools/libclang/CXTypes.cpp head/contrib/llvm/tools/clang/utils/pch-test.pl head/contrib/llvm/tools/edis/EDDisassembler.cpp head/contrib/llvm/tools/edis/EDDisassembler.h head/contrib/llvm/tools/edis/EDInfo.td head/contrib/llvm/tools/edis/EDInst.cpp head/contrib/llvm/tools/edis/EDInst.h head/contrib/llvm/tools/edis/EDOperand.cpp head/contrib/llvm/tools/edis/EDOperand.h head/contrib/llvm/tools/edis/EDToken.cpp head/contrib/llvm/tools/edis/EDToken.h head/contrib/llvm/tools/llvmc/driver/Main.cpp head/contrib/llvm/tools/llvmc/driver/Makefile head/contrib/llvm/tools/llvmc/example/Hello/Hello.cpp head/contrib/llvm/tools/llvmc/example/Hello/Makefile head/contrib/llvm/tools/llvmc/example/Simple/Makefile head/contrib/llvm/tools/llvmc/example/Simple/PluginMain.cpp head/contrib/llvm/tools/llvmc/example/Simple/Simple.td head/contrib/llvm/tools/llvmc/example/Skeleton/Makefile head/contrib/llvm/tools/llvmc/example/Skeleton/README head/contrib/llvm/tools/llvmc/example/Skeleton/driver/Main.cpp head/contrib/llvm/tools/llvmc/example/Skeleton/driver/Makefile head/contrib/llvm/tools/llvmc/example/Skeleton/plugins/Makefile head/contrib/llvm/tools/llvmc/example/Skeleton/plugins/Plugin/Makefile head/contrib/llvm/tools/llvmc/example/Skeleton/plugins/Plugin/Plugin.td head/contrib/llvm/tools/llvmc/example/Skeleton/plugins/Plugin/PluginMain.cpp head/contrib/llvm/tools/llvmc/example/mcc16/Makefile head/contrib/llvm/tools/llvmc/example/mcc16/README head/contrib/llvm/tools/llvmc/example/mcc16/driver/Main.cpp head/contrib/llvm/tools/llvmc/example/mcc16/driver/Makefile head/contrib/llvm/tools/llvmc/example/mcc16/plugins/Makefile head/contrib/llvm/tools/llvmc/example/mcc16/plugins/PIC16Base/Makefile head/contrib/llvm/tools/llvmc/example/mcc16/plugins/PIC16Base/PIC16Base.td head/contrib/llvm/tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp head/contrib/llvm/tools/llvmc/plugins/Base/Base.td.in head/contrib/llvm/tools/llvmc/plugins/Base/Hooks.cpp head/contrib/llvm/tools/llvmc/plugins/Base/Makefile head/contrib/llvm/tools/llvmc/plugins/Base/PluginMain.cpp head/contrib/llvm/tools/llvmc/plugins/Clang/Clang.td head/contrib/llvm/tools/llvmc/plugins/Clang/Makefile head/contrib/llvm/tools/llvmc/plugins/Clang/PluginMain.cpp head/contrib/llvm/tools/llvmc/plugins/Makefile head/contrib/llvm/utils/RegressionFinder.pl head/contrib/llvm/utils/mkpatch head/contrib/llvm/utils/userloc.pl head/contrib/llvm/utils/valgrind/x86_64-pc-linux-gnu_gcc-4.3.3.supp Modified: head/contrib/llvm/CMakeLists.txt head/contrib/llvm/CREDITS.TXT head/contrib/llvm/Makefile head/contrib/llvm/Makefile.config.in head/contrib/llvm/Makefile.rules head/contrib/llvm/README.txt head/contrib/llvm/autoconf/configure.ac head/contrib/llvm/autoconf/m4/link_options.m4 head/contrib/llvm/bindings/ada/llvm/llvm.ads head/contrib/llvm/bindings/ocaml/llvm/llvm.ml head/contrib/llvm/bindings/ocaml/llvm/llvm.mli head/contrib/llvm/bindings/ocaml/llvm/llvm_ocaml.c head/contrib/llvm/configure head/contrib/llvm/include/llvm-c/Core.h head/contrib/llvm/include/llvm-c/EnhancedDisassembly.h head/contrib/llvm/include/llvm-c/ExecutionEngine.h head/contrib/llvm/include/llvm-c/Target.h head/contrib/llvm/include/llvm-c/lto.h head/contrib/llvm/include/llvm/ADT/APInt.h head/contrib/llvm/include/llvm/ADT/DenseMap.h head/contrib/llvm/include/llvm/ADT/DenseSet.h head/contrib/llvm/include/llvm/ADT/DepthFirstIterator.h head/contrib/llvm/include/llvm/ADT/FoldingSet.h head/contrib/llvm/include/llvm/ADT/ImmutableIntervalMap.h head/contrib/llvm/include/llvm/ADT/STLExtras.h head/contrib/llvm/include/llvm/ADT/ScopedHashTable.h head/contrib/llvm/include/llvm/ADT/SmallVector.h head/contrib/llvm/include/llvm/ADT/StringMap.h head/contrib/llvm/include/llvm/ADT/StringRef.h head/contrib/llvm/include/llvm/ADT/StringSet.h head/contrib/llvm/include/llvm/ADT/StringSwitch.h head/contrib/llvm/include/llvm/ADT/Triple.h head/contrib/llvm/include/llvm/ADT/ValueMap.h head/contrib/llvm/include/llvm/ADT/ilist.h head/contrib/llvm/include/llvm/Analysis/AliasAnalysis.h head/contrib/llvm/include/llvm/Analysis/AliasSetTracker.h head/contrib/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h head/contrib/llvm/include/llvm/Analysis/DebugInfo.h head/contrib/llvm/include/llvm/Analysis/Dominators.h head/contrib/llvm/include/llvm/Analysis/FindUsedTypes.h head/contrib/llvm/include/llvm/Analysis/IntervalPartition.h head/contrib/llvm/include/llvm/Analysis/LazyValueInfo.h head/contrib/llvm/include/llvm/Analysis/LibCallAliasAnalysis.h head/contrib/llvm/include/llvm/Analysis/LibCallSemantics.h head/contrib/llvm/include/llvm/Analysis/LoopDependenceAnalysis.h head/contrib/llvm/include/llvm/Analysis/LoopInfo.h head/contrib/llvm/include/llvm/Analysis/LoopPass.h head/contrib/llvm/include/llvm/Analysis/Passes.h head/contrib/llvm/include/llvm/Analysis/PointerTracking.h head/contrib/llvm/include/llvm/Analysis/PostDominators.h head/contrib/llvm/include/llvm/Analysis/ScalarEvolution.h head/contrib/llvm/include/llvm/Analysis/ScalarEvolutionExpander.h head/contrib/llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h head/contrib/llvm/include/llvm/Analysis/ValueTracking.h head/contrib/llvm/include/llvm/AutoUpgrade.h head/contrib/llvm/include/llvm/Bitcode/Archive.h head/contrib/llvm/include/llvm/Bitcode/BitstreamWriter.h head/contrib/llvm/include/llvm/Bitcode/LLVMBitCodes.h head/contrib/llvm/include/llvm/CallGraphSCCPass.h head/contrib/llvm/include/llvm/CodeGen/AsmPrinter.h head/contrib/llvm/include/llvm/CodeGen/CalcSpillWeights.h head/contrib/llvm/include/llvm/CodeGen/CallingConvLower.h head/contrib/llvm/include/llvm/CodeGen/FunctionLoweringInfo.h head/contrib/llvm/include/llvm/CodeGen/ISDOpcodes.h head/contrib/llvm/include/llvm/CodeGen/LiveInterval.h head/contrib/llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h head/contrib/llvm/include/llvm/CodeGen/LiveStackAnalysis.h head/contrib/llvm/include/llvm/CodeGen/LiveVariables.h head/contrib/llvm/include/llvm/CodeGen/MachineFrameInfo.h head/contrib/llvm/include/llvm/CodeGen/MachineFunction.h head/contrib/llvm/include/llvm/CodeGen/MachineFunctionPass.h head/contrib/llvm/include/llvm/CodeGen/MachineInstr.h head/contrib/llvm/include/llvm/CodeGen/MachineLoopInfo.h head/contrib/llvm/include/llvm/CodeGen/MachineModuleInfo.h head/contrib/llvm/include/llvm/CodeGen/Passes.h head/contrib/llvm/include/llvm/CodeGen/ProcessImplicitDefs.h head/contrib/llvm/include/llvm/CodeGen/SchedulerRegistry.h head/contrib/llvm/include/llvm/CodeGen/SelectionDAG.h head/contrib/llvm/include/llvm/CodeGen/SlotIndexes.h head/contrib/llvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h head/contrib/llvm/include/llvm/CodeGen/ValueTypes.h head/contrib/llvm/include/llvm/CompilerDriver/Action.h head/contrib/llvm/include/llvm/CompilerDriver/BuiltinOptions.h head/contrib/llvm/include/llvm/CompilerDriver/Common.td head/contrib/llvm/include/llvm/CompilerDriver/CompilationGraph.h head/contrib/llvm/include/llvm/CompilerDriver/Error.h head/contrib/llvm/include/llvm/CompilerDriver/Main.inc head/contrib/llvm/include/llvm/CompilerDriver/Tool.h head/contrib/llvm/include/llvm/Config/config.h.cmake head/contrib/llvm/include/llvm/Config/config.h.in head/contrib/llvm/include/llvm/Constants.h head/contrib/llvm/include/llvm/DerivedTypes.h head/contrib/llvm/include/llvm/ExecutionEngine/JITMemoryManager.h head/contrib/llvm/include/llvm/GlobalValue.h head/contrib/llvm/include/llvm/Instruction.h head/contrib/llvm/include/llvm/Instructions.h head/contrib/llvm/include/llvm/IntrinsicInst.h head/contrib/llvm/include/llvm/Intrinsics.td head/contrib/llvm/include/llvm/IntrinsicsARM.td head/contrib/llvm/include/llvm/IntrinsicsPowerPC.td head/contrib/llvm/include/llvm/IntrinsicsX86.td head/contrib/llvm/include/llvm/LLVMContext.h head/contrib/llvm/include/llvm/LinkAllPasses.h head/contrib/llvm/include/llvm/LinkAllVMCore.h head/contrib/llvm/include/llvm/Linker.h head/contrib/llvm/include/llvm/MC/MCAsmInfo.h head/contrib/llvm/include/llvm/MC/MCAssembler.h head/contrib/llvm/include/llvm/MC/MCContext.h head/contrib/llvm/include/llvm/MC/MCObjectStreamer.h head/contrib/llvm/include/llvm/MC/MCObjectWriter.h head/contrib/llvm/include/llvm/MC/MCParser/MCAsmParser.h head/contrib/llvm/include/llvm/MC/MCParser/MCAsmParserExtension.h head/contrib/llvm/include/llvm/MC/MCParser/MCParsedAsmOperand.h head/contrib/llvm/include/llvm/MC/MCSectionELF.h head/contrib/llvm/include/llvm/MC/MCStreamer.h head/contrib/llvm/include/llvm/Metadata.h head/contrib/llvm/include/llvm/Module.h head/contrib/llvm/include/llvm/Pass.h head/contrib/llvm/include/llvm/PassAnalysisSupport.h head/contrib/llvm/include/llvm/PassManager.h head/contrib/llvm/include/llvm/PassManagers.h head/contrib/llvm/include/llvm/PassSupport.h head/contrib/llvm/include/llvm/Support/COFF.h head/contrib/llvm/include/llvm/Support/CallSite.h head/contrib/llvm/include/llvm/Support/Casting.h head/contrib/llvm/include/llvm/Support/CommandLine.h head/contrib/llvm/include/llvm/Support/Compiler.h head/contrib/llvm/include/llvm/Support/ConstantRange.h head/contrib/llvm/include/llvm/Support/DataFlow.h head/contrib/llvm/include/llvm/Support/ELF.h head/contrib/llvm/include/llvm/Support/ErrorHandling.h head/contrib/llvm/include/llvm/Support/GraphWriter.h head/contrib/llvm/include/llvm/Support/IRBuilder.h head/contrib/llvm/include/llvm/Support/IRReader.h head/contrib/llvm/include/llvm/Support/MachO.h head/contrib/llvm/include/llvm/Support/MathExtras.h head/contrib/llvm/include/llvm/Support/PassNameParser.h head/contrib/llvm/include/llvm/Support/PatternMatch.h head/contrib/llvm/include/llvm/Support/PrettyStackTrace.h head/contrib/llvm/include/llvm/Support/Regex.h head/contrib/llvm/include/llvm/Support/Registry.h head/contrib/llvm/include/llvm/Support/SourceMgr.h head/contrib/llvm/include/llvm/Support/StandardPasses.h head/contrib/llvm/include/llvm/Support/SystemUtils.h head/contrib/llvm/include/llvm/Support/TypeBuilder.h head/contrib/llvm/include/llvm/Support/raw_ostream.h head/contrib/llvm/include/llvm/System/Memory.h head/contrib/llvm/include/llvm/System/Path.h head/contrib/llvm/include/llvm/System/Process.h head/contrib/llvm/include/llvm/System/Program.h head/contrib/llvm/include/llvm/System/Signals.h head/contrib/llvm/include/llvm/System/ThreadLocal.h head/contrib/llvm/include/llvm/Target/Target.td head/contrib/llvm/include/llvm/Target/TargetAsmParser.h head/contrib/llvm/include/llvm/Target/TargetCallingConv.td head/contrib/llvm/include/llvm/Target/TargetData.h head/contrib/llvm/include/llvm/Target/TargetInstrDesc.h head/contrib/llvm/include/llvm/Target/TargetInstrInfo.h head/contrib/llvm/include/llvm/Target/TargetLowering.h head/contrib/llvm/include/llvm/Target/TargetMachine.h head/contrib/llvm/include/llvm/Target/TargetOpcodes.h head/contrib/llvm/include/llvm/Target/TargetOptions.h head/contrib/llvm/include/llvm/Target/TargetRegisterInfo.h head/contrib/llvm/include/llvm/Target/TargetRegistry.h head/contrib/llvm/include/llvm/Target/TargetSelect.h head/contrib/llvm/include/llvm/Transforms/IPO.h head/contrib/llvm/include/llvm/Transforms/IPO/InlinerPass.h head/contrib/llvm/include/llvm/Transforms/Scalar.h head/contrib/llvm/include/llvm/Transforms/Utils/Cloning.h head/contrib/llvm/include/llvm/Transforms/Utils/Local.h head/contrib/llvm/include/llvm/Transforms/Utils/SSAUpdater.h head/contrib/llvm/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h head/contrib/llvm/include/llvm/Type.h head/contrib/llvm/include/llvm/Use.h head/contrib/llvm/include/llvm/Value.h head/contrib/llvm/include/llvm/ValueSymbolTable.h head/contrib/llvm/lib/Analysis/AliasAnalysis.cpp head/contrib/llvm/lib/Analysis/AliasAnalysisCounter.cpp head/contrib/llvm/lib/Analysis/AliasAnalysisEvaluator.cpp head/contrib/llvm/lib/Analysis/AliasDebugger.cpp head/contrib/llvm/lib/Analysis/AliasSetTracker.cpp head/contrib/llvm/lib/Analysis/BasicAliasAnalysis.cpp head/contrib/llvm/lib/Analysis/CFGPrinter.cpp head/contrib/llvm/lib/Analysis/CMakeLists.txt head/contrib/llvm/lib/Analysis/CaptureTracking.cpp head/contrib/llvm/lib/Analysis/ConstantFolding.cpp head/contrib/llvm/lib/Analysis/DbgInfoPrinter.cpp head/contrib/llvm/lib/Analysis/DebugInfo.cpp head/contrib/llvm/lib/Analysis/DomPrinter.cpp head/contrib/llvm/lib/Analysis/IPA/CallGraph.cpp head/contrib/llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp head/contrib/llvm/lib/Analysis/IPA/FindUsedTypes.cpp head/contrib/llvm/lib/Analysis/IPA/GlobalsModRef.cpp head/contrib/llvm/lib/Analysis/IVUsers.cpp head/contrib/llvm/lib/Analysis/InlineCost.cpp head/contrib/llvm/lib/Analysis/InstCount.cpp head/contrib/llvm/lib/Analysis/IntervalPartition.cpp head/contrib/llvm/lib/Analysis/LazyValueInfo.cpp head/contrib/llvm/lib/Analysis/LibCallAliasAnalysis.cpp head/contrib/llvm/lib/Analysis/LibCallSemantics.cpp head/contrib/llvm/lib/Analysis/Lint.cpp head/contrib/llvm/lib/Analysis/LiveValues.cpp head/contrib/llvm/lib/Analysis/LoopDependenceAnalysis.cpp head/contrib/llvm/lib/Analysis/LoopInfo.cpp head/contrib/llvm/lib/Analysis/LoopPass.cpp head/contrib/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp head/contrib/llvm/lib/Analysis/ModuleDebugInfoPrinter.cpp head/contrib/llvm/lib/Analysis/PointerTracking.cpp head/contrib/llvm/lib/Analysis/PostDominators.cpp head/contrib/llvm/lib/Analysis/ProfileEstimatorPass.cpp head/contrib/llvm/lib/Analysis/ProfileInfo.cpp head/contrib/llvm/lib/Analysis/ProfileInfoLoaderPass.cpp head/contrib/llvm/lib/Analysis/ProfileVerifierPass.cpp head/contrib/llvm/lib/Analysis/ScalarEvolution.cpp head/contrib/llvm/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp head/contrib/llvm/lib/Analysis/ScalarEvolutionExpander.cpp head/contrib/llvm/lib/Analysis/ScalarEvolutionNormalization.cpp head/contrib/llvm/lib/Analysis/ValueTracking.cpp head/contrib/llvm/lib/AsmParser/LLLexer.cpp head/contrib/llvm/lib/AsmParser/LLParser.cpp head/contrib/llvm/lib/AsmParser/LLParser.h head/contrib/llvm/lib/AsmParser/LLToken.h head/contrib/llvm/lib/AsmParser/Parser.cpp head/contrib/llvm/lib/Bitcode/Reader/BitcodeReader.cpp head/contrib/llvm/lib/Bitcode/Reader/BitcodeReader.h head/contrib/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp head/contrib/llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp head/contrib/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp head/contrib/llvm/lib/Bitcode/Writer/ValueEnumerator.h head/contrib/llvm/lib/CodeGen/AggressiveAntiDepBreaker.cpp head/contrib/llvm/lib/CodeGen/AggressiveAntiDepBreaker.h head/contrib/llvm/lib/CodeGen/Analysis.cpp head/contrib/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp head/contrib/llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp head/contrib/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp head/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp head/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h head/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfException.cpp head/contrib/llvm/lib/CodeGen/BranchFolding.cpp head/contrib/llvm/lib/CodeGen/CMakeLists.txt head/contrib/llvm/lib/CodeGen/CalcSpillWeights.cpp head/contrib/llvm/lib/CodeGen/CodePlacementOpt.cpp head/contrib/llvm/lib/CodeGen/CriticalAntiDepBreaker.cpp head/contrib/llvm/lib/CodeGen/CriticalAntiDepBreaker.h head/contrib/llvm/lib/CodeGen/DeadMachineInstructionElim.cpp head/contrib/llvm/lib/CodeGen/DwarfEHPrepare.cpp head/contrib/llvm/lib/CodeGen/ELF.h head/contrib/llvm/lib/CodeGen/ELFCodeEmitter.cpp head/contrib/llvm/lib/CodeGen/ELFWriter.cpp head/contrib/llvm/lib/CodeGen/ELFWriter.h head/contrib/llvm/lib/CodeGen/GCMetadata.cpp head/contrib/llvm/lib/CodeGen/GCStrategy.cpp head/contrib/llvm/lib/CodeGen/IfConversion.cpp head/contrib/llvm/lib/CodeGen/InlineSpiller.cpp head/contrib/llvm/lib/CodeGen/IntrinsicLowering.cpp head/contrib/llvm/lib/CodeGen/LLVMTargetMachine.cpp head/contrib/llvm/lib/CodeGen/LiveInterval.cpp head/contrib/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp head/contrib/llvm/lib/CodeGen/LiveStackAnalysis.cpp head/contrib/llvm/lib/CodeGen/LiveVariables.cpp head/contrib/llvm/lib/CodeGen/LowerSubregs.cpp head/contrib/llvm/lib/CodeGen/MachineBasicBlock.cpp head/contrib/llvm/lib/CodeGen/MachineCSE.cpp head/contrib/llvm/lib/CodeGen/MachineDominators.cpp head/contrib/llvm/lib/CodeGen/MachineFunction.cpp head/contrib/llvm/lib/CodeGen/MachineFunctionAnalysis.cpp head/contrib/llvm/lib/CodeGen/MachineFunctionPrinterPass.cpp head/contrib/llvm/lib/CodeGen/MachineInstr.cpp head/contrib/llvm/lib/CodeGen/MachineLICM.cpp head/contrib/llvm/lib/CodeGen/MachineLoopInfo.cpp head/contrib/llvm/lib/CodeGen/MachineModuleInfo.cpp head/contrib/llvm/lib/CodeGen/MachineSink.cpp head/contrib/llvm/lib/CodeGen/MachineVerifier.cpp head/contrib/llvm/lib/CodeGen/OptimizePHIs.cpp head/contrib/llvm/lib/CodeGen/PBQP/HeuristicBase.h head/contrib/llvm/lib/CodeGen/PBQP/HeuristicSolver.h head/contrib/llvm/lib/CodeGen/PBQP/Heuristics/Briggs.h head/contrib/llvm/lib/CodeGen/PBQP/Solution.h head/contrib/llvm/lib/CodeGen/PHIElimination.cpp head/contrib/llvm/lib/CodeGen/PHIElimination.h head/contrib/llvm/lib/CodeGen/PostRASchedulerList.cpp head/contrib/llvm/lib/CodeGen/PreAllocSplitting.cpp head/contrib/llvm/lib/CodeGen/ProcessImplicitDefs.cpp head/contrib/llvm/lib/CodeGen/PrologEpilogInserter.cpp head/contrib/llvm/lib/CodeGen/PrologEpilogInserter.h head/contrib/llvm/lib/CodeGen/RegAllocFast.cpp head/contrib/llvm/lib/CodeGen/RegAllocLinearScan.cpp head/contrib/llvm/lib/CodeGen/RegAllocPBQP.cpp head/contrib/llvm/lib/CodeGen/RegisterCoalescer.cpp head/contrib/llvm/lib/CodeGen/RegisterScavenging.cpp head/contrib/llvm/lib/CodeGen/ScheduleDAGInstrs.cpp head/contrib/llvm/lib/CodeGen/ScheduleDAGInstrs.h head/contrib/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp head/contrib/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp head/contrib/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp head/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp head/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp head/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h head/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp head/contrib/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp head/contrib/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp head/contrib/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp head/contrib/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp head/contrib/llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp head/contrib/llvm/lib/CodeGen/SimpleRegisterCoalescing.h head/contrib/llvm/lib/CodeGen/SjLjEHPrepare.cpp head/contrib/llvm/lib/CodeGen/SlotIndexes.cpp head/contrib/llvm/lib/CodeGen/Spiller.cpp head/contrib/llvm/lib/CodeGen/Spiller.h head/contrib/llvm/lib/CodeGen/StackProtector.cpp head/contrib/llvm/lib/CodeGen/StackSlotColoring.cpp head/contrib/llvm/lib/CodeGen/StrongPHIElimination.cpp head/contrib/llvm/lib/CodeGen/TailDuplication.cpp head/contrib/llvm/lib/CodeGen/TargetInstrInfoImpl.cpp head/contrib/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp head/contrib/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp head/contrib/llvm/lib/CodeGen/UnreachableBlockElim.cpp head/contrib/llvm/lib/CodeGen/VirtRegMap.cpp head/contrib/llvm/lib/CodeGen/VirtRegMap.h head/contrib/llvm/lib/CodeGen/VirtRegRewriter.cpp head/contrib/llvm/lib/CompilerDriver/Action.cpp head/contrib/llvm/lib/CompilerDriver/BuiltinOptions.cpp head/contrib/llvm/lib/CompilerDriver/CompilationGraph.cpp head/contrib/llvm/lib/CompilerDriver/Main.cpp head/contrib/llvm/lib/CompilerDriver/Makefile head/contrib/llvm/lib/ExecutionEngine/ExecutionEngineBindings.cpp head/contrib/llvm/lib/ExecutionEngine/JIT/Intercept.cpp head/contrib/llvm/lib/ExecutionEngine/JIT/JIT.cpp head/contrib/llvm/lib/ExecutionEngine/JIT/JITDebugRegisterer.cpp head/contrib/llvm/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp head/contrib/llvm/lib/ExecutionEngine/JIT/JITDwarfEmitter.h head/contrib/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp head/contrib/llvm/lib/Linker/LinkModules.cpp head/contrib/llvm/lib/MC/CMakeLists.txt head/contrib/llvm/lib/MC/MCAsmInfo.cpp head/contrib/llvm/lib/MC/MCAsmInfoDarwin.cpp head/contrib/llvm/lib/MC/MCAsmStreamer.cpp head/contrib/llvm/lib/MC/MCAssembler.cpp head/contrib/llvm/lib/MC/MCContext.cpp head/contrib/llvm/lib/MC/MCMachOStreamer.cpp head/contrib/llvm/lib/MC/MCNullStreamer.cpp head/contrib/llvm/lib/MC/MCObjectStreamer.cpp head/contrib/llvm/lib/MC/MCParser/AsmLexer.cpp head/contrib/llvm/lib/MC/MCParser/AsmParser.cpp head/contrib/llvm/lib/MC/MCParser/DarwinAsmParser.cpp head/contrib/llvm/lib/MC/MCParser/ELFAsmParser.cpp head/contrib/llvm/lib/MC/MCParser/MCAsmParser.cpp head/contrib/llvm/lib/MC/MCParser/TargetAsmParser.cpp head/contrib/llvm/lib/MC/MCStreamer.cpp head/contrib/llvm/lib/MC/MachObjectWriter.cpp head/contrib/llvm/lib/MC/Makefile head/contrib/llvm/lib/MC/WinCOFFObjectWriter.cpp head/contrib/llvm/lib/MC/WinCOFFStreamer.cpp head/contrib/llvm/lib/Support/APFloat.cpp head/contrib/llvm/lib/Support/APInt.cpp head/contrib/llvm/lib/Support/CMakeLists.txt head/contrib/llvm/lib/Support/ConstantRange.cpp head/contrib/llvm/lib/Support/ErrorHandling.cpp head/contrib/llvm/lib/Support/FoldingSet.cpp head/contrib/llvm/lib/Support/PrettyStackTrace.cpp head/contrib/llvm/lib/Support/SmallVector.cpp head/contrib/llvm/lib/Support/Statistic.cpp head/contrib/llvm/lib/Support/StringRef.cpp head/contrib/llvm/lib/Support/SystemUtils.cpp head/contrib/llvm/lib/Support/Triple.cpp head/contrib/llvm/lib/Support/raw_ostream.cpp head/contrib/llvm/lib/System/DynamicLibrary.cpp head/contrib/llvm/lib/System/Path.cpp head/contrib/llvm/lib/System/RWMutex.cpp head/contrib/llvm/lib/System/ThreadLocal.cpp head/contrib/llvm/lib/System/Unix/Path.inc head/contrib/llvm/lib/System/Unix/Signals.inc head/contrib/llvm/lib/System/Unix/ThreadLocal.inc head/contrib/llvm/lib/System/Win32/Path.inc head/contrib/llvm/lib/System/Win32/Signals.inc head/contrib/llvm/lib/System/Win32/ThreadLocal.inc head/contrib/llvm/lib/Target/ARM/ARM.h head/contrib/llvm/lib/Target/ARM/ARM.td head/contrib/llvm/lib/Target/ARM/ARMAddressingModes.h head/contrib/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp head/contrib/llvm/lib/Target/ARM/ARMBaseInstrInfo.h head/contrib/llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp head/contrib/llvm/lib/Target/ARM/ARMBaseRegisterInfo.h head/contrib/llvm/lib/Target/ARM/ARMCallingConv.td head/contrib/llvm/lib/Target/ARM/ARMCodeEmitter.cpp head/contrib/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp head/contrib/llvm/lib/Target/ARM/ARMExpandPseudoInsts.cpp head/contrib/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp head/contrib/llvm/lib/Target/ARM/ARMISelLowering.cpp head/contrib/llvm/lib/Target/ARM/ARMISelLowering.h head/contrib/llvm/lib/Target/ARM/ARMInstrFormats.td head/contrib/llvm/lib/Target/ARM/ARMInstrInfo.td head/contrib/llvm/lib/Target/ARM/ARMInstrNEON.td head/contrib/llvm/lib/Target/ARM/ARMInstrThumb.td head/contrib/llvm/lib/Target/ARM/ARMInstrThumb2.td head/contrib/llvm/lib/Target/ARM/ARMInstrVFP.td head/contrib/llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp head/contrib/llvm/lib/Target/ARM/ARMMachineFunctionInfo.h head/contrib/llvm/lib/Target/ARM/ARMRegisterInfo.td head/contrib/llvm/lib/Target/ARM/ARMSubtarget.cpp head/contrib/llvm/lib/Target/ARM/ARMSubtarget.h head/contrib/llvm/lib/Target/ARM/ARMTargetMachine.cpp head/contrib/llvm/lib/Target/ARM/ARMTargetMachine.h head/contrib/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp head/contrib/llvm/lib/Target/ARM/AsmPrinter/ARMInstPrinter.cpp head/contrib/llvm/lib/Target/ARM/AsmPrinter/ARMInstPrinter.h head/contrib/llvm/lib/Target/ARM/AsmPrinter/CMakeLists.txt head/contrib/llvm/lib/Target/ARM/CMakeLists.txt head/contrib/llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp head/contrib/llvm/lib/Target/ARM/Disassembler/ARMDisassemblerCore.cpp head/contrib/llvm/lib/Target/ARM/Disassembler/ARMDisassemblerCore.h head/contrib/llvm/lib/Target/ARM/Disassembler/ThumbDisassemblerCore.h head/contrib/llvm/lib/Target/ARM/Makefile head/contrib/llvm/lib/Target/ARM/NEONMoveFix.cpp head/contrib/llvm/lib/Target/ARM/NEONPreAllocPass.cpp head/contrib/llvm/lib/Target/ARM/README.txt head/contrib/llvm/lib/Target/ARM/Thumb1RegisterInfo.cpp head/contrib/llvm/lib/Target/ARM/Thumb1RegisterInfo.h head/contrib/llvm/lib/Target/ARM/Thumb2ITBlockPass.cpp head/contrib/llvm/lib/Target/ARM/Thumb2InstrInfo.cpp head/contrib/llvm/lib/Target/ARM/Thumb2SizeReduction.cpp head/contrib/llvm/lib/Target/Alpha/AlphaBranchSelector.cpp head/contrib/llvm/lib/Target/Alpha/AlphaCodeEmitter.cpp head/contrib/llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp head/contrib/llvm/lib/Target/Alpha/AlphaInstrInfo.cpp head/contrib/llvm/lib/Target/Alpha/AlphaInstrInfo.h head/contrib/llvm/lib/Target/Alpha/AlphaLLRP.cpp head/contrib/llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp head/contrib/llvm/lib/Target/Alpha/AlphaRegisterInfo.h head/contrib/llvm/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp head/contrib/llvm/lib/Target/Blackfin/BlackfinInstrInfo.cpp head/contrib/llvm/lib/Target/Blackfin/BlackfinInstrInfo.h head/contrib/llvm/lib/Target/Blackfin/BlackfinRegisterInfo.cpp head/contrib/llvm/lib/Target/Blackfin/BlackfinRegisterInfo.h head/contrib/llvm/lib/Target/CBackend/CBackend.cpp head/contrib/llvm/lib/Target/CellSPU/SPUCallingConv.td head/contrib/llvm/lib/Target/CellSPU/SPUISelDAGToDAG.cpp head/contrib/llvm/lib/Target/CellSPU/SPUISelLowering.cpp head/contrib/llvm/lib/Target/CellSPU/SPUInstrInfo.cpp head/contrib/llvm/lib/Target/CellSPU/SPUInstrInfo.h head/contrib/llvm/lib/Target/CellSPU/SPUInstrInfo.td head/contrib/llvm/lib/Target/CellSPU/SPUOperands.td head/contrib/llvm/lib/Target/CellSPU/SPURegisterInfo.cpp head/contrib/llvm/lib/Target/CellSPU/SPURegisterInfo.h head/contrib/llvm/lib/Target/CellSPU/SPURegisterInfo.td head/contrib/llvm/lib/Target/CppBackend/CPPBackend.cpp head/contrib/llvm/lib/Target/MBlaze/AsmPrinter/MBlazeAsmPrinter.cpp head/contrib/llvm/lib/Target/MBlaze/MBlaze.td head/contrib/llvm/lib/Target/MBlaze/MBlazeCallingConv.td head/contrib/llvm/lib/Target/MBlaze/MBlazeDelaySlotFiller.cpp head/contrib/llvm/lib/Target/MBlaze/MBlazeISelDAGToDAG.cpp head/contrib/llvm/lib/Target/MBlaze/MBlazeInstrFPU.td head/contrib/llvm/lib/Target/MBlaze/MBlazeInstrFSL.td head/contrib/llvm/lib/Target/MBlaze/MBlazeInstrFormats.td head/contrib/llvm/lib/Target/MBlaze/MBlazeInstrInfo.cpp head/contrib/llvm/lib/Target/MBlaze/MBlazeInstrInfo.h head/contrib/llvm/lib/Target/MBlaze/MBlazeInstrInfo.td head/contrib/llvm/lib/Target/MBlaze/MBlazeIntrinsics.td head/contrib/llvm/lib/Target/MBlaze/MBlazeRegisterInfo.cpp head/contrib/llvm/lib/Target/MBlaze/MBlazeRegisterInfo.h head/contrib/llvm/lib/Target/MBlaze/MBlazeRegisterInfo.td head/contrib/llvm/lib/Target/MBlaze/MBlazeSchedule.td head/contrib/llvm/lib/Target/MSP430/MSP430BranchSelector.cpp head/contrib/llvm/lib/Target/MSP430/MSP430InstrInfo.cpp head/contrib/llvm/lib/Target/MSP430/MSP430InstrInfo.h head/contrib/llvm/lib/Target/MSP430/MSP430RegisterInfo.cpp head/contrib/llvm/lib/Target/MSP430/MSP430RegisterInfo.h head/contrib/llvm/lib/Target/Mangler.cpp head/contrib/llvm/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp head/contrib/llvm/lib/Target/Mips/Mips.td head/contrib/llvm/lib/Target/Mips/MipsCallingConv.td head/contrib/llvm/lib/Target/Mips/MipsDelaySlotFiller.cpp head/contrib/llvm/lib/Target/Mips/MipsISelDAGToDAG.cpp head/contrib/llvm/lib/Target/Mips/MipsISelLowering.cpp head/contrib/llvm/lib/Target/Mips/MipsInstrFPU.td head/contrib/llvm/lib/Target/Mips/MipsInstrFormats.td head/contrib/llvm/lib/Target/Mips/MipsInstrInfo.cpp head/contrib/llvm/lib/Target/Mips/MipsInstrInfo.h head/contrib/llvm/lib/Target/Mips/MipsInstrInfo.td head/contrib/llvm/lib/Target/Mips/MipsRegisterInfo.cpp head/contrib/llvm/lib/Target/Mips/MipsRegisterInfo.h head/contrib/llvm/lib/Target/Mips/MipsRegisterInfo.td head/contrib/llvm/lib/Target/Mips/MipsSchedule.td head/contrib/llvm/lib/Target/PIC16/CMakeLists.txt head/contrib/llvm/lib/Target/PIC16/PIC16.h head/contrib/llvm/lib/Target/PIC16/PIC16ISelLowering.cpp head/contrib/llvm/lib/Target/PIC16/PIC16ISelLowering.h head/contrib/llvm/lib/Target/PIC16/PIC16InstrInfo.cpp head/contrib/llvm/lib/Target/PIC16/PIC16InstrInfo.h head/contrib/llvm/lib/Target/PIC16/PIC16MemSelOpt.cpp head/contrib/llvm/lib/Target/PIC16/PIC16Passes/PIC16Cloner.cpp head/contrib/llvm/lib/Target/PIC16/PIC16Passes/PIC16Cloner.h head/contrib/llvm/lib/Target/PIC16/PIC16Passes/PIC16Overlay.cpp head/contrib/llvm/lib/Target/PIC16/PIC16Passes/PIC16Overlay.h head/contrib/llvm/lib/Target/PIC16/PIC16RegisterInfo.cpp head/contrib/llvm/lib/Target/PIC16/PIC16RegisterInfo.h head/contrib/llvm/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp head/contrib/llvm/lib/Target/PowerPC/PPCBranchSelector.cpp head/contrib/llvm/lib/Target/PowerPC/PPCCallingConv.td head/contrib/llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp head/contrib/llvm/lib/Target/PowerPC/PPCISelLowering.cpp head/contrib/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp head/contrib/llvm/lib/Target/PowerPC/PPCInstrInfo.h head/contrib/llvm/lib/Target/PowerPC/PPCInstrInfo.td head/contrib/llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp head/contrib/llvm/lib/Target/PowerPC/PPCRegisterInfo.h head/contrib/llvm/lib/Target/PowerPC/PPCSubtarget.cpp head/contrib/llvm/lib/Target/PowerPC/PPCSubtarget.h head/contrib/llvm/lib/Target/README.txt head/contrib/llvm/lib/Target/Sparc/DelaySlotFiller.cpp head/contrib/llvm/lib/Target/Sparc/FPMover.cpp head/contrib/llvm/lib/Target/Sparc/Sparc.td head/contrib/llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp head/contrib/llvm/lib/Target/Sparc/SparcInstrInfo.cpp head/contrib/llvm/lib/Target/Sparc/SparcInstrInfo.h head/contrib/llvm/lib/Target/Sparc/SparcInstrInfo.td head/contrib/llvm/lib/Target/Sparc/SparcRegisterInfo.cpp head/contrib/llvm/lib/Target/Sparc/SparcRegisterInfo.h head/contrib/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp head/contrib/llvm/lib/Target/SystemZ/SystemZInstrInfo.h head/contrib/llvm/lib/Target/SystemZ/SystemZRegisterInfo.cpp head/contrib/llvm/lib/Target/SystemZ/SystemZRegisterInfo.h head/contrib/llvm/lib/Target/TargetData.cpp head/contrib/llvm/lib/Target/TargetMachine.cpp head/contrib/llvm/lib/Target/TargetRegisterInfo.cpp head/contrib/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp head/contrib/llvm/lib/Target/X86/AsmPrinter/CMakeLists.txt head/contrib/llvm/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp head/contrib/llvm/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.h head/contrib/llvm/lib/Target/X86/AsmPrinter/X86IntelInstPrinter.cpp head/contrib/llvm/lib/Target/X86/AsmPrinter/X86IntelInstPrinter.h head/contrib/llvm/lib/Target/X86/CMakeLists.txt head/contrib/llvm/lib/Target/X86/README-FPStack.txt head/contrib/llvm/lib/Target/X86/README-SSE.txt head/contrib/llvm/lib/Target/X86/README.txt head/contrib/llvm/lib/Target/X86/SSEDomainFix.cpp head/contrib/llvm/lib/Target/X86/X86.h head/contrib/llvm/lib/Target/X86/X86.td head/contrib/llvm/lib/Target/X86/X86AsmBackend.cpp head/contrib/llvm/lib/Target/X86/X86CallingConv.td head/contrib/llvm/lib/Target/X86/X86CodeEmitter.cpp head/contrib/llvm/lib/Target/X86/X86FastISel.cpp head/contrib/llvm/lib/Target/X86/X86FloatingPoint.cpp head/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp head/contrib/llvm/lib/Target/X86/X86ISelLowering.h head/contrib/llvm/lib/Target/X86/X86Instr64bit.td head/contrib/llvm/lib/Target/X86/X86InstrFPStack.td head/contrib/llvm/lib/Target/X86/X86InstrFormats.td head/contrib/llvm/lib/Target/X86/X86InstrFragmentsSIMD.td head/contrib/llvm/lib/Target/X86/X86InstrInfo.cpp head/contrib/llvm/lib/Target/X86/X86InstrInfo.h head/contrib/llvm/lib/Target/X86/X86InstrInfo.td head/contrib/llvm/lib/Target/X86/X86InstrMMX.td head/contrib/llvm/lib/Target/X86/X86InstrSSE.td head/contrib/llvm/lib/Target/X86/X86MCAsmInfo.cpp head/contrib/llvm/lib/Target/X86/X86MCCodeEmitter.cpp head/contrib/llvm/lib/Target/X86/X86RegisterInfo.cpp head/contrib/llvm/lib/Target/X86/X86RegisterInfo.h head/contrib/llvm/lib/Target/X86/X86RegisterInfo.td head/contrib/llvm/lib/Target/X86/X86Subtarget.cpp head/contrib/llvm/lib/Target/X86/X86Subtarget.h head/contrib/llvm/lib/Target/X86/X86TargetMachine.cpp head/contrib/llvm/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp head/contrib/llvm/lib/Target/XCore/CMakeLists.txt head/contrib/llvm/lib/Target/XCore/XCoreISelDAGToDAG.cpp head/contrib/llvm/lib/Target/XCore/XCoreInstrInfo.cpp head/contrib/llvm/lib/Target/XCore/XCoreInstrInfo.h head/contrib/llvm/lib/Target/XCore/XCoreInstrInfo.td head/contrib/llvm/lib/Target/XCore/XCoreRegisterInfo.cpp head/contrib/llvm/lib/Target/XCore/XCoreRegisterInfo.h head/contrib/llvm/lib/Transforms/Hello/Hello.cpp head/contrib/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp head/contrib/llvm/lib/Transforms/IPO/ConstantMerge.cpp head/contrib/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp head/contrib/llvm/lib/Transforms/IPO/DeadTypeElimination.cpp head/contrib/llvm/lib/Transforms/IPO/ExtractGV.cpp head/contrib/llvm/lib/Transforms/IPO/FunctionAttrs.cpp head/contrib/llvm/lib/Transforms/IPO/GlobalDCE.cpp head/contrib/llvm/lib/Transforms/IPO/GlobalOpt.cpp head/contrib/llvm/lib/Transforms/IPO/IPConstantPropagation.cpp head/contrib/llvm/lib/Transforms/IPO/InlineAlways.cpp head/contrib/llvm/lib/Transforms/IPO/InlineSimple.cpp head/contrib/llvm/lib/Transforms/IPO/Inliner.cpp head/contrib/llvm/lib/Transforms/IPO/Internalize.cpp head/contrib/llvm/lib/Transforms/IPO/LoopExtractor.cpp head/contrib/llvm/lib/Transforms/IPO/LowerSetJmp.cpp head/contrib/llvm/lib/Transforms/IPO/MergeFunctions.cpp head/contrib/llvm/lib/Transforms/IPO/PartialInlining.cpp head/contrib/llvm/lib/Transforms/IPO/PartialSpecialization.cpp head/contrib/llvm/lib/Transforms/IPO/PruneEH.cpp head/contrib/llvm/lib/Transforms/IPO/StripDeadPrototypes.cpp head/contrib/llvm/lib/Transforms/IPO/StripSymbols.cpp head/contrib/llvm/lib/Transforms/IPO/StructRetPromotion.cpp head/contrib/llvm/lib/Transforms/InstCombine/InstCombine.h head/contrib/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp head/contrib/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp head/contrib/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp head/contrib/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp head/contrib/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp head/contrib/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp head/contrib/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp head/contrib/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp head/contrib/llvm/lib/Transforms/Instrumentation/EdgeProfiling.cpp head/contrib/llvm/lib/Transforms/Instrumentation/OptimalEdgeProfiling.cpp head/contrib/llvm/lib/Transforms/Scalar/ADCE.cpp head/contrib/llvm/lib/Transforms/Scalar/BasicBlockPlacement.cpp head/contrib/llvm/lib/Transforms/Scalar/CMakeLists.txt head/contrib/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp head/contrib/llvm/lib/Transforms/Scalar/ConstantProp.cpp head/contrib/llvm/lib/Transforms/Scalar/DCE.cpp head/contrib/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp head/contrib/llvm/lib/Transforms/Scalar/GEPSplitter.cpp head/contrib/llvm/lib/Transforms/Scalar/GVN.cpp head/contrib/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp head/contrib/llvm/lib/Transforms/Scalar/JumpThreading.cpp head/contrib/llvm/lib/Transforms/Scalar/LICM.cpp head/contrib/llvm/lib/Transforms/Scalar/LoopDeletion.cpp head/contrib/llvm/lib/Transforms/Scalar/LoopIndexSplit.cpp head/contrib/llvm/lib/Transforms/Scalar/LoopRotation.cpp head/contrib/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp head/contrib/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp head/contrib/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp head/contrib/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp head/contrib/llvm/lib/Transforms/Scalar/Reassociate.cpp head/contrib/llvm/lib/Transforms/Scalar/Reg2Mem.cpp head/contrib/llvm/lib/Transforms/Scalar/SCCP.cpp head/contrib/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp head/contrib/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp head/contrib/llvm/lib/Transforms/Scalar/SimplifyHalfPowrLibCalls.cpp head/contrib/llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp head/contrib/llvm/lib/Transforms/Scalar/Sink.cpp head/contrib/llvm/lib/Transforms/Scalar/TailDuplication.cpp head/contrib/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp head/contrib/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp head/contrib/llvm/lib/Transforms/Utils/BasicInliner.cpp head/contrib/llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp head/contrib/llvm/lib/Transforms/Utils/BuildLibCalls.cpp head/contrib/llvm/lib/Transforms/Utils/CMakeLists.txt head/contrib/llvm/lib/Transforms/Utils/CloneFunction.cpp head/contrib/llvm/lib/Transforms/Utils/CloneModule.cpp head/contrib/llvm/lib/Transforms/Utils/InlineFunction.cpp head/contrib/llvm/lib/Transforms/Utils/InstructionNamer.cpp head/contrib/llvm/lib/Transforms/Utils/LCSSA.cpp head/contrib/llvm/lib/Transforms/Utils/Local.cpp head/contrib/llvm/lib/Transforms/Utils/LoopSimplify.cpp head/contrib/llvm/lib/Transforms/Utils/LoopUnroll.cpp head/contrib/llvm/lib/Transforms/Utils/LowerInvoke.cpp head/contrib/llvm/lib/Transforms/Utils/LowerSwitch.cpp head/contrib/llvm/lib/Transforms/Utils/Mem2Reg.cpp head/contrib/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp head/contrib/llvm/lib/Transforms/Utils/SSAUpdater.cpp head/contrib/llvm/lib/Transforms/Utils/SimplifyCFG.cpp head/contrib/llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp head/contrib/llvm/lib/Transforms/Utils/ValueMapper.cpp head/contrib/llvm/lib/VMCore/AsmWriter.cpp head/contrib/llvm/lib/VMCore/AutoUpgrade.cpp head/contrib/llvm/lib/VMCore/CMakeLists.txt head/contrib/llvm/lib/VMCore/ConstantFold.cpp head/contrib/llvm/lib/VMCore/Constants.cpp head/contrib/llvm/lib/VMCore/ConstantsContext.h head/contrib/llvm/lib/VMCore/Core.cpp head/contrib/llvm/lib/VMCore/Dominators.cpp head/contrib/llvm/lib/VMCore/Globals.cpp head/contrib/llvm/lib/VMCore/InlineAsm.cpp head/contrib/llvm/lib/VMCore/Instruction.cpp head/contrib/llvm/lib/VMCore/Instructions.cpp head/contrib/llvm/lib/VMCore/LLVMContext.cpp head/contrib/llvm/lib/VMCore/LLVMContextImpl.cpp head/contrib/llvm/lib/VMCore/LLVMContextImpl.h head/contrib/llvm/lib/VMCore/Metadata.cpp head/contrib/llvm/lib/VMCore/Module.cpp head/contrib/llvm/lib/VMCore/Pass.cpp head/contrib/llvm/lib/VMCore/PassManager.cpp head/contrib/llvm/lib/VMCore/PrintModulePass.cpp head/contrib/llvm/lib/VMCore/Type.cpp head/contrib/llvm/lib/VMCore/TypesContext.h head/contrib/llvm/lib/VMCore/Use.cpp head/contrib/llvm/lib/VMCore/Value.cpp head/contrib/llvm/lib/VMCore/ValueSymbolTable.cpp head/contrib/llvm/lib/VMCore/Verifier.cpp head/contrib/llvm/runtime/libprofile/Makefile head/contrib/llvm/tools/CMakeLists.txt head/contrib/llvm/tools/Makefile head/contrib/llvm/tools/bugpoint/BugDriver.cpp head/contrib/llvm/tools/bugpoint/BugDriver.h head/contrib/llvm/tools/bugpoint/CMakeLists.txt head/contrib/llvm/tools/bugpoint/CrashDebugger.cpp head/contrib/llvm/tools/bugpoint/ExecutionDriver.cpp head/contrib/llvm/tools/bugpoint/ExtractFunction.cpp head/contrib/llvm/tools/bugpoint/FindBugs.cpp head/contrib/llvm/tools/bugpoint/Miscompilation.cpp head/contrib/llvm/tools/bugpoint/OptimizerDriver.cpp head/contrib/llvm/tools/bugpoint/ToolRunner.cpp head/contrib/llvm/tools/bugpoint/bugpoint.cpp head/contrib/llvm/tools/clang/include/clang-c/Index.h head/contrib/llvm/tools/clang/include/clang/AST/ASTConsumer.h head/contrib/llvm/tools/clang/include/clang/AST/ASTContext.h head/contrib/llvm/tools/clang/include/clang/AST/ASTImporter.h head/contrib/llvm/tools/clang/include/clang/AST/Attr.h head/contrib/llvm/tools/clang/include/clang/AST/CMakeLists.txt head/contrib/llvm/tools/clang/include/clang/AST/CanonicalType.h head/contrib/llvm/tools/clang/include/clang/AST/Decl.h head/contrib/llvm/tools/clang/include/clang/AST/DeclBase.h head/contrib/llvm/tools/clang/include/clang/AST/DeclCXX.h head/contrib/llvm/tools/clang/include/clang/AST/DeclContextInternals.h head/contrib/llvm/tools/clang/include/clang/AST/DeclFriend.h head/contrib/llvm/tools/clang/include/clang/AST/DeclGroup.h head/contrib/llvm/tools/clang/include/clang/AST/DeclObjC.h head/contrib/llvm/tools/clang/include/clang/AST/DeclTemplate.h head/contrib/llvm/tools/clang/include/clang/AST/DeclarationName.h head/contrib/llvm/tools/clang/include/clang/AST/Expr.h head/contrib/llvm/tools/clang/include/clang/AST/ExprCXX.h head/contrib/llvm/tools/clang/include/clang/AST/ExternalASTSource.h head/contrib/llvm/tools/clang/include/clang/AST/FullExpr.h head/contrib/llvm/tools/clang/include/clang/AST/Makefile head/contrib/llvm/tools/clang/include/clang/AST/NestedNameSpecifier.h head/contrib/llvm/tools/clang/include/clang/AST/RecursiveASTVisitor.h head/contrib/llvm/tools/clang/include/clang/AST/Redeclarable.h head/contrib/llvm/tools/clang/include/clang/AST/Stmt.h head/contrib/llvm/tools/clang/include/clang/AST/StmtCXX.h head/contrib/llvm/tools/clang/include/clang/AST/StmtVisitor.h head/contrib/llvm/tools/clang/include/clang/AST/Type.h head/contrib/llvm/tools/clang/include/clang/AST/TypeLoc.h head/contrib/llvm/tools/clang/include/clang/AST/TypeOrdering.h head/contrib/llvm/tools/clang/include/clang/Analysis/Analyses/LiveVariables.h head/contrib/llvm/tools/clang/include/clang/Analysis/AnalysisContext.h head/contrib/llvm/tools/clang/include/clang/Analysis/CFG.h head/contrib/llvm/tools/clang/include/clang/Analysis/FlowSensitive/DataflowSolver.h head/contrib/llvm/tools/clang/include/clang/Analysis/ProgramPoint.h head/contrib/llvm/tools/clang/include/clang/Analysis/Visitors/CFGStmtVisitor.h head/contrib/llvm/tools/clang/include/clang/Basic/Attr.td head/contrib/llvm/tools/clang/include/clang/Basic/Builtins.def head/contrib/llvm/tools/clang/include/clang/Basic/Builtins.h head/contrib/llvm/tools/clang/include/clang/Basic/BuiltinsARM.def head/contrib/llvm/tools/clang/include/clang/Basic/BuiltinsX86.def head/contrib/llvm/tools/clang/include/clang/Basic/DeclNodes.td head/contrib/llvm/tools/clang/include/clang/Basic/Diagnostic.h head/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticCommonKinds.td head/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticDriverKinds.td head/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticFrontendKinds.td head/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticGroups.td head/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticLexKinds.td head/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticParseKinds.td head/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td head/contrib/llvm/tools/clang/include/clang/Basic/IdentifierTable.h head/contrib/llvm/tools/clang/include/clang/Basic/LangOptions.h head/contrib/llvm/tools/clang/include/clang/Basic/Linkage.h head/contrib/llvm/tools/clang/include/clang/Basic/Makefile head/contrib/llvm/tools/clang/include/clang/Basic/OnDiskHashTable.h head/contrib/llvm/tools/clang/include/clang/Basic/SourceManager.h head/contrib/llvm/tools/clang/include/clang/Basic/Specifiers.h head/contrib/llvm/tools/clang/include/clang/Basic/StmtNodes.td head/contrib/llvm/tools/clang/include/clang/Basic/TargetInfo.h head/contrib/llvm/tools/clang/include/clang/Basic/TargetOptions.h head/contrib/llvm/tools/clang/include/clang/Basic/TokenKinds.def head/contrib/llvm/tools/clang/include/clang/Basic/arm_neon.td head/contrib/llvm/tools/clang/include/clang/CMakeLists.txt head/contrib/llvm/tools/clang/include/clang/Checker/BugReporter/BugReporter.h head/contrib/llvm/tools/clang/include/clang/Checker/PathSensitive/AnalysisManager.h head/contrib/llvm/tools/clang/include/clang/Checker/PathSensitive/Checker.h head/contrib/llvm/tools/clang/include/clang/Checker/PathSensitive/ConstraintManager.h head/contrib/llvm/tools/clang/include/clang/Checker/PathSensitive/Environment.h head/contrib/llvm/tools/clang/include/clang/Checker/PathSensitive/GRCoreEngine.h head/contrib/llvm/tools/clang/include/clang/Checker/PathSensitive/GRExprEngine.h head/contrib/llvm/tools/clang/include/clang/Checker/PathSensitive/GRState.h head/contrib/llvm/tools/clang/include/clang/Checker/PathSensitive/GRSubEngine.h head/contrib/llvm/tools/clang/include/clang/Checker/PathSensitive/GRTransferFuncs.h head/contrib/llvm/tools/clang/include/clang/Checker/PathSensitive/GRWorkList.h head/contrib/llvm/tools/clang/include/clang/Checker/PathSensitive/MemRegion.h head/contrib/llvm/tools/clang/include/clang/Checker/PathSensitive/SVals.h head/contrib/llvm/tools/clang/include/clang/Checker/PathSensitive/Store.h head/contrib/llvm/tools/clang/include/clang/Checker/PathSensitive/SymbolManager.h head/contrib/llvm/tools/clang/include/clang/Checker/PathSensitive/ValueManager.h head/contrib/llvm/tools/clang/include/clang/Driver/CC1Options.td head/contrib/llvm/tools/clang/include/clang/Driver/Compilation.h head/contrib/llvm/tools/clang/include/clang/Driver/Driver.h head/contrib/llvm/tools/clang/include/clang/Driver/HostInfo.h head/contrib/llvm/tools/clang/include/clang/Driver/Job.h head/contrib/llvm/tools/clang/include/clang/Driver/OptParser.td head/contrib/llvm/tools/clang/include/clang/Driver/OptTable.h head/contrib/llvm/tools/clang/include/clang/Driver/Option.h head/contrib/llvm/tools/clang/include/clang/Driver/Options.td head/contrib/llvm/tools/clang/include/clang/Driver/Tool.h head/contrib/llvm/tools/clang/include/clang/Driver/ToolChain.h head/contrib/llvm/tools/clang/include/clang/Frontend/ASTConsumers.h head/contrib/llvm/tools/clang/include/clang/Frontend/ASTUnit.h head/contrib/llvm/tools/clang/include/clang/Frontend/AnalyzerOptions.h head/contrib/llvm/tools/clang/include/clang/Frontend/CodeGenOptions.h head/contrib/llvm/tools/clang/include/clang/Frontend/CompilerInstance.h head/contrib/llvm/tools/clang/include/clang/Frontend/DeclXML.def head/contrib/llvm/tools/clang/include/clang/Frontend/DiagnosticOptions.h head/contrib/llvm/tools/clang/include/clang/Frontend/DocumentXML.h head/contrib/llvm/tools/clang/include/clang/Frontend/FrontendAction.h head/contrib/llvm/tools/clang/include/clang/Frontend/FrontendActions.h head/contrib/llvm/tools/clang/include/clang/Frontend/FrontendOptions.h head/contrib/llvm/tools/clang/include/clang/Frontend/HeaderSearchOptions.h head/contrib/llvm/tools/clang/include/clang/Frontend/PreprocessorOptions.h head/contrib/llvm/tools/clang/include/clang/Frontend/PreprocessorOutputOptions.h head/contrib/llvm/tools/clang/include/clang/Frontend/StmtXML.def head/contrib/llvm/tools/clang/include/clang/Frontend/TypeXML.def head/contrib/llvm/tools/clang/include/clang/Frontend/Utils.h head/contrib/llvm/tools/clang/include/clang/Index/TranslationUnit.h head/contrib/llvm/tools/clang/include/clang/Lex/ExternalPreprocessorSource.h head/contrib/llvm/tools/clang/include/clang/Lex/HeaderSearch.h head/contrib/llvm/tools/clang/include/clang/Lex/Lexer.h head/contrib/llvm/tools/clang/include/clang/Lex/MacroInfo.h head/contrib/llvm/tools/clang/include/clang/Lex/PPCallbacks.h head/contrib/llvm/tools/clang/include/clang/Lex/PTHLexer.h head/contrib/llvm/tools/clang/include/clang/Lex/PreprocessingRecord.h head/contrib/llvm/tools/clang/include/clang/Lex/Preprocessor.h head/contrib/llvm/tools/clang/include/clang/Lex/Token.h head/contrib/llvm/tools/clang/include/clang/Makefile head/contrib/llvm/tools/clang/include/clang/Parse/Parser.h head/contrib/llvm/tools/clang/include/clang/Rewrite/FixItRewriter.h head/contrib/llvm/tools/clang/include/clang/Rewrite/FrontendActions.h head/contrib/llvm/tools/clang/include/clang/Sema/CodeCompleteConsumer.h head/contrib/llvm/tools/clang/include/clang/Sema/ExternalSemaSource.h head/contrib/llvm/tools/clang/lib/AST/ASTConsumer.cpp head/contrib/llvm/tools/clang/lib/AST/ASTContext.cpp head/contrib/llvm/tools/clang/lib/AST/ASTDiagnostic.cpp head/contrib/llvm/tools/clang/lib/AST/ASTImporter.cpp head/contrib/llvm/tools/clang/lib/AST/AttrImpl.cpp head/contrib/llvm/tools/clang/lib/AST/CMakeLists.txt head/contrib/llvm/tools/clang/lib/AST/Decl.cpp head/contrib/llvm/tools/clang/lib/AST/DeclBase.cpp head/contrib/llvm/tools/clang/lib/AST/DeclCXX.cpp head/contrib/llvm/tools/clang/lib/AST/DeclGroup.cpp head/contrib/llvm/tools/clang/lib/AST/DeclObjC.cpp head/contrib/llvm/tools/clang/lib/AST/DeclPrinter.cpp head/contrib/llvm/tools/clang/lib/AST/DeclTemplate.cpp head/contrib/llvm/tools/clang/lib/AST/DeclarationName.cpp head/contrib/llvm/tools/clang/lib/AST/Expr.cpp head/contrib/llvm/tools/clang/lib/AST/ExprCXX.cpp head/contrib/llvm/tools/clang/lib/AST/ExprClassification.cpp head/contrib/llvm/tools/clang/lib/AST/ExprConstant.cpp head/contrib/llvm/tools/clang/lib/AST/FullExpr.cpp head/contrib/llvm/tools/clang/lib/AST/Makefile head/contrib/llvm/tools/clang/lib/AST/NestedNameSpecifier.cpp head/contrib/llvm/tools/clang/lib/AST/ParentMap.cpp head/contrib/llvm/tools/clang/lib/AST/RecordLayout.cpp head/contrib/llvm/tools/clang/lib/AST/RecordLayoutBuilder.cpp head/contrib/llvm/tools/clang/lib/AST/Stmt.cpp head/contrib/llvm/tools/clang/lib/AST/StmtDumper.cpp head/contrib/llvm/tools/clang/lib/AST/StmtPrinter.cpp head/contrib/llvm/tools/clang/lib/AST/StmtProfile.cpp head/contrib/llvm/tools/clang/lib/AST/TemplateBase.cpp head/contrib/llvm/tools/clang/lib/AST/Type.cpp head/contrib/llvm/tools/clang/lib/AST/TypeLoc.cpp head/contrib/llvm/tools/clang/lib/AST/TypePrinter.cpp head/contrib/llvm/tools/clang/lib/Analysis/AnalysisContext.cpp head/contrib/llvm/tools/clang/lib/Analysis/CFG.cpp head/contrib/llvm/tools/clang/lib/Analysis/CMakeLists.txt head/contrib/llvm/tools/clang/lib/Analysis/LiveVariables.cpp head/contrib/llvm/tools/clang/lib/Analysis/Makefile head/contrib/llvm/tools/clang/lib/Analysis/PrintfFormatString.cpp head/contrib/llvm/tools/clang/lib/Analysis/ReachableCode.cpp head/contrib/llvm/tools/clang/lib/Analysis/UninitializedValues.cpp head/contrib/llvm/tools/clang/lib/Basic/Builtins.cpp head/contrib/llvm/tools/clang/lib/Basic/Diagnostic.cpp head/contrib/llvm/tools/clang/lib/Basic/FileManager.cpp head/contrib/llvm/tools/clang/lib/Basic/IdentifierTable.cpp head/contrib/llvm/tools/clang/lib/Basic/Makefile head/contrib/llvm/tools/clang/lib/Basic/SourceManager.cpp head/contrib/llvm/tools/clang/lib/Basic/TargetInfo.cpp head/contrib/llvm/tools/clang/lib/Basic/Targets.cpp head/contrib/llvm/tools/clang/lib/Basic/Version.cpp head/contrib/llvm/tools/clang/lib/CMakeLists.txt head/contrib/llvm/tools/clang/lib/Checker/AdjustedReturnValueChecker.cpp head/contrib/llvm/tools/clang/lib/Checker/AggExprVisitor.cpp head/contrib/llvm/tools/clang/lib/Checker/AnalysisConsumer.cpp head/contrib/llvm/tools/clang/lib/Checker/ArrayBoundChecker.cpp head/contrib/llvm/tools/clang/lib/Checker/BasicObjCFoundationChecks.cpp head/contrib/llvm/tools/clang/lib/Checker/BasicStore.cpp head/contrib/llvm/tools/clang/lib/Checker/BasicValueFactory.cpp head/contrib/llvm/tools/clang/lib/Checker/BugReporter.cpp head/contrib/llvm/tools/clang/lib/Checker/BugReporterVisitors.cpp head/contrib/llvm/tools/clang/lib/Checker/CFRefCount.cpp head/contrib/llvm/tools/clang/lib/Checker/CMakeLists.txt head/contrib/llvm/tools/clang/lib/Checker/CStringChecker.cpp head/contrib/llvm/tools/clang/lib/Checker/CallAndMessageChecker.cpp head/contrib/llvm/tools/clang/lib/Checker/CastSizeChecker.cpp head/contrib/llvm/tools/clang/lib/Checker/CheckDeadStores.cpp head/contrib/llvm/tools/clang/lib/Checker/CheckSecuritySyntaxOnly.cpp head/contrib/llvm/tools/clang/lib/Checker/CocoaConventions.cpp head/contrib/llvm/tools/clang/lib/Checker/DivZeroChecker.cpp head/contrib/llvm/tools/clang/lib/Checker/Environment.cpp head/contrib/llvm/tools/clang/lib/Checker/FixedAddressChecker.cpp head/contrib/llvm/tools/clang/lib/Checker/FlatStore.cpp head/contrib/llvm/tools/clang/lib/Checker/GRCXXExprEngine.cpp head/contrib/llvm/tools/clang/lib/Checker/GRCoreEngine.cpp head/contrib/llvm/tools/clang/lib/Checker/GRExprEngine.cpp head/contrib/llvm/tools/clang/lib/Checker/GRExprEngineExperimentalChecks.cpp head/contrib/llvm/tools/clang/lib/Checker/GRExprEngineExperimentalChecks.h head/contrib/llvm/tools/clang/lib/Checker/GRState.cpp head/contrib/llvm/tools/clang/lib/Checker/IdempotentOperationChecker.cpp head/contrib/llvm/tools/clang/lib/Checker/LLVMConventionsChecker.cpp head/contrib/llvm/tools/clang/lib/Checker/Makefile head/contrib/llvm/tools/clang/lib/Checker/MallocChecker.cpp head/contrib/llvm/tools/clang/lib/Checker/MemRegion.cpp head/contrib/llvm/tools/clang/lib/Checker/OSAtomicChecker.cpp head/contrib/llvm/tools/clang/lib/Checker/PointerArithChecker.cpp head/contrib/llvm/tools/clang/lib/Checker/PointerSubChecker.cpp head/contrib/llvm/tools/clang/lib/Checker/RangeConstraintManager.cpp head/contrib/llvm/tools/clang/lib/Checker/RegionStore.cpp head/contrib/llvm/tools/clang/lib/Checker/ReturnPointerRangeChecker.cpp head/contrib/llvm/tools/clang/lib/Checker/ReturnUndefChecker.cpp head/contrib/llvm/tools/clang/lib/Checker/SVals.cpp head/contrib/llvm/tools/clang/lib/Checker/SValuator.cpp head/contrib/llvm/tools/clang/lib/Checker/SimpleConstraintManager.cpp head/contrib/llvm/tools/clang/lib/Checker/SimpleConstraintManager.h head/contrib/llvm/tools/clang/lib/Checker/SimpleSValuator.cpp head/contrib/llvm/tools/clang/lib/Checker/StackAddrLeakChecker.cpp head/contrib/llvm/tools/clang/lib/Checker/Store.cpp head/contrib/llvm/tools/clang/lib/Checker/StreamChecker.cpp head/contrib/llvm/tools/clang/lib/Checker/SymbolManager.cpp head/contrib/llvm/tools/clang/lib/Checker/UndefBranchChecker.cpp head/contrib/llvm/tools/clang/lib/Checker/UndefinedAssignmentChecker.cpp head/contrib/llvm/tools/clang/lib/Checker/UnixAPIChecker.cpp head/contrib/llvm/tools/clang/lib/Checker/VLASizeChecker.cpp head/contrib/llvm/tools/clang/lib/Checker/ValueManager.cpp head/contrib/llvm/tools/clang/lib/CodeGen/ABIInfo.h head/contrib/llvm/tools/clang/lib/CodeGen/CGBlocks.cpp head/contrib/llvm/tools/clang/lib/CodeGen/CGBlocks.h head/contrib/llvm/tools/clang/lib/CodeGen/CGBuiltin.cpp head/contrib/llvm/tools/clang/lib/CodeGen/CGCXX.cpp head/contrib/llvm/tools/clang/lib/CodeGen/CGCXXABI.h head/contrib/llvm/tools/clang/lib/CodeGen/CGCall.cpp head/contrib/llvm/tools/clang/lib/CodeGen/CGClass.cpp head/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp head/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.h head/contrib/llvm/tools/clang/lib/CodeGen/CGDecl.cpp head/contrib/llvm/tools/clang/lib/CodeGen/CGDeclCXX.cpp head/contrib/llvm/tools/clang/lib/CodeGen/CGException.cpp head/contrib/llvm/tools/clang/lib/CodeGen/CGException.h head/contrib/llvm/tools/clang/lib/CodeGen/CGExpr.cpp head/contrib/llvm/tools/clang/lib/CodeGen/CGExprAgg.cpp head/contrib/llvm/tools/clang/lib/CodeGen/CGExprCXX.cpp head/contrib/llvm/tools/clang/lib/CodeGen/CGExprComplex.cpp head/contrib/llvm/tools/clang/lib/CodeGen/CGExprConstant.cpp head/contrib/llvm/tools/clang/lib/CodeGen/CGExprScalar.cpp head/contrib/llvm/tools/clang/lib/CodeGen/CGObjC.cpp head/contrib/llvm/tools/clang/lib/CodeGen/CGObjCGNU.cpp head/contrib/llvm/tools/clang/lib/CodeGen/CGObjCMac.cpp head/contrib/llvm/tools/clang/lib/CodeGen/CGObjCRuntime.h head/contrib/llvm/tools/clang/lib/CodeGen/CGRTTI.cpp head/contrib/llvm/tools/clang/lib/CodeGen/CGRecordLayout.h head/contrib/llvm/tools/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp head/contrib/llvm/tools/clang/lib/CodeGen/CGStmt.cpp head/contrib/llvm/tools/clang/lib/CodeGen/CGTemporaries.cpp head/contrib/llvm/tools/clang/lib/CodeGen/CGVTT.cpp head/contrib/llvm/tools/clang/lib/CodeGen/CGVTables.cpp head/contrib/llvm/tools/clang/lib/CodeGen/CGValue.h head/contrib/llvm/tools/clang/lib/CodeGen/CodeGenFunction.cpp head/contrib/llvm/tools/clang/lib/CodeGen/CodeGenFunction.h head/contrib/llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp head/contrib/llvm/tools/clang/lib/CodeGen/CodeGenModule.h head/contrib/llvm/tools/clang/lib/CodeGen/CodeGenTypes.cpp head/contrib/llvm/tools/clang/lib/CodeGen/CodeGenTypes.h head/contrib/llvm/tools/clang/lib/CodeGen/ItaniumCXXABI.cpp head/contrib/llvm/tools/clang/lib/CodeGen/Makefile head/contrib/llvm/tools/clang/lib/CodeGen/Mangle.cpp head/contrib/llvm/tools/clang/lib/CodeGen/MicrosoftCXXABI.cpp head/contrib/llvm/tools/clang/lib/CodeGen/TargetInfo.cpp head/contrib/llvm/tools/clang/lib/CodeGen/TargetInfo.h head/contrib/llvm/tools/clang/lib/Driver/Compilation.cpp head/contrib/llvm/tools/clang/lib/Driver/Driver.cpp head/contrib/llvm/tools/clang/lib/Driver/HostInfo.cpp head/contrib/llvm/tools/clang/lib/Driver/InputInfo.h head/contrib/llvm/tools/clang/lib/Driver/Job.cpp head/contrib/llvm/tools/clang/lib/Driver/Makefile head/contrib/llvm/tools/clang/lib/Driver/OptTable.cpp head/contrib/llvm/tools/clang/lib/Driver/Option.cpp head/contrib/llvm/tools/clang/lib/Driver/ToolChain.cpp head/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp head/contrib/llvm/tools/clang/lib/Driver/ToolChains.h head/contrib/llvm/tools/clang/lib/Driver/Tools.cpp head/contrib/llvm/tools/clang/lib/Driver/Tools.h head/contrib/llvm/tools/clang/lib/Frontend/ASTConsumers.cpp head/contrib/llvm/tools/clang/lib/Frontend/ASTMerge.cpp head/contrib/llvm/tools/clang/lib/Frontend/ASTUnit.cpp head/contrib/llvm/tools/clang/lib/Frontend/CMakeLists.txt head/contrib/llvm/tools/clang/lib/Frontend/CacheTokens.cpp head/contrib/llvm/tools/clang/lib/Frontend/CompilerInstance.cpp head/contrib/llvm/tools/clang/lib/Frontend/CompilerInvocation.cpp head/contrib/llvm/tools/clang/lib/Frontend/DependencyFile.cpp head/contrib/llvm/tools/clang/lib/Frontend/DiagChecker.cpp head/contrib/llvm/tools/clang/lib/Frontend/FrontendAction.cpp head/contrib/llvm/tools/clang/lib/Frontend/FrontendActions.cpp head/contrib/llvm/tools/clang/lib/Frontend/InitHeaderSearch.cpp head/contrib/llvm/tools/clang/lib/Frontend/InitPreprocessor.cpp head/contrib/llvm/tools/clang/lib/Frontend/Makefile head/contrib/llvm/tools/clang/lib/Frontend/PrintPreprocessedOutput.cpp head/contrib/llvm/tools/clang/lib/Frontend/StmtXML.cpp head/contrib/llvm/tools/clang/lib/Frontend/TextDiagnosticPrinter.cpp head/contrib/llvm/tools/clang/lib/Frontend/VerifyDiagnosticsClient.cpp head/contrib/llvm/tools/clang/lib/Headers/CMakeLists.txt head/contrib/llvm/tools/clang/lib/Headers/Makefile head/contrib/llvm/tools/clang/lib/Headers/altivec.h head/contrib/llvm/tools/clang/lib/Headers/emmintrin.h head/contrib/llvm/tools/clang/lib/Headers/mmintrin.h head/contrib/llvm/tools/clang/lib/Headers/nmmintrin.h head/contrib/llvm/tools/clang/lib/Headers/smmintrin.h head/contrib/llvm/tools/clang/lib/Headers/stddef.h head/contrib/llvm/tools/clang/lib/Headers/xmmintrin.h head/contrib/llvm/tools/clang/lib/Index/CMakeLists.txt head/contrib/llvm/tools/clang/lib/Index/Entity.cpp head/contrib/llvm/tools/clang/lib/Index/Makefile head/contrib/llvm/tools/clang/lib/Lex/Lexer.cpp head/contrib/llvm/tools/clang/lib/Lex/LiteralSupport.cpp head/contrib/llvm/tools/clang/lib/Lex/MacroInfo.cpp head/contrib/llvm/tools/clang/lib/Lex/Makefile head/contrib/llvm/tools/clang/lib/Lex/PPDirectives.cpp head/contrib/llvm/tools/clang/lib/Lex/PPExpressions.cpp head/contrib/llvm/tools/clang/lib/Lex/PPMacroExpansion.cpp head/contrib/llvm/tools/clang/lib/Lex/PTHLexer.cpp head/contrib/llvm/tools/clang/lib/Lex/Pragma.cpp head/contrib/llvm/tools/clang/lib/Lex/PreprocessingRecord.cpp head/contrib/llvm/tools/clang/lib/Lex/Preprocessor.cpp head/contrib/llvm/tools/clang/lib/Lex/TokenLexer.cpp head/contrib/llvm/tools/clang/lib/Makefile head/contrib/llvm/tools/clang/lib/Parse/CMakeLists.txt head/contrib/llvm/tools/clang/lib/Parse/Makefile head/contrib/llvm/tools/clang/lib/Parse/ParseCXXInlineMethods.cpp head/contrib/llvm/tools/clang/lib/Parse/ParseDecl.cpp head/contrib/llvm/tools/clang/lib/Parse/ParseDeclCXX.cpp head/contrib/llvm/tools/clang/lib/Parse/ParseExpr.cpp head/contrib/llvm/tools/clang/lib/Parse/ParseExprCXX.cpp head/contrib/llvm/tools/clang/lib/Parse/ParseInit.cpp head/contrib/llvm/tools/clang/lib/Parse/ParseObjc.cpp head/contrib/llvm/tools/clang/lib/Parse/ParsePragma.cpp head/contrib/llvm/tools/clang/lib/Parse/ParsePragma.h head/contrib/llvm/tools/clang/lib/Parse/ParseStmt.cpp head/contrib/llvm/tools/clang/lib/Parse/ParseTemplate.cpp head/contrib/llvm/tools/clang/lib/Parse/ParseTentative.cpp head/contrib/llvm/tools/clang/lib/Parse/Parser.cpp head/contrib/llvm/tools/clang/lib/Rewrite/CMakeLists.txt head/contrib/llvm/tools/clang/lib/Rewrite/DeltaTree.cpp head/contrib/llvm/tools/clang/lib/Rewrite/FixItRewriter.cpp head/contrib/llvm/tools/clang/lib/Rewrite/FrontendActions.cpp head/contrib/llvm/tools/clang/lib/Rewrite/HTMLRewrite.cpp head/contrib/llvm/tools/clang/lib/Rewrite/Makefile head/contrib/llvm/tools/clang/lib/Rewrite/RewriteObjC.cpp head/contrib/llvm/tools/clang/lib/Sema/AnalysisBasedWarnings.cpp head/contrib/llvm/tools/clang/lib/Sema/CMakeLists.txt head/contrib/llvm/tools/clang/lib/Sema/CodeCompleteConsumer.cpp head/contrib/llvm/tools/clang/lib/Sema/IdentifierResolver.cpp head/contrib/llvm/tools/clang/lib/Sema/JumpDiagnostics.cpp head/contrib/llvm/tools/clang/lib/Sema/Makefile head/contrib/llvm/tools/clang/lib/Sema/Sema.cpp head/contrib/llvm/tools/clang/lib/Sema/SemaAccess.cpp head/contrib/llvm/tools/clang/lib/Sema/SemaAttr.cpp head/contrib/llvm/tools/clang/lib/Sema/SemaCXXCast.cpp head/contrib/llvm/tools/clang/lib/Sema/SemaCXXScopeSpec.cpp head/contrib/llvm/tools/clang/lib/Sema/SemaChecking.cpp head/contrib/llvm/tools/clang/lib/Sema/SemaCodeComplete.cpp head/contrib/llvm/tools/clang/lib/Sema/SemaDecl.cpp head/contrib/llvm/tools/clang/lib/Sema/SemaDeclAttr.cpp head/contrib/llvm/tools/clang/lib/Sema/SemaDeclCXX.cpp head/contrib/llvm/tools/clang/lib/Sema/SemaDeclObjC.cpp head/contrib/llvm/tools/clang/lib/Sema/SemaExceptionSpec.cpp head/contrib/llvm/tools/clang/lib/Sema/SemaExpr.cpp head/contrib/llvm/tools/clang/lib/Sema/SemaExprCXX.cpp head/contrib/llvm/tools/clang/lib/Sema/SemaExprObjC.cpp head/contrib/llvm/tools/clang/lib/Sema/SemaInit.cpp head/contrib/llvm/tools/clang/lib/Sema/SemaLookup.cpp head/contrib/llvm/tools/clang/lib/Sema/SemaObjCProperty.cpp head/contrib/llvm/tools/clang/lib/Sema/SemaOverload.cpp head/contrib/llvm/tools/clang/lib/Sema/SemaStmt.cpp head/contrib/llvm/tools/clang/lib/Sema/SemaTemplate.cpp head/contrib/llvm/tools/clang/lib/Sema/SemaTemplateDeduction.cpp head/contrib/llvm/tools/clang/lib/Sema/SemaTemplateInstantiate.cpp head/contrib/llvm/tools/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp head/contrib/llvm/tools/clang/lib/Sema/SemaType.cpp head/contrib/llvm/tools/clang/lib/Sema/TargetAttributesSema.cpp head/contrib/llvm/tools/clang/lib/Sema/TargetAttributesSema.h head/contrib/llvm/tools/clang/lib/Sema/TreeTransform.h head/contrib/llvm/tools/clang/tools/c-index-test/CMakeLists.txt head/contrib/llvm/tools/clang/tools/c-index-test/Makefile head/contrib/llvm/tools/clang/tools/c-index-test/c-index-test.c head/contrib/llvm/tools/clang/tools/driver/CMakeLists.txt head/contrib/llvm/tools/clang/tools/driver/Makefile head/contrib/llvm/tools/clang/tools/driver/cc1_main.cpp head/contrib/llvm/tools/clang/tools/driver/cc1as_main.cpp head/contrib/llvm/tools/clang/tools/driver/driver.cpp head/contrib/llvm/tools/clang/tools/libclang/CIndex.cpp head/contrib/llvm/tools/clang/tools/libclang/CIndexCodeCompletion.cpp head/contrib/llvm/tools/clang/tools/libclang/CIndexDiagnostic.cpp head/contrib/llvm/tools/clang/tools/libclang/CIndexUSRs.cpp head/contrib/llvm/tools/clang/tools/libclang/CMakeLists.txt head/contrib/llvm/tools/clang/tools/libclang/CXCursor.cpp head/contrib/llvm/tools/clang/tools/libclang/CXCursor.h head/contrib/llvm/tools/clang/tools/libclang/Makefile head/contrib/llvm/tools/clang/tools/libclang/libclang.darwin.exports head/contrib/llvm/tools/clang/tools/libclang/libclang.exports head/contrib/llvm/tools/edis/CMakeLists.txt head/contrib/llvm/tools/edis/EDMain.cpp head/contrib/llvm/tools/edis/Makefile head/contrib/llvm/tools/gold/README.txt head/contrib/llvm/tools/gold/gold-plugin.cpp head/contrib/llvm/tools/llc/llc.cpp head/contrib/llvm/tools/lli/lli.cpp head/contrib/llvm/tools/llvm-as/llvm-as.cpp head/contrib/llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp head/contrib/llvm/tools/llvm-config/CMakeLists.txt head/contrib/llvm/tools/llvm-dis/llvm-dis.cpp head/contrib/llvm/tools/llvm-extract/llvm-extract.cpp head/contrib/llvm/tools/llvm-ld/llvm-ld.cpp head/contrib/llvm/tools/llvm-link/llvm-link.cpp head/contrib/llvm/tools/llvm-mc/CMakeLists.txt head/contrib/llvm/tools/llvm-mc/Disassembler.cpp head/contrib/llvm/tools/llvm-mc/Disassembler.h head/contrib/llvm/tools/llvm-mc/Makefile head/contrib/llvm/tools/llvm-mc/llvm-mc.cpp head/contrib/llvm/tools/llvm-nm/llvm-nm.cpp head/contrib/llvm/tools/llvm-prof/llvm-prof.cpp head/contrib/llvm/tools/llvm-shlib/Makefile head/contrib/llvm/tools/llvmc/CMakeLists.txt head/contrib/llvm/tools/llvmc/Makefile head/contrib/llvm/tools/llvmc/doc/LLVMC-Reference.rst head/contrib/llvm/tools/lto/LTOCodeGenerator.cpp head/contrib/llvm/tools/lto/LTOCodeGenerator.h head/contrib/llvm/tools/lto/LTOModule.cpp head/contrib/llvm/tools/lto/LTOModule.h head/contrib/llvm/tools/lto/Makefile head/contrib/llvm/tools/lto/lto.cpp head/contrib/llvm/tools/lto/lto.exports head/contrib/llvm/tools/opt/AnalysisWrappers.cpp head/contrib/llvm/tools/opt/GraphPrinters.cpp head/contrib/llvm/tools/opt/PrintSCC.cpp head/contrib/llvm/tools/opt/opt.cpp head/contrib/llvm/utils/FileCheck/FileCheck.cpp head/contrib/llvm/utils/FileUpdate/FileUpdate.cpp head/contrib/llvm/utils/Makefile head/contrib/llvm/utils/TableGen/ARMDecoderEmitter.cpp head/contrib/llvm/utils/TableGen/AsmMatcherEmitter.cpp head/contrib/llvm/utils/TableGen/AsmWriterEmitter.cpp head/contrib/llvm/utils/TableGen/CallingConvEmitter.cpp head/contrib/llvm/utils/TableGen/ClangAttrEmitter.cpp head/contrib/llvm/utils/TableGen/ClangAttrEmitter.h head/contrib/llvm/utils/TableGen/CodeGenDAGPatterns.cpp head/contrib/llvm/utils/TableGen/CodeGenInstruction.cpp head/contrib/llvm/utils/TableGen/CodeGenInstruction.h head/contrib/llvm/utils/TableGen/CodeGenIntrinsics.h head/contrib/llvm/utils/TableGen/CodeGenRegisters.h head/contrib/llvm/utils/TableGen/CodeGenTarget.cpp head/contrib/llvm/utils/TableGen/DAGISelEmitter.cpp head/contrib/llvm/utils/TableGen/DAGISelEmitter.h head/contrib/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp head/contrib/llvm/utils/TableGen/DAGISelMatcherGen.cpp head/contrib/llvm/utils/TableGen/EDEmitter.cpp head/contrib/llvm/utils/TableGen/EDEmitter.h head/contrib/llvm/utils/TableGen/FastISelEmitter.cpp head/contrib/llvm/utils/TableGen/InstrInfoEmitter.cpp head/contrib/llvm/utils/TableGen/IntrinsicEmitter.cpp head/contrib/llvm/utils/TableGen/LLVMCConfigurationEmitter.cpp head/contrib/llvm/utils/TableGen/NeonEmitter.cpp head/contrib/llvm/utils/TableGen/Record.cpp head/contrib/llvm/utils/TableGen/Record.h head/contrib/llvm/utils/TableGen/RegisterInfoEmitter.cpp head/contrib/llvm/utils/TableGen/TableGen.cpp head/contrib/llvm/utils/buildit/GNUmakefile head/contrib/llvm/utils/buildit/build_llvm head/contrib/llvm/utils/lit/lit/ExampleTests/lit.cfg head/contrib/llvm/utils/lit/lit/TestFormats.py head/contrib/llvm/utils/lit/lit/TestRunner.py head/contrib/llvm/utils/lit/lit/TestingConfig.py head/contrib/llvm/utils/lit/lit/lit.py head/contrib/llvm/utils/llvm.grm head/contrib/llvm/utils/llvmdo head/contrib/llvm/utils/valgrind/i386-pc-linux-gnu.supp head/contrib/llvm/utils/valgrind/x86_64-pc-linux-gnu.supp head/contrib/llvm/utils/vim/llvm.vim head/contrib/llvm/utils/vim/vimrc head/lib/clang/Makefile head/lib/clang/clang.build.mk head/lib/clang/include/clang/Basic/Version.inc head/lib/clang/include/llvm/Config/config.h head/lib/clang/libclanganalysis/Makefile head/lib/clang/libclangast/Makefile head/lib/clang/libclangbasic/Makefile head/lib/clang/libclangchecker/Makefile head/lib/clang/libclangcodegen/Makefile head/lib/clang/libclangfrontend/Makefile head/lib/clang/libclangparse/Makefile head/lib/clang/libclangsema/Makefile head/lib/clang/libllvmanalysis/Makefile head/lib/clang/libllvmarmasmparser/Makefile head/lib/clang/libllvmarmasmprinter/Makefile head/lib/clang/libllvmarmcodegen/Makefile head/lib/clang/libllvmbitreader/Makefile head/lib/clang/libllvmbitwriter/Makefile head/lib/clang/libllvmcodegen/Makefile head/lib/clang/libllvmcore/Makefile head/lib/clang/libllvmipo/Makefile head/lib/clang/libllvmmc/Makefile head/lib/clang/libllvmmipscodegen/Makefile head/lib/clang/libllvmpowerpccodegen/Makefile head/lib/clang/libllvmscalaropts/Makefile head/lib/clang/libllvmsupport/Makefile head/lib/clang/libllvmsystem/Makefile head/lib/clang/libllvmtarget/Makefile head/lib/clang/libllvmtransformutils/Makefile head/lib/clang/libllvmx86asmprinter/Makefile head/lib/clang/libllvmx86codegen/Makefile head/usr.bin/clang/clang/Makefile Directory Properties: head/contrib/llvm/ (props changed) head/contrib/llvm/tools/clang/ (props changed) Modified: head/contrib/llvm/CMakeLists.txt ============================================================================== --- head/contrib/llvm/CMakeLists.txt Mon Sep 20 16:18:39 2010 (r212903) +++ head/contrib/llvm/CMakeLists.txt Mon Sep 20 16:43:17 2010 (r212904) @@ -1,10 +1,20 @@ # See docs/CMake.html for instructions about how to build LLVM with CMake. project(LLVM) -cmake_minimum_required(VERSION 2.6.1) +cmake_minimum_required(VERSION 2.8) + +# Add path for custom modules +set(CMAKE_MODULE_PATH + ${CMAKE_MODULE_PATH} + "${CMAKE_CURRENT_SOURCE_DIR}/cmake" + "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" + ) + +set(PACKAGE_VERSION "2.8") +include(VersionFromVCS) +add_version_info_from_vcs(PACKAGE_VERSION) set(PACKAGE_NAME llvm) -set(PACKAGE_VERSION 2.8svn) set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_BUGREPORT "llvmbugs@cs.uiuc.edu") @@ -53,7 +63,6 @@ set(LLVM_ALL_TARGETS CppBackend Mips MBlaze - MSIL MSP430 PIC16 PowerPC @@ -124,13 +133,6 @@ configure_file( set(llvm_builded_incs_dir ${LLVM_BINARY_DIR}/include/llvm) -# Add path for custom modules -set(CMAKE_MODULE_PATH - ${CMAKE_MODULE_PATH} - "${LLVM_MAIN_SRC_DIR}/cmake" - "${LLVM_MAIN_SRC_DIR}/cmake/modules" - ) - include(AddLLVMDefinitions) if(WIN32) @@ -214,14 +216,8 @@ if( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT endif( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 ) if( MSVC ) - # List of valid CRTs for MSVC - set(MSVC_CRT - MD - MDd - MT - MTd) + include(ChooseMSVCCRT) - set(LLVM_USE_CRT "" CACHE STRING "Specify VC++ CRT to use for debug/release configurations.") add_llvm_definitions( -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS ) add_llvm_definitions( -D_SCL_SECURE_NO_WARNINGS -DCRT_NONSTDC_NO_WARNINGS ) add_llvm_definitions( -D_SCL_SECURE_NO_DEPRECATE ) @@ -231,15 +227,6 @@ if( MSVC ) # Suppress 'new behavior: elements of array 'array' will be default initialized' add_llvm_definitions( -wd4351 ) - if (NOT ${LLVM_USE_CRT} STREQUAL "") - list(FIND MSVC_CRT ${LLVM_USE_CRT} idx) - if (idx LESS 0) - message(FATAL_ERROR "Invalid value for LLVM_USE_CRT: ${LLVM_USE_CRT}. Valid options are one of: ${MSVC_CRT}") - endif (idx LESS 0) - add_llvm_definitions("/${LLVM_USE_CRT}") - message(STATUS "Using VC++ CRT: ${LLVM_USE_CRT}") - endif (NOT ${LLVM_USE_CRT} STREQUAL "") - # Enable warnings if (LLVM_ENABLE_WARNINGS) add_llvm_definitions( /W4 /Wall ) @@ -308,6 +295,7 @@ add_subdirectory(lib/Analysis) add_subdirectory(lib/Analysis/IPA) add_subdirectory(lib/MC) add_subdirectory(lib/MC/MCParser) +add_subdirectory(lib/MC/MCDisassembler) add_subdirectory(test) add_subdirectory(utils/FileCheck) @@ -372,6 +360,8 @@ add_subdirectory(tools) option(LLVM_BUILD_EXAMPLES "Build LLVM example programs." OFF) add_subdirectory(examples) +add_subdirectory(cmake/modules) + install(DIRECTORY include/ DESTINATION include FILES_MATCHING Modified: head/contrib/llvm/CREDITS.TXT ============================================================================== --- head/contrib/llvm/CREDITS.TXT Mon Sep 20 16:18:39 2010 (r212903) +++ head/contrib/llvm/CREDITS.TXT Mon Sep 20 16:43:17 2010 (r212904) @@ -134,6 +134,11 @@ N: Gabor Greif E: ggreif@gmail.com D: Improvements for space efficiency +N: James Grosbach +E: grosbach@apple.com +D: SjLj exception handling support +D: General fixes and improvements for the ARM back-end + N: Lang Hames E: lhames@gmail.com D: PBQP-based register allocator @@ -247,6 +252,12 @@ N: Scott Michel E: scottm@aero.org D: Added STI Cell SPU backend. +N: Takumi Nakamura +E: geek4civic@gmail.com +E: chapuni@hf.rim.or.jp +D: Cygwin and MinGW support. +S: Yokohama, Japan + N: Edward O'Callaghan E: eocallaghan@auroraux.org W: http://www.auroraux.org @@ -277,6 +288,11 @@ N: Sandeep Patel E: deeppatel1987@gmail.com D: ARM calling conventions rewrite, hard float support +N: Wesley Peck +E: peckw@wesleypeck.com +W: http://wesleypeck.com/ +D: MicroBlaze backend + N: Vladimir Prus W: http://vladimir_prus.blogspot.com E: ghost@cs.msu.su @@ -288,7 +304,10 @@ D: MSIL backend N: Duncan Sands E: baldrick@free.fr -D: Ada front-end, exception handling improvements +D: Ada support in llvm-gcc +D: Dragonegg plugin +D: Exception handling improvements +D: Type legalizer rewrite N: Ruchira Sasanka E: sasanka@uiuc.edu @@ -306,6 +325,10 @@ N: Anand Shukla E: ashukla@cs.uiuc.edu D: The `paths' pass +N: Michael J. Spencer +E: bigcheesegs@gmail.com +D: Shepherding Windows COFF support into MC. + N: Reid Spencer E: rspencer@reidspencer.com W: http://reidspencer.com/ @@ -329,14 +352,9 @@ E: xerxes@zafena.se D: Cmake dependency chain and various bug fixes N: Bill Wendling -E: isanbard@gmail.com +E: wendling@apple.com D: Bunches of stuff N: Bob Wilson E: bob.wilson@acm.org D: Advanced SIMD (NEON) support in the ARM backend - -N: Wesley Peck -E: peckw@wesleypeck.com -W: http://wesleypeck.com/ -D: MicroBlaze backend Modified: head/contrib/llvm/Makefile ============================================================================== --- head/contrib/llvm/Makefile Mon Sep 20 16:18:39 2010 (r212903) +++ head/contrib/llvm/Makefile Mon Sep 20 16:43:17 2010 (r212904) @@ -64,7 +64,8 @@ endif ifeq ($(MAKECMDGOALS),install-clang) DIRS := tools/clang/tools/driver tools/clang/lib/Headers \ - tools/clang/runtime tools/clang/docs + tools/clang/runtime tools/clang/docs \ + tools/lto OPTIONAL_DIRS := NO_INSTALL = 1 endif @@ -78,7 +79,8 @@ ifeq ($(MAKECMDGOALS),install-clang-c) endif ifeq ($(MAKECMDGOALS),clang-only) - DIRS := $(filter-out tools runtime docs unittests, $(DIRS)) tools/clang + DIRS := $(filter-out tools runtime docs unittests, $(DIRS)) \ + tools/clang tools/lto OPTIONAL_DIRS := endif @@ -110,7 +112,8 @@ cross-compile-build-tools: --host=$(BUILD_TRIPLE) --target=$(BUILD_TRIPLE); \ cd .. ; \ fi; \ - ($(MAKE) -C BuildTools \ + (unset SDKROOT; \ + $(MAKE) -C BuildTools \ BUILD_DIRS_ONLY=1 \ UNIVERSAL= \ ENABLE_OPTIMIZED=$(ENABLE_OPTIMIZED) \ @@ -167,7 +170,7 @@ FilesToConfig := \ include/llvm/Config/AsmParsers.def \ include/llvm/Config/Disassemblers.def \ include/llvm/System/DataTypes.h \ - tools/llvmc/plugins/Base/Base.td + tools/llvmc/src/Base.td FilesToConfigPATH := $(addprefix $(LLVM_OBJ_ROOT)/,$(FilesToConfig)) all-local:: $(FilesToConfigPATH) @@ -192,9 +195,6 @@ endif check-llvm2cpp: $(Verb)$(MAKE) check TESTSUITE=Feature RUNLLVM2CPP=1 -check-one: - $(Verb)$(MAKE) -C test check-one TESTONE=$(TESTONE) - srpm: $(LLVM_OBJ_ROOT)/llvm.spec rpmbuild -bs $(LLVM_OBJ_ROOT)/llvm.spec Modified: head/contrib/llvm/Makefile.config.in ============================================================================== --- head/contrib/llvm/Makefile.config.in Mon Sep 20 16:18:39 2010 (r212903) +++ head/contrib/llvm/Makefile.config.in Mon Sep 20 16:43:17 2010 (r212904) @@ -39,14 +39,18 @@ ifndef PROJECT_NAME PROJECT_NAME := $(LLVMPackageName) endif -PROJ_OBJ_DIR := $(shell $(PWD)) -PROJ_OBJ_ROOT := $(shell cd $(PROJ_OBJ_DIR)/$(LEVEL); $(PWD)) +# The macro below is expanded when 'realpath' is not built-in. +# Built-in 'realpath' is available on GNU Make 3.81. +realpath = $(shell cd $(1); $(PWD)) + +PROJ_OBJ_DIR := $(call realpath, .) +PROJ_OBJ_ROOT := $(call realpath, $(PROJ_OBJ_DIR)/$(LEVEL)) ifeq ($(PROJECT_NAME),llvm) -LLVM_SRC_ROOT := $(shell cd @abs_top_srcdir@; $(PWD)) -LLVM_OBJ_ROOT := $(shell cd @abs_top_builddir@; $(PWD)) -PROJ_SRC_ROOT := $(shell cd $(LLVM_SRC_ROOT); $(PWD)) -PROJ_SRC_DIR := $(shell cd $(LLVM_SRC_ROOT)/$(patsubst $(PROJ_OBJ_ROOT)%,%,$(PROJ_OBJ_DIR)); $(PWD)) +LLVM_SRC_ROOT := $(call realpath, @abs_top_srcdir@) +LLVM_OBJ_ROOT := $(call realpath, @abs_top_builddir@) +PROJ_SRC_ROOT := $(LLVM_SRC_ROOT) +PROJ_SRC_DIR := $(call realpath, $(LLVM_SRC_ROOT)/$(patsubst $(PROJ_OBJ_ROOT)%,%,$(PROJ_OBJ_DIR))) prefix := @prefix@ PROJ_prefix := $(prefix) PROJ_VERSION := $(LLVMVersion) @@ -66,7 +70,7 @@ endif ifndef LLVM_OBJ_ROOT $(error Projects must define LLVM_OBJ_ROOT) endif -PROJ_SRC_DIR := $(shell cd $(PROJ_SRC_ROOT)/$(patsubst $(PROJ_OBJ_ROOT)%,%,$(PROJ_OBJ_DIR)); $(PWD)) +PROJ_SRC_DIR := $(call realpath, $(PROJ_SRC_ROOT)/$(patsubst $(PROJ_OBJ_ROOT)%,%,$(PROJ_OBJ_DIR))) prefix := $(PROJ_INSTALL_ROOT) PROJ_prefix := $(prefix) ifndef PROJ_VERSION Modified: head/contrib/llvm/Makefile.rules ============================================================================== --- head/contrib/llvm/Makefile.rules Mon Sep 20 16:18:39 2010 (r212903) +++ head/contrib/llvm/Makefile.rules Mon Sep 20 16:43:17 2010 (r212904) @@ -196,105 +196,15 @@ install-local:: all-local install-bytecode:: install-bytecode-local ############################################################################### -# LLVMC: Provide rules for compiling llvmc plugins +# LLVMC: Provide rules for compiling llvmc-based driver ############################################################################### -ifdef LLVMC_PLUGIN - -LIBRARYNAME := $(patsubst %,plugin_llvmc_%,$(LLVMC_PLUGIN)) -CPP.Flags += -DLLVMC_PLUGIN_NAME=$(LLVMC_PLUGIN) -REQUIRES_EH := 1 - -ifeq ($(ENABLE_LLVMC_DYNAMIC),1) - LD.Flags += -lCompilerDriver -endif - -# Build a dynamic library if the user runs `make` directly from the plugin -# directory. -ifndef LLVMC_BUILTIN_PLUGIN - LOADABLE_MODULE = 1 -endif - -# TableGen stuff... -ifneq ($(BUILT_SOURCES),) - LLVMC_BUILD_AUTOGENERATED_INC=1 -endif - -endif # LLVMC_PLUGIN - ifdef LLVMC_BASED_DRIVER TOOLNAME = $(LLVMC_BASED_DRIVER) -REQUIRES_EH := 1 - -ifeq ($(ENABLE_LLVMC_DYNAMIC),1) - LD.Flags += -lCompilerDriver -else - LLVMLIBS = CompilerDriver.a - LINK_COMPONENTS = support system -endif - -# Preprocessor magic that generates references to static variables in built-in -# plugins. -ifneq ($(LLVMC_BUILTIN_PLUGINS),) - -USEDLIBS += $(patsubst %,plugin_llvmc_%.a,$(LLVMC_BUILTIN_PLUGINS)) - -LLVMC_BUILTIN_PLUGIN_1 = $(word 1, $(LLVMC_BUILTIN_PLUGINS)) -LLVMC_BUILTIN_PLUGIN_2 = $(word 2, $(LLVMC_BUILTIN_PLUGINS)) -LLVMC_BUILTIN_PLUGIN_3 = $(word 3, $(LLVMC_BUILTIN_PLUGINS)) -LLVMC_BUILTIN_PLUGIN_4 = $(word 4, $(LLVMC_BUILTIN_PLUGINS)) -LLVMC_BUILTIN_PLUGIN_5 = $(word 5, $(LLVMC_BUILTIN_PLUGINS)) -LLVMC_BUILTIN_PLUGIN_6 = $(word 6, $(LLVMC_BUILTIN_PLUGINS)) -LLVMC_BUILTIN_PLUGIN_7 = $(word 7, $(LLVMC_BUILTIN_PLUGINS)) -LLVMC_BUILTIN_PLUGIN_8 = $(word 8, $(LLVMC_BUILTIN_PLUGINS)) -LLVMC_BUILTIN_PLUGIN_9 = $(word 9, $(LLVMC_BUILTIN_PLUGINS)) -LLVMC_BUILTIN_PLUGIN_10 = $(word 10, $(LLVMC_BUILTIN_PLUGINS)) - - -ifneq ($(LLVMC_BUILTIN_PLUGIN_1),) -CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_1=$(LLVMC_BUILTIN_PLUGIN_1) -endif - -ifneq ($(LLVMC_BUILTIN_PLUGIN_2),) -CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_2=$(LLVMC_BUILTIN_PLUGIN_2) -endif - -ifneq ($(LLVMC_BUILTIN_PLUGIN_3),) -CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_3=$(LLVMC_BUILTIN_PLUGIN_3) -endif - -ifneq ($(LLVMC_BUILTIN_PLUGIN_4),) -CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_4=$(LLVMC_BUILTIN_PLUGIN_4) -endif - -ifneq ($(LLVMC_BUILTIN_PLUGIN_5),) -CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_5=$(LLVMC_BUILTIN_PLUGIN_5) -endif - -ifneq ($(LLVMC_BUILTIN_PLUGIN_6),) -CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_5=$(LLVMC_BUILTIN_PLUGIN_6) -endif - -ifneq ($(LLVMC_BUILTIN_PLUGIN_7),) -CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_5=$(LLVMC_BUILTIN_PLUGIN_7) -endif - -ifneq ($(LLVMC_BUILTIN_PLUGIN_8),) -CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_5=$(LLVMC_BUILTIN_PLUGIN_8) -endif - -ifneq ($(LLVMC_BUILTIN_PLUGIN_9),) -CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_5=$(LLVMC_BUILTIN_PLUGIN_9) -endif - -ifneq ($(LLVMC_BUILTIN_PLUGIN_10),) -CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_5=$(LLVMC_BUILTIN_PLUGIN_10) -endif - - -endif +LLVMLIBS = CompilerDriver.a +LINK_COMPONENTS = support system endif # LLVMC_BASED_DRIVER @@ -501,6 +411,26 @@ LLVMToolDir := $(LLVM_OBJ_ROOT)/$(BuildM LLVMExmplDir:= $(LLVM_OBJ_ROOT)/$(BuildMode)/examples #-------------------------------------------------------------------- +# Locations of shared libraries +#-------------------------------------------------------------------- + +SharedPrefix := lib +SharedLibDir := $(LibDir) +LLVMSharedLibDir := $(LLVMLibDir) + +# Win32.DLL prefers to be located on the "PATH" of binaries. +ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW)) + SharedLibDir := $(ToolDir) + LLVMSharedLibDir := $(LLVMToolDir) + + ifeq ($(HOST_OS),Cygwin) + SharedPrefix := cyg + else + SharedPrefix := + endif +endif + +#-------------------------------------------------------------------- # LLVM Capable Compiler #-------------------------------------------------------------------- @@ -573,12 +503,7 @@ ifeq ($(HOST_OS),Darwin) SharedLinkOptions += -mmacosx-version-min=$(DARWIN_VERSION) endif else - ifeq ($(HOST_OS),Cygwin) - SharedLinkOptions=-shared -nostdlib -Wl,--export-all-symbols \ - -Wl,--enable-auto-import -Wl,--enable-auto-image-base - else - SharedLinkOptions=-shared - endif + SharedLinkOptions=-shared endif ifeq ($(TARGET_OS),Darwin) @@ -588,11 +513,13 @@ ifeq ($(TARGET_OS),Darwin) endif ifdef SHARED_LIBRARY +ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW)) ifneq ($(HOST_OS),Darwin) LD.Flags += $(RPATH) -Wl,'$$ORIGIN' else ifneq ($(DARWIN_MAJVERS),4) - LD.Flags += $(RPATH) -Wl,$(LibDir) + LD.Flags += $(RPATH) -Wl,$(SharedLibDir) +endif endif endif endif @@ -621,8 +548,8 @@ ifndef KEEP_SYMBOLS endif # Adjust linker flags for building an executable -ifneq ($(HOST_OS),Darwin) -ifneq ($(DARWIN_MAJVERS),4) +ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW)) +ifneq ($(HOST_OS), Darwin) ifdef TOOLNAME LD.Flags += $(RPATH) -Wl,'$$ORIGIN/../lib' ifdef EXAMPLE_TOOL @@ -631,12 +558,12 @@ ifdef TOOLNAME LD.Flags += $(RPATH) -Wl,$(ToolDir) $(RDYNAMIC) endif endif -endif else ifneq ($(DARWIN_MAJVERS),4) LD.Flags += $(RPATH) -Wl,@executable_path/../lib endif endif +endif #---------------------------------------------------------- @@ -963,6 +890,13 @@ LLVMUsedLibs := $(patsubst %.a.o, lib LLVMLibsPaths := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs)) endif +# Win32.DLL may refer to other components. +ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW)) + ifdef LOADABLE_MODULE + LINK_COMPONENTS := all + endif +endif + ifndef IS_CLEANING_TARGET ifdef LINK_COMPONENTS @@ -975,12 +909,28 @@ $(LLVM_CONFIG): $(ToolDir)/$(strip $(TOOLNAME))$(EXEEXT): $(LLVM_CONFIG) ifeq ($(ENABLE_SHARED), 1) +# We can take the "auto-import" feature to get rid of using dllimport. +ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW)) +LLVMLibsOptions += -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc \ + -L $(SharedLibDir) +endif LLVMLibsOptions += -lLLVM-$(LLVMVersion) -LLVMLibsPaths += $(LibDir)/libLLVM-$(LLVMVersion)$(SHLIBEXT) +LLVMLibsPaths += $(SharedLibDir)/$(SharedPrefix)LLVM-$(LLVMVersion)$(SHLIBEXT) else -LLVMLibsOptions += $(shell $(LLVM_CONFIG) --libs $(LINK_COMPONENTS)) -LLVMLibsPaths += $(LLVM_CONFIG) \ - $(shell $(LLVM_CONFIG) --libfiles $(LINK_COMPONENTS)) + +ifndef NO_LLVM_CONFIG +LLVMConfigLibs := $(shell $(LLVM_CONFIG) --libs $(LINK_COMPONENTS) || echo Error) +ifeq ($(LLVMConfigLibs),Error) +$(error llvm-config --libs failed) +endif +LLVMLibsOptions += $(LLVMConfigLibs) +LLVMConfigLibfiles := $(shell $(LLVM_CONFIG) --libfiles $(LINK_COMPONENTS) || echo Error) +ifeq ($(LLVMConfigLibfiles),Error) +$(error llvm-config --libfiles failed) +endif +LLVMLibsPaths += $(LLVM_CONFIG) $(LLVMConfigLibfiles) +endif + endif endif endif @@ -1011,12 +961,25 @@ $(NativeExportsFile): $(EXPORTED_SYMBOL_ clean-local:: -$(Verb) $(RM) -f $(NativeExportsFile) else +ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW)) +# GNU ld Win32 accepts .DEF files that contain "DATA" entries. +NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE:.exports=.def)) +$(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir + $(Echo) Generating $(notdir $@) + $(Verb) $(ECHO) "EXPORTS" > $@ + $(Verb) $(CAT) $< >> $@ +clean-local:: + -$(Verb) $(RM) -f $(NativeExportsFile) +else +# Default behavior: just use the exports file verbatim. NativeExportsFile := $(EXPORTED_SYMBOL_FILE) endif endif +endif # Now add the linker command-line options to use the native export file. +# Darwin ifeq ($(HOST_OS),Darwin) LLVMLibsOptions += -Wl,-exported_symbols_list,$(NativeExportsFile) endif @@ -1026,6 +989,12 @@ ifeq ($(HAVE_LINK_VERSION_SCRIPT),1) LLVMLibsOptions += -Wl,--version-script,$(NativeExportsFile) endif +# Windows +ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW)) +# LLVMLibsOptions is invalidated at processing tools/llvm-shlib. +SharedLinkOptions += $(NativeExportsFile) +endif + endif ############################################################################### @@ -1100,10 +1069,10 @@ ifdef LIBRARYNAME LIBRARYNAME := $(strip $(LIBRARYNAME)) ifdef LOADABLE_MODULE LibName.A := $(LibDir)/$(LIBRARYNAME).a -LibName.SO := $(LibDir)/$(LIBRARYNAME)$(SHLIBEXT) +LibName.SO := $(SharedLibDir)/$(LIBRARYNAME)$(SHLIBEXT) else LibName.A := $(LibDir)/lib$(LIBRARYNAME).a -LibName.SO := $(LibDir)/lib$(LIBRARYNAME)$(SHLIBEXT) +LibName.SO := $(SharedLibDir)/$(SharedPrefix)$(LIBRARYNAME)$(SHLIBEXT) endif LibName.O := $(LibDir)/$(LIBRARYNAME).o LibName.BCA:= $(LibDir)/lib$(LIBRARYNAME).bca @@ -1128,14 +1097,14 @@ SharedLibKindMessage := "Loadable Module else SharedLibKindMessage := "Shared Library" endif -$(LibName.SO): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths) $(LibDir)/.dir +$(LibName.SO): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths) $(SharedLibDir)/.dir $(Echo) Linking $(BuildMode) $(SharedLibKindMessage) \ - $(LIBRARYNAME)$(SHLIBEXT) + $(notdir $@) $(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO) \ $(ProjLibsOptions) $(LLVMLibsOptions) $(LIBS) else -$(LibName.SO): $(ObjectsO) $(LibDir)/.dir - $(Echo) Linking $(BuildMode) Shared Library $(basename $@) +$(LibName.SO): $(ObjectsO) $(SharedLibDir)/.dir + $(Echo) Linking $(BuildMode) Shared Library $(notdir $@) $(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO) endif @@ -1151,21 +1120,23 @@ uninstall-local:: $(Echo) Uninstall circumvented with NO_INSTALL else -ifdef LOADABLE_MODULE -DestSharedLib = $(DESTDIR)$(PROJ_libdir)/$(LIBRARYNAME)$(SHLIBEXT) +# Win32.DLL prefers to be located on the "PATH" of binaries. +ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW)) +DestSharedLibDir := $(DESTDIR)$(PROJ_bindir) else -DestSharedLib = $(DESTDIR)$(PROJ_libdir)/lib$(LIBRARYNAME)$(SHLIBEXT) +DestSharedLibDir := $(DESTDIR)$(PROJ_libdir) endif +DestSharedLib := $(DestSharedLibDir)/$(SharedPrefix)$(LIBRARYNAME)$(SHLIBEXT) install-local:: $(DestSharedLib) -$(DestSharedLib): $(LibName.SO) $(DESTDIR)$(PROJ_libdir) +$(DestSharedLib): $(LibName.SO) $(DestSharedLibDir) $(Echo) Installing $(BuildMode) Shared Library $(DestSharedLib) $(Verb) $(INSTALL) $(LibName.SO) $(DestSharedLib) uninstall-local:: $(Echo) Uninstalling $(BuildMode) Shared Library $(DestSharedLib) - -$(Verb) $(RM) -f $(DESTDIR)$(PROJ_libdir)/lib$(LIBRARYNAME).* + -$(Verb) $(RM) -f $(DestSharedLibDir)/$(SharedPrefix)$(LIBRARYNAME).* endif endif @@ -1341,10 +1312,33 @@ endif endif ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux NetBSD FreeBSD)) +ifneq ($(ARCH), Mips) LD.Flags += -Wl,--version-script=$(LLVM_SRC_ROOT)/autoconf/ExportMap.map endif endif +endif + +#--------------------------------------------------------- +# Tool Version Info Support +#--------------------------------------------------------- +ifeq ($(HOST_OS),Darwin) +ifdef TOOL_INFO_PLIST + +LD.Flags += -Wl,-sectcreate,__TEXT,__info_plist,$(ObjDir)/$(TOOL_INFO_PLIST) + +$(ToolBuildPath): $(ObjDir)/$(TOOL_INFO_PLIST) + +$(ObjDir)/$(TOOL_INFO_PLIST): $(PROJ_SRC_DIR)/$(TOOL_INFO_PLIST).in $(ObjDir)/.dir + $(Echo) "Creating $(TOOLNAME) '$(TOOL_INFO_PLIST)' file..." + $(Verb)sed -e "s#@TOOL_INFO_UTI@#$(TOOL_INFO_UTI)#g" \ + -e "s#@TOOL_INFO_NAME@#$(TOOL_INFO_NAME)#g" \ + -e "s#@TOOL_INFO_VERSION@#$(TOOL_INFO_VERSION)#g" \ + -e "s#@TOOL_INFO_BUILD_VERSION@#$(TOOL_INFO_BUILD_VERSION)#g" \ + $< > $@ + +endif +endif #--------------------------------------------------------- # Provide targets for building the tools @@ -1377,7 +1371,7 @@ $(ToolAliasBuildPath): $(ToolBuildPath) $(Echo) Creating $(BuildMode) Alias $(TOOLALIAS) $(StripWarnMsg) $(Verb) $(RM) -f $(ToolAliasBuildPath) $(Verb) $(AliasTool) $(TOOLEXENAME) $(ToolAliasBuildPath) - $(Echo) ======= Finished Creating $(BuildMode) Alias $(TOOLNAME) \ + $(Echo) ======= Finished Creating $(BuildMode) Alias $(TOOLALIAS) \ $(StripWarnMsg) endif @@ -1626,7 +1620,7 @@ ifdef TARGET TABLEGEN_INC_FILES_COMMON = 1 endif -ifdef LLVMC_BUILD_AUTOGENERATED_INC +ifdef LLVMC_BASED_DRIVER TABLEGEN_INC_FILES_COMMON = 1 endif @@ -1750,20 +1744,26 @@ clean-local:: endif # TARGET -ifdef LLVMC_BUILD_AUTOGENERATED_INC +ifdef LLVMC_BASED_DRIVER + +TDSrc := $(sort $(strip $(wildcard $(PROJ_SRC_DIR)/*.td)) \ + $(strip $(wildcard $(PROJ_OBJ_DIR)/*.td))) + +TDCommon := $(strip $(wildcard \ + $(LLVM_SRC_ROOT)/include/llvm/CompilerDriver/*.td)) -LLVMCPluginSrc := $(sort $(strip $(wildcard $(PROJ_SRC_DIR)/*.td)) \ - $(strip $(wildcard $(PROJ_OBJ_DIR)/*.td))) +TDFiles := $(TDSrc) $(TDCommon) -TDFiles := $(LLVMCPluginSrc) \ - $(strip $(wildcard $(LLVM_SRC_ROOT)/include/llvm/CompilerDriver/*.td)) +$(INCTMPFiles) : $(TBLGEN) $(TDFiles) -$(ObjDir)/AutoGenerated.inc.tmp: $(LLVMCPluginSrc) $(ObjDir)/.dir \ - $(TBLGEN) $(TD_COMMON) - $(Echo) "Building LLVMC configuration library with tblgen" +$(ObjDir)/%.inc.tmp: %.td $(ObjDir)/.dir + $(Echo) "Building LLVMC compilation graph description with tblgen" $(Verb) $(TableGen) -gen-llvmc -o $(call SYSPATH, $@) $< -endif # LLVMC_BUILD_AUTOGENERATED_INC +clean-local:: + -$(Verb) $(RM) -f $(INCFiles) + +endif # LLVMC_BASED_DRIVER ############################################################################### # OTHER RULES: Other rules needed @@ -1840,11 +1840,13 @@ check:: $(EchoCmd) No test directory ; \ fi -check-lit:: +check-lit:: check + +check-dg:: $(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \ if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \ $(EchoCmd) Running test suite ; \ - $(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local-lit ; \ + $(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local-dg ; \ else \ $(EchoCmd) No Makefile in test directory ; \ fi ; \ Modified: head/contrib/llvm/README.txt ============================================================================== --- head/contrib/llvm/README.txt Mon Sep 20 16:18:39 2010 (r212903) +++ head/contrib/llvm/README.txt Mon Sep 20 16:43:17 2010 (r212904) @@ -1,4 +1,4 @@ -Low Level Virtual Machine (LLVM) +\Low Level Virtual Machine (LLVM) ================================ This directory and its subdirectories contain source code for the Low Level @@ -13,3 +13,4 @@ assistance with LLVM. If you're writing a package for LLVM, see docs/Packaging.html for our suggestions. + Modified: head/contrib/llvm/autoconf/configure.ac ============================================================================== --- head/contrib/llvm/autoconf/configure.ac Mon Sep 20 16:18:39 2010 (r212903) +++ head/contrib/llvm/autoconf/configure.ac Mon Sep 20 16:43:17 2010 (r212904) @@ -31,7 +31,7 @@ dnl=== dnl===-----------------------------------------------------------------------=== dnl Initialize autoconf and define the package name, version number and dnl email address for reporting bugs. -AC_INIT([[llvm]],[[2.8svn]],[llvmbugs@cs.uiuc.edu]) +AC_INIT([[llvm]],[[2.8rc]],[llvmbugs@cs.uiuc.edu]) dnl Provide a copyright substitution and ensure the copyright notice is included dnl in the output of --version option of the generated configure script. @@ -101,7 +101,6 @@ for i in `ls ${srcdir}/projects` do if test -d ${srcdir}/projects/${i} ; then case ${i} in - CVS) ;; sample) AC_CONFIG_SUBDIRS([projects/sample]) ;; privbracket) AC_CONFIG_SUBDIRS([projects/privbracket]) ;; llvm-stacker) AC_CONFIG_SUBDIRS([projects/llvm-stacker]) ;; @@ -299,7 +298,7 @@ dnl Set the LINKALL and NOLINKALL Makefi AC_SUBST(LINKALL,$llvm_cv_link_all_option) AC_SUBST(NOLINKALL,$llvm_cv_no_link_all_option) -dnl Set the "LLVM_ON_*" variables based on llvm_cvs_platform_type +dnl Set the "LLVM_ON_*" variables based on llvm_cv_platform_type dnl This is used by lib/System to determine the basic kind of implementation dnl to use. case $llvm_cv_platform_type in @@ -369,13 +368,13 @@ else AC_SUBST(LLVM_CROSS_COMPILING, [0]) fi -dnl Check to see if there's a "CVS" (or .svn or .git) directory indicating -dnl that this build is being done from a checkout. This sets up several -dnl defaults for the command line switches. When we build with a CVS directory, +dnl Check to see if there's a .svn or .git directory indicating that this +dnl build is being done from a checkout. This sets up several defaults for +dnl the command line switches. When we build with a checkout directory, dnl we get a debug with assertions turned on. Without, we assume a source dnl release and we get an optimized build without assertions. dnl See --enable-optimized and --enable-assertions below -if test -d "CVS" -o -d "${srcdir}/CVS" -o -d ".svn" -o -d "${srcdir}/.svn" -o -d ".git" -o -d "${srcdir}/.git"; then +if test -d ".svn" -o -d "${srcdir}/.svn" -o -d ".git" -o -d "${srcdir}/.git"; then cvsbuild="yes" optimize="no" AC_SUBST(CVSBUILD,[[CVSBUILD=1]]) @@ -392,7 +391,7 @@ dnl===---------------------------------- dnl --enable-optimized : check whether they want to do an optimized build: AC_ARG_ENABLE(optimized, AS_HELP_STRING( - --enable-optimized,[Compile with optimizations enabled (default is NO)]),,enableval=$optimize) + --enable-optimized,[Compile with optimizations enabled (default is YES)]),,enableval="yes") if test ${enableval} = "no" ; then AC_SUBST(ENABLE_OPTIMIZED,[[]]) else @@ -410,7 +409,7 @@ fi dnl --enable-assertions : check whether they want to turn on assertions or not: AC_ARG_ENABLE(assertions,AS_HELP_STRING( - --enable-assertions,[Compile with assertion checks enabled (default is YES)]),, enableval="yes") + --enable-assertions,[Compile with assertion checks enabled (default is NO)]),, enableval="no") if test ${enableval} = "yes" ; then AC_SUBST(DISABLE_ASSERTIONS,[[]]) else @@ -544,13 +543,13 @@ TARGETS_TO_BUILD="" AC_ARG_ENABLE([targets],AS_HELP_STRING([--enable-targets], [Build specific host targets: all or target1,target2,... Valid targets are: host, x86, x86_64, sparc, powerpc, alpha, arm, mips, spu, pic16, - xcore, msp430, systemz, blackfin, cbe, msil, and cpp (default=all)]),, + xcore, msp430, systemz, blackfin, cbe, and cpp (default=all)]),, enableval=all) if test "$enableval" = host-only ; then enableval=host fi case "$enableval" in - all) TARGETS_TO_BUILD="X86 Sparc PowerPC Alpha ARM Mips CellSPU PIC16 XCore MSP430 SystemZ Blackfin CBackend MSIL CppBackend MBlaze" ;; + all) TARGETS_TO_BUILD="X86 Sparc PowerPC Alpha ARM Mips CellSPU PIC16 XCore MSP430 SystemZ Blackfin CBackend CppBackend MBlaze" ;; *)for a_target in `echo $enableval|sed -e 's/,/ /g' ` ; do case "$a_target" in x86) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;; @@ -567,7 +566,6 @@ case "$enableval" in systemz) TARGETS_TO_BUILD="SystemZ $TARGETS_TO_BUILD" ;; blackfin) TARGETS_TO_BUILD="Blackfin $TARGETS_TO_BUILD" ;; cbe) TARGETS_TO_BUILD="CBackend $TARGETS_TO_BUILD" ;; - msil) TARGETS_TO_BUILD="MSIL $TARGETS_TO_BUILD" ;; cpp) TARGETS_TO_BUILD="CppBackend $TARGETS_TO_BUILD" ;; mblaze) TARGETS_TO_BUILD="MBlaze $TARGETS_TO_BUILD" ;; host) case "$llvm_cv_target_arch" in @@ -598,9 +596,17 @@ AC_SUBST(TARGETS_TO_BUILD,$TARGETS_TO_BU # If so, define LLVM_NATIVE_ARCH to that LLVM target. for a_target in $TARGETS_TO_BUILD; do if test "$a_target" = "$LLVM_NATIVE_ARCH"; then - LLVM_NATIVE_ARCHTARGET="${LLVM_NATIVE_ARCH}Target" - AC_DEFINE_UNQUOTED(LLVM_NATIVE_ARCH,$LLVM_NATIVE_ARCHTARGET, + AC_DEFINE_UNQUOTED(LLVM_NATIVE_ARCH, $LLVM_NATIVE_ARCH, [LLVM architecture name for the native architecture, if available]) + LLVM_NATIVE_TARGET="LLVMInitialize${LLVM_NATIVE_ARCH}Target" + LLVM_NATIVE_TARGETINFO="LLVMInitialize${LLVM_NATIVE_ARCH}TargetInfo" + LLVM_NATIVE_ASMPRINTER="LLVMInitialize${LLVM_NATIVE_ARCH}AsmPrinter" + AC_DEFINE_UNQUOTED(LLVM_NATIVE_TARGET, $LLVM_NATIVE_TARGET, + [LLVM name for the native Target init function, if available]) + AC_DEFINE_UNQUOTED(LLVM_NATIVE_TARGETINFO, $LLVM_NATIVE_TARGETINFO, + [LLVM name for the native TargetInfo init function, if available]) + AC_DEFINE_UNQUOTED(LLVM_NATIVE_ASMPRINTER, $LLVM_NATIVE_ASMPRINTER, + [LLVM name for the native AsmPrinter init function, if available]) fi done @@ -857,35 +863,6 @@ AC_ARG_ENABLE(libffi,AS_HELP_STRING( esac], llvm_cv_enable_libffi=no) -dnl Only Windows needs dynamic libCompilerDriver to support plugins. -if test "$llvm_cv_os_type" = "Win32" ; then - llvmc_dynamic="yes" -else - llvmc_dynamic="no" -fi - -dnl --enable-llvmc-dynamic : should LLVMC link libCompilerDriver dynamically? -AC_ARG_ENABLE(llvmc-dynamic,AS_HELP_STRING( ---enable-llvmc-dynamic, -[Link LLVMC dynamically (default is NO, unless on Win32)]),, -enableval=$llvmc_dynamic) -if test ${enableval} = "yes" && test "$ENABLE_PIC" -eq 1 ; then - AC_SUBST(ENABLE_LLVMC_DYNAMIC,[[ENABLE_LLVMC_DYNAMIC=1]]) -else - AC_SUBST(ENABLE_LLVMC_DYNAMIC,[[]]) -fi - -dnl --enable-llvmc-dynamic-plugins : should LLVMC support dynamic plugins? -AC_ARG_ENABLE(llvmc-dynamic-plugins,AS_HELP_STRING( ---enable-llvmc-dynamic-plugins, -[Enable dynamic LLVMC plugins (default is YES)]),, -enableval=yes) -if test ${enableval} = "yes" ; then - AC_SUBST(ENABLE_LLVMC_DYNAMIC_PLUGINS,[[ENABLE_LLVMC_DYNAMIC_PLUGINS=1]]) -else - AC_SUBST(ENABLE_LLVMC_DYNAMIC_PLUGINS,[[]]) -fi - dnl===-----------------------------------------------------------------------=== dnl=== dnl=== SECTION 4: Check for programs we need and that they are the right version @@ -1011,6 +988,13 @@ fi dnl Find the install program AC_PROG_INSTALL +dnl Prepend src dir to install path dir if it's a relative path +dnl This is a hack for installs that take place in something other +dnl than the top level. +case "$INSTALL" in + [[\\/$]]* | ?:[[\\/]]* ) ;; + *) INSTALL="\\\$(TOPSRCDIR)/$INSTALL" ;; +esac dnl Checks for documentation and testing tools that we can do without. If these dnl are not found then they are set to "true" which always succeeds but does @@ -1033,6 +1017,9 @@ AC_PATH_PROGS(OCAMLDEP, [ocamldep]) AC_PATH_PROGS(OCAMLDOC, [ocamldoc]) AC_PATH_PROGS(GAS, [gas as]) +dnl Get the version of the linker in use. +AC_LINK_GET_VERSION + dnl Determine whether the linker supports the -R option. AC_LINK_USE_R @@ -1345,6 +1332,9 @@ fi dnl atomic builtins are required for threading support. AC_MSG_CHECKING(for GCC atomic builtins) +dnl Since we'll be using these atomic builtins in C++ files we should test +dnl the C++ compiler. +AC_LANG_PUSH([C++]) AC_LINK_IFELSE( AC_LANG_SOURCE( [[int main() { @@ -1356,13 +1346,13 @@ AC_LINK_IFELSE( return 0; } ]]), + AC_LANG_POP([C++]) AC_MSG_RESULT(yes) AC_DEFINE(LLVM_MULTITHREADED, 1, Build multithreading support into LLVM), AC_MSG_RESULT(no) AC_DEFINE(LLVM_MULTITHREADED, 0, Build multithreading support into LLVM) AC_MSG_WARN([LLVM will be built thread-unsafe because atomic builtins are missing])) - dnl===-----------------------------------------------------------------------=== dnl=== dnl=== SECTION 9: Additional checks, variables, etc. @@ -1549,7 +1539,11 @@ dnl WARNING: dnl If you add or remove an dnl you MUST also update Makefile.rules so that the variable FilesToConfig dnl contains the same list of files as AC_CONFIG_HEADERS below. This ensures the dnl files can be updated automatically when their *.in sources change. -AC_CONFIG_HEADERS([include/llvm/Config/config.h]) +AC_CONFIG_HEADERS([include/llvm/Config/config.h include/llvm/Config/llvm-config.h]) +AH_TOP([#ifndef CONFIG_H +#define CONFIG_H]) +AH_BOTTOM([#endif]) + AC_CONFIG_FILES([include/llvm/Config/Targets.def]) AC_CONFIG_FILES([include/llvm/Config/AsmPrinters.def]) AC_CONFIG_FILES([include/llvm/Config/AsmParsers.def]) @@ -1563,7 +1557,7 @@ dnl Configure the RPM spec file for LLVM AC_CONFIG_FILES([llvm.spec]) dnl Configure llvmc's Base plugin -AC_CONFIG_FILES([tools/llvmc/plugins/Base/Base.td]) +AC_CONFIG_FILES([tools/llvmc/src/Base.td]) dnl Do the first stage of configuration for llvm-config.in. AC_CONFIG_FILES([tools/llvm-config/llvm-config.in]) Modified: head/contrib/llvm/autoconf/m4/link_options.m4 ============================================================================== --- head/contrib/llvm/autoconf/m4/link_options.m4 Mon Sep 20 16:18:39 2010 (r212903) +++ head/contrib/llvm/autoconf/m4/link_options.m4 Mon Sep 20 16:43:17 2010 (r212904) @@ -1,4 +1,25 @@ # +# Get the linker version string. +# +# This macro is specific to LLVM. +# +AC_DEFUN([AC_LINK_GET_VERSION], + [AC_CACHE_CHECK([for linker version],[llvm_cv_link_version], + [ + version_string="$(ld -v 2>&1 | head -1)" + + # Check for ld64. + if (echo "$version_string" | grep -q "ld64"); then + llvm_cv_link_version=$(echo "$version_string" | sed -e "s#.*ld64-\([^ ]*\)#\1#") + else + llvm_cv_link_version=$(echo "$version_string" | sed -e "s#[^0-9]*\([0-9.]*\).*#\1#") + fi + ]) + AC_DEFINE_UNQUOTED([HOST_LINK_VERSION],"$llvm_cv_link_version", + [Linker version detected at compile time.]) +]) + +# # Determine if the system can handle the -R option being passed to the linker. # # This macro is specific to LLVM. Modified: head/contrib/llvm/bindings/ada/llvm/llvm.ads ============================================================================== --- head/contrib/llvm/bindings/ada/llvm/llvm.ads Mon Sep 20 16:18:39 2010 (r212903) +++ head/contrib/llvm/bindings/ada/llvm/llvm.ads Mon Sep 20 16:43:17 2010 (r212904) @@ -317,25 +317,27 @@ package llvm is LLVMGhostLinkage, LLVMCommonLinkage, LLVMLinkerPrivateLinkage, - LLVMLinkerPrivateWeakLinkage); + LLVMLinkerPrivateWeakLinkage, + LinkerPrivateWeakDefAutoLinkage); for LLVMLinkage use - (LLVMExternalLinkage => 0, - LLVMAvailableExternallyLinkage => 1, - LLVMLinkOnceAnyLinkage => 2, - LLVMLinkOnceODRLinkage => 3, - LLVMWeakAnyLinkage => 4, - LLVMWeakODRLinkage => 5, - LLVMAppendingLinkage => 6, - LLVMInternalLinkage => 7, - LLVMPrivateLinkage => 8, - LLVMDLLImportLinkage => 9, - LLVMDLLExportLinkage => 10, - LLVMExternalWeakLinkage => 11, - LLVMGhostLinkage => 12, - LLVMCommonLinkage => 13, - LLVMLinkerPrivateLinkage => 14, - LLVMLinkerPrivateWeakLinkage => 15); + (LLVMExternalLinkage => 0, + LLVMAvailableExternallyLinkage => 1, + LLVMLinkOnceAnyLinkage => 2, + LLVMLinkOnceODRLinkage => 3, + LLVMWeakAnyLinkage => 4, + LLVMWeakODRLinkage => 5, + LLVMAppendingLinkage => 6, + LLVMInternalLinkage => 7, + LLVMPrivateLinkage => 8, + LLVMDLLImportLinkage => 9, + LLVMDLLExportLinkage => 10, + LLVMExternalWeakLinkage => 11, + LLVMGhostLinkage => 12, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 17:03:10 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B8FF1065672; Mon, 20 Sep 2010 17:03:10 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8A34F8FC17; Mon, 20 Sep 2010 17:03:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KH3Ac3059685; Mon, 20 Sep 2010 17:03:10 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KH3AIP059683; Mon, 20 Sep 2010 17:03:10 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201009201703.o8KH3AIP059683@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Mon, 20 Sep 2010 17:03:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212905 - stable/8/sys/contrib/pf/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 17:03:10 -0000 Author: bz Date: Mon Sep 20 17:03:10 2010 New Revision: 212905 URL: http://svn.freebsd.org/changeset/base/212905 Log: MFC r212403: When using pf routing options, properly handle IP fragmentation for interfaces with TSO enabled, otherwise one would see an extra ICMP unreach, frag needed pre matching packet on lo0. This syncs pf code to ip_output.c r162084. Submitted by: yongari via mlaier Reviewed by: eri Tested by: kib PR: kern/144311 Modified: stable/8/sys/contrib/pf/net/pf.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/contrib/pf/net/pf.c ============================================================================== --- stable/8/sys/contrib/pf/net/pf.c Mon Sep 20 16:43:17 2010 (r212904) +++ stable/8/sys/contrib/pf/net/pf.c Mon Sep 20 17:03:10 2010 (r212905) @@ -6375,6 +6375,7 @@ pf_route(struct mbuf **m, struct pf_rule m0->m_pkthdr.csum_flags &= ifp->if_hwassist; if (ntohs(ip->ip_len) <= ifp->if_mtu || + (m0->m_pkthdr.csum_flags & ifp->if_hwassist & CSUM_TSO) != 0 || (ifp->if_hwassist & CSUM_FRAGMENT && ((ip->ip_off & htons(IP_DF)) == 0))) { /* @@ -6449,7 +6450,7 @@ pf_route(struct mbuf **m, struct pf_rule * Too large for interface; fragment if possible. * Must be able to put at least 8 bytes per fragment. */ - if (ip->ip_off & htons(IP_DF)) { + if (ip->ip_off & htons(IP_DF) || (m0->m_pkthdr.csum_flags & CSUM_TSO)) { KMOD_IPSTAT_INC(ips_cantfrag); if (r->rt != PF_DUPTO) { #ifdef __FreeBSD__ From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 17:10:07 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4CF71106566B; Mon, 20 Sep 2010 17:10:07 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3B34D8FC0C; Mon, 20 Sep 2010 17:10:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KHA7M1059887; Mon, 20 Sep 2010 17:10:07 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KHA7aO059883; Mon, 20 Sep 2010 17:10:07 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201009201710.o8KHA7aO059883@svn.freebsd.org> From: Edward Tomasz Napierala Date: Mon, 20 Sep 2010 17:10:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212906 - in head: lib/libc/posix1e sys/kern sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 17:10:07 -0000 Author: trasz Date: Mon Sep 20 17:10:06 2010 New Revision: 212906 URL: http://svn.freebsd.org/changeset/base/212906 Log: First step at adopting FreeBSD to support PSARC/2010/029. This makes acl_is_trivial_np(3) properly recognize the new trivial ACLs. From the user point of view, that means "ls -l" no longer shows plus signs for all the files when running ZFS v28. Modified: head/lib/libc/posix1e/acl_strip.c head/sys/kern/subr_acl_nfs4.c head/sys/sys/acl.h Modified: head/lib/libc/posix1e/acl_strip.c ============================================================================== --- head/lib/libc/posix1e/acl_strip.c Mon Sep 20 17:03:10 2010 (r212905) +++ head/lib/libc/posix1e/acl_strip.c Mon Sep 20 17:10:06 2010 (r212906) @@ -31,19 +31,21 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "acl_support.h" /* - * These two routines from sys/kern/subr_acl_nfs4.c are used by both kernel + * These three routines from sys/kern/subr_acl_nfs4.c are used by both kernel * and libc. */ +void acl_nfs4_trivial_from_mode(struct acl *aclp, mode_t mode); void acl_nfs4_sync_acl_from_mode(struct acl *aclp, mode_t mode, int file_owner_id); void acl_nfs4_sync_mode_from_acl(mode_t *_mode, const struct acl *aclp); static acl_t -_nfs4_acl_strip_np(const acl_t aclp, int recalculate_mask) +_nfs4_acl_strip_np(const acl_t aclp, int canonical_six) { acl_t newacl; mode_t mode = 0; @@ -57,7 +59,10 @@ _nfs4_acl_strip_np(const acl_t aclp, int _acl_brand_as(newacl, ACL_BRAND_NFS4); acl_nfs4_sync_mode_from_acl(&mode, &(aclp->ats_acl)); - acl_nfs4_sync_acl_from_mode(&(newacl->ats_acl), mode, -1); + if (canonical_six) + acl_nfs4_sync_acl_from_mode(&(newacl->ats_acl), mode, -1); + else + acl_nfs4_trivial_from_mode(&(newacl->ats_acl), mode); return (newacl); } @@ -136,7 +141,7 @@ acl_strip_np(const acl_t aclp, int recal { switch (_acl_brand(aclp)) { case ACL_BRAND_NFS4: - return (_nfs4_acl_strip_np(aclp, recalculate_mask)); + return (_nfs4_acl_strip_np(aclp, 1)); case ACL_BRAND_POSIX: return (_posix1e_acl_strip_np(aclp, recalculate_mask)); @@ -185,10 +190,25 @@ acl_is_trivial_np(const acl_t aclp, int } /* - * Calculate trivial ACL - using acl_strip_np - and compare + * Calculate trivial ACL - using acl_strip_np(3) - and compare * with the original. */ - tmpacl = acl_strip_np(aclp, 0); + tmpacl = _nfs4_acl_strip_np(aclp, 0); + if (tmpacl == NULL) + return (-1); + + differs = _acl_differs(aclp, tmpacl); + acl_free(tmpacl); + + if (differs == 0) { + *trivialp = 1; + return (0); + } + + /* + * Try again with an old-style, "canonical six" trivial ACL. + */ + tmpacl = _nfs4_acl_strip_np(aclp, 1); if (tmpacl == NULL) return (-1); Modified: head/sys/kern/subr_acl_nfs4.c ============================================================================== --- head/sys/kern/subr_acl_nfs4.c Mon Sep 20 17:03:10 2010 (r212905) +++ head/sys/kern/subr_acl_nfs4.c Mon Sep 20 17:10:06 2010 (r212906) @@ -349,6 +349,83 @@ _acl_duplicate_entry(struct acl *aclp, i return (&(aclp->acl_entry[entry_index + 1])); } +/* + * Calculate trivial ACL in a manner compatible with PSARC/2010/029. + * Note that this results in an ACL different from (but semantically + * equal to) the "canonical six" trivial ACL computed using algorithm + * described in draft-ietf-nfsv4-minorversion1-03.txt, 3.16.6.2. + */ +void +acl_nfs4_trivial_from_mode(struct acl *aclp, mode_t mode) +{ + acl_perm_t user_allow_first = 0, user_deny = 0, group_deny = 0; + acl_perm_t user_allow, group_allow, everyone_allow; + + KASSERT(aclp->acl_cnt == 0, ("aclp->acl_cnt == 0")); + + user_allow = group_allow = everyone_allow = ACL_READ_ACL | + ACL_READ_ATTRIBUTES | ACL_READ_NAMED_ATTRS | ACL_SYNCHRONIZE; + user_allow |= ACL_WRITE_ACL | ACL_WRITE_OWNER | ACL_WRITE_ATTRIBUTES | + ACL_WRITE_NAMED_ATTRS; + + if (mode & S_IRUSR) + user_allow |= ACL_READ_DATA; + if (mode & S_IWUSR) + user_allow |= (ACL_WRITE_DATA | ACL_APPEND_DATA); + if (mode & S_IXUSR) + user_allow |= ACL_EXECUTE; + + if (mode & S_IRGRP) + group_allow |= ACL_READ_DATA; + if (mode & S_IWGRP) + group_allow |= (ACL_WRITE_DATA | ACL_APPEND_DATA); + if (mode & S_IXGRP) + group_allow |= ACL_EXECUTE; + + if (mode & S_IROTH) + everyone_allow |= ACL_READ_DATA; + if (mode & S_IWOTH) + everyone_allow |= (ACL_WRITE_DATA | ACL_APPEND_DATA); + if (mode & S_IXOTH) + everyone_allow |= ACL_EXECUTE; + + user_deny = ((group_allow | everyone_allow) & ~user_allow); + group_deny = everyone_allow & ~group_allow; + user_allow_first = group_deny & ~user_deny; + +#if 1 + /* + * This is a workaround for what looks like a bug in ZFS - trivial + * ACL for mode 0077 should look like this: + * + * owner@:rwxp----------:------:deny + * owner@:------aARWcCos:------:allow + * group@:rwxp--a-R-c--s:------:allow + * everyone@:rwxp--a-R-c--s:------:allow + * + * Instead, ZFS makes it like this: + * + * owner@:rwx-----------:------:deny + * owner@:------aARWcCos:------:allow + * group@:rwxp--a-R-c--s:------:allow + * everyone@:rwxp--a-R-c--s:------:allow + */ + user_allow_first &= ~ACL_APPEND_DATA; + user_deny &= ~ACL_APPEND_DATA; + group_deny &= ~ACL_APPEND_DATA; +#endif + + if (user_allow_first != 0) + _acl_append(aclp, ACL_USER_OBJ, user_allow_first, ACL_ENTRY_TYPE_ALLOW); + if (user_deny != 0) + _acl_append(aclp, ACL_USER_OBJ, user_deny, ACL_ENTRY_TYPE_DENY); + if (group_deny != 0) + _acl_append(aclp, ACL_GROUP_OBJ, group_deny, ACL_ENTRY_TYPE_DENY); + _acl_append(aclp, ACL_USER_OBJ, user_allow, ACL_ENTRY_TYPE_ALLOW); + _acl_append(aclp, ACL_GROUP_OBJ, group_allow, ACL_ENTRY_TYPE_ALLOW); + _acl_append(aclp, ACL_EVERYONE, everyone_allow, ACL_ENTRY_TYPE_ALLOW); +} + void acl_nfs4_sync_acl_from_mode(struct acl *aclp, mode_t mode, int file_owner_id) { Modified: head/sys/sys/acl.h ============================================================================== --- head/sys/sys/acl.h Mon Sep 20 17:03:10 2010 (r212905) +++ head/sys/sys/acl.h Mon Sep 20 17:10:06 2010 (r212906) @@ -285,6 +285,8 @@ mode_t acl_posix1e_newfilemode(mode_t struct acl *acl_alloc(int flags); void acl_free(struct acl *aclp); +void acl_nfs4_trivial_from_mode(struct acl *aclp, + mode_t mode); void acl_nfs4_sync_acl_from_mode(struct acl *aclp, mode_t mode, int file_owner_id); void acl_nfs4_sync_mode_from_acl(mode_t *mode, From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 17:39:50 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 14B951065679; Mon, 20 Sep 2010 17:39:50 +0000 (UTC) (envelope-from gibbs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 02F488FC1B; Mon, 20 Sep 2010 17:39:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KHdn2o060631; Mon, 20 Sep 2010 17:39:49 GMT (envelope-from gibbs@svn.freebsd.org) Received: (from gibbs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KHdnuD060627; Mon, 20 Sep 2010 17:39:49 GMT (envelope-from gibbs@svn.freebsd.org) Message-Id: <201009201739.o8KHdnuD060627@svn.freebsd.org> From: "Justin T. Gibbs" Date: Mon, 20 Sep 2010 17:39:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212907 - in stable/8/sys/dev/aic7xxx: . aicasm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 17:39:50 -0000 Author: gibbs Date: Mon Sep 20 17:39:49 2010 New Revision: 212907 URL: http://svn.freebsd.org/changeset/base/212907 Log: MFC r210055: Correct logic bug in aicasm's undefined register bit access detection code. The code in question verifies that all register write operations only change bits that are defined (in the register definition file) for that effected register. The bug effectively disabled this checking. o Fix the check by testing the opcode against all supported read ("and" based) operands. o Add missing bit definitions to the aic7xxx and aic79xx register definition files so that the warning (treated as a fatal error) does not spuriously fire. Modified: stable/8/sys/dev/aic7xxx/aic79xx.reg stable/8/sys/dev/aic7xxx/aic7xxx.reg stable/8/sys/dev/aic7xxx/aicasm/aicasm_gram.y Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/aic7xxx/aic79xx.reg ============================================================================== --- stable/8/sys/dev/aic7xxx/aic79xx.reg Mon Sep 20 17:10:06 2010 (r212906) +++ stable/8/sys/dev/aic7xxx/aic79xx.reg Mon Sep 20 17:39:49 2010 (r212907) @@ -3813,6 +3813,7 @@ scb { SCB_RESIDUAL_SGPTR { size 4 field SG_ADDR_MASK 0xf8 /* In the last byte */ + field SG_ADDR_BIT 0x04 field SG_OVERRUN_RESID 0x02 /* In the first byte */ field SG_LIST_NULL 0x01 /* In the first byte */ } Modified: stable/8/sys/dev/aic7xxx/aic7xxx.reg ============================================================================== --- stable/8/sys/dev/aic7xxx/aic7xxx.reg Mon Sep 20 17:10:06 2010 (r212906) +++ stable/8/sys/dev/aic7xxx/aic7xxx.reg Mon Sep 20 17:39:49 2010 (r212907) @@ -1448,6 +1448,7 @@ scratch_ram { mask EXIT_MSG_LOOP 0x08 mask CONT_MSG_LOOP 0x04 mask CONT_TARG_SESSION 0x02 + mask SPARE 0x01 alias RETURN_1 } ARG_2 { Modified: stable/8/sys/dev/aic7xxx/aicasm/aicasm_gram.y ============================================================================== --- stable/8/sys/dev/aic7xxx/aicasm/aicasm_gram.y Mon Sep 20 17:10:06 2010 (r212906) +++ stable/8/sys/dev/aic7xxx/aicasm/aicasm_gram.y Mon Sep 20 17:39:49 2010 (r212907) @@ -1821,9 +1821,15 @@ type_check(symbol_t *symbol, expression_ { symbol_node_t *node; int and_op; + uint8_t invalid_bits; and_op = FALSE; - if (opcode == AIC_OP_AND || opcode == AIC_OP_JNZ || AIC_OP_JZ) + if (opcode == AIC_OP_AND + || opcode == AIC_OP_BMOV + || opcode == AIC_OP_JE + || opcode == AIC_OP_JNE + || opcode == AIC_OP_JNZ + || opcode == AIC_OP_JZ) and_op = TRUE; /* @@ -1831,12 +1837,11 @@ type_check(symbol_t *symbol, expression_ * that hasn't been defined. If this is an and operation, * this is a mask, so "undefined" bits are okay. */ - if (and_op == FALSE - && (expression->value & ~symbol->info.rinfo->valid_bitmask) != 0) { + invalid_bits = expression->value & ~symbol->info.rinfo->valid_bitmask; + if (and_op == FALSE && invalid_bits != 0) { snprintf(errbuf, sizeof(errbuf), "Invalid bit(s) 0x%x in immediate written to %s", - expression->value & ~symbol->info.rinfo->valid_bitmask, - symbol->name); + invalid_bits, symbol->name); stop(errbuf, EX_DATAERR); /* NOTREACHED */ } From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 17:56:03 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 89FC51065697; Mon, 20 Sep 2010 17:56:03 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7929D8FC1A; Mon, 20 Sep 2010 17:56:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KHu3LX061224; Mon, 20 Sep 2010 17:56:03 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KHu3iD061222; Mon, 20 Sep 2010 17:56:03 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009201756.o8KHu3iD061222@svn.freebsd.org> From: Alexander Motin Date: Mon, 20 Sep 2010 17:56:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212908 - stable/8/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 17:56:03 -0000 Author: mav Date: Mon Sep 20 17:56:03 2010 New Revision: 212908 URL: http://svn.freebsd.org/changeset/base/212908 Log: MFC r201148: Don't forget to use `void' for sched_balance(). It has no arguments. Modified: stable/8/sys/kern/sched_ule.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/kern/sched_ule.c ============================================================================== --- stable/8/sys/kern/sched_ule.c Mon Sep 20 17:39:49 2010 (r212907) +++ stable/8/sys/kern/sched_ule.c Mon Sep 20 17:56:03 2010 (r212908) @@ -773,7 +773,7 @@ sched_balance_group(struct cpu_group *cg } static void -sched_balance() +sched_balance(void) { struct tdq *tdq; From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 18:20:36 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E87F1065670; Mon, 20 Sep 2010 18:20:36 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0D4768FC0A; Mon, 20 Sep 2010 18:20:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KIKZgZ062063; Mon, 20 Sep 2010 18:20:35 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KIKZe2062061; Mon, 20 Sep 2010 18:20:35 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009201820.o8KIKZe2062061@svn.freebsd.org> From: Alexander Motin Date: Mon, 20 Sep 2010 18:20:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212909 - stable/8/sys/i386/i386 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 18:20:36 -0000 Author: mav Date: Mon Sep 20 18:20:35 2010 New Revision: 212909 URL: http://svn.freebsd.org/changeset/base/212909 Log: MFC r196829: Add missing ';'. Modified: stable/8/sys/i386/i386/machdep.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/i386/i386/machdep.c ============================================================================== --- stable/8/sys/i386/i386/machdep.c Mon Sep 20 17:56:03 2010 (r212908) +++ stable/8/sys/i386/i386/machdep.c Mon Sep 20 18:20:35 2010 (r212909) @@ -2593,7 +2593,7 @@ init386(first) default_proc_ldt.ldt_base = (caddr_t)ldt; default_proc_ldt.ldt_len = 6; _default_ldt = (int)&default_proc_ldt; - PCPU_SET(currentldt, _default_ldt) + PCPU_SET(currentldt, _default_ldt); PT_SET_MA(ldt, *vtopte((unsigned long)ldt) & ~PG_RW); xen_set_ldt((unsigned long) ldt, (sizeof ldt_segs / sizeof ldt_segs[0])); From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 18:26:37 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A63DD1065674; Mon, 20 Sep 2010 18:26:37 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 94B898FC1B; Mon, 20 Sep 2010 18:26:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KIQbOX062414; Mon, 20 Sep 2010 18:26:37 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KIQb0K062412; Mon, 20 Sep 2010 18:26:37 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201009201826.o8KIQb0K062412@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Mon, 20 Sep 2010 18:26:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212910 - stable/7/sys/contrib/pf/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 18:26:37 -0000 Author: bz Date: Mon Sep 20 18:26:37 2010 New Revision: 212910 URL: http://svn.freebsd.org/changeset/base/212910 Log: MFC r212403: When using pf routing options, properly handle IP fragmentation for interfaces with TSO enabled, otherwise one would see an extra ICMP unreach, frag needed pre matching packet on lo0. This syncs pf code to ip_output.c r162084. Submitted by: yongari via mlaier PR: kern/144311 Modified: stable/7/sys/contrib/pf/net/pf.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/contrib/pf/net/pf.c ============================================================================== --- stable/7/sys/contrib/pf/net/pf.c Mon Sep 20 18:20:35 2010 (r212909) +++ stable/7/sys/contrib/pf/net/pf.c Mon Sep 20 18:26:37 2010 (r212910) @@ -6376,6 +6376,7 @@ pf_route(struct mbuf **m, struct pf_rule m0->m_pkthdr.csum_flags &= ifp->if_hwassist; if (ntohs(ip->ip_len) <= ifp->if_mtu || + (m0->m_pkthdr.csum_flags & ifp->if_hwassist & CSUM_TSO) != 0 || (ifp->if_hwassist & CSUM_FRAGMENT && ((ip->ip_off & htons(IP_DF)) == 0))) { /* @@ -6450,7 +6451,7 @@ pf_route(struct mbuf **m, struct pf_rule * Too large for interface; fragment if possible. * Must be able to put at least 8 bytes per fragment. */ - if (ip->ip_off & htons(IP_DF)) { + if (ip->ip_off & htons(IP_DF) || (m0->m_pkthdr.csum_flags & CSUM_TSO)) { ipstat.ips_cantfrag++; if (r->rt != PF_DUPTO) { #ifdef __FreeBSD__ From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 18:40:55 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0CBC11065672; Mon, 20 Sep 2010 18:40:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EF8E38FC15; Mon, 20 Sep 2010 18:40:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KIes99062908; Mon, 20 Sep 2010 18:40:54 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KIesP9062906; Mon, 20 Sep 2010 18:40:54 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201009201840.o8KIesP9062906@svn.freebsd.org> From: John Baldwin Date: Mon, 20 Sep 2010 18:40:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212911 - stable/8/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 18:40:55 -0000 Author: jhb Date: Mon Sep 20 18:40:54 2010 New Revision: 212911 URL: http://svn.freebsd.org/changeset/base/212911 Log: MFC 211888: Simplify the tcp pcblist estimate logic slightly. Modified: stable/8/sys/netinet/tcp_subr.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet/tcp_subr.c ============================================================================== --- stable/8/sys/netinet/tcp_subr.c Mon Sep 20 18:26:37 2010 (r212910) +++ stable/8/sys/netinet/tcp_subr.c Mon Sep 20 18:40:54 2010 (r212911) @@ -1016,11 +1016,9 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS) * resource-intensive to repeat twice on every request. */ if (req->oldptr == NULL) { - m = syncache_pcbcount(); - n = V_tcbinfo.ipi_count; - n += imax((m + n) / 8, 10); - req->oldidx = 2 * (sizeof xig) + - (m + n) * sizeof(struct xtcpcb); + n = V_tcbinfo.ipi_count + syncache_pcbcount(); + n += imax(n / 8, 10); + req->oldidx = 2 * (sizeof xig) + n * sizeof(struct xtcpcb); return (0); } From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 18:41:16 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1F4B1106566C; Mon, 20 Sep 2010 18:41:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0E0E38FC12; Mon, 20 Sep 2010 18:41:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KIfFf2062957; Mon, 20 Sep 2010 18:41:15 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KIfFbN062955; Mon, 20 Sep 2010 18:41:15 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201009201841.o8KIfFbN062955@svn.freebsd.org> From: John Baldwin Date: Mon, 20 Sep 2010 18:41:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212912 - stable/7/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 18:41:16 -0000 Author: jhb Date: Mon Sep 20 18:41:15 2010 New Revision: 212912 URL: http://svn.freebsd.org/changeset/base/212912 Log: MFC 211888: Simplify the tcp pcblist estimate logic slightly. Modified: stable/7/sys/netinet/tcp_subr.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/netinet/tcp_subr.c ============================================================================== --- stable/7/sys/netinet/tcp_subr.c Mon Sep 20 18:40:54 2010 (r212911) +++ stable/7/sys/netinet/tcp_subr.c Mon Sep 20 18:41:15 2010 (r212912) @@ -937,11 +937,9 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS) * resource-intensive to repeat twice on every request. */ if (req->oldptr == NULL) { - m = syncache_pcbcount(); - n = tcbinfo.ipi_count; - n += imax((m + n) / 8, 10); - req->oldidx = 2 * (sizeof xig) + - (m + n) * sizeof(struct xtcpcb); + n = tcbinfo.ipi_count + syncache_pcbcount(); + n += imax(n / 8, 10); + req->oldidx = 2 * (sizeof xig) + n * sizeof(struct xtcpcb); return (0); } From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 18:58:24 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 866FA106566C; Mon, 20 Sep 2010 18:58:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 754788FC13; Mon, 20 Sep 2010 18:58:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KIwOnv063482; Mon, 20 Sep 2010 18:58:24 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KIwOxW063480; Mon, 20 Sep 2010 18:58:24 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201009201858.o8KIwOxW063480@svn.freebsd.org> From: John Baldwin Date: Mon, 20 Sep 2010 18:58:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212914 - stable/8/sys/boot/forth X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 18:58:24 -0000 Author: jhb Date: Mon Sep 20 18:58:24 2010 New Revision: 212914 URL: http://svn.freebsd.org/changeset/base/212914 Log: MFC 212338: If autoboot_delay is set to -1, boot immediately without checking for a keypress to match the behavior of the loader. Modified: stable/8/sys/boot/forth/beastie.4th Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/boot/forth/beastie.4th ============================================================================== --- stable/8/sys/boot/forth/beastie.4th Mon Sep 20 18:49:28 2010 (r212913) +++ stable/8/sys/boot/forth/beastie.4th Mon Sep 20 18:58:24 2010 (r212914) @@ -240,7 +240,10 @@ set-current drop 10 else - 0 0 2swap >number drop drop drop + 2dup s" -1" compare 0= if + 0 boot + then + 0 s>d 2swap >number 2drop drop then begin dup tkey From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 18:58:45 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1AE621065670; Mon, 20 Sep 2010 18:58:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 09D9E8FC18; Mon, 20 Sep 2010 18:58:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KIwi9F063525; Mon, 20 Sep 2010 18:58:44 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KIwiAi063523; Mon, 20 Sep 2010 18:58:44 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201009201858.o8KIwiAi063523@svn.freebsd.org> From: John Baldwin Date: Mon, 20 Sep 2010 18:58:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212915 - stable/7/sys/boot/forth X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 18:58:45 -0000 Author: jhb Date: Mon Sep 20 18:58:44 2010 New Revision: 212915 URL: http://svn.freebsd.org/changeset/base/212915 Log: MFC 212338: If autoboot_delay is set to -1, boot immediately without checking for a keypress to match the behavior of the loader. Modified: stable/7/sys/boot/forth/beastie.4th Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/boot/forth/beastie.4th ============================================================================== --- stable/7/sys/boot/forth/beastie.4th Mon Sep 20 18:58:24 2010 (r212914) +++ stable/7/sys/boot/forth/beastie.4th Mon Sep 20 18:58:44 2010 (r212915) @@ -240,7 +240,10 @@ set-current drop 10 else - 0 0 2swap >number drop drop drop + 2dup s" -1" compare 0= if + 0 boot + then + 0 s>d 2swap >number 2drop drop then begin dup tkey From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 19:17:22 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51823106566B; Mon, 20 Sep 2010 19:17:22 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4014C8FC08; Mon, 20 Sep 2010 19:17:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KJHMBM064181; Mon, 20 Sep 2010 19:17:22 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KJHMq9064179; Mon, 20 Sep 2010 19:17:22 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201009201917.o8KJHMq9064179@svn.freebsd.org> From: John Baldwin Date: Mon, 20 Sep 2010 19:17:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212918 - stable/8/usr.sbin/pciconf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:17:22 -0000 Author: jhb Date: Mon Sep 20 19:17:21 2010 New Revision: 212918 URL: http://svn.freebsd.org/changeset/base/212918 Log: MFC 212329: Simplify chkattached(). The PCIOCATTACHED ioctl only needs the pi_sel field populated, it ignores the rest of the 'pci_io' structure. Modified: stable/8/usr.sbin/pciconf/pciconf.c Directory Properties: stable/8/usr.sbin/pciconf/ (props changed) Modified: stable/8/usr.sbin/pciconf/pciconf.c ============================================================================== --- stable/8/usr.sbin/pciconf/pciconf.c Mon Sep 20 19:14:45 2010 (r212917) +++ stable/8/usr.sbin/pciconf/pciconf.c Mon Sep 20 19:17:21 2010 (r212918) @@ -75,7 +75,7 @@ static const char *guess_subclass(struct static int load_vendors(void); static void readit(const char *, const char *, int); static void writeit(const char *, const char *, const char *, int); -static void chkattached(const char *, int); +static void chkattached(const char *); static int exitstatus = 0; @@ -148,8 +148,7 @@ main(int argc, char **argv) if (listmode) { list_devs(verbose, bars, caps); } else if (attachedmode) { - chkattached(argv[optind], - byte ? 1 : isshort ? 2 : 4); + chkattached(argv[optind]); } else if (readmode) { readit(argv[optind], argv[optind + 1], byte ? 1 : isshort ? 2 : 4); @@ -646,15 +645,12 @@ writeit(const char *name, const char *re } static void -chkattached(const char *name, int width) +chkattached(const char *name) { int fd; struct pci_io pi; pi.pi_sel = getsel(name); - pi.pi_reg = 0; - pi.pi_width = width; - pi.pi_data = 0; fd = open(_PATH_DEVPCI, O_RDWR, 0); if (fd < 0) From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 19:17:32 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 04BD51065674; Mon, 20 Sep 2010 19:17:32 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E78A38FC16; Mon, 20 Sep 2010 19:17:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KJHVI5064220; Mon, 20 Sep 2010 19:17:31 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KJHVbm064218; Mon, 20 Sep 2010 19:17:31 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201009201917.o8KJHVbm064218@svn.freebsd.org> From: John Baldwin Date: Mon, 20 Sep 2010 19:17:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212919 - stable/7/usr.sbin/pciconf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:17:32 -0000 Author: jhb Date: Mon Sep 20 19:17:31 2010 New Revision: 212919 URL: http://svn.freebsd.org/changeset/base/212919 Log: MFC 212329: Simplify chkattached(). The PCIOCATTACHED ioctl only needs the pi_sel field populated, it ignores the rest of the 'pci_io' structure. Modified: stable/7/usr.sbin/pciconf/pciconf.c Directory Properties: stable/7/usr.sbin/pciconf/ (props changed) Modified: stable/7/usr.sbin/pciconf/pciconf.c ============================================================================== --- stable/7/usr.sbin/pciconf/pciconf.c Mon Sep 20 19:17:21 2010 (r212918) +++ stable/7/usr.sbin/pciconf/pciconf.c Mon Sep 20 19:17:31 2010 (r212919) @@ -75,7 +75,7 @@ static const char *guess_subclass(struct static int load_vendors(void); static void readit(const char *, const char *, int); static void writeit(const char *, const char *, const char *, int); -static void chkattached(const char *, int); +static void chkattached(const char *); static int exitstatus = 0; @@ -148,8 +148,7 @@ main(int argc, char **argv) if (listmode) { list_devs(verbose, bars, caps); } else if (attachedmode) { - chkattached(argv[optind], - byte ? 1 : isshort ? 2 : 4); + chkattached(argv[optind]); } else if (readmode) { readit(argv[optind], argv[optind + 1], byte ? 1 : isshort ? 2 : 4); @@ -645,15 +644,12 @@ writeit(const char *name, const char *re } static void -chkattached(const char *name, int width) +chkattached(const char *name) { int fd; struct pci_io pi; pi.pi_sel = getsel(name); - pi.pi_reg = 0; - pi.pi_width = width; - pi.pi_data = 0; fd = open(_PATH_DEVPCI, O_RDWR, 0); if (fd < 0) From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 19:25:16 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 20CB51065670; Mon, 20 Sep 2010 19:25:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0F7B38FC12; Mon, 20 Sep 2010 19:25:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KJPFt6064571; Mon, 20 Sep 2010 19:25:15 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KJPFWT064569; Mon, 20 Sep 2010 19:25:15 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201009201925.o8KJPFWT064569@svn.freebsd.org> From: John Baldwin Date: Mon, 20 Sep 2010 19:25:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212921 - stable/8/usr.sbin/pciconf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:25:16 -0000 Author: jhb Date: Mon Sep 20 19:25:15 2010 New Revision: 212921 URL: http://svn.freebsd.org/changeset/base/212921 Log: MFC 212369: - Use 'sta' to hold the PCIR_STATUS register value instead of 'cmd' when walking the capability list. - Use constants for PCI header types instead of magic numbers. Modified: stable/8/usr.sbin/pciconf/cap.c Directory Properties: stable/8/usr.sbin/pciconf/ (props changed) Modified: stable/8/usr.sbin/pciconf/cap.c ============================================================================== --- stable/8/usr.sbin/pciconf/cap.c Mon Sep 20 19:20:37 2010 (r212920) +++ stable/8/usr.sbin/pciconf/cap.c Mon Sep 20 19:25:15 2010 (r212921) @@ -458,20 +458,20 @@ cap_pciaf(int fd, struct pci_conf *p, ui void list_caps(int fd, struct pci_conf *p) { - uint16_t cmd; + uint16_t sta; uint8_t ptr, cap; /* Are capabilities present for this device? */ - cmd = read_config(fd, &p->pc_sel, PCIR_STATUS, 2); - if (!(cmd & PCIM_STATUS_CAPPRESENT)) + sta = read_config(fd, &p->pc_sel, PCIR_STATUS, 2); + if (!(sta & PCIM_STATUS_CAPPRESENT)) return; switch (p->pc_hdr & PCIM_HDRTYPE) { - case 0: - case 1: + case PCIM_HDRTYPE_NORMAL: + case PCIM_HDRTYPE_BRIDGE: ptr = PCIR_CAP_PTR; break; - case 2: + case PCIM_HDRTYPE_CARDBUS: ptr = PCIR_CAP_PTR_2; break; default: From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 19:25:27 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 85221106578D; Mon, 20 Sep 2010 19:25:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 739998FC0A; Mon, 20 Sep 2010 19:25:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KJPRYB064614; Mon, 20 Sep 2010 19:25:27 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KJPRie064612; Mon, 20 Sep 2010 19:25:27 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201009201925.o8KJPRie064612@svn.freebsd.org> From: John Baldwin Date: Mon, 20 Sep 2010 19:25:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212922 - stable/7/usr.sbin/pciconf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:25:27 -0000 Author: jhb Date: Mon Sep 20 19:25:27 2010 New Revision: 212922 URL: http://svn.freebsd.org/changeset/base/212922 Log: MFC 212369: - Use 'sta' to hold the PCIR_STATUS register value instead of 'cmd' when walking the capability list. - Use constants for PCI header types instead of magic numbers. Modified: stable/7/usr.sbin/pciconf/cap.c Directory Properties: stable/7/usr.sbin/pciconf/ (props changed) Modified: stable/7/usr.sbin/pciconf/cap.c ============================================================================== --- stable/7/usr.sbin/pciconf/cap.c Mon Sep 20 19:25:15 2010 (r212921) +++ stable/7/usr.sbin/pciconf/cap.c Mon Sep 20 19:25:27 2010 (r212922) @@ -458,20 +458,20 @@ cap_pciaf(int fd, struct pci_conf *p, ui void list_caps(int fd, struct pci_conf *p) { - uint16_t cmd; + uint16_t sta; uint8_t ptr, cap; /* Are capabilities present for this device? */ - cmd = read_config(fd, &p->pc_sel, PCIR_STATUS, 2); - if (!(cmd & PCIM_STATUS_CAPPRESENT)) + sta = read_config(fd, &p->pc_sel, PCIR_STATUS, 2); + if (!(sta & PCIM_STATUS_CAPPRESENT)) return; switch (p->pc_hdr & PCIM_HDRTYPE) { - case 0: - case 1: + case PCIM_HDRTYPE_NORMAL: + case PCIM_HDRTYPE_BRIDGE: ptr = PCIR_CAP_PTR; break; - case 2: + case PCIM_HDRTYPE_CARDBUS: ptr = PCIR_CAP_PTR_2; break; default: From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 19:29:49 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 620B21065670; Mon, 20 Sep 2010 19:29:48 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4FBB68FC12; Mon, 20 Sep 2010 19:29:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KJTmxx064791; Mon, 20 Sep 2010 19:29:48 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KJTm1r064788; Mon, 20 Sep 2010 19:29:48 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201009201929.o8KJTm1r064788@svn.freebsd.org> From: John Baldwin Date: Mon, 20 Sep 2010 19:29:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212923 - in stable/8: sys/dev/pci usr.sbin/pciconf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:29:49 -0000 Author: jhb Date: Mon Sep 20 19:29:48 2010 New Revision: 212923 URL: http://svn.freebsd.org/changeset/base/212923 Log: MFC 209907,212326,212368,212749: - Provide more defines for PCI-Express device ctrl. - Add register definitions related to extended capability IDs in PCI-express. I used PCIZ_* for ID constants (plain capability IDs use PCIY_*). - Add register definitions for the Advanced Error Reporting, Virtual Channels, and Device Serial Number extended capabilities. - Teach pciconf -c to list extended as well as plain capabilities for PCI-express devices. Adds more detailed parsing for AER, VC, and device serial numbers. Modified: stable/8/sys/dev/pci/pcireg.h stable/8/usr.sbin/pciconf/cap.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/usr.sbin/pciconf/ (props changed) Modified: stable/8/sys/dev/pci/pcireg.h ============================================================================== --- stable/8/sys/dev/pci/pcireg.h Mon Sep 20 19:25:27 2010 (r212922) +++ stable/8/sys/dev/pci/pcireg.h Mon Sep 20 19:29:48 2010 (r212923) @@ -36,6 +36,7 @@ * PCIV_xxx: PCI vendor ID (only required to fixup ancient devices) * PCID_xxx: device ID * PCIY_xxx: capability identification number + * PCIZ_xxx: extended capability identification number */ /* some PCI bus constants */ @@ -66,7 +67,8 @@ #define PCIM_STATUS_CAPPRESENT 0x0010 #define PCIM_STATUS_66CAPABLE 0x0020 #define PCIM_STATUS_BACKTOBACK 0x0080 -#define PCIM_STATUS_PERRREPORT 0x0100 +#define PCIM_STATUS_MDPERR 0x0100 +#define PCIM_STATUS_PERRREPORT PCIM_STATUS_MDPERR #define PCIM_STATUS_SEL_FAST 0x0000 #define PCIM_STATUS_SEL_MEDIMUM 0x0200 #define PCIM_STATUS_SEL_SLOW 0x0400 @@ -117,6 +119,28 @@ #define PCIY_SATA 0x12 /* SATA */ #define PCIY_PCIAF 0x13 /* PCI Advanced Features */ +/* Extended Capability Register Fields */ + +#define PCIR_EXTCAP 0x100 +#define PCIM_EXTCAP_ID 0x0000ffff +#define PCIM_EXTCAP_VER 0x000f0000 +#define PCIM_EXTCAP_NEXTPTR 0xfff00000 +#define PCI_EXTCAP_ID(ecap) ((ecap) & PCIM_EXTCAP_ID) +#define PCI_EXTCAP_VER(ecap) (((ecap) & PCIM_EXTCAP_VER) >> 16) +#define PCI_EXTCAP_NEXTPTR(ecap) (((ecap) & PCIM_EXTCAP_NEXTPTR) >> 20) + +/* Extended Capability Identification Numbers */ + +#define PCIZ_AER 0x0001 /* Advanced Error Reporting */ +#define PCIZ_VC 0x0002 /* Virtual Channel */ +#define PCIZ_SERNUM 0x0003 /* Device Serial Number */ +#define PCIZ_PWRBDGT 0x0004 /* Power Budgeting */ +#define PCIZ_VENDOR 0x000b /* Vendor Unique */ +#define PCIZ_ACS 0x000d /* Access Control Services */ +#define PCIZ_ARI 0x000e /* Alternative Routing-ID Interpretation */ +#define PCIZ_ATS 0x000f /* Address Translation Services */ +#define PCIZ_SRIOV 0x0010 /* Single Root IO Virtualization */ + /* config registers for header type 0 devices */ #define PCIR_BARS 0x10 @@ -605,6 +629,9 @@ #define PCIR_EXPRESS_DEVICE_CAP 0x4 #define PCIM_EXP_CAP_MAX_PAYLOAD 0x0007 #define PCIR_EXPRESS_DEVICE_CTL 0x8 +#define PCIM_EXP_CTL_NFER_ENABLE 0x0002 +#define PCIM_EXP_CTL_FER_ENABLE 0x0004 +#define PCIM_EXP_CTL_URR_ENABLE 0x0008 #define PCIM_EXP_CTL_RELAXED_ORD_ENABLE 0x0010 #define PCIM_EXP_CTL_MAX_PAYLOAD 0x00e0 #define PCIM_EXP_CTL_NOSNOOP_ENABLE 0x0800 @@ -660,3 +687,64 @@ #define PCIR_PCIAFCTRL_FLR 0x01 #define PCIR_PCIAF_STATUS 0x5 #define PCIR_PCIAFSTATUS_TP 0x01 + +/* Advanced Error Reporting */ +#define PCIR_AER_UC_STATUS 0x04 +#define PCIM_AER_UC_TRAINING_ERROR 0x00000001 +#define PCIM_AER_UC_DL_PROTOCOL_ERROR 0x00000010 +#define PCIM_AER_UC_POISONED_TLP 0x00001000 +#define PCIM_AER_UC_FC_PROTOCOL_ERROR 0x00002000 +#define PCIM_AER_UC_COMPLETION_TIMEOUT 0x00004000 +#define PCIM_AER_UC_COMPLETER_ABORT 0x00008000 +#define PCIM_AER_UC_UNEXPECTED_COMPLETION 0x00010000 +#define PCIM_AER_UC_RECEIVER_OVERFLOW 0x00020000 +#define PCIM_AER_UC_MALFORMED_TLP 0x00040000 +#define PCIM_AER_UC_ECRC_ERROR 0x00080000 +#define PCIM_AER_UC_UNSUPPORTED_REQUEST 0x00100000 +#define PCIM_AER_UC_ACS_VIOLATION 0x00200000 +#define PCIR_AER_UC_MASK 0x08 /* Shares bits with UC_STATUS */ +#define PCIR_AER_UC_SEVERITY 0x0c /* Shares bits with UC_STATUS */ +#define PCIR_AER_COR_STATUS 0x10 +#define PCIM_AER_COR_RECEIVER_ERROR 0x00000001 +#define PCIM_AER_COR_BAD_TLP 0x00000040 +#define PCIM_AER_COR_BAD_DLLP 0x00000080 +#define PCIM_AER_COR_REPLAY_ROLLOVER 0x00000100 +#define PCIM_AER_COR_REPLAY_TIMEOUT 0x00001000 +#define PCIR_AER_COR_MASK 0x14 /* Shares bits with COR_STATUS */ +#define PCIR_AER_CAP_CONTROL 0x18 +#define PCIM_AER_FIRST_ERROR_PTR 0x0000001f +#define PCIM_AER_ECRC_GEN_CAPABLE 0x00000020 +#define PCIM_AER_ECRC_GEN_ENABLE 0x00000040 +#define PCIM_AER_ECRC_CHECK_CAPABLE 0x00000080 +#define PCIM_AER_ECRC_CHECK_ENABLE 0x00000100 +#define PCIR_AER_HEADER_LOG 0x1c +#define PCIR_AER_ROOTERR_CMD 0x2c /* Only for root complex ports */ +#define PCIM_AER_ROOTERR_COR_ENABLE 0x00000001 +#define PCIM_AER_ROOTERR_NF_ENABLE 0x00000002 +#define PCIM_AER_ROOTERR_F_ENABLE 0x00000004 +#define PCIR_AER_ROOTERR_STATUS 0x30 /* Only for root complex ports */ +#define PCIM_AER_ROOTERR_COR_ERR 0x00000001 +#define PCIM_AER_ROOTERR_MULTI_COR_ERR 0x00000002 +#define PCIM_AER_ROOTERR_UC_ERR 0x00000004 +#define PCIM_AER_ROOTERR_MULTI_UC_ERR 0x00000008 +#define PCIM_AER_ROOTERR_FIRST_UC_FATAL 0x00000010 +#define PCIM_AER_ROOTERR_NF_ERR 0x00000020 +#define PCIM_AER_ROOTERR_F_ERR 0x00000040 +#define PCIM_AER_ROOTERR_INT_MESSAGE 0xf8000000 +#define PCIR_AER_COR_SOURCE_ID 0x34 /* Only for root complex ports */ +#define PCIR_AER_ERR_SOURCE_ID 0x36 /* Only for root complex ports */ + +/* Virtual Channel definitions */ +#define PCIR_VC_CAP1 0x04 +#define PCIM_VC_CAP1_EXT_COUNT 0x00000007 +#define PCIM_VC_CAP1_LOWPRI_EXT_COUNT 0x00000070 +#define PCIR_VC_CAP2 0x08 +#define PCIR_VC_CONTROL 0x0C +#define PCIR_VC_STATUS 0x0E +#define PCIR_VC_RESOURCE_CAP(n) (0x10 + (n) * 0x0C) +#define PCIR_VC_RESOURCE_CTL(n) (0x14 + (n) * 0x0C) +#define PCIR_VC_RESOURCE_STA(n) (0x18 + (n) * 0x0C) + +/* Serial Number definitions */ +#define PCIR_SERIAL_LOW 0x04 +#define PCIR_SERIAL_HIGH 0x08 Modified: stable/8/usr.sbin/pciconf/cap.c ============================================================================== --- stable/8/usr.sbin/pciconf/cap.c Mon Sep 20 19:25:27 2010 (r212922) +++ stable/8/usr.sbin/pciconf/cap.c Mon Sep 20 19:29:48 2010 (r212923) @@ -45,6 +45,8 @@ static const char rcsid[] = #include "pciconf.h" +static void list_ecaps(int fd, struct pci_conf *p); + static void cap_power(int fd, struct pci_conf *p, uint8_t ptr) { @@ -458,6 +460,7 @@ cap_pciaf(int fd, struct pci_conf *p, ui void list_caps(int fd, struct pci_conf *p) { + int express; uint16_t sta; uint8_t ptr, cap; @@ -479,6 +482,7 @@ list_caps(int fd, struct pci_conf *p) } /* Walk the capability list. */ + express = 0; ptr = read_config(fd, &p->pc_sel, ptr, 1); while (ptr != 0 && ptr != 0xff) { cap = read_config(fd, &p->pc_sel, ptr + PCICAP_ID, 1); @@ -512,6 +516,7 @@ list_caps(int fd, struct pci_conf *p) cap_subvendor(fd, p, ptr); break; case PCIY_EXPRESS: + express = 1; cap_express(fd, p, ptr); break; case PCIY_MSIX: @@ -530,4 +535,98 @@ list_caps(int fd, struct pci_conf *p) printf("\n"); ptr = read_config(fd, &p->pc_sel, ptr + PCICAP_NEXTPTR, 1); } + + if (express) + list_ecaps(fd, p); +} + +/* From . */ +static __inline uint32_t +bitcount32(uint32_t x) +{ + + x = (x & 0x55555555) + ((x & 0xaaaaaaaa) >> 1); + x = (x & 0x33333333) + ((x & 0xcccccccc) >> 2); + x = (x + (x >> 4)) & 0x0f0f0f0f; + x = (x + (x >> 8)); + x = (x + (x >> 16)) & 0x000000ff; + return (x); +} + +static void +ecap_aer(int fd, struct pci_conf *p, uint16_t ptr, uint8_t ver) +{ + uint32_t sta, mask; + + printf("AER %d", ver); + if (ver != 1) + return; + sta = read_config(fd, &p->pc_sel, ptr + PCIR_AER_UC_STATUS, 4); + mask = read_config(fd, &p->pc_sel, ptr + PCIR_AER_UC_SEVERITY, 4); + printf(" %d fatal", bitcount32(sta & mask)); + printf(" %d non-fatal", bitcount32(sta & ~mask)); + sta = read_config(fd, &p->pc_sel, ptr + PCIR_AER_COR_STATUS, 4); + printf(" %d corrected", bitcount32(sta)); +} + +static void +ecap_vc(int fd, struct pci_conf *p, uint16_t ptr, uint8_t ver) +{ + uint32_t cap1; + + printf("VC %d", ver); + if (ver != 1) + return; + cap1 = read_config(fd, &p->pc_sel, ptr + PCIR_VC_CAP1, 4); + printf(" max VC%d", cap1 & PCIM_VC_CAP1_EXT_COUNT); + if ((cap1 & PCIM_VC_CAP1_LOWPRI_EXT_COUNT) != 0) + printf(" lowpri VC0-VC%d", + (cap1 & PCIM_VC_CAP1_LOWPRI_EXT_COUNT) >> 4); +} + +static void +ecap_sernum(int fd, struct pci_conf *p, uint16_t ptr, uint8_t ver) +{ + uint32_t high, low; + + printf("Serial %d", ver); + if (ver != 1) + return; + low = read_config(fd, &p->pc_sel, ptr + PCIR_SERIAL_LOW, 4); + high = read_config(fd, &p->pc_sel, ptr + PCIR_SERIAL_HIGH, 4); + printf(" %08x%08x", high, low); +} + +static void +list_ecaps(int fd, struct pci_conf *p) +{ + uint32_t ecap; + uint16_t ptr; + + ptr = PCIR_EXTCAP; + ecap = read_config(fd, &p->pc_sel, ptr, 4); + if (ecap == 0xffffffff || ecap == 0) + return; + for (;;) { + printf("ecap %04x[%03x] = ", PCI_EXTCAP_ID(ecap), ptr); + switch (PCI_EXTCAP_ID(ecap)) { + case PCIZ_AER: + ecap_aer(fd, p, ptr, PCI_EXTCAP_VER(ecap)); + break; + case PCIZ_VC: + ecap_vc(fd, p, ptr, PCI_EXTCAP_VER(ecap)); + break; + case PCIZ_SERNUM: + ecap_sernum(fd, p, ptr, PCI_EXTCAP_VER(ecap)); + break; + default: + printf("unknown %d", PCI_EXTCAP_VER(ecap)); + break; + } + printf("\n"); + ptr = PCI_EXTCAP_NEXTPTR(ecap); + if (ptr == 0) + break; + ecap = read_config(fd, &p->pc_sel, ptr, 4); + } } From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 19:30:21 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5EEAA1065697; Mon, 20 Sep 2010 19:30:21 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4C83B8FC1D; Mon, 20 Sep 2010 19:30:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KJULul064854; Mon, 20 Sep 2010 19:30:21 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KJULNE064851; Mon, 20 Sep 2010 19:30:21 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201009201930.o8KJULNE064851@svn.freebsd.org> From: John Baldwin Date: Mon, 20 Sep 2010 19:30:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212924 - in stable/7: sys/dev/pci usr.sbin/pciconf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:30:21 -0000 Author: jhb Date: Mon Sep 20 19:30:20 2010 New Revision: 212924 URL: http://svn.freebsd.org/changeset/base/212924 Log: MFC 209907,212326,212368,212749: - Provide more defines for PCI-Express device ctrl. - Add register definitions related to extended capability IDs in PCI-express. I used PCIZ_* for ID constants (plain capability IDs use PCIY_*). - Add register definitions for the Advanced Error Reporting, Virtual Channels, and Device Serial Number extended capabilities. - Teach pciconf -c to list extended as well as plain capabilities for PCI-express devices. Adds more detailed parsing for AER, VC, and device serial numbers. Modified: stable/7/sys/dev/pci/pcireg.h stable/7/usr.sbin/pciconf/cap.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/usr.sbin/pciconf/ (props changed) Modified: stable/7/sys/dev/pci/pcireg.h ============================================================================== --- stable/7/sys/dev/pci/pcireg.h Mon Sep 20 19:29:48 2010 (r212923) +++ stable/7/sys/dev/pci/pcireg.h Mon Sep 20 19:30:20 2010 (r212924) @@ -36,6 +36,7 @@ * PCIV_xxx: PCI vendor ID (only required to fixup ancient devices) * PCID_xxx: device ID * PCIY_xxx: capability identification number + * PCIZ_xxx: extended capability identification number */ /* some PCI bus constants */ @@ -66,7 +67,8 @@ #define PCIM_STATUS_CAPPRESENT 0x0010 #define PCIM_STATUS_66CAPABLE 0x0020 #define PCIM_STATUS_BACKTOBACK 0x0080 -#define PCIM_STATUS_PERRREPORT 0x0100 +#define PCIM_STATUS_MDPERR 0x0100 +#define PCIM_STATUS_PERRREPORT PCIM_STATUS_MDPERR #define PCIM_STATUS_SEL_FAST 0x0000 #define PCIM_STATUS_SEL_MEDIMUM 0x0200 #define PCIM_STATUS_SEL_SLOW 0x0400 @@ -117,6 +119,28 @@ #define PCIY_SATA 0x12 /* SATA */ #define PCIY_PCIAF 0x13 /* PCI Advanced Features */ +/* Extended Capability Register Fields */ + +#define PCIR_EXTCAP 0x100 +#define PCIM_EXTCAP_ID 0x0000ffff +#define PCIM_EXTCAP_VER 0x000f0000 +#define PCIM_EXTCAP_NEXTPTR 0xfff00000 +#define PCI_EXTCAP_ID(ecap) ((ecap) & PCIM_EXTCAP_ID) +#define PCI_EXTCAP_VER(ecap) (((ecap) & PCIM_EXTCAP_VER) >> 16) +#define PCI_EXTCAP_NEXTPTR(ecap) (((ecap) & PCIM_EXTCAP_NEXTPTR) >> 20) + +/* Extended Capability Identification Numbers */ + +#define PCIZ_AER 0x0001 /* Advanced Error Reporting */ +#define PCIZ_VC 0x0002 /* Virtual Channel */ +#define PCIZ_SERNUM 0x0003 /* Device Serial Number */ +#define PCIZ_PWRBDGT 0x0004 /* Power Budgeting */ +#define PCIZ_VENDOR 0x000b /* Vendor Unique */ +#define PCIZ_ACS 0x000d /* Access Control Services */ +#define PCIZ_ARI 0x000e /* Alternative Routing-ID Interpretation */ +#define PCIZ_ATS 0x000f /* Address Translation Services */ +#define PCIZ_SRIOV 0x0010 /* Single Root IO Virtualization */ + /* config registers for header type 0 devices */ #define PCIR_BARS 0x10 @@ -605,6 +629,9 @@ #define PCIR_EXPRESS_DEVICE_CAP 0x4 #define PCIM_EXP_CAP_MAX_PAYLOAD 0x0007 #define PCIR_EXPRESS_DEVICE_CTL 0x8 +#define PCIM_EXP_CTL_NFER_ENABLE 0x0002 +#define PCIM_EXP_CTL_FER_ENABLE 0x0004 +#define PCIM_EXP_CTL_URR_ENABLE 0x0008 #define PCIM_EXP_CTL_RELAXED_ORD_ENABLE 0x0010 #define PCIM_EXP_CTL_MAX_PAYLOAD 0x00e0 #define PCIM_EXP_CTL_NOSNOOP_ENABLE 0x0800 @@ -660,3 +687,64 @@ #define PCIR_PCIAFCTRL_FLR 0x01 #define PCIR_PCIAF_STATUS 0x5 #define PCIR_PCIAFSTATUS_TP 0x01 + +/* Advanced Error Reporting */ +#define PCIR_AER_UC_STATUS 0x04 +#define PCIM_AER_UC_TRAINING_ERROR 0x00000001 +#define PCIM_AER_UC_DL_PROTOCOL_ERROR 0x00000010 +#define PCIM_AER_UC_POISONED_TLP 0x00001000 +#define PCIM_AER_UC_FC_PROTOCOL_ERROR 0x00002000 +#define PCIM_AER_UC_COMPLETION_TIMEOUT 0x00004000 +#define PCIM_AER_UC_COMPLETER_ABORT 0x00008000 +#define PCIM_AER_UC_UNEXPECTED_COMPLETION 0x00010000 +#define PCIM_AER_UC_RECEIVER_OVERFLOW 0x00020000 +#define PCIM_AER_UC_MALFORMED_TLP 0x00040000 +#define PCIM_AER_UC_ECRC_ERROR 0x00080000 +#define PCIM_AER_UC_UNSUPPORTED_REQUEST 0x00100000 +#define PCIM_AER_UC_ACS_VIOLATION 0x00200000 +#define PCIR_AER_UC_MASK 0x08 /* Shares bits with UC_STATUS */ +#define PCIR_AER_UC_SEVERITY 0x0c /* Shares bits with UC_STATUS */ +#define PCIR_AER_COR_STATUS 0x10 +#define PCIM_AER_COR_RECEIVER_ERROR 0x00000001 +#define PCIM_AER_COR_BAD_TLP 0x00000040 +#define PCIM_AER_COR_BAD_DLLP 0x00000080 +#define PCIM_AER_COR_REPLAY_ROLLOVER 0x00000100 +#define PCIM_AER_COR_REPLAY_TIMEOUT 0x00001000 +#define PCIR_AER_COR_MASK 0x14 /* Shares bits with COR_STATUS */ +#define PCIR_AER_CAP_CONTROL 0x18 +#define PCIM_AER_FIRST_ERROR_PTR 0x0000001f +#define PCIM_AER_ECRC_GEN_CAPABLE 0x00000020 +#define PCIM_AER_ECRC_GEN_ENABLE 0x00000040 +#define PCIM_AER_ECRC_CHECK_CAPABLE 0x00000080 +#define PCIM_AER_ECRC_CHECK_ENABLE 0x00000100 +#define PCIR_AER_HEADER_LOG 0x1c +#define PCIR_AER_ROOTERR_CMD 0x2c /* Only for root complex ports */ +#define PCIM_AER_ROOTERR_COR_ENABLE 0x00000001 +#define PCIM_AER_ROOTERR_NF_ENABLE 0x00000002 +#define PCIM_AER_ROOTERR_F_ENABLE 0x00000004 +#define PCIR_AER_ROOTERR_STATUS 0x30 /* Only for root complex ports */ +#define PCIM_AER_ROOTERR_COR_ERR 0x00000001 +#define PCIM_AER_ROOTERR_MULTI_COR_ERR 0x00000002 +#define PCIM_AER_ROOTERR_UC_ERR 0x00000004 +#define PCIM_AER_ROOTERR_MULTI_UC_ERR 0x00000008 +#define PCIM_AER_ROOTERR_FIRST_UC_FATAL 0x00000010 +#define PCIM_AER_ROOTERR_NF_ERR 0x00000020 +#define PCIM_AER_ROOTERR_F_ERR 0x00000040 +#define PCIM_AER_ROOTERR_INT_MESSAGE 0xf8000000 +#define PCIR_AER_COR_SOURCE_ID 0x34 /* Only for root complex ports */ +#define PCIR_AER_ERR_SOURCE_ID 0x36 /* Only for root complex ports */ + +/* Virtual Channel definitions */ +#define PCIR_VC_CAP1 0x04 +#define PCIM_VC_CAP1_EXT_COUNT 0x00000007 +#define PCIM_VC_CAP1_LOWPRI_EXT_COUNT 0x00000070 +#define PCIR_VC_CAP2 0x08 +#define PCIR_VC_CONTROL 0x0C +#define PCIR_VC_STATUS 0x0E +#define PCIR_VC_RESOURCE_CAP(n) (0x10 + (n) * 0x0C) +#define PCIR_VC_RESOURCE_CTL(n) (0x14 + (n) * 0x0C) +#define PCIR_VC_RESOURCE_STA(n) (0x18 + (n) * 0x0C) + +/* Serial Number definitions */ +#define PCIR_SERIAL_LOW 0x04 +#define PCIR_SERIAL_HIGH 0x08 Modified: stable/7/usr.sbin/pciconf/cap.c ============================================================================== --- stable/7/usr.sbin/pciconf/cap.c Mon Sep 20 19:29:48 2010 (r212923) +++ stable/7/usr.sbin/pciconf/cap.c Mon Sep 20 19:30:20 2010 (r212924) @@ -45,6 +45,8 @@ static const char rcsid[] = #include "pciconf.h" +static void list_ecaps(int fd, struct pci_conf *p); + static void cap_power(int fd, struct pci_conf *p, uint8_t ptr) { @@ -458,6 +460,7 @@ cap_pciaf(int fd, struct pci_conf *p, ui void list_caps(int fd, struct pci_conf *p) { + int express; uint16_t sta; uint8_t ptr, cap; @@ -479,6 +482,7 @@ list_caps(int fd, struct pci_conf *p) } /* Walk the capability list. */ + express = 0; ptr = read_config(fd, &p->pc_sel, ptr, 1); while (ptr != 0 && ptr != 0xff) { cap = read_config(fd, &p->pc_sel, ptr + PCICAP_ID, 1); @@ -512,6 +516,7 @@ list_caps(int fd, struct pci_conf *p) cap_subvendor(fd, p, ptr); break; case PCIY_EXPRESS: + express = 1; cap_express(fd, p, ptr); break; case PCIY_MSIX: @@ -530,4 +535,98 @@ list_caps(int fd, struct pci_conf *p) printf("\n"); ptr = read_config(fd, &p->pc_sel, ptr + PCICAP_NEXTPTR, 1); } + + if (express) + list_ecaps(fd, p); +} + +/* From . */ +static __inline uint32_t +bitcount32(uint32_t x) +{ + + x = (x & 0x55555555) + ((x & 0xaaaaaaaa) >> 1); + x = (x & 0x33333333) + ((x & 0xcccccccc) >> 2); + x = (x + (x >> 4)) & 0x0f0f0f0f; + x = (x + (x >> 8)); + x = (x + (x >> 16)) & 0x000000ff; + return (x); +} + +static void +ecap_aer(int fd, struct pci_conf *p, uint16_t ptr, uint8_t ver) +{ + uint32_t sta, mask; + + printf("AER %d", ver); + if (ver != 1) + return; + sta = read_config(fd, &p->pc_sel, ptr + PCIR_AER_UC_STATUS, 4); + mask = read_config(fd, &p->pc_sel, ptr + PCIR_AER_UC_SEVERITY, 4); + printf(" %d fatal", bitcount32(sta & mask)); + printf(" %d non-fatal", bitcount32(sta & ~mask)); + sta = read_config(fd, &p->pc_sel, ptr + PCIR_AER_COR_STATUS, 4); + printf(" %d corrected", bitcount32(sta)); +} + +static void +ecap_vc(int fd, struct pci_conf *p, uint16_t ptr, uint8_t ver) +{ + uint32_t cap1; + + printf("VC %d", ver); + if (ver != 1) + return; + cap1 = read_config(fd, &p->pc_sel, ptr + PCIR_VC_CAP1, 4); + printf(" max VC%d", cap1 & PCIM_VC_CAP1_EXT_COUNT); + if ((cap1 & PCIM_VC_CAP1_LOWPRI_EXT_COUNT) != 0) + printf(" lowpri VC0-VC%d", + (cap1 & PCIM_VC_CAP1_LOWPRI_EXT_COUNT) >> 4); +} + +static void +ecap_sernum(int fd, struct pci_conf *p, uint16_t ptr, uint8_t ver) +{ + uint32_t high, low; + + printf("Serial %d", ver); + if (ver != 1) + return; + low = read_config(fd, &p->pc_sel, ptr + PCIR_SERIAL_LOW, 4); + high = read_config(fd, &p->pc_sel, ptr + PCIR_SERIAL_HIGH, 4); + printf(" %08x%08x", high, low); +} + +static void +list_ecaps(int fd, struct pci_conf *p) +{ + uint32_t ecap; + uint16_t ptr; + + ptr = PCIR_EXTCAP; + ecap = read_config(fd, &p->pc_sel, ptr, 4); + if (ecap == 0xffffffff || ecap == 0) + return; + for (;;) { + printf("ecap %04x[%03x] = ", PCI_EXTCAP_ID(ecap), ptr); + switch (PCI_EXTCAP_ID(ecap)) { + case PCIZ_AER: + ecap_aer(fd, p, ptr, PCI_EXTCAP_VER(ecap)); + break; + case PCIZ_VC: + ecap_vc(fd, p, ptr, PCI_EXTCAP_VER(ecap)); + break; + case PCIZ_SERNUM: + ecap_sernum(fd, p, ptr, PCI_EXTCAP_VER(ecap)); + break; + default: + printf("unknown %d", PCI_EXTCAP_VER(ecap)); + break; + } + printf("\n"); + ptr = PCI_EXTCAP_NEXTPTR(ecap); + if (ptr == 0) + break; + ecap = read_config(fd, &p->pc_sel, ptr, 4); + } } From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 19:42:15 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 14C97106566B; Mon, 20 Sep 2010 19:42:15 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 043898FC1A; Mon, 20 Sep 2010 19:42:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KJgEIG065224; Mon, 20 Sep 2010 19:42:14 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KJgECl065222; Mon, 20 Sep 2010 19:42:14 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201009201942.o8KJgECl065222@svn.freebsd.org> From: Matthew D Fleming Date: Mon, 20 Sep 2010 19:42:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212926 - head/sys/cam/scsi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:42:15 -0000 Author: mdf Date: Mon Sep 20 19:42:14 2010 New Revision: 212926 URL: http://svn.freebsd.org/changeset/base/212926 Log: Use destroy_dev_sched(9) instead of destroy_dev(9) in passcleanup() as it is indirectly a d_close method. Prompted by: kib Reviewed by: mav MFC after: 2 weeks Modified: head/sys/cam/scsi/scsi_pass.c Modified: head/sys/cam/scsi/scsi_pass.c ============================================================================== --- head/sys/cam/scsi/scsi_pass.c Mon Sep 20 19:36:53 2010 (r212925) +++ head/sys/cam/scsi/scsi_pass.c Mon Sep 20 19:42:14 2010 (r212926) @@ -169,7 +169,11 @@ passcleanup(struct cam_periph *periph) xpt_print(periph->path, "removing device entry\n"); devstat_remove_entry(softc->device_stats); cam_periph_unlock(periph); - destroy_dev(softc->dev); + /* + * passcleanup() is indirectly a d_close method via passclose, + * so using destroy_dev(9) directly can result in deadlock. + */ + destroy_dev_sched(softc->dev); cam_periph_lock(periph); free(softc, M_DEVBUF); } From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 19:42:52 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9C1A0106566B; Mon, 20 Sep 2010 19:42:52 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8B6A48FC16; Mon, 20 Sep 2010 19:42:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KJgq7E065277; Mon, 20 Sep 2010 19:42:52 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KJgqL4065274; Mon, 20 Sep 2010 19:42:52 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201009201942.o8KJgqL4065274@svn.freebsd.org> From: Xin LI Date: Mon, 20 Sep 2010 19:42:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212927 - head/usr.bin/grep/nls X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:42:52 -0000 Author: delphij Date: Mon Sep 20 19:42:52 2010 New Revision: 212927 URL: http://svn.freebsd.org/changeset/base/212927 Log: Add Simplified Chinese messages for BSD grep. Added: head/usr.bin/grep/nls/zh_CN.UTF-8.msg (contents, props changed) Modified: head/usr.bin/grep/nls/Makefile.inc Modified: head/usr.bin/grep/nls/Makefile.inc ============================================================================== --- head/usr.bin/grep/nls/Makefile.inc Mon Sep 20 19:42:14 2010 (r212926) +++ head/usr.bin/grep/nls/Makefile.inc Mon Sep 20 19:42:52 2010 (r212927) @@ -10,6 +10,7 @@ NLS+= ja_JP.UTF-8 NLS+= pt_BR.ISO8859-1 NLS+= ru_RU.KOI8-R NLS+= uk_UA.UTF-8 +NLS+= zh_CN.UTF-8 NLSSRCDIR= ${.CURDIR}/nls .for lang in ${NLS} Added: head/usr.bin/grep/nls/zh_CN.UTF-8.msg ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/grep/nls/zh_CN.UTF-8.msg Mon Sep 20 19:42:52 2010 (r212927) @@ -0,0 +1,13 @@ +$ $FreeBSD$ +$ +$set 1 +$quote " +1 "(æ ‡ć‡†èŸ“ć…„)" +2 "èŻ»ć– bzip2 ćŽ‹çŒ©æ–‡ä»¶æ—¶ć‡ș错" +3 "选éĄč %s æ— æł•èŻ†ćˆ«" +4 "ç”šæł•ïŒš %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A èĄŒæ•°] [-B èĄŒæ•°] [-C[èĄŒæ•°]]\n" +5 "\t[-e æšĄćŒ] [-f 文件] [--binary-files=ć€Œ] [--color=䜕时]\n" +6 "\t[--context[=èĄŒæ•°]] [--directories=ćŠšäœœ] [--label] [--line-buffered]\n" +7 "\t[--null] [æšĄćŒ] [æ–‡ä»¶ć ...]\n" +8 "äșŒèż›ćˆ¶æ–‡ä»¶ %s ćŒ…ć«æšĄćŒ\n" +9 "%s (BSD grep) %s\n" From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 19:51:36 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F342310656A3; Mon, 20 Sep 2010 19:51:35 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from mx0.hoeg.nl (unknown [IPv6:2a01:4f8:101:5343::aa]) by mx1.freebsd.org (Postfix) with ESMTP id 878EE8FC14; Mon, 20 Sep 2010 19:51:35 +0000 (UTC) Received: by mx0.hoeg.nl (Postfix, from userid 1000) id DED172A28D3B; Mon, 20 Sep 2010 21:51:34 +0200 (CEST) Date: Mon, 20 Sep 2010 21:51:34 +0200 From: Ed Schouten To: Bruce Evans Message-ID: <20100920195134.GS56986@hoeg.nl> References: <201009191635.o8JGZgF3008282@svn.freebsd.org> <20100920224337.E63497@besplex.bde.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="qBOV/12gVmFoc0GF" Content-Disposition: inline In-Reply-To: <20100920224337.E63497@besplex.bde.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 Subject: Re: svn commit: r212867 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:51:36 -0000 --qBOV/12gVmFoc0GF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Bruce Evans wrote: > Er, my review explained how wrong this is. Please back it out. So basically you want to have it in its current form, with the only difference that CLOCAL is not enforced for callout devices, but still want callout devices to skip waiting for DCD? If so, I can change that if you like. About the default flags for serial devices. I really have no idea how to sanely address the issue you're raising. Isn't it a good thing that right now we initialize all termios structures similarly? It makes the system far more predictive than pushing that logic into the driver. Also, I don't think "breaking historical behaviour" should always be considered a bug, which is often something you seem to imply. Look, I am more than willing to get things improved in the TTY layer, but please, just create a patch. In the same (probably even less) time you've written your email, you could have simply crafted a patch and sent it to me. That way it is practically impossible for us to miscommunicate and it saves me a lot of time. --=20 Ed Schouten WWW: http://80386.nl/ --qBOV/12gVmFoc0GF Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (FreeBSD) iEYEARECAAYFAkyXu0YACgkQ52SDGA2eCwVGCgCdHlt/ZDJPoszLQu8+R9aEk6Ph Fn0An3HR7ZE7FIE+GGzRSFJe/6LPUHKG =MdUK -----END PGP SIGNATURE----- --qBOV/12gVmFoc0GF-- From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 19:58:51 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4C3BD106566B; Mon, 20 Sep 2010 19:58:51 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 39ACF8FC17; Mon, 20 Sep 2010 19:58:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KJwpqZ065799; Mon, 20 Sep 2010 19:58:51 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KJwpC8065793; Mon, 20 Sep 2010 19:58:51 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201009201958.o8KJwpC8065793@svn.freebsd.org> From: John Baldwin Date: Mon, 20 Sep 2010 19:58:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212929 - in stable/8/sys: fs/nfsclient nfsclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:58:51 -0000 Author: jhb Date: Mon Sep 20 19:58:50 2010 New Revision: 212929 URL: http://svn.freebsd.org/changeset/base/212929 Log: MFC 212293: Store the full timestamp when caching timestamps of files and directories for purposes of validating name cache entries. This closes races where two updates to a file or directory within the same second could result in stale entries in the name cache. To preserve the ABI of 'struct nfsnode', the existing timestamp fields are left with 'n_unusedX' placeholders along with the unused 'n_expiry' field. The larger n_ctime and n_dmtime fields are added to the end of the structure. Modified: stable/8/sys/fs/nfsclient/nfs_clrpcops.c stable/8/sys/fs/nfsclient/nfs_clvnops.c stable/8/sys/fs/nfsclient/nfsnode.h stable/8/sys/nfsclient/nfs_vnops.c stable/8/sys/nfsclient/nfsnode.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clrpcops.c Mon Sep 20 19:47:58 2010 (r212928) +++ stable/8/sys/fs/nfsclient/nfs_clrpcops.c Mon Sep 20 19:58:50 2010 (r212929) @@ -3300,8 +3300,7 @@ nfsrpc_readdirplus(vnode_t vp, struct ui ndp->ni_vp = newvp; NFSCNHASH(cnp, HASHINIT); if (cnp->cn_namelen <= NCHNAMLEN) { - np->n_ctime = - np->n_vattr.na_ctime.tv_sec; + np->n_ctime = np->n_vattr.na_ctime; cache_enter(ndp->ni_dvp,ndp->ni_vp,cnp); } if (unlocknewvp) Modified: stable/8/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clvnops.c Mon Sep 20 19:47:58 2010 (r212928) +++ stable/8/sys/fs/nfsclient/nfs_clvnops.c Mon Sep 20 19:58:50 2010 (r212929) @@ -999,7 +999,7 @@ nfs_lookup(struct vop_lookup_args *ap) struct nfsfh *nfhp; struct nfsvattr dnfsva, nfsva; struct vattr vattr; - time_t dmtime; + struct timespec dmtime; *vpp = NULLVP; if ((flags & ISLASTCN) && (mp->mnt_flag & MNT_RDONLY) && @@ -1049,7 +1049,7 @@ nfs_lookup(struct vop_lookup_args *ap) } if (nfscl_nodeleg(newvp, 0) == 0 || (VOP_GETATTR(newvp, &vattr, cnp->cn_cred) == 0 && - vattr.va_ctime.tv_sec == newnp->n_ctime)) { + timespeccmp(&vattr.va_ctime, &newnp->n_ctime, ==))) { NFSINCRGLOBAL(newnfsstats.lookupcache_hits); if (cnp->cn_nameiop != LOOKUP && (flags & ISLASTCN)) @@ -1076,13 +1076,13 @@ nfs_lookup(struct vop_lookup_args *ap) if ((u_int)(ticks - np->n_dmtime_ticks) < (nmp->nm_negnametimeo * hz) && VOP_GETATTR(dvp, &vattr, cnp->cn_cred) == 0 && - vattr.va_mtime.tv_sec == np->n_dmtime) { + timespeccmp(&vattr.va_mtime, &np->n_dmtime, ==)) { NFSINCRGLOBAL(newnfsstats.lookupcache_hits); return (ENOENT); } cache_purge_negative(dvp); mtx_lock(&np->n_mtx); - np->n_dmtime = 0; + timespecclear(&np->n_dmtime); mtx_unlock(&np->n_mtx); } @@ -1097,7 +1097,7 @@ nfs_lookup(struct vop_lookup_args *ap) * the lookup RPC has been performed on the server but before * n_dmtime is set at the end of this function. */ - dmtime = np->n_vattr.na_mtime.tv_sec; + dmtime = np->n_vattr.na_mtime; error = 0; newvp = NULLVP; NFSINCRGLOBAL(newnfsstats.lookupcache_misses); @@ -1150,8 +1150,8 @@ nfs_lookup(struct vop_lookup_args *ap) * lookup. */ mtx_lock(&np->n_mtx); - if (np->n_dmtime <= dmtime) { - if (np->n_dmtime == 0) { + if (timespeccmp(&np->n_dmtime, &dmtime, <=)) { + if (!timespecisset(&np->n_dmtime)) { np->n_dmtime = dmtime; np->n_dmtime_ticks = ticks; } @@ -1252,7 +1252,7 @@ nfs_lookup(struct vop_lookup_args *ap) cnp->cn_flags |= SAVENAME; if ((cnp->cn_flags & MAKEENTRY) && (cnp->cn_nameiop != DELETE || !(flags & ISLASTCN))) { - np->n_ctime = np->n_vattr.na_vattr.va_ctime.tv_sec; + np->n_ctime = np->n_vattr.na_vattr.va_ctime; cache_enter(dvp, newvp, cnp); } *vpp = newvp; Modified: stable/8/sys/fs/nfsclient/nfsnode.h ============================================================================== --- stable/8/sys/fs/nfsclient/nfsnode.h Mon Sep 20 19:47:58 2010 (r212928) +++ stable/8/sys/fs/nfsclient/nfsnode.h Mon Sep 20 19:58:50 2010 (r212929) @@ -102,10 +102,10 @@ struct nfsnode { time_t n_attrstamp; /* Attr. cache timestamp */ struct nfs_accesscache n_accesscache[NFS_ACCESSCACHESIZE]; struct timespec n_mtime; /* Prev modify time. */ - time_t n_ctime; /* Prev create time. */ - time_t n_dmtime; /* Prev dir modify time. */ + time_t n_unused0; + time_t n_unused1; int n_dmtime_ticks; /* Tick of -ve cache entry */ - time_t n_expiry; /* Lease expiry time */ + time_t n_unused2; struct nfsfh *n_fhp; /* NFS File Handle */ struct vnode *n_vnode; /* associated vnode */ struct vnode *n_dvp; /* parent vnode */ @@ -131,6 +131,8 @@ struct nfsnode { struct nfs_attrcache_timestamp n_unused; u_int64_t n_change; /* old Change attribute */ struct nfsv4node *n_v4; /* extra V4 stuff */ + struct timespec n_ctime; /* Prev create time. */ + struct timespec n_dmtime; /* Prev dir modify time. */ }; #define n_atim n_un1.nf_atim Modified: stable/8/sys/nfsclient/nfs_vnops.c ============================================================================== --- stable/8/sys/nfsclient/nfs_vnops.c Mon Sep 20 19:47:58 2010 (r212928) +++ stable/8/sys/nfsclient/nfs_vnops.c Mon Sep 20 19:58:50 2010 (r212929) @@ -916,7 +916,7 @@ nfs_lookup(struct vop_lookup_args *ap) struct vnode **vpp = ap->a_vpp; struct mount *mp = dvp->v_mount; struct vattr vattr; - time_t dmtime; + struct timespec dmtime; int flags = cnp->cn_flags; struct vnode *newvp; struct nfsmount *nmp; @@ -970,7 +970,7 @@ nfs_lookup(struct vop_lookup_args *ap) mtx_unlock(&newnp->n_mtx); } if (VOP_GETATTR(newvp, &vattr, cnp->cn_cred) == 0 && - vattr.va_ctime.tv_sec == newnp->n_ctime) { + timespeccmp(&vattr.va_ctime, &newnp->n_ctime, ==)) { nfsstats.lookupcache_hits++; if (cnp->cn_nameiop != LOOKUP && (flags & ISLASTCN)) @@ -997,13 +997,13 @@ nfs_lookup(struct vop_lookup_args *ap) if ((u_int)(ticks - np->n_dmtime_ticks) < (nmp->nm_negnametimeo * hz) && VOP_GETATTR(dvp, &vattr, cnp->cn_cred) == 0 && - vattr.va_mtime.tv_sec == np->n_dmtime) { + timespeccmp(&vattr.va_mtime, &np->n_dmtime, ==)) { nfsstats.lookupcache_hits++; return (ENOENT); } cache_purge_negative(dvp); mtx_lock(&np->n_mtx); - np->n_dmtime = 0; + timespecclear(&np->n_dmtime); mtx_unlock(&np->n_mtx); } @@ -1018,7 +1018,7 @@ nfs_lookup(struct vop_lookup_args *ap) * the lookup RPC has been performed on the server but before * n_dmtime is set at the end of this function. */ - dmtime = np->n_vattr.va_mtime.tv_sec; + dmtime = np->n_vattr.va_mtime; error = 0; newvp = NULLVP; nfsstats.lookupcache_misses++; @@ -1137,7 +1137,7 @@ nfs_lookup(struct vop_lookup_args *ap) cnp->cn_flags |= SAVENAME; if ((cnp->cn_flags & MAKEENTRY) && (cnp->cn_nameiop != DELETE || !(flags & ISLASTCN))) { - np->n_ctime = np->n_vattr.va_ctime.tv_sec; + np->n_ctime = np->n_vattr.va_ctime; cache_enter(dvp, newvp, cnp); } *vpp = newvp; @@ -1183,8 +1183,8 @@ nfsmout: * lookup. */ mtx_lock(&np->n_mtx); - if (np->n_dmtime <= dmtime) { - if (np->n_dmtime == 0) { + if (timespeccmp(&np->n_dmtime, &dmtime, <=)) { + if (!timespecisset(&np->n_dmtime)) { np->n_dmtime = dmtime; np->n_dmtime_ticks = ticks; } @@ -2657,8 +2657,11 @@ nfs_readdirplusrpc(struct vnode *vp, str dp->d_type = IFTODT(VTTOIF(np->n_vattr.va_type)); ndp->ni_vp = newvp; - /* Update n_ctime, so subsequent lookup doesn't purge entry */ - np->n_ctime = np->n_vattr.va_ctime.tv_sec; + /* + * Update n_ctime so subsequent lookup + * doesn't purge entry. + */ + np->n_ctime = np->n_vattr.va_ctime; cache_enter(ndp->ni_dvp, ndp->ni_vp, cnp); } } else { Modified: stable/8/sys/nfsclient/nfsnode.h ============================================================================== --- stable/8/sys/nfsclient/nfsnode.h Mon Sep 20 19:47:58 2010 (r212928) +++ stable/8/sys/nfsclient/nfsnode.h Mon Sep 20 19:58:50 2010 (r212929) @@ -108,10 +108,10 @@ struct nfsnode { time_t n_attrstamp; /* Attr. cache timestamp */ struct nfs_accesscache n_accesscache[NFS_ACCESSCACHESIZE]; struct timespec n_mtime; /* Prev modify time. */ - time_t n_ctime; /* Prev create time. */ - time_t n_dmtime; /* Prev dir modify time. */ + time_t n_unused0; + time_t n_unused1; int n_dmtime_ticks; /* Tick of -ve cache entry */ - time_t n_expiry; /* Lease expiry time */ + time_t n_unused2; nfsfh_t *n_fhp; /* NFS File Handle */ struct vnode *n_vnode; /* associated vnode */ struct vnode *n_dvp; /* parent vnode */ @@ -137,6 +137,8 @@ struct nfsnode { int n_directio_opens; int n_directio_asyncwr; struct nfs_attrcache_timestamp n_unused; + struct timespec n_ctime; /* Prev create time. */ + struct timespec n_dmtime; /* Prev dir modify time. */ }; #define n_atim n_un1.nf_atim From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 19:59:09 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A77B1065745; Mon, 20 Sep 2010 19:59:09 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EC9F38FC1C; Mon, 20 Sep 2010 19:59:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KJx8rQ065845; Mon, 20 Sep 2010 19:59:08 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KJx8aI065841; Mon, 20 Sep 2010 19:59:08 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201009201959.o8KJx8aI065841@svn.freebsd.org> From: John Baldwin Date: Mon, 20 Sep 2010 19:59:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212930 - in stable/7/sys: nfs4client nfsclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:59:09 -0000 Author: jhb Date: Mon Sep 20 19:59:08 2010 New Revision: 212930 URL: http://svn.freebsd.org/changeset/base/212930 Log: MFC 212293: Store the full timestamp when caching timestamps of files and directories for purposes of validating name cache entries. This closes races where two updates to a file or directory within the same second could result in stale entries in the name cache. To preserve the ABI of 'struct nfsnode', the existing timestamp fields are left with 'n_unusedX' placeholders along with the unused 'n_expiry' field. The larger n_ctime and n_dmtime fields are added to the end of the structure. Modified: stable/7/sys/nfs4client/nfs4_vnops.c stable/7/sys/nfsclient/nfs_vnops.c stable/7/sys/nfsclient/nfsnode.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/nfs4client/nfs4_vnops.c ============================================================================== --- stable/7/sys/nfs4client/nfs4_vnops.c Mon Sep 20 19:58:50 2010 (r212929) +++ stable/7/sys/nfs4client/nfs4_vnops.c Mon Sep 20 19:59:08 2010 (r212930) @@ -965,8 +965,8 @@ nfs4_lookup(struct vop_lookup_args *ap) struct vattr vattr; newvp = *vpp; - if (!VOP_GETATTR(newvp, &vattr, cnp->cn_cred, td) - && vattr.va_ctime.tv_sec == VTONFS(newvp)->n_ctime) { + if (VOP_GETATTR(newvp, &vattr, cnp->cn_cred, td) == 0 && + timespeccmp(&vattr.va_ctime, &VTONFS(newvp)->n_ctime, ==)) { nfsstats.lookupcache_hits++; if (cnp->cn_nameiop != LOOKUP && (flags & ISLASTCN)) @@ -1081,7 +1081,7 @@ nfs4_lookup(struct vop_lookup_args *ap) cnp->cn_flags |= SAVENAME; if ((cnp->cn_flags & MAKEENTRY) && (cnp->cn_nameiop != DELETE || !(flags & ISLASTCN))) { - np->n_ctime = np->n_vattr.va_ctime.tv_sec; + np->n_ctime = np->n_vattr.va_ctime; cache_enter(dvp, newvp, cnp); } *vpp = newvp; Modified: stable/7/sys/nfsclient/nfs_vnops.c ============================================================================== --- stable/7/sys/nfsclient/nfs_vnops.c Mon Sep 20 19:58:50 2010 (r212929) +++ stable/7/sys/nfsclient/nfs_vnops.c Mon Sep 20 19:59:08 2010 (r212930) @@ -861,7 +861,7 @@ nfs_lookup(struct vop_lookup_args *ap) struct vnode *dvp = ap->a_dvp; struct vnode **vpp = ap->a_vpp; struct vattr vattr; - time_t dmtime; + struct timespec dmtime; int flags = cnp->cn_flags; struct vnode *newvp; struct nfsmount *nmp; @@ -914,7 +914,7 @@ nfs_lookup(struct vop_lookup_args *ap) mtx_unlock(&newnp->n_mtx); } if (VOP_GETATTR(newvp, &vattr, cnp->cn_cred, td) == 0 && - vattr.va_ctime.tv_sec == newnp->n_ctime) { + timespeccmp(&vattr.va_ctime, &newnp->n_ctime, ==)) { nfsstats.lookupcache_hits++; if (cnp->cn_nameiop != LOOKUP && (flags & ISLASTCN)) @@ -938,13 +938,13 @@ nfs_lookup(struct vop_lookup_args *ap) */ if ((u_int)(ticks - np->n_dmtime_ticks) < (negnametimeo * hz) && VOP_GETATTR(dvp, &vattr, cnp->cn_cred, td) == 0 && - vattr.va_mtime.tv_sec == np->n_dmtime) { + timespeccmp(&vattr.va_mtime, &np->n_dmtime, ==)) { nfsstats.lookupcache_hits++; return (ENOENT); } cache_purge_negative(dvp); mtx_lock(&np->n_mtx); - np->n_dmtime = 0; + timespecclear(&np->n_dmtime); mtx_unlock(&np->n_mtx); } @@ -959,7 +959,7 @@ nfs_lookup(struct vop_lookup_args *ap) * the lookup RPC has been performed on the server but before * n_dmtime is set at the end of this function. */ - dmtime = np->n_vattr.va_mtime.tv_sec; + dmtime = np->n_vattr.va_mtime; error = 0; newvp = NULLVP; nfsstats.lookupcache_misses++; @@ -1046,7 +1046,7 @@ nfs_lookup(struct vop_lookup_args *ap) cnp->cn_flags |= SAVENAME; if ((cnp->cn_flags & MAKEENTRY) && (cnp->cn_nameiop != DELETE || !(flags & ISLASTCN))) { - np->n_ctime = np->n_vattr.va_ctime.tv_sec; + np->n_ctime = np->n_vattr.va_ctime; cache_enter(dvp, newvp, cnp); } *vpp = newvp; @@ -1092,8 +1092,8 @@ nfsmout: * lookup. */ mtx_lock(&np->n_mtx); - if (np->n_dmtime <= dmtime) { - if (np->n_dmtime == 0) { + if (timespeccmp(&np->n_dmtime, &dmtime, <=)) { + if (!timespecisset(&np->n_dmtime)) { np->n_dmtime = dmtime; np->n_dmtime_ticks = ticks; } @@ -2550,8 +2550,11 @@ nfs_readdirplusrpc(struct vnode *vp, str dp->d_type = IFTODT(VTTOIF(np->n_vattr.va_type)); ndp->ni_vp = newvp; - /* Update n_ctime, so subsequent lookup doesn't purge entry */ - np->n_ctime = np->n_vattr.va_ctime.tv_sec; + /* + * Update n_ctime so subsequent lookup + * doesn't purge entry. + */ + np->n_ctime = np->n_vattr.va_ctime; cache_enter(ndp->ni_dvp, ndp->ni_vp, cnp); } } else { Modified: stable/7/sys/nfsclient/nfsnode.h ============================================================================== --- stable/7/sys/nfsclient/nfsnode.h Mon Sep 20 19:58:50 2010 (r212929) +++ stable/7/sys/nfsclient/nfsnode.h Mon Sep 20 19:59:08 2010 (r212930) @@ -104,10 +104,10 @@ struct nfsnode { uid_t n_modeuid; /* credentials having mode */ time_t n_modestamp; /* mode cache timestamp */ struct timespec n_mtime; /* Prev modify time. */ - time_t n_ctime; /* Prev create time. */ - time_t n_dmtime; /* Prev dir modify time. */ + time_t n_unused0; + time_t n_unused1; int n_dmtime_ticks; /* Tick of -ve cache entry */ - time_t n_expiry; /* Lease expiry time */ + time_t n_unused2; nfsfh_t *n_fhp; /* NFS File Handle */ struct vnode *n_vnode; /* associated vnode */ struct vnode *n_dvp; /* parent vnode */ @@ -135,6 +135,8 @@ struct nfsnode { int n_directio_opens; int n_directio_asyncwr; struct nfs_attrcache_timestamp n_unused; + struct timespec n_ctime; /* Prev create time. */ + struct timespec n_dmtime; /* Prev dir modify time. */ }; #define n_atim n_un1.nf_atim From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 20:41:59 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A0F231065674; Mon, 20 Sep 2010 20:41:59 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 907318FC08; Mon, 20 Sep 2010 20:41:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KKfxvd066974; Mon, 20 Sep 2010 20:41:59 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KKfxUQ066972; Mon, 20 Sep 2010 20:41:59 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201009202041.o8KKfxUQ066972@svn.freebsd.org> From: Matthew D Fleming Date: Mon, 20 Sep 2010 20:41:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212931 - head/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 20:41:59 -0000 Author: mdf Date: Mon Sep 20 20:41:59 2010 New Revision: 212931 URL: http://svn.freebsd.org/changeset/base/212931 Log: Replace an XXX comment with the appropriate code. Submitted by: alc Modified: head/sys/vm/vm_kern.c Modified: head/sys/vm/vm_kern.c ============================================================================== --- head/sys/vm/vm_kern.c Mon Sep 20 19:59:08 2010 (r212930) +++ head/sys/vm/vm_kern.c Mon Sep 20 20:41:59 2010 (r212931) @@ -354,11 +354,7 @@ kmem_back(vm_map_t map, vm_offset_t addr vm_page_t m; int pflags; - /* - * XXX the map must be locked for write on entry, but there's - * no easy way to assert that. - */ - + KASSERT(vm_map_locked(map), ("kmem_back: map %p is not locked", map)); offset = addr - VM_MIN_KERNEL_ADDRESS; vm_object_reference(kmem_object); vm_map_insert(map, kmem_object, offset, addr, addr + size, From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 21:22:15 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A5C60106564A; Mon, 20 Sep 2010 21:22:15 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7AB878FC14; Mon, 20 Sep 2010 21:22:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KLMFgU067996; Mon, 20 Sep 2010 21:22:15 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KLMFFA067994; Mon, 20 Sep 2010 21:22:15 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201009202122.o8KLMFFA067994@svn.freebsd.org> From: Andriy Gapon Date: Mon, 20 Sep 2010 21:22:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212932 - head/tools/tools/umastat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 21:22:16 -0000 Author: avg Date: Mon Sep 20 21:22:15 2010 New Revision: 212932 URL: http://svn.freebsd.org/changeset/base/212932 Log: tools/umastat: fix build on amd64 And perhaps other 64-bit platforms. Submitted by: Fabian Keil MFC after: 1 week Modified: head/tools/tools/umastat/umastat.c Modified: head/tools/tools/umastat/umastat.c ============================================================================== --- head/tools/tools/umastat/umastat.c Mon Sep 20 20:41:59 2010 (r212931) +++ head/tools/tools/umastat/umastat.c Mon Sep 20 21:22:15 2010 (r212932) @@ -230,7 +230,7 @@ uma_print_bucketlist(kvm_t *kvm, struct } printf("\n"); - printf("%s}; // total cnt %llu, total entries %llu\n", spaces, + printf("%s}; // total cnt %ju, total entries %ju\n", spaces, total_cnt, total_entries); } @@ -242,8 +242,8 @@ uma_print_cache(kvm_t *kvm, struct uma_c int ret; printf("%s%s[%d] = {\n", spaces, name, cpu); - printf("%s uc_frees = %llu;\n", spaces, cache->uc_frees); - printf("%s uc_allocs = %llu;\n", spaces, cache->uc_allocs); + printf("%s uc_frees = %ju;\n", spaces, cache->uc_frees); + printf("%s uc_allocs = %ju;\n", spaces, cache->uc_allocs); if (cache->uc_freebucket != NULL) { ret = kread(kvm, cache->uc_freebucket, &ub, sizeof(ub), 0); @@ -412,20 +412,20 @@ main(int argc, char *argv[]) } printf(" Zone {\n"); printf(" uz_name = \"%s\";\n", name); - printf(" uz_allocs = %llu;\n", + printf(" uz_allocs = %ju;\n", uzp_userspace->uz_allocs); - printf(" uz_frees = %llu;\n", + printf(" uz_frees = %ju;\n", uzp_userspace->uz_frees); - printf(" uz_fails = %llu;\n", + printf(" uz_fails = %ju;\n", uzp_userspace->uz_fails); printf(" uz_fills = %u;\n", uzp_userspace->uz_fills); printf(" uz_count = %u;\n", uzp_userspace->uz_count); - uma_print_bucketlist(kvm, (struct bucketlist *) + uma_print_bucketlist(kvm, (void *) &uzp_userspace->uz_full_bucket, "uz_full_bucket", " "); - uma_print_bucketlist(kvm, (struct bucketlist *) + uma_print_bucketlist(kvm, (void *) &uzp_userspace->uz_free_bucket, "uz_free_bucket", " "); From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 21:38:53 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 58C0E1065697; Mon, 20 Sep 2010 21:38:53 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 482858FC12; Mon, 20 Sep 2010 21:38:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KLcruY068380; Mon, 20 Sep 2010 21:38:53 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KLcrZm068377; Mon, 20 Sep 2010 21:38:53 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <201009202138.o8KLcrZm068377@svn.freebsd.org> From: Andrew Thompson Date: Mon, 20 Sep 2010 21:38:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org X-SVN-Group: svnadmin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212933 - svnadmin/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 21:38:53 -0000 Author: thompsa Date: Mon Sep 20 21:38:52 2010 New Revision: 212933 URL: http://svn.freebsd.org/changeset/base/212933 Log: Please welcome Hans Petter Selasky (hselasky@) to the ranks of the src committers. He will be working on all things USB. Approved by: core Modified: svnadmin/conf/access svnadmin/conf/mentors Modified: svnadmin/conf/access ============================================================================== --- svnadmin/conf/access Mon Sep 20 21:22:15 2010 (r212932) +++ svnadmin/conf/access Mon Sep 20 21:38:52 2010 (r212933) @@ -98,6 +98,7 @@ harti hm hmp hrs +hselasky iedowse imp ivoras Modified: svnadmin/conf/mentors ============================================================================== --- svnadmin/conf/mentors Mon Sep 20 21:22:15 2010 (r212932) +++ svnadmin/conf/mentors Mon Sep 20 21:38:52 2010 (r212933) @@ -19,6 +19,7 @@ dchagin kib dim rpaulo Co-mentor: ed eri mlaier Co-mentor: thompsa gabor delphij +hselasky thompsa jinmei gnn mm delphij nork imp From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 21:58:48 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 61F05106566B; Mon, 20 Sep 2010 21:58:48 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail09.syd.optusnet.com.au (mail09.syd.optusnet.com.au [211.29.132.190]) by mx1.freebsd.org (Postfix) with ESMTP id F01218FC08; Mon, 20 Sep 2010 21:58:47 +0000 (UTC) Received: from besplex.bde.org (c122-107-116-249.carlnfd1.nsw.optusnet.com.au [122.107.116.249]) by mail09.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o8KLwcWF031872 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 21 Sep 2010 07:58:40 +1000 Date: Tue, 21 Sep 2010 07:58:38 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Ed Schouten In-Reply-To: <20100920195134.GS56986@hoeg.nl> Message-ID: <20100921064714.N31073@besplex.bde.org> References: <201009191635.o8JGZgF3008282@svn.freebsd.org> <20100920224337.E63497@besplex.bde.org> <20100920195134.GS56986@hoeg.nl> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Bruce Evans Subject: Re: svn commit: r212867 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 21:58:48 -0000 On Mon, 20 Sep 2010, Ed Schouten wrote: > * Bruce Evans wrote: >> Er, my review explained how wrong this is. Please back it out. > > So basically you want to have it in its current form, with the only > difference that CLOCAL is not enforced for callout devices, but still > want callout devices to skip waiting for DCD? If so, I can change that > if you like. It would also be good to fix the original problem with missing locking for consoles. % Index: tty.c % =================================================================== % RCS file: /home/ncvs/src/sys/kern/tty.c,v % retrieving revision 1.338 % retrieving revision 1.340 % diff -u -2 -r1.338 -r1.340 % --- tty.c 6 Aug 2010 09:42:15 -0000 1.338 % +++ tty.c 19 Sep 2010 16:35:42 -0000 1.340 % ... % @@ -264,10 +264,12 @@ % if (!tty_opened(tp)) { % /* Set proper termios flags. */ % - if (TTY_CALLOUT(tp, dev)) { % + if (TTY_CALLOUT(tp, dev)) % tp->t_termios = tp->t_termios_init_out; % - } else { % + else % tp->t_termios = tp->t_termios_init_in; % - } Good to fix the style bug. % ttydevsw_param(tp, &tp->t_termios); % + /* Prevent modem control on callout devices and /dev/console. */ % + if (TTY_CALLOUT(tp, dev) || dev == dev_console) % + tp->t_termios.c_cflag |= CLOCAL; This enforces CLOCAL for both the callout devices and consoles. This shouldn't be done here for either. Set it in the lock and initial state device for consoles and don't change anything for callout devices. % % ttydevsw_modem(tp, SER_DTR|SER_RTS, 0); % @@ -282,5 +284,5 @@ % % /* Wait for Carrier Detect. */ % - if (!TTY_CALLOUT(tp, dev) && (oflags & O_NONBLOCK) == 0 && % + if ((oflags & O_NONBLOCK) == 0 && % (tp->t_termios.c_cflag & CLOCAL) == 0) { % while ((ttydevsw_modem(tp, 0, 0) & SER_DCD) == 0) { This simplification depends on the previous erroneous enforcement. > About the default flags for serial devices. I really have no idea how to > sanely address the issue you're raising. Isn't it a good thing that > right now we initialize all termios structures similarly? It makes the > system far more predictive than pushing that logic into the driver. It's good for the initialization to be centralized, but console initialization must be special. It already is special, and requires special logic in the driver, since only the driver knows the speed and line state that are already being used and must be preserved. Presumably it overwrites the settings of tty_init_termios() soon after that returns. RELENG_7 had this more or less correctly centralized, with the speed and an "echo" (really consoleness) flag passed to ttyinitmode(), and another function ttyconsolemode() for the additional special setting of consoles (this should have handled the speed and "echo" too). The special settings are almost exactly the defaulting and locking of CLOCAL: % void % ttyconsolemode(struct tty *tp, int speed) % { % % if (speed == 0) % speed = TTYDEF_SPEED; % ttyinitmode(tp, 1, speed); % tp->t_init_in.c_cflag |= CLOCAL; Default CLOCAL for t_init_in (whole t_init_in will be copied to t_init_out). % tp->t_lock_out.c_cflag = tp->t_lock_in.c_cflag = CLOCAL; Lock CLOCAL for both (won't copy whole lock termios). % tp->t_lock_out.c_ispeed = tp->t_lock_out.c_ospeed = % tp->t_lock_in.c_ispeed = tp->t_lock_in.c_ospeed = speed; Lock the speeds too. % tp->t_init_out = tp->t_init_in; % tp->t_termios = tp->t_init_in; Actually silly to copy the whole t_init_in twice after just changing CLOCAL in it (we have just called ttyinitmode() which copied everything else). % ttsetwater(tp); Must change the watermarks whenever the speed changed, but ttyinitmode() should have called this since it changed the speed. Missing: setting and locking of other termios state (especially in cflag) critical to the continued operation of the console (also the debugger on a possibly-non-console port). % } Having predicitiveness/orthogonality is perhaps the main reason why CLOCAL was not forced or even defaulted to for callout devices. > Also, I don't think "breaking historical behaviour" should always be > considered a bug, which is often something you seem to imply. It is when the historical behaviour was carefully designed. Bruce From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 22:05:00 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 352B4106566B; Mon, 20 Sep 2010 22:05:00 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2278F8FC15; Mon, 20 Sep 2010 22:05:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KM50rP069071; Mon, 20 Sep 2010 22:05:00 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KM4xOu069067; Mon, 20 Sep 2010 22:04:59 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <201009202204.o8KM4xOu069067@svn.freebsd.org> From: Brian Somers Date: Mon, 20 Sep 2010 22:04:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212934 - in head: sbin/geom/class/eli tools/regression/geom_eli X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 22:05:00 -0000 Author: brian Date: Mon Sep 20 22:04:59 2010 New Revision: 212934 URL: http://svn.freebsd.org/changeset/base/212934 Log: Add a geli resize subcommand to resize encrypted filesystems prior to growing the filesystem. Refuse to attach providers where the metadata provider size is wrong. This makes post-boot attaches behave consistently with pre-boot attaches. Also refuse to restore metadata to a provider of the wrong size without the new -f switch. The new -f switch forces the metadata restoration despite the provider size, and updates the provider size in the restored metadata to the correct value. Helped by: pjd Reviewed by: pjd Added: head/tools/regression/geom_eli/resize.t (contents, props changed) Modified: head/sbin/geom/class/eli/geli.8 head/sbin/geom/class/eli/geom_eli.c Modified: head/sbin/geom/class/eli/geli.8 ============================================================================== --- head/sbin/geom/class/eli/geli.8 Mon Sep 20 21:38:52 2010 (r212933) +++ head/sbin/geom/class/eli/geli.8 Mon Sep 20 22:04:59 2010 (r212934) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 29, 2008 +.Dd September 20, 2010 .Dt GELI 8 .Os .Sh NAME @@ -111,10 +111,15 @@ utility: .Ar file .Nm .Cm restore -.Op Fl v +.Op Fl fv .Ar file .Ar prov .Nm +.Cm resize +.Op Fl v +.Fl s Ar oldsize +.Ar prov +.Nm .Cm clear .Op Fl v .Ar prov ... @@ -464,6 +469,34 @@ If specified, all currently attached pro Backup metadata from the given provider to the given file. .It Cm restore Restore metadata from the given file to the given provider. +.Bl -tag -width ".Fl f" +.It Fl f +Metadata contains the size of the provider to ensure that the correct +partition or slice is attached. +If an attempt is made to restore metadata to a provider that has a different +size, +.Nm +will refuse to restore the data unless the +.Fl f +switch is used. +If the partition or slice has been grown, the +.Cm resize +subcommand should be used rather than attempting to relocate the metadata +through +.Cm backup +and +.Cm restore . +.El +.It Cm resize +Inform +.Nm +that the provider has been resized. +The old metadata block is relocated to the correct position at the end of the +provider and the provider size is updated. +.Bl -tag -width ".Fl s Ar oldsize" +.It Fl s Ar oldsize +The size of the provider before it was resized. +.El .It Cm clear Clear metadata from the given providers. .It Cm dump @@ -665,6 +698,17 @@ geli: Cannot read metadata from /dev/da0 # geli attach /dev/da0 Enter passphrase: .Ed +.Pp +If an encrypted filesystem is extended, it is necessary to relocate and +update the metadata: +.Bd -literal -offset indent +# gpart create -s GPT ada0 +# gpart add -s 1g -t freebsd-ufs -i 1 ada0 +# geli init -K keyfile -P ada0p1 +# gpart resize -s 2g -i 1 ada0 +# geli resize -s 1g ada0p1 +# geli attach -k keyfile -p ada0p1 +.Ed .Sh DATA AUTHENTICATION .Nm can verify data integrity when an authentication algorithm is specified. Modified: head/sbin/geom/class/eli/geom_eli.c ============================================================================== --- head/sbin/geom/class/eli/geom_eli.c Mon Sep 20 21:38:52 2010 (r212933) +++ head/sbin/geom/class/eli/geom_eli.c Mon Sep 20 22:04:59 2010 (r212934) @@ -66,6 +66,7 @@ static void eli_delkey(struct gctl_req * static void eli_kill(struct gctl_req *req); static void eli_backup(struct gctl_req *req); static void eli_restore(struct gctl_req *req); +static void eli_resize(struct gctl_req *req); static void eli_clear(struct gctl_req *req); static void eli_dump(struct gctl_req *req); @@ -86,7 +87,8 @@ static int eli_backup_create(struct gctl * delkey [-afv] [-n keyno] prov * kill [-av] [prov ...] * backup [-v] prov file - * restore [-v] file prov + * restore [-fv] file prov + * resize [-v] -s oldsize prov * clear [-v] prov ... * dump [-v] prov ... */ @@ -197,8 +199,19 @@ struct g_command class_commands[] = { { "backup", G_FLAG_VERBOSE, eli_main, G_NULL_OPTS, "[-v] prov file" }, - { "restore", G_FLAG_VERBOSE, eli_main, G_NULL_OPTS, - "[-v] file prov" + { "restore", G_FLAG_VERBOSE, eli_main, + { + { 'f', "force", NULL, G_TYPE_BOOL }, + G_OPT_SENTINEL + }, + "[-fv] file prov" + }, + { "resize", G_FLAG_VERBOSE, eli_main, + { + { 's', "oldsize", NULL, G_TYPE_NUMBER }, + G_OPT_SENTINEL + }, + "[-v] -s oldsize prov" }, { "clear", G_FLAG_VERBOSE, eli_main, G_NULL_OPTS, "[-v] prov ..." @@ -264,6 +277,8 @@ eli_main(struct gctl_req *req, unsigned eli_backup(req); else if (strcmp(name, "restore") == 0) eli_restore(req); + else if (strcmp(name, "resize") == 0) + eli_resize(req); else if (strcmp(name, "dump") == 0) eli_dump(req); else if (strcmp(name, "clear") == 0) @@ -683,6 +698,7 @@ eli_attach(struct gctl_req *req) struct g_eli_metadata md; unsigned char key[G_ELI_USERKEYLEN]; const char *prov; + off_t mediasize; int nargs; nargs = gctl_get_int(req, "nargs"); @@ -695,6 +711,12 @@ eli_attach(struct gctl_req *req) if (eli_metadata_read(req, prov, &md) == -1) return; + mediasize = g_get_mediasize(prov); + if (md.md_provsize != (uint64_t)mediasize) { + gctl_error(req, "Provider size mismatch."); + return; + } + if (eli_genkey(req, &md, key, 0) == NULL) { bzero(key, sizeof(key)); return; @@ -1212,6 +1234,17 @@ eli_restore(struct gctl_req *req) gctl_error(req, "MD5 hash mismatch: not a geli backup file?"); goto out; } + /* Check if the provider size has changed since we did the backup. */ + if (md.md_provsize != (uint64_t)mediasize) { + if (gctl_get_int(req, "force")) { + md.md_provsize = mediasize; + eli_metadata_encode(&md, sector); + } else { + gctl_error(req, "Provider size mismatch: " + "wrong backup file?"); + goto out; + } + } /* Write metadata from the provider. */ if (pwrite(provfd, sector, secsize, mediasize - secsize) != (ssize_t)secsize) { @@ -1230,6 +1263,111 @@ out: } static void +eli_resize(struct gctl_req *req) +{ + struct g_eli_metadata md; + const char *prov; + unsigned char *sector; + unsigned secsize; + off_t mediasize, oldsize; + int nargs, provfd; + + nargs = gctl_get_int(req, "nargs"); + if (nargs != 1) { + gctl_error(req, "Invalid number of arguments."); + return; + } + prov = gctl_get_ascii(req, "arg0"); + + provfd = -1; + sector = NULL; + secsize = 0; + + provfd = open(prov, O_RDWR); + if (provfd == -1 && errno == ENOENT && prov[0] != '/') { + char devprov[MAXPATHLEN]; + + snprintf(devprov, sizeof(devprov), "%s%s", _PATH_DEV, prov); + provfd = open(devprov, O_RDWR); + } + if (provfd == -1) { + gctl_error(req, "Cannot open %s: %s.", prov, strerror(errno)); + goto out; + } + + mediasize = g_get_mediasize(prov); + secsize = g_get_sectorsize(prov); + if (mediasize == 0 || secsize == 0) { + gctl_error(req, "Cannot get information about %s: %s.", prov, + strerror(errno)); + goto out; + } + + sector = malloc(secsize); + if (sector == NULL) { + gctl_error(req, "Cannot allocate memory."); + goto out; + } + + oldsize = gctl_get_intmax(req, "oldsize"); + if (oldsize < 0 || oldsize > mediasize) { + gctl_error(req, "Invalid oldsize: Out of range."); + goto out; + } + + /* Read metadata from the 'oldsize' offset. */ + if (pread(provfd, sector, secsize, oldsize - secsize) != + (ssize_t)secsize) { + gctl_error(req, "Cannot read old metadata: %s.", + strerror(errno)); + goto out; + } + + /* Check if this sector contains geli metadata. */ + if (eli_metadata_decode(sector, &md) != 0) { + gctl_error(req, "MD5 hash mismatch: no metadata for oldsize."); + goto out; + } + + /* + * If the old metadata doesn't have a correct provider size, refuse + * to resize. + */ + if (md.md_provsize != (uint64_t)oldsize) { + gctl_error(req, "Provider size mismatch at oldsize."); + goto out; + } + + /* + * Update the old metadata with the current provider size and write + * it back to the correct place on the provider. + */ + md.md_provsize = mediasize; + eli_metadata_encode(&md, sector); + if (pwrite(provfd, sector, secsize, mediasize - secsize) != + (ssize_t)secsize) { + gctl_error(req, "Cannot write metadata: %s.", strerror(errno)); + goto out; + } + + /* Now trash the old metadata. */ + arc4rand(sector, secsize); + if (pwrite(provfd, sector, secsize, oldsize - secsize) != + (ssize_t)secsize) { + gctl_error(req, "Failed to clobber old metadata: %s.", + strerror(errno)); + goto out; + } +out: + if (provfd > 0) + close(provfd); + if (sector != NULL) { + bzero(sector, secsize); + free(sector); + } +} + +static void eli_clear(struct gctl_req *req) { const char *name; Added: head/tools/regression/geom_eli/resize.t ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/geom_eli/resize.t Mon Sep 20 22:04:59 2010 (r212934) @@ -0,0 +1,149 @@ +#! /bin/sh +# +# $FreeBSD$ + +echo 1..27 + +BLK=512 +BLKS_PER_MB=2048 + +md=$(mdconfig -s40m) || exit 1 +unit=${md#md} +i=1 + +setsize() { + partszMB=$1 unitszMB=$2 + + { + echo a: $(($partszMB * $BLKS_PER_MB)) 0 4.2BSD 1024 8192 + echo c: $(($unitszMB * $BLKS_PER_MB)) 0 unused 0 0 + } | disklabel -R $md /dev/stdin +} + +# Initialise + +kldload geom_eli >/dev/null 2>&1 + +setsize 10 40 || echo -n "not " +echo ok $i - "Sized ${md}a to 10m" +i=$((i + 1)) + +echo secret >tmp.key +geli init -Bnone -PKtmp.key ${md}a || echo -n "not " +echo ok $i - "Initialised geli on ${md}a" +i=$((i + 1)) +geli attach -pk tmp.key ${md}a || echo -n "not " +echo ok $i - "Attached ${md}a as ${md}a.eli" +i=$((i + 1)) + +newfs -U ${md}a.eli >/dev/null || echo -n "not " +echo ok $i - "Initialised the filesystem on ${md}a.eli" +i=$((i + 1)) +out=$(fsck -tufs -y ${md}a.eli) +echo "$out" | fgrep -q MODIFIED && echo -n "not " +echo ok $i - "fsck says ${md}a.eli is clean," $(echo $(echo "$out" | wc -l)) \ + "lines of output" +i=$((i + 1)) + + +# Doing a backup, resize & restore must be forced (with -f) as geli +# verifies that the provider size in the metadata matches the consumer. + +geli backup ${md}a tmp.meta || echo -n "not " +echo ok $i - "Backed up ${md}a metadata" +i=$((i + 1)) + +geli detach ${md}a.eli || echo -n "not " +echo ok $i - "Detached ${md}a.eli" +i=$((i + 1)) + +setsize 20 40 || echo -n "not " +echo ok $i - "Sized ${md}a to 20m" +i=$((i + 1)) +geli attach -pktmp.key ${md}a && echo -n "not " +echo ok $i - "Attaching ${md}a fails after resizing the consumer" +i=$((i + 1)) + +geli restore tmp.meta ${md}a && echo -n "not " +echo ok $i - "Restoring metadata on ${md}a.eli fails without -f" +i=$((i + 1)) +geli restore -f tmp.meta ${md}a || echo -n "not " +echo ok $i - "Restoring metadata on ${md}a.eli can be forced" +i=$((i + 1)) + +geli attach -pktmp.key ${md}a || echo -n "not " +echo ok $i - "Attaching ${md}a is now possible" +i=$((i + 1)) + +growfs -y ${md}a.eli >/dev/null || echo -n "not " +echo ok $i - "Extended the filesystem on ${md}a.eli" +i=$((i + 1)) + +out=$(fsck -tufs -y ${md}a.eli) +echo "$out" | fgrep -q MODIFIED && echo -n "not " +echo ok $i - "fsck says ${md}a.eli is clean," $(echo $(echo "$out" | wc -l)) \ + "lines of output" +i=$((i + 1)) + + +# Now do the resize properly + +geli detach ${md}a.eli || echo -n "not " +echo ok $i - "Detached ${md}a.eli" +i=$((i + 1)) + +setsize 30 40 || echo -n "not " +echo ok $i - "Sized ${md}a to 30m" +i=$((i + 1)) + +geli resize -s20m ${md}a || echo -n "not " +echo ok $i - "Resizing works ok" +i=$((i + 1)) +geli resize -s20m ${md}a && echo -n "not " +echo ok $i - "Resizing doesn't work a 2nd time (no old metadata)" +i=$((i + 1)) + +geli attach -pktmp.key ${md}a || echo -n "not " +echo ok $i - "Attaching ${md}a works ok" +i=$((i + 1)) + +growfs -y ${md}a.eli >/dev/null || echo -n "not " +echo ok $i - "Extended the filesystem on ${md}a.eli" +i=$((i + 1)) + +out=$(fsck -tufs -y ${md}a.eli) +echo "$out" | fgrep -q MODIFIED && echo -n "not " +echo ok $i - "fsck says ${md}a.eli is clean," $(echo $(echo "$out" | wc -l)) \ + "lines of output" +i=$((i + 1)) + +geli detach ${md}a.eli + + +# Verify that the man page example works, changing ada0 to $md, +# 1g to 20m, 2g to 30m and keyfile to tmp.key, and adding -B none +# to geli init. + +gpart create -s GPT md0 || echo -n "not " +echo ok $i - "Installed an MBR on md0" +i=$((i + 1)) +gpart add -s 20m -t freebsd-ufs -i 1 $md || echo -n "not " +echo ok $i - "Added a 20m partition in slot 1" +i=$((i + 1)) +geli init -B none -K tmp.key -P ${md}p1 || echo -n "not " +echo ok $i - "Initialised geli on ${md}p1" +i=$((i + 1)) +gpart resize -s 30m -i 1 $md || echo -n "not " +echo ok $i - "Resized partition ${md}p1 to 30m" +i=$((i + 1)) +geli resize -s 20m ${md}p1 || echo -n "not " +echo ok $i - "Resized geli on ${md}p1 to 30m" +i=$((i + 1)) +geli attach -k tmp.key -p ${md}p1 || echo -n "not " +echo ok $i - "Attached ${md}p1.eli" +i=$((i + 1)) + +geli detach ${md}p1.eli +mdconfig -du$unit + +rm tmp.* From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 22:39:39 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2E9CC106564A; Mon, 20 Sep 2010 22:39:39 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-pw0-f54.google.com (mail-pw0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id E29018FC08; Mon, 20 Sep 2010 22:39:38 +0000 (UTC) Received: by pwi8 with SMTP id 8so1753428pwi.13 for ; Mon, 20 Sep 2010 15:39:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=LKaYMz+CeyANyVvoUU1hYetOd6Il4c6MfZy1n/dniYI=; b=SQZ3vihEApd1mR/FV75JAjGEDlC8mUc6EBeNWtkmZCnOSEEhojmbzi7VD1tWfayIjy QvLYNF3ACvbZ0qNdy6ymI70aNPmFyS79kykxbslyGjFqYJMz5hI0McErmt3EjWhJCwJB kqEKXOR3MYJdrGpNJGc93gNEKJ3xXNCiRLjbM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=dTK5Q4HLimnzjDyAgJ57ApIB7H9oPIQkhhOcyA154zDegPt0g4fkcOICsmAj8LIRaW s1eF8roI2ujlMpmcRWTMrHZKLPlvKnpq9YfNBlGyJvxlZa7L1lfktiw9VQfAJ6Tx/3/5 ZvMy2X/axoiI52E8b8piJh0SIXOHUsi8C40hw= MIME-Version: 1.0 Received: by 10.142.120.9 with SMTP id s9mr8321519wfc.89.1285022378394; Mon, 20 Sep 2010 15:39:38 -0700 (PDT) Received: by 10.142.66.9 with HTTP; Mon, 20 Sep 2010 15:39:38 -0700 (PDT) In-Reply-To: <201009202122.o8KLMFFA067994@svn.freebsd.org> References: <201009202122.o8KLMFFA067994@svn.freebsd.org> Date: Tue, 21 Sep 2010 02:39:38 +0400 Message-ID: From: pluknet To: Andriy Gapon Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212932 - head/tools/tools/umastat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 22:39:39 -0000 On 21 September 2010 01:22, Andriy Gapon wrote: > Author: avg > Date: Mon Sep 20 21:22:15 2010 > New Revision: 212932 > URL: http://svn.freebsd.org/changeset/base/212932 > > Log: > =A0tools/umastat: fix build on amd64 Hi. Now my PR 146119 being in GNATS queue for five month can be partially close= d. Thanks. --=20 wbr, pluknet From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 23:36:54 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B18D4106566B; Mon, 20 Sep 2010 23:36:54 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A0CA98FC1D; Mon, 20 Sep 2010 23:36:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KNasqI071510; Mon, 20 Sep 2010 23:36:54 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KNaskL071508; Mon, 20 Sep 2010 23:36:54 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201009202336.o8KNaskL071508@svn.freebsd.org> From: Warner Losh Date: Mon, 20 Sep 2010 23:36:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212938 - head/tools/tools/nanobsd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 23:36:54 -0000 Author: imp Date: Mon Sep 20 23:36:54 2010 New Revision: 212938 URL: http://svn.freebsd.org/changeset/base/212938 Log: Support new variable NANO_LABEL. When set to a non-null string, nanobsd will build a system that uses this label (via /dev/ufs/${NANO_LABEL}sX) in preference to NANO_DRIVE (well, it forces NANO_DRIVE to be ufs/${NANO_LABEL}). This allows images that will boot off usb stick or CF card easily well. There is no change if you don't set this variable. Modified: head/tools/tools/nanobsd/nanobsd.sh Modified: head/tools/tools/nanobsd/nanobsd.sh ============================================================================== --- head/tools/tools/nanobsd/nanobsd.sh Mon Sep 20 23:17:26 2010 (r212937) +++ head/tools/tools/nanobsd/nanobsd.sh Mon Sep 20 23:36:54 2010 (r212938) @@ -135,9 +135,16 @@ NANO_MD_BACKING="file" # Progress Print level PPLEVEL=3 +# Set NANO_LABEL to non-blank to form the basis for using /dev/ufs/label +# in preference to /dev/${NANO_DRIVE} +# Root partition will be ${NANO_LABEL}s{1,2} +# /cfg partition will be ${NANO_LABEL}s3 +# /data partition will be ${NANO_LABEL}s4 +NANO_LABEL="" + ####################################################################### # Architecture to build. Corresponds to TARGET_ARCH in a buildworld. -# Unfortunately, there's no way to set TARGET at this time, and it +# Unfortunately, there's no way to set TARGET at this time, and it # conflates the two, so architectures where TARGET != TARGET_ARCH do # not work. This defaults to the arch of the current machine. @@ -361,16 +368,26 @@ prune_usr() ( done ) +newfs_part ( ) ( + local dev mnt lbl + dev=$1 + mnt=$2 + lbl=$3 + echo newfs ${NANO_NEWFS} ${NANO_LABEL:+-L${NANO_LABEL}${lbl}} ${dev} + newfs ${NANO_NEWFS} ${NANO_LABEL:+-L${NANO_LABEL}${lbl}} ${dev} + mount ${dev} ${mnt} +) + populate_slice ( ) ( - local dev dir mnt + local dev dir mnt lbl dev=$1 dir=$2 mnt=$3 + lbl=$4 test -z $2 && dir=/var/empty - test -d $d || dir=/var/empty + test -d $dir || dir=/var/empty echo "Creating ${dev} with ${dir} (mounting on ${mnt})" - newfs ${NANO_NEWFS} ${dev} - mount ${dev} ${mnt} + newfs_part $dev $mnt $lbl cd ${dir} find . -print | grep -Ev '/(CVS|\.svn)' | cpio -dumpv ${mnt} df -i ${mnt} @@ -378,11 +395,11 @@ populate_slice ( ) ( ) populate_cfg_slice ( ) ( - populate_slice "$1" "$2" "$3" + populate_slice "$1" "$2" "$3" "$4" ) populate_data_slice ( ) ( - populate_slice "$1" "$2" "$3" + populate_slice "$1" "$2" "$3" "$4" ) create_i386_diskimage ( ) ( @@ -484,13 +501,8 @@ create_i386_diskimage ( ) ( bsdlabel ${MD}s1 # Create first image - # XXX: should use populate_slice for easier override - newfs ${NANO_NEWFS} /dev/${MD}s1a + populate_slice /dev/${MD}s1a ${NANO_WORLDDIR} ${MNT} "s1" mount /dev/${MD}s1a ${MNT} - df -i ${MNT} - echo "Copying worlddir..." - ( cd ${NANO_WORLDDIR} && find . -print | cpio -dump ${MNT} ) - df -i ${MNT} echo "Generating mtree..." ( cd ${MNT} && mtree -c ) > ${NANO_OBJ}/_.mtree ( cd ${MNT} && du -k ) > ${NANO_OBJ}/_.du @@ -506,14 +518,17 @@ create_i386_diskimage ( ) ( sed -i "" "s=${NANO_DRIVE}s1=${NANO_DRIVE}s2=g" $f done umount ${MNT} + if [ ! -z ${NANO_LABEL} ]; then + tunefs -L ${NANO_LABEL}"s2" /dev/${MD}s2a + fi fi # Create Config slice - populate_cfg_slice /dev/${MD}s3 "${NANO_CFGDIR}" ${MNT} + populate_cfg_slice /dev/${MD}s3 "${NANO_CFGDIR}" ${MNT} "s3" # Create Data slice, if any. if [ $NANO_DATASIZE -ne 0 ] ; then - populate_data_slice /dev/${MD}s4 "${NANO_DATADIR}" ${MNT} + populate_data_slice /dev/${MD}s4 "${NANO_DATADIR}" ${MNT} "s4" fi if [ "${NANO_MD_BACKING}" = "swap" ] ; then @@ -612,7 +627,7 @@ cust_comconsole () ( sed -i "" -e '/^ttyv[0-8]/s/ on/ off/' ${NANO_WORLDDIR}/etc/ttys # Tell loader to use serial console early. - echo "${NANO_BOOT2CFG}" > ${NANO_WORLDDIR}/boot.config + echo " -h" > ${NANO_WORLDDIR}/boot.config ) ####################################################################### @@ -820,6 +835,11 @@ else NANO_PMAKE="${NANO_PMAKE} -DNO_CLEAN" fi +# Override user's NANO_DRIVE if they specified a NANO_LABEL +if [ ! -z "${NANO_LABEL}" ]; then + NANO_DRIVE=ufs/${NANO_LABEL} +fi + export MAKEOBJDIRPREFIX export NANO_ARCH @@ -844,6 +864,7 @@ export NANO_TOOLS export NANO_WORLDDIR export NANO_BOOT0CFG export NANO_BOOTLOADER +export NANO_LABEL ####################################################################### # And then it is as simple as that... From owner-svn-src-all@FreeBSD.ORG Mon Sep 20 23:39:01 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2F5B4106566B; Mon, 20 Sep 2010 23:39:01 +0000 (UTC) (envelope-from gibbs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1B8008FC0C; Mon, 20 Sep 2010 23:39:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8KNd1g3071610; Mon, 20 Sep 2010 23:39:01 GMT (envelope-from gibbs@svn.freebsd.org) Received: (from gibbs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8KNd0lG071602; Mon, 20 Sep 2010 23:39:00 GMT (envelope-from gibbs@svn.freebsd.org) Message-Id: <201009202339.o8KNd0lG071602@svn.freebsd.org> From: "Justin T. Gibbs" Date: Mon, 20 Sep 2010 23:39:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212939 - in stable/8/sys: cam/ata cam/scsi cddl/contrib/opensolaris/uts/common/fs/zfs geom geom/sched kern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 23:39:01 -0000 Author: gibbs Date: Mon Sep 20 23:39:00 2010 New Revision: 212939 URL: http://svn.freebsd.org/changeset/base/212939 Log: MFC 212160: Correct bioq_disksort so that bioq_insert_tail() offers barrier semantic. Add the BIO_ORDERED flag for struct bio and update bio clients to use it. The barrier semantics of bioq_insert_tail() were broken in two ways: o In bioq_disksort(), an added bio could be inserted at the head of the queue, even when a barrier was present, if the sort key for the new entry was less than that of the last queued barrier bio. o The last_offset used to generate the sort key for newly queued bios did not stay at the position of the barrier until either the barrier was de-queued, or a new barrier (which updates last_offset) was queued. When a barrier is in effect, we know that the disk will pass through the barrier position just before the "blocked bios" are released, so using the barrier's offset for last_offset is the optimal choice. sys/geom/sched/subr_disk.c: sys/kern/subr_disk.c: o Update last_offset in bioq_insert_tail(). o Only update last_offset in bioq_remove() if the removed bio is at the head of the queue (typically due to a call via bioq_takefirst()) and no barrier is active. o In bioq_disksort(), if we have a barrier (insert_point is non-NULL), set prev to the barrier and cur to it's next element. Now that last_offset is kept at the barrier position, this change isn't strictly necessary, but since we have to take a decision branch anyway, it does avoid one, no-op, loop iteration in the while loop that immediately follows. o In bioq_disksort(), bypass the normal sort for bios with the BIO_ORDERED attribute and instead insert them into the queue with bioq_insert_tail(). bioq_insert_tail() not only gives the desired command order during insertion, but also provides barrier semantics so that commands disksorted in the future cannot pass the just enqueued transaction. sys/sys/bio.h: Add BIO_ORDERED as bit 4 of the bio_flags field in struct bio. sys/cam/ata/ata_da.c: sys/cam/scsi/scsi_da.c Use an ordered command for SCSI/ATA-NCQ commands issued in response to bios with the BIO_ORDERED flag set. sys/cam/scsi/scsi_da.c Use an ordered tag when issuing a synchronize cache command. Wrap some lines to 80 columns. sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c sys/geom/geom_io.c Mark bios with the BIO_FLUSH command as BIO_ORDERED. Sponsored by: Spectra Logic Corporation ------------------------------------------------------------------------ Modified: stable/8/sys/cam/ata/ata_da.c stable/8/sys/cam/scsi/scsi_da.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c stable/8/sys/geom/geom_io.c stable/8/sys/geom/sched/subr_disk.c stable/8/sys/kern/subr_disk.c stable/8/sys/sys/bio.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/cam/ata/ata_da.c ============================================================================== --- stable/8/sys/cam/ata/ata_da.c Mon Sep 20 23:36:54 2010 (r212938) +++ stable/8/sys/cam/ata/ata_da.c Mon Sep 20 23:39:00 2010 (r212939) @@ -870,7 +870,8 @@ adastart(struct cam_periph *periph, unio } bioq_remove(&softc->bio_queue, bp); - if ((softc->flags & ADA_FLAG_NEED_OTAG) != 0) { + if ((bp->bio_flags & BIO_ORDERED) != 0 + || (softc->flags & ADA_FLAG_NEED_OTAG) != 0) { softc->flags &= ~ADA_FLAG_NEED_OTAG; softc->ordered_tag_count++; tag_code = 0; Modified: stable/8/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_da.c Mon Sep 20 23:36:54 2010 (r212938) +++ stable/8/sys/cam/scsi/scsi_da.c Mon Sep 20 23:39:00 2010 (r212939) @@ -1318,7 +1318,8 @@ dastart(struct cam_periph *periph, union bioq_remove(&softc->bio_queue, bp); - if ((softc->flags & DA_FLAG_NEED_OTAG) != 0) { + if ((bp->bio_flags & BIO_ORDERED) != 0 + || (softc->flags & DA_FLAG_NEED_OTAG) != 0) { softc->flags &= ~DA_FLAG_NEED_OTAG; softc->ordered_tag_count++; tag_code = MSG_ORDERED_Q_TAG; @@ -1332,7 +1333,8 @@ dastart(struct cam_periph *periph, union /*retries*/da_retry_count, /*cbfcnp*/dadone, /*tag_action*/tag_code, - /*read_op*/bp->bio_cmd == BIO_READ, + /*read_op*/bp->bio_cmd + == BIO_READ, /*byte2*/0, softc->minimum_cmd_size, /*lba*/bp->bio_pblkno, @@ -1341,17 +1343,24 @@ dastart(struct cam_periph *periph, union /*data_ptr*/ bp->bio_data, /*dxfer_len*/ bp->bio_bcount, /*sense_len*/SSD_FULL_SIZE, - /*timeout*/da_default_timeout*1000); + da_default_timeout * 1000); break; case BIO_FLUSH: + /* + * BIO_FLUSH doesn't currently communicate + * range data, so we synchronize the cache + * over the whole disk. We also force + * ordered tag semantics the flush applies + * to all previously queued I/O. + */ scsi_synchronize_cache(&start_ccb->csio, /*retries*/1, /*cbfcnp*/dadone, - MSG_SIMPLE_Q_TAG, - /*begin_lba*/0,/* Cover the whole disk */ + MSG_ORDERED_Q_TAG, + /*begin_lba*/0, /*lb_count*/0, SSD_FULL_SIZE, - /*timeout*/da_default_timeout*1000); + da_default_timeout*1000); break; } start_ccb->ccb_h.ccb_state = DA_CCB_BUFFER_IO; Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Mon Sep 20 23:36:54 2010 (r212938) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Mon Sep 20 23:39:00 2010 (r212939) @@ -597,6 +597,7 @@ sendreq: break; case ZIO_TYPE_IOCTL: bp->bio_cmd = BIO_FLUSH; + bp->bio_flags |= BIO_ORDERED; bp->bio_data = NULL; bp->bio_offset = cp->provider->mediasize; bp->bio_length = 0; Modified: stable/8/sys/geom/geom_io.c ============================================================================== --- stable/8/sys/geom/geom_io.c Mon Sep 20 23:36:54 2010 (r212938) +++ stable/8/sys/geom/geom_io.c Mon Sep 20 23:39:00 2010 (r212939) @@ -265,6 +265,7 @@ g_io_flush(struct g_consumer *cp) g_trace(G_T_BIO, "bio_flush(%s)", cp->provider->name); bp = g_alloc_bio(); bp->bio_cmd = BIO_FLUSH; + bp->bio_flags |= BIO_ORDERED; bp->bio_done = NULL; bp->bio_attribute = NULL; bp->bio_offset = cp->provider->mediasize; Modified: stable/8/sys/geom/sched/subr_disk.c ============================================================================== --- stable/8/sys/geom/sched/subr_disk.c Mon Sep 20 23:36:54 2010 (r212938) +++ stable/8/sys/geom/sched/subr_disk.c Mon Sep 20 23:39:00 2010 (r212939) @@ -86,7 +86,7 @@ __FBSDID("$FreeBSD$"); * bioq_remove() remove a generic element from the queue, act as * bioq_takefirst() if invoked on the head of the queue. * - * The semantic of these methods is the same of the operations + * The semantic of these methods is the same as the operations * on the underlying TAILQ, but with additional guarantees on * subsequent bioq_disksort() calls. E.g. bioq_insert_tail() * can be useful for making sure that all previous ops are flushed @@ -115,10 +115,10 @@ void gs_bioq_remove(struct bio_queue_head *head, struct bio *bp) { - if (bp == TAILQ_FIRST(&head->queue)) - head->last_offset = bp->bio_offset + bp->bio_length; - - if (bp == head->insert_point) + if (head->insert_point == NULL) { + if (bp == TAILQ_FIRST(&head->queue)) + head->last_offset = bp->bio_offset + bp->bio_length; + } else if (bp == head->insert_point) head->insert_point = NULL; TAILQ_REMOVE(&head->queue, bp, bio_queue); @@ -137,7 +137,8 @@ void gs_bioq_insert_head(struct bio_queue_head *head, struct bio *bp) { - head->last_offset = bp->bio_offset; + if (head->insert_point == NULL) + head->last_offset = bp->bio_offset; TAILQ_INSERT_HEAD(&head->queue, bp, bio_queue); } @@ -147,6 +148,7 @@ gs_bioq_insert_tail(struct bio_queue_hea TAILQ_INSERT_TAIL(&head->queue, bp, bio_queue); head->insert_point = bp; + head->last_offset = bp->bio_offset; } struct bio * @@ -189,13 +191,28 @@ gs_bioq_bio_key(struct bio_queue_head *h void gs_bioq_disksort(struct bio_queue_head *head, struct bio *bp) { - struct bio *cur, *prev = NULL; - uoff_t key = gs_bioq_bio_key(head, bp); + struct bio *cur, *prev; + uoff_t key; + if ((bp->bio_flags & BIO_ORDERED) != 0) { + /* + * Ordered transactions can only be dispatched + * after any currently queued transactions. They + * also have barrier semantics - no transactions + * queued in the future can pass them. + */ + gs_bioq_insert_tail(head, bp); + return; + } + + prev = NULL; + key = gs_bioq_bio_key(head, bp); cur = TAILQ_FIRST(&head->queue); - if (head->insert_point) - cur = head->insert_point; + if (head->insert_point) { + prev = head->insert_point; + cur = TAILQ_NEXT(head->insert_point, bio_queue); + } while (cur != NULL && key >= gs_bioq_bio_key(head, cur)) { prev = cur; Modified: stable/8/sys/kern/subr_disk.c ============================================================================== --- stable/8/sys/kern/subr_disk.c Mon Sep 20 23:36:54 2010 (r212938) +++ stable/8/sys/kern/subr_disk.c Mon Sep 20 23:39:00 2010 (r212939) @@ -127,7 +127,7 @@ disk_err(struct bio *bp, const char *wha * bioq_remove() remove a generic element from the queue, act as * bioq_takefirst() if invoked on the head of the queue. * - * The semantic of these methods is the same of the operations + * The semantic of these methods is the same as the operations * on the underlying TAILQ, but with additional guarantees on * subsequent bioq_disksort() calls. E.g. bioq_insert_tail() * can be useful for making sure that all previous ops are flushed @@ -156,10 +156,10 @@ void bioq_remove(struct bio_queue_head *head, struct bio *bp) { - if (bp == TAILQ_FIRST(&head->queue)) - head->last_offset = bp->bio_offset + bp->bio_length; - - if (bp == head->insert_point) + if (head->insert_point == NULL) { + if (bp == TAILQ_FIRST(&head->queue)) + head->last_offset = bp->bio_offset + bp->bio_length; + } else if (bp == head->insert_point) head->insert_point = NULL; TAILQ_REMOVE(&head->queue, bp, bio_queue); @@ -178,7 +178,8 @@ void bioq_insert_head(struct bio_queue_head *head, struct bio *bp) { - head->last_offset = bp->bio_offset; + if (head->insert_point == NULL) + head->last_offset = bp->bio_offset; TAILQ_INSERT_HEAD(&head->queue, bp, bio_queue); } @@ -188,6 +189,7 @@ bioq_insert_tail(struct bio_queue_head * TAILQ_INSERT_TAIL(&head->queue, bp, bio_queue); head->insert_point = bp; + head->last_offset = bp->bio_offset; } struct bio * @@ -230,13 +232,28 @@ bioq_bio_key(struct bio_queue_head *head void bioq_disksort(struct bio_queue_head *head, struct bio *bp) { - struct bio *cur, *prev = NULL; - uoff_t key = bioq_bio_key(head, bp); + struct bio *cur, *prev; + uoff_t key; + if ((bp->bio_flags & BIO_ORDERED) != 0) { + /* + * Ordered transactions can only be dispatched + * after any currently queued transactions. They + * also have barrier semantics - no transactions + * queued in the future can pass them. + */ + bioq_insert_tail(head, bp); + return; + } + + prev = NULL; + key = bioq_bio_key(head, bp); cur = TAILQ_FIRST(&head->queue); - if (head->insert_point) - cur = head->insert_point; + if (head->insert_point) { + prev = head->insert_point; + cur = TAILQ_NEXT(head->insert_point, bio_queue); + } while (cur != NULL && key >= bioq_bio_key(head, cur)) { prev = cur; Modified: stable/8/sys/sys/bio.h ============================================================================== --- stable/8/sys/sys/bio.h Mon Sep 20 23:36:54 2010 (r212938) +++ stable/8/sys/sys/bio.h Mon Sep 20 23:39:00 2010 (r212939) @@ -54,6 +54,7 @@ #define BIO_ERROR 0x01 #define BIO_DONE 0x02 #define BIO_ONQUEUE 0x04 +#define BIO_ORDERED 0x08 #ifdef _KERNEL struct disk; From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 04:23:27 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8EB93106564A; Tue, 21 Sep 2010 04:23:27 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7DA678FC1A; Tue, 21 Sep 2010 04:23:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8L4NRSF078687; Tue, 21 Sep 2010 04:23:27 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8L4NRv9078685; Tue, 21 Sep 2010 04:23:27 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009210423.o8L4NRv9078685@svn.freebsd.org> From: Alexander Motin Date: Tue, 21 Sep 2010 04:23:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212946 - stable/8/sys/sparc64/sparc64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 04:23:27 -0000 Author: mav Date: Tue Sep 21 04:23:27 2010 New Revision: 212946 URL: http://svn.freebsd.org/changeset/base/212946 Log: MFC r212456: Sparc64 uses dummy cpu_idle() method. It's CPUs never sleeping. Tell scheduler that it doesn't need to use IPI to "wake up" CPU. Modified: stable/8/sys/sparc64/sparc64/machdep.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/sparc64/sparc64/machdep.c ============================================================================== --- stable/8/sys/sparc64/sparc64/machdep.c Tue Sep 21 02:24:11 2010 (r212945) +++ stable/8/sys/sparc64/sparc64/machdep.c Tue Sep 21 04:23:27 2010 (r212946) @@ -957,7 +957,7 @@ int cpu_idle_wakeup(int cpu) { - return (0); + return (1); } int From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 04:29:27 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B66D4106564A; Tue, 21 Sep 2010 04:29:27 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A41DE8FC14; Tue, 21 Sep 2010 04:29:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8L4TRVP078901; Tue, 21 Sep 2010 04:29:27 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8L4TRu9078897; Tue, 21 Sep 2010 04:29:27 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009210429.o8L4TRu9078897@svn.freebsd.org> From: Alexander Motin Date: Tue, 21 Sep 2010 04:29:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212947 - in stable/8: share/man/man4/man4.powerpc sys/dev/powermac_nvram X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 04:29:27 -0000 Author: mav Date: Tue Sep 21 04:29:27 2010 New Revision: 212947 URL: http://svn.freebsd.org/changeset/base/212947 Log: MFC r212240: Add support for the Sharp/Micron flash chips to powermac_mvram(4). Tested on PowerMac G4 AGP. Modified: stable/8/share/man/man4/man4.powerpc/powermac_nvram.4 stable/8/sys/dev/powermac_nvram/powermac_nvram.c stable/8/sys/dev/powermac_nvram/powermac_nvramvar.h Directory Properties: stable/8/share/man/man4/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/share/man/man4/man4.powerpc/powermac_nvram.4 ============================================================================== --- stable/8/share/man/man4/man4.powerpc/powermac_nvram.4 Tue Sep 21 04:23:27 2010 (r212946) +++ stable/8/share/man/man4/man4.powerpc/powermac_nvram.4 Tue Sep 21 04:29:27 2010 (r212947) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 1, 2006 +.Dd September 5, 2010 .Dt POWERMAC_NVRAM 4 powerpc .Os .Sh NAME @@ -63,8 +63,3 @@ The .Nm driver was written by .An Maxim Sobolev Aq sobomax@FreeBSD.org . -.Sh BUGS -Currently, the -.Nm -driver only supports systems equipped with an AMD flash part and is only -tested on Apple G4-based Mac Mini machines. Modified: stable/8/sys/dev/powermac_nvram/powermac_nvram.c ============================================================================== --- stable/8/sys/dev/powermac_nvram/powermac_nvram.c Tue Sep 21 04:23:27 2010 (r212946) +++ stable/8/sys/dev/powermac_nvram/powermac_nvram.c Tue Sep 21 04:29:27 2010 (r212947) @@ -115,7 +115,10 @@ powermac_nvram_probe(device_t dev) if (type == NULL || compatible == NULL) return ENXIO; - if (strcmp(type, "nvram") != 0 || strcmp(compatible, "amd-0137") != 0) + if (strcmp(type, "nvram") != 0) + return ENXIO; + if (strcmp(compatible, "amd-0137") != 0 && + strcmp(compatible, "nvram,flash") != 0) return ENXIO; device_set_desc(dev, "Apple NVRAM"); @@ -126,6 +129,7 @@ static int powermac_nvram_attach(device_t dev) { struct powermac_nvram_softc *sc; + const char *compatible; phandle_t node; u_int32_t reg[3]; int gen0, gen1, i; @@ -139,6 +143,12 @@ powermac_nvram_attach(device_t dev) sc->sc_dev = dev; sc->sc_node = node; + compatible = ofw_bus_get_compat(dev); + if (strcmp(compatible, "amd-0137") == 0) + sc->sc_type = FLASH_TYPE_AMD; + else + sc->sc_type = FLASH_TYPE_SM; + /* * Find which byte of reg corresponds to the 32-bit physical address. * We should probably read #address-cells from /chosen instead. @@ -342,7 +352,7 @@ adler_checksum(uint8_t *data, int len) #define OUTB_DELAY(a, v) outb(a, v); DELAY(1); static int -wait_operation_complete(uint8_t *bank) +wait_operation_complete_amd(uint8_t *bank) { int i; @@ -353,7 +363,7 @@ wait_operation_complete(uint8_t *bank) } static int -erase_bank(device_t dev, uint8_t *bank) +erase_bank_amd(device_t dev, uint8_t *bank) { unsigned int i; @@ -368,7 +378,7 @@ erase_bank(device_t dev, uint8_t *bank) OUTB_DELAY(bank + 0x2aa, 0x55); OUTB_DELAY(bank, 0x30); - if (wait_operation_complete(bank) != 0) { + if (wait_operation_complete_amd(bank) != 0) { device_printf(dev, "flash erase timeout\n"); return -1; } @@ -386,7 +396,7 @@ erase_bank(device_t dev, uint8_t *bank) } static int -write_bank(device_t dev, uint8_t *bank, uint8_t *data) +write_bank_amd(device_t dev, uint8_t *bank, uint8_t *data) { unsigned int i; @@ -399,7 +409,7 @@ write_bank(device_t dev, uint8_t *bank, /* Write single word */ OUTB_DELAY(bank + 0x555, 0xa0); OUTB_DELAY(bank + i, data[i]); - if (wait_operation_complete(bank) != 0) { + if (wait_operation_complete_amd(bank) != 0) { device_printf(dev, "flash write timeout\n"); return -1; } @@ -416,3 +426,91 @@ write_bank(device_t dev, uint8_t *bank, } return 0; } + +static int +wait_operation_complete_sm(uint8_t *bank) +{ + int i; + + for (i = 1000000; i != 0; i--) { + outb(bank, SM_FLASH_CMD_READ_STATUS); + if (inb(bank) & SM_FLASH_STATUS_DONE) + return (0); + } + return (-1); +} + +static int +erase_bank_sm(device_t dev, uint8_t *bank) +{ + unsigned int i; + + outb(bank, SM_FLASH_CMD_ERASE_SETUP); + outb(bank, SM_FLASH_CMD_ERASE_CONFIRM); + + if (wait_operation_complete_sm(bank) != 0) { + device_printf(dev, "flash erase timeout\n"); + return (-1); + } + + outb(bank, SM_FLASH_CMD_CLEAR_STATUS); + outb(bank, SM_FLASH_CMD_RESET); + + for (i = 0; i < NVRAM_SIZE; i++) { + if (bank[i] != 0xff) { + device_printf(dev, "flash write has failed\n"); + return (-1); + } + } + return (0); +} + +static int +write_bank_sm(device_t dev, uint8_t *bank, uint8_t *data) +{ + unsigned int i; + + for (i = 0; i < NVRAM_SIZE; i++) { + OUTB_DELAY(bank + i, SM_FLASH_CMD_WRITE_SETUP); + outb(bank + i, data[i]); + if (wait_operation_complete_sm(bank) != 0) { + device_printf(dev, "flash write error/timeout\n"); + break; + } + } + + outb(bank, SM_FLASH_CMD_CLEAR_STATUS); + outb(bank, SM_FLASH_CMD_RESET); + + for (i = 0; i < NVRAM_SIZE; i++) { + if (bank[i] != data[i]) { + device_printf(dev, "flash write has failed\n"); + return (-1); + } + } + return (0); +} + +static int +erase_bank(device_t dev, uint8_t *bank) +{ + struct powermac_nvram_softc *sc; + + sc = device_get_softc(dev); + if (sc->sc_type == FLASH_TYPE_AMD) + return (erase_bank_amd(dev, bank)); + else + return (erase_bank_sm(dev, bank)); +} + +static int +write_bank(device_t dev, uint8_t *bank, uint8_t *data) +{ + struct powermac_nvram_softc *sc; + + sc = device_get_softc(dev); + if (sc->sc_type == FLASH_TYPE_AMD) + return (write_bank_amd(dev, bank, data)); + else + return (write_bank_sm(dev, bank, data)); +} Modified: stable/8/sys/dev/powermac_nvram/powermac_nvramvar.h ============================================================================== --- stable/8/sys/dev/powermac_nvram/powermac_nvramvar.h Tue Sep 21 04:23:27 2010 (r212946) +++ stable/8/sys/dev/powermac_nvram/powermac_nvramvar.h Tue Sep 21 04:29:27 2010 (r212947) @@ -33,6 +33,16 @@ #define CORE99_SIGNATURE 0x5a +#define SM_FLASH_CMD_ERASE_CONFIRM 0xd0 +#define SM_FLASH_CMD_ERASE_SETUP 0x20 +#define SM_FLASH_CMD_RESET 0xff +#define SM_FLASH_CMD_WRITE_SETUP 0x40 +#define SM_FLASH_CMD_CLEAR_STATUS 0x50 +#define SM_FLASH_CMD_READ_STATUS 0x70 + +#define SM_FLASH_STATUS_DONE 0x80 +#define SM_FLASH_STATUS_ERR 0x38 + #ifdef _KERNEL struct powermac_nvram_softc { @@ -44,6 +54,9 @@ struct powermac_nvram_softc { uint8_t sc_data[NVRAM_SIZE]; struct cdev * sc_cdev; + int sc_type; +#define FLASH_TYPE_SM 0 +#define FLASH_TYPE_AMD 1 int sc_isopen; int sc_rpos; int sc_wpos; From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 04:39:14 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5095D106566C; Tue, 21 Sep 2010 04:39:14 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3F7258FC0A; Tue, 21 Sep 2010 04:39:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8L4dEQ2079201; Tue, 21 Sep 2010 04:39:14 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8L4dE1E079199; Tue, 21 Sep 2010 04:39:14 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009210439.o8L4dE1E079199@svn.freebsd.org> From: Alexander Motin Date: Tue, 21 Sep 2010 04:39:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212948 - stable/8/sbin/camcontrol X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 04:39:14 -0000 Author: mav Date: Tue Sep 21 04:39:13 2010 New Revision: 212948 URL: http://svn.freebsd.org/changeset/base/212948 Log: MFC r209625: Correct explanation for idle and standby subcommands' -t argument. Modified: stable/8/sbin/camcontrol/camcontrol.8 Directory Properties: stable/8/sbin/camcontrol/ (props changed) Modified: stable/8/sbin/camcontrol/camcontrol.8 ============================================================================== --- stable/8/sbin/camcontrol/camcontrol.8 Tue Sep 21 04:29:27 2010 (r212947) +++ stable/8/sbin/camcontrol/camcontrol.8 Tue Sep 21 04:39:13 2010 (r212948) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 2, 2010 +.Dd July 1, 2010 .Dt CAMCONTROL 8 .Os .Sh NAME @@ -846,11 +846,13 @@ will not be asked about the timeout if a command line. .El .It Ic idle -Put ATA device into IDLE state. Optional parameter specifies automatic -idle timer value in seconds. +Put ATA device into IDLE state. Optional parameter +.Pq Fl t +specifies automatic standby timer value in seconds. Value 0 disables timer. .It Ic standby -Put ATA device into STANDBY state. Optional parameter specifies automatic -standby timer value in seconds. +Put ATA device into STANDBY state. Optional parameter +.Pq Fl t +specifies automatic standby timer value in seconds. Value 0 disables timer. .It Ic sleep Put ATA device into SLEEP state. Note that the only way get device out of this state may be reset. From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 04:47:38 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8B41B106566B; Tue, 21 Sep 2010 04:47:38 +0000 (UTC) (envelope-from andy@fud.org.nz) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id A96598FC0C; Tue, 21 Sep 2010 04:47:37 +0000 (UTC) Received: by wwc33 with SMTP id 33so523356wwc.31 for ; Mon, 20 Sep 2010 21:47:36 -0700 (PDT) MIME-Version: 1.0 Received: by 10.227.141.138 with SMTP id m10mr2710833wbu.20.1285044456515; Mon, 20 Sep 2010 21:47:36 -0700 (PDT) Sender: andy@fud.org.nz Received: by 10.227.157.85 with HTTP; Mon, 20 Sep 2010 21:47:36 -0700 (PDT) In-Reply-To: <201006241632.o5OGWKBb040575@svn.freebsd.org> References: <201006241632.o5OGWKBb040575@svn.freebsd.org> Date: Tue, 21 Sep 2010 16:47:36 +1200 X-Google-Sender-Auth: qTPbZYVT53zOv3vFzp6U3k4jMZA Message-ID: From: Andrew Thompson To: Warner Losh Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r209510 - head X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 04:47:38 -0000 On 25 June 2010 04:32, Warner Losh wrote: > Author: imp > Date: Thu Jun 24 16:32:20 2010 > New Revision: 209510 > URL: http://svn.freebsd.org/changeset/base/209510 > > Log: > =A0Merge from tbemd: > > =A0change the name of the object tree from ${TARGET} to > =A0${TARGET}.${TARGET_ARCH} so we can do both big and little endian > =A0builds in the same tree. This seems to have broken the VCS string in vers.c, does this look ok? Index: sys/conf/newvers.sh =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/conf/newvers.sh (revision 212945) +++ sys/conf/newvers.sh (working copy) @@ -91,7 +91,7 @@ case "$d" in */sys/*) SRCDIR=3D${d##*obj} if [ -n "$MACHINE" ]; then - SRCDIR=3D${SRCDIR##/$MACHINE} + SRCDIR=3D${SRCDIR##/$MACHINE.$MACHINE_ARCH} fi SRCDIR=3D${SRCDIR%%/sys/*} From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 05:05:44 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A0374106566C; Tue, 21 Sep 2010 05:05:44 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 5C8D68FC14; Tue, 21 Sep 2010 05:05:44 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id o8L501FT070603; Mon, 20 Sep 2010 23:00:02 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Mon, 20 Sep 2010 23:00:06 -0600 (MDT) Message-Id: <20100920.230006.634347869592887498.imp@bsdimp.com> To: thompsa@FreeBSD.org From: "M. Warner Losh" In-Reply-To: References: <201006241632.o5OGWKBb040575@svn.freebsd.org> X-Mailer: Mew version 6.3 on Emacs 22.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r209510 - head X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 05:05:44 -0000 In message: Andrew Thompson writes: : On 25 June 2010 04:32, Warner Losh wrote: : > Author: imp : > Date: Thu Jun 24 16:32:20 2010 : > New Revision: 209510 : > URL: http://svn.freebsd.org/changeset/base/209510 : > : > Log: : > =A0Merge from tbemd: : > : > =A0change the name of the object tree from ${TARGET} to : > =A0${TARGET}.${TARGET_ARCH} so we can do both big and little endian= : > =A0builds in the same tree. : = : This seems to have broken the VCS string in vers.c, does this look ok= ? : = : Index: sys/conf/newvers.sh : =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/conf/newvers.sh (revision 212945) : +++ sys/conf/newvers.sh (working copy) : @@ -91,7 +91,7 @@ case "$d" in : */sys/*) : SRCDIR=3D${d##*obj} : if [ -n "$MACHINE" ]; then : - SRCDIR=3D${SRCDIR##/$MACHINE} : + SRCDIR=3D${SRCDIR##/$MACHINE.$MACHINE_ARCH} : fi : SRCDIR=3D${SRCDIR%%/sys/*} Sure. 3 months to notice... I think this may be because I don't have these lines anymore in my newvers.sh... Warner From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 05:36:31 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4A009106566C; Tue, 21 Sep 2010 05:36:31 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 398588FC21; Tue, 21 Sep 2010 05:36:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8L5aVfV080515; Tue, 21 Sep 2010 05:36:31 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8L5aVM6080513; Tue, 21 Sep 2010 05:36:31 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201009210536.o8L5aVM6080513@svn.freebsd.org> From: Andriy Gapon Date: Tue, 21 Sep 2010 05:36:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212949 - head/tools/tools/umastat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 05:36:31 -0000 Author: avg Date: Tue Sep 21 05:36:30 2010 New Revision: 212949 URL: http://svn.freebsd.org/changeset/base/212949 Log: tools/umastat: more cleanups PR: misc/146119 Submitted by: pluknet MFC after: 1 week Modified: head/tools/tools/umastat/umastat.c Modified: head/tools/tools/umastat/umastat.c ============================================================================== --- head/tools/tools/umastat/umastat.c Tue Sep 21 04:39:13 2010 (r212948) +++ head/tools/tools/umastat/umastat.c Tue Sep 21 05:36:30 2010 (r212949) @@ -37,6 +37,7 @@ #include #include +#include #include #include #include @@ -196,7 +197,7 @@ uma_print_keg_align(struct uma_keg *ukp, LIST_HEAD(bucketlist, uma_bucket); static void -uma_print_bucket(struct uma_bucket *ubp, const char *spaces) +uma_print_bucket(struct uma_bucket *ubp, const char *spaces __unused) { printf("{ ub_cnt = %d, ub_entries = %d }", ubp->ub_cnt, @@ -286,6 +287,7 @@ main(int argc, char *argv[]) size_t uzp_userspace_len; char *memf, *nlistf; int ch; + char errbuf[_POSIX2_LINE_MAX]; memf = nlistf = NULL; while ((ch = getopt(argc, argv, "M:N:")) != -1) { @@ -308,9 +310,9 @@ main(int argc, char *argv[]) if (nlistf != NULL && memf == NULL) usage(); - kvm = kvm_open(nlistf, memf, NULL, 0, "umastat"); + kvm = kvm_openfiles(nlistf, memf, NULL, 0, errbuf); if (kvm == NULL) - err(-1, "kvm_open"); + errx(-1, "kvm_openfiles: %s", errbuf); if (kvm_nlist(kvm, namelist) != 0) err(-1, "kvm_nlist"); From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 05:39:17 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5B2A1106566C; Tue, 21 Sep 2010 05:39:17 +0000 (UTC) (envelope-from avg@freebsd.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 380608FC20; Tue, 21 Sep 2010 05:39:15 +0000 (UTC) Received: from porto.topspin.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 IAA25557; Tue, 21 Sep 2010 08:39:13 +0300 (EEST) (envelope-from avg@freebsd.org) Received: from localhost.topspin.kiev.ua ([127.0.0.1]) by porto.topspin.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1OxvZQ-000Nl2-Uy; Tue, 21 Sep 2010 08:39:12 +0300 Message-ID: <4C984500.6080807@freebsd.org> Date: Tue, 21 Sep 2010 08:39:12 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.9) Gecko/20100918 Lightning/1.0b2 Thunderbird/3.1.4 MIME-Version: 1.0 To: pluknet References: <201009202122.o8KLMFFA067994@svn.freebsd.org> In-Reply-To: X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212932 - head/tools/tools/umastat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 05:39:17 -0000 on 21/09/2010 01:39 pluknet said the following: > On 21 September 2010 01:22, Andriy Gapon wrote: >> Author: avg >> Date: Mon Sep 20 21:22:15 2010 >> New Revision: 212932 >> URL: http://svn.freebsd.org/changeset/base/212932 >> >> Log: >> tools/umastat: fix build on amd64 > > Hi. > > Now my PR 146119 being in GNATS queue for five month can be partially closed. Committed the rest of your patch. Sorry for not spotting the PR earlier. Thanks! -- Andriy Gapon From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 05:54:36 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E96F9106566C; Tue, 21 Sep 2010 05:54:36 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D890A8FC18; Tue, 21 Sep 2010 05:54:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8L5saCN080915; Tue, 21 Sep 2010 05:54:36 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8L5samY080913; Tue, 21 Sep 2010 05:54:36 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201009210554.o8L5samY080913@svn.freebsd.org> From: Andriy Gapon Date: Tue, 21 Sep 2010 05:54:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212950 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 05:54:37 -0000 Author: avg Date: Tue Sep 21 05:54:36 2010 New Revision: 212950 URL: http://svn.freebsd.org/changeset/base/212950 Log: zfs_vnops: use zfs_map_page/zfs_unmap_page helper functions in another place MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue Sep 21 05:36:30 2010 (r212949) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue Sep 21 05:54:36 2010 (r212950) @@ -510,14 +510,11 @@ again: dirbytes = 0; } if (error == 0) { - sched_pin(); - sf = sf_buf_alloc(m, SFB_CPUPRIVATE); - va = (caddr_t)sf_buf_kva(sf); + va = zfs_map_page(m, &sf); error = dmu_read(os, zp->z_id, start + off, bytes, (void *)(va + off), DMU_READ_PREFETCH); - sf_buf_free(sf); - sched_unpin(); + zfs_unmap_page(sf); } VM_OBJECT_LOCK(obj); if (error == 0) From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 05:58:46 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F41E21065670; Tue, 21 Sep 2010 05:58:45 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E370D8FC22; Tue, 21 Sep 2010 05:58:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8L5wjk6081070; Tue, 21 Sep 2010 05:58:45 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8L5wjv9081068; Tue, 21 Sep 2010 05:58:45 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201009210558.o8L5wjv9081068@svn.freebsd.org> From: Andriy Gapon Date: Tue, 21 Sep 2010 05:58:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212951 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 05:58:46 -0000 Author: avg Date: Tue Sep 21 05:58:45 2010 New Revision: 212951 URL: http://svn.freebsd.org/changeset/base/212951 Log: zfs_map_page/zfs_unmap_page: do not use sched_pin() and SFB_CPUPRIVATE zfs_map_page/zfs_unmap_page are mostly called around potential I/O paths and it seems to be a not very good idea to do cpu pinning there. Suggested by: kib MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue Sep 21 05:54:36 2010 (r212950) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue Sep 21 05:58:45 2010 (r212951) @@ -358,8 +358,7 @@ static caddr_t zfs_map_page(vm_page_t pp, struct sf_buf **sfp) { - sched_pin(); - *sfp = sf_buf_alloc(pp, SFB_CPUPRIVATE); + *sfp = sf_buf_alloc(pp, 0); return ((caddr_t)sf_buf_kva(*sfp)); } @@ -368,7 +367,6 @@ zfs_unmap_page(struct sf_buf *sf) { sf_buf_free(sf); - sched_unpin(); } From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 06:47:05 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51D41106564A; Tue, 21 Sep 2010 06:47:05 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 40DFC8FC21; Tue, 21 Sep 2010 06:47:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8L6l5RM082196; Tue, 21 Sep 2010 06:47:05 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8L6l55H082194; Tue, 21 Sep 2010 06:47:05 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201009210647.o8L6l55H082194@svn.freebsd.org> From: David Xu Date: Tue, 21 Sep 2010 06:47:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212952 - head/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 06:47:05 -0000 Author: davidxu Date: Tue Sep 21 06:47:04 2010 New Revision: 212952 URL: http://svn.freebsd.org/changeset/base/212952 Log: If we are at cancellation point, always work as deferred mode despite whether asynchronous mode is turned on or not, this always gives us a chance to decide whether thread should be canceled or not in cancellation points. Modified: head/lib/libthr/thread/thr_sig.c Modified: head/lib/libthr/thread/thr_sig.c ============================================================================== --- head/lib/libthr/thread/thr_sig.c Tue Sep 21 05:58:45 2010 (r212951) +++ head/lib/libthr/thread/thr_sig.c Tue Sep 21 06:47:04 2010 (r212952) @@ -270,46 +270,44 @@ static void check_cancel(struct pthread *curthread, ucontext_t *ucp) { - if (__predict_true(!curthread->cancel_pending || !curthread->cancel_enable || - curthread->no_cancel)) + if (__predict_true(!curthread->cancel_pending || + !curthread->cancel_enable || curthread->no_cancel)) return; - if (curthread->cancel_async) { + /* + * Otherwise, we are in defer mode, and we are at + * cancel point, tell kernel to not block the current + * thread on next cancelable system call. + * + * There are three cases we should call thr_wake() to + * turn on TDP_WAKEUP or send SIGCANCEL in kernel: + * 1) we are going to call a cancelable system call, + * non-zero cancel_point means we are already in + * cancelable state, next system call is cancelable. + * 2) because _thr_ast() may be called by + * THR_CRITICAL_LEAVE() which is used by rtld rwlock + * and any libthr internal locks, when rtld rwlock + * is used, it is mostly caused my an unresolved PLT. + * those routines may clear the TDP_WAKEUP flag by + * invoking some system calls, in those cases, we + * also should reenable the flag. + * 3) thread is in sigsuspend(), and the syscall insists + * on getting a signal before it agrees to return. + */ + if (curthread->cancel_point) { + if (curthread->in_sigsuspend && ucp) { + SIGADDSET(ucp->uc_sigmask, SIGCANCEL); + curthread->unblock_sigcancel = 1; + _thr_send_sig(curthread, SIGCANCEL); + } else + thr_wake(curthread->tid); + } else if (curthread->cancel_async) { /* - * asynchronous cancellation mode, act upon + * asynchronous cancellation mode, act upon * immediately. - */ + */ _pthread_exit_mask(PTHREAD_CANCELED, ucp? &ucp->uc_sigmask : NULL); - } else { - /* - * Otherwise, we are in defer mode, and we are at - * cancel point, tell kernel to not block the current - * thread on next cancelable system call. - * - * There are three cases we should call thr_wake() to - * turn on TDP_WAKEUP or send SIGCANCEL in kernel: - * 1) we are going to call a cancelable system call, - * non-zero cancel_point means we are already in - * cancelable state, next system call is cancelable. - * 2) because _thr_ast() may be called by - * THR_CRITICAL_LEAVE() which is used by rtld rwlock - * and any libthr internal locks, when rtld rwlock - * is used, it is mostly caused my an unresolved PLT. - * those routines may clear the TDP_WAKEUP flag by - * invoking some system calls, in those cases, we - * also should reenable the flag. - * 3) thread is in sigsuspend(), and the syscall insists - * on getting a signal before it agrees to return. - */ - if (curthread->cancel_point) { - if (curthread->in_sigsuspend && ucp) { - SIGADDSET(ucp->uc_sigmask, SIGCANCEL); - curthread->unblock_sigcancel = 1; - _thr_send_sig(curthread, SIGCANCEL); - } else - thr_wake(curthread->tid); - } } } From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 07:01:01 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 21593106564A; Tue, 21 Sep 2010 07:01:01 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0F49C8FC1A; Tue, 21 Sep 2010 07:01:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8L7109A082616; Tue, 21 Sep 2010 07:01:00 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8L710Fg082611; Tue, 21 Sep 2010 07:01:00 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201009210701.o8L710Fg082611@svn.freebsd.org> From: Ed Schouten Date: Tue, 21 Sep 2010 07:01:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212953 - stable/8/sys/fs/tmpfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 07:01:01 -0000 Author: ed Date: Tue Sep 21 07:01:00 2010 New Revision: 212953 URL: http://svn.freebsd.org/changeset/base/212953 Log: MFC r211598: Add support for whiteouts on tmpfs. Right now unionfs only allows filesystems to be mounted on top of another if it supports whiteouts. Even though I have sent a patch to daichi@ to let unionfs work without it, we'd better also add support for whiteouts to tmpfs. This patch implements .vop_whiteout and makes necessary changes to lookup() and readdir() to take them into account. We must also make sure that when adding or removing a file, we honour the componentname's DOWHITEOUT and ISWHITEOUT, to prevent duplicate filenames. Modified: stable/8/sys/fs/tmpfs/tmpfs.h stable/8/sys/fs/tmpfs/tmpfs_subr.c stable/8/sys/fs/tmpfs/tmpfs_vnops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/fs/tmpfs/tmpfs.h ============================================================================== --- stable/8/sys/fs/tmpfs/tmpfs.h Tue Sep 21 06:47:04 2010 (r212952) +++ stable/8/sys/fs/tmpfs/tmpfs.h Tue Sep 21 07:01:00 2010 (r212953) @@ -72,7 +72,8 @@ struct tmpfs_dirent { * td_namelen field must always be used when accessing its value. */ char * td_name; - /* Pointer to the node this entry refers to. */ + /* Pointer to the node this entry refers to. In case this field + * is NULL, the node is a whiteout. */ struct tmpfs_node * td_node; }; @@ -414,6 +415,8 @@ int tmpfs_dir_getdotdent(struct tmpfs_no int tmpfs_dir_getdotdotdent(struct tmpfs_node *, struct uio *); struct tmpfs_dirent * tmpfs_dir_lookupbycookie(struct tmpfs_node *, off_t); int tmpfs_dir_getdents(struct tmpfs_node *, struct uio *, off_t *); +int tmpfs_dir_whiteout_add(struct vnode *, struct componentname *); +void tmpfs_dir_whiteout_remove(struct vnode *, struct componentname *); int tmpfs_reg_resize(struct vnode *, off_t); int tmpfs_chflags(struct vnode *, int, struct ucred *, struct thread *); int tmpfs_chmod(struct vnode *, mode_t, struct ucred *, struct thread *); Modified: stable/8/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- stable/8/sys/fs/tmpfs/tmpfs_subr.c Tue Sep 21 06:47:04 2010 (r212952) +++ stable/8/sys/fs/tmpfs/tmpfs_subr.c Tue Sep 21 07:01:00 2010 (r212953) @@ -258,7 +258,8 @@ tmpfs_alloc_dirent(struct tmpfs_mount *t memcpy(nde->td_name, name, len); nde->td_node = node; - node->tn_links++; + if (node != NULL) + node->tn_links++; *de = nde; @@ -284,9 +285,10 @@ tmpfs_free_dirent(struct tmpfs_mount *tm struct tmpfs_node *node; node = de->td_node; - - MPASS(node->tn_links > 0); - node->tn_links--; + if (node != NULL) { + MPASS(node->tn_links > 0); + node->tn_links--; + } } free(de->td_name, M_TMPFSNAME); @@ -506,6 +508,8 @@ tmpfs_alloc_file(struct vnode *dvp, stru /* Now that all required items are allocated, we can proceed to * insert the new node into the directory, an operation that * cannot fail. */ + if (cnp->cn_flags & ISWHITEOUT) + tmpfs_dir_whiteout_remove(dvp, cnp); tmpfs_dir_attach(dvp, de); out: @@ -745,39 +749,44 @@ tmpfs_dir_getdents(struct tmpfs_node *no /* Create a dirent structure representing the current * tmpfs_node and fill it. */ - d.d_fileno = de->td_node->tn_id; - switch (de->td_node->tn_type) { - case VBLK: - d.d_type = DT_BLK; - break; - - case VCHR: - d.d_type = DT_CHR; - break; - - case VDIR: - d.d_type = DT_DIR; - break; - - case VFIFO: - d.d_type = DT_FIFO; - break; - - case VLNK: - d.d_type = DT_LNK; - break; - - case VREG: - d.d_type = DT_REG; - break; - - case VSOCK: - d.d_type = DT_SOCK; - break; - - default: - panic("tmpfs_dir_getdents: type %p %d", - de->td_node, (int)de->td_node->tn_type); + if (de->td_node == NULL) { + d.d_fileno = 1; + d.d_type = DT_WHT; + } else { + d.d_fileno = de->td_node->tn_id; + switch (de->td_node->tn_type) { + case VBLK: + d.d_type = DT_BLK; + break; + + case VCHR: + d.d_type = DT_CHR; + break; + + case VDIR: + d.d_type = DT_DIR; + break; + + case VFIFO: + d.d_type = DT_FIFO; + break; + + case VLNK: + d.d_type = DT_LNK; + break; + + case VREG: + d.d_type = DT_REG; + break; + + case VSOCK: + d.d_type = DT_SOCK; + break; + + default: + panic("tmpfs_dir_getdents: type %p %d", + de->td_node, (int)de->td_node->tn_type); + } } d.d_namlen = de->td_namelen; MPASS(de->td_namelen < sizeof(d.d_name)); @@ -814,6 +823,31 @@ tmpfs_dir_getdents(struct tmpfs_node *no return error; } +int +tmpfs_dir_whiteout_add(struct vnode *dvp, struct componentname *cnp) +{ + struct tmpfs_dirent *de; + int error; + + error = tmpfs_alloc_dirent(VFS_TO_TMPFS(dvp->v_mount), NULL, + cnp->cn_nameptr, cnp->cn_namelen, &de); + if (error != 0) + return (error); + tmpfs_dir_attach(dvp, de); + return (0); +} + +void +tmpfs_dir_whiteout_remove(struct vnode *dvp, struct componentname *cnp) +{ + struct tmpfs_dirent *de; + + de = tmpfs_dir_lookup(VP_TO_TMPFS_DIR(dvp), NULL, cnp); + MPASS(de != NULL && de->td_node == NULL); + tmpfs_dir_detach(dvp, de); + tmpfs_free_dirent(VFS_TO_TMPFS(dvp->v_mount), de, TRUE); +} + /* --------------------------------------------------------------------- */ /* Modified: stable/8/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/8/sys/fs/tmpfs/tmpfs_vnops.c Tue Sep 21 06:47:04 2010 (r212952) +++ stable/8/sys/fs/tmpfs/tmpfs_vnops.c Tue Sep 21 07:01:00 2010 (r212953) @@ -103,14 +103,19 @@ tmpfs_lookup(struct vop_cachedlookup_arg error = 0; } else { de = tmpfs_dir_lookup(dnode, NULL, cnp); - if (de == NULL) { + if (de != NULL && de->td_node == NULL) + cnp->cn_flags |= ISWHITEOUT; + if (de == NULL || de->td_node == NULL) { /* The entry was not found in the directory. * This is OK if we are creating or renaming an * entry and are working on the last component of * the path name. */ if ((cnp->cn_flags & ISLASTCN) && (cnp->cn_nameiop == CREATE || \ - cnp->cn_nameiop == RENAME)) { + cnp->cn_nameiop == RENAME || + (cnp->cn_nameiop == DELETE && + cnp->cn_flags & DOWHITEOUT && + cnp->cn_flags & ISWHITEOUT))) { error = VOP_ACCESS(dvp, VWRITE, cnp->cn_cred, cnp->cn_thread); if (error != 0) @@ -757,6 +762,8 @@ tmpfs_remove(struct vop_remove_args *v) /* Remove the entry from the directory; as it is a file, we do not * have to change the number of hard links of the directory. */ tmpfs_dir_detach(dvp, de); + if (v->a_cnp->cn_flags & DOWHITEOUT) + tmpfs_dir_whiteout_add(dvp, v->a_cnp); /* Free the directory entry we just deleted. Note that the node * referred by it will not be removed until the vnode is really @@ -827,6 +834,8 @@ tmpfs_link(struct vop_link_args *v) goto out; /* Insert the new directory entry into the appropriate directory. */ + if (cnp->cn_flags & ISWHITEOUT) + tmpfs_dir_whiteout_remove(dvp, cnp); tmpfs_dir_attach(dvp, de); /* vp link count has changed, so update node times. */ @@ -982,6 +991,10 @@ tmpfs_rename(struct vop_rename_args *v) /* Do the move: just remove the entry from the source directory * and insert it into the target one. */ tmpfs_dir_detach(fdvp, de); + if (fcnp->cn_flags & DOWHITEOUT) + tmpfs_dir_whiteout_add(fdvp, fcnp); + if (tcnp->cn_flags & ISWHITEOUT) + tmpfs_dir_whiteout_remove(tdvp, tcnp); tmpfs_dir_attach(tdvp, de); } @@ -1105,6 +1118,8 @@ tmpfs_rmdir(struct vop_rmdir_args *v) /* Detach the directory entry from the directory (dnode). */ tmpfs_dir_detach(dvp, de); + if (v->a_cnp->cn_flags & DOWHITEOUT) + tmpfs_dir_whiteout_add(dvp, v->a_cnp); node->tn_links--; node->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_CHANGED | \ @@ -1405,6 +1420,29 @@ tmpfs_vptofh(struct vop_vptofh_args *ap) return (0); } +static int +tmpfs_whiteout(struct vop_whiteout_args *ap) +{ + struct vnode *dvp = ap->a_dvp; + struct componentname *cnp = ap->a_cnp; + struct tmpfs_dirent *de; + + switch (ap->a_flags) { + case LOOKUP: + return (0); + case CREATE: + de = tmpfs_dir_lookup(VP_TO_TMPFS_DIR(dvp), NULL, cnp); + if (de != NULL) + return (de->td_node == NULL ? 0 : EEXIST); + return (tmpfs_dir_whiteout_add(dvp, cnp)); + case DELETE: + tmpfs_dir_whiteout_remove(dvp, cnp); + return (0); + default: + panic("tmpfs_whiteout: unknown op"); + } +} + /* --------------------------------------------------------------------- */ /* @@ -1437,6 +1475,7 @@ struct vop_vector tmpfs_vnodeop_entries .vop_print = tmpfs_print, .vop_pathconf = tmpfs_pathconf, .vop_vptofh = tmpfs_vptofh, + .vop_whiteout = tmpfs_whiteout, .vop_bmap = VOP_EOPNOTSUPP, }; From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 07:03:53 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B6BD6106564A; Tue, 21 Sep 2010 07:03:53 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A637D8FC26; Tue, 21 Sep 2010 07:03:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8L73rph082726; Tue, 21 Sep 2010 07:03:53 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8L73rZc082724; Tue, 21 Sep 2010 07:03:53 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <201009210703.o8L73rZc082724@svn.freebsd.org> From: Andrew Thompson Date: Tue, 21 Sep 2010 07:03:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212954 - head/sys/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 07:03:53 -0000 Author: thompsa Date: Tue Sep 21 07:03:53 2010 New Revision: 212954 URL: http://svn.freebsd.org/changeset/base/212954 Log: Fix the path to the sys dir when cross compiling after r209510. Reviewed by: imp Modified: head/sys/conf/newvers.sh Modified: head/sys/conf/newvers.sh ============================================================================== --- head/sys/conf/newvers.sh Tue Sep 21 07:01:00 2010 (r212953) +++ head/sys/conf/newvers.sh Tue Sep 21 07:03:53 2010 (r212954) @@ -91,7 +91,7 @@ case "$d" in */sys/*) SRCDIR=${d##*obj} if [ -n "$MACHINE" ]; then - SRCDIR=${SRCDIR##/$MACHINE} + SRCDIR=${SRCDIR##/$MACHINE.$MACHINE_ARCH} fi SRCDIR=${SRCDIR%%/sys/*} From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 07:43:56 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ED129106566C; Tue, 21 Sep 2010 07:43:56 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DBA7B8FC17; Tue, 21 Sep 2010 07:43:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8L7huVV083696; Tue, 21 Sep 2010 07:43:56 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8L7huVn083694; Tue, 21 Sep 2010 07:43:56 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <201009210743.o8L7huVn083694@svn.freebsd.org> From: Brian Somers Date: Tue, 21 Sep 2010 07:43:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212955 - stable/8/sbin/dhclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 07:43:57 -0000 Author: brian Date: Tue Sep 21 07:43:56 2010 New Revision: 212955 URL: http://svn.freebsd.org/changeset/base/212955 Log: MFC r212253: Document how to use dhclient-{enter,exit}-hooks. PR: 149351 Modified: stable/8/sbin/dhclient/dhclient-script.8 Directory Properties: stable/8/sbin/dhclient/ (props changed) Modified: stable/8/sbin/dhclient/dhclient-script.8 ============================================================================== --- stable/8/sbin/dhclient/dhclient-script.8 Tue Sep 21 07:03:53 2010 (r212954) +++ stable/8/sbin/dhclient/dhclient-script.8 Tue Sep 21 07:43:56 2010 (r212955) @@ -38,7 +38,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 1, 1997 +.Dd September 6, 2010 .Dt DHCLIENT-SCRIPT 8 .Os .Sh NAME @@ -218,6 +218,29 @@ if it has reason to believe they are val If not, it should exit with a nonzero value. .El .Pp +Before taking action according to +.Va $reason , +.Nm +will check for the existence of +.Pa /etc/dhclient-enter-hooks . +If found, it will be sourced +.Pq see Xr sh 1 . +After taking action according to +.Va $reason , +.Nm +will check for the existence of +.Pa /etc/dhclient-exit-hooks . +If found, it will be sourced +.Pq see Xr sh 1 . +These hooks scripts can be used to dynamically modify the enviornment at +appropriate times during the DHCP negotiations. +For example, if the administrator wishes to disable alias IP numbers on +the DHCP interface, they might want to put the following in +.Pa /etc/dhclient-enter-hooks : +.Bd -literal -offset indent +[ ."$reason" = .PREINIT ] && ifconfig $interface 0.0.0.0 +.Ed +.Pp The usual way to test a lease is to set up the network as with .Li REBIND (since this may be called to test more than one lease) and then ping @@ -239,6 +262,7 @@ but current scripts do not do this. .\" and bear the names of the operating systems on which they are intended .\" to work. .Sh SEE ALSO +.Xr sh 1 , .Xr dhclient.conf 5 , .Xr dhclient.leases 5 , .Xr dhclient 8 , From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 07:44:40 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9BC421065696; Tue, 21 Sep 2010 07:44:40 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8ABBF8FC1F; Tue, 21 Sep 2010 07:44:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8L7ieGP083778; Tue, 21 Sep 2010 07:44:40 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8L7iev9083776; Tue, 21 Sep 2010 07:44:40 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <201009210744.o8L7iev9083776@svn.freebsd.org> From: Brian Somers Date: Tue, 21 Sep 2010 07:44:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212956 - stable/7/sbin/dhclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 07:44:40 -0000 Author: brian Date: Tue Sep 21 07:44:40 2010 New Revision: 212956 URL: http://svn.freebsd.org/changeset/base/212956 Log: MFC r212253: Document how to use dhclient-{enter,exit}-hooks. PR: 149351 Modified: stable/7/sbin/dhclient/dhclient-script.8 Directory Properties: stable/7/sbin/dhclient/ (props changed) Modified: stable/7/sbin/dhclient/dhclient-script.8 ============================================================================== --- stable/7/sbin/dhclient/dhclient-script.8 Tue Sep 21 07:43:56 2010 (r212955) +++ stable/7/sbin/dhclient/dhclient-script.8 Tue Sep 21 07:44:40 2010 (r212956) @@ -38,7 +38,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 1, 1997 +.Dd September 6, 2010 .Dt DHCLIENT-SCRIPT 8 .Os .Sh NAME @@ -218,6 +218,29 @@ if it has reason to believe they are val If not, it should exit with a nonzero value. .El .Pp +Before taking action according to +.Va $reason , +.Nm +will check for the existence of +.Pa /etc/dhclient-enter-hooks . +If found, it will be sourced +.Pq see Xr sh 1 . +After taking action according to +.Va $reason , +.Nm +will check for the existence of +.Pa /etc/dhclient-exit-hooks . +If found, it will be sourced +.Pq see Xr sh 1 . +These hooks scripts can be used to dynamically modify the enviornment at +appropriate times during the DHCP negotiations. +For example, if the administrator wishes to disable alias IP numbers on +the DHCP interface, they might want to put the following in +.Pa /etc/dhclient-enter-hooks : +.Bd -literal -offset indent +[ ."$reason" = .PREINIT ] && ifconfig $interface 0.0.0.0 +.Ed +.Pp The usual way to test a lease is to set up the network as with .Li REBIND (since this may be called to test more than one lease) and then ping @@ -239,6 +262,7 @@ but current scripts do not do this. .\" and bear the names of the operating systems on which they are intended .\" to work. .Sh SEE ALSO +.Xr sh 1 , .Xr dhclient.conf 5 , .Xr dhclient.leases 5 , .Xr dhclient 8 , From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 07:58:48 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 297501065670; Tue, 21 Sep 2010 07:58:48 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1886E8FC16; Tue, 21 Sep 2010 07:58:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8L7wlbe084145; Tue, 21 Sep 2010 07:58:47 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8L7wlce084142; Tue, 21 Sep 2010 07:58:47 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201009210758.o8L7wlce084142@svn.freebsd.org> From: "Jayachandran C." Date: Tue, 21 Sep 2010 07:58:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212957 - in head/sys/mips/rmi: . dev/nlge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 07:58:48 -0000 Author: jchandra Date: Tue Sep 21 07:58:47 2010 New Revision: 212957 URL: http://svn.freebsd.org/changeset/base/212957 Log: n32 fixes for nlge. Use correct define (__mips_n64) for n64 compilation and use correct parameter type for xlr_paddr_lw() in n32. Modified: head/sys/mips/rmi/dev/nlge/if_nlge.c head/sys/mips/rmi/rmi_mips_exts.h Modified: head/sys/mips/rmi/dev/nlge/if_nlge.c ============================================================================== --- head/sys/mips/rmi/dev/nlge/if_nlge.c Tue Sep 21 07:44:40 2010 (r212956) +++ head/sys/mips/rmi/dev/nlge/if_nlge.c Tue Sep 21 07:58:47 2010 (r212957) @@ -659,7 +659,7 @@ nlge_msgring_handler(int bucket, int siz if (is_p2p) { release_tx_desc(phys_addr); } else { -#ifdef __mips64 +#ifdef __mips_n64 m = (struct mbuf *)(uintptr_t)xlr_paddr_ld(phys_addr); m->m_nextpkt = NULL; #else @@ -1912,7 +1912,7 @@ prepare_fmn_message(struct nlge_softc *s if (msg_sz == (FMN_SZ - 1)) { p2p = uma_zalloc(nl_tx_desc_zone, M_NOWAIT); if (p2p == NULL) { - return 2; + return (2); } /* * Save the virtual address in the descriptor, @@ -1948,7 +1948,7 @@ prepare_fmn_message(struct nlge_softc *s /* set eop in most-recent p2d */ cur_p2d[-1] |= (1ULL << 63); -#ifdef __mips64 +#ifdef __mips_n64 /* * On n64, we cannot store our mbuf pointer(64 bit) in the freeback * message (40bit available), so we put the mbuf in m_nextpkt and Modified: head/sys/mips/rmi/rmi_mips_exts.h ============================================================================== --- head/sys/mips/rmi/rmi_mips_exts.h Tue Sep 21 07:44:40 2010 (r212956) +++ head/sys/mips/rmi/rmi_mips_exts.h Tue Sep 21 07:58:47 2010 (r212957) @@ -436,7 +436,7 @@ xlr_paddr_ld(uint64_t paddr) #elif defined(__mips_n32) static __inline uint32_t -xlr_paddr_lw(uint32_t paddr) +xlr_paddr_lw(uint64_t paddr) { uint32_t val; From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 08:02:02 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 81C641065670; Tue, 21 Sep 2010 08:02:02 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 718158FC0C; Tue, 21 Sep 2010 08:02:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8L822O6084294; Tue, 21 Sep 2010 08:02:02 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8L822H2084292; Tue, 21 Sep 2010 08:02:02 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009210802.o8L822H2084292@svn.freebsd.org> From: Alexander Motin Date: Tue, 21 Sep 2010 08:02:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212958 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 08:02:02 -0000 Author: mav Date: Tue Sep 21 08:02:02 2010 New Revision: 212958 URL: http://svn.freebsd.org/changeset/base/212958 Log: Until hardclock() and respectively tc_windup() called first time, system is running on "dummy" time counter. But to function properly in one-shot mode, event timer management code requires working time counter. Slow moving "dummy" time counter delays first hardclock() call by few seconds on my systems, even though timer interrupts were correctly kicking kernel. That causes few seconds delay during boot with one-shot mode enabled. To break this loop, explicitly call tc_windup() first time during initialization process to let it switch to some real time counter. Modified: head/sys/kern/kern_tc.c Modified: head/sys/kern/kern_tc.c ============================================================================== --- head/sys/kern/kern_tc.c Tue Sep 21 07:58:47 2010 (r212957) +++ head/sys/kern/kern_tc.c Tue Sep 21 08:02:02 2010 (r212958) @@ -805,6 +805,7 @@ inittimecounter(void *dummy) /* warm up new timecounter (again) and get rolling. */ (void)timecounter->tc_get_timecount(timecounter); (void)timecounter->tc_get_timecount(timecounter); + tc_windup(); } SYSINIT(timecounter, SI_SUB_CLOCKS, SI_ORDER_SECOND, inittimecounter, NULL); From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 08:25:00 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EE93610656EF; Tue, 21 Sep 2010 08:25:00 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DE6838FC15; Tue, 21 Sep 2010 08:25:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8L8P0th084861; Tue, 21 Sep 2010 08:25:00 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8L8P0L0084859; Tue, 21 Sep 2010 08:25:00 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201009210825.o8L8P0L0084859@svn.freebsd.org> From: Ed Schouten Date: Tue, 21 Sep 2010 08:25:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212959 - head/sbin/mount_unionfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 08:25:01 -0000 Author: ed Date: Tue Sep 21 08:25:00 2010 New Revision: 212959 URL: http://svn.freebsd.org/changeset/base/212959 Log: Add a notice to the man page that batteries should be installed. Modified: head/sbin/mount_unionfs/mount_unionfs.8 Modified: head/sbin/mount_unionfs/mount_unionfs.8 ============================================================================== --- head/sbin/mount_unionfs/mount_unionfs.8 Tue Sep 21 08:02:02 2010 (r212958) +++ head/sbin/mount_unionfs/mount_unionfs.8 Tue Sep 21 08:25:00 2010 (r212959) @@ -353,6 +353,7 @@ USE AT YOUR OWN RISK. BEWARE OF DOG. SLIPPERY WHEN WET. +BATTERIES NOT INCLUDED. .Pp This code also needs an owner in order to be less dangerous - serious hackers can apply by sending mail to From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 09:33:44 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6D6C21065675; Tue, 21 Sep 2010 09:33:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5C9B38FC12; Tue, 21 Sep 2010 09:33:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8L9XiZJ086548; Tue, 21 Sep 2010 09:33:44 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8L9XiVF086546; Tue, 21 Sep 2010 09:33:44 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201009210933.o8L9XiVF086546@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 21 Sep 2010 09:33:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212960 - stable/8/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 09:33:44 -0000 Author: kib Date: Tue Sep 21 09:33:44 2010 New Revision: 212960 URL: http://svn.freebsd.org/changeset/base/212960 Log: MFC r212618: Rename the field to not confuse readers. The bytes are actually used. Modified: stable/8/sys/sys/mount.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/sys/mount.h ============================================================================== --- stable/8/sys/sys/mount.h Tue Sep 21 08:25:00 2010 (r212959) +++ stable/8/sys/sys/mount.h Tue Sep 21 09:33:44 2010 (r212960) @@ -56,7 +56,7 @@ typedef struct fsid { int32_t val[2]; } struct fid { u_short fid_len; /* length of data in bytes */ - u_short fid_reserved; /* force longword alignment */ + u_short fid_data0; /* force longword alignment */ char fid_data[MAXFIDSZ]; /* data (variable length) */ }; From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 10:22:29 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 811FF1065670; Tue, 21 Sep 2010 10:22:29 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 704DF8FC1E; Tue, 21 Sep 2010 10:22:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8LAMTqS087770; Tue, 21 Sep 2010 10:22:29 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8LAMT1R087767; Tue, 21 Sep 2010 10:22:29 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201009211022.o8LAMT1R087767@svn.freebsd.org> From: Rui Paulo Date: Tue, 21 Sep 2010 10:22:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212961 - in head/crypto/openssl/crypto: . rc5 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 10:22:29 -0000 Author: rpaulo Date: Tue Sep 21 10:22:29 2010 New Revision: 212961 URL: http://svn.freebsd.org/changeset/base/212961 Log: Bring in OpenSSL checkin 19821: Make inline assembler clang-friendly [from HEAD]. openssl/crypto/md32_common.h 1.45.2.1 -> 1.45.2.2 openssl/crypto/rc5/rc5_locl.h 1.8 -> 1.8.8.1 Approved by: simon Modified: head/crypto/openssl/crypto/md32_common.h head/crypto/openssl/crypto/rc5/rc5_locl.h Modified: head/crypto/openssl/crypto/md32_common.h ============================================================================== --- head/crypto/openssl/crypto/md32_common.h Tue Sep 21 09:33:44 2010 (r212960) +++ head/crypto/openssl/crypto/md32_common.h Tue Sep 21 10:22:29 2010 (r212961) @@ -165,7 +165,7 @@ asm ( \ "roll %1,%0" \ : "=r"(ret) \ - : "I"(n), "0"(a) \ + : "I"(n), "0"((unsigned int)(a)) \ : "cc"); \ ret; \ }) @@ -383,6 +383,7 @@ int HASH_FINAL (unsigned char *md, HASH_ } #ifndef MD32_REG_T +#if defined(__alpha) || defined(__sparcv9) || defined(__mips) #define MD32_REG_T long /* * This comment was originaly written for MD5, which is why it @@ -400,9 +401,15 @@ int HASH_FINAL (unsigned char *md, HASH_ * Well, to be honest it should say that this *prevents* * performance degradation. * - * Apparently there're LP64 compilers that generate better - * code if A-D are declared int. Most notably GCC-x86_64 - * generates better code. + */ +#else +/* + * Above is not absolute and there are LP64 compilers that + * generate better code if MD32_REG_T is defined int. The above + * pre-processor condition reflects the circumstances under which + * the conclusion was made and is subject to further extension. * */ +#define MD32_REG_T int +#endif #endif Modified: head/crypto/openssl/crypto/rc5/rc5_locl.h ============================================================================== --- head/crypto/openssl/crypto/rc5/rc5_locl.h Tue Sep 21 09:33:44 2010 (r212960) +++ head/crypto/openssl/crypto/rc5/rc5_locl.h Tue Sep 21 10:22:29 2010 (r212961) @@ -154,14 +154,14 @@ # define ROTATE_l32(a,n) ({ register unsigned int ret; \ asm ("roll %%cl,%0" \ : "=r"(ret) \ - : "c"(n),"0"(a) \ + : "c"(n),"0"((unsigned int)(a)) \ : "cc"); \ ret; \ }) # define ROTATE_r32(a,n) ({ register unsigned int ret; \ asm ("rorl %%cl,%0" \ : "=r"(ret) \ - : "c"(n),"0"(a) \ + : "c"(n),"0"((unsigned int)(a)) \ : "cc"); \ ret; \ }) From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 10:24:29 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0BDFC1065694; Tue, 21 Sep 2010 10:24:29 +0000 (UTC) (envelope-from prvs=18736308cf=brian@Awfulhak.org) Received: from idcmail-mo2no.shaw.ca (idcmail-mo2no.shaw.ca [64.59.134.9]) by mx1.freebsd.org (Postfix) with ESMTP id 9F2BD8FC22; Tue, 21 Sep 2010 10:24:28 +0000 (UTC) Received: from pd6ml2no-ssvc.prod.shaw.ca ([10.0.153.163]) by pd5mo1no-svcs.prod.shaw.ca with ESMTP; 21 Sep 2010 04:09:26 -0600 X-Cloudmark-SP-Filtered: true X-Cloudmark-SP-Result: v=1.1 cv=Mj7okGGiyvljez8nourwAOSCyIXzraNcHEi86Qy5a+Y= c=1 sm=1 a=nwdpmwd4ttUA:10 a=BLceEmwcHowA:10 a=kj9zAlcOel0A:10 a=MJPcHhXccCG8eBs0us8XwA==:17 a=PO7r1zJSAAAA:8 a=MMwg4So0AAAA:8 a=6I5d2MoRAAAA:8 a=W9iI6s1Q80laVmV6a0wA:9 a=L7jCreETJnLBE5ugy_8A:7 a=7Scn8inXKID6XUUMbpi4eBYh2kMA:4 a=CjuIK1q_8ugA:10 a=WJ3hkfHDukgA:10 a=SV7veod9ZcQA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 Received: from unknown (HELO store.lan.Awfulhak.org) ([70.79.162.198]) by pd6ml2no-dmz.prod.shaw.ca with ESMTP; 21 Sep 2010 04:09:25 -0600 Received: from store.lan.Awfulhak.org (localhost.localdomain [127.0.0.1]) by localhost (Email Security Appliance) with SMTP id 5DB51C433C1_C988455B; Tue, 21 Sep 2010 10:09:25 +0000 (GMT) Received: from gw.Awfulhak.org (gw.lan.Awfulhak.org [172.16.0.1]) by store.lan.Awfulhak.org (Sophos Email Appliance) with ESMTP id EE735C460F8_C988450F; Tue, 21 Sep 2010 10:09:20 +0000 (GMT) Received: from dev.lan.Awfulhak.org (brian@dev.lan.Awfulhak.org [172.16.0.5]) by gw.Awfulhak.org (8.14.4/8.14.4) with ESMTP id o8LA9KFr096704; Tue, 21 Sep 2010 03:09:20 -0700 (PDT) (envelope-from brian@Awfulhak.org) Date: Tue, 21 Sep 2010 03:09:16 -0700 From: Brian Somers To: Bruce Evans Message-ID: <20100921030916.3ee375c6@dev.lan.Awfulhak.org> In-Reply-To: <20100920163758.A788@besplex.bde.org> References: <201009200420.o8K4KtKn026514@svn.freebsd.org> <20100920163758.A788@besplex.bde.org> X-Mailer: Claws Mail 3.7.6 (GTK+ 2.20.1; i386-portbld-freebsd9.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, Marcel Moolenaar , src-committers@FreeBSD.org Subject: Re: svn commit: r212886 - head/sbin/growfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 10:24:29 -0000 On Mon, 20 Sep 2010 16:55:57 +1000 (EST) Bruce Evans wrote: > On Mon, 20 Sep 2010, Marcel Moolenaar wrote: > > > Log: > > Unbreak the build on strong-aligned architectures (arm, ia64). > > Casting from (char *) to (struct ufs1_dinode *) changes the > > alignment requirement of the pointer and GCC does not know that > > the pointer is adequately aligned (due to malloc(3)), and warns > > about it. Cast to (void *) first to by-pass the check. > > A previous version in which the pointer (iobuf) the correct type to > begin with was better. It used to have type void *, but now has type > caddr_t (whose existence is a bug), in order to abuse caddr_t by > assuming that it is char * to do pointer arithmetic on it in 1 place > (iobuf + sblock.fs_cgsize). The 7 other places where iobuf is used > only assume that caddr_t is a pointer (or perhaps a [u]intptr_t). > > growfs has no other instances of caddr_t. Maybe iobuf ought to go back to being a void * with casting where the arithmetic happens. If it's changed, newfs/mkfs.c should probably change too. Is there some subtle difference that makes the casting ok in newfs/mkfs.c: dp1 = (struct ufs1_dinode *)(&iobuf[start]); and not ok in growfs/growfs.c r212885: dp1 = (struct ufs1_dinode *)iobuf; or is it just ignored because WARNS is 3 for newfs and is defaulted to 6 for growfs? -- Brian Somers Don't _EVER_ lose your sense of humour ! From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 11:50:03 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C392106564A; Tue, 21 Sep 2010 11:50:03 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail05.syd.optusnet.com.au (mail05.syd.optusnet.com.au [211.29.132.186]) by mx1.freebsd.org (Postfix) with ESMTP id 877408FC17; Tue, 21 Sep 2010 11:50:02 +0000 (UTC) Received: from besplex.bde.org (c122-107-116-249.carlnfd1.nsw.optusnet.com.au [122.107.116.249]) by mail05.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o8LBns85019041 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 21 Sep 2010 21:49:55 +1000 Date: Tue, 21 Sep 2010 21:49:53 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Brian Somers In-Reply-To: <20100921030916.3ee375c6@dev.lan.Awfulhak.org> Message-ID: <20100921213906.D14718@besplex.bde.org> References: <201009200420.o8K4KtKn026514@svn.freebsd.org> <20100920163758.A788@besplex.bde.org> <20100921030916.3ee375c6@dev.lan.Awfulhak.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, Marcel Moolenaar , Bruce Evans , src-committers@FreeBSD.org Subject: Re: svn commit: r212886 - head/sbin/growfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 11:50:03 -0000 On Tue, 21 Sep 2010, Brian Somers wrote: > On Mon, 20 Sep 2010 16:55:57 +1000 (EST) Bruce Evans wrote: >> On Mon, 20 Sep 2010, Marcel Moolenaar wrote: >> >>> Log: >>> Unbreak the build on strong-aligned architectures (arm, ia64). >>> Casting from (char *) to (struct ufs1_dinode *) changes the >>> alignment requirement of the pointer and GCC does not know that >>> the pointer is adequately aligned (due to malloc(3)), and warns >>> about it. Cast to (void *) first to by-pass the check. >> >> A previous version in which the pointer (iobuf) the correct type to >> begin with was better. It used to have type void *, but now has type >> ... > > Maybe iobuf ought to go back to being a void * with casting where the > arithmetic happens. If it's changed, newfs/mkfs.c should probably change > too. > > Is there some subtle difference that makes the casting ok in newfs/mkfs.c: > > dp1 = (struct ufs1_dinode *)(&iobuf[start]); > > and not ok in growfs/growfs.c r212885: > > dp1 = (struct ufs1_dinode *)iobuf; > > or is it just ignored because WARNS is 3 for newfs and is defaulted to 6 for growfs? Just because of WARNS. The `caddr_t iobuf;' in newfs is really old and should be fixed someday. It is the only caddr_t remaining in newfs. In Lite2, newfs also uses caddr_t for its now-dead mfs parts, including for its replacements for the malloc() family which were errors in theory even at the time of Lite2 and which are now errors in practice. Bruce From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 12:55:20 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E79261065672; Tue, 21 Sep 2010 12:55:20 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D656A8FC1D; Tue, 21 Sep 2010 12:55:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8LCtKEa094880; Tue, 21 Sep 2010 12:55:20 GMT (envelope-from tijl@svn.freebsd.org) Received: (from tijl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8LCtKdB094877; Tue, 21 Sep 2010 12:55:20 GMT (envelope-from tijl@svn.freebsd.org) Message-Id: <201009211255.o8LCtKdB094877@svn.freebsd.org> From: Tijl Coosemans Date: Tue, 21 Sep 2010 12:55:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212962 - stable/8/gnu/lib/libstdc++ X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 12:55:21 -0000 Author: tijl Date: Tue Sep 21 12:55:20 2010 New Revision: 212962 URL: http://svn.freebsd.org/changeset/base/212962 Log: MFC r212286: GCC defines built-ins for atomic instructions found on i486 and higher. Because FreeBSD no longer supports the 80386 cpu all code targeting FreeBSD/i386 necessarily runs on i486 or higher so the compiler built-ins can be used by default inside libstdc++ and in C++ headers. This allows newly compiled C++ code to inline some atomic operations. Old binaries continue to use libstdc++ functions. PR: 148926 Tested by: Yuri Karaban Approved by: kib (mentor) Modified: stable/8/gnu/lib/libstdc++/Makefile stable/8/gnu/lib/libstdc++/config.h Directory Properties: stable/8/gnu/lib/libstdc++/ (props changed) Modified: stable/8/gnu/lib/libstdc++/Makefile ============================================================================== --- stable/8/gnu/lib/libstdc++/Makefile Tue Sep 21 10:22:29 2010 (r212961) +++ stable/8/gnu/lib/libstdc++/Makefile Tue Sep 21 12:55:20 2010 (r212962) @@ -81,7 +81,7 @@ ATOMICITY_H= ${SRCDIR}/config/cpu/${MARC ATOMICITY_H= ${SRCDIR}/config/cpu/generic/atomicity_mutex/atomicity.h .endif -.if ${MACHINE_ARCH} == "amd64" +.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" .if exists(${SRCDIR}/config/cpu/generic/atomicity_builtins/atomicity.h) ATOMICITY_H= ${SRCDIR}/config/cpu/generic/atomicity_builtins/atomicity.h .endif Modified: stable/8/gnu/lib/libstdc++/config.h ============================================================================== --- stable/8/gnu/lib/libstdc++/config.h Tue Sep 21 10:22:29 2010 (r212961) +++ stable/8/gnu/lib/libstdc++/config.h Tue Sep 21 12:55:20 2010 (r212962) @@ -671,7 +671,7 @@ /* #undef VERSION */ /* Define if builtin atomic operations are supported on this host. */ -#if defined(__amd64__) +#if defined(__amd64__) || defined(__i386__) #define _GLIBCXX_ATOMIC_BUILTINS 1 #endif From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 12:57:44 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 45F081065670; Tue, 21 Sep 2010 12:57:44 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 348A88FC19; Tue, 21 Sep 2010 12:57:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8LCviu5094953; Tue, 21 Sep 2010 12:57:44 GMT (envelope-from tijl@svn.freebsd.org) Received: (from tijl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8LCvi4a094950; Tue, 21 Sep 2010 12:57:44 GMT (envelope-from tijl@svn.freebsd.org) Message-Id: <201009211257.o8LCvi4a094950@svn.freebsd.org> From: Tijl Coosemans Date: Tue, 21 Sep 2010 12:57:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212963 - stable/7/gnu/lib/libstdc++ X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 12:57:44 -0000 Author: tijl Date: Tue Sep 21 12:57:43 2010 New Revision: 212963 URL: http://svn.freebsd.org/changeset/base/212963 Log: MFC r212286: GCC defines built-ins for atomic instructions found on i486 and higher. Because FreeBSD no longer supports the 80386 cpu all code targeting FreeBSD/i386 necessarily runs on i486 or higher so the compiler built-ins can be used by default inside libstdc++ and in C++ headers. This allows newly compiled C++ code to inline some atomic operations. Old binaries continue to use libstdc++ functions. Approved by: kib (mentor) Modified: stable/7/gnu/lib/libstdc++/Makefile stable/7/gnu/lib/libstdc++/config.h Directory Properties: stable/7/gnu/lib/libstdc++/ (props changed) Modified: stable/7/gnu/lib/libstdc++/Makefile ============================================================================== --- stable/7/gnu/lib/libstdc++/Makefile Tue Sep 21 12:55:20 2010 (r212962) +++ stable/7/gnu/lib/libstdc++/Makefile Tue Sep 21 12:57:43 2010 (r212963) @@ -82,7 +82,7 @@ ATOMICITY_H= ${SRCDIR}/config/cpu/${MARC ATOMICITY_H= ${SRCDIR}/config/cpu/generic/atomicity_mutex/atomicity.h .endif -.if ${MACHINE_ARCH} == "amd64" +.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" .if exists(${SRCDIR}/config/cpu/generic/atomicity_builtins/atomicity.h) ATOMICITY_H= ${SRCDIR}/config/cpu/generic/atomicity_builtins/atomicity.h .endif Modified: stable/7/gnu/lib/libstdc++/config.h ============================================================================== --- stable/7/gnu/lib/libstdc++/config.h Tue Sep 21 12:55:20 2010 (r212962) +++ stable/7/gnu/lib/libstdc++/config.h Tue Sep 21 12:57:43 2010 (r212963) @@ -671,7 +671,7 @@ /* #undef VERSION */ /* Define if builtin atomic operations are supported on this host. */ -#if defined(__amd64__) +#if defined(__amd64__) || defined(__i386__) #define _GLIBCXX_ATOMIC_BUILTINS 1 #endif From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 15:07:45 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 409871065673; Tue, 21 Sep 2010 15:07:45 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ED2D68FC12; Tue, 21 Sep 2010 15:07:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8LF7iCm097678; Tue, 21 Sep 2010 15:07:44 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8LF7iVv097676; Tue, 21 Sep 2010 15:07:44 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201009211507.o8LF7iVv097676@svn.freebsd.org> From: Andriy Gapon Date: Tue, 21 Sep 2010 15:07:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 15:07:45 -0000 Author: avg Date: Tue Sep 21 15:07:44 2010 New Revision: 212964 URL: http://svn.freebsd.org/changeset/base/212964 Log: kdb_backtrace: stack(9)-based code to print backtrace without any backend The idea is to add KDB and KDB_TRACE options to GENERIC kernels on stable branches, so that at least the minimal information is produced for non-specific panics like traps on page faults. The GENERICs in stable branches seem to already include STACK option. Reviewed by: attilio MFC after: 2 weeks Modified: head/sys/kern/subr_kdb.c Modified: head/sys/kern/subr_kdb.c ============================================================================== --- head/sys/kern/subr_kdb.c Tue Sep 21 12:57:43 2010 (r212963) +++ head/sys/kern/subr_kdb.c Tue Sep 21 15:07:44 2010 (r212964) @@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$"); #include "opt_kdb.h" +#include "opt_stack.h" #include #include @@ -37,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -300,6 +302,15 @@ kdb_backtrace(void) printf("KDB: stack backtrace:\n"); kdb_dbbe->dbbe_trace(); } +#ifdef STACK + else { + struct stack st; + + printf("KDB: stack backtrace:\n"); + stack_save(&st); + stack_print(&st); + } +#endif } /* From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 15:17:03 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8B9B61065670; Tue, 21 Sep 2010 15:17:03 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-gx0-f182.google.com (mail-gx0-f182.google.com [209.85.161.182]) by mx1.freebsd.org (Postfix) with ESMTP id 1CDFE8FC12; Tue, 21 Sep 2010 15:17:02 +0000 (UTC) Received: by gxk8 with SMTP id 8so2091545gxk.13 for ; Tue, 21 Sep 2010 08:17:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=V2xc3q4X5C6vy8U1zbtLAnR8IigBbSsdBkoRvDQjmfM=; b=x62LCCJi6/KoB5I9SaeybeRTJWkRCOGfcD2vKgPnJLi2NnDbjeA64ZxOu5+VwX5upw goBLBoyIgq2umXcR4Wf+ZfFgkgevmlwSpJfWPXXaB9qv+kv/IG7kggnK5DS3bIRdeqhT i4H4RSYnnYkaJcseSm4sqkxOqgLGTR/kkRLsk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=J1CcG5bFpkhry1V93jDHU3t0CvYKlVVcH9DkUWisAbOEUW7zTcklTJ32nEfDelpd2r TL0ZDfgXKmGUwrY1KB648Up51WAUfgPHdael5ULitVoo4wNqqjgz7BtNLeCC0TkyLXjd d/uWnyw/nSxGvrVE+5Jcr5vqKNwiy00V06BUc= MIME-Version: 1.0 Received: by 10.100.42.13 with SMTP id p13mr11241781anp.54.1285082221776; Tue, 21 Sep 2010 08:17:01 -0700 (PDT) Sender: mdf356@gmail.com Received: by 10.231.187.71 with HTTP; Tue, 21 Sep 2010 08:17:01 -0700 (PDT) In-Reply-To: <201009211507.o8LF7iVv097676@svn.freebsd.org> References: <201009211507.o8LF7iVv097676@svn.freebsd.org> Date: Tue, 21 Sep 2010 08:17:01 -0700 X-Google-Sender-Auth: UQ1TutHYuhLihrRa0T4fJl2xZYk Message-ID: From: mdf@FreeBSD.org To: Andriy Gapon Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 15:17:03 -0000 On Tue, Sep 21, 2010 at 8:07 AM, Andriy Gapon wrote: > Author: avg > Date: Tue Sep 21 15:07:44 2010 > New Revision: 212964 > URL: http://svn.freebsd.org/changeset/base/212964 > > Log: > =A0kdb_backtrace: stack(9)-based code to print backtrace without any back= end > > =A0The idea is to add KDB and KDB_TRACE options to GENERIC kernels on > =A0stable branches, so that at least the minimal information is produced > =A0for non-specific panics like traps on page faults. > =A0The GENERICs in stable branches seem to already include STACK option. > > =A0Reviewed by: =A0attilio > =A0MFC after: =A0 =A02 weeks > > Modified: > =A0head/sys/kern/subr_kdb.c > > Modified: head/sys/kern/subr_kdb.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/subr_kdb.c =A0 =A0Tue Sep 21 12:57:43 2010 =A0 =A0 =A0 = =A0(r212963) > +++ head/sys/kern/subr_kdb.c =A0 =A0Tue Sep 21 15:07:44 2010 =A0 =A0 =A0 = =A0(r212964) > @@ -28,6 +28,7 @@ > =A0__FBSDID("$FreeBSD$"); > > =A0#include "opt_kdb.h" > +#include "opt_stack.h" > > =A0#include > =A0#include > @@ -37,6 +38,7 @@ __FBSDID("$FreeBSD$"); > =A0#include > =A0#include > =A0#include > +#include > =A0#include > > =A0#include > @@ -300,6 +302,15 @@ kdb_backtrace(void) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0printf("KDB: stack backtrace:\n"); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0kdb_dbbe->dbbe_trace(); > =A0 =A0 =A0 =A0} > +#ifdef STACK > + =A0 =A0 =A0 else { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 struct stack st; > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 printf("KDB: stack backtrace:\n"); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 stack_save(&st); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 stack_print(&st); I'd recommend using stack_print_ddb(), as that avoids any locking which may hang depending on how the kernel panic'd. Thanks, matthew > + =A0 =A0 =A0 } > +#endif > =A0} > > =A0/* > From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 15:27:38 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A45FC1065672; Tue, 21 Sep 2010 15:27:38 +0000 (UTC) (envelope-from avg@freebsd.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 5696E8FC12; Tue, 21 Sep 2010 15:27:37 +0000 (UTC) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id SAA09128; Tue, 21 Sep 2010 18:27:35 +0300 (EEST) (envelope-from avg@freebsd.org) Message-ID: <4C98CEE7.6060802@freebsd.org> Date: Tue, 21 Sep 2010 18:27:35 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.9) Gecko/20100920 Lightning/1.0b2 Thunderbird/3.1.4 MIME-Version: 1.0 To: mdf@freebsd.org References: <201009211507.o8LF7iVv097676@svn.freebsd.org> In-Reply-To: X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 15:27:38 -0000 on 21/09/2010 18:17 mdf@FreeBSD.org said the following: > On Tue, Sep 21, 2010 at 8:07 AM, Andriy Gapon wrote: >> Author: avg >> Date: Tue Sep 21 15:07:44 2010 >> New Revision: 212964 >> URL: http://svn.freebsd.org/changeset/base/212964 >> >> Log: >> kdb_backtrace: stack(9)-based code to print backtrace without any backend >> >> The idea is to add KDB and KDB_TRACE options to GENERIC kernels on >> stable branches, so that at least the minimal information is produced >> for non-specific panics like traps on page faults. >> The GENERICs in stable branches seem to already include STACK option. >> >> Reviewed by: attilio >> MFC after: 2 weeks >> >> Modified: >> head/sys/kern/subr_kdb.c >> >> Modified: head/sys/kern/subr_kdb.c >> ============================================================================== >> --- head/sys/kern/subr_kdb.c Tue Sep 21 12:57:43 2010 (r212963) >> +++ head/sys/kern/subr_kdb.c Tue Sep 21 15:07:44 2010 (r212964) >> @@ -28,6 +28,7 @@ >> __FBSDID("$FreeBSD$"); >> >> #include "opt_kdb.h" >> +#include "opt_stack.h" >> >> #include >> #include >> @@ -37,6 +38,7 @@ __FBSDID("$FreeBSD$"); >> #include >> #include >> #include >> +#include >> #include >> >> #include >> @@ -300,6 +302,15 @@ kdb_backtrace(void) >> printf("KDB: stack backtrace:\n"); >> kdb_dbbe->dbbe_trace(); >> } >> +#ifdef STACK >> + else { >> + struct stack st; >> + >> + printf("KDB: stack backtrace:\n"); >> + stack_save(&st); >> + stack_print(&st); > > I'd recommend using stack_print_ddb(), as that avoids any locking > which may hang depending on how the kernel panic'd. It seems that stack_print_ddb() depends on DDB? -- Andriy Gapon From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 15:40:52 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 12E501065673; Tue, 21 Sep 2010 15:40:51 +0000 (UTC) (envelope-from avg@freebsd.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 114308FC1B; Tue, 21 Sep 2010 15:40:49 +0000 (UTC) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id SAA09398; Tue, 21 Sep 2010 18:40:48 +0300 (EEST) (envelope-from avg@freebsd.org) Message-ID: <4C98D200.4040909@freebsd.org> Date: Tue, 21 Sep 2010 18:40:48 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.9) Gecko/20100920 Lightning/1.0b2 Thunderbird/3.1.4 MIME-Version: 1.0 To: mdf@freebsd.org References: <201009211507.o8LF7iVv097676@svn.freebsd.org> <4C98CEE7.6060802@freebsd.org> In-Reply-To: <4C98CEE7.6060802@freebsd.org> X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 15:40:52 -0000 on 21/09/2010 18:27 Andriy Gapon said the following: > on 21/09/2010 18:17 mdf@FreeBSD.org said the following: >> >> I'd recommend using stack_print_ddb(), as that avoids any locking >> which may hang depending on how the kernel panic'd. > > It seems that stack_print_ddb() depends on DDB? But the point about locking is very good. How do you suggest we can deal with it? A dirty hack would be to check panicstr in linker_search_symbol_name and avoid locking, but I don't like that at all. Perhaps, some code in subr_stack.c could be taken outside DDB ifdef? Thank you! -- Andriy Gapon From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 15:48:23 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D8D4E106567A; Tue, 21 Sep 2010 15:48:23 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id 288108FC26; Tue, 21 Sep 2010 15:48:22 +0000 (UTC) Received: by qwg5 with SMTP id 5so4961379qwg.13 for ; Tue, 21 Sep 2010 08:48:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type; bh=ls+dToSLXVfuAz7a+c2dZYvjxWv5dxXwEoW5UkbnFpM=; b=fatzqq8ZLXE+Q2eMLeq6ZKrlM9h4ECazy21MQWA8gvlRszHULFMz6Vsu4LQpdlA43B Yr/JQLtYFXaxSOuRoSKQqFrRVbkTDiQTEQYR+S8Y9mLW+K5EnPE6KnqUjVd5UW/Bl6Lx EQFZZZ5q3M5yZ+wH37zkMeRqNNTcgX1tQ/3Ps= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=eHqGBpBjjs8Vn2f3EhtbPePrXzKU9E6HMgnpAifPI6S+TXLf7p5MuHbey7MX//qYxm QW4iI5zGJm+sFuW2lyCPl5/mlqfLooxejCsXbQKTTdw0Q50/mGpNb8ia3dCyy1HW7a6N 4wvcDOy62hNXJnqA7LcK+bmgGAz12bW13uDWk= MIME-Version: 1.0 Received: by 10.224.19.205 with SMTP id c13mr697474qab.63.1285084101966; Tue, 21 Sep 2010 08:48:21 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.229.235.143 with HTTP; Tue, 21 Sep 2010 08:48:21 -0700 (PDT) In-Reply-To: <4C98D200.4040909@freebsd.org> References: <201009211507.o8LF7iVv097676@svn.freebsd.org> <4C98CEE7.6060802@freebsd.org> <4C98D200.4040909@freebsd.org> Date: Tue, 21 Sep 2010 17:48:21 +0200 X-Google-Sender-Auth: Z0xkzM2JKhf6IagNM-lheL6zy94 Message-ID: From: Attilio Rao To: Andriy Gapon Content-Type: text/plain; charset=UTF-8 Cc: svn-src-head@freebsd.org, mdf@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 15:48:24 -0000 2010/9/21 Andriy Gapon : > on 21/09/2010 18:27 Andriy Gapon said the following: >> on 21/09/2010 18:17 mdf@FreeBSD.org said the following: >>> >>> I'd recommend using stack_print_ddb(), as that avoids any locking >>> which may hang depending on how the kernel panic'd. >> >> It seems that stack_print_ddb() depends on DDB? > > But the point about locking is very good. > How do you suggest we can deal with it? > > A dirty hack would be to check panicstr in linker_search_symbol_name and avoid > locking, but I don't like that at all. > Perhaps, some code in subr_stack.c could be taken outside DDB ifdef? It heavilly depends on DDB, I'd say to just leave as the code is now. Thanks, Attilio -- Peace can only be achieved by understanding - A. Einstein From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 15:52:07 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A35D8106564A; Tue, 21 Sep 2010 15:52:07 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 5C7AE8FC16; Tue, 21 Sep 2010 15:52:07 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id o8LFhn6E078851; Tue, 21 Sep 2010 09:43:50 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Tue, 21 Sep 2010 09:43:57 -0600 (MDT) Message-Id: <20100921.094357.999284355964747902.imp@bsdimp.com> To: thompsa@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <20100920.230006.634347869592887498.imp@bsdimp.com> References: <201006241632.o5OGWKBb040575@svn.freebsd.org> <20100920.230006.634347869592887498.imp@bsdimp.com> X-Mailer: Mew version 6.3 on Emacs 22.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r209510 - head X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 15:52:07 -0000 In message: <20100920.230006.634347869592887498.imp@bsdimp.com> "M. Warner Losh" writes: : In message: : Andrew Thompson writes: : : On 25 June 2010 04:32, Warner Losh wrote: : : > Author: imp : : > Date: Thu Jun 24 16:32:20 2010 : : > New Revision: 209510 : : > URL: http://svn.freebsd.org/changeset/base/209510 : : > : : > Log: : : > =A0Merge from tbemd: : : > : : > =A0change the name of the object tree from ${TARGET} to : : > =A0${TARGET}.${TARGET_ARCH} so we can do both big and little endi= an : : > =A0builds in the same tree. : : = : : This seems to have broken the VCS string in vers.c, does this look = ok? : : = : : Index: sys/conf/newvers.sh : : =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/conf/newvers.sh (revision 212945) : : +++ sys/conf/newvers.sh (working copy) : : @@ -91,7 +91,7 @@ case "$d" in : : */sys/*) : : SRCDIR=3D${d##*obj} : : if [ -n "$MACHINE" ]; then : : - SRCDIR=3D${SRCDIR##/$MACHINE} : : + SRCDIR=3D${SRCDIR##/$MACHINE.$MACHINE_ARCH} : : fi : : SRCDIR=3D${SRCDIR%%/sys/*} : = : Sure. 3 months to notice... : = : I think this may be because I don't have these lines anymore in my : newvers.sh... I guess what I was trying to say was that this change shouldn't be a problem. However, I've completely gutted that section of newvers.sh, since it isn't necessary, and have been running with it since before BSDcan. Maybe I'll just commit it... Warner From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 16:14:57 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 170761065670; Tue, 21 Sep 2010 16:14:57 +0000 (UTC) (envelope-from avg@freebsd.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id C0BC28FC19; Tue, 21 Sep 2010 16:14:55 +0000 (UTC) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id TAA10128; Tue, 21 Sep 2010 19:14:53 +0300 (EEST) (envelope-from avg@freebsd.org) Message-ID: <4C98D9FD.4050809@freebsd.org> Date: Tue, 21 Sep 2010 19:14:53 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.9) Gecko/20100920 Lightning/1.0b2 Thunderbird/3.1.4 MIME-Version: 1.0 To: mdf@freebsd.org References: <201009211507.o8LF7iVv097676@svn.freebsd.org> In-Reply-To: X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 16:14:57 -0000 on 21/09/2010 18:17 mdf@FreeBSD.org said the following: > I'd recommend using stack_print_ddb(), as that avoids any locking > which may hang depending on how the kernel panic'd. How does the following look to you? I hope I haven't freed too much from under DDB. The patch compiles fine with STACK && !DDB. --- a/sys/kern/kern_linker.c +++ b/sys/kern/kern_linker.c @@ -924,7 +924,6 @@ linker_debug_search_symbol_name return (0); } -#ifdef DDB /* * DDB Helpers. DDB has to look across multiple files with their own symbol * tables and string tables. @@ -933,12 +932,14 @@ linker_debug_search_symbol_name * DDB to hang because somebody's got the lock held. We'll take the chance * that the files list is inconsistant instead. */ +#ifdef DDB int linker_ddb_lookup(const char *symstr, c_linker_sym_t *sym) { return (linker_debug_lookup(symstr, sym)); } +#endif int linker_ddb_search_symbol(caddr_t value, c_linker_sym_t *sym, long *diffp) @@ -961,7 +962,6 @@ linker_ddb_search_symbol_name return (linker_debug_search_symbol_name(value, buf, buflen, offset)); } -#endif /* * stack(9) helper for non-debugging environemnts. Unlike DDB helpers, we do --- a/sys/kern/subr_kdb.c +++ b/sys/kern/subr_kdb.c @@ -308,7 +308,7 @@ kdb_backtrace(void) printf("KDB: stack backtrace:\n"); stack_save(&st); - stack_print(&st); + stack_print_ddb(&st); } #endif } --- a/sys/kern/subr_stack.c +++ b/sys/kern/subr_stack.c @@ -44,9 +44,7 @@ static int stack_symbol(vm_offset_t pc, char *namebuf, u_int buflen, long *offset); -#ifdef DDB static int stack_symbol_ddb(vm_offset_t pc, const char **name, long *offset); -#endif struct stack * stack_create(void) @@ -125,7 +123,6 @@ stack_print_short(struct stack *st) printf("\n"); } -#ifdef DDB void stack_print_ddb(struct stack *st) { @@ -141,6 +138,7 @@ stack_print_ddb(struct stack *st) } } +#ifdef DDB void stack_print_short_ddb(struct stack *st) { @@ -255,7 +253,6 @@ stack_symbol return (0); } -#ifdef DDB static int stack_symbol_ddb(vm_offset_t pc, const char **name, long *offset) { @@ -275,4 +272,3 @@ stack_symbol_ddb *name = "??"; return (ENOENT); } -#endif -- Andriy Gapon From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 16:17:38 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 380DA106564A; Tue, 21 Sep 2010 16:17:38 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id 6ED278FC24; Tue, 21 Sep 2010 16:17:37 +0000 (UTC) Received: by qwg5 with SMTP id 5so4987246qwg.13 for ; Tue, 21 Sep 2010 09:17:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type; bh=sEnPv864vnyqFtEdjtVgt2qesbm0VPQFARjdSqQu7Zg=; b=QqJ09GDNBEiy2xIRAZYdxmGa5mJyf0Th93Fgb0+CZoK+IiQoPrQp/2Xr6QWkHBrTsh HygBgOeGkdWmYBAqRB+beeAv79AOd1xTaRhwOCXacBCO7bRmi4mywlB3H+d+cydxiJz1 gkihjYhvs6dZowZ5UjwTmxkCqHZdbW61MEMfI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=hjKDsnFH/mSY02XAbGCSwnsmp1DI9U7Upzb/xcd8FPuNj6XEOJTd4IH/YygRDK5TJl yK4vnGg4LyKrtcYYuW3eifNYgtmEVr20eSGZnxmVHjodsxd5BVY3FF2mJg5yDu3GSLxi 5QkXQsTC8R5EdvguIbWw4WLLz26R7jqqgO6pE= MIME-Version: 1.0 Received: by 10.224.124.80 with SMTP id t16mr7178133qar.204.1285085856558; Tue, 21 Sep 2010 09:17:36 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.229.235.143 with HTTP; Tue, 21 Sep 2010 09:17:36 -0700 (PDT) In-Reply-To: <4C98D9FD.4050809@freebsd.org> References: <201009211507.o8LF7iVv097676@svn.freebsd.org> <4C98D9FD.4050809@freebsd.org> Date: Tue, 21 Sep 2010 18:17:36 +0200 X-Google-Sender-Auth: Qw8BU2TFWbNAveweTT9p3jJPCQw Message-ID: From: Attilio Rao To: Andriy Gapon Content-Type: text/plain; charset=UTF-8 Cc: svn-src-head@freebsd.org, mdf@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 16:17:38 -0000 2010/9/21 Andriy Gapon : > on 21/09/2010 18:17 mdf@FreeBSD.org said the following: >> I'd recommend using stack_print_ddb(), as that avoids any locking >> which may hang depending on how the kernel panic'd. > > How does the following look to you? > I hope I haven't freed too much from under DDB. > The patch compiles fine with STACK && !DDB. In general, if you really want to go with that route, I'd rename the functions with _unlocked() prefix (there is actually no need to tell they are _ddb specific) and maybe add _ddb() wrappers, you can have more opinions. Thanks, Attilio -- Peace can only be achieved by understanding - A. Einstein From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 16:24:52 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2FE77106564A; Tue, 21 Sep 2010 16:24:52 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1E3358FC0C; Tue, 21 Sep 2010 16:24:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8LGOqFt099339; Tue, 21 Sep 2010 16:24:52 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8LGOpZc099335; Tue, 21 Sep 2010 16:24:51 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201009211624.o8LGOpZc099335@svn.freebsd.org> From: Alan Cox Date: Tue, 21 Sep 2010 16:24:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212965 - in head: lib/libc/sys sys/kern sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 16:24:52 -0000 Author: alc Date: Tue Sep 21 16:24:51 2010 New Revision: 212965 URL: http://svn.freebsd.org/changeset/base/212965 Log: Fix exec_imgact_shell()'s handling of two error cases: (1) Previously, if the first line of a script exceeded MAXSHELLCMDLEN characters, then exec_imgact_shell() silently truncated the line and passed on the truncated interpreter name or argument. Now, exec_imgact_shell() will fail and return ENOEXEC, which is the commonly used errno among Unix variants for this type of error. (2) Previously, exec_imgact_shell()'s check on the length of the interpreter's name was ineffective. In other words, exec_imgact_shell() could not possibly fail and return ENAMETOOLONG. The reason being that the length of the interpreter name had to exceed MAXSHELLCMDLEN characters in order that ENAMETOOLONG be returned. But, the search for the end of the interpreter name stops after at most MAXSHELLCMDLEN - 2 characters are scanned. (In the end, this particular error is eventually discovered outside of exec_imgact_shell() and ENAMETOOLONG is returned. So, the real effect of this second change is that the error is detected earlier, in exec_imgact_shell().) Update the definition of MAXINTERP to the actual limit on the size of the interpreter name that has been in effect since r142453 (from 2005). In collaboration with: kib Modified: head/lib/libc/sys/execve.2 head/sys/kern/imgact_shell.c head/sys/sys/param.h Modified: head/lib/libc/sys/execve.2 ============================================================================== --- head/lib/libc/sys/execve.2 Tue Sep 21 15:07:44 2010 (r212964) +++ head/lib/libc/sys/execve.2 Tue Sep 21 16:24:51 2010 (r212965) @@ -28,7 +28,7 @@ .\" @(#)execve.2 8.5 (Berkeley) 6/1/94 .\" $FreeBSD$ .\" -.Dd April 10, 2008 +.Dd September 21, 2010 .Dt EXECVE 2 .Os .Sh NAME @@ -256,9 +256,11 @@ A component of the path prefix is not a .It Bq Er ENAMETOOLONG A component of a pathname exceeded 255 characters, or an entire path name exceeded 1023 characters. -.It Bq Er ENAMETOOLONG -When invoking an interpreted script, the interpreter name -exceeds +.It Bq Er ENOEXEC +When invoking an interpreted script, the length of the first line, +inclusive of the +.Sy \&#! +prefix and terminating newline, exceeds .Dv MAXSHELLCMDLEN characters. .It Bq Er ENOENT Modified: head/sys/kern/imgact_shell.c ============================================================================== --- head/sys/kern/imgact_shell.c Tue Sep 21 15:07:44 2010 (r212964) +++ head/sys/kern/imgact_shell.c Tue Sep 21 16:24:51 2010 (r212965) @@ -46,13 +46,18 @@ __FBSDID("$FreeBSD$"); /* * At the time of this writing, MAXSHELLCMDLEN == PAGE_SIZE. This is * significant because the caller has only mapped in one page of the - * file we're reading. This code should be changed to know how to - * read in the second page, but I'm not doing that just yet... + * file we're reading. */ #if MAXSHELLCMDLEN > PAGE_SIZE #error "MAXSHELLCMDLEN is larger than a single page!" #endif +/* + * MAXSHELLCMDLEN must be at least MAXINTERP plus the size of the `#!' + * prefix and terminating newline. + */ +CTASSERT(MAXSHELLCMDLEN >= MAXINTERP + 3); + /** * Shell interpreter image activator. An interpreter name beginning at * imgp->args->begin_argv is the minimal successful exit requirement. @@ -98,20 +103,20 @@ exec_shell_imgact(imgp) const char *image_header = imgp->image_header; const char *ihp, *interpb, *interpe, *maxp, *optb, *opte, *fname; int error, offset; - size_t length, clength; + size_t length; struct vattr vattr; struct sbuf *sname; /* a shell script? */ - if (((const short *) image_header)[0] != SHELLMAGIC) - return(-1); + if (((const short *)image_header)[0] != SHELLMAGIC) + return (-1); /* * Don't allow a shell script to be the shell for a shell * script. :-) */ if (imgp->interpreted) - return(ENOEXEC); + return (ENOEXEC); imgp->interpreted = 1; @@ -127,12 +132,9 @@ exec_shell_imgact(imgp) /* * Copy shell name and arguments from image_header into a string - * buffer. Remember that the caller has mapped only the - * first page of the file into memory. + * buffer. */ - clength = (vattr.va_size > PAGE_SIZE) ? PAGE_SIZE : vattr.va_size; - - maxp = &image_header[clength]; + maxp = &image_header[MIN(vattr.va_size, MAXSHELLCMDLEN)]; ihp = &image_header[2]; /* @@ -149,7 +151,7 @@ exec_shell_imgact(imgp) interpe = ihp; if (interpb == interpe) return (ENOEXEC); - if ((interpe - interpb) >= MAXSHELLCMDLEN) + if (interpe - interpb >= MAXINTERP) return (ENAMETOOLONG); /* @@ -163,6 +165,8 @@ exec_shell_imgact(imgp) while (ihp < maxp && ((*ihp != '\n') && (*ihp != '\0'))) ihp++; opte = ihp; + if (opte == maxp) + return (ENOEXEC); while (--ihp > optb && ((*ihp == ' ') || (*ihp == '\t'))) opte = ihp; Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Tue Sep 21 15:07:44 2010 (r212964) +++ head/sys/sys/param.h Tue Sep 21 16:24:51 2010 (r212965) @@ -73,7 +73,7 @@ #include #define MAXCOMLEN 19 /* max command name remembered */ -#define MAXINTERP 32 /* max interpreter file name length */ +#define MAXINTERP PATH_MAX /* max interpreter file name length */ #define MAXLOGNAME 17 /* max login name length (incl. NUL) */ #define MAXUPRC CHILD_MAX /* max simultaneous processes */ #define NCARGS ARG_MAX /* max bytes for an exec function */ From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 16:31:05 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5A46B1065672; Tue, 21 Sep 2010 16:31:05 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-gx0-f182.google.com (mail-gx0-f182.google.com [209.85.161.182]) by mx1.freebsd.org (Postfix) with ESMTP id ABD978FC17; Tue, 21 Sep 2010 16:31:04 +0000 (UTC) Received: by gxk8 with SMTP id 8so2122247gxk.13 for ; Tue, 21 Sep 2010 09:31:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type; bh=iQ5Nz+FkyG5J4py/5KlnYON7ZTqt/yIwCYaEH0KD0HU=; b=dwpUet8Xj2bCKgvN7ZMMFRCa5Q6xgPpgcw8KnE8OgTqs3AGuDPGeFkyuYPGt466NxU gSs8VQqkSvtMVHJpaq7As5/SkNieOoiGQdPojXfZKZKQlhmdIs1s/z7ty9og8IlIYJmn 0j0ueDcxm14rvlKKotMqvfPuuAjNQDqqat158= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=VYdz8sfQl2ca+WbujWNf52AV1omNWzQvqzyX57aEtBp7Eq/OwKvItZEqN/156+1QgJ ABIl2sEjzyXho/ulNGOBuMizwBUGxQ/HyP6ykc3vr2cUpSVPEkqzVmIuIp38JkwT18Zq GLT2fiBVRT6p22ED8OKvfk/VU2D7+Q07kodQ4= MIME-Version: 1.0 Received: by 10.90.95.14 with SMTP id s14mr6148150agb.161.1285086662059; Tue, 21 Sep 2010 09:31:02 -0700 (PDT) Sender: mdf356@gmail.com Received: by 10.231.187.71 with HTTP; Tue, 21 Sep 2010 09:31:01 -0700 (PDT) In-Reply-To: <4C98D200.4040909@freebsd.org> References: <201009211507.o8LF7iVv097676@svn.freebsd.org> <4C98CEE7.6060802@freebsd.org> <4C98D200.4040909@freebsd.org> Date: Tue, 21 Sep 2010 09:31:01 -0700 X-Google-Sender-Auth: wQNN5cZynoYNuE0IR25Aj5e-N44 Message-ID: From: mdf@FreeBSD.org To: Andriy Gapon Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 16:31:05 -0000 On Tue, Sep 21, 2010 at 8:40 AM, Andriy Gapon wrote: > on 21/09/2010 18:27 Andriy Gapon said the following: >> on 21/09/2010 18:17 mdf@FreeBSD.org said the following: >>> >>> I'd recommend using stack_print_ddb(), as that avoids any locking >>> which may hang depending on how the kernel panic'd. >> >> It seems that stack_print_ddb() depends on DDB? > > But the point about locking is very good. > How do you suggest we can deal with it? > > A dirty hack would be to check panicstr in linker_search_symbol_name and avoid > locking, but I don't like that at all. > Perhaps, some code in subr_stack.c could be taken outside DDB ifdef? I keep forgetting, but actually _mtx_lock_sleep() will just return if panicstr is set. _mtx_assert() is similarly guarded, so actually it should be mostly okay. Thanks, matthew From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 16:36:56 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 86E66106566C; Tue, 21 Sep 2010 16:36:56 +0000 (UTC) (envelope-from avg@freebsd.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 236BD8FC08; Tue, 21 Sep 2010 16:36:54 +0000 (UTC) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id TAA10746; Tue, 21 Sep 2010 19:36:53 +0300 (EEST) (envelope-from avg@freebsd.org) Message-ID: <4C98DF25.9040100@freebsd.org> Date: Tue, 21 Sep 2010 19:36:53 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.9) Gecko/20100920 Lightning/1.0b2 Thunderbird/3.1.4 MIME-Version: 1.0 To: mdf@freebsd.org References: <201009211507.o8LF7iVv097676@svn.freebsd.org> <4C98CEE7.6060802@freebsd.org> <4C98D200.4040909@freebsd.org> In-Reply-To: X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 16:36:56 -0000 on 21/09/2010 19:31 mdf@FreeBSD.org said the following: > I keep forgetting, but actually _mtx_lock_sleep() will just return if > panicstr is set. _mtx_assert() is similarly guarded, so actually it > should be mostly okay. But this doesn't seem to be the case for sx lock which is wrapped under KLD_LOCK() ? -- Andriy Gapon From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 16:39:25 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 450C8106566B; Tue, 21 Sep 2010 16:39:25 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id D27838FC18; Tue, 21 Sep 2010 16:39:24 +0000 (UTC) Received: by iwn34 with SMTP id 34so6290787iwn.13 for ; Tue, 21 Sep 2010 09:39:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=iS54kzfIqBUJsHBxBHUNE8PMibdZlpIJn7H+KMWpncc=; b=lij3ZEZH/lg/yKo4GJM4OJiYP5mIP4BgCk/SBzFyUOOfsrmABd3JrpB6NlBWZA+cP7 cPFrlBK9rSMBszObyWxxAKu3/O2N+AFFFIEpdocfKjQJ/PiyrejBp0p0h6txNmfKu3hL G7rA23cmqSciiQ9+I/i2VUkaJx+RJwH17L/qU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=svfNcT03iegdHQKEG5gbl4C0Xljjy+vY1+DZz62rdwnDdj8PyZh2fbcSU/yJaWaDHB FRnNP3QA7oWivLJ7bcARxQLyZBL4wWTJNlGGfZfyRH891ioXMDbfnxKklOSgsFXqLF7i QHWZcG/hMVwOvqH1BGIUfPTNuoIGP6zqNx+Ns= MIME-Version: 1.0 Received: by 10.231.14.69 with SMTP id f5mr12171599iba.116.1285087164009; Tue, 21 Sep 2010 09:39:24 -0700 (PDT) Sender: mdf356@gmail.com Received: by 10.231.187.71 with HTTP; Tue, 21 Sep 2010 09:39:23 -0700 (PDT) In-Reply-To: <4C98DF25.9040100@freebsd.org> References: <201009211507.o8LF7iVv097676@svn.freebsd.org> <4C98CEE7.6060802@freebsd.org> <4C98D200.4040909@freebsd.org> <4C98DF25.9040100@freebsd.org> Date: Tue, 21 Sep 2010 09:39:23 -0700 X-Google-Sender-Auth: ZaQ2kyv0dIdaqyR_6NR_dbVx1gc Message-ID: From: mdf@FreeBSD.org To: Andriy Gapon Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 16:39:25 -0000 On Tue, Sep 21, 2010 at 9:36 AM, Andriy Gapon wrote: > on 21/09/2010 19:31 mdf@FreeBSD.org said the following: >> I keep forgetting, but actually _mtx_lock_sleep() will just return if >> panicstr is set. =A0_mtx_assert() is similarly guarded, so actually it >> should be mostly okay. > > But this doesn't seem to be the case for sx lock which is wrapped under K= LD_LOCK() ? Right, that was it. I knew I hit a problem on 7 in the past. The right thing is probably to guard the sx_[sx]lock_hard primitives and sx_assert in the same way. Thanks, matthew From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 16:49:03 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 38B331065670; Tue, 21 Sep 2010 16:49:03 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1D6D38FC22; Tue, 21 Sep 2010 16:49:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8LGn3YF099972; Tue, 21 Sep 2010 16:49:03 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8LGn2lE099969; Tue, 21 Sep 2010 16:49:02 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201009211649.o8LGn2lE099969@svn.freebsd.org> From: Jaakko Heinonen Date: Tue, 21 Sep 2010 16:49:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212966 - head/sys/fs/devfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 16:49:03 -0000 Author: jh Date: Tue Sep 21 16:49:02 2010 New Revision: 212966 URL: http://svn.freebsd.org/changeset/base/212966 Log: Modify devfs_fqpn() for future use in devfs path reference counting code: - Accept devfs_mount and devfs_dirent as the arguments instead of a vnode. This generalizes the function so that it can be used from contexts where vnode references are not available. - Accept NULL cnp argument. No '/' will be appended, if a NULL cnp is provided. - Make the function global and add its prototype to devfs.h. Reviewed by: kib Modified: head/sys/fs/devfs/devfs.h head/sys/fs/devfs/devfs_vnops.c Modified: head/sys/fs/devfs/devfs.h ============================================================================== --- head/sys/fs/devfs/devfs.h Tue Sep 21 16:24:51 2010 (r212965) +++ head/sys/fs/devfs/devfs.h Tue Sep 21 16:49:02 2010 (r212966) @@ -122,6 +122,8 @@ struct devfs_rule { MALLOC_DECLARE(M_DEVFS); #endif +struct componentname; + struct devfs_dirent { struct cdev_priv *de_cdp; int de_inode; @@ -178,6 +180,8 @@ void devfs_rules_cleanup (struct devfs_m int devfs_rules_ioctl(struct devfs_mount *dm, u_long cmd, caddr_t data, struct thread *td); int devfs_allocv(struct devfs_dirent *de, struct mount *mp, int lockmode, struct vnode **vpp); +char *devfs_fqpn(char *, struct devfs_mount *, struct devfs_dirent *, + struct componentname *); void devfs_delete(struct devfs_mount *dm, struct devfs_dirent *de, int flags); void devfs_dirent_free(struct devfs_dirent *de); void devfs_populate (struct devfs_mount *dm); Modified: head/sys/fs/devfs/devfs_vnops.c ============================================================================== --- head/sys/fs/devfs/devfs_vnops.c Tue Sep 21 16:24:51 2010 (r212965) +++ head/sys/fs/devfs/devfs_vnops.c Tue Sep 21 16:49:02 2010 (r212966) @@ -299,29 +299,34 @@ finished: } /* - * Construct the fully qualified path name relative to the mountpoint + * Construct the fully qualified path name relative to the mountpoint. + * If a NULL cnp is provided, no '/' is appended to the resulting path. */ -static char * -devfs_fqpn(char *buf, struct vnode *dvp, struct componentname *cnp) +char * +devfs_fqpn(char *buf, struct devfs_mount *dmp, struct devfs_dirent *dd, + struct componentname *cnp) { int i; - struct devfs_dirent *de, *dd; - struct devfs_mount *dmp; + struct devfs_dirent *de; + + sx_assert(&dmp->dm_lock, SA_LOCKED); - dmp = VFSTODEVFS(dvp->v_mount); - dd = dvp->v_data; i = SPECNAMELEN; buf[i] = '\0'; - i -= cnp->cn_namelen; + if (cnp != NULL) + i -= cnp->cn_namelen; if (i < 0) return (NULL); - bcopy(cnp->cn_nameptr, buf + i, cnp->cn_namelen); + if (cnp != NULL) + bcopy(cnp->cn_nameptr, buf + i, cnp->cn_namelen); de = dd; while (de != dmp->dm_rootdir) { - i--; - if (i < 0) - return (NULL); - buf[i] = '/'; + if (cnp != NULL || i < SPECNAMELEN) { + i--; + if (i < 0) + return (NULL); + buf[i] = '/'; + } i -= de->de_dirent->d_namlen; if (i < 0) return (NULL); @@ -878,7 +883,7 @@ devfs_lookupx(struct vop_lookup_args *ap * OK, we didn't have an entry for the name we were asked for * so we try to see if anybody can create it on demand. */ - pname = devfs_fqpn(specname, dvp, cnp); + pname = devfs_fqpn(specname, dmp, dd, cnp); if (pname == NULL) break; From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 16:50:25 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3060D106564A; Tue, 21 Sep 2010 16:50:25 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1FB198FC1C; Tue, 21 Sep 2010 16:50:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8LGoPsp000145; Tue, 21 Sep 2010 16:50:25 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8LGoP8R000143; Tue, 21 Sep 2010 16:50:25 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009211650.o8LGoP8R000143@svn.freebsd.org> From: Alexander Motin Date: Tue, 21 Sep 2010 16:50:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212967 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 16:50:25 -0000 Author: mav Date: Tue Sep 21 16:50:24 2010 New Revision: 212967 URL: http://svn.freebsd.org/changeset/base/212967 Log: Remember last kern.eventtimer.periodic value, explicitly set by user. If timer capabilities forcing us to change periodicity mode, try to restore it back later, as soon as new choosen timer capable to do it. Without this, timer change like HPET->RTC->HPET always results in enabling periodic mode. Modified: head/sys/kern/kern_clocksource.c Modified: head/sys/kern/kern_clocksource.c ============================================================================== --- head/sys/kern/kern_clocksource.c Tue Sep 21 16:49:02 2010 (r212966) +++ head/sys/kern/kern_clocksource.c Tue Sep 21 16:50:24 2010 (r212967) @@ -117,7 +117,8 @@ SYSCTL_INT(_kern_eventtimer, OID_AUTO, i 0, "Run periodic events when idle"); static int periodic = 0; /* Periodic or one-shot mode. */ -TUNABLE_INT("kern.eventtimer.periodic", &periodic); +static int want_periodic = 0; /* What mode to prefer. */ +TUNABLE_INT("kern.eventtimer.periodic", &want_periodic); struct pcpu_state { struct mtx et_hw_mtx; /* Per-CPU timer mutex. */ @@ -587,6 +588,7 @@ cpu_initclocks_bsp(void) #ifdef SMP callout_new_inserted = cpu_new_callout; #endif + periodic = want_periodic; /* Grab requested timer or the best of present. */ if (timername[0]) timer = et_find(timername, 0, 0); @@ -841,6 +843,7 @@ sysctl_kern_eventtimer_timer(SYSCTL_HAND cpu_disable_deep_sleep++; if (timer->et_flags & ET_FLAGS_C3STOP) cpu_disable_deep_sleep--; + periodic = want_periodic; timer = et; et_init(timer, timercb, NULL, NULL); configtimer(1); @@ -865,7 +868,7 @@ sysctl_kern_eventtimer_periodic(SYSCTL_H return (error); ET_LOCK(); configtimer(0); - periodic = val; + periodic = want_periodic = val; configtimer(1); ET_UNLOCK(); return (error); From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 16:50:43 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2F4E510657C3; Tue, 21 Sep 2010 16:50:43 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id EF7D38FC17; Tue, 21 Sep 2010 16:50:42 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 96B7246BA6; Tue, 21 Sep 2010 12:50:42 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 662518A04E; Tue, 21 Sep 2010 12:50:41 -0400 (EDT) From: John Baldwin To: mdf@freebsd.org Date: Tue, 21 Sep 2010 12:50:40 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201009211507.o8LF7iVv097676@svn.freebsd.org> <4C98D200.4040909@freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201009211250.40704.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Tue, 21 Sep 2010 12:50:41 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andriy Gapon Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 16:50:43 -0000 On Tuesday, September 21, 2010 12:31:01 pm mdf@freebsd.org wrote: > On Tue, Sep 21, 2010 at 8:40 AM, Andriy Gapon wrote: > > on 21/09/2010 18:27 Andriy Gapon said the following: > >> on 21/09/2010 18:17 mdf@FreeBSD.org said the following: > >>> > >>> I'd recommend using stack_print_ddb(), as that avoids any locking > >>> which may hang depending on how the kernel panic'd. > >> > >> It seems that stack_print_ddb() depends on DDB? > > > > But the point about locking is very good. > > How do you suggest we can deal with it? > > > > A dirty hack would be to check panicstr in linker_search_symbol_name and avoid > > locking, but I don't like that at all. > > Perhaps, some code in subr_stack.c could be taken outside DDB ifdef? > > I keep forgetting, but actually _mtx_lock_sleep() will just return if > panicstr is set. _mtx_assert() is similarly guarded, so actually it > should be mostly okay. Err, I don't think _mtx_lock_sleep() is guarded in that fashion? I have an old patch to do that but have never committed it. If we want that we should probably change rwlocks and sxlocks to have also not block when panicstr is set. --- //depot/vendor/freebsd/src/sys/kern/kern_mutex.c 2010-05-11 18:31:25.000000000 0000 +++ //depot/projects/smpng/sys/kern/kern_mutex.c 2010-06-01 20:12:02.000000000 0000 @@ -348,6 +348,15 @@ return; } + /* + * If we have already panic'd and this is the thread that called + * panic(), then don't block on any mutexes but silently succeed. + * Otherwise, the kernel will deadlock since the scheduler isn't + * going to run the thread that holds the lock we need. + */ + if (panicstr != NULL && curthread->td_flags & TDF_INPANIC) + return; + lock_profile_obtain_lock_failed(&m->lock_object, &contested, &waittime); if (LOCK_LOG_TEST(&m->lock_object, opts)) @@ -664,6 +673,15 @@ } /* + * If we failed to unlock this lock and we are a thread that has + * called panic(), it may be due to the bypass in _mtx_lock_sleep() + * above. In that case, just return and leave the lock alone to + * avoid changing the state. + */ + if (panicstr != NULL && curthread->td_flags & TDF_INPANIC) + return; + + /* * We have to lock the chain before the turnstile so this turnstile * can be removed from the hash list if it is empty. */ -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 16:54:02 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D4D421065670; Tue, 21 Sep 2010 16:54:02 +0000 (UTC) (envelope-from mj@feral.com) Received: from ns1.feral.com (ns1.feral.com [192.67.166.1]) by mx1.freebsd.org (Postfix) with ESMTP id 9941B8FC21; Tue, 21 Sep 2010 16:54:02 +0000 (UTC) Received: from [192.168.1.2] (m206-63.dsl.tsoft.com [198.144.206.63]) by ns1.feral.com (8.14.3/8.14.3) with ESMTP id o8LGs1qT029510; Tue, 21 Sep 2010 09:54:01 -0700 (PDT) (envelope-from mj@feral.com) Message-ID: <4C98E324.8090803@feral.com> Date: Tue, 21 Sep 2010 09:53:56 -0700 From: Matthew Jacob Organization: Feral Software User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4 MIME-Version: 1.0 To: John Baldwin References: <201009211507.o8LF7iVv097676@svn.freebsd.org> <4C98D200.4040909@freebsd.org> <201009211250.40704.jhb@freebsd.org> In-Reply-To: <201009211250.40704.jhb@freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-4.2.6 (ns1.feral.com [192.67.166.1]); Tue, 21 Sep 2010 09:54:01 -0700 (PDT) Cc: svn-src-head@FreeBSD.org, mdf@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Andriy Gapon Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 16:54:02 -0000 > Err, I don't think _mtx_lock_sleep() is guarded in that fashion? I have an > old patch to do that but have never committed it. If we want that we should > probably change rwlocks and sxlocks to have also not block when panicstr is > set. Seems to me you are backing into interesting territory here- getting a bit more like Solaris. If you *do* do this, then you really *do* need to stop all other CPUs when you panic, or else it's likely you'll double panic more often than not. From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 17:02:25 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BDB42106566C; Tue, 21 Sep 2010 17:02:25 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 8B7888FC1A; Tue, 21 Sep 2010 17:02:23 +0000 (UTC) Received: by bwz15 with SMTP id 15so6775453bwz.13 for ; Tue, 21 Sep 2010 10:02:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :x-enigmail-version:content-type:content-transfer-encoding; bh=7IalIQiTB+SqEY6HGvk4q76XYswJ4k8qDvf9+528opQ=; b=CwhSt8h3QB3eAam15mzlb4iBKNpWBVXTsNk6GCBS2NA3xaIHOJdvMVRNF9Qq89K8r6 PMtXzons49JZOxIPz+1cTrlCcCAxEkJT9rrfjEk1Jy31BgM5h9sde40mzc9z3iHKGA56 4Qa1IjNSWabpJH1DL/k8cl8kxoVDPofjZELMg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; b=LDMvcB0boK1l8wqpaMjvWzIoOcMhvBdP+tGjr6GkJ5lTr3L+hLxozs4LyTTTS/YfED dwX9FvToasljw4Lp52wZiNR1s4Enp+NkbHp+1fojwTLTUXL8FbU4JdgaJCct9LlcT4T9 raGvXAheqBCqusmN4g05GLmHC9DoM6jlThVQo= Received: by 10.204.175.77 with SMTP id w13mr7877705bkz.202.1285088543124; Tue, 21 Sep 2010 10:02:23 -0700 (PDT) Received: from mavbook2.mavhome.dp.ua (pc.mavhome.dp.ua [212.86.226.226]) by mx.google.com with ESMTPS id y19sm7764033bkw.18.2010.09.21.10.02.19 (version=SSLv3 cipher=RC4-MD5); Tue, 21 Sep 2010 10:02:21 -0700 (PDT) Sender: Alexander Motin Message-ID: <4C98E514.7090107@FreeBSD.org> Date: Tue, 21 Sep 2010 20:02:12 +0300 From: Alexander Motin User-Agent: Thunderbird 2.0.0.23 (X11/20091212) MIME-Version: 1.0 To: Matthew Jacob References: <201009211507.o8LF7iVv097676@svn.freebsd.org> <4C98D200.4040909@freebsd.org> <201009211250.40704.jhb@freebsd.org> <4C98E324.8090803@feral.com> In-Reply-To: <4C98E324.8090803@feral.com> X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: mdf@FreeBSD.org, src-committers@FreeBSD.org, John Baldwin , svn-src-all@FreeBSD.org, Andriy Gapon , svn-src-head@FreeBSD.org Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 17:02:25 -0000 Matthew Jacob wrote: > >> Err, I don't think _mtx_lock_sleep() is guarded in that fashion? I >> have an >> old patch to do that but have never committed it. If we want that we >> should >> probably change rwlocks and sxlocks to have also not block when >> panicstr is >> set. > > Seems to me you are backing into interesting territory here- getting a > bit more like Solaris. > > If you *do* do this, then you really *do* need to stop all other CPUs > when you panic, or else it's likely you'll double panic more often than > not. May be it is not so bad idea to get more coherent memory snapshot? -- Alexander Motin From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 17:05:12 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9F7891065670; Tue, 21 Sep 2010 17:05:12 +0000 (UTC) (envelope-from mj@feral.com) Received: from ns1.feral.com (ns1.feral.com [192.67.166.1]) by mx1.freebsd.org (Postfix) with ESMTP id 62D0F8FC08; Tue, 21 Sep 2010 17:05:12 +0000 (UTC) Received: from [192.168.1.2] (m206-63.dsl.tsoft.com [198.144.206.63]) by ns1.feral.com (8.14.3/8.14.3) with ESMTP id o8LH5A99029608; Tue, 21 Sep 2010 10:05:10 -0700 (PDT) (envelope-from mj@feral.com) Message-ID: <4C98E5C1.70708@feral.com> Date: Tue, 21 Sep 2010 10:05:05 -0700 From: Matthew Jacob Organization: Feral Software User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4 MIME-Version: 1.0 To: Alexander Motin References: <201009211507.o8LF7iVv097676@svn.freebsd.org> <4C98D200.4040909@freebsd.org> <201009211250.40704.jhb@freebsd.org> <4C98E324.8090803@feral.com> <4C98E514.7090107@FreeBSD.org> In-Reply-To: <4C98E514.7090107@FreeBSD.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-4.2.6 (ns1.feral.com [192.67.166.1]); Tue, 21 Sep 2010 10:05:11 -0700 (PDT) Cc: mdf@FreeBSD.org, src-committers@FreeBSD.org, John Baldwin , svn-src-all@FreeBSD.org, Andriy Gapon , svn-src-head@FreeBSD.org Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 17:05:12 -0000 Absolutely. I have patches for RELENG_7, but have had trouble moving it to head. >> Seems to me you are backing into interesting territory here- getting a >> bit more like Solaris. >> >> If you *do* do this, then you really *do* need to stop all other CPUs >> when you panic, or else it's likely you'll double panic more often than >> not. > May be it is not so bad idea to get more coherent memory snapshot? > From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 17:25:16 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 13CC3106566C; Tue, 21 Sep 2010 17:25:16 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 029E98FC08; Tue, 21 Sep 2010 17:25:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8LHPFje001100; Tue, 21 Sep 2010 17:25:15 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8LHPFvi001098; Tue, 21 Sep 2010 17:25:15 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009211725.o8LHPFvi001098@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 21 Sep 2010 17:25:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212968 - head/sys/dev/ae X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 17:25:16 -0000 Author: yongari Date: Tue Sep 21 17:25:15 2010 New Revision: 212968 URL: http://svn.freebsd.org/changeset/base/212968 Log: Remove unnecessary controller reinitialization. PR: kern/87506 Modified: head/sys/dev/ae/if_ae.c Modified: head/sys/dev/ae/if_ae.c ============================================================================== --- head/sys/dev/ae/if_ae.c Tue Sep 21 16:50:24 2010 (r212967) +++ head/sys/dev/ae/if_ae.c Tue Sep 21 17:25:15 2010 (r212968) @@ -565,6 +565,8 @@ ae_init_locked(ae_softc_t *sc) AE_LOCK_ASSERT(sc); ifp = sc->ifp; + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + return (0); mii = device_get_softc(sc->miibus); ae_stop(sc); @@ -1786,7 +1788,10 @@ ae_int_task(void *arg, int pending) if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) { if ((val & (AE_ISR_DMAR_TIMEOUT | AE_ISR_DMAW_TIMEOUT | AE_ISR_PHY_LINKDOWN)) != 0) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; ae_init_locked(sc); + AE_UNLOCK(sc); + return; } if ((val & AE_ISR_TX_EVENT) != 0) ae_tx_intr(sc); @@ -1997,6 +2002,7 @@ ae_watchdog(ae_softc_t *sc) if_printf(ifp, "watchdog timeout - resetting.\n"); ifp->if_oerrors++; + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; ae_init_locked(sc); if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) taskqueue_enqueue(sc->tq, &sc->tx_task); @@ -2107,8 +2113,10 @@ ae_ioctl(struct ifnet *ifp, u_long cmd, else if (ifp->if_mtu != ifr->ifr_mtu) { AE_LOCK(sc); ifp->if_mtu = ifr->ifr_mtu; - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; ae_init_locked(sc); + } AE_UNLOCK(sc); } break; From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 17:31:15 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E3DB106564A; Tue, 21 Sep 2010 17:31:15 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0D62F8FC1D; Tue, 21 Sep 2010 17:31:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8LHVEp7001265; Tue, 21 Sep 2010 17:31:14 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8LHVEKT001263; Tue, 21 Sep 2010 17:31:14 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009211731.o8LHVEKT001263@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 21 Sep 2010 17:31:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212969 - head/sys/dev/et X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 17:31:15 -0000 Author: yongari Date: Tue Sep 21 17:31:14 2010 New Revision: 212969 URL: http://svn.freebsd.org/changeset/base/212969 Log: Make sure to clear IFF_DRV_RUNNING to reinitialize controller. While I'm here update if_oerrors counter when driver encounters watchdog timeout. Modified: head/sys/dev/et/if_et.c Modified: head/sys/dev/et/if_et.c ============================================================================== --- head/sys/dev/et/if_et.c Tue Sep 21 17:25:15 2010 (r212968) +++ head/sys/dev/et/if_et.c Tue Sep 21 17:31:14 2010 (r212969) @@ -1320,6 +1320,8 @@ et_watchdog(struct et_softc *sc) if_printf(sc->ifp, "watchdog timed out\n"); + sc->ifp->if_oerrors++; + sc->ifp->if_drv_flags &= ~IFF_DRV_RUNNING; et_init_locked(sc); et_start_locked(sc->ifp); } From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 17:37:29 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 249DD1065670; Tue, 21 Sep 2010 17:37:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 13D4F8FC14; Tue, 21 Sep 2010 17:37:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8LHbSVt001430; Tue, 21 Sep 2010 17:37:28 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8LHbSbI001428; Tue, 21 Sep 2010 17:37:28 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009211737.o8LHbSbI001428@svn.freebsd.org> From: Alexander Motin Date: Tue, 21 Sep 2010 17:37:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212970 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 17:37:29 -0000 Author: mav Date: Tue Sep 21 17:37:28 2010 New Revision: 212970 URL: http://svn.freebsd.org/changeset/base/212970 Log: If new callout scheduled to another CPU and we are using global timer, there is high probability that timer is already programmed by some other CPU. Especially by one that registered this callout, and so active now. Modified: head/sys/kern/kern_clocksource.c Modified: head/sys/kern/kern_clocksource.c ============================================================================== --- head/sys/kern/kern_clocksource.c Tue Sep 21 17:31:14 2010 (r212969) +++ head/sys/kern/kern_clocksource.c Tue Sep 21 17:37:28 2010 (r212970) @@ -785,14 +785,18 @@ cpu_new_callout(int cpu, int ticks) } /* * If timer is periodic - just update next event time for target CPU. + * If timer is global - there is chance it is already programmed. */ - if (periodic) { + if (periodic || (timer->et_flags & ET_FLAGS_PERCPU) == 0) { state->nextevent = state->nexthard; tmp = hardperiod; bintime_mul(&tmp, ticks - 1); bintime_add(&state->nextevent, &tmp); - ET_HW_UNLOCK(state); - return; + if (periodic || + bintime_cmp(&state->nextevent, &nexttick, >=)) { + ET_HW_UNLOCK(state); + return; + } } /* * Otherwise we have to wake that CPU up, as we can't get present From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 17:38:41 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CC38010656A5; Tue, 21 Sep 2010 17:38:41 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 58C5B8FC25; Tue, 21 Sep 2010 17:38:41 +0000 (UTC) Received: by iwn34 with SMTP id 34so6322645iwn.13 for ; Tue, 21 Sep 2010 10:38:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=U7S3vy8S9gEmALgq6XSFvWLqrgbz7/jwWLBHg1BElXo=; b=TWHszlaRkK7SpKr2ueMK3ImgnOga4BuoIPUbIrgRJZ3vNWUlhf+h72VlWnVpC2H2YD HHjJrkcbXS/Er3i76qq51KJ3JbEqN445Q7BxER/1G8ppoGJcKg+oj/0ufdzCTbtOLCqY pVh1UjVp1dh8cW+/KDBfS7v/3zftVqMmSHV3o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=L/x2ko9UaxFYOSv2jH0PLmD5jk8Z3EJMGP12PdPoy2WxjDB6pHLplg8+XJraMI4otG Eg4fhVeFQUQpRLiuzd1l6ibsTaecThHLJJ7cNLQOEpp1zWedtwCHXvN+dngfafUzyyU0 nrtrSJBo0Ck6BAIgwDi5L7u8wIKtVTOXmPFxQ= MIME-Version: 1.0 Received: by 10.231.184.156 with SMTP id ck28mr10375567ibb.168.1285090716913; Tue, 21 Sep 2010 10:38:36 -0700 (PDT) Sender: mdf356@gmail.com Received: by 10.231.187.71 with HTTP; Tue, 21 Sep 2010 10:38:36 -0700 (PDT) In-Reply-To: <201009211250.40704.jhb@freebsd.org> References: <201009211507.o8LF7iVv097676@svn.freebsd.org> <4C98D200.4040909@freebsd.org> <201009211250.40704.jhb@freebsd.org> Date: Tue, 21 Sep 2010 10:38:36 -0700 X-Google-Sender-Auth: faHs1tBdIilmf2hw9A8SvZ-h2AI Message-ID: From: mdf@FreeBSD.org To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andriy Gapon Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 17:38:41 -0000 On Tue, Sep 21, 2010 at 9:50 AM, John Baldwin wrote: > On Tuesday, September 21, 2010 12:31:01 pm mdf@freebsd.org wrote: >> On Tue, Sep 21, 2010 at 8:40 AM, Andriy Gapon wrote: >> > on 21/09/2010 18:27 Andriy Gapon said the following: >> >> on 21/09/2010 18:17 mdf@FreeBSD.org said the following: >> >>> >> >>> I'd recommend using stack_print_ddb(), as that avoids any locking >> >>> which may hang depending on how the kernel panic'd. >> >> >> >> It seems that stack_print_ddb() depends on DDB? >> > >> > But the point about locking is very good. >> > How do you suggest we can deal with it? >> > >> > A dirty hack would be to check panicstr in linker_search_symbol_name a= nd avoid >> > locking, but I don't like that at all. >> > Perhaps, some code in subr_stack.c could be taken outside DDB ifdef? >> >> I keep forgetting, but actually _mtx_lock_sleep() will just return if >> panicstr is set. =A0_mtx_assert() is similarly guarded, so actually it >> should be mostly okay. > > Err, I don't think _mtx_lock_sleep() is guarded in that fashion? =A0I hav= e an > old patch to do that but have never committed it. =A0If we want that we s= hould > probably change rwlocks and sxlocks to have also not block when panicstr = is > set. D'oh! Once again I was looking at Isilon source but not CURRENT. We had patches for mtx (back on 6.1) and haven't updated them for sx/rw for 7. We're also running with local patches to stop CPUs in panic() that Mr Jacob has a copy of. Regarding the original issue, then, I think in the short term using a safe stack_print() would be the correct thing. Changing the locking and stop_cpus logic will not happen in the next week. :-) Thanks, matthew > > --- //depot/vendor/freebsd/src/sys/kern/kern_mutex.c =A0 =A02010-05-11 18= :31:25.000000000 0000 > +++ //depot/projects/smpng/sys/kern/kern_mutex.c =A0 =A0 =A0 =A02010-06-0= 1 20:12:02.000000000 0000 > @@ -348,6 +348,15 @@ > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return; > =A0 =A0 =A0 =A0} > > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* If we have already panic'd and this is the thread that= called > + =A0 =A0 =A0 =A0* panic(), then don't block on any mutexes but silently = succeed. > + =A0 =A0 =A0 =A0* Otherwise, the kernel will deadlock since the schedule= r isn't > + =A0 =A0 =A0 =A0* going to run the thread that holds the lock we need. > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 if (panicstr !=3D NULL && curthread->td_flags & TDF_INPANIC= ) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return; > + > =A0 =A0 =A0 =A0lock_profile_obtain_lock_failed(&m->lock_object, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0&contested, &waittime); > =A0 =A0 =A0 =A0if (LOCK_LOG_TEST(&m->lock_object, opts)) > @@ -664,6 +673,15 @@ > =A0 =A0 =A0 =A0} > > =A0 =A0 =A0 =A0/* > + =A0 =A0 =A0 =A0* If we failed to unlock this lock and we are a thread t= hat has > + =A0 =A0 =A0 =A0* called panic(), it may be due to the bypass in _mtx_lo= ck_sleep() > + =A0 =A0 =A0 =A0* above. =A0In that case, just return and leave the lock= alone to > + =A0 =A0 =A0 =A0* avoid changing the state. > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 if (panicstr !=3D NULL && curthread->td_flags & TDF_INPANIC= ) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return; > + > + =A0 =A0 =A0 /* > =A0 =A0 =A0 =A0 * We have to lock the chain before the turnstile so this = turnstile > =A0 =A0 =A0 =A0 * can be removed from the hash list if it is empty. > =A0 =A0 =A0 =A0 */ > > -- > John Baldwin > From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 17:42:19 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 909AB1065674; Tue, 21 Sep 2010 17:42:19 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7FA578FC15; Tue, 21 Sep 2010 17:42:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8LHgJAa001557; Tue, 21 Sep 2010 17:42:19 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8LHgJCA001555; Tue, 21 Sep 2010 17:42:19 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009211742.o8LHgJCA001555@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 21 Sep 2010 17:42:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212971 - head/sys/dev/sf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 17:42:19 -0000 Author: yongari Date: Tue Sep 21 17:42:19 2010 New Revision: 212971 URL: http://svn.freebsd.org/changeset/base/212971 Log: Remove unnecessary controller reinitialization. StarFire controller does not require controller reinitialization to program perfect filters. While here, make driver immediately exit from interrupt/polling handler if driver reinitialized controller. PR: kern/87506 Modified: head/sys/dev/sf/if_sf.c Modified: head/sys/dev/sf/if_sf.c ============================================================================== --- head/sys/dev/sf/if_sf.c Tue Sep 21 17:37:28 2010 (r212970) +++ head/sys/dev/sf/if_sf.c Tue Sep 21 17:42:19 2010 (r212971) @@ -1826,7 +1826,10 @@ sf_poll(struct ifnet *ifp, enum poll_cmd else if ((status & SF_ISR_DMAERR) != 0) { device_printf(sc->sf_dev, "DMA error, resetting\n"); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; sf_init_locked(sc); + SF_UNLOCK(sc); + return (rx_npkts); } else if ((status & SF_ISR_NO_TX_CSUM) != 0) { sc->sf_statistics.sf_tx_gfp_stall++; #ifdef SF_GFP_DEBUG @@ -1894,8 +1897,10 @@ sf_intr(void *arg) else if ((status & SF_ISR_DMAERR) != 0) { device_printf(sc->sf_dev, "DMA error, resetting\n"); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; sf_init_locked(sc); - break; + SF_UNLOCK(sc); + return; } else if ((status & SF_ISR_NO_TX_CSUM) != 0) { sc->sf_statistics.sf_tx_gfp_stall++; #ifdef SF_GFP_DEBUG @@ -1984,6 +1989,8 @@ sf_init_locked(struct sf_softc *sc) SF_LOCK_ASSERT(sc); ifp = sc->sf_ifp; + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + return; mii = device_get_softc(sc->sf_miibus); sf_stop(sc); @@ -2547,6 +2554,7 @@ sf_watchdog(struct sf_softc *sc) if_printf(ifp, "watchdog timeout, %d Tx descs are active\n", sc->sf_cdata.sf_tx_cnt); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; sf_init_locked(sc); if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 17:48:34 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6E9A31065698; Tue, 21 Sep 2010 17:48:34 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 3DF3B8FC24; Tue, 21 Sep 2010 17:48:34 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id C3A5F46B60; Tue, 21 Sep 2010 13:48:33 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 973478A04E; Tue, 21 Sep 2010 13:48:32 -0400 (EDT) From: John Baldwin To: Matthew Jacob Date: Tue, 21 Sep 2010 13:47:28 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201009211507.o8LF7iVv097676@svn.freebsd.org> <201009211250.40704.jhb@freebsd.org> <4C98E324.8090803@feral.com> In-Reply-To: <4C98E324.8090803@feral.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201009211347.28800.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Tue, 21 Sep 2010 13:48:32 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, mdf@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andriy Gapon Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 17:48:34 -0000 On Tuesday, September 21, 2010 12:53:56 pm Matthew Jacob wrote: > > > Err, I don't think _mtx_lock_sleep() is guarded in that fashion? I have an > > old patch to do that but have never committed it. If we want that we should > > probably change rwlocks and sxlocks to have also not block when panicstr is > > set. > > Seems to me you are backing into interesting territory here- getting a > bit more like Solaris. > > If you *do* do this, then you really *do* need to stop all other CPUs > when you panic, or else it's likely you'll double panic more often than not. Yes, I don't dispute this. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 17:52:33 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 77011106566C; Tue, 21 Sep 2010 17:52:33 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4BA638FC17; Tue, 21 Sep 2010 17:52:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8LHqWeC001803; Tue, 21 Sep 2010 17:52:32 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8LHqWVv001801; Tue, 21 Sep 2010 17:52:32 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009211752.o8LHqWVv001801@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 21 Sep 2010 17:52:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212972 - head/sys/dev/stge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 17:52:33 -0000 Author: yongari Date: Tue Sep 21 17:52:32 2010 New Revision: 212972 URL: http://svn.freebsd.org/changeset/base/212972 Log: Remove unnecessary controller reinitialization. PR: kern/87506 Modified: head/sys/dev/stge/if_stge.c Modified: head/sys/dev/stge/if_stge.c ============================================================================== --- head/sys/dev/stge/if_stge.c Tue Sep 21 17:42:19 2010 (r212971) +++ head/sys/dev/stge/if_stge.c Tue Sep 21 17:52:32 2010 (r212972) @@ -1377,6 +1377,7 @@ stge_watchdog(struct stge_softc *sc) ifp = sc->sc_ifp; if_printf(sc->sc_ifp, "device timeout\n"); ifp->if_oerrors++; + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; stge_init_locked(sc); if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) stge_start_locked(ifp); @@ -1405,7 +1406,10 @@ stge_ioctl(struct ifnet *ifp, u_long cmd else if (ifp->if_mtu != ifr->ifr_mtu) { ifp->if_mtu = ifr->ifr_mtu; STGE_LOCK(sc); - stge_init_locked(sc); + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + stge_init_locked(sc); + } STGE_UNLOCK(sc); } break; @@ -1639,8 +1643,10 @@ stge_intr(void *arg) } force_init: - if (reinit != 0) + if (reinit != 0) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; stge_init_locked(sc); + } /* Re-enable interrupts. */ CSR_WRITE_2(sc, STGE_IntEnable, sc->sc_IntEnable); @@ -1936,11 +1942,16 @@ stge_poll(struct ifnet *ifp, enum poll_c if ((status & IS_HostError) != 0) { device_printf(sc->sc_dev, "Host interface error, resetting...\n"); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; stge_init_locked(sc); + break; } if ((status & IS_TxComplete) != 0) { - if (stge_tx_error(sc) != 0) + if (stge_tx_error(sc) != 0) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; stge_init_locked(sc); + break; + } } } @@ -2121,6 +2132,8 @@ stge_init_locked(struct stge_softc *sc) STGE_LOCK_ASSERT(sc); ifp = sc->sc_ifp; + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + return; mii = device_get_softc(sc->sc_miibus); /* From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 17:59:36 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 26651106567A; Tue, 21 Sep 2010 17:59:36 +0000 (UTC) (envelope-from mj@feral.com) Received: from ns1.feral.com (ns1.feral.com [192.67.166.1]) by mx1.freebsd.org (Postfix) with ESMTP id DF5358FC0A; Tue, 21 Sep 2010 17:59:35 +0000 (UTC) Received: from [192.168.1.2] (m206-63.dsl.tsoft.com [198.144.206.63]) by ns1.feral.com (8.14.3/8.14.3) with ESMTP id o8LHxYeG029954; Tue, 21 Sep 2010 10:59:34 -0700 (PDT) (envelope-from mj@feral.com) Message-ID: <4C98F281.2080806@feral.com> Date: Tue, 21 Sep 2010 10:59:29 -0700 From: Matthew Jacob Organization: Feral Software User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4 MIME-Version: 1.0 To: John Baldwin References: <201009211507.o8LF7iVv097676@svn.freebsd.org> <201009211250.40704.jhb@freebsd.org> <4C98E324.8090803@feral.com> <201009211347.28800.jhb@freebsd.org> In-Reply-To: <201009211347.28800.jhb@freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-4.2.6 (ns1.feral.com [192.67.166.1]); Tue, 21 Sep 2010 10:59:35 -0700 (PDT) Cc: svn-src-head@freebsd.org, mdf@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andriy Gapon Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 17:59:36 -0000 FWIW, I think that this would be a *good* thing. One of the problems with panic is that you can't really reset the state of the world, so most kernel services are not reliable. Unfortunately, mechanisms for preserving forensics for debug require some kernel services. >> Seems to me you are backing into interesting territory here- getting a >> bit more like Solaris. >> >> If you *do* do this, then you really *do* need to stop all other CPUs >> when you panic, or else it's likely you'll double panic more often than not. > Yes, I don't dispute this. > From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 19:01:04 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 775CB1065674 for ; Tue, 21 Sep 2010 19:01:04 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from mail2.fluidhosting.com (mx21.fluidhosting.com [204.14.89.4]) by mx1.freebsd.org (Postfix) with ESMTP id 03EF38FC20 for ; Tue, 21 Sep 2010 19:01:03 +0000 (UTC) Received: (qmail 7879 invoked by uid 399); 21 Sep 2010 19:01:03 -0000 Received: from localhost (HELO ?192.168.0.142?) (dougb@dougbarton.us@127.0.0.1) by localhost with ESMTPAM; 21 Sep 2010 19:01:03 -0000 X-Originating-IP: 127.0.0.1 X-Sender: dougb@dougbarton.us Message-ID: <4C9900EF.2090908@FreeBSD.org> Date: Tue, 21 Sep 2010 12:01:03 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4 MIME-Version: 1.0 To: Ed Schouten References: <201009210825.o8L8P0L0084859@svn.freebsd.org> In-Reply-To: <201009210825.o8L8P0L0084859@svn.freebsd.org> X-Enigmail-Version: 1.2a1pre OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212959 - head/sbin/mount_unionfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:01:04 -0000 You forgot to bump .Dd On 9/21/2010 1:25 AM, Ed Schouten wrote: > Author: ed > Date: Tue Sep 21 08:25:00 2010 > New Revision: 212959 > URL: http://svn.freebsd.org/changeset/base/212959 > > Log: > Add a notice to the man page that batteries should be installed. > > Modified: > head/sbin/mount_unionfs/mount_unionfs.8 > > Modified: head/sbin/mount_unionfs/mount_unionfs.8 > ============================================================================== > --- head/sbin/mount_unionfs/mount_unionfs.8 Tue Sep 21 08:02:02 2010 (r212958) > +++ head/sbin/mount_unionfs/mount_unionfs.8 Tue Sep 21 08:25:00 2010 (r212959) > @@ -353,6 +353,7 @@ USE AT YOUR > OWN RISK. > BEWARE OF DOG. > SLIPPERY WHEN WET. > +BATTERIES NOT INCLUDED. > .Pp > This code also needs an owner in order to be less dangerous - serious > hackers can apply by sending mail to > -- ... and that's just a little bit of history repeating. -- Propellerheads Improve the effectiveness of your Internet presence with a domain name makeover! http://SupersetSolutions.com/ From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 19:12:22 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B80EE1065695; Tue, 21 Sep 2010 19:12:22 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A75D08FC1D; Tue, 21 Sep 2010 19:12:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8LJCMUd004210; Tue, 21 Sep 2010 19:12:22 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8LJCM4t004208; Tue, 21 Sep 2010 19:12:22 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201009211912.o8LJCM4t004208@svn.freebsd.org> From: John Baldwin Date: Tue, 21 Sep 2010 19:12:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212974 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:12:22 -0000 Author: jhb Date: Tue Sep 21 19:12:22 2010 New Revision: 212974 URL: http://svn.freebsd.org/changeset/base/212974 Log: Comment nit, set TDF_NEEDRESCHED after the comment describing why it is done rather than before. MFC after: 1 week Modified: head/sys/kern/sched_ule.c Modified: head/sys/kern/sched_ule.c ============================================================================== --- head/sys/kern/sched_ule.c Tue Sep 21 18:25:33 2010 (r212973) +++ head/sys/kern/sched_ule.c Tue Sep 21 19:12:22 2010 (r212974) @@ -2404,12 +2404,12 @@ sched_affinity(struct thread *td) } if (!TD_IS_RUNNING(td)) return; - td->td_flags |= TDF_NEEDRESCHED; /* * Force a switch before returning to userspace. If the * target thread is not running locally send an ipi to force * the issue. */ + td->td_flags |= TDF_NEEDRESCHED; if (td != curthread) ipi_cpu(ts->ts_cpu, IPI_PREEMPT); #endif From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 20:23:19 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 94618106566C; Tue, 21 Sep 2010 20:23:19 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8366F8FC0A; Tue, 21 Sep 2010 20:23:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8LKNJD4005884; Tue, 21 Sep 2010 20:23:19 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8LKNJI3005882; Tue, 21 Sep 2010 20:23:19 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201009212023.o8LKNJI3005882@svn.freebsd.org> From: Rui Paulo Date: Tue, 21 Sep 2010 20:23:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212976 - head/lib/libc/i386/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 20:23:19 -0000 Author: rpaulo Date: Tue Sep 21 20:23:19 2010 New Revision: 212976 URL: http://svn.freebsd.org/changeset/base/212976 Log: Workaround LLVM bug #4434: Reorder inline assembly arguments temp2, temp, value and texp to follow the st(0), st(1), etc. style. Also mark the temp2 variable as volatile to workaround another clang bug. This allows clang to buildworld FreeBSD/i386. Submitted by: dim Modified: head/lib/libc/i386/gen/ldexp.c Modified: head/lib/libc/i386/gen/ldexp.c ============================================================================== --- head/lib/libc/i386/gen/ldexp.c Tue Sep 21 20:21:56 2010 (r212975) +++ head/lib/libc/i386/gen/ldexp.c Tue Sep 21 20:23:19 2010 (r212976) @@ -51,12 +51,16 @@ __FBSDID("$FreeBSD$"); double ldexp (double value, int exp) { - double temp, texp, temp2; + double temp, texp; +#ifdef __clang__ + volatile +#endif + double temp2; texp = exp; #ifdef __GNUC__ __asm ("fscale " - : "=u" (temp2), "=t" (temp) - : "0" (texp), "1" (value)); + : "=t" (temp), "=u" (temp2) + : "0" (value), "1" (texp)); #else #error unknown asm #endif From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 20:29:57 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 64756106564A; Tue, 21 Sep 2010 20:29:57 +0000 (UTC) (envelope-from rpaulo@freebsd.org) Received: from karen.lavabit.com (karen.lavabit.com [72.249.41.33]) by mx1.freebsd.org (Postfix) with ESMTP id 3AEAE8FC08; Tue, 21 Sep 2010 20:29:57 +0000 (UTC) Received: from d.earth.lavabit.com (d.earth.lavabit.com [192.168.111.13]) by karen.lavabit.com (Postfix) with ESMTP id 4FEDC11B888; Tue, 21 Sep 2010 15:29:56 -0500 (CDT) Received: from 10.0.10.3 (221.163.108.93.rev.vodafone.pt [93.108.163.221]) by lavabit.com with ESMTP id PSNOMQEKKT72; Tue, 21 Sep 2010 15:29:56 -0500 Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: text/plain; charset=us-ascii From: Rui Paulo In-Reply-To: <201009212023.o8LKNJI3005882@svn.freebsd.org> Date: Tue, 21 Sep 2010 21:29:53 +0100 Content-Transfer-Encoding: 7bit Message-Id: References: <201009212023.o8LKNJI3005882@svn.freebsd.org> To: Rui Paulo X-Mailer: Apple Mail (2.1081) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212976 - head/lib/libc/i386/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 20:29:57 -0000 On 21 Sep 2010, at 21:23, Rui Paulo wrote: > Author: rpaulo > Date: Tue Sep 21 20:23:19 2010 > New Revision: 212976 > URL: http://svn.freebsd.org/changeset/base/212976 > > Log: > Workaround LLVM bug #4434: > > Reorder inline assembly arguments temp2, temp, value and texp to follow > the st(0), st(1), etc. style. > Also mark the temp2 variable as volatile to workaround another clang > bug. > This allows clang to buildworld FreeBSD/i386. There's no binary change when using gcc. Regards, -- Rui Paulo From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 21:07:46 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C507B1065672; Tue, 21 Sep 2010 21:07:46 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B3D0E8FC0C; Tue, 21 Sep 2010 21:07:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8LL7kju006977; Tue, 21 Sep 2010 21:07:46 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8LL7kRr006975; Tue, 21 Sep 2010 21:07:46 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201009212107.o8LL7kRr006975@svn.freebsd.org> From: Christian Brueffer Date: Tue, 21 Sep 2010 21:07:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212978 - head/cddl/usr.sbin/plockstat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 21:07:46 -0000 Author: brueffer Date: Tue Sep 21 21:07:46 2010 New Revision: 212978 URL: http://svn.freebsd.org/changeset/base/212978 Log: Minor grammar fixes. Modified: head/cddl/usr.sbin/plockstat/plockstat.1 Modified: head/cddl/usr.sbin/plockstat/plockstat.1 ============================================================================== --- head/cddl/usr.sbin/plockstat/plockstat.1 Tue Sep 21 20:51:40 2010 (r212977) +++ head/cddl/usr.sbin/plockstat/plockstat.1 Tue Sep 21 21:07:46 2010 (r212978) @@ -68,7 +68,7 @@ Print all statistics. .It Fl C Print commulative statistics (the default). .It Fl H -Print an histogram. +Print a histogram. .It Fl V Print the DTrace script about to be used to stderr. .It Fl n Ar count @@ -91,5 +91,5 @@ man page for more details. .Sh HISTORY The .Nm -utility comes from the OpenSolaris and was first imported into +utility comes from OpenSolaris and was first imported into .Fx 9.0 . From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 21:41:46 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1D1541065670; Tue, 21 Sep 2010 21:41:46 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E53038FC0A; Tue, 21 Sep 2010 21:41:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8LLfjsZ007650; Tue, 21 Sep 2010 21:41:45 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8LLfjHX007646; Tue, 21 Sep 2010 21:41:45 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201009212141.o8LLfjHX007646@svn.freebsd.org> From: Dimitry Andric Date: Tue, 21 Sep 2010 21:41:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212979 - in head: gnu/lib/libobjc sys/boot/i386/boot2 sys/boot/pc98/boot2 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 21:41:46 -0000 Author: dim Date: Tue Sep 21 21:41:45 2010 New Revision: 212979 URL: http://svn.freebsd.org/changeset/base/212979 Log: When building world with clang, for gnu/lib/libobjc, sys/boot/i386/boot2 and sys/boot/pc98/boot2, do not simply assign 'gcc' to CC, since compile flags are sometimes passed via this variable, for example during the build32 stage on amd64. This caused the 32-bit libobjc build on amd64 to fail. Instead, only replace the first instance of clang (if any, including optional path) with gcc, and leave the arguments alone. Approved-by: rpaulo (mentor) Modified: head/gnu/lib/libobjc/Makefile head/sys/boot/i386/boot2/Makefile head/sys/boot/pc98/boot2/Makefile Modified: head/gnu/lib/libobjc/Makefile ============================================================================== --- head/gnu/lib/libobjc/Makefile Tue Sep 21 21:07:46 2010 (r212978) +++ head/gnu/lib/libobjc/Makefile Tue Sep 21 21:41:45 2010 (r212979) @@ -16,9 +16,7 @@ SRCS= archive.c class.c encoding.c gc.c selector.c sendmsg.c thr.c thr-objc.c exception.c # XXX: clang cannot compile libobjc yet -.if ${CC:T:Mclang} == "clang" -CC=gcc -.endif +CC:=${CC:C/^(.*\/)?clang$/gcc/1} INCS= encoding.h hash.h objc-api.h objc-decls.h objc-list.h objc.h runtime.h \ sarray.h thr.h typedstream.h NXConstStr.h Object.h Protocol.h Modified: head/sys/boot/i386/boot2/Makefile ============================================================================== --- head/sys/boot/i386/boot2/Makefile Tue Sep 21 21:07:46 2010 (r212978) +++ head/sys/boot/i386/boot2/Makefile Tue Sep 21 21:41:45 2010 (r212979) @@ -3,9 +3,7 @@ .include # XXX: clang can compile the boot code just fine, but boot2 gets too big -.if ${CC:T:Mclang} == "clang" -CC=gcc -.endif +CC:=${CC:C/^(.*\/)?clang$/gcc/1} FILES= boot boot1 boot2 Modified: head/sys/boot/pc98/boot2/Makefile ============================================================================== --- head/sys/boot/pc98/boot2/Makefile Tue Sep 21 21:07:46 2010 (r212978) +++ head/sys/boot/pc98/boot2/Makefile Tue Sep 21 21:41:45 2010 (r212979) @@ -3,9 +3,7 @@ .include # XXX: clang can compile the boot code just fine, but boot2 gets too big -.if ${CC:T:Mclang} == "clang" -CC=gcc -.endif +CC:=${CC:C/^(.*\/)?clang$/gcc/1} FILES= boot boot1 boot2 From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 22:42:14 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D7A121065673; Tue, 21 Sep 2010 22:42:14 +0000 (UTC) (envelope-from sanpei@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AB9A48FC1B; Tue, 21 Sep 2010 22:42:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8LMgE0K008919; Tue, 21 Sep 2010 22:42:14 GMT (envelope-from sanpei@svn.freebsd.org) Received: (from sanpei@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8LMgEha008915; Tue, 21 Sep 2010 22:42:14 GMT (envelope-from sanpei@svn.freebsd.org) Message-Id: <201009212242.o8LMgEha008915@svn.freebsd.org> From: MIHIRA Sanpei Yoshiro Date: Tue, 21 Sep 2010 22:42:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212980 - in head: share/man/man4 sys/dev/usb sys/dev/usb/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 22:42:14 -0000 Author: sanpei Date: Tue Sep 21 22:42:14 2010 New Revision: 212980 URL: http://svn.freebsd.org/changeset/base/212980 Log: Add new device ids. Buffalo (Melco Inc.) LUA3-U2-AGT Logitec LAN-GTJ/U2A(usb/119981) PR: usb/119981 and me Submitted by: "Y.Okabe" , hiroo at oikumene.gcd.org Reviewed by: thompsa MFC after: 3 days Modified: head/share/man/man4/axe.4 head/sys/dev/usb/net/if_axe.c head/sys/dev/usb/usbdevs Modified: head/share/man/man4/axe.4 ============================================================================== --- head/share/man/man4/axe.4 Tue Sep 21 21:41:45 2010 (r212979) +++ head/share/man/man4/axe.4 Tue Sep 21 22:42:14 2010 (r212980) @@ -169,6 +169,10 @@ AX88178: .It Belkin F5D5055 .It +Logitec LAN-GTJ/U2A +.It +Buffalo (Melco Inc.) LUA3-U2-AGT +.It Planex Communications GU1000T .It Sitecom Europe LN-028 Modified: head/sys/dev/usb/net/if_axe.c ============================================================================== --- head/sys/dev/usb/net/if_axe.c Tue Sep 21 21:41:45 2010 (r212979) +++ head/sys/dev/usb/net/if_axe.c Tue Sep 21 22:42:14 2010 (r212980) @@ -155,7 +155,9 @@ static const struct usb_device_id axe_de AXE_DEV(JVC, MP_PRX1, 0), AXE_DEV(LINKSYS2, USB200M, 0), AXE_DEV(LINKSYS4, USB1000, AXE_FLAG_178), + AXE_DEV(LOGITEC, LAN_GTJU2A, AXE_FLAG_178), AXE_DEV(MELCO, LUAU2KTX, 0), + AXE_DEV(MELCO, LUA3U2AGT, AXE_FLAG_178), AXE_DEV(NETGEAR, FA120, 0), AXE_DEV(OQO, ETHER01PLUS, AXE_FLAG_772), AXE_DEV(PLANEX3, GU1000T, AXE_FLAG_178), Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Tue Sep 21 21:41:45 2010 (r212979) +++ head/sys/dev/usb/usbdevs Tue Sep 21 22:42:14 2010 (r212980) @@ -2063,6 +2063,7 @@ product LOGITECH QUICKCAMPRO2 0xd001 Qui /* Logitec Corp. products */ product LOGITEC LDR_H443SU2 0x0033 DVD Multi-plus unit LDR-H443SU2 product LOGITEC LDR_H443U2 0x00b3 DVD Multi-plus unit LDR-H443U2 +product LOGITEC LAN_GTJU2A 0x0160 LAN-GTJ/U2A Ethernet product LOGITEC RT2870_1 0x0162 RT2870 product LOGITEC RT2870_2 0x0163 RT2870 product LOGITEC RT2870_3 0x0164 RT2870 @@ -2101,6 +2102,7 @@ product MELCO LUAU2KTX 0x003d LUA-U2-KT product MELCO KG54YB 0x005e WLI-U2-KG54-YB WLAN product MELCO KG54 0x0066 WLI-U2-KG54 WLAN product MELCO KG54AI 0x0067 WLI-U2-KG54-AI WLAN +product MELCO LUA3U2AGT 0x006e LUA3-U2-AGT product MELCO NINWIFI 0x008b Nintendo Wi-Fi product MELCO PCOPRS1 0x00b3 PC-OP-RS1 RemoteStation product MELCO SG54HP 0x00d8 WLI-U2-SG54HP From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 02:14:24 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1033) id 586341065670; Wed, 22 Sep 2010 02:14:24 +0000 (UTC) Date: Wed, 22 Sep 2010 02:14:24 +0000 From: Alexey Dokuchaev To: Doug Barton Message-ID: <20100922021424.GA44486@FreeBSD.org> References: <201009210825.o8L8P0L0084859@svn.freebsd.org> <4C9900EF.2090908@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <4C9900EF.2090908@FreeBSD.org> User-Agent: Mutt/1.4.2.1i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Ed Schouten Subject: Re: svn commit: r212959 - head/sbin/mount_unionfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 02:14:24 -0000 On Tue, Sep 21, 2010 at 12:01:03PM -0700, Doug Barton wrote: > You forgot to bump .Dd I thought it is required when manpages undergoes substantial or at least functional changes. ./danfe From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 02:16:29 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 40DE21065674 for ; Wed, 22 Sep 2010 02:16:29 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from mail2.fluidhosting.com (mx21.fluidhosting.com [204.14.89.4]) by mx1.freebsd.org (Postfix) with ESMTP id CAFE68FC1A for ; Wed, 22 Sep 2010 02:16:28 +0000 (UTC) Received: (qmail 8578 invoked by uid 399); 22 Sep 2010 02:16:27 -0000 Received: from localhost (HELO ?192.168.0.142?) (dougb@dougbarton.us@127.0.0.1) by localhost with ESMTPAM; 22 Sep 2010 02:16:27 -0000 X-Originating-IP: 127.0.0.1 X-Sender: dougb@dougbarton.us Message-ID: <4C9966FC.8030406@FreeBSD.org> Date: Tue, 21 Sep 2010 19:16:28 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4 MIME-Version: 1.0 To: Alexey Dokuchaev References: <201009210825.o8L8P0L0084859@svn.freebsd.org> <4C9900EF.2090908@FreeBSD.org> <20100922021424.GA44486@FreeBSD.org> In-Reply-To: <20100922021424.GA44486@FreeBSD.org> X-Enigmail-Version: 1.2a1pre OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Ed Schouten Subject: Re: svn commit: r212959 - head/sbin/mount_unionfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 02:16:29 -0000 On 9/21/2010 7:14 PM, Alexey Dokuchaev wrote: > On Tue, Sep 21, 2010 at 12:01:03PM -0700, Doug Barton wrote: >> You forgot to bump .Dd > > I thought it is required when manpages undergoes substantial or at least > functional changes. Seriously? You people are so humor-deficient that you didn't recognize that as a joke without me putting a smiley on it? Or maybe I'm the one who's missing a joke here .... Doug -- ... and that's just a little bit of history repeating. -- Propellerheads Improve the effectiveness of your Internet presence with a domain name makeover! http://SupersetSolutions.com/ From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 02:19:40 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4BBE7106564A; Wed, 22 Sep 2010 02:19:40 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.208.78.105]) by mx1.freebsd.org (Postfix) with ESMTP id 2A6758FC15; Wed, 22 Sep 2010 02:19:40 +0000 (UTC) Received: from troutmask.apl.washington.edu (localhost.apl.washington.edu [127.0.0.1]) by troutmask.apl.washington.edu (8.14.4/8.14.4) with ESMTP id o8M2JdUY085461; Tue, 21 Sep 2010 19:19:39 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.14.4/8.14.4/Submit) id o8M2Jd51085460; Tue, 21 Sep 2010 19:19:39 -0700 (PDT) (envelope-from sgk) Date: Tue, 21 Sep 2010 19:19:39 -0700 From: Steve Kargl To: Doug Barton Message-ID: <20100922021939.GA85446@troutmask.apl.washington.edu> References: <201009210825.o8L8P0L0084859@svn.freebsd.org> <4C9900EF.2090908@FreeBSD.org> <20100922021424.GA44486@FreeBSD.org> <4C9966FC.8030406@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4C9966FC.8030406@FreeBSD.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, Alexey Dokuchaev , src-committers@freebsd.org, Ed Schouten , svn-src-all@freebsd.org Subject: Re: svn commit: r212959 - head/sbin/mount_unionfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 02:19:40 -0000 On Tue, Sep 21, 2010 at 07:16:28PM -0700, Doug Barton wrote: > On 9/21/2010 7:14 PM, Alexey Dokuchaev wrote: > >On Tue, Sep 21, 2010 at 12:01:03PM -0700, Doug Barton wrote: > >>You forgot to bump .Dd > > > >I thought it is required when manpages undergoes substantial or at least > >functional changes. > > Seriously? You people are so humor-deficient that you didn't recognize > that as a joke without me putting a smiley on it? Or maybe I'm the one > who's missing a joke here .... > Perhaps, you should review your last month or so of posts to list. Note no smiley! -- Steve From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 02:26:07 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9ED611065670; Wed, 22 Sep 2010 02:26:07 +0000 (UTC) (envelope-from neel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 735EA8FC16; Wed, 22 Sep 2010 02:26:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8M2Q77V013718; Wed, 22 Sep 2010 02:26:07 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8M2Q789013713; Wed, 22 Sep 2010 02:26:07 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201009220226.o8M2Q789013713@svn.freebsd.org> From: Neel Natu Date: Wed, 22 Sep 2010 02:26:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212989 - in head/sys/mips: include mips sibyte X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 02:26:07 -0000 Author: neel Date: Wed Sep 22 02:26:07 2010 New Revision: 212989 URL: http://svn.freebsd.org/changeset/base/212989 Log: Enforce that 'pmap_kenter()' is only used to establish cacheable mappings. Mappings with other cacheability attributes can be established, if needed, by using 'pmap_kenter_attr()'. Suggested by: jchandra, imp Modified: head/sys/mips/include/pmap.h head/sys/mips/mips/pmap.c head/sys/mips/sibyte/sb_zbpci.c Modified: head/sys/mips/include/pmap.h ============================================================================== --- head/sys/mips/include/pmap.h Wed Sep 22 01:39:55 2010 (r212988) +++ head/sys/mips/include/pmap.h Wed Sep 22 02:26:07 2010 (r212989) @@ -154,6 +154,7 @@ void pmap_unmapdev(vm_offset_t, vm_size_ vm_offset_t pmap_steal_memory(vm_size_t size); int page_is_managed(vm_offset_t pa); void pmap_kenter(vm_offset_t va, vm_paddr_t pa); +void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int attr); void pmap_kremove(vm_offset_t va); void *pmap_kenter_temporary(vm_paddr_t pa, int i); void pmap_kenter_temporary_free(vm_paddr_t pa); Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Wed Sep 22 01:39:55 2010 (r212988) +++ head/sys/mips/mips/pmap.c Wed Sep 22 02:26:07 2010 (r212989) @@ -828,7 +828,7 @@ retry: /* * add a wired page to the kva */ -static void +void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int attr) { pt_entry_t *pte; @@ -849,14 +849,11 @@ pmap_kenter_attr(vm_offset_t va, vm_padd void pmap_kenter(vm_offset_t va, vm_paddr_t pa) { - int attr; - if (is_cacheable_mem(pa)) - attr = PTE_C_CACHE; - else - attr = PTE_C_UNCACHED; + KASSERT(is_cacheable_mem(pa), + ("pmap_kenter: memory at 0x%lx is not cacheable", (u_long)pa)); - pmap_kenter_attr(va, pa, attr); + pmap_kenter_attr(va, pa, PTE_C_CACHE); } /* Modified: head/sys/mips/sibyte/sb_zbpci.c ============================================================================== --- head/sys/mips/sibyte/sb_zbpci.c Wed Sep 22 01:39:55 2010 (r212988) +++ head/sys/mips/sibyte/sb_zbpci.c Wed Sep 22 02:26:07 2010 (r212989) @@ -349,7 +349,7 @@ zbpci_config_space_va(int bus, int slot, pa_page = pa & ~(PAGE_SIZE - 1); if (zbpci_config_space[cpu].paddr != pa_page) { pmap_kremove(va_page); - pmap_kenter(va_page, pa_page); + pmap_kenter_attr(va_page, pa_page, PTE_C_UNCACHED); zbpci_config_space[cpu].paddr = pa_page; } return (va_page + (pa - pa_page)); From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 02:35:58 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 187AA106564A for ; Wed, 22 Sep 2010 02:35:58 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from mail2.fluidhosting.com (mx21.fluidhosting.com [204.14.89.4]) by mx1.freebsd.org (Postfix) with ESMTP id 473AB8FC1A for ; Wed, 22 Sep 2010 02:35:55 +0000 (UTC) Received: (qmail 31820 invoked by uid 399); 22 Sep 2010 02:35:55 -0000 Received: from localhost (HELO ?192.168.0.142?) (dougb@dougbarton.us@127.0.0.1) by localhost with ESMTPAM; 22 Sep 2010 02:35:55 -0000 X-Originating-IP: 127.0.0.1 X-Sender: dougb@dougbarton.us Message-ID: <4C996B8B.4@FreeBSD.org> Date: Tue, 21 Sep 2010 19:35:55 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4 MIME-Version: 1.0 To: Steve Kargl References: <201009210825.o8L8P0L0084859@svn.freebsd.org> <4C9900EF.2090908@FreeBSD.org> <20100922021424.GA44486@FreeBSD.org> <4C9966FC.8030406@FreeBSD.org> <20100922021939.GA85446@troutmask.apl.washington.edu> In-Reply-To: <20100922021939.GA85446@troutmask.apl.washington.edu> X-Enigmail-Version: 1.2a1pre OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, Alexey Dokuchaev , src-committers@freebsd.org, Ed Schouten , svn-src-all@freebsd.org Subject: Re: svn commit: r212959 - head/sbin/mount_unionfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 02:35:58 -0000 On 9/21/2010 7:19 PM, Steve Kargl wrote: > On Tue, Sep 21, 2010 at 07:16:28PM -0700, Doug Barton wrote: >> On 9/21/2010 7:14 PM, Alexey Dokuchaev wrote: >>> On Tue, Sep 21, 2010 at 12:01:03PM -0700, Doug Barton wrote: >>>> You forgot to bump .Dd >>> >>> I thought it is required when manpages undergoes substantial or at least >>> functional changes. >> >> Seriously? You people are so humor-deficient that you didn't recognize >> that as a joke without me putting a smiley on it? Or maybe I'm the one >> who's missing a joke here .... >> > > Perhaps, you should review your last month or so of posts > to list. Note no smiley! Yeah, had that discussion already, apologized for the behavior that I actually agreed was over the top, now time to move on. :) :) :) Doug :) :) :) -- ... and that's just a little bit of history repeating. -- Propellerheads Improve the effectiveness of your Internet presence with a domain name makeover! http://SupersetSolutions.com/ From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 04:48:40 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F71B1065672; Wed, 22 Sep 2010 04:48:40 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F32B28FC19; Wed, 22 Sep 2010 04:48:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8M4mdxn016740; Wed, 22 Sep 2010 04:48:39 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8M4mdXs016738; Wed, 22 Sep 2010 04:48:39 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201009220448.o8M4mdXs016738@svn.freebsd.org> From: Warner Losh Date: Wed, 22 Sep 2010 04:48:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212990 - head/tools/tools/nanobsd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 04:48:40 -0000 Author: imp Date: Wed Sep 22 04:48:39 2010 New Revision: 212990 URL: http://svn.freebsd.org/changeset/base/212990 Log: Make the labels match the device name that's mounted, not just the slice they are on. When NANO_LABEL is not defined, the fstab generates entries that specify /dev/ad0s1a. When NANO_LABEL is defined, it generates /dev/usb/${NANO_LABEL}s1a. The prior code created the file system with a label of ${NANO_LABEL}s1, leading to problems on boot. Pointy hat to: imp@ Modified: head/tools/tools/nanobsd/nanobsd.sh Modified: head/tools/tools/nanobsd/nanobsd.sh ============================================================================== --- head/tools/tools/nanobsd/nanobsd.sh Wed Sep 22 02:26:07 2010 (r212989) +++ head/tools/tools/nanobsd/nanobsd.sh Wed Sep 22 04:48:39 2010 (r212990) @@ -501,7 +501,7 @@ create_i386_diskimage ( ) ( bsdlabel ${MD}s1 # Create first image - populate_slice /dev/${MD}s1a ${NANO_WORLDDIR} ${MNT} "s1" + populate_slice /dev/${MD}s1a ${NANO_WORLDDIR} ${MNT} "s1a" mount /dev/${MD}s1a ${MNT} echo "Generating mtree..." ( cd ${MNT} && mtree -c ) > ${NANO_OBJ}/_.mtree @@ -518,8 +518,10 @@ create_i386_diskimage ( ) ( sed -i "" "s=${NANO_DRIVE}s1=${NANO_DRIVE}s2=g" $f done umount ${MNT} + # Override the label from the first partition so we + # don't confuse glabel with duplicates. if [ ! -z ${NANO_LABEL} ]; then - tunefs -L ${NANO_LABEL}"s2" /dev/${MD}s2a + tunefs -L ${NANO_LABEL}"s2a" /dev/${MD}s2a fi fi From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 05:17:19 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 58B7E106566C; Wed, 22 Sep 2010 05:17:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 487D38FC18; Wed, 22 Sep 2010 05:17:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8M5HJ8v017363; Wed, 22 Sep 2010 05:17:19 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8M5HJHn017361; Wed, 22 Sep 2010 05:17:19 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009220517.o8M5HJHn017361@svn.freebsd.org> From: Alexander Motin Date: Wed, 22 Sep 2010 05:17:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212991 - head/sys/cam X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 05:17:19 -0000 Author: mav Date: Wed Sep 22 05:17:18 2010 New Revision: 212991 URL: http://svn.freebsd.org/changeset/base/212991 Log: Decrease poll interval from 1000 to 100us. This significantly reduces kernel dump time, especially with minidump. Modified: head/sys/cam/cam_xpt.c Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Wed Sep 22 04:48:39 2010 (r212990) +++ head/sys/cam/cam_xpt.c Wed Sep 22 05:17:18 2010 (r212991) @@ -2914,7 +2914,7 @@ xpt_polled_action(union ccb *start_ccb) struct cam_ed *dev; - timeout = start_ccb->ccb_h.timeout; + timeout = start_ccb->ccb_h.timeout * 10; sim = start_ccb->ccb_h.path->bus->sim; devq = sim->devq; dev = start_ccb->ccb_h.path->device; @@ -2930,7 +2930,7 @@ xpt_polled_action(union ccb *start_ccb) while(((devq != NULL && devq->send_openings <= 0) || dev->ccbq.dev_openings < 0) && (--timeout > 0)) { - DELAY(1000); + DELAY(100); (*(sim->sim_poll))(sim); camisr_runqueue(&sim->sim_doneq); } @@ -2946,7 +2946,7 @@ xpt_polled_action(union ccb *start_ccb) if ((start_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_INPROG) break; - DELAY(1000); + DELAY(100); } if (timeout == 0) { /* From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 05:32:37 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E0841106566C; Wed, 22 Sep 2010 05:32:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D075E8FC19; Wed, 22 Sep 2010 05:32:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8M5Wbbq017694; Wed, 22 Sep 2010 05:32:37 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8M5WbGb017692; Wed, 22 Sep 2010 05:32:37 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009220532.o8M5WbGb017692@svn.freebsd.org> From: Alexander Motin Date: Wed, 22 Sep 2010 05:32:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212992 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 05:32:38 -0000 Author: mav Date: Wed Sep 22 05:32:37 2010 New Revision: 212992 URL: http://svn.freebsd.org/changeset/base/212992 Log: If kernel built with DEVICE_POLLING, keep one CPU always in active state to handle it. Modified: head/sys/kern/kern_clocksource.c Modified: head/sys/kern/kern_clocksource.c ============================================================================== --- head/sys/kern/kern_clocksource.c Wed Sep 22 05:17:18 2010 (r212991) +++ head/sys/kern/kern_clocksource.c Wed Sep 22 05:32:37 2010 (r212992) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); /* XEN has own timer routines now. */ #ifndef XEN +#include "opt_device_polling.h" #include "opt_kdtrace.h" #include @@ -721,7 +722,11 @@ cpu_idleclock(void) struct pcpu_state *state; if (idletick || busy || - (periodic && (timer->et_flags & ET_FLAGS_PERCPU))) + (periodic && (timer->et_flags & ET_FLAGS_PERCPU)) +#ifdef DEVICE_POLLING + || curcpu == CPU_FIRST() +#endif + ) return; state = DPCPU_PTR(timerstate); if (periodic) From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 06:10:22 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 78BA51065672; Wed, 22 Sep 2010 06:10:22 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4E3508FC0C; Wed, 22 Sep 2010 06:10:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8M6AMwT018457; Wed, 22 Sep 2010 06:10:22 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8M6AMYs018455; Wed, 22 Sep 2010 06:10:22 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201009220610.o8M6AMYs018455@svn.freebsd.org> From: Andriy Gapon Date: Wed, 22 Sep 2010 06:10:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212993 - head/sys/dev/acpica X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 06:10:22 -0000 Author: avg Date: Wed Sep 22 06:10:22 2010 New Revision: 212993 URL: http://svn.freebsd.org/changeset/base/212993 Log: acpi_attach: do not explicitly install default handlers for default address spaces There has been no need to do that starting with ACPICA 20040427 as AcpiEnableSubsystem() installs the handlers automatically. Additionaly, explicitly calling AcpiInstallAddressSpaceHandler before AcpiEnableSubsystem is not supported by ACPICA and leads to too early execution of _REG methods in some DSDTs, which may result in problems. Big thanks to Robert Moore of ACPICA/Intel for explaining the above. Reported by: Daniel Bilik Tested by: Daniel Bilik Reviewed by: jkim Suggested by: "Moore, Robert" MFC after: 1 week Modified: head/sys/dev/acpica/acpi.c Modified: head/sys/dev/acpica/acpi.c ============================================================================== --- head/sys/dev/acpica/acpi.c Wed Sep 22 05:32:37 2010 (r212992) +++ head/sys/dev/acpica/acpi.c Wed Sep 22 06:10:22 2010 (r212993) @@ -494,29 +494,6 @@ acpi_attach(device_t dev) acpi_enable_pcie(); #endif - /* Install the default address space handlers. */ - status = AcpiInstallAddressSpaceHandler(ACPI_ROOT_OBJECT, - ACPI_ADR_SPACE_SYSTEM_MEMORY, ACPI_DEFAULT_HANDLER, NULL, NULL); - if (ACPI_FAILURE(status)) { - device_printf(dev, "Could not initialise SystemMemory handler: %s\n", - AcpiFormatException(status)); - goto out; - } - status = AcpiInstallAddressSpaceHandler(ACPI_ROOT_OBJECT, - ACPI_ADR_SPACE_SYSTEM_IO, ACPI_DEFAULT_HANDLER, NULL, NULL); - if (ACPI_FAILURE(status)) { - device_printf(dev, "Could not initialise SystemIO handler: %s\n", - AcpiFormatException(status)); - goto out; - } - status = AcpiInstallAddressSpaceHandler(ACPI_ROOT_OBJECT, - ACPI_ADR_SPACE_PCI_CONFIG, ACPI_DEFAULT_HANDLER, NULL, NULL); - if (ACPI_FAILURE(status)) { - device_printf(dev, "could not initialise PciConfig handler: %s\n", - AcpiFormatException(status)); - goto out; - } - /* * Note that some systems (specifically, those with namespace evaluation * issues that require the avoidance of parts of the namespace) must From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 06:45:08 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 20FB6106566C; Wed, 22 Sep 2010 06:45:08 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 10A618FC13; Wed, 22 Sep 2010 06:45:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8M6j7Ai019196; Wed, 22 Sep 2010 06:45:07 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8M6j70m019192; Wed, 22 Sep 2010 06:45:07 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201009220645.o8M6j70m019192@svn.freebsd.org> From: Andriy Gapon Date: Wed, 22 Sep 2010 06:45:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212994 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 06:45:08 -0000 Author: avg Date: Wed Sep 22 06:45:07 2010 New Revision: 212994 URL: http://svn.freebsd.org/changeset/base/212994 Log: kdb_backtrace: use stack_print_ddb instead of stack_print This is a followup to r212964. stack_print call chain obtains linker sx lock and thus potentially may lead to a deadlock depending on a kind of a panic. stack_print_ddb doesn't acquire any locks and it doesn't use any facilities of ddb backend. Using stack_print_ddb outside of DDB ifdef required taking a number of helper functions from under it as well. It is a good idea to rename linker_ddb_* and stack_*_ddb functions to have 'unlocked' component in their name instead of 'ddb', because those functions do not use any DDB services, but instead they provide unlocked access to linker symbol information. The latter was previously needed only for DDB, hence the 'ddb' name component. Alternative is to ditch unlocked versions altogether after implementing proper panic handling: 1. stop other cpus upon a panic 2. make all non-spinlock lock operations (mutex, sx, rwlock) be a no-op when panicstr != NULL Suggested by: mdf Discussed with: attilio MFC after: 2 weeks Modified: head/sys/kern/kern_linker.c head/sys/kern/subr_kdb.c head/sys/kern/subr_stack.c Modified: head/sys/kern/kern_linker.c ============================================================================== --- head/sys/kern/kern_linker.c Wed Sep 22 06:10:22 2010 (r212993) +++ head/sys/kern/kern_linker.c Wed Sep 22 06:45:07 2010 (r212994) @@ -924,7 +924,6 @@ linker_debug_search_symbol_name(caddr_t return (0); } -#ifdef DDB /* * DDB Helpers. DDB has to look across multiple files with their own symbol * tables and string tables. @@ -933,12 +932,14 @@ linker_debug_search_symbol_name(caddr_t * DDB to hang because somebody's got the lock held. We'll take the chance * that the files list is inconsistant instead. */ +#ifdef DDB int linker_ddb_lookup(const char *symstr, c_linker_sym_t *sym) { return (linker_debug_lookup(symstr, sym)); } +#endif int linker_ddb_search_symbol(caddr_t value, c_linker_sym_t *sym, long *diffp) @@ -961,7 +962,6 @@ linker_ddb_search_symbol_name(caddr_t va return (linker_debug_search_symbol_name(value, buf, buflen, offset)); } -#endif /* * stack(9) helper for non-debugging environemnts. Unlike DDB helpers, we do Modified: head/sys/kern/subr_kdb.c ============================================================================== --- head/sys/kern/subr_kdb.c Wed Sep 22 06:10:22 2010 (r212993) +++ head/sys/kern/subr_kdb.c Wed Sep 22 06:45:07 2010 (r212994) @@ -308,7 +308,7 @@ kdb_backtrace(void) printf("KDB: stack backtrace:\n"); stack_save(&st); - stack_print(&st); + stack_print_ddb(&st); } #endif } Modified: head/sys/kern/subr_stack.c ============================================================================== --- head/sys/kern/subr_stack.c Wed Sep 22 06:10:22 2010 (r212993) +++ head/sys/kern/subr_stack.c Wed Sep 22 06:45:07 2010 (r212994) @@ -44,9 +44,7 @@ static MALLOC_DEFINE(M_STACK, "stack", " static int stack_symbol(vm_offset_t pc, char *namebuf, u_int buflen, long *offset); -#ifdef DDB static int stack_symbol_ddb(vm_offset_t pc, const char **name, long *offset); -#endif struct stack * stack_create(void) @@ -125,7 +123,6 @@ stack_print_short(struct stack *st) printf("\n"); } -#ifdef DDB void stack_print_ddb(struct stack *st) { @@ -141,6 +138,7 @@ stack_print_ddb(struct stack *st) } } +#ifdef DDB void stack_print_short_ddb(struct stack *st) { @@ -255,7 +253,6 @@ stack_symbol(vm_offset_t pc, char *nameb return (0); } -#ifdef DDB static int stack_symbol_ddb(vm_offset_t pc, const char **name, long *offset) { @@ -275,4 +272,3 @@ stack_symbol_ddb(vm_offset_t pc, const c *name = "??"; return (ENOENT); } -#endif From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 08:41:31 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6FCDF1065673; Wed, 22 Sep 2010 08:41:31 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4543E8FC18; Wed, 22 Sep 2010 08:41:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8M8fVC8021672; Wed, 22 Sep 2010 08:41:31 GMT (envelope-from philip@svn.freebsd.org) Received: (from philip@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8M8fVSn021670; Wed, 22 Sep 2010 08:41:31 GMT (envelope-from philip@svn.freebsd.org) Message-Id: <201009220841.o8M8fVSn021670@svn.freebsd.org> From: Philip Paeps Date: Wed, 22 Sep 2010 08:41:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org X-SVN-Group: svnadmin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212995 - svnadmin/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 08:41:31 -0000 Author: philip Date: Wed Sep 22 08:41:30 2010 New Revision: 212995 URL: http://svn.freebsd.org/changeset/base/212995 Log: Take dds' commit bit for safekeeping per his request. Approved by: core Modified: svnadmin/conf/access Modified: svnadmin/conf/access ============================================================================== --- svnadmin/conf/access Wed Sep 22 06:45:07 2010 (r212994) +++ svnadmin/conf/access Wed Sep 22 08:41:30 2010 (r212995) @@ -57,7 +57,6 @@ davidch davidxu dchagin dd -dds deischen delphij des From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 11:32:22 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 803E31065670; Wed, 22 Sep 2010 11:32:22 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6FB098FC0C; Wed, 22 Sep 2010 11:32:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MBWMn7029535; Wed, 22 Sep 2010 11:32:22 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MBWMru029533; Wed, 22 Sep 2010 11:32:22 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009221132.o8MBWMru029533@svn.freebsd.org> From: Alexander Motin Date: Wed, 22 Sep 2010 11:32:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212997 - head/sys/dev/acpica X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 11:32:22 -0000 Author: mav Date: Wed Sep 22 11:32:22 2010 New Revision: 212997 URL: http://svn.freebsd.org/changeset/base/212997 Log: Quick fix for unmotivated C2 state usage during boot, introduced at r212541. That caused LAPIC timer failure and huge delays during boot on some systems. Modified: head/sys/dev/acpica/acpi_cpu.c Modified: head/sys/dev/acpica/acpi_cpu.c ============================================================================== --- head/sys/dev/acpica/acpi_cpu.c Wed Sep 22 10:55:33 2010 (r212996) +++ head/sys/dev/acpica/acpi_cpu.c Wed Sep 22 11:32:22 2010 (r212997) @@ -894,7 +894,7 @@ acpi_cpu_idle() cx_next_idx = 0; #ifndef __ia64__ if (cpu_disable_deep_sleep) - i = sc->cpu_non_c3; + i = min(sc->cpu_cx_lowest, sc->cpu_non_c3); else #endif i = sc->cpu_cx_lowest; From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 12:52:13 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F3B311065670; Wed, 22 Sep 2010 12:52:12 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E2B198FC1B; Wed, 22 Sep 2010 12:52:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MCqCB7031145; Wed, 22 Sep 2010 12:52:12 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MCqCcw031143; Wed, 22 Sep 2010 12:52:12 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201009221252.o8MCqCcw031143@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 22 Sep 2010 12:52:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212998 - head/sys/sparc64/sparc64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 12:52:13 -0000 Author: kib Date: Wed Sep 22 12:52:12 2010 New Revision: 212998 URL: http://svn.freebsd.org/changeset/base/212998 Log: For sparc64 relocations that directly put bits of the symbol value into the location, apply elf_relocaddr to the symbol value to have right values for the symbols from dpcpu segment. PR: kern/147769 Discussed with: avg Tested by: marius MFC after: 2 weeks Modified: head/sys/sparc64/sparc64/elf_machdep.c Modified: head/sys/sparc64/sparc64/elf_machdep.c ============================================================================== --- head/sys/sparc64/sparc64/elf_machdep.c Wed Sep 22 11:32:22 2010 (r212997) +++ head/sys/sparc64/sparc64/elf_machdep.c Wed Sep 22 12:52:12 2010 (r212998) @@ -155,6 +155,7 @@ elf64_dump_thread(struct thread *td __un #define _RF_G 0x10000000 /* GOT offset */ #define _RF_B 0x08000000 /* Load address relative */ #define _RF_U 0x04000000 /* Unaligned */ +#define _RF_X 0x02000000 /* Bare symbols, needs proc */ #define _RF_SZ(s) (((s) & 0xff) << 8) /* memory target size */ #define _RF_RS(s) ( (s) & 0xff) /* right shift */ static const int reloc_target_flags[] = { @@ -167,10 +168,10 @@ static const int reloc_target_flags[] = _RF_S|_RF_A|_RF_P| _RF_SZ(32) | _RF_RS(0), /* DISP_32 */ _RF_S|_RF_A|_RF_P| _RF_SZ(32) | _RF_RS(2), /* WDISP_30 */ _RF_S|_RF_A|_RF_P| _RF_SZ(32) | _RF_RS(2), /* WDISP_22 */ - _RF_S|_RF_A| _RF_SZ(32) | _RF_RS(10), /* HI22 */ - _RF_S|_RF_A| _RF_SZ(32) | _RF_RS(0), /* 22 */ - _RF_S|_RF_A| _RF_SZ(32) | _RF_RS(0), /* 13 */ - _RF_S|_RF_A| _RF_SZ(32) | _RF_RS(0), /* LO10 */ + _RF_S|_RF_A|_RF_X| _RF_SZ(32) | _RF_RS(10), /* HI22 */ + _RF_S|_RF_A|_RF_X| _RF_SZ(32) | _RF_RS(0), /* 22 */ + _RF_S|_RF_A|_RF_X| _RF_SZ(32) | _RF_RS(0), /* 13 */ + _RF_S|_RF_A|_RF_X| _RF_SZ(32) | _RF_RS(0), /* LO10 */ _RF_G| _RF_SZ(32) | _RF_RS(0), /* GOT10 */ _RF_G| _RF_SZ(32) | _RF_RS(0), /* GOT13 */ _RF_G| _RF_SZ(32) | _RF_RS(10), /* GOT22 */ @@ -189,29 +190,29 @@ static const int reloc_target_flags[] = _RF_A|_RF_P| _RF_SZ(32) | _RF_RS(0), /* PCPLT32 */ _RF_A|_RF_P| _RF_SZ(32) | _RF_RS(10), /* PCPLT22 */ _RF_A|_RF_P| _RF_SZ(32) | _RF_RS(0), /* PCPLT10 */ - _RF_S|_RF_A| _RF_SZ(32) | _RF_RS(0), /* 10 */ - _RF_S|_RF_A| _RF_SZ(32) | _RF_RS(0), /* 11 */ - _RF_S|_RF_A| _RF_SZ(64) | _RF_RS(0), /* 64 */ + _RF_S|_RF_A|_RF_X| _RF_SZ(32) | _RF_RS(0), /* 10 */ + _RF_S|_RF_A|_RF_X| _RF_SZ(32) | _RF_RS(0), /* 11 */ + _RF_S|_RF_A|_RF_X| _RF_SZ(64) | _RF_RS(0), /* 64 */ _RF_S|_RF_A|/*extra*/ _RF_SZ(32) | _RF_RS(0), /* OLO10 */ - _RF_S|_RF_A| _RF_SZ(32) | _RF_RS(42), /* HH22 */ - _RF_S|_RF_A| _RF_SZ(32) | _RF_RS(32), /* HM10 */ - _RF_S|_RF_A| _RF_SZ(32) | _RF_RS(10), /* LM22 */ + _RF_S|_RF_A|_RF_X| _RF_SZ(32) | _RF_RS(42), /* HH22 */ + _RF_S|_RF_A|_RF_X| _RF_SZ(32) | _RF_RS(32), /* HM10 */ + _RF_S|_RF_A|_RF_X| _RF_SZ(32) | _RF_RS(10), /* LM22 */ _RF_S|_RF_A|_RF_P| _RF_SZ(32) | _RF_RS(42), /* PC_HH22 */ _RF_S|_RF_A|_RF_P| _RF_SZ(32) | _RF_RS(32), /* PC_HM10 */ _RF_S|_RF_A|_RF_P| _RF_SZ(32) | _RF_RS(10), /* PC_LM22 */ _RF_S|_RF_A|_RF_P| _RF_SZ(32) | _RF_RS(2), /* WDISP16 */ _RF_S|_RF_A|_RF_P| _RF_SZ(32) | _RF_RS(2), /* WDISP19 */ _RF_S|_RF_A| _RF_SZ(32) | _RF_RS(0), /* GLOB_JMP */ - _RF_S|_RF_A| _RF_SZ(32) | _RF_RS(0), /* 7 */ - _RF_S|_RF_A| _RF_SZ(32) | _RF_RS(0), /* 5 */ - _RF_S|_RF_A| _RF_SZ(32) | _RF_RS(0), /* 6 */ + _RF_S|_RF_A|_RF_X| _RF_SZ(32) | _RF_RS(0), /* 7 */ + _RF_S|_RF_A|_RF_X| _RF_SZ(32) | _RF_RS(0), /* 5 */ + _RF_S|_RF_A|_RF_X| _RF_SZ(32) | _RF_RS(0), /* 6 */ _RF_S|_RF_A|_RF_P| _RF_SZ(64) | _RF_RS(0), /* DISP64 */ _RF_A| _RF_SZ(64) | _RF_RS(0), /* PLT64 */ - _RF_S|_RF_A| _RF_SZ(32) | _RF_RS(10), /* HIX22 */ - _RF_S|_RF_A| _RF_SZ(32) | _RF_RS(0), /* LOX10 */ - _RF_S|_RF_A| _RF_SZ(32) | _RF_RS(22), /* H44 */ - _RF_S|_RF_A| _RF_SZ(32) | _RF_RS(12), /* M44 */ - _RF_S|_RF_A| _RF_SZ(32) | _RF_RS(0), /* L44 */ + _RF_S|_RF_A|_RF_X| _RF_SZ(32) | _RF_RS(10), /* HIX22 */ + _RF_S|_RF_A|_RF_X| _RF_SZ(32) | _RF_RS(0), /* LOX10 */ + _RF_S|_RF_A|_RF_X| _RF_SZ(32) | _RF_RS(22), /* H44 */ + _RF_S|_RF_A|_RF_X| _RF_SZ(32) | _RF_RS(12), /* M44 */ + _RF_S|_RF_A|_RF_X| _RF_SZ(32) | _RF_RS(0), /* L44 */ _RF_S|_RF_A| _RF_SZ(64) | _RF_RS(0), /* REGISTER */ _RF_S|_RF_A| _RF_U| _RF_SZ(64) | _RF_RS(0), /* UA64 */ _RF_S|_RF_A| _RF_U| _RF_SZ(16) | _RF_RS(0), /* UA16 */ @@ -238,6 +239,7 @@ static const char *reloc_names[] = { #define RELOC_BASE_RELATIVE(t) ((reloc_target_flags[t] & _RF_B) != 0) #define RELOC_UNALIGNED(t) ((reloc_target_flags[t] & _RF_U) != 0) #define RELOC_USE_ADDEND(t) ((reloc_target_flags[t] & _RF_A) != 0) +#define RELOC_BARE_SYMBOL(t) ((reloc_target_flags[t] & _RF_X) != 0) #define RELOC_TARGET_SIZE(t) ((reloc_target_flags[t] >> 8) & 0xff) #define RELOC_VALUE_RIGHTSHIFT(t) (reloc_target_flags[t] & 0xff) @@ -334,6 +336,8 @@ elf_reloc(linker_file_t lf, Elf_Addr rel if (addr == 0) return (-1); value += addr; + if (RELOC_BARE_SYMBOL(rtype)) + value = elf_relocaddr(lf, value); } if (rtype == R_SPARC_OLO10) From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 13:57:32 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 71B37106564A; Wed, 22 Sep 2010 13:57:32 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from ixe-mta-27.emailfiltering.com (ixe-mta-27-tx.emailfiltering.com [194.116.199.158]) by mx1.freebsd.org (Postfix) with ESMTP id 43F338FC1D; Wed, 22 Sep 2010 13:57:30 +0000 (UTC) Received: from mail-gw14.york.ac.uk ([144.32.129.164]) by ixe-mta-27.emailfiltering.com with emfmta (version 4.6.0.72) by TLS id 763535398 for avg@FreeBSD.org;876ec0c1947c60a; Wed, 22 Sep 2010 14:46:42 +0100 Received: from buffy-128.york.ac.uk ([144.32.128.160]:22111 helo=buffy.york.ac.uk) by mail-gw14.york.ac.uk with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1OyPej-0002ys-9z; Wed, 22 Sep 2010 14:46:41 +0100 Received: from buffy.york.ac.uk (localhost [127.0.0.1]) by buffy.york.ac.uk (8.14.4/8.14.4) with ESMTP id o8MDkevO064391; Wed, 22 Sep 2010 14:46:40 +0100 (BST) (envelope-from gavin@FreeBSD.org) Received: (from ga9@localhost) by buffy.york.ac.uk (8.14.4/8.14.4/Submit) id o8MDkeD3064390; Wed, 22 Sep 2010 14:46:40 +0100 (BST) (envelope-from gavin@FreeBSD.org) X-Authentication-Warning: buffy.york.ac.uk: ga9 set sender to gavin@FreeBSD.org using -f From: Gavin Atkinson To: Andriy Gapon In-Reply-To: <201009211507.o8LF7iVv097676@svn.freebsd.org> References: <201009211507.o8LF7iVv097676@svn.freebsd.org> Content-Type: text/plain; charset="ASCII" Content-Transfer-Encoding: quoted-printable Date: Wed, 22 Sep 2010 14:46:40 +0100 Message-ID: <1285163200.64197.10.camel@buffy.york.ac.uk> Mime-Version: 1.0 X-Mailer: Evolution 2.30.1.2 FreeBSD GNOME Team Port Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 13:57:32 -0000 On Tue, 2010-09-21 at 15:07 +0000, Andriy Gapon wrote: > Author: avg > Date: Tue Sep 21 15:07:44 2010 > New Revision: 212964 > URL: http://svn.freebsd.org/changeset/base/212964 >=20 > Log: > kdb_backtrace: stack(9)-based code to print backtrace without any backe= nd > =20 > The idea is to add KDB and KDB_TRACE options to GENERIC kernels on > stable branches, so that at least the minimal information is produced > for non-specific panics like traps on page faults. > The GENERICs in stable branches seem to already include STACK option. Ignoring the rest of the discussion about locking, I think this is a step in the right direction. However, what I feel we should be strongly considering is for textdumps to be enabled by default on release media. As more groups choose to use the kernels from the release media (PC-BSD, FreeNAS, etc) and put them into places where end users are never expected to recompile kernels, having textdumps enabled by default in RELEASE kernels becomes a bigger and bigger priority. Groups like PC-BSD don't necessarily have the time or skills to do the needed kernel debugging (and nor should they have to, it's not their purpose), so anything we can do in releases to make sure we have enough info to resolve panics seen by their users is a big bonus. Is there any real reason why we shouldn't go down this route? Thanks, Gavin --=20 Gavin Atkinson FreeBSD committer and bugmeister GPG: A093262B (313A A79F 697D 3A5C 216A EDF5 935D EF44 A093 262B) From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 14:43:18 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9629C106564A; Wed, 22 Sep 2010 14:43:18 +0000 (UTC) (envelope-from avg@freebsd.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 469EA8FC18; Wed, 22 Sep 2010 14:43:16 +0000 (UTC) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id RAA02473; Wed, 22 Sep 2010 17:43:15 +0300 (EEST) (envelope-from avg@freebsd.org) Message-ID: <4C9A1602.4020204@freebsd.org> Date: Wed, 22 Sep 2010 17:43:14 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.9) Gecko/20100920 Lightning/1.0b2 Thunderbird/3.1.4 MIME-Version: 1.0 To: Gavin Atkinson References: <201009211507.o8LF7iVv097676@svn.freebsd.org> <1285163200.64197.10.camel@buffy.york.ac.uk> In-Reply-To: <1285163200.64197.10.camel@buffy.york.ac.uk> X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 14:43:18 -0000 on 22/09/2010 16:46 Gavin Atkinson said the following: > Ignoring the rest of the discussion about locking, I think this is a > step in the right direction. However, what I feel we should be strongly > considering is for textdumps to be enabled by default on release media. > > As more groups choose to use the kernels from the release media (PC-BSD, > FreeNAS, etc) and put them into places where end users are never > expected to recompile kernels, having textdumps enabled by default in > RELEASE kernels becomes a bigger and bigger priority. Groups like > PC-BSD don't necessarily have the time or skills to do the needed kernel > debugging (and nor should they have to, it's not their purpose), so > anything we can do in releases to make sure we have enough info to > resolve panics seen by their users is a big bonus. > > Is there any real reason why we shouldn't go down this route? textdumps need DDB. textdumps also need dumpdev which is not enabled by default in /etc/defaults/rc.conf, but that's easier to fix for any individual user or a FreeBSD "distribution". I originally suggested to include DDB in the stable GENERICs. But that has a number of consequences: 1. With DDB a panic results in a system going to ddb prompt instead of rebooting, unless KDB_UNATTENDED is also specified. System not rebooting on panic may be a POLA violation and an inconvenience. However, a user can change this using debug.debugger_on_panic=0 sysctl. Although, sysctl time might be too late in some cases, not sure. 2. Adding KDB_UNATTENDED to GENERIC may have unexpected effect for users that include GENERIC in their kernel config and then extend/trim it with local directives. So another possible POLA violation. Again, fixable by debug.debugger_on_panic=1 with all the howevers and althoughs. For me personally, the significant benefits outweigh possible minor/temporary inconveniences and surprises, but this opinion is not shared by all developers. Really besides the point, but such FreeBSD "distributions" like FreeNAS and PC-BSD can really use their own kernel config, they don't have to use the same GENERICs. P.S. I think that it would have been better if you followed up to my proposal on arch@. -- Andriy Gapon From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 15:10:03 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B11B21065672; Wed, 22 Sep 2010 15:10:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A05F18FC1A; Wed, 22 Sep 2010 15:10:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MFA3qr033949; Wed, 22 Sep 2010 15:10:03 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MFA35F033947; Wed, 22 Sep 2010 15:10:03 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201009221510.o8MFA35F033947@svn.freebsd.org> From: John Baldwin Date: Wed, 22 Sep 2010 15:10:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212999 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 15:10:03 -0000 Author: jhb Date: Wed Sep 22 15:10:03 2010 New Revision: 212999 URL: http://svn.freebsd.org/changeset/base/212999 Log: Copy td_rqindex during fork instead of zero'ing it to match the comments. I do not believe there is any functional change. Modified: head/sys/sys/proc.h Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Wed Sep 22 12:52:12 2010 (r212998) +++ head/sys/sys/proc.h Wed Sep 22 15:10:03 2010 (r212999) @@ -263,7 +263,7 @@ struct thread { int td_ng_outbound; /* (k) Thread entered ng from above. */ struct osd td_osd; /* (k) Object specific data. */ struct vm_map_entry *td_map_def_user; /* (k) Deferred entries. */ -#define td_endzero td_base_pri +#define td_endzero td_rqindex /* Copied during fork1() or thread_sched_upcall(). */ #define td_startcopy td_endzero From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 15:23:42 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 57910106566C; Wed, 22 Sep 2010 15:23:42 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from gse-mta-27.emailfiltering.com (gse-mta-27-tx.emailfiltering.com [194.116.198.158]) by mx1.freebsd.org (Postfix) with ESMTP id EA8FF8FC12; Wed, 22 Sep 2010 15:23:40 +0000 (UTC) Received: from mail-gw5.york.ac.uk ([144.32.129.29]) by gse-mta-27.emailfiltering.com with emfmta (version 4.6.0.72) by TLS id 753660736 for avg@FreeBSD.org;792989edab745909; Wed, 22 Sep 2010 16:23:39 +0100 Received: from buffy-128.york.ac.uk ([144.32.128.160]:40427 helo=buffy.york.ac.uk) by mail-gw5.york.ac.uk with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1OyRAY-0007xB-2C; Wed, 22 Sep 2010 16:23:38 +0100 Received: from buffy.york.ac.uk (localhost [127.0.0.1]) by buffy.york.ac.uk (8.14.4/8.14.4) with ESMTP id o8MFNbpo064768; Wed, 22 Sep 2010 16:23:37 +0100 (BST) (envelope-from gavin@FreeBSD.org) Received: (from ga9@localhost) by buffy.york.ac.uk (8.14.4/8.14.4/Submit) id o8MFNb4v064767; Wed, 22 Sep 2010 16:23:37 +0100 (BST) (envelope-from gavin@FreeBSD.org) X-Authentication-Warning: buffy.york.ac.uk: ga9 set sender to gavin@FreeBSD.org using -f From: Gavin Atkinson To: Andriy Gapon In-Reply-To: <4C9A1602.4020204@freebsd.org> References: <201009211507.o8LF7iVv097676@svn.freebsd.org> <1285163200.64197.10.camel@buffy.york.ac.uk> <4C9A1602.4020204@freebsd.org> Content-Type: text/plain; charset="ASCII" Content-Transfer-Encoding: quoted-printable Date: Wed, 22 Sep 2010 16:23:37 +0100 Message-ID: <1285169017.64197.29.camel@buffy.york.ac.uk> Mime-Version: 1.0 X-Mailer: Evolution 2.30.1.2 FreeBSD GNOME Team Port Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 15:23:42 -0000 On Wed, 2010-09-22 at 17:43 +0300, Andriy Gapon wrote: > on 22/09/2010 16:46 Gavin Atkinson said the following: > > Ignoring the rest of the discussion about locking, I think this is a > > step in the right direction. However, what I feel we should be strongl= y > > considering is for textdumps to be enabled by default on release media. > >=20 > > As more groups choose to use the kernels from the release media (PC-BSD= , > > FreeNAS, etc) and put them into places where end users are never > > expected to recompile kernels, having textdumps enabled by default in > > RELEASE kernels becomes a bigger and bigger priority. Groups like > > PC-BSD don't necessarily have the time or skills to do the needed kerne= l > > debugging (and nor should they have to, it's not their purpose), so > > anything we can do in releases to make sure we have enough info to > > resolve panics seen by their users is a big bonus. > >=20 > > Is there any real reason why we shouldn't go down this route? >=20 > textdumps need DDB. > textdumps also need dumpdev which is not enabled by default in > /etc/defaults/rc.conf, but that's easier to fix for any individual user o= r a > FreeBSD "distribution". Indeed, I was happy to see dumpdev enabled on 7.x, and disappointed to see it disabled on 8.x. > I originally suggested to include DDB in the stable GENERICs. > But that has a number of consequences: > 1. With DDB a panic results in a system going to ddb prompt instead of re= booting, > unless KDB_UNATTENDED is also specified. System not rebooting on panic m= ay be a > POLA violation and an inconvenience. However, a user can change this usi= ng > debug.debugger_on_panic=3D0 sysctl. Although, sysctl time might be too l= ate in some > cases, not sure. Indeed, if we went down this route we would have to make sure that the existing behaviour of rebooting is preserved. We'd also have to ensure Ctrl-Alt-Escape doesn't drop to the debugger on release media. > For me personally, the significant benefits outweigh possible minor/tempo= rary > inconveniences and surprises, but this opinion is not shared by all devel= opers. I (and I suspect any of the other people on the PR database frontline) would probably support this :) > Really besides the point, but such FreeBSD "distributions" like FreeNAS a= nd PC-BSD > can really use their own kernel config, they don't have to use the same G= ENERICs. Indeed, although in some ways they shouldn't have to. Having textdumps enabled by default would also be a huge win for us, of course. > P.S. I think that it would have been better if you followed up to my prop= osal on > arch@. I'm not subscribed to -arch at the moment, I probably should be. I guess you're talking about the thread in June? I wish I'd seen that at the time, I'm 100% in favour of it. Gavin --=20 Gavin Atkinson FreeBSD committer and bugmeister GPG: A093262B (313A A79F 697D 3A5C 216A EDF5 935D EF44 A093 262B) From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 15:25:57 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7D0A61065672; Wed, 22 Sep 2010 15:25:57 +0000 (UTC) (envelope-from avg@freebsd.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 1803D8FC18; Wed, 22 Sep 2010 15:25:55 +0000 (UTC) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id SAA03219; Wed, 22 Sep 2010 18:25:54 +0300 (EEST) (envelope-from avg@freebsd.org) Message-ID: <4C9A2002.9070807@freebsd.org> Date: Wed, 22 Sep 2010 18:25:54 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.9) Gecko/20100920 Lightning/1.0b2 Thunderbird/3.1.4 MIME-Version: 1.0 To: Gavin Atkinson References: <201009211507.o8LF7iVv097676@svn.freebsd.org> <1285163200.64197.10.camel@buffy.york.ac.uk> <4C9A1602.4020204@freebsd.org> <1285169017.64197.29.camel@buffy.york.ac.uk> In-Reply-To: <1285169017.64197.29.camel@buffy.york.ac.uk> X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 15:25:57 -0000 on 22/09/2010 18:23 Gavin Atkinson said the following: > I'm not subscribed to -arch at the moment, I probably should be. I > guess you're talking about the thread in June? I wish I'd seen that at > the time, I'm 100% in favour of it. No, a thread in September, third decade of it :) -- Andriy Gapon From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 16:48:25 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 454FD106566C; Wed, 22 Sep 2010 16:48:25 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 346168FC0A; Wed, 22 Sep 2010 16:48:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MGmPFB036169; Wed, 22 Sep 2010 16:48:25 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MGmPMq036167; Wed, 22 Sep 2010 16:48:25 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009221648.o8MGmPMq036167@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 22 Sep 2010 16:48:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213000 - head/sys/dev/stge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 16:48:25 -0000 Author: yongari Date: Wed Sep 22 16:48:24 2010 New Revision: 213000 URL: http://svn.freebsd.org/changeset/base/213000 Log: Fix build breakage introduced in r212972. Modified: head/sys/dev/stge/if_stge.c Modified: head/sys/dev/stge/if_stge.c ============================================================================== --- head/sys/dev/stge/if_stge.c Wed Sep 22 15:10:03 2010 (r212999) +++ head/sys/dev/stge/if_stge.c Wed Sep 22 16:48:24 2010 (r213000) @@ -1944,13 +1944,11 @@ stge_poll(struct ifnet *ifp, enum poll_c "Host interface error, resetting...\n"); ifp->if_drv_flags &= ~IFF_DRV_RUNNING; stge_init_locked(sc); - break; } if ((status & IS_TxComplete) != 0) { if (stge_tx_error(sc) != 0) { ifp->if_drv_flags &= ~IFF_DRV_RUNNING; stge_init_locked(sc); - break; } } } From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 16:54:23 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 194F01065670; Wed, 22 Sep 2010 16:54:23 +0000 (UTC) (envelope-from sunpoet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E1B658FC15; Wed, 22 Sep 2010 16:54:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MGsMA3036471; Wed, 22 Sep 2010 16:54:22 GMT (envelope-from sunpoet@svn.freebsd.org) Received: (from sunpoet@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MGsMRR036468; Wed, 22 Sep 2010 16:54:22 GMT (envelope-from sunpoet@svn.freebsd.org) Message-Id: <201009221654.o8MGsMRR036468@svn.freebsd.org> From: Sunpoet Po-Chuan Hsieh Date: Wed, 22 Sep 2010 16:54:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213001 - in head: share/misc usr.bin/calendar/calendars X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 16:54:23 -0000 Author: sunpoet (ports committer) Date: Wed Sep 22 16:54:22 2010 New Revision: 213001 URL: http://svn.freebsd.org/changeset/base/213001 Log: Add myself as a ports committer Approved by: pgollucci (mentor) Modified: head/share/misc/committers-ports.dot head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/share/misc/committers-ports.dot ============================================================================== --- head/share/misc/committers-ports.dot Wed Sep 22 16:48:24 2010 (r213000) +++ head/share/misc/committers-ports.dot Wed Sep 22 16:54:22 2010 (r213001) @@ -154,6 +154,7 @@ skreuzer [label="Steven Kreuzer\nskreuze sobomax[label="Maxim Sobolev\nsobomax@FreeBSD.org\n2000/05/17"] stas [label="Stanislav Sedov\nstas@FreeBSD.org\n2006/09/18"] stefan [label="Stefan Walter\nstefan@FreeBSD.org\n2006/05/07"] +sunpoet [label="Po-Chuan Hsieh\nsunpoet@FreeBSD.org\n2010/09/21"] swills [label="Steve Wills\nswills@FreeBSD.org\n2010/09/03"] tabthorpe [label="Thomas Abthorpe\ntabthorpe@FreeBSD.org\n2007/08/20"] tdb [label="Tim Bishop\ntdb@FreeBSD.org\n2005/11/30"] @@ -332,6 +333,7 @@ pav -> mnag pgj -> ashish pgj -> jacula +pgollucci -> sunpoet pgollucci -> swills philip -> koitsu Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Wed Sep 22 16:48:24 2010 (r213000) +++ head/usr.bin/calendar/calendars/calendar.freebsd Wed Sep 22 16:54:22 2010 (r213001) @@ -105,6 +105,7 @@ 03/27 Josef El-Rayes born in Linz, Austria, 1982 03/28 Sean C. Farley born in Indianapolis, Indiana, United States, 1970 03/29 Thierry Thomas born in Luxeuil les Bains, France, 1961 +03/30 Po-Chuan Hsieh born in Taipei, Taiwan, Republic of China, 1978 04/01 Matthew Jacob born in San Francisco, California, United States, 1958 04/01 Bill Fenner born in Bellefonte, Pennsylvania, United States, 1971 04/01 Peter Edwards born in Dublin, Ireland, 1973 From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 18:00:35 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5A6821065696; Wed, 22 Sep 2010 18:00:35 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 488108FC12; Wed, 22 Sep 2010 18:00:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MI0Z9P038220; Wed, 22 Sep 2010 18:00:35 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MI0Ze3038214; Wed, 22 Sep 2010 18:00:35 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201009221800.o8MI0Ze3038214@svn.freebsd.org> From: Rui Paulo Date: Wed, 22 Sep 2010 18:00:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213002 - in stable/8: include lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 18:00:35 -0000 Author: rpaulo Date: Wed Sep 22 18:00:34 2010 New Revision: 213002 URL: http://svn.freebsd.org/changeset/base/213002 Log: MFC r197804 (rwatson): Add basename_r(3) to complement basename(3). basename_r(3) which accepts a caller-allocated buffer of at least MAXPATHLEN, rather than using a global buffer. Note about semantics: while this interface is not POSIXy, there's another major platform that uses it (Android) and the semantics between the two platforms are pretty much the same. Modified: stable/8/include/libgen.h stable/8/lib/libc/gen/Makefile.inc stable/8/lib/libc/gen/Symbol.map stable/8/lib/libc/gen/basename.3 stable/8/lib/libc/gen/basename.c Directory Properties: stable/8/include/ (props changed) stable/8/lib/libc/ (props changed) stable/8/lib/libc/locale/ (props changed) stable/8/lib/libc/stdtime/ (props changed) stable/8/lib/libc/sys/ (props changed) Modified: stable/8/include/libgen.h ============================================================================== --- stable/8/include/libgen.h Wed Sep 22 16:54:22 2010 (r213001) +++ stable/8/include/libgen.h Wed Sep 22 18:00:34 2010 (r213002) @@ -36,6 +36,7 @@ __BEGIN_DECLS char *basename(const char *); +char *basename_r(const char *, char *); char *dirname(const char *); #if 0 char *regcmp(const char *, ...); Modified: stable/8/lib/libc/gen/Makefile.inc ============================================================================== --- stable/8/lib/libc/gen/Makefile.inc Wed Sep 22 16:54:22 2010 (r213001) +++ stable/8/lib/libc/gen/Makefile.inc Wed Sep 22 18:00:34 2010 (r213002) @@ -77,6 +77,7 @@ MAN+= alarm.3 arc4random.3 \ MLINKS+=arc4random.3 arc4random_addrandom.3 arc4random.3 arc4random_stir.3 \ arc4random.3 arc4random_buf.3 arc4random.3 arc4random_uniform.3 +MLINKS+=basename.3 basename_r.3 MLINKS+=ctermid.3 ctermid_r.3 MLINKS+=devname.3 devname_r.3 MLINKS+=devname.3 fdevname.3 Modified: stable/8/lib/libc/gen/Symbol.map ============================================================================== --- stable/8/lib/libc/gen/Symbol.map Wed Sep 22 16:54:22 2010 (r213001) +++ stable/8/lib/libc/gen/Symbol.map Wed Sep 22 18:00:34 2010 (r213002) @@ -366,6 +366,7 @@ FBSD_1.1 { }; FBSD_1.2 { + basename_r; getpagesizes; }; Modified: stable/8/lib/libc/gen/basename.3 ============================================================================== --- stable/8/lib/libc/gen/basename.3 Wed Sep 22 16:54:22 2010 (r213001) +++ stable/8/lib/libc/gen/basename.3 Wed Sep 22 18:00:34 2010 (r213002) @@ -27,7 +27,7 @@ .\" $OpenBSD: basename.3,v 1.12 2000/04/18 03:01:25 aaron Exp $ .\" $FreeBSD$ .\" -.Dd October 12, 2006 +.Dd October 6, 2009 .Dt BASENAME 3 .Os .Sh NAME @@ -37,6 +37,8 @@ .In libgen.h .Ft char * .Fn basename "const char *path" +.Ft char * +.Fn basename_r "const char *path" "char *bname" .Sh DESCRIPTION The .Fn basename @@ -58,6 +60,12 @@ If is a null pointer or the empty string, a pointer to the string .Qq \&. is returned. +.Pp +The +.Fn basename_r +variation accepts a buffer of at least +.Dv MAXPATHLEN +bytes in which to store the resulting component. .Sh IMPLEMENTATION NOTES The .Fn basename @@ -65,15 +73,17 @@ function returns a pointer to internal storage space allocated on the first call that will be overwritten by subsequent calls. +.Fn basename_r +is therefore preferred for threaded applications. .Sh RETURN VALUES On successful completion, .Fn basename -returns a pointer to the last component of +and +.Fn basename_r +return pointers to the last component of .Fa path . .Pp -If -.Fn basename -fails, a null pointer is returned and the global variable +If they fail, a null pointer is returned and the global variable .Va errno is set to indicate the error. .Sh ERRORS Modified: stable/8/lib/libc/gen/basename.c ============================================================================== --- stable/8/lib/libc/gen/basename.c Wed Sep 22 16:54:22 2010 (r213001) +++ stable/8/lib/libc/gen/basename.c Wed Sep 22 18:00:34 2010 (r213002) @@ -40,18 +40,12 @@ __FBSDID("$FreeBSD$"); #include char * -basename(path) +basename_r(path, bname) const char *path; + char *bname; { - static char *bname = NULL; const char *endp, *startp; - if (bname == NULL) { - bname = (char *)malloc(MAXPATHLEN); - if (bname == NULL) - return(NULL); - } - /* Empty or NULL string gets treated as "." */ if (path == NULL || *path == '\0') { (void)strcpy(bname, "."); @@ -82,3 +76,17 @@ basename(path) bname[endp - startp + 1] = '\0'; return(bname); } + +char * +basename(path) + const char *path; +{ + static char *bname = NULL; + + if (bname == NULL) { + bname = (char *)malloc(MAXPATHLEN); + if (bname == NULL) + return (NULL); + } + return (basename_r(path, bname)); +} From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 18:32:30 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A2AFF106566C; Wed, 22 Sep 2010 18:32:30 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from gse-mta-27.emailfiltering.com (gse-mta-27-tx.emailfiltering.com [194.116.198.158]) by mx1.freebsd.org (Postfix) with ESMTP id 894A08FC12; Wed, 22 Sep 2010 18:32:28 +0000 (UTC) Received: from mail-gw12.york.ac.uk ([144.32.129.162]) by gse-mta-27.emailfiltering.com with emfmta (version 4.6.0.72) by TLS id 753887668 for rpaulo@FreeBSD.org; 8f2afc23033486d2; Wed, 22 Sep 2010 19:32:27 +0100 Received: from buffy-128.york.ac.uk ([144.32.128.160]:39705 helo=buffy.york.ac.uk) by mail-gw12.york.ac.uk with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1OyU7G-0000Ji-UA; Wed, 22 Sep 2010 19:32:26 +0100 Received: from buffy.york.ac.uk (localhost [127.0.0.1]) by buffy.york.ac.uk (8.14.4/8.14.4) with ESMTP id o8MIWQZO065567; Wed, 22 Sep 2010 19:32:26 +0100 (BST) (envelope-from gavin@FreeBSD.org) Received: (from ga9@localhost) by buffy.york.ac.uk (8.14.4/8.14.4/Submit) id o8MIWQBk065566; Wed, 22 Sep 2010 19:32:26 +0100 (BST) (envelope-from gavin@FreeBSD.org) X-Authentication-Warning: buffy.york.ac.uk: ga9 set sender to gavin@FreeBSD.org using -f From: Gavin Atkinson To: Rui Paulo In-Reply-To: <201009221800.o8MI0Ze3038214@svn.freebsd.org> References: <201009221800.o8MI0Ze3038214@svn.freebsd.org> Content-Type: text/plain; charset="ASCII" Content-Transfer-Encoding: quoted-printable Date: Wed, 22 Sep 2010 19:32:25 +0100 Message-ID: <1285180346.65489.3.camel@buffy.york.ac.uk> Mime-Version: 1.0 X-Mailer: Evolution 2.30.1.2 FreeBSD GNOME Team Port Cc: svn-src-stable@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, svn-src-stable-8@FreeBSD.org Subject: Re: svn commit: r213002 - in stable/8: include lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 18:32:30 -0000 On Wed, 2010-09-22 at 18:00 +0000, Rui Paulo wrote: > Author: rpaulo > Date: Wed Sep 22 18:00:34 2010 > New Revision: 213002 > URL: http://svn.freebsd.org/changeset/base/213002 >=20 > Log: > MFC r197804 (rwatson): > Add basename_r(3) to complement basename(3). basename_r(3) which acc= epts > a caller-allocated buffer of at least MAXPATHLEN, rather than using a > global buffer. > =20 > Note about semantics: while this interface is not POSIXy, there's > another major platform that uses it (Android) and the semantics between > the two platforms are pretty much the same. Are you sure? Ours (just introduced): char * basename_r(path, bname) Android (from [1]): int basename_r(const char* path, char* buffer, size_t bufflen) The semantics seem very different. Ours allocates a buffer, on Android you pass in a buffer, for a start. Gavin [1] http://android.git.kernel.org/?p=3Dplatform/bionic.git;a=3Dblob;f=3Dlibc/bi= onic/basename_r.c;h=3De9080f058b6012f1bce77c72befc8f9fc213aed9;hb=3Da799b53= f10e5a6fd51fef4436cfb7ec99836a516 --=20 Gavin Atkinson FreeBSD committer and bugmeister GPG: A093262B (313A A79F 697D 3A5C 216A EDF5 935D EF44 A093 262B) From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 18:38:02 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D493D1065670; Wed, 22 Sep 2010 18:38:02 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C511B8FC0A; Wed, 22 Sep 2010 18:38:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MIc2nD038994; Wed, 22 Sep 2010 18:38:02 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MIc2Dh038992; Wed, 22 Sep 2010 18:38:02 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009221838.o8MIc2Dh038992@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 22 Sep 2010 18:38:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213003 - head/sbin/hastd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 18:38:02 -0000 Author: pjd Date: Wed Sep 22 18:38:02 2010 New Revision: 213003 URL: http://svn.freebsd.org/changeset/base/213003 Log: Sort includes. MFC after: 3 days Modified: head/sbin/hastd/control.c Modified: head/sbin/hastd/control.c ============================================================================== --- head/sbin/hastd/control.c Wed Sep 22 18:00:34 2010 (r213002) +++ head/sbin/hastd/control.c Wed Sep 22 18:38:02 2010 (r213003) @@ -32,11 +32,11 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include +#include #include #include From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 18:39:43 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D348F106564A; Wed, 22 Sep 2010 18:39:43 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C39EB8FC1F; Wed, 22 Sep 2010 18:39:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MIdh8x039059; Wed, 22 Sep 2010 18:39:43 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MIdhQB039057; Wed, 22 Sep 2010 18:39:43 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009221839.o8MIdhQB039057@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 22 Sep 2010 18:39:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213004 - head/sbin/hastd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 18:39:43 -0000 Author: pjd Date: Wed Sep 22 18:39:43 2010 New Revision: 213004 URL: http://svn.freebsd.org/changeset/base/213004 Log: If we are unable to receive control message is most likely because the main process died. Instead of entering infinite loop, terminate. MFC after: 3 days Modified: head/sbin/hastd/control.c Modified: head/sbin/hastd/control.c ============================================================================== --- head/sbin/hastd/control.c Wed Sep 22 18:38:02 2010 (r213003) +++ head/sbin/hastd/control.c Wed Sep 22 18:39:43 2010 (r213004) @@ -387,7 +387,8 @@ ctrl_thread(void *arg) pthread_exit(NULL); pjdlog_errno(LOG_ERR, "Unable to receive control message"); - continue; + kill(getpid(), SIGTERM); + pthread_exit(NULL); } cmd = nv_get_uint8(nvin, "cmd"); if (cmd == 0) { From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 18:46:18 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 11FAE106564A; Wed, 22 Sep 2010 18:46:18 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 029838FC14; Wed, 22 Sep 2010 18:46:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MIkHvL039262; Wed, 22 Sep 2010 18:46:17 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MIkH2e039260; Wed, 22 Sep 2010 18:46:17 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201009221846.o8MIkH2e039260@svn.freebsd.org> From: Doug Barton Date: Wed, 22 Sep 2010 18:46:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213005 - head/usr.sbin/named X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 18:46:18 -0000 Author: dougb Date: Wed Sep 22 18:46:17 2010 New Revision: 213005 URL: http://svn.freebsd.org/changeset/base/213005 Log: Eliminate the --disable-ipv6 string which while technically correct in terms of the arguments that configure was called with is misleading because if IPv6 support is present on the system it will be present in BIND. Modified: head/usr.sbin/named/Makefile Modified: head/usr.sbin/named/Makefile ============================================================================== --- head/usr.sbin/named/Makefile Wed Sep 22 18:39:43 2010 (r213004) +++ head/usr.sbin/named/Makefile Wed Sep 22 18:46:17 2010 (r213005) @@ -9,7 +9,7 @@ SRCDIR= ${BIND_DIR}/bin/named PROG= named -CONFIGARGS='--prefix=/usr' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--enable-threads' '--disable-ipv6' '--enable-getifaddrs' '--disable-linux-caps' '--with-openssl=/usr' '--with-randomdev=/dev/random' +CONFIGARGS='--prefix=/usr' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--enable-threads' '--enable-getifaddrs' '--disable-linux-caps' '--with-openssl=/usr' '--with-randomdev=/dev/random' # Optional features .if ${MK_BIND_LARGE_FILE} == "yes" From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 18:56:57 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A2B610656C5 for ; Wed, 22 Sep 2010 18:56:57 +0000 (UTC) (envelope-from joerg@britannica.bec.de) Received: from www.sonnenberger.org (www.sonnenberger.org [92.79.50.50]) by mx1.freebsd.org (Postfix) with ESMTP id 4B9B78FC15 for ; Wed, 22 Sep 2010 18:56:57 +0000 (UTC) Received: from britannica.bec.de (www.sonnenberger.org [192.168.1.10]) by www.sonnenberger.org (Postfix) with ESMTP id 73C9F6665D for ; Wed, 22 Sep 2010 20:40:21 +0200 (CEST) Received: by britannica.bec.de (Postfix, from userid 1000) id 8D281116DAE; Wed, 22 Sep 2010 20:40:29 +0200 (CEST) Date: Wed, 22 Sep 2010 20:40:29 +0200 From: Joerg Sonnenberger To: svn-src-all@freebsd.org Message-ID: <20100922184029.GB20824@britannica.bec.de> References: <201009221800.o8MI0Ze3038214@svn.freebsd.org> <1285180346.65489.3.camel@buffy.york.ac.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1285180346.65489.3.camel@buffy.york.ac.uk> User-Agent: Mutt/1.5.20 (2009-06-14) Subject: Re: svn commit: r213002 - in stable/8: include lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 18:56:57 -0000 On Wed, Sep 22, 2010 at 07:32:25PM +0100, Gavin Atkinson wrote: > Ours (just introduced): > > char * basename_r(path, bname) > > Android (from [1]): > > int basename_r(const char* path, char* buffer, size_t bufflen) > > The semantics seem very different. Ours allocates a buffer, on Android > you pass in a buffer, for a start. ...and the Android interface is what most *_r functions expose. Joerg From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 18:57:06 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 76C0A10656CB; Wed, 22 Sep 2010 18:57:06 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4D0E18FC13; Wed, 22 Sep 2010 18:57:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MIv6L2039507; Wed, 22 Sep 2010 18:57:06 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MIv6ei039503; Wed, 22 Sep 2010 18:57:06 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009221857.o8MIv6ei039503@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 22 Sep 2010 18:57:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213006 - head/sbin/hastd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 18:57:06 -0000 Author: pjd Date: Wed Sep 22 18:57:06 2010 New Revision: 213006 URL: http://svn.freebsd.org/changeset/base/213006 Log: Fix descriptor leaks: when child exits, we have to close control and event socket pairs. We did that only in one case out of three. MFC after: 3 days Modified: head/sbin/hastd/control.c head/sbin/hastd/control.h head/sbin/hastd/hastd.c Modified: head/sbin/hastd/control.c ============================================================================== --- head/sbin/hastd/control.c Wed Sep 22 18:46:17 2010 (r213005) +++ head/sbin/hastd/control.c Wed Sep 22 18:57:06 2010 (r213006) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "hast.h" #include "hastd.h" @@ -51,6 +52,17 @@ __FBSDID("$FreeBSD$"); #include "control.h" +void +child_cleanup(struct hast_resource *res) +{ + + proto_close(res->hr_ctrl); + res->hr_ctrl = NULL; + proto_close(res->hr_event); + res->hr_event = NULL; + res->hr_workerpid = 0; +} + static void control_set_role_common(struct hastd_config *cfg, struct nv *nvout, uint8_t role, struct hast_resource *res, const char *name, unsigned int no) @@ -109,7 +121,7 @@ control_set_role_common(struct hastd_con pjdlog_debug(1, "Worker process %u stopped.", (unsigned int)res->hr_workerpid); } - res->hr_workerpid = 0; + child_cleanup(res); } /* Start worker process if we are changing to primary. */ Modified: head/sbin/hastd/control.h ============================================================================== --- head/sbin/hastd/control.h Wed Sep 22 18:46:17 2010 (r213005) +++ head/sbin/hastd/control.h Wed Sep 22 18:57:06 2010 (r213006) @@ -38,6 +38,8 @@ struct hastd_config; struct hast_resource; +void child_cleanup(struct hast_resource *res); + void control_set_role(struct hast_resource *res, uint8_t role); void control_handle(struct hastd_config *cfg); Modified: head/sbin/hastd/hastd.c ============================================================================== --- head/sbin/hastd/hastd.c Wed Sep 22 18:46:17 2010 (r213005) +++ head/sbin/hastd/hastd.c Wed Sep 22 18:57:06 2010 (r213006) @@ -158,13 +158,7 @@ child_exit(void) pjdlog_prefix_set("[%s] (%s) ", res->hr_name, role2str(res->hr_role)); child_exit_log(pid, status); - proto_close(res->hr_ctrl); - res->hr_ctrl = NULL; - if (res->hr_event != NULL) { - proto_close(res->hr_event); - res->hr_event = NULL; - } - res->hr_workerpid = 0; + child_cleanup(res); if (res->hr_role == HAST_ROLE_PRIMARY) { /* * Restart child process if it was killed by signal @@ -553,7 +547,7 @@ listen_accept(void) } else { child_exit_log(res->hr_workerpid, status); } - res->hr_workerpid = 0; + child_cleanup(res); } else if (res->hr_remotein != NULL) { char oaddr[256]; From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 19:03:11 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CD33F1065697; Wed, 22 Sep 2010 19:03:11 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B37F48FC1E; Wed, 22 Sep 2010 19:03:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MJ3B3Z039691; Wed, 22 Sep 2010 19:03:11 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MJ3B2m039688; Wed, 22 Sep 2010 19:03:11 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009221903.o8MJ3B2m039688@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 22 Sep 2010 19:03:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213007 - head/sbin/hastd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:03:12 -0000 Author: pjd Date: Wed Sep 22 19:03:11 2010 New Revision: 213007 URL: http://svn.freebsd.org/changeset/base/213007 Log: Fix possible deadlock where worker process sends an event to the main process while the main process sends control message to the worker process, but worker process hasn't started control thread yet, because it waits for reply from the main process. The fix is to start the control thread before sending any events. Reported and fix suggested by: Mikolaj Golub MFC after: 3 days Modified: head/sbin/hastd/primary.c head/sbin/hastd/secondary.c Modified: head/sbin/hastd/primary.c ============================================================================== --- head/sbin/hastd/primary.c Wed Sep 22 18:57:06 2010 (r213006) +++ head/sbin/hastd/primary.c Wed Sep 22 19:03:11 2010 (r213007) @@ -807,10 +807,20 @@ hastd_primary(struct hast_resource *res) proto_send(res->hr_event, NULL, 0); init_local(res); - if (real_remote(res) && init_remote(res, NULL, NULL)) - sync_start(); init_ggate(res); init_environment(res); + /* + * Create the control thread before sending any event to the parent, + * as we can deadlock when parent sends control request to worker, + * but worker has no control thread started yet, so parent waits. + * In the meantime worker sends an event to the parent, but parent + * is unable to handle the event, because it waits for control + * request response. + */ + error = pthread_create(&td, NULL, ctrl_thread, res); + assert(error == 0); + if (real_remote(res) && init_remote(res, NULL, NULL)) + sync_start(); error = pthread_create(&td, NULL, ggate_recv_thread, res); assert(error == 0); error = pthread_create(&td, NULL, local_send_thread, res); @@ -823,8 +833,6 @@ hastd_primary(struct hast_resource *res) assert(error == 0); error = pthread_create(&td, NULL, sync_thread, res); assert(error == 0); - error = pthread_create(&td, NULL, ctrl_thread, res); - assert(error == 0); (void)guard_thread(res); } Modified: head/sbin/hastd/secondary.c ============================================================================== --- head/sbin/hastd/secondary.c Wed Sep 22 18:57:06 2010 (r213006) +++ head/sbin/hastd/secondary.c Wed Sep 22 19:03:11 2010 (r213007) @@ -393,17 +393,27 @@ hastd_secondary(struct hast_resource *re pjdlog_errno(LOG_WARNING, "Unable to set connection timeout"); init_local(res); - init_remote(res, nvin); init_environment(); + + /* + * Create the control thread before sending any event to the parent, + * as we can deadlock when parent sends control request to worker, + * but worker has no control thread started yet, so parent waits. + * In the meantime worker sends an event to the parent, but parent + * is unable to handle the event, because it waits for control + * request response. + */ + error = pthread_create(&td, NULL, ctrl_thread, res); + assert(error == 0); + + init_remote(res, nvin); event_send(res, EVENT_CONNECT); error = pthread_create(&td, NULL, recv_thread, res); assert(error == 0); error = pthread_create(&td, NULL, disk_thread, res); assert(error == 0); - error = pthread_create(&td, NULL, send_thread, res); - assert(error == 0); - (void)ctrl_thread(res); + (void)send_thread(res); } static void From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 19:05:55 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1072410656A7; Wed, 22 Sep 2010 19:05:55 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 015348FC1B; Wed, 22 Sep 2010 19:05:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MJ5shX039780; Wed, 22 Sep 2010 19:05:54 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MJ5sog039778; Wed, 22 Sep 2010 19:05:54 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009221905.o8MJ5sog039778@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 22 Sep 2010 19:05:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213008 - head/sbin/hastd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:05:55 -0000 Author: pjd Date: Wed Sep 22 19:05:54 2010 New Revision: 213008 URL: http://svn.freebsd.org/changeset/base/213008 Log: Assert that descriptor numbers are sane. MFC after: 3 days Modified: head/sbin/hastd/hastd.c Modified: head/sbin/hastd/hastd.c ============================================================================== --- head/sbin/hastd/hastd.c Wed Sep 22 19:03:11 2010 (r213007) +++ head/sbin/hastd/hastd.c Wed Sep 22 19:05:54 2010 (r213008) @@ -650,18 +650,22 @@ main_loop(void) /* Setup descriptors for select(2). */ FD_ZERO(&rfds); maxfd = fd = proto_descriptor(cfg->hc_controlconn); + assert(fd >= 0); FD_SET(fd, &rfds); fd = proto_descriptor(cfg->hc_listenconn); + assert(fd >= 0); FD_SET(fd, &rfds); maxfd = fd > maxfd ? fd : maxfd; TAILQ_FOREACH(res, &cfg->hc_resources, hr_next) { if (res->hr_event == NULL) continue; fd = proto_descriptor(res->hr_event); + assert(fd >= 0); FD_SET(fd, &rfds); maxfd = fd > maxfd ? fd : maxfd; } + assert(maxfd + 1 <= (int)FD_SETSIZE); ret = select(maxfd + 1, &rfds, NULL, NULL, &timeout); if (ret == 0) hook_check(false); From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 19:08:11 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BF379106564A; Wed, 22 Sep 2010 19:08:11 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AF5918FC16; Wed, 22 Sep 2010 19:08:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MJ8Br4039858; Wed, 22 Sep 2010 19:08:11 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MJ8BTQ039853; Wed, 22 Sep 2010 19:08:11 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009221908.o8MJ8BTQ039853@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 22 Sep 2010 19:08:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213009 - head/sbin/hastd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:08:11 -0000 Author: pjd Date: Wed Sep 22 19:08:11 2010 New Revision: 213009 URL: http://svn.freebsd.org/changeset/base/213009 Log: Switch to sigprocmask(2) API also in the main process and secondary process. This way the primary process inherits signal mask from the main process, which fixes a race where signal is delivered to the primary process before configuring signal mask. Reported by: Mikolaj Golub MFC after: 3 days Modified: head/sbin/hastd/hastd.c head/sbin/hastd/hastd.h head/sbin/hastd/primary.c head/sbin/hastd/secondary.c Modified: head/sbin/hastd/hastd.c ============================================================================== --- head/sbin/hastd/hastd.c Wed Sep 22 19:05:54 2010 (r213008) +++ head/sbin/hastd/hastd.c Wed Sep 22 19:08:11 2010 (r213009) @@ -63,10 +63,6 @@ __FBSDID("$FreeBSD$"); const char *cfgpath = HAST_CONFIG; /* Hastd configuration. */ static struct hastd_config *cfg; -/* Was SIGCHLD signal received? */ -bool sigchld_received = false; -/* Was SIGHUP signal received? */ -bool sighup_received = false; /* Was SIGINT or SIGTERM signal received? */ bool sigexit_received = false; /* PID file handle. */ @@ -83,26 +79,6 @@ usage(void) } static void -sighandler(int sig) -{ - - switch (sig) { - case SIGINT: - case SIGTERM: - sigexit_received = true; - break; - case SIGCHLD: - sigchld_received = true; - break; - case SIGHUP: - sighup_received = true; - break; - default: - assert(!"invalid condition"); - } -} - -static void g_gate_load(void) { @@ -625,26 +601,41 @@ static void main_loop(void) { struct hast_resource *res; - struct timeval timeout; - int fd, maxfd, ret; + struct timeval seltimeout; + struct timespec sigtimeout; + int fd, maxfd, ret, signo; + sigset_t mask; fd_set rfds; - timeout.tv_sec = REPORT_INTERVAL; - timeout.tv_usec = 0; + seltimeout.tv_sec = REPORT_INTERVAL; + seltimeout.tv_usec = 0; + sigtimeout.tv_sec = 0; + sigtimeout.tv_nsec = 0; + + PJDLOG_VERIFY(sigemptyset(&mask) == 0); + PJDLOG_VERIFY(sigaddset(&mask, SIGHUP) == 0); + PJDLOG_VERIFY(sigaddset(&mask, SIGINT) == 0); + PJDLOG_VERIFY(sigaddset(&mask, SIGTERM) == 0); + PJDLOG_VERIFY(sigaddset(&mask, SIGCHLD) == 0); for (;;) { - if (sigexit_received) { - sigexit_received = false; - terminate_workers(); - exit(EX_OK); - } - if (sigchld_received) { - sigchld_received = false; - child_exit(); - } - if (sighup_received) { - sighup_received = false; - hastd_reload(); + while ((signo = sigtimedwait(&mask, NULL, &sigtimeout)) != -1) { + switch (signo) { + case SIGINT: + case SIGTERM: + sigexit_received = true; + terminate_workers(); + exit(EX_OK); + break; + case SIGCHLD: + child_exit(); + break; + case SIGHUP: + hastd_reload(); + break; + default: + assert(!"invalid condition"); + } } /* Setup descriptors for select(2). */ @@ -666,7 +657,7 @@ main_loop(void) } assert(maxfd + 1 <= (int)FD_SETSIZE); - ret = select(maxfd + 1, &rfds, NULL, NULL, &timeout); + ret = select(maxfd + 1, &rfds, NULL, NULL, &seltimeout); if (ret == 0) hook_check(false); else if (ret == -1) { @@ -701,6 +692,7 @@ main(int argc, char *argv[]) pid_t otherpid; bool foreground; int debuglevel; + sigset_t mask; g_gate_load(); @@ -751,10 +743,12 @@ main(int argc, char *argv[]) cfg = yy_config_parse(cfgpath, true); assert(cfg != NULL); - signal(SIGINT, sighandler); - signal(SIGTERM, sighandler); - signal(SIGHUP, sighandler); - signal(SIGCHLD, sighandler); + PJDLOG_VERIFY(sigemptyset(&mask) == 0); + PJDLOG_VERIFY(sigaddset(&mask, SIGHUP) == 0); + PJDLOG_VERIFY(sigaddset(&mask, SIGINT) == 0); + PJDLOG_VERIFY(sigaddset(&mask, SIGTERM) == 0); + PJDLOG_VERIFY(sigaddset(&mask, SIGCHLD) == 0); + PJDLOG_VERIFY(sigprocmask(SIG_SETMASK, &mask, NULL) == 0); /* Listen on control address. */ if (proto_server(cfg->hc_controladdr, &cfg->hc_controlconn) < 0) { Modified: head/sbin/hastd/hastd.h ============================================================================== --- head/sbin/hastd/hastd.h Wed Sep 22 19:05:54 2010 (r213008) +++ head/sbin/hastd/hastd.h Wed Sep 22 19:08:11 2010 (r213009) @@ -40,7 +40,7 @@ #include "hast.h" extern const char *cfgpath; -extern bool sigchld_received, sigexit_received, sighup_received; +extern bool sigexit_received; extern struct pidfh *pfh; void hastd_primary(struct hast_resource *res); Modified: head/sbin/hastd/primary.c ============================================================================== --- head/sbin/hastd/primary.c Wed Sep 22 19:05:54 2010 (r213008) +++ head/sbin/hastd/primary.c Wed Sep 22 19:08:11 2010 (r213009) @@ -313,7 +313,6 @@ init_environment(struct hast_resource *r { struct hio *hio; unsigned int ii, ncomps; - sigset_t mask; /* * In the future it might be per-resource value. @@ -420,15 +419,6 @@ init_environment(struct hast_resource *r hio->hio_ggio.gctl_error = 0; TAILQ_INSERT_HEAD(&hio_free_list, hio, hio_free_next); } - - /* - * Turn on signals handling. - */ - PJDLOG_VERIFY(sigemptyset(&mask) == 0); - PJDLOG_VERIFY(sigaddset(&mask, SIGHUP) == 0); - PJDLOG_VERIFY(sigaddset(&mask, SIGINT) == 0); - PJDLOG_VERIFY(sigaddset(&mask, SIGTERM) == 0); - PJDLOG_VERIFY(sigprocmask(SIG_SETMASK, &mask, NULL) == 0); } static void @@ -800,9 +790,6 @@ hastd_primary(struct hast_resource *res) setproctitle("%s (primary)", res->hr_name); - signal(SIGHUP, SIG_DFL); - signal(SIGCHLD, SIG_DFL); - /* Declare that we are sender. */ proto_send(res->hr_event, NULL, 0); Modified: head/sbin/hastd/secondary.c ============================================================================== --- head/sbin/hastd/secondary.c Wed Sep 22 19:05:54 2010 (r213008) +++ head/sbin/hastd/secondary.c Wed Sep 22 19:08:11 2010 (r213009) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -334,6 +335,7 @@ init_remote(struct hast_resource *res, s void hastd_secondary(struct hast_resource *res, struct nv *nvin) { + sigset_t mask; pthread_t td; pid_t pid; int error; @@ -380,8 +382,8 @@ hastd_secondary(struct hast_resource *re setproctitle("%s (secondary)", res->hr_name); - signal(SIGHUP, SIG_DFL); - signal(SIGCHLD, SIG_DFL); + PJDLOG_VERIFY(sigemptyset(&mask) == 0); + PJDLOG_VERIFY(sigprocmask(SIG_SETMASK, &mask, NULL) == 0); /* Declare that we are sender. */ proto_send(res->hr_event, NULL, 0); From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 19:26:41 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7DD2D106564A; Wed, 22 Sep 2010 19:26:41 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6EC558FC08; Wed, 22 Sep 2010 19:26:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MJQfmY040330; Wed, 22 Sep 2010 19:26:41 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MJQf0e040328; Wed, 22 Sep 2010 19:26:41 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201009221926.o8MJQf0e040328@svn.freebsd.org> From: Ed Maste Date: Wed, 22 Sep 2010 19:26:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213012 - head/bin/ps X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:26:41 -0000 Author: emaste Date: Wed Sep 22 19:26:41 2010 New Revision: 213012 URL: http://svn.freebsd.org/changeset/base/213012 Log: Correct sort order. Modified: head/bin/ps/extern.h Modified: head/bin/ps/extern.h ============================================================================== --- head/bin/ps/extern.h Wed Sep 22 19:12:22 2010 (r213011) +++ head/bin/ps/extern.h Wed Sep 22 19:26:41 2010 (r213012) @@ -80,8 +80,8 @@ int s_uname(KINFO *); void showkey(void); void started(KINFO *, VARENT *); void state(KINFO *, VARENT *); -void tdnam(KINFO *, VARENT *); void tdev(KINFO *, VARENT *); +void tdnam(KINFO *, VARENT *); void tname(KINFO *, VARENT *); void ucomm(KINFO *, VARENT *); void uname(KINFO *, VARENT *); From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 19:41:02 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 22334106566C; Wed, 22 Sep 2010 19:41:02 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 131478FC16; Wed, 22 Sep 2010 19:41:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MJf1ok040689; Wed, 22 Sep 2010 19:41:01 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MJf1LD040687; Wed, 22 Sep 2010 19:41:01 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201009221941.o8MJf1LD040687@svn.freebsd.org> From: Ed Maste Date: Wed, 22 Sep 2010 19:41:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213013 - head/gnu/usr.bin/gdb/kgdb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:41:02 -0000 Author: emaste Date: Wed Sep 22 19:41:01 2010 New Revision: 213013 URL: http://svn.freebsd.org/changeset/base/213013 Log: Move test for zero bufp or size before rseq and wseq calculation. This avoids spinning in an infinite loop for some (possibly corrupt?) core files at work. Modified: head/gnu/usr.bin/gdb/kgdb/main.c Modified: head/gnu/usr.bin/gdb/kgdb/main.c ============================================================================== --- head/gnu/usr.bin/gdb/kgdb/main.c Wed Sep 22 19:26:41 2010 (r213012) +++ head/gnu/usr.bin/gdb/kgdb/main.c Wed Sep 22 19:41:01 2010 (r213013) @@ -222,11 +222,13 @@ kgdb_dmesg(void) return; bufp = kgdb_parse("msgbufp->msg_ptr"); size = (int)kgdb_parse("msgbufp->msg_size"); + if (bufp == 0 || size == 0) + return; rseq = (int)kgdb_parse("msgbufp->msg_rseq"); wseq = (int)kgdb_parse("msgbufp->msg_wseq"); rseq = MSGBUF_SEQ_TO_POS(size, rseq); wseq = MSGBUF_SEQ_TO_POS(size, wseq); - if (bufp == 0 || size == 0 || rseq == wseq) + if (rseq == wseq) return; printf("\nUnread portion of the kernel message buffer:\n"); From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 19:48:07 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EC767106566C; Wed, 22 Sep 2010 19:48:07 +0000 (UTC) (envelope-from rpaulo@freebsd.org) Received: from karen.lavabit.com (karen.lavabit.com [72.249.41.33]) by mx1.freebsd.org (Postfix) with ESMTP id BA07C8FC0A; Wed, 22 Sep 2010 19:48:07 +0000 (UTC) Received: from d.earth.lavabit.com (d.earth.lavabit.com [192.168.111.13]) by karen.lavabit.com (Postfix) with ESMTP id DE42111BA22; Wed, 22 Sep 2010 14:48:06 -0500 (CDT) Received: from 10.0.10.3 (221.163.108.93.rev.vodafone.pt [93.108.163.221]) by lavabit.com with ESMTP id G4Q2GA9ZXZ1O; Wed, 22 Sep 2010 14:48:06 -0500 Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: text/plain; charset=us-ascii From: Rui Paulo In-Reply-To: <1285180346.65489.3.camel@buffy.york.ac.uk> Date: Wed, 22 Sep 2010 20:48:03 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <4461F6BE-707F-40D4-93F0-6661332A38C6@FreeBSD.org> References: <201009221800.o8MI0Ze3038214@svn.freebsd.org> <1285180346.65489.3.camel@buffy.york.ac.uk> To: Gavin Atkinson X-Mailer: Apple Mail (2.1081) Cc: svn-src-stable@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, svn-src-stable-8@FreeBSD.org Subject: Re: svn commit: r213002 - in stable/8: include lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:48:08 -0000 On 22 Sep 2010, at 19:32, Gavin Atkinson wrote: > On Wed, 2010-09-22 at 18:00 +0000, Rui Paulo wrote: >> Author: rpaulo >> Date: Wed Sep 22 18:00:34 2010 >> New Revision: 213002 >> URL: http://svn.freebsd.org/changeset/base/213002 >>=20 >> Log: >> MFC r197804 (rwatson): >> Add basename_r(3) to complement basename(3). basename_r(3) which = accepts >> a caller-allocated buffer of at least MAXPATHLEN, rather than = using a >> global buffer. >>=20 >> Note about semantics: while this interface is not POSIXy, there's >> another major platform that uses it (Android) and the semantics = between >> the two platforms are pretty much the same. >=20 > Are you sure? >=20 > Ours (just introduced): >=20 > char * basename_r(path, bname) >=20 > Android (from [1]): >=20 > int basename_r(const char* path, char* buffer, size_t bufflen) >=20 > The semantics seem very different. Ours allocates a buffer, on = Android > you pass in a buffer, for a start. Hmm, I only looked at the function body... It seems that the best way to = overcome this is to just add a len parameter. The return value can also = be changed. P.S.: Our basename_r() performs no allocation. You were probably looking = at basename(). Regards, -- Rui Paulo From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 19:55:38 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F1E7A106566C; Wed, 22 Sep 2010 19:55:37 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E1C678FC12; Wed, 22 Sep 2010 19:55:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MJtboh041026; Wed, 22 Sep 2010 19:55:37 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MJtbDi041024; Wed, 22 Sep 2010 19:55:37 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009221955.o8MJtbDi041024@svn.freebsd.org> From: Marius Strobl Date: Wed, 22 Sep 2010 19:55:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213014 - stable/8/sys/sparc64/sparc64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:55:38 -0000 Author: marius Date: Wed Sep 22 19:55:37 2010 New Revision: 213014 URL: http://svn.freebsd.org/changeset/base/213014 Log: MFC: r212663 - Update the comment in swi_vm() regarding busdma bounce buffers; it's unlikely that support for these ever will be implemented on sparc64 as the IOMMUs are able to translate to up to the maximum physical address supported by the respective machine, bypassing the IOMMU is affected by hardware errata and being able to support DMA engines which cannot do at least 32-bit DMA does not justify the costs. - The page zeroing in uma_small_alloc() may use the VIS-based block zero function so take advantage of it. Modified: stable/8/sys/sparc64/sparc64/vm_machdep.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/sparc64/sparc64/vm_machdep.c ============================================================================== --- stable/8/sys/sparc64/sparc64/vm_machdep.c Wed Sep 22 19:41:01 2010 (r213013) +++ stable/8/sys/sparc64/sparc64/vm_machdep.c Wed Sep 22 19:55:37 2010 (r213014) @@ -492,10 +492,7 @@ void swi_vm(void *v) { - /* - * Nothing to do here yet - busdma bounce buffers are not yet - * implemented. - */ + /* Nothing to do here - busdma bounce buffers are not implemented. */ } void * @@ -540,7 +537,7 @@ uma_small_alloc(uma_zone_t zone, int byt } va = (void *)TLB_PHYS_TO_DIRECT(pa); if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0) - bzero(va, PAGE_SIZE); + cpu_block_zero(va, PAGE_SIZE); return (va); } From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 19:55:40 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C32B6106576A; Wed, 22 Sep 2010 19:55:40 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B23A98FC1C; Wed, 22 Sep 2010 19:55:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MJteZp041060; Wed, 22 Sep 2010 19:55:40 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MJtex4041058; Wed, 22 Sep 2010 19:55:40 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009221955.o8MJtex4041058@svn.freebsd.org> From: Marius Strobl Date: Wed, 22 Sep 2010 19:55:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213015 - stable/7/sys/sparc64/sparc64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:55:41 -0000 Author: marius Date: Wed Sep 22 19:55:40 2010 New Revision: 213015 URL: http://svn.freebsd.org/changeset/base/213015 Log: MFC: r212663 - Update the comment in swi_vm() regarding busdma bounce buffers; it's unlikely that support for these ever will be implemented on sparc64 as the IOMMUs are able to translate to up to the maximum physical address supported by the respective machine, bypassing the IOMMU is affected by hardware errata and being able to support DMA engines which cannot do at least 32-bit DMA does not justify the costs. - The page zeroing in uma_small_alloc() may use the VIS-based block zero function so take advantage of it. Modified: stable/7/sys/sparc64/sparc64/vm_machdep.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/sparc64/sparc64/vm_machdep.c ============================================================================== --- stable/7/sys/sparc64/sparc64/vm_machdep.c Wed Sep 22 19:55:37 2010 (r213014) +++ stable/7/sys/sparc64/sparc64/vm_machdep.c Wed Sep 22 19:55:40 2010 (r213015) @@ -456,10 +456,7 @@ void swi_vm(void *v) { - /* - * Nothing to do here yet - busdma bounce buffers are not yet - * implemented. - */ + /* Nothing to do here - busdma bounce buffers are not implemented. */ } void * @@ -504,7 +501,7 @@ uma_small_alloc(uma_zone_t zone, int byt } va = (void *)TLB_PHYS_TO_DIRECT(pa); if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0) - bzero(va, PAGE_SIZE); + cpu_block_zero(va, PAGE_SIZE); return (va); } From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 19:58:38 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ACBC01065704; Wed, 22 Sep 2010 19:58:38 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 7F79E8FC0C; Wed, 22 Sep 2010 19:58:38 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 3273546B46; Wed, 22 Sep 2010 15:58:38 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id C21658A03C; Wed, 22 Sep 2010 15:58:36 -0400 (EDT) From: John Baldwin To: Gavin Atkinson Date: Wed, 22 Sep 2010 15:58:27 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201009211507.o8LF7iVv097676@svn.freebsd.org> <4C9A1602.4020204@freebsd.org> <1285169017.64197.29.camel@buffy.york.ac.uk> In-Reply-To: <1285169017.64197.29.camel@buffy.york.ac.uk> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201009221558.27393.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Wed, 22 Sep 2010 15:58:36 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andriy Gapon Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:58:38 -0000 On Wednesday, September 22, 2010 11:23:37 am Gavin Atkinson wrote: > On Wed, 2010-09-22 at 17:43 +0300, Andriy Gapon wrote: > > on 22/09/2010 16:46 Gavin Atkinson said the following: > > > Ignoring the rest of the discussion about locking, I think this is a > > > step in the right direction. However, what I feel we should be strongly > > > considering is for textdumps to be enabled by default on release media. > > > > > > As more groups choose to use the kernels from the release media (PC-BSD, > > > FreeNAS, etc) and put them into places where end users are never > > > expected to recompile kernels, having textdumps enabled by default in > > > RELEASE kernels becomes a bigger and bigger priority. Groups like > > > PC-BSD don't necessarily have the time or skills to do the needed kernel > > > debugging (and nor should they have to, it's not their purpose), so > > > anything we can do in releases to make sure we have enough info to > > > resolve panics seen by their users is a big bonus. > > > > > > Is there any real reason why we shouldn't go down this route? > > > > textdumps need DDB. > > textdumps also need dumpdev which is not enabled by default in > > /etc/defaults/rc.conf, but that's easier to fix for any individual user or a > > FreeBSD "distribution". > > Indeed, I was happy to see dumpdev enabled on 7.x, and disappointed to > see it disabled on 8.x. Agreed. FWIW, I actually think that this is the only change needed as crashinfo is enabled by default in 8.x and later. We already include symbols in kernels by default now, so just setting dumpdev will give you the same info you generally can get from a textdump in the form of a simple /var/crash/core.txt.N file. The other benefit of full crashdumps + crashinfo as compared to textdumps is that a developer can request further information in a PR followup (fire up kgdb and enter command 'X' and reply with the output). With a textdump any info not collected by the textdump is lost once the machine reboots after the crash. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 19:59:11 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D7A2C1065670; Wed, 22 Sep 2010 19:59:11 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C729B8FC14; Wed, 22 Sep 2010 19:59:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MJxBsD041371; Wed, 22 Sep 2010 19:59:11 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MJxBYH041368; Wed, 22 Sep 2010 19:59:11 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009221959.o8MJxBYH041368@svn.freebsd.org> From: Marius Strobl Date: Wed, 22 Sep 2010 19:59:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213016 - in stable/8/sys: sparc64/sparc64 sun4v/sun4v X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:59:12 -0000 Author: marius Date: Wed Sep 22 19:59:11 2010 New Revision: 213016 URL: http://svn.freebsd.org/changeset/base/213016 Log: MFC: r212676 Sync with other platforms: - make dflt_lock() always panic, - add kludge to use contigmalloc() when the alignment is larger than the size and print a diagnostic when we didn't satisfy the alignment. Modified: stable/8/sys/sparc64/sparc64/bus_machdep.c stable/8/sys/sun4v/sun4v/bus_machdep.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/sparc64/sparc64/bus_machdep.c ============================================================================== --- stable/8/sys/sparc64/sparc64/bus_machdep.c Wed Sep 22 19:55:40 2010 (r213015) +++ stable/8/sys/sparc64/sparc64/bus_machdep.c Wed Sep 22 19:59:11 2010 (r213016) @@ -182,11 +182,8 @@ busdma_lock_mutex(void *arg, bus_dma_loc static void dflt_lock(void *arg, bus_dma_lock_op_t op) { -#ifdef INVARIANTS + panic("driver error: busdma dflt_lock called"); -#else - printf("DRIVER_ERROR: busdma dflt_lock called\n"); -#endif } /* @@ -631,9 +628,18 @@ nexus_dmamem_alloc(bus_dma_tag_t dmat, v if (flags & BUS_DMA_ZERO) mflags |= M_ZERO; - if ((dmat->dt_maxsize <= PAGE_SIZE)) { + /* + * XXX: + * (dmat->dt_alignment < dmat->dt_maxsize) is just a quick hack; the + * exact alignment guarantees of malloc need to be nailed down, and + * the code below should be rewritten to take that into account. + * + * In the meantime, we'll warn the user if malloc gets it wrong. + */ + if (dmat->dt_maxsize <= PAGE_SIZE && + dmat->dt_alignment < dmat->dt_maxsize) *vaddr = malloc(dmat->dt_maxsize, M_DEVBUF, mflags); - } else { + else { /* * XXX use contigmalloc until it is merged into this * facility and handles multi-seg allocations. Nobody @@ -646,6 +652,8 @@ nexus_dmamem_alloc(bus_dma_tag_t dmat, v } if (*vaddr == NULL) return (ENOMEM); + if ((uintptr_t)*vaddr % dmat->dt_alignment) + printf("%s: failed to align memory properly.\n", __func__); return (0); } @@ -657,11 +665,11 @@ static void nexus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map) { - if ((dmat->dt_maxsize <= PAGE_SIZE)) + if (dmat->dt_maxsize <= PAGE_SIZE && + dmat->dt_alignment < dmat->dt_maxsize) free(vaddr, M_DEVBUF); - else { + else contigfree(vaddr, dmat->dt_maxsize, M_DEVBUF); - } } struct bus_dma_methods nexus_dma_methods = { Modified: stable/8/sys/sun4v/sun4v/bus_machdep.c ============================================================================== --- stable/8/sys/sun4v/sun4v/bus_machdep.c Wed Sep 22 19:55:40 2010 (r213015) +++ stable/8/sys/sun4v/sun4v/bus_machdep.c Wed Sep 22 19:59:11 2010 (r213016) @@ -181,11 +181,8 @@ busdma_lock_mutex(void *arg, bus_dma_loc static void dflt_lock(void *arg, bus_dma_lock_op_t op) { -#ifdef INVARIANTS + panic("driver error: busdma dflt_lock called"); -#else - printf("DRIVER_ERROR: busdma dflt_lock called\n"); -#endif } /* @@ -647,9 +644,18 @@ nexus_dmamem_alloc(bus_dma_tag_t dmat, v if (flags & BUS_DMA_ZERO) mflags |= M_ZERO; - if ((dmat->dt_maxsize <= PAGE_SIZE)) { + /* + * XXX: + * (dmat->dt_alignment < dmat->dt_maxsize) is just a quick hack; the + * exact alignment guarantees of malloc need to be nailed down, and + * the code below should be rewritten to take that into account. + * + * In the meantime, we'll warn the user if malloc gets it wrong. + */ + if (dmat->dt_maxsize <= PAGE_SIZE && + dmat->dt_alignment < dmat->dt_maxsize) *vaddr = malloc(dmat->dt_maxsize, M_DEVBUF, mflags); - } else { + else { /* * XXX use contigmalloc until it is merged into this * facility and handles multi-seg allocations. Nobody @@ -662,6 +668,8 @@ nexus_dmamem_alloc(bus_dma_tag_t dmat, v } if (*vaddr == NULL) return (ENOMEM); + if ((uintptr_t)*vaddr % dmat->dt_alignment) + printf("%s: failed to align memory properly.\n", __func__); return (0); } @@ -673,11 +681,11 @@ static void nexus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map) { - if ((dmat->dt_maxsize <= PAGE_SIZE)) + if (dmat->dt_maxsize <= PAGE_SIZE && + dmat->dt_alignment < dmat->dt_maxsize) free(vaddr, M_DEVBUF); - else { + else contigfree(vaddr, dmat->dt_maxsize, M_DEVBUF); - } } struct bus_dma_methods nexus_dma_methods = { From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 19:59:12 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 302B01065674; Wed, 22 Sep 2010 19:59:12 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1F45C8FC16; Wed, 22 Sep 2010 19:59:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MJxCwE041387; Wed, 22 Sep 2010 19:59:12 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MJxBsu041384; Wed, 22 Sep 2010 19:59:11 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009221959.o8MJxBsu041384@svn.freebsd.org> From: Marius Strobl Date: Wed, 22 Sep 2010 19:59:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213017 - in stable/7/sys: sparc64/sparc64 sun4v/sun4v X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:59:12 -0000 Author: marius Date: Wed Sep 22 19:59:11 2010 New Revision: 213017 URL: http://svn.freebsd.org/changeset/base/213017 Log: MFC: r212676 Sync with other platforms: - make dflt_lock() always panic, - add kludge to use contigmalloc() when the alignment is larger than the size and print a diagnostic when we didn't satisfy the alignment. Modified: stable/7/sys/sparc64/sparc64/bus_machdep.c stable/7/sys/sun4v/sun4v/bus_machdep.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/sparc64/sparc64/bus_machdep.c ============================================================================== --- stable/7/sys/sparc64/sparc64/bus_machdep.c Wed Sep 22 19:59:11 2010 (r213016) +++ stable/7/sys/sparc64/sparc64/bus_machdep.c Wed Sep 22 19:59:11 2010 (r213017) @@ -182,11 +182,8 @@ busdma_lock_mutex(void *arg, bus_dma_loc static void dflt_lock(void *arg, bus_dma_lock_op_t op) { -#ifdef INVARIANTS + panic("driver error: busdma dflt_lock called"); -#else - printf("DRIVER_ERROR: busdma dflt_lock called\n"); -#endif } /* @@ -638,9 +635,18 @@ nexus_dmamem_alloc(bus_dma_tag_t dmat, v if (flags & BUS_DMA_ZERO) mflags |= M_ZERO; - if ((dmat->dt_maxsize <= PAGE_SIZE)) { + /* + * XXX: + * (dmat->dt_alignment < dmat->dt_maxsize) is just a quick hack; the + * exact alignment guarantees of malloc need to be nailed down, and + * the code below should be rewritten to take that into account. + * + * In the meantime, we'll warn the user if malloc gets it wrong. + */ + if (dmat->dt_maxsize <= PAGE_SIZE && + dmat->dt_alignment < dmat->dt_maxsize) *vaddr = malloc(dmat->dt_maxsize, M_DEVBUF, mflags); - } else { + else { /* * XXX use contigmalloc until it is merged into this * facility and handles multi-seg allocations. Nobody @@ -653,6 +659,8 @@ nexus_dmamem_alloc(bus_dma_tag_t dmat, v } if (*vaddr == NULL) return (ENOMEM); + if ((uintptr_t)*vaddr % dmat->dt_alignment) + printf("%s: failed to align memory properly.\n", __func__); return (0); } @@ -664,11 +672,11 @@ static void nexus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map) { - if ((dmat->dt_maxsize <= PAGE_SIZE)) + if (dmat->dt_maxsize <= PAGE_SIZE && + dmat->dt_alignment < dmat->dt_maxsize) free(vaddr, M_DEVBUF); - else { + else contigfree(vaddr, dmat->dt_maxsize, M_DEVBUF); - } } struct bus_dma_methods nexus_dma_methods = { Modified: stable/7/sys/sun4v/sun4v/bus_machdep.c ============================================================================== --- stable/7/sys/sun4v/sun4v/bus_machdep.c Wed Sep 22 19:59:11 2010 (r213016) +++ stable/7/sys/sun4v/sun4v/bus_machdep.c Wed Sep 22 19:59:11 2010 (r213017) @@ -181,11 +181,8 @@ busdma_lock_mutex(void *arg, bus_dma_loc static void dflt_lock(void *arg, bus_dma_lock_op_t op) { -#ifdef INVARIANTS + panic("driver error: busdma dflt_lock called"); -#else - printf("DRIVER_ERROR: busdma dflt_lock called\n"); -#endif } /* @@ -647,9 +644,18 @@ nexus_dmamem_alloc(bus_dma_tag_t dmat, v if (flags & BUS_DMA_ZERO) mflags |= M_ZERO; - if ((dmat->dt_maxsize <= PAGE_SIZE)) { + /* + * XXX: + * (dmat->dt_alignment < dmat->dt_maxsize) is just a quick hack; the + * exact alignment guarantees of malloc need to be nailed down, and + * the code below should be rewritten to take that into account. + * + * In the meantime, we'll warn the user if malloc gets it wrong. + */ + if (dmat->dt_maxsize <= PAGE_SIZE && + dmat->dt_alignment < dmat->dt_maxsize) *vaddr = malloc(dmat->dt_maxsize, M_DEVBUF, mflags); - } else { + else { /* * XXX use contigmalloc until it is merged into this * facility and handles multi-seg allocations. Nobody @@ -662,6 +668,8 @@ nexus_dmamem_alloc(bus_dma_tag_t dmat, v } if (*vaddr == NULL) return (ENOMEM); + if ((uintptr_t)*vaddr % dmat->dt_alignment) + printf("%s: failed to align memory properly.\n", __func__); return (0); } @@ -673,11 +681,11 @@ static void nexus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map) { - if ((dmat->dt_maxsize <= PAGE_SIZE)) + if (dmat->dt_maxsize <= PAGE_SIZE && + dmat->dt_alignment < dmat->dt_maxsize) free(vaddr, M_DEVBUF); - else { + else contigfree(vaddr, dmat->dt_maxsize, M_DEVBUF); - } } struct bus_dma_methods nexus_dma_methods = { From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 20:01:33 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 614BE10656A7; Wed, 22 Sep 2010 20:01:33 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 512D18FC13; Wed, 22 Sep 2010 20:01:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MK1XUC041529; Wed, 22 Sep 2010 20:01:33 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MK1XBp041527; Wed, 22 Sep 2010 20:01:33 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009222001.o8MK1XBp041527@svn.freebsd.org> From: Marius Strobl Date: Wed, 22 Sep 2010 20:01:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213018 - stable/8/sys/sparc64/include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 20:01:33 -0000 Author: marius Date: Wed Sep 22 20:01:33 2010 New Revision: 213018 URL: http://svn.freebsd.org/changeset/base/213018 Log: MFC: r212705 Add macros for alternate entry points. Modified: stable/8/sys/sparc64/include/asm.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/sparc64/include/asm.h ============================================================================== --- stable/8/sys/sparc64/include/asm.h Wed Sep 22 19:59:11 2010 (r213017) +++ stable/8/sys/sparc64/include/asm.h Wed Sep 22 20:01:33 2010 (r213018) @@ -76,7 +76,7 @@ _ALIGN_TEXT /* - * Define a function entry point. + * Define function entry and alternate entry points. * * The compiler produces #function for the .type pseudo-op, but the '#' * character has special meaning in cpp macros, so we use @function like @@ -86,12 +86,19 @@ * value. Since this is difficult to predict and its expected that * assembler code is already optimized, we leave it out. */ + +#define _ALTENTRY(x) \ + .globl CNAME(x) ; \ + .type CNAME(x),@function ; \ +CNAME(x): + #define _ENTRY(x) \ _START_ENTRY ; \ .globl CNAME(x) ; \ .type CNAME(x),@function ; \ CNAME(x): +#define ALTENTRY(x) _ALTENTRY(x) #define ENTRY(x) _ENTRY(x) #define END(x) .size x, . - x From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 20:01:36 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 71B911065804; Wed, 22 Sep 2010 20:01:36 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AE0B18FC0A; Wed, 22 Sep 2010 20:01:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MK1Za0041563; Wed, 22 Sep 2010 20:01:35 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MK1Zcm041561; Wed, 22 Sep 2010 20:01:35 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009222001.o8MK1Zcm041561@svn.freebsd.org> From: Marius Strobl Date: Wed, 22 Sep 2010 20:01:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213019 - stable/7/sys/sparc64/include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 20:01:36 -0000 Author: marius Date: Wed Sep 22 20:01:35 2010 New Revision: 213019 URL: http://svn.freebsd.org/changeset/base/213019 Log: MFC: r212705 Add macros for alternate entry points. Modified: stable/7/sys/sparc64/include/asm.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/sparc64/include/asm.h ============================================================================== --- stable/7/sys/sparc64/include/asm.h Wed Sep 22 20:01:33 2010 (r213018) +++ stable/7/sys/sparc64/include/asm.h Wed Sep 22 20:01:35 2010 (r213019) @@ -76,7 +76,7 @@ _ALIGN_TEXT /* - * Define a function entry point. + * Define function entry and alternate entry points. * * The compiler produces #function for the .type pseudo-op, but the '#' * character has special meaning in cpp macros, so we use @function like @@ -86,12 +86,19 @@ * value. Since this is difficult to predict and its expected that * assembler code is already optimized, we leave it out. */ + +#define _ALTENTRY(x) \ + .globl CNAME(x) ; \ + .type CNAME(x),@function ; \ +CNAME(x): + #define _ENTRY(x) \ _START_ENTRY ; \ .globl CNAME(x) ; \ .type CNAME(x),@function ; \ CNAME(x): +#define ALTENTRY(x) _ALTENTRY(x) #define ENTRY(x) _ENTRY(x) #define END(x) .size x, . - x From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 20:04:00 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5748E1065673; Wed, 22 Sep 2010 20:04:00 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3D7498FC19; Wed, 22 Sep 2010 20:04:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MK40ht041702; Wed, 22 Sep 2010 20:04:00 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MK40pH041698; Wed, 22 Sep 2010 20:04:00 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009222004.o8MK40pH041698@svn.freebsd.org> From: Marius Strobl Date: Wed, 22 Sep 2010 20:04:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213020 - in stable/8/sys/sparc64: include sparc64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 20:04:00 -0000 Author: marius Date: Wed Sep 22 20:03:59 2010 New Revision: 213020 URL: http://svn.freebsd.org/changeset/base/213020 Log: MFC: rr212709, r212730 Add a VIS-based block copy function for SPARC64 V and later, which additionally takes advantage of the prefetch cache of these CPUs. Unlike the uncommitted US-III version, which provide no measurable speedup or even resulted in a slight slowdown on certain CPUs models compared to using the US-I version with these, the SPARC64 version actually results in a slight improvement. Modified: stable/8/sys/sparc64/include/md_var.h stable/8/sys/sparc64/sparc64/machdep.c stable/8/sys/sparc64/sparc64/support.S Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/sparc64/include/md_var.h ============================================================================== --- stable/8/sys/sparc64/include/md_var.h Wed Sep 22 20:01:35 2010 (r213019) +++ stable/8/sys/sparc64/include/md_var.h Wed Sep 22 20:03:59 2010 (r213020) @@ -58,6 +58,8 @@ struct md_utrap *utrap_hold(struct md_ut cpu_block_copy_t spitfire_block_copy; cpu_block_zero_t spitfire_block_zero; +cpu_block_copy_t zeus_block_copy; +cpu_block_zero_t zeus_block_zero; extern cpu_block_copy_t *cpu_block_copy; extern cpu_block_zero_t *cpu_block_zero; Modified: stable/8/sys/sparc64/sparc64/machdep.c ============================================================================== --- stable/8/sys/sparc64/sparc64/machdep.c Wed Sep 22 20:01:35 2010 (r213019) +++ stable/8/sys/sparc64/sparc64/machdep.c Wed Sep 22 20:03:59 2010 (r213020) @@ -494,7 +494,6 @@ sparc64_init(caddr_t mdp, u_long o1, u_l if (cpu_use_vis) { switch (cpu_impl) { case CPU_IMPL_SPARC64: - case CPU_IMPL_SPARC64V: case CPU_IMPL_ULTRASPARCI: case CPU_IMPL_ULTRASPARCII: case CPU_IMPL_ULTRASPARCIIi: @@ -508,6 +507,10 @@ sparc64_init(caddr_t mdp, u_long o1, u_l cpu_block_copy = spitfire_block_copy; cpu_block_zero = spitfire_block_zero; break; + case CPU_IMPL_SPARC64V: + cpu_block_copy = zeus_block_copy; + cpu_block_zero = zeus_block_zero; + break; } } Modified: stable/8/sys/sparc64/sparc64/support.S ============================================================================== --- stable/8/sys/sparc64/sparc64/support.S Wed Sep 22 20:01:35 2010 (r213019) +++ stable/8/sys/sparc64/sparc64/support.S Wed Sep 22 20:03:59 2010 (r213020) @@ -661,8 +661,121 @@ ENTRY(spitfire_block_copy) END(spitfire_block_copy) /* + * void zeus_block_copy(void *src, void *dst, size_t len) + */ +ENTRY(zeus_block_copy) + prefetch [%o0 + (0 * 64)], 0 + + rdpr %pil, %o3 + wrpr %g0, PIL_TICK, %pil + + wr %g0, ASI_BLK_S, %asi + wr %g0, FPRS_FEF, %fprs + + sub PCB_REG, TF_SIZEOF, %o4 + ldx [%o4 + TF_FPRS], %o5 + andcc %o5, FPRS_FEF, %g0 + bz,a,pt %xcc, 1f + nop + stda %f0, [PCB_REG + PCB_UFP + (0 * 64)] %asi + stda %f16, [PCB_REG + PCB_UFP + (1 * 64)] %asi + stda %f32, [PCB_REG + PCB_UFP + (2 * 64)] %asi + stda %f48, [PCB_REG + PCB_UFP + (3 * 64)] %asi + membar #Sync + + andn %o5, FPRS_FEF, %o5 + stx %o5, [%o4 + TF_FPRS] + ldx [PCB_REG + PCB_FLAGS], %o4 + or %o4, PCB_FEF, %o4 + stx %o4, [PCB_REG + PCB_FLAGS] + +1: wrpr %o3, 0, %pil + + ldd [%o0 + (0 * 8)], %f0 + prefetch [%o0 + (1 * 64)], 0 + ldd [%o0 + (1 * 8)], %f2 + prefetch [%o0 + (2 * 64)], 0 + fmovd %f0, %f32 + ldd [%o0 + (2 * 8)], %f4 + prefetch [%o0 + (3 * 64)], 0 + fmovd %f2, %f34 + ldd [%o0 + (3 * 8)], %f6 + prefetch [%o0 + (4 * 64)], 1 + fmovd %f4, %f36 + ldd [%o0 + (4 * 8)], %f8 + prefetch [%o0 + (8 * 64)], 1 + fmovd %f6, %f38 + ldd [%o0 + (5 * 8)], %f10 + prefetch [%o0 + (12 * 64)], 1 + fmovd %f8, %f40 + ldd [%o0 + (6 * 8)], %f12 + prefetch [%o0 + (16 * 64)], 1 + fmovd %f10, %f42 + ldd [%o0 + (7 * 8)], %f14 + ldd [%o0 + (8 * 8)], %f0 + sub %o2, 64, %o2 + add %o0, 64, %o0 + prefetch [%o0 + (19 * 64)], 1 + ba,pt %xcc, 2f + prefetch [%o0 + (23 * 64)], 1 + .align 32 + +2: ldd [%o0 + (1 * 8)], %f2 + fmovd %f12, %f44 + ldd [%o0 + (2 * 8)], %f4 + fmovd %f14, %f46 + stda %f32, [%o1] %asi + ldd [%o0 + (3 * 8)], %f6 + fmovd %f0, %f32 + ldd [%o0 + (4 * 8)], %f8 + fmovd %f2, %f34 + ldd [%o0 + (5 * 8)], %f10 + fmovd %f4, %f36 + ldd [%o0 + (6 * 8)], %f12 + fmovd %f6, %f38 + ldd [%o0 + (7 * 8)], %f14 + fmovd %f8, %f40 + ldd [%o0 + (8 * 8)], %f0 + fmovd %f10, %f42 + sub %o2, 64, %o2 + prefetch [%o0 + (3 * 64)], 0 + add %o1, 64, %o1 + prefetch [%o0 + (24 * 64)], 1 + add %o0, 64, %o0 + cmp %o2, 64 + 8 + bgu,pt %xcc, 2b + prefetch [%o0 + (12 * 64)], 1 + ldd [%o0 + (1 * 8)], %f2 + fsrc1 %f12, %f44 + ldd [%o0 + (2 * 8)], %f4 + fsrc1 %f14, %f46 + stda %f32, [%o1] %asi + ldd [%o0 + (3 * 8)], %f6 + fsrc1 %f0, %f32 + ldd [%o0 + (4 * 8)], %f8 + fsrc1 %f2, %f34 + ldd [%o0 + (5 * 8)], %f10 + fsrc1 %f4, %f36 + ldd [%o0 + (6 * 8)], %f12 + fsrc1 %f6, %f38 + ldd [%o0 + (7 * 8)], %f14 + fsrc1 %f8, %f40 + add %o1, 64, %o1 + fsrc1 %f10, %f42 + fsrc1 %f12, %f44 + fsrc1 %f14, %f46 + stda %f32, [%o1] %asi + membar #Sync + + retl + wr %g0, 0, %fprs +END(zeus_block_copy) + +/* * void spitfire_block_zero(void *dst, size_t len) + * void zeus_block_zero(void *dst, size_t len) */ +ALTENTRY(zeus_block_zero) ENTRY(spitfire_block_zero) rdpr %pil, %o3 wrpr %g0, PIL_TICK, %pil From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 20:04:04 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5D45F1065769; Wed, 22 Sep 2010 20:04:04 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4C5B08FC12; Wed, 22 Sep 2010 20:04:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MK44dA041744; Wed, 22 Sep 2010 20:04:04 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MK444o041739; Wed, 22 Sep 2010 20:04:04 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009222004.o8MK444o041739@svn.freebsd.org> From: Marius Strobl Date: Wed, 22 Sep 2010 20:04:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213021 - in stable/7/sys/sparc64: include sparc64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 20:04:04 -0000 Author: marius Date: Wed Sep 22 20:04:03 2010 New Revision: 213021 URL: http://svn.freebsd.org/changeset/base/213021 Log: MFC: rr212709, r212730 Add a VIS-based block copy function for SPARC64 V and later, which additionally takes advantage of the prefetch cache of these CPUs. Unlike the uncommitted US-III version, which provide no measurable speedup or even resulted in a slight slowdown on certain CPUs models compared to using the US-I version with these, the SPARC64 version actually results in a slight improvement. Modified: stable/7/sys/sparc64/include/md_var.h stable/7/sys/sparc64/sparc64/machdep.c stable/7/sys/sparc64/sparc64/support.S Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/sparc64/include/md_var.h ============================================================================== --- stable/7/sys/sparc64/include/md_var.h Wed Sep 22 20:03:59 2010 (r213020) +++ stable/7/sys/sparc64/include/md_var.h Wed Sep 22 20:04:03 2010 (r213021) @@ -58,6 +58,8 @@ struct md_utrap *utrap_hold(struct md_ut cpu_block_copy_t spitfire_block_copy; cpu_block_zero_t spitfire_block_zero; +cpu_block_copy_t zeus_block_copy; +cpu_block_zero_t zeus_block_zero; extern cpu_block_copy_t *cpu_block_copy; extern cpu_block_zero_t *cpu_block_zero; Modified: stable/7/sys/sparc64/sparc64/machdep.c ============================================================================== --- stable/7/sys/sparc64/sparc64/machdep.c Wed Sep 22 20:03:59 2010 (r213020) +++ stable/7/sys/sparc64/sparc64/machdep.c Wed Sep 22 20:04:03 2010 (r213021) @@ -486,7 +486,6 @@ sparc64_init(caddr_t mdp, u_long o1, u_l if (cpu_use_vis) { switch (cpu_impl) { case CPU_IMPL_SPARC64: - case CPU_IMPL_SPARC64V: case CPU_IMPL_ULTRASPARCI: case CPU_IMPL_ULTRASPARCII: case CPU_IMPL_ULTRASPARCIIi: @@ -500,6 +499,10 @@ sparc64_init(caddr_t mdp, u_long o1, u_l cpu_block_copy = spitfire_block_copy; cpu_block_zero = spitfire_block_zero; break; + case CPU_IMPL_SPARC64V: + cpu_block_copy = zeus_block_copy; + cpu_block_zero = zeus_block_zero; + break; } } Modified: stable/7/sys/sparc64/sparc64/support.S ============================================================================== --- stable/7/sys/sparc64/sparc64/support.S Wed Sep 22 20:03:59 2010 (r213020) +++ stable/7/sys/sparc64/sparc64/support.S Wed Sep 22 20:04:03 2010 (r213021) @@ -661,8 +661,121 @@ ENTRY(spitfire_block_copy) END(spitfire_block_copy) /* + * void zeus_block_copy(void *src, void *dst, size_t len) + */ +ENTRY(zeus_block_copy) + prefetch [%o0 + (0 * 64)], 0 + + rdpr %pil, %o3 + wrpr %g0, PIL_TICK, %pil + + wr %g0, ASI_BLK_S, %asi + wr %g0, FPRS_FEF, %fprs + + sub PCB_REG, TF_SIZEOF, %o4 + ldx [%o4 + TF_FPRS], %o5 + andcc %o5, FPRS_FEF, %g0 + bz,a,pt %xcc, 1f + nop + stda %f0, [PCB_REG + PCB_UFP + (0 * 64)] %asi + stda %f16, [PCB_REG + PCB_UFP + (1 * 64)] %asi + stda %f32, [PCB_REG + PCB_UFP + (2 * 64)] %asi + stda %f48, [PCB_REG + PCB_UFP + (3 * 64)] %asi + membar #Sync + + andn %o5, FPRS_FEF, %o5 + stx %o5, [%o4 + TF_FPRS] + ldx [PCB_REG + PCB_FLAGS], %o4 + or %o4, PCB_FEF, %o4 + stx %o4, [PCB_REG + PCB_FLAGS] + +1: wrpr %o3, 0, %pil + + ldd [%o0 + (0 * 8)], %f0 + prefetch [%o0 + (1 * 64)], 0 + ldd [%o0 + (1 * 8)], %f2 + prefetch [%o0 + (2 * 64)], 0 + fmovd %f0, %f32 + ldd [%o0 + (2 * 8)], %f4 + prefetch [%o0 + (3 * 64)], 0 + fmovd %f2, %f34 + ldd [%o0 + (3 * 8)], %f6 + prefetch [%o0 + (4 * 64)], 1 + fmovd %f4, %f36 + ldd [%o0 + (4 * 8)], %f8 + prefetch [%o0 + (8 * 64)], 1 + fmovd %f6, %f38 + ldd [%o0 + (5 * 8)], %f10 + prefetch [%o0 + (12 * 64)], 1 + fmovd %f8, %f40 + ldd [%o0 + (6 * 8)], %f12 + prefetch [%o0 + (16 * 64)], 1 + fmovd %f10, %f42 + ldd [%o0 + (7 * 8)], %f14 + ldd [%o0 + (8 * 8)], %f0 + sub %o2, 64, %o2 + add %o0, 64, %o0 + prefetch [%o0 + (19 * 64)], 1 + ba,pt %xcc, 2f + prefetch [%o0 + (23 * 64)], 1 + .align 32 + +2: ldd [%o0 + (1 * 8)], %f2 + fmovd %f12, %f44 + ldd [%o0 + (2 * 8)], %f4 + fmovd %f14, %f46 + stda %f32, [%o1] %asi + ldd [%o0 + (3 * 8)], %f6 + fmovd %f0, %f32 + ldd [%o0 + (4 * 8)], %f8 + fmovd %f2, %f34 + ldd [%o0 + (5 * 8)], %f10 + fmovd %f4, %f36 + ldd [%o0 + (6 * 8)], %f12 + fmovd %f6, %f38 + ldd [%o0 + (7 * 8)], %f14 + fmovd %f8, %f40 + ldd [%o0 + (8 * 8)], %f0 + fmovd %f10, %f42 + sub %o2, 64, %o2 + prefetch [%o0 + (3 * 64)], 0 + add %o1, 64, %o1 + prefetch [%o0 + (24 * 64)], 1 + add %o0, 64, %o0 + cmp %o2, 64 + 8 + bgu,pt %xcc, 2b + prefetch [%o0 + (12 * 64)], 1 + ldd [%o0 + (1 * 8)], %f2 + fsrc1 %f12, %f44 + ldd [%o0 + (2 * 8)], %f4 + fsrc1 %f14, %f46 + stda %f32, [%o1] %asi + ldd [%o0 + (3 * 8)], %f6 + fsrc1 %f0, %f32 + ldd [%o0 + (4 * 8)], %f8 + fsrc1 %f2, %f34 + ldd [%o0 + (5 * 8)], %f10 + fsrc1 %f4, %f36 + ldd [%o0 + (6 * 8)], %f12 + fsrc1 %f6, %f38 + ldd [%o0 + (7 * 8)], %f14 + fsrc1 %f8, %f40 + add %o1, 64, %o1 + fsrc1 %f10, %f42 + fsrc1 %f12, %f44 + fsrc1 %f14, %f46 + stda %f32, [%o1] %asi + membar #Sync + + retl + wr %g0, 0, %fprs +END(zeus_block_copy) + +/* * void spitfire_block_zero(void *dst, size_t len) + * void zeus_block_zero(void *dst, size_t len) */ +ALTENTRY(zeus_block_zero) ENTRY(spitfire_block_zero) rdpr %pil, %o3 wrpr %g0, PIL_TICK, %pil From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 20:15:35 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 411A41065673; Wed, 22 Sep 2010 20:15:35 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2FDA38FC15; Wed, 22 Sep 2010 20:15:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MKFZSG042151; Wed, 22 Sep 2010 20:15:35 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MKFZlf042146; Wed, 22 Sep 2010 20:15:35 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009222015.o8MKFZlf042146@svn.freebsd.org> From: Marius Strobl Date: Wed, 22 Sep 2010 20:15:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213023 - in stable/8/sys: dev/gem modules/gem X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 20:15:35 -0000 Author: marius Date: Wed Sep 22 20:15:34 2010 New Revision: 213023 URL: http://svn.freebsd.org/changeset/base/213023 Log: MFC: r212725 Merge r207585 (MFC'ed to stable/8 in r208086) from cas(4): - Don't probe for PHYs if we already know to use a SERDES. Unlike as with cas(4) this only serves to speed up the the device attach though and can only be determined via the OFW device tree but not from the VPD. - Don't touch the MIF when using a SERDES. - Add some missing bus space barriers, mainly in the PCS code path. Modified: stable/8/sys/dev/gem/if_gem.c stable/8/sys/dev/gem/if_gem_pci.c stable/8/sys/dev/gem/if_gem_sbus.c stable/8/sys/modules/gem/Makefile Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/gem/if_gem.c ============================================================================== --- stable/8/sys/dev/gem/if_gem.c Wed Sep 22 20:07:02 2010 (r213022) +++ stable/8/sys/dev/gem/if_gem.c Wed Sep 22 20:15:34 2010 (r213023) @@ -268,10 +268,17 @@ gem_attach(struct gem_softc *sc) sc->sc_rxsoft[i].rxs_mbuf = NULL; } + /* Bypass probing PHYs if we already know for sure to use a SERDES. */ + if ((sc->sc_flags & GEM_SERDES) != 0) + goto serdes; + /* Bad things will happen when touching this register on ERI. */ - if (sc->sc_variant != GEM_SUN_ERI) + if (sc->sc_variant != GEM_SUN_ERI) { GEM_BANK1_WRITE_4(sc, GEM_MII_DATAPATH_MODE, GEM_MII_DATAPATH_MII); + GEM_BANK1_BARRIER(sc, GEM_MII_DATAPATH_MODE, 4, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + } gem_mifinit(sc); @@ -283,6 +290,8 @@ gem_attach(struct gem_softc *sc) if ((v & GEM_MIF_CONFIG_MDI1) != 0) { v |= GEM_MIF_CONFIG_PHY_SEL; GEM_BANK1_WRITE_4(sc, GEM_MIF_CONFIG, v); + GEM_BANK1_BARRIER(sc, GEM_MIF_CONFIG, 4, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); switch (sc->sc_variant) { case GEM_SUN_ERI: sc->sc_phyad = GEM_PHYAD_EXTERNAL; @@ -304,6 +313,8 @@ gem_attach(struct gem_softc *sc) ((v & GEM_MIF_CONFIG_MDI0) != 0 || GEM_IS_APPLE(sc))) { v &= ~GEM_MIF_CONFIG_PHY_SEL; GEM_BANK1_WRITE_4(sc, GEM_MIF_CONFIG, v); + GEM_BANK1_BARRIER(sc, GEM_MIF_CONFIG, 4, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); switch (sc->sc_variant) { case GEM_SUN_ERI: case GEM_APPLE_K2_GMAC: @@ -324,17 +335,23 @@ gem_attach(struct gem_softc *sc) * Try the external PCS SERDES if we didn't find any PHYs. */ if (error != 0 && sc->sc_variant == GEM_SUN_GEM) { + serdes: GEM_BANK1_WRITE_4(sc, GEM_MII_DATAPATH_MODE, GEM_MII_DATAPATH_SERDES); + GEM_BANK1_BARRIER(sc, GEM_MII_DATAPATH_MODE, 4, + BUS_SPACE_BARRIER_WRITE); GEM_BANK1_WRITE_4(sc, GEM_MII_SLINK_CONTROL, GEM_MII_SLINK_LOOPBACK | GEM_MII_SLINK_EN_SYNC_D); + GEM_BANK1_BARRIER(sc, GEM_MII_SLINK_CONTROL, 4, + BUS_SPACE_BARRIER_WRITE); GEM_BANK1_WRITE_4(sc, GEM_MII_CONFIG, GEM_MII_CONFIG_ENABLE); + GEM_BANK1_BARRIER(sc, GEM_MII_CONFIG, 4, + BUS_SPACE_BARRIER_WRITE); sc->sc_flags |= GEM_SERDES; sc->sc_phyad = GEM_PHYAD_EXTERNAL; error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus, gem_mediachange, gem_mediastatus); } - if (error != 0) { device_printf(sc->sc_dev, "PHY probe failed: %d\n", error); goto fail_rxd; @@ -918,8 +935,9 @@ gem_init_locked(struct gem_softc *sc) __func__); #endif - /* Re-initialize the MIF. */ - gem_mifinit(sc); + if ((sc->sc_flags & GEM_SERDES) == 0) + /* Re-initialize the MIF. */ + gem_mifinit(sc); /* step 3. Setup data structures in host memory. */ if (gem_meminit(sc) != 0) @@ -1800,6 +1818,8 @@ gem_mifinit(struct gem_softc *sc) /* Configure the MIF in frame mode. */ GEM_BANK1_WRITE_4(sc, GEM_MIF_CONFIG, GEM_BANK1_READ_4(sc, GEM_MIF_CONFIG) & ~GEM_MIF_CONFIG_BB_ENA); + GEM_BANK1_BARRIER(sc, GEM_MIF_CONFIG, 4, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); } /* @@ -1914,10 +1934,16 @@ gem_mii_writereg(device_t dev, int phy, GEM_BANK1_BARRIER(sc, GEM_MII_CONFIG, 4, BUS_SPACE_BARRIER_WRITE); GEM_BANK1_WRITE_4(sc, GEM_MII_ANAR, val); + GEM_BANK1_BARRIER(sc, GEM_MII_ANAR, 4, + BUS_SPACE_BARRIER_WRITE); GEM_BANK1_WRITE_4(sc, GEM_MII_SLINK_CONTROL, GEM_MII_SLINK_LOOPBACK | GEM_MII_SLINK_EN_SYNC_D); + GEM_BANK1_BARRIER(sc, GEM_MII_SLINK_CONTROL, 4, + BUS_SPACE_BARRIER_WRITE); GEM_BANK1_WRITE_4(sc, GEM_MII_CONFIG, GEM_MII_CONFIG_ENABLE); + GEM_BANK1_BARRIER(sc, GEM_MII_CONFIG, 4, + BUS_SPACE_BARRIER_WRITE); return (0); case MII_ANLPAR: reg = GEM_MII_ANLPAR; @@ -1928,6 +1954,8 @@ gem_mii_writereg(device_t dev, int phy, return (0); } GEM_BANK1_WRITE_4(sc, reg, val); + GEM_BANK1_BARRIER(sc, reg, 4, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); return (0); } Modified: stable/8/sys/dev/gem/if_gem_pci.c ============================================================================== --- stable/8/sys/dev/gem/if_gem_pci.c Wed Sep 22 20:07:02 2010 (r213022) +++ stable/8/sys/dev/gem/if_gem_pci.c Wed Sep 22 20:15:34 2010 (r213023) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #if defined(__powerpc__) || defined(__sparc64__) +#include #include #include #endif @@ -140,12 +141,17 @@ static struct resource_spec gem_pci_res_ { -1, 0 } }; +#define GEM_SHARED_PINS "shared-pins" +#define GEM_SHARED_PINS_SERDES "serdes" + static int gem_pci_attach(device_t dev) { struct gem_softc *sc; int i; -#if !(defined(__powerpc__) || defined(__sparc64__)) +#if defined(__powerpc__) || defined(__sparc64__) + char buf[sizeof(GEM_SHARED_PINS)]; +#else int j; #endif @@ -207,6 +213,12 @@ gem_pci_attach(device_t dev) #if defined(__powerpc__) || defined(__sparc64__) OF_getetheraddr(dev, sc->sc_enaddr); + if (OF_getprop(ofw_bus_get_node(dev), GEM_SHARED_PINS, buf, + sizeof(buf)) > 0) { + buf[sizeof(buf) - 1] = '\0'; + if (strcmp(buf, GEM_SHARED_PINS_SERDES) == 0) + sc->sc_flags |= GEM_SERDES; + } #else /* * Dig out VPD (vital product data) and read NA (network address). Modified: stable/8/sys/dev/gem/if_gem_sbus.c ============================================================================== --- stable/8/sys/dev/gem/if_gem_sbus.c Wed Sep 22 20:07:02 2010 (r213022) +++ stable/8/sys/dev/gem/if_gem_sbus.c Wed Sep 22 20:15:34 2010 (r213023) @@ -131,6 +131,8 @@ gem_sbus_attach(device_t dev) sc = device_get_softc(dev); sc->sc_variant = GEM_SUN_GEM; sc->sc_dev = dev; + /* All known SBus models use a SERDES. */ + sc->sc_flags = GEM_SERDES; if (bus_alloc_resources(dev, gem_sbus_res_spec, sc->sc_res)) { device_printf(dev, "failed to allocate resources\n"); Modified: stable/8/sys/modules/gem/Makefile ============================================================================== --- stable/8/sys/modules/gem/Makefile Wed Sep 22 20:07:02 2010 (r213022) +++ stable/8/sys/modules/gem/Makefile Wed Sep 22 20:15:34 2010 (r213023) @@ -3,10 +3,15 @@ .PATH: ${.CURDIR}/../../dev/gem KMOD= if_gem -SRCS= bus_if.h device_if.h if_gem.c if_gem_pci.c miibus_if.h pci_if.h +SRCS= bus_if.h device_if.h if_gem.c if_gem_pci.c ${if_gem_sbus} miibus_if.h +SRCS+= ${ofw_bus_if} pci_if.h .if ${MACHINE} == "sparc64" -SRCS+= if_gem_sbus.c ofw_bus_if.h +if_gem_sbus= if_gem_sbus.c +.endif + +.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "sparc64" +ofw_bus_if= ofw_bus_if.h .endif .include From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 20:15:38 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 87DA71065674; Wed, 22 Sep 2010 20:15:38 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 708D68FC0A; Wed, 22 Sep 2010 20:15:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MKFcns042189; Wed, 22 Sep 2010 20:15:38 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MKFcQe042184; Wed, 22 Sep 2010 20:15:38 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009222015.o8MKFcQe042184@svn.freebsd.org> From: Marius Strobl Date: Wed, 22 Sep 2010 20:15:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213024 - in stable/7/sys: dev/gem modules/gem X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 20:15:38 -0000 Author: marius Date: Wed Sep 22 20:15:38 2010 New Revision: 213024 URL: http://svn.freebsd.org/changeset/base/213024 Log: MFC: r212725 Merge r207585 (MFC'ed to stable/7 in r208087) from cas(4): - Don't probe for PHYs if we already know to use a SERDES. Unlike as with cas(4) this only serves to speed up the the device attach though and can only be determined via the OFW device tree but not from the VPD. - Don't touch the MIF when using a SERDES. - Add some missing bus space barriers, mainly in the PCS code path. Modified: stable/7/sys/dev/gem/if_gem.c stable/7/sys/dev/gem/if_gem_pci.c stable/7/sys/dev/gem/if_gem_sbus.c stable/7/sys/modules/gem/Makefile Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/gem/if_gem.c ============================================================================== --- stable/7/sys/dev/gem/if_gem.c Wed Sep 22 20:15:34 2010 (r213023) +++ stable/7/sys/dev/gem/if_gem.c Wed Sep 22 20:15:38 2010 (r213024) @@ -268,10 +268,17 @@ gem_attach(struct gem_softc *sc) sc->sc_rxsoft[i].rxs_mbuf = NULL; } + /* Bypass probing PHYs if we already know for sure to use a SERDES. */ + if ((sc->sc_flags & GEM_SERDES) != 0) + goto serdes; + /* Bad things will happen when touching this register on ERI. */ - if (sc->sc_variant != GEM_SUN_ERI) + if (sc->sc_variant != GEM_SUN_ERI) { GEM_BANK1_WRITE_4(sc, GEM_MII_DATAPATH_MODE, GEM_MII_DATAPATH_MII); + GEM_BANK1_BARRIER(sc, GEM_MII_DATAPATH_MODE, 4, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + } gem_mifinit(sc); @@ -283,6 +290,8 @@ gem_attach(struct gem_softc *sc) if ((v & GEM_MIF_CONFIG_MDI1) != 0) { v |= GEM_MIF_CONFIG_PHY_SEL; GEM_BANK1_WRITE_4(sc, GEM_MIF_CONFIG, v); + GEM_BANK1_BARRIER(sc, GEM_MIF_CONFIG, 4, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); switch (sc->sc_variant) { case GEM_SUN_ERI: sc->sc_phyad = GEM_PHYAD_EXTERNAL; @@ -304,6 +313,8 @@ gem_attach(struct gem_softc *sc) ((v & GEM_MIF_CONFIG_MDI0) != 0 || GEM_IS_APPLE(sc))) { v &= ~GEM_MIF_CONFIG_PHY_SEL; GEM_BANK1_WRITE_4(sc, GEM_MIF_CONFIG, v); + GEM_BANK1_BARRIER(sc, GEM_MIF_CONFIG, 4, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); switch (sc->sc_variant) { case GEM_SUN_ERI: case GEM_APPLE_K2_GMAC: @@ -324,17 +335,23 @@ gem_attach(struct gem_softc *sc) * Try the external PCS SERDES if we didn't find any PHYs. */ if (error != 0 && sc->sc_variant == GEM_SUN_GEM) { + serdes: GEM_BANK1_WRITE_4(sc, GEM_MII_DATAPATH_MODE, GEM_MII_DATAPATH_SERDES); + GEM_BANK1_BARRIER(sc, GEM_MII_DATAPATH_MODE, 4, + BUS_SPACE_BARRIER_WRITE); GEM_BANK1_WRITE_4(sc, GEM_MII_SLINK_CONTROL, GEM_MII_SLINK_LOOPBACK | GEM_MII_SLINK_EN_SYNC_D); + GEM_BANK1_BARRIER(sc, GEM_MII_SLINK_CONTROL, 4, + BUS_SPACE_BARRIER_WRITE); GEM_BANK1_WRITE_4(sc, GEM_MII_CONFIG, GEM_MII_CONFIG_ENABLE); + GEM_BANK1_BARRIER(sc, GEM_MII_CONFIG, 4, + BUS_SPACE_BARRIER_WRITE); sc->sc_flags |= GEM_SERDES; sc->sc_phyad = GEM_PHYAD_EXTERNAL; error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus, gem_mediachange, gem_mediastatus); } - if (error != 0) { device_printf(sc->sc_dev, "PHY probe failed: %d\n", error); goto fail_rxd; @@ -918,8 +935,9 @@ gem_init_locked(struct gem_softc *sc) __func__); #endif - /* Re-initialize the MIF. */ - gem_mifinit(sc); + if ((sc->sc_flags & GEM_SERDES) == 0) + /* Re-initialize the MIF. */ + gem_mifinit(sc); /* step 3. Setup data structures in host memory. */ if (gem_meminit(sc) != 0) @@ -1800,6 +1818,8 @@ gem_mifinit(struct gem_softc *sc) /* Configure the MIF in frame mode. */ GEM_BANK1_WRITE_4(sc, GEM_MIF_CONFIG, GEM_BANK1_READ_4(sc, GEM_MIF_CONFIG) & ~GEM_MIF_CONFIG_BB_ENA); + GEM_BANK1_BARRIER(sc, GEM_MIF_CONFIG, 4, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); } /* @@ -1914,10 +1934,16 @@ gem_mii_writereg(device_t dev, int phy, GEM_BANK1_BARRIER(sc, GEM_MII_CONFIG, 4, BUS_SPACE_BARRIER_WRITE); GEM_BANK1_WRITE_4(sc, GEM_MII_ANAR, val); + GEM_BANK1_BARRIER(sc, GEM_MII_ANAR, 4, + BUS_SPACE_BARRIER_WRITE); GEM_BANK1_WRITE_4(sc, GEM_MII_SLINK_CONTROL, GEM_MII_SLINK_LOOPBACK | GEM_MII_SLINK_EN_SYNC_D); + GEM_BANK1_BARRIER(sc, GEM_MII_SLINK_CONTROL, 4, + BUS_SPACE_BARRIER_WRITE); GEM_BANK1_WRITE_4(sc, GEM_MII_CONFIG, GEM_MII_CONFIG_ENABLE); + GEM_BANK1_BARRIER(sc, GEM_MII_CONFIG, 4, + BUS_SPACE_BARRIER_WRITE); return (0); case MII_ANLPAR: reg = GEM_MII_ANLPAR; @@ -1928,6 +1954,8 @@ gem_mii_writereg(device_t dev, int phy, return (0); } GEM_BANK1_WRITE_4(sc, reg, val); + GEM_BANK1_BARRIER(sc, reg, 4, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); return (0); } Modified: stable/7/sys/dev/gem/if_gem_pci.c ============================================================================== --- stable/7/sys/dev/gem/if_gem_pci.c Wed Sep 22 20:15:34 2010 (r213023) +++ stable/7/sys/dev/gem/if_gem_pci.c Wed Sep 22 20:15:38 2010 (r213024) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #if defined(__powerpc__) || defined(__sparc64__) +#include #include #include #endif @@ -140,12 +141,17 @@ static struct resource_spec gem_pci_res_ { -1, 0 } }; +#define GEM_SHARED_PINS "shared-pins" +#define GEM_SHARED_PINS_SERDES "serdes" + static int gem_pci_attach(device_t dev) { struct gem_softc *sc; int i; -#if !(defined(__powerpc__) || defined(__sparc64__)) +#if defined(__powerpc__) || defined(__sparc64__) + char buf[sizeof(GEM_SHARED_PINS)]; +#else int j; #endif @@ -207,6 +213,12 @@ gem_pci_attach(device_t dev) #if defined(__powerpc__) || defined(__sparc64__) OF_getetheraddr(dev, sc->sc_enaddr); + if (OF_getprop(ofw_bus_get_node(dev), GEM_SHARED_PINS, buf, + sizeof(buf)) > 0) { + buf[sizeof(buf) - 1] = '\0'; + if (strcmp(buf, GEM_SHARED_PINS_SERDES) == 0) + sc->sc_flags |= GEM_SERDES; + } #else /* * Dig out VPD (vital product data) and read NA (network address). Modified: stable/7/sys/dev/gem/if_gem_sbus.c ============================================================================== --- stable/7/sys/dev/gem/if_gem_sbus.c Wed Sep 22 20:15:34 2010 (r213023) +++ stable/7/sys/dev/gem/if_gem_sbus.c Wed Sep 22 20:15:38 2010 (r213024) @@ -131,6 +131,8 @@ gem_sbus_attach(device_t dev) sc = device_get_softc(dev); sc->sc_variant = GEM_SUN_GEM; sc->sc_dev = dev; + /* All known SBus models use a SERDES. */ + sc->sc_flags = GEM_SERDES; if (bus_alloc_resources(dev, gem_sbus_res_spec, sc->sc_res)) { device_printf(dev, "failed to allocate resources\n"); Modified: stable/7/sys/modules/gem/Makefile ============================================================================== --- stable/7/sys/modules/gem/Makefile Wed Sep 22 20:15:34 2010 (r213023) +++ stable/7/sys/modules/gem/Makefile Wed Sep 22 20:15:38 2010 (r213024) @@ -3,10 +3,15 @@ .PATH: ${.CURDIR}/../../dev/gem KMOD= if_gem -SRCS= bus_if.h device_if.h if_gem.c if_gem_pci.c miibus_if.h pci_if.h +SRCS= bus_if.h device_if.h if_gem.c if_gem_pci.c ${if_gem_sbus} miibus_if.h +SRCS+= ${ofw_bus_if} pci_if.h .if ${MACHINE} == "sparc64" -SRCS+= if_gem_sbus.c ofw_bus_if.h +if_gem_sbus= if_gem_sbus.c +.endif + +.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "sparc64" +ofw_bus_if= ofw_bus_if.h .endif .include From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 20:17:33 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 906C61065672; Wed, 22 Sep 2010 20:17:33 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7F65A8FC12; Wed, 22 Sep 2010 20:17:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MKHXvj042292; Wed, 22 Sep 2010 20:17:33 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MKHXrf042290; Wed, 22 Sep 2010 20:17:33 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009222017.o8MKHXrf042290@svn.freebsd.org> From: Marius Strobl Date: Wed, 22 Sep 2010 20:17:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213025 - stable/8/sys/boot/sparc64/boot1 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 20:17:33 -0000 Author: marius Date: Wed Sep 22 20:17:33 2010 New Revision: 213025 URL: http://svn.freebsd.org/changeset/base/213025 Log: MFC: r212729 Merge from powerpc: - Change putc_func_t to use a char instead of an int for the character. - Make functions and variables not used outside of this source file static. - Remove unused prototypes and variables. - The OFW read and seek methods take 3 and not 4 input arguments. Modified: stable/8/sys/boot/sparc64/boot1/boot1.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/boot/sparc64/boot1/boot1.c ============================================================================== --- stable/8/sys/boot/sparc64/boot1/boot1.c Wed Sep 22 20:15:38 2010 (r213024) +++ stable/8/sys/boot/sparc64/boot1/boot1.c Wed Sep 22 20:17:33 2010 (r213025) @@ -26,9 +26,7 @@ __FBSDID("$FreeBSD$"); #define _PATH_LOADER "/boot/loader" #define _PATH_KERNEL "/boot/kernel/kernel" -#define BSIZEMAX 16384 - -typedef int putc_func_t(int c, void *arg); +typedef int putc_func_t(char c, void *arg); typedef int32_t ofwh_t; struct sp_data { @@ -44,11 +42,6 @@ static char bootargs[128]; static ofwh_t bootdev; -static struct fs fs; -static ino_t inomap; -static char blkbuf[BSIZEMAX]; -static unsigned int fsblks; - static uint32_t fs_off; int main(int ac, char **av); @@ -66,14 +59,13 @@ static int mount(const char *device); static void panic(const char *fmt, ...) __dead2; static int printf(const char *fmt, ...); -static int putchar(int c, void *arg); +static int putchar(char c, void *arg); static int vprintf(const char *fmt, va_list ap); static int vsnprintf(char *str, size_t sz, const char *fmt, va_list ap); static int __printf(const char *fmt, putc_func_t *putc, void *arg, va_list ap); -static int __putc(int c, void *arg); static int __puts(const char *s, putc_func_t *putc, void *arg); -static int __sputc(int c, void *arg); +static int __sputc(char c, void *arg); static char *__uitoa(char *buf, u_int val, int base); static char *__ultoa(char *buf, u_long val, int base); @@ -83,19 +75,18 @@ static char *__ultoa(char *buf, u_long v typedef u_int64_t ofwcell_t; typedef u_int32_t u_ofwh_t; typedef int (*ofwfp_t)(ofwcell_t []); -ofwfp_t ofw; /* the prom Open Firmware entry */ +static ofwfp_t ofw; /* the PROM Open Firmware entry */ void ofw_init(int, int, int, int, ofwfp_t); -ofwh_t ofw_finddevice(const char *); -ofwh_t ofw_open(const char *); -int ofw_getprop(ofwh_t, const char *, void *, size_t); -int ofw_read(ofwh_t, void *, size_t); -int ofw_write(ofwh_t, const void *, size_t); -int ofw_seek(ofwh_t, u_int64_t); -void ofw_exit(void) __dead2; +static ofwh_t ofw_finddevice(const char *); +static ofwh_t ofw_open(const char *); +static int ofw_getprop(ofwh_t, const char *, void *, size_t); +static int ofw_read(ofwh_t, void *, size_t); +static int ofw_write(ofwh_t, const void *, size_t); +static int ofw_seek(ofwh_t, u_int64_t); +static void ofw_exit(void) __dead2; -ofwh_t bootdevh; -ofwh_t stdinh, stdouth; +static ofwh_t stdinh, stdouth; /* * This has to stay here, as the PROM seems to ignore the @@ -138,7 +129,7 @@ ofw_init(int d, int d1, int d2, int d3, exit(main(ac, av)); } -ofwh_t +static ofwh_t ofw_finddevice(const char *name) { ofwcell_t args[] = { @@ -156,7 +147,7 @@ ofw_finddevice(const char *name) return (args[4]); } -int +static int ofw_getprop(ofwh_t ofwh, const char *name, void *buf, size_t len) { ofwcell_t args[] = { @@ -178,7 +169,7 @@ ofw_getprop(ofwh_t ofwh, const char *nam return (0); } -ofwh_t +static ofwh_t ofw_open(const char *path) { ofwcell_t args[] = { @@ -196,7 +187,7 @@ ofw_open(const char *path) return (args[4]); } -int +static int ofw_close(ofwh_t devh) { ofwcell_t args[] = { @@ -213,12 +204,12 @@ ofw_close(ofwh_t devh) return (0); } -int +static int ofw_read(ofwh_t devh, void *buf, size_t len) { ofwcell_t args[] = { (ofwcell_t)"read", - 4, + 3, 1, (u_ofwh_t)devh, (ofwcell_t)buf, @@ -233,7 +224,7 @@ ofw_read(ofwh_t devh, void *buf, size_t return (0); } -int +static int ofw_write(ofwh_t devh, const void *buf, size_t len) { ofwcell_t args[] = { @@ -253,12 +244,12 @@ ofw_write(ofwh_t devh, const void *buf, return (0); } -int +static int ofw_seek(ofwh_t devh, u_int64_t off) { ofwcell_t args[] = { (ofwcell_t)"seek", - 4, + 3, 1, (u_ofwh_t)devh, off >> 32, @@ -273,7 +264,7 @@ ofw_seek(ofwh_t devh, u_int64_t off) return (0); } -void +static void ofw_exit(void) { ofwcell_t args[3]; @@ -299,6 +290,7 @@ bcopy(const void *src, void *dst, size_t static void memcpy(void *dst, const void *src, size_t len) { + bcopy(src, dst, len); } @@ -314,6 +306,7 @@ bzero(void *b, size_t len) static int strcmp(const char *s1, const char *s2) { + for (; *s1 == *s2 && *s1; s1++, s2++) ; return ((u_char)*s1 - (u_char)*s2); @@ -431,6 +424,7 @@ load(const char *fname) static int dskread(void *buf, u_int64_t lba, int nblk) { + /* * The Open Firmware should open the correct partition for us. * That means, if we read from offset zero on an open instance handle, @@ -468,7 +462,7 @@ printf(const char *fmt, ...) } static int -putchar(int c, void *arg) +putchar(char c, void *arg) { char buf; @@ -614,7 +608,7 @@ reswitch: c = *fmt++; } static int -__sputc(int c, void *arg) +__sputc(char c, void *arg) { struct sp_data *sp; From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 20:17:36 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3470E106576D; Wed, 22 Sep 2010 20:17:35 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2D78B8FC13; Wed, 22 Sep 2010 20:17:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MKHZ7S042322; Wed, 22 Sep 2010 20:17:35 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MKHZT5042320; Wed, 22 Sep 2010 20:17:35 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009222017.o8MKHZT5042320@svn.freebsd.org> From: Marius Strobl Date: Wed, 22 Sep 2010 20:17:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213026 - stable/7/sys/boot/sparc64/boot1 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 20:17:36 -0000 Author: marius Date: Wed Sep 22 20:17:34 2010 New Revision: 213026 URL: http://svn.freebsd.org/changeset/base/213026 Log: MFC: r212729 Merge from powerpc: - Change putc_func_t to use a char instead of an int for the character. - Make functions and variables not used outside of this source file static. - Remove unused prototypes and variables. - The OFW read and seek methods take 3 and not 4 input arguments. Modified: stable/7/sys/boot/sparc64/boot1/boot1.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/boot/sparc64/boot1/boot1.c ============================================================================== --- stable/7/sys/boot/sparc64/boot1/boot1.c Wed Sep 22 20:17:33 2010 (r213025) +++ stable/7/sys/boot/sparc64/boot1/boot1.c Wed Sep 22 20:17:34 2010 (r213026) @@ -26,9 +26,7 @@ __FBSDID("$FreeBSD$"); #define _PATH_LOADER "/boot/loader" #define _PATH_KERNEL "/boot/kernel/kernel" -#define BSIZEMAX 16384 - -typedef int putc_func_t(int c, void *arg); +typedef int putc_func_t(char c, void *arg); typedef int32_t ofwh_t; struct sp_data { @@ -44,11 +42,6 @@ static char bootargs[128]; static ofwh_t bootdev; -static struct fs fs; -static ino_t inomap; -static char blkbuf[BSIZEMAX]; -static unsigned int fsblks; - static uint32_t fs_off; int main(int ac, char **av); @@ -66,14 +59,13 @@ static int mount(const char *device); static void panic(const char *fmt, ...) __dead2; static int printf(const char *fmt, ...); -static int putchar(int c, void *arg); +static int putchar(char c, void *arg); static int vprintf(const char *fmt, va_list ap); static int vsnprintf(char *str, size_t sz, const char *fmt, va_list ap); static int __printf(const char *fmt, putc_func_t *putc, void *arg, va_list ap); -static int __putc(int c, void *arg); static int __puts(const char *s, putc_func_t *putc, void *arg); -static int __sputc(int c, void *arg); +static int __sputc(char c, void *arg); static char *__uitoa(char *buf, u_int val, int base); static char *__ultoa(char *buf, u_long val, int base); @@ -83,19 +75,18 @@ static char *__ultoa(char *buf, u_long v typedef u_int64_t ofwcell_t; typedef u_int32_t u_ofwh_t; typedef int (*ofwfp_t)(ofwcell_t []); -ofwfp_t ofw; /* the prom Open Firmware entry */ +static ofwfp_t ofw; /* the PROM Open Firmware entry */ void ofw_init(int, int, int, int, ofwfp_t); -ofwh_t ofw_finddevice(const char *); -ofwh_t ofw_open(const char *); -int ofw_getprop(ofwh_t, const char *, void *, size_t); -int ofw_read(ofwh_t, void *, size_t); -int ofw_write(ofwh_t, const void *, size_t); -int ofw_seek(ofwh_t, u_int64_t); -void ofw_exit(void) __dead2; +static ofwh_t ofw_finddevice(const char *); +static ofwh_t ofw_open(const char *); +static int ofw_getprop(ofwh_t, const char *, void *, size_t); +static int ofw_read(ofwh_t, void *, size_t); +static int ofw_write(ofwh_t, const void *, size_t); +static int ofw_seek(ofwh_t, u_int64_t); +static void ofw_exit(void) __dead2; -ofwh_t bootdevh; -ofwh_t stdinh, stdouth; +static ofwh_t stdinh, stdouth; /* * This has to stay here, as the PROM seems to ignore the @@ -138,7 +129,7 @@ ofw_init(int d, int d1, int d2, int d3, exit(main(ac, av)); } -ofwh_t +static ofwh_t ofw_finddevice(const char *name) { ofwcell_t args[] = { @@ -156,7 +147,7 @@ ofw_finddevice(const char *name) return (args[4]); } -int +static int ofw_getprop(ofwh_t ofwh, const char *name, void *buf, size_t len) { ofwcell_t args[] = { @@ -178,7 +169,7 @@ ofw_getprop(ofwh_t ofwh, const char *nam return (0); } -ofwh_t +static ofwh_t ofw_open(const char *path) { ofwcell_t args[] = { @@ -196,7 +187,7 @@ ofw_open(const char *path) return (args[4]); } -int +static int ofw_close(ofwh_t devh) { ofwcell_t args[] = { @@ -213,12 +204,12 @@ ofw_close(ofwh_t devh) return (0); } -int +static int ofw_read(ofwh_t devh, void *buf, size_t len) { ofwcell_t args[] = { (ofwcell_t)"read", - 4, + 3, 1, (u_ofwh_t)devh, (ofwcell_t)buf, @@ -233,7 +224,7 @@ ofw_read(ofwh_t devh, void *buf, size_t return (0); } -int +static int ofw_write(ofwh_t devh, const void *buf, size_t len) { ofwcell_t args[] = { @@ -253,12 +244,12 @@ ofw_write(ofwh_t devh, const void *buf, return (0); } -int +static int ofw_seek(ofwh_t devh, u_int64_t off) { ofwcell_t args[] = { (ofwcell_t)"seek", - 4, + 3, 1, (u_ofwh_t)devh, off >> 32, @@ -273,7 +264,7 @@ ofw_seek(ofwh_t devh, u_int64_t off) return (0); } -void +static void ofw_exit(void) { ofwcell_t args[3]; @@ -299,6 +290,7 @@ bcopy(const void *src, void *dst, size_t static void memcpy(void *dst, const void *src, size_t len) { + bcopy(src, dst, len); } @@ -314,6 +306,7 @@ bzero(void *b, size_t len) static int strcmp(const char *s1, const char *s2) { + for (; *s1 == *s2 && *s1; s1++, s2++) ; return ((u_char)*s1 - (u_char)*s2); @@ -431,6 +424,7 @@ load(const char *fname) static int dskread(void *buf, u_int64_t lba, int nblk) { + /* * The Open Firmware should open the correct partition for us. * That means, if we read from offset zero on an open instance handle, @@ -468,7 +462,7 @@ printf(const char *fmt, ...) } static int -putchar(int c, void *arg) +putchar(char c, void *arg) { char buf; @@ -614,7 +608,7 @@ reswitch: c = *fmt++; } static int -__sputc(int c, void *arg) +__sputc(char c, void *arg) { struct sp_data *sp; From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 20:27:59 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7A3351065673; Wed, 22 Sep 2010 20:27:59 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 698118FC1C; Wed, 22 Sep 2010 20:27:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MKRxWB042601; Wed, 22 Sep 2010 20:27:59 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MKRxCq042597; Wed, 22 Sep 2010 20:27:59 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009222027.o8MKRxCq042597@svn.freebsd.org> From: Marius Strobl Date: Wed, 22 Sep 2010 20:27:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213027 - stable/7/libexec/tftpd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 20:27:59 -0000 Author: marius Date: Wed Sep 22 20:27:59 2010 New Revision: 213027 URL: http://svn.freebsd.org/changeset/base/213027 Log: MFC: r173852 Add the -W options, which acts the same as -w but will generate unique names based on the submitted filename, a strftime(3) format string and a two digit sequence number. By default the strftime(3) format string is %Y%m%d (YYYYMMDD), but this can be changed by the -F option. PR: bin/106049 (based on patch in that PR) Approved by: grog@ (mentor) Modified: stable/7/libexec/tftpd/Makefile stable/7/libexec/tftpd/tftpd.8 stable/7/libexec/tftpd/tftpd.c Directory Properties: stable/7/libexec/tftpd/ (props changed) Modified: stable/7/libexec/tftpd/Makefile ============================================================================== --- stable/7/libexec/tftpd/Makefile Wed Sep 22 20:17:34 2010 (r213026) +++ stable/7/libexec/tftpd/Makefile Wed Sep 22 20:27:59 2010 (r213027) @@ -5,6 +5,7 @@ PROG= tftpd SRCS= tftpd.c tftpsubs.c DPADD= ${LIBUTIL} LDADD= -lutil +WFORMAT=0 MAN= tftpd.8 CFLAGS+=-I${.CURDIR}/../../usr.bin/tftp .PATH: ${.CURDIR}/../../usr.bin/tftp Modified: stable/7/libexec/tftpd/tftpd.8 ============================================================================== --- stable/7/libexec/tftpd/tftpd.8 Wed Sep 22 20:17:34 2010 (r213026) +++ stable/7/libexec/tftpd/tftpd.8 Wed Sep 22 20:27:59 2010 (r213027) @@ -40,7 +40,8 @@ .Nd Internet Trivial File Transfer Protocol server .Sh SYNOPSIS .Nm tftpd -.Op Fl cClnw +.Op Fl cClnwW +.Op Fl F Ar strftime-format .Op Fl s Ar directory .Op Fl u Ar user .Op Fl U Ar umask @@ -142,6 +143,13 @@ except it falls back to specified via .Fl s if a directory does not exist for the client's IP. +.It Fl F +Use this +.Xr strftime 3 +compatible format string for the creation of the suffix if +.Fl W +is specified. +By default the string "%Y%m%d" is used. .It Fl l Log all requests using .Xr syslog 3 @@ -184,6 +192,17 @@ Allow write requests to create new files By default .Nm requires that the file specified in a write request exist. +Note that this only works in directories writable by the user +specified with +.Fl u +option +.It Fl W +As +.Fl w +but append a YYYYMMDD.nn sequence number to the end of the filename. +Note that the string YYYYMMDD can be changed the +.Fl F +option. .El .Sh SEE ALSO .Xr tftp 1 , @@ -212,10 +231,17 @@ the .Fl u option was introduced in .Fx 4.2 , -and the +the .Fl c option was introduced in -.Fx 4.3 . +.Fx 4.3 , +and the +.Fl F +and +.Fl W +options were introduced in +.Fx 7 . +.Pp .Sh BUGS Files larger than 33488896 octets (65535 blocks) cannot be transferred without client and server supporting blocksize negotiation (RFC1783). Modified: stable/7/libexec/tftpd/tftpd.c ============================================================================== --- stable/7/libexec/tftpd/tftpd.c Wed Sep 22 20:17:34 2010 (r213026) +++ stable/7/libexec/tftpd/tftpd.c Wed Sep 22 20:27:59 2010 (r213027) @@ -110,6 +110,8 @@ static int suppress_naks; static int logging; static int ipchroot; static int create_new = 0; +static char *newfile_format = "%Y%m%d"; +static int increase_name = 0; static mode_t mask = S_IWGRP|S_IWOTH; static const char *errtomsg(int); @@ -134,7 +136,7 @@ main(int argc, char *argv[]) tzset(); /* syslog in localtime */ openlog("tftpd", LOG_PID | LOG_NDELAY, LOG_FTP); - while ((ch = getopt(argc, argv, "cClns:u:U:w")) != -1) { + while ((ch = getopt(argc, argv, "cCF:lns:u:U:wW")) != -1) { switch (ch) { case 'c': ipchroot = 1; @@ -142,6 +144,9 @@ main(int argc, char *argv[]) case 'C': ipchroot = 2; break; + case 'F': + newfile_format = optarg; + break; case 'l': logging = 1; break; @@ -160,6 +165,10 @@ main(int argc, char *argv[]) case 'w': create_new = 1; break; + case 'W': + create_new = 1; + increase_name = 1; + break; default: syslog(LOG_WARNING, "ignoring unknown option -%c", ch); } @@ -513,6 +522,57 @@ option_fail: FILE *file; /* + * Find the next value for YYYYMMDD.nn when the file to be written should + * be unique. Due to the limitations of nn, we will fail if nn reaches 100. + * Besides, that is four updates per hour on a file, which is kind of + * execessive anyway. + */ +static int +find_next_name(char *filename, int *fd) +{ + int i; + time_t tval; + size_t len; + struct tm lt; + char yyyymmdd[MAXPATHLEN]; + char newname[MAXPATHLEN]; + struct stat sb; + int ret; + + /* Create the YYYYMMDD part of the filename */ + time(&tval); + lt = *localtime(&tval); + len = strftime(yyyymmdd, sizeof(yyyymmdd), newfile_format, <); + if (len == 0) { + syslog(LOG_WARNING, + "Filename suffix too long (%d characters maximum)", + MAXPATHLEN); + return (EACCESS); + } + + /* Make sure the new filename is not too long */ + if (strlen(filename) > MAXPATHLEN - len - 5) { + syslog(LOG_WARNING, + "Filename too long (%d characters, %d maximum)", + strlen(filename), MAXPATHLEN - len - 5); + return (EACCESS); + } + + /* Find the first file which doesn't exist */ + for (i = 0; i < 100; i++) { + sprintf(newname, "%s.%s.%02d", filename, yyyymmdd, i); + *fd = open(newname, + O_WRONLY | O_CREAT | O_EXCL, + S_IRUSR | S_IWUSR | S_IRGRP | + S_IWGRP | S_IROTH | S_IWOTH); + if (*fd > 0) + return 0; + } + + return (EEXIST); +} + +/* * Validate file access. Since we * have no uid or gid, for now require * file to exist and be publicly @@ -528,6 +588,7 @@ validate_access(char **filep, int mode) { struct stat stbuf; int fd; + int error; struct dirlist *dirp; static char pathname[MAXPATHLEN]; char *filename = *filep; @@ -610,10 +671,18 @@ validate_access(char **filep, int mode) if (mode == RRQ) fd = open(filename, O_RDONLY); else { - if (create_new) - fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0666); - else - fd = open(filename, O_WRONLY|O_TRUNC); + if (create_new) { + if (increase_name) { + error = find_next_name(filename, &fd); + if (error > 0) + return (error + 100); + } else + fd = open(filename, + O_WRONLY | O_TRUNC | O_CREAT, + S_IRUSR | S_IWUSR | S_IRGRP | + S_IWGRP | S_IROTH | S_IWOTH ); + } else + fd = open(filename, O_WRONLY | O_TRUNC); } if (fd < 0) return (errno + 100); From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 21:02:35 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E38EA10656C6; Wed, 22 Sep 2010 21:02:35 +0000 (UTC) (envelope-from avg@freebsd.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 65B798FC1D; Wed, 22 Sep 2010 21:02:33 +0000 (UTC) Received: from porto.topspin.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 AAA08450; Thu, 23 Sep 2010 00:02:32 +0300 (EEST) (envelope-from avg@freebsd.org) Received: from localhost.topspin.kiev.ua ([127.0.0.1]) by porto.topspin.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1OyWSW-0001vk-1v; Thu, 23 Sep 2010 00:02:32 +0300 Message-ID: <4C9A6EE6.5050301@freebsd.org> Date: Thu, 23 Sep 2010 00:02:30 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.9) Gecko/20100918 Lightning/1.0b2 Thunderbird/3.1.4 MIME-Version: 1.0 To: John Baldwin References: <201009211507.o8LF7iVv097676@svn.freebsd.org> <4C9A1602.4020204@freebsd.org> <1285169017.64197.29.camel@buffy.york.ac.uk> <201009221558.27393.jhb@freebsd.org> In-Reply-To: <201009221558.27393.jhb@freebsd.org> X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Gavin Atkinson , src-committers@freebsd.org Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 21:02:36 -0000 on 22/09/2010 22:58 John Baldwin said the following: > Agreed. FWIW, I actually think that this is the only change needed as > crashinfo is enabled by default in 8.x and later. We already include symbols > in kernels by default now, so just setting dumpdev will give you the same > info you generally can get from a textdump in the form of a simple > /var/crash/core.txt.N file. > > The other benefit of full crashdumps + crashinfo as compared to textdumps is > that a developer can request further information in a PR followup (fire up > kgdb and enter command 'X' and reply with the output). With a textdump any > info not collected by the textdump is lost once the machine reboots after the > crash. Agree++ But what was the reason that dumpdev="AUTO" was reverted? I remember that POLA was quoted at the time. I am not sure what the astonishment actually was - perhaps 'AUTO' was not smart enough and destroyed somebody's data? -- Andriy Gapon From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 21:02:43 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5A85810656C7; Wed, 22 Sep 2010 21:02:43 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4A1508FC1D; Wed, 22 Sep 2010 21:02:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8ML2hkq043383; Wed, 22 Sep 2010 21:02:43 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8ML2hDD043380; Wed, 22 Sep 2010 21:02:43 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201009222102.o8ML2hDD043380@svn.freebsd.org> From: John Baldwin Date: Wed, 22 Sep 2010 21:02:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213028 - head/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 21:02:43 -0000 Author: jhb Date: Wed Sep 22 21:02:43 2010 New Revision: 213028 URL: http://svn.freebsd.org/changeset/base/213028 Log: - Expand scope of tun/tap softc locks to cover more softc fields and driver-maintained ifnet fields (such as if_drv_flags). - Use soft locks as the mutex that protects each interface's knote list rather than using the global knote list lock. Also, use the softc for kn_hook instead of the cdev. - Use mtx_sleep() instead of tsleep() when blocking in the read routines. This fixes a lost wakeup race. - Remove D_NEEDGIANT now that the cdevsw routines use the softc lock where locking is needed. - Lock IFQ when calculating the result for FIONREAD in tap(4). tun(4) already did this. - Remove remaining spl calls. Submitted by: Marcin Cieslak saper of saper|info (3) MFC after: 2 weeks Modified: head/sys/net/if_tap.c head/sys/net/if_tun.c Modified: head/sys/net/if_tap.c ============================================================================== --- head/sys/net/if_tap.c Wed Sep 22 20:27:59 2010 (r213027) +++ head/sys/net/if_tap.c Wed Sep 22 21:02:43 2010 (r213028) @@ -132,7 +132,7 @@ static struct filterops tap_write_filter static struct cdevsw tap_cdevsw = { .d_version = D_VERSION, - .d_flags = D_PSEUDO | D_NEEDGIANT | D_NEEDMINOR, + .d_flags = D_PSEUDO | D_NEEDMINOR, .d_open = tapopen, .d_close = tapclose, .d_read = tapread, @@ -209,7 +209,6 @@ static void tap_destroy(struct tap_softc *tp) { struct ifnet *ifp = tp->tap_ifp; - int s; /* Unlocked read. */ KASSERT(!(tp->tap_flags & TAP_OPEN), @@ -217,10 +216,8 @@ tap_destroy(struct tap_softc *tp) knlist_destroy(&tp->tap_rsel.si_note); destroy_dev(tp->tap_dev); - s = splimp(); ether_ifdetach(ifp); if_free_type(ifp, IFT_ETHER); - splx(s); mtx_destroy(&tp->tap_mtx); free(tp, M_TAP); @@ -398,7 +395,7 @@ tapcreate(struct cdev *dev) struct tap_softc *tp = NULL; unsigned short macaddr_hi; uint32_t macaddr_mid; - int unit, s; + int unit; char *name = NULL; u_char eaddr[6]; @@ -442,22 +439,20 @@ tapcreate(struct cdev *dev) ifp->if_ioctl = tapifioctl; ifp->if_mtu = ETHERMTU; ifp->if_flags = (IFF_BROADCAST|IFF_SIMPLEX|IFF_MULTICAST); - ifp->if_snd.ifq_maxlen = ifqmaxlen; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); ifp->if_capabilities |= IFCAP_LINKSTATE; ifp->if_capenable |= IFCAP_LINKSTATE; dev->si_drv1 = tp; tp->tap_dev = dev; - s = splimp(); ether_ifattach(ifp, eaddr); - splx(s); mtx_lock(&tp->tap_mtx); tp->tap_flags |= TAP_INITED; mtx_unlock(&tp->tap_mtx); - knlist_init_mtx(&tp->tap_rsel.si_note, NULL); + knlist_init_mtx(&tp->tap_rsel.si_note, &tp->tap_mtx); TAPDEBUG("interface %s is created. minor = %#x\n", ifp->if_xname, dev2unit(dev)); @@ -474,7 +469,7 @@ tapopen(struct cdev *dev, int flag, int { struct tap_softc *tp = NULL; struct ifnet *ifp = NULL; - int error, s; + int error; if (tapuopen == 0) { error = priv_check(td, PRIV_NET_TAP); @@ -497,15 +492,13 @@ tapopen(struct cdev *dev, int flag, int tp->tap_pid = td->td_proc->p_pid; tp->tap_flags |= TAP_OPEN; ifp = tp->tap_ifp; - mtx_unlock(&tp->tap_mtx); - s = splimp(); ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; if (tapuponopen) ifp->if_flags |= IFF_UP; if_link_state_change(ifp, LINK_STATE_UP); - splx(s); + mtx_unlock(&tp->tap_mtx); TAPDEBUG("%s is open. minor = %#x\n", ifp->if_xname, dev2unit(dev)); @@ -524,9 +517,9 @@ tapclose(struct cdev *dev, int foo, int struct ifaddr *ifa; struct tap_softc *tp = dev->si_drv1; struct ifnet *ifp = tp->tap_ifp; - int s; /* junk all pending output */ + mtx_lock(&tp->tap_mtx); IF_DRAIN(&ifp->if_snd); /* @@ -534,28 +527,26 @@ tapclose(struct cdev *dev, int foo, int * interface, if we are in VMnet mode. just close the device. */ - mtx_lock(&tp->tap_mtx); if (((tp->tap_flags & TAP_VMNET) == 0) && (ifp->if_flags & IFF_UP)) { mtx_unlock(&tp->tap_mtx); - s = splimp(); if_down(ifp); + mtx_lock(&tp->tap_mtx); if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + mtx_unlock(&tp->tap_mtx); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { rtinit(ifa, (int)RTM_DELETE, 0); } if_purgeaddrs(ifp); - ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + mtx_lock(&tp->tap_mtx); } - splx(s); - } else - mtx_unlock(&tp->tap_mtx); + } if_link_state_change(ifp, LINK_STATE_DOWN); funsetown(&tp->tap_sigio); selwakeuppri(&tp->tap_rsel, PZERO+1); - KNOTE_UNLOCKED(&tp->tap_rsel.si_note, 0); + KNOTE_LOCKED(&tp->tap_rsel.si_note, 0); - mtx_lock(&tp->tap_mtx); tp->tap_flags &= ~TAP_OPEN; tp->tap_pid = 0; mtx_unlock(&tp->tap_mtx); @@ -580,8 +571,10 @@ tapifinit(void *xtp) TAPDEBUG("initializing %s\n", ifp->if_xname); + mtx_lock(&tp->tap_mtx); ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + mtx_unlock(&tp->tap_mtx); /* attempt to start output */ tapifstart(ifp); @@ -599,7 +592,7 @@ tapifioctl(struct ifnet *ifp, u_long cmd struct tap_softc *tp = ifp->if_softc; struct ifreq *ifr = (struct ifreq *)data; struct ifstat *ifs = NULL; - int s, dummy; + int dummy; switch (cmd) { case SIOCSIFFLAGS: /* XXX -- just like vmnet does */ @@ -612,7 +605,6 @@ tapifioctl(struct ifnet *ifp, u_long cmd break; case SIOCGIFSTATUS: - s = splimp(); ifs = (struct ifstat *)data; dummy = strlen(ifs->ascii); mtx_lock(&tp->tap_mtx); @@ -621,14 +613,10 @@ tapifioctl(struct ifnet *ifp, u_long cmd sizeof(ifs->ascii) - dummy, "\tOpened by PID %d\n", tp->tap_pid); mtx_unlock(&tp->tap_mtx); - splx(s); break; default: - s = splimp(); - dummy = ether_ioctl(ifp, cmd, data); - splx(s); - return (dummy); + return (ether_ioctl(ifp, cmd, data)); /* NOT REACHED */ } @@ -645,7 +633,6 @@ static void tapifstart(struct ifnet *ifp) { struct tap_softc *tp = ifp->if_softc; - int s; TAPDEBUG("%s starting\n", ifp->if_xname); @@ -657,32 +644,28 @@ tapifstart(struct ifnet *ifp) mtx_lock(&tp->tap_mtx); if (((tp->tap_flags & TAP_VMNET) == 0) && ((tp->tap_flags & TAP_READY) != TAP_READY)) { - struct mbuf *m = NULL; - - mtx_unlock(&tp->tap_mtx); + struct mbuf *m; /* Unlocked read. */ TAPDEBUG("%s not ready, tap_flags = 0x%x\n", ifp->if_xname, tp->tap_flags); - s = splimp(); - do { + for (;;) { IF_DEQUEUE(&ifp->if_snd, m); - if (m != NULL) + if (m != NULL) { m_freem(m); - ifp->if_oerrors ++; - } while (m != NULL); - splx(s); + ifp->if_oerrors++; + } else + break; + } + mtx_unlock(&tp->tap_mtx); return; } - mtx_unlock(&tp->tap_mtx); - s = splimp(); ifp->if_drv_flags |= IFF_DRV_OACTIVE; - if (ifp->if_snd.ifq_len != 0) { - mtx_lock(&tp->tap_mtx); + if (!IFQ_IS_EMPTY(&ifp->if_snd)) { if (tp->tap_flags & TAP_RWAIT) { tp->tap_flags &= ~TAP_RWAIT; wakeup(tp); @@ -691,16 +674,16 @@ tapifstart(struct ifnet *ifp) if ((tp->tap_flags & TAP_ASYNC) && (tp->tap_sigio != NULL)) { mtx_unlock(&tp->tap_mtx); pgsigio(&tp->tap_sigio, SIGIO, 0); - } else - mtx_unlock(&tp->tap_mtx); + mtx_lock(&tp->tap_mtx); + } selwakeuppri(&tp->tap_rsel, PZERO+1); - KNOTE_UNLOCKED(&tp->tap_rsel.si_note, 0); + KNOTE_LOCKED(&tp->tap_rsel.si_note, 0); ifp->if_opackets ++; /* obytes are counted in ether_output */ } ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - splx(s); + mtx_unlock(&tp->tap_mtx); } /* tapifstart */ @@ -715,7 +698,6 @@ tapioctl(struct cdev *dev, u_long cmd, c struct tap_softc *tp = dev->si_drv1; struct ifnet *ifp = tp->tap_ifp; struct tapinfo *tapp = NULL; - int s; int f; #if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) || \ defined(COMPAT_FREEBSD4) @@ -724,19 +706,21 @@ tapioctl(struct cdev *dev, u_long cmd, c switch (cmd) { case TAPSIFINFO: - s = splimp(); tapp = (struct tapinfo *)data; + mtx_lock(&tp->tap_mtx); ifp->if_mtu = tapp->mtu; ifp->if_type = tapp->type; ifp->if_baudrate = tapp->baudrate; - splx(s); + mtx_unlock(&tp->tap_mtx); break; case TAPGIFINFO: tapp = (struct tapinfo *)data; + mtx_lock(&tp->tap_mtx); tapp->mtu = ifp->if_mtu; tapp->type = ifp->if_type; tapp->baudrate = ifp->if_baudrate; + mtx_unlock(&tp->tap_mtx); break; case TAPSDEBUG: @@ -757,26 +741,26 @@ tapioctl(struct cdev *dev, u_long cmd, c break; case FIOASYNC: - s = splimp(); mtx_lock(&tp->tap_mtx); if (*(int *)data) tp->tap_flags |= TAP_ASYNC; else tp->tap_flags &= ~TAP_ASYNC; mtx_unlock(&tp->tap_mtx); - splx(s); break; case FIONREAD: - s = splimp(); - if (ifp->if_snd.ifq_head) { - struct mbuf *mb = ifp->if_snd.ifq_head; + if (!IFQ_IS_EMPTY(&ifp->if_snd)) { + struct mbuf *mb; - for(*(int *)data = 0;mb != NULL;mb = mb->m_next) + IFQ_LOCK(&ifp->if_snd); + IFQ_POLL_NOLOCK(&ifp->if_snd, mb); + for (*(int *)data = 0; mb != NULL; + mb = mb->m_next) *(int *)data += mb->m_len; + IFQ_UNLOCK(&ifp->if_snd); } else *(int *)data = 0; - splx(s); break; case FIOSETOWN: @@ -797,10 +781,6 @@ tapioctl(struct cdev *dev, u_long cmd, c /* VMware/VMnet port ioctl's */ - case SIOCGIFFLAGS: /* get ifnet flags */ - bcopy(&ifp->if_flags, data, sizeof(ifp->if_flags)); - break; - #if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) || \ defined(COMPAT_FREEBSD4) case _IO('V', 0): @@ -814,9 +794,9 @@ tapioctl(struct cdev *dev, u_long cmd, c f &= ~IFF_CANTCHANGE; f |= IFF_UP; - s = splimp(); + mtx_lock(&tp->tap_mtx); ifp->if_flags = f | (ifp->if_flags & IFF_CANTCHANGE); - splx(s); + mtx_unlock(&tp->tap_mtx); break; case OSIOCGIFADDR: /* get MAC address of the remote side */ @@ -851,7 +831,7 @@ tapread(struct cdev *dev, struct uio *ui struct tap_softc *tp = dev->si_drv1; struct ifnet *ifp = tp->tap_ifp; struct mbuf *m = NULL; - int error = 0, len, s; + int error = 0, len; TAPDEBUG("%s reading, minor = %#x\n", ifp->if_xname, dev2unit(dev)); @@ -867,26 +847,27 @@ tapread(struct cdev *dev, struct uio *ui } tp->tap_flags &= ~TAP_RWAIT; - mtx_unlock(&tp->tap_mtx); /* sleep until we get a packet */ do { - s = splimp(); IF_DEQUEUE(&ifp->if_snd, m); - splx(s); if (m == NULL) { - if (flag & O_NONBLOCK) + if (flag & O_NONBLOCK) { + mtx_unlock(&tp->tap_mtx); return (EWOULDBLOCK); + } - mtx_lock(&tp->tap_mtx); tp->tap_flags |= TAP_RWAIT; - mtx_unlock(&tp->tap_mtx); - error = tsleep(tp,PCATCH|(PZERO+1),"taprd",0); - if (error) + error = mtx_sleep(tp, &tp->tap_mtx, PCATCH | (PZERO + 1), + "taprd", 0); + if (error) { + mtx_unlock(&tp->tap_mtx); return (error); + } } } while (m == NULL); + mtx_unlock(&tp->tap_mtx); /* feed packet to bpf */ BPF_MTAP(ifp, m); @@ -982,14 +963,14 @@ tappoll(struct cdev *dev, int events, st { struct tap_softc *tp = dev->si_drv1; struct ifnet *ifp = tp->tap_ifp; - int s, revents = 0; + int revents = 0; TAPDEBUG("%s polling, minor = %#x\n", ifp->if_xname, dev2unit(dev)); - s = splimp(); if (events & (POLLIN | POLLRDNORM)) { - if (ifp->if_snd.ifq_len > 0) { + IFQ_LOCK(&ifp->if_snd); + if (!IFQ_IS_EMPTY(&ifp->if_snd)) { TAPDEBUG("%s have data in queue. len = %d, " \ "minor = %#x\n", ifp->if_xname, ifp->if_snd.ifq_len, dev2unit(dev)); @@ -1001,12 +982,12 @@ tappoll(struct cdev *dev, int events, st selrecord(td, &tp->tap_rsel); } + IFQ_UNLOCK(&ifp->if_snd); } if (events & (POLLOUT | POLLWRNORM)) revents |= (events & (POLLOUT | POLLWRNORM)); - splx(s); return (revents); } /* tappoll */ @@ -1019,11 +1000,9 @@ tappoll(struct cdev *dev, int events, st static int tapkqfilter(struct cdev *dev, struct knote *kn) { - int s; struct tap_softc *tp = dev->si_drv1; struct ifnet *ifp = tp->tap_ifp; - s = splimp(); switch (kn->kn_filter) { case EVFILT_READ: TAPDEBUG("%s kqfilter: EVFILT_READ, minor = %#x\n", @@ -1040,13 +1019,11 @@ tapkqfilter(struct cdev *dev, struct kno default: TAPDEBUG("%s kqfilter: invalid filter, minor = %#x\n", ifp->if_xname, dev2unit(dev)); - splx(s); return (EINVAL); /* NOT REACHED */ } - splx(s); - kn->kn_hook = (caddr_t) dev; + kn->kn_hook = tp; knlist_add(&tp->tap_rsel.si_note, kn, 0); return (0); @@ -1061,12 +1038,11 @@ tapkqfilter(struct cdev *dev, struct kno static int tapkqread(struct knote *kn, long hint) { - int ret, s; - struct cdev *dev = (struct cdev *)(kn->kn_hook); - struct tap_softc *tp = dev->si_drv1; + int ret; + struct tap_softc *tp = kn->kn_hook; + struct cdev *dev = tp->tap_dev; struct ifnet *ifp = tp->tap_ifp; - s = splimp(); if ((kn->kn_data = ifp->if_snd.ifq_len) > 0) { TAPDEBUG("%s have data in queue. len = %d, minor = %#x\n", ifp->if_xname, ifp->if_snd.ifq_len, dev2unit(dev)); @@ -1076,7 +1052,6 @@ tapkqread(struct knote *kn, long hint) ifp->if_xname, dev2unit(dev)); ret = 0; } - splx(s); return (ret); } /* tapkqread */ @@ -1090,13 +1065,10 @@ tapkqread(struct knote *kn, long hint) static int tapkqwrite(struct knote *kn, long hint) { - int s; - struct tap_softc *tp = ((struct cdev *) kn->kn_hook)->si_drv1; + struct tap_softc *tp = kn->kn_hook; struct ifnet *ifp = tp->tap_ifp; - s = splimp(); kn->kn_data = ifp->if_mtu; - splx(s); return (1); } /* tapkqwrite */ @@ -1105,7 +1077,7 @@ tapkqwrite(struct knote *kn, long hint) static void tapkqdetach(struct knote *kn) { - struct tap_softc *tp = ((struct cdev *) kn->kn_hook)->si_drv1; + struct tap_softc *tp = kn->kn_hook; knlist_remove(&tp->tap_rsel.si_note, kn, 0); } /* tapkqdetach */ Modified: head/sys/net/if_tun.c ============================================================================== --- head/sys/net/if_tun.c Wed Sep 22 20:27:59 2010 (r213027) +++ head/sys/net/if_tun.c Wed Sep 22 21:02:43 2010 (r213028) @@ -165,7 +165,7 @@ static struct filterops tun_write_filter static struct cdevsw tun_cdevsw = { .d_version = D_VERSION, - .d_flags = D_PSEUDO | D_NEEDGIANT | D_NEEDMINOR, + .d_flags = D_PSEUDO | D_NEEDMINOR, .d_open = tunopen, .d_close = tunclose, .d_read = tunread, @@ -344,13 +344,13 @@ tunstart(struct ifnet *ifp) tp->tun_flags &= ~TUN_RWAIT; wakeup(tp); } + selwakeuppri(&tp->tun_rsel, PZERO + 1); + KNOTE_LOCKED(&tp->tun_rsel.si_note, 0); if (tp->tun_flags & TUN_ASYNC && tp->tun_sigio) { mtx_unlock(&tp->tun_mtx); pgsigio(&tp->tun_sigio, SIGIO, 0); } else mtx_unlock(&tp->tun_mtx); - selwakeuppri(&tp->tun_rsel, PZERO + 1); - KNOTE_UNLOCKED(&tp->tun_rsel.si_note, 0); } /* XXX: should return an error code so it can fail. */ @@ -385,7 +385,7 @@ tuncreate(const char *name, struct cdev IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); ifp->if_snd.ifq_drv_maxlen = 0; IFQ_SET_READY(&ifp->if_snd); - knlist_init_mtx(&sc->tun_rsel.si_note, NULL); + knlist_init_mtx(&sc->tun_rsel.si_note, &sc->tun_mtx); ifp->if_capabilities |= IFCAP_LINKSTATE; ifp->if_capenable |= IFCAP_LINKSTATE; @@ -426,10 +426,10 @@ tunopen(struct cdev *dev, int flag, int tp->tun_pid = td->td_proc->p_pid; tp->tun_flags |= TUN_OPEN; - mtx_unlock(&tp->tun_mtx); ifp = TUN2IFP(tp); if_link_state_change(ifp, LINK_STATE_UP); TUNDEBUG(ifp, "open\n"); + mtx_unlock(&tp->tun_mtx); return (0); } @@ -443,7 +443,6 @@ tunclose(struct cdev *dev, int foo, int { struct tun_softc *tp; struct ifnet *ifp; - int s; tp = dev->si_drv1; ifp = TUN2IFP(tp); @@ -451,27 +450,25 @@ tunclose(struct cdev *dev, int foo, int mtx_lock(&tp->tun_mtx); tp->tun_flags &= ~TUN_OPEN; tp->tun_pid = 0; - mtx_unlock(&tp->tun_mtx); /* * junk all pending output */ CURVNET_SET(ifp->if_vnet); - s = splimp(); IFQ_PURGE(&ifp->if_snd); - splx(s); if (ifp->if_flags & IFF_UP) { - s = splimp(); + mtx_unlock(&tp->tun_mtx); if_down(ifp); - splx(s); + mtx_lock(&tp->tun_mtx); } /* Delete all addresses and routes which reference this interface. */ if (ifp->if_drv_flags & IFF_DRV_RUNNING) { struct ifaddr *ifa; - s = splimp(); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + mtx_unlock(&tp->tun_mtx); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { /* deal w/IPv4 PtP destination; unlocked read */ if (ifa->ifa_addr->sa_family == AF_INET) { @@ -482,16 +479,14 @@ tunclose(struct cdev *dev, int foo, int } } if_purgeaddrs(ifp); - ifp->if_drv_flags &= ~IFF_DRV_RUNNING; - splx(s); + mtx_lock(&tp->tun_mtx); } if_link_state_change(ifp, LINK_STATE_DOWN); CURVNET_RESTORE(); - mtx_lock(&tp->tun_mtx); funsetown(&tp->tun_sigio); selwakeuppri(&tp->tun_rsel, PZERO + 1); - KNOTE_UNLOCKED(&tp->tun_rsel.si_note, 0); + KNOTE_LOCKED(&tp->tun_rsel.si_note, 0); TUNDEBUG (ifp, "closed\n"); cv_broadcast(&tp->tun_cv); @@ -510,6 +505,7 @@ tuninit(struct ifnet *ifp) TUNDEBUG(ifp, "tuninit\n"); + mtx_lock(&tp->tun_mtx); ifp->if_flags |= IFF_UP; ifp->if_drv_flags |= IFF_DRV_RUNNING; getmicrotime(&ifp->if_lastchange); @@ -521,18 +517,17 @@ tuninit(struct ifnet *ifp) struct sockaddr_in *si; si = (struct sockaddr_in *)ifa->ifa_addr; - mtx_lock(&tp->tun_mtx); if (si->sin_addr.s_addr) tp->tun_flags |= TUN_IASET; si = (struct sockaddr_in *)ifa->ifa_dstaddr; if (si && si->sin_addr.s_addr) tp->tun_flags |= TUN_DSTADDR; - mtx_unlock(&tp->tun_mtx); } } if_addr_runlock(ifp); #endif + mtx_unlock(&tp->tun_mtx); return (error); } @@ -545,9 +540,8 @@ tunifioctl(struct ifnet *ifp, u_long cmd struct ifreq *ifr = (struct ifreq *)data; struct tun_softc *tp = ifp->if_softc; struct ifstat *ifs; - int error = 0, s; + int error = 0; - s = splimp(); switch(cmd) { case SIOCGIFSTATUS: ifs = (struct ifstat *)data; @@ -576,7 +570,6 @@ tunifioctl(struct ifnet *ifp, u_long cmd default: error = EINVAL; } - splx(s); return (error); } @@ -682,7 +675,6 @@ tunoutput( static int tunioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) { - int s; int error; struct tun_softc *tp = dev->si_drv1; struct tuninfo *tunp; @@ -697,15 +689,19 @@ tunioctl(struct cdev *dev, u_long cmd, c if (error) return (error); } + mtx_lock(&tp->tun_mtx); TUN2IFP(tp)->if_mtu = tunp->mtu; TUN2IFP(tp)->if_type = tunp->type; TUN2IFP(tp)->if_baudrate = tunp->baudrate; + mtx_unlock(&tp->tun_mtx); break; case TUNGIFINFO: tunp = (struct tuninfo *)data; + mtx_lock(&tp->tun_mtx); tunp->mtu = TUN2IFP(tp)->if_mtu; tunp->type = TUN2IFP(tp)->if_type; tunp->baudrate = TUN2IFP(tp)->if_baudrate; + mtx_unlock(&tp->tun_mtx); break; case TUNSDEBUG: tundebug = *(int *)data; @@ -732,7 +728,6 @@ tunioctl(struct cdev *dev, u_long cmd, c mtx_unlock(&tp->tun_mtx); break; case TUNGIFHEAD: - /* Could be unlocked read? */ mtx_lock(&tp->tun_mtx); *(int *)data = (tp->tun_flags & TUN_IFHEAD) ? 1 : 0; mtx_unlock(&tp->tun_mtx); @@ -745,9 +740,11 @@ tunioctl(struct cdev *dev, u_long cmd, c switch (*(int *)data & ~IFF_MULTICAST) { case IFF_POINTOPOINT: case IFF_BROADCAST: + mtx_lock(&tp->tun_mtx); TUN2IFP(tp)->if_flags &= ~(IFF_BROADCAST|IFF_POINTOPOINT|IFF_MULTICAST); TUN2IFP(tp)->if_flags |= *(int *)data; + mtx_unlock(&tp->tun_mtx); break; default: return(EINVAL); @@ -769,17 +766,15 @@ tunioctl(struct cdev *dev, u_long cmd, c mtx_unlock(&tp->tun_mtx); break; case FIONREAD: - s = splimp(); if (!IFQ_IS_EMPTY(&TUN2IFP(tp)->if_snd)) { struct mbuf *mb; IFQ_LOCK(&TUN2IFP(tp)->if_snd); IFQ_POLL_NOLOCK(&TUN2IFP(tp)->if_snd, mb); - for( *(int *)data = 0; mb != 0; mb = mb->m_next) + for (*(int *)data = 0; mb != NULL; mb = mb->m_next) *(int *)data += mb->m_len; IFQ_UNLOCK(&TUN2IFP(tp)->if_snd); } else *(int *)data = 0; - splx(s); break; case FIOSETOWN: return (fsetown(*(int *)data, &tp->tun_sigio)); @@ -813,7 +808,7 @@ tunread(struct cdev *dev, struct uio *ui struct tun_softc *tp = dev->si_drv1; struct ifnet *ifp = TUN2IFP(tp); struct mbuf *m; - int error=0, len, s; + int error=0, len; TUNDEBUG (ifp, "read\n"); mtx_lock(&tp->tun_mtx); @@ -824,27 +819,24 @@ tunread(struct cdev *dev, struct uio *ui } tp->tun_flags &= ~TUN_RWAIT; - mtx_unlock(&tp->tun_mtx); - s = splimp(); do { IFQ_DEQUEUE(&ifp->if_snd, m); if (m == NULL) { if (flag & O_NONBLOCK) { - splx(s); + mtx_unlock(&tp->tun_mtx); return (EWOULDBLOCK); } - mtx_lock(&tp->tun_mtx); tp->tun_flags |= TUN_RWAIT; - mtx_unlock(&tp->tun_mtx); - if ((error = tsleep(tp, PCATCH | (PZERO + 1), - "tunread", 0)) != 0) { - splx(s); + error = mtx_sleep(tp, &tp->tun_mtx, PCATCH | (PZERO + 1), + "tunread", 0); + if (error != 0) { + mtx_unlock(&tp->tun_mtx); return (error); } } } while (m == NULL); - splx(s); + mtx_unlock(&tp->tun_mtx); while (m && uio->uio_resid > 0 && error == 0) { len = min(uio->uio_resid, m->m_len); @@ -957,13 +949,11 @@ tunwrite(struct cdev *dev, struct uio *u static int tunpoll(struct cdev *dev, int events, struct thread *td) { - int s; struct tun_softc *tp = dev->si_drv1; struct ifnet *ifp = TUN2IFP(tp); int revents = 0; struct mbuf *m; - s = splimp(); TUNDEBUG(ifp, "tunpoll\n"); if (events & (POLLIN | POLLRDNORM)) { @@ -981,7 +971,6 @@ tunpoll(struct cdev *dev, int events, st if (events & (POLLOUT | POLLWRNORM)) revents |= events & (POLLOUT | POLLWRNORM); - splx(s); return (revents); } @@ -991,11 +980,9 @@ tunpoll(struct cdev *dev, int events, st static int tunkqfilter(struct cdev *dev, struct knote *kn) { - int s; struct tun_softc *tp = dev->si_drv1; struct ifnet *ifp = TUN2IFP(tp); - s = splimp(); switch(kn->kn_filter) { case EVFILT_READ: TUNDEBUG(ifp, "%s kqfilter: EVFILT_READ, minor = %#x\n", @@ -1012,12 +999,10 @@ tunkqfilter(struct cdev *dev, struct kno default: TUNDEBUG(ifp, "%s kqfilter: invalid filter, minor = %#x\n", ifp->if_xname, dev2unit(dev)); - splx(s); return(EINVAL); } - splx(s); - kn->kn_hook = (caddr_t) dev; + kn->kn_hook = tp; knlist_add(&tp->tun_rsel.si_note, kn, 0); return (0); @@ -1029,12 +1014,11 @@ tunkqfilter(struct cdev *dev, struct kno static int tunkqread(struct knote *kn, long hint) { - int ret, s; - struct cdev *dev = (struct cdev *)(kn->kn_hook); - struct tun_softc *tp = dev->si_drv1; + int ret; + struct tun_softc *tp = kn->kn_hook; + struct cdev *dev = tp->tun_dev; struct ifnet *ifp = TUN2IFP(tp); - s = splimp(); if ((kn->kn_data = ifp->if_snd.ifq_len) > 0) { TUNDEBUG(ifp, "%s have data in the queue. Len = %d, minor = %#x\n", @@ -1046,7 +1030,6 @@ tunkqread(struct knote *kn, long hint) dev2unit(dev)); ret = 0; } - splx(s); return (ret); } @@ -1057,13 +1040,10 @@ tunkqread(struct knote *kn, long hint) static int tunkqwrite(struct knote *kn, long hint) { - int s; - struct tun_softc *tp = ((struct cdev *)kn->kn_hook)->si_drv1; + struct tun_softc *tp = kn->kn_hook; struct ifnet *ifp = TUN2IFP(tp); - s = splimp(); kn->kn_data = ifp->if_mtu; - splx(s); return (1); } @@ -1071,7 +1051,7 @@ tunkqwrite(struct knote *kn, long hint) static void tunkqdetach(struct knote *kn) { - struct tun_softc *tp = ((struct cdev *)kn->kn_hook)->si_drv1; + struct tun_softc *tp = kn->kn_hook; knlist_remove(&tp->tun_rsel.si_note, kn, 0); } From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 21:02:51 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EAB8E10656C4; Wed, 22 Sep 2010 21:02:51 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DA87F8FC21; Wed, 22 Sep 2010 21:02:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8ML2pIZ043422; Wed, 22 Sep 2010 21:02:51 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8ML2psV043420; Wed, 22 Sep 2010 21:02:51 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009222102.o8ML2psV043420@svn.freebsd.org> From: Marius Strobl Date: Wed, 22 Sep 2010 21:02:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213029 - stable/7/libexec/tftpd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 21:02:52 -0000 Author: marius Date: Wed Sep 22 21:02:51 2010 New Revision: 213029 URL: http://svn.freebsd.org/changeset/base/213029 Log: MFC: r173854 Add "with" to make the line go smoother. Modified: stable/7/libexec/tftpd/tftpd.8 Directory Properties: stable/7/libexec/tftpd/ (props changed) Modified: stable/7/libexec/tftpd/tftpd.8 ============================================================================== --- stable/7/libexec/tftpd/tftpd.8 Wed Sep 22 21:02:43 2010 (r213028) +++ stable/7/libexec/tftpd/tftpd.8 Wed Sep 22 21:02:51 2010 (r213029) @@ -200,7 +200,7 @@ option As .Fl w but append a YYYYMMDD.nn sequence number to the end of the filename. -Note that the string YYYYMMDD can be changed the +Note that the string YYYYMMDD can be changed with the .Fl F option. .El From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 21:06:41 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CD5D61065696; Wed, 22 Sep 2010 21:06:41 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BD0458FC19; Wed, 22 Sep 2010 21:06:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8ML6fP5043556; Wed, 22 Sep 2010 21:06:41 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8ML6fVd043554; Wed, 22 Sep 2010 21:06:41 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009222106.o8ML6fVd043554@svn.freebsd.org> From: Marius Strobl Date: Wed, 22 Sep 2010 21:06:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213030 - stable/8/libexec/tftpd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 21:06:41 -0000 Author: marius Date: Wed Sep 22 21:06:41 2010 New Revision: 213030 URL: http://svn.freebsd.org/changeset/base/213030 Log: MFC: r205076 (partial) Fix several typos in macros or macro misusage. Found by: make manlint Reviewed by: ru Approved by: philip (mentor) Modified: stable/8/libexec/tftpd/tftpd.8 Directory Properties: stable/8/libexec/tftpd/ (props changed) Modified: stable/8/libexec/tftpd/tftpd.8 ============================================================================== --- stable/8/libexec/tftpd/tftpd.8 Wed Sep 22 21:02:51 2010 (r213029) +++ stable/8/libexec/tftpd/tftpd.8 Wed Sep 22 21:06:41 2010 (r213030) @@ -240,7 +240,7 @@ and the and .Fl W options were introduced in -.Fx 7 . +.Fx 8.0 . .Pp .Sh BUGS Files larger than 33488896 octets (65535 blocks) cannot be transferred From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 21:06:44 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 04A551065695; Wed, 22 Sep 2010 21:06:44 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E7EA68FC2D; Wed, 22 Sep 2010 21:06:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8ML6hlt043592; Wed, 22 Sep 2010 21:06:43 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8ML6h5N043590; Wed, 22 Sep 2010 21:06:43 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009222106.o8ML6h5N043590@svn.freebsd.org> From: Marius Strobl Date: Wed, 22 Sep 2010 21:06:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213031 - stable/7/libexec/tftpd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 21:06:44 -0000 Author: marius Date: Wed Sep 22 21:06:43 2010 New Revision: 213031 URL: http://svn.freebsd.org/changeset/base/213031 Log: MFC: r205076 (partial) Fix several typos in macros or macro misusage. Found by: make manlint Reviewed by: ru Approved by: philip (mentor) Modified: stable/7/libexec/tftpd/tftpd.8 Directory Properties: stable/7/libexec/tftpd/ (props changed) Modified: stable/7/libexec/tftpd/tftpd.8 ============================================================================== --- stable/7/libexec/tftpd/tftpd.8 Wed Sep 22 21:06:41 2010 (r213030) +++ stable/7/libexec/tftpd/tftpd.8 Wed Sep 22 21:06:43 2010 (r213031) @@ -240,7 +240,7 @@ and the and .Fl W options were introduced in -.Fx 7 . +.Fx 8.0 . .Pp .Sh BUGS Files larger than 33488896 octets (65535 blocks) cannot be transferred From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 21:08:42 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9CF7C1065693; Wed, 22 Sep 2010 21:08:42 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail08.syd.optusnet.com.au (mail08.syd.optusnet.com.au [211.29.132.189]) by mx1.freebsd.org (Postfix) with ESMTP id 1D9B18FC16; Wed, 22 Sep 2010 21:08:41 +0000 (UTC) Received: from c122-107-116-249.carlnfd1.nsw.optusnet.com.au (c122-107-116-249.carlnfd1.nsw.optusnet.com.au [122.107.116.249]) by mail08.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o8ML8bU4027607 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 23 Sep 2010 07:08:39 +1000 Date: Thu, 23 Sep 2010 07:08:37 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Rui Paulo In-Reply-To: <201009221800.o8MI0Ze3038214@svn.freebsd.org> Message-ID: <20100923070247.L716@delplex.bde.org> References: <201009221800.o8MI0Ze3038214@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r213002 - in stable/8: include lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 21:08:42 -0000 On Wed, 22 Sep 2010, Rui Paulo wrote: > Log: > MFC r197804 (rwatson): > Add basename_r(3) to complement basename(3). basename_r(3) which accepts > a caller-allocated buffer of at least MAXPATHLEN, rather than using a > global buffer. MAXPATHLEN has been deprecated for more than 20 years. Please don't use it in new interfaces. A few man pages, not including basename.3, have been updated to spell it PATH_MAX (should be {PATH_MAX}). > Note about semantics: while this interface is not POSIXy, there's > another major platform that uses it (Android) and the semantics between > the two platforms are pretty much the same. It is also not non-POSIX... > Modified: stable/8/include/libgen.h > ============================================================================== > --- stable/8/include/libgen.h Wed Sep 22 16:54:22 2010 (r213001) > +++ stable/8/include/libgen.h Wed Sep 22 18:00:34 2010 (r213002) > @@ -36,6 +36,7 @@ > __BEGIN_DECLS > > char *basename(const char *); > +char *basename_r(const char *, char *); > char *dirname(const char *); > #if 0 > char *regcmp(const char *, ...); > ...since it is declared in the POSIX namespace. Bruce From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 21:10:46 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 53A361065674; Wed, 22 Sep 2010 21:10:46 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 43D888FC15; Wed, 22 Sep 2010 21:10:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MLAkEV043728; Wed, 22 Sep 2010 21:10:46 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MLAkm0043726; Wed, 22 Sep 2010 21:10:46 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201009222110.o8MLAkm0043726@svn.freebsd.org> From: Edwin Groothuis Date: Wed, 22 Sep 2010 21:10:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213032 - head/usr.bin/calendar/calendars X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 21:10:46 -0000 Author: edwin Date: Wed Sep 22 21:10:45 2010 New Revision: 213032 URL: http://svn.freebsd.org/changeset/base/213032 Log: Fix location of the Battle of the Plains of Abraham PR: 150504 Submitted by: Douglas Berry MFC after: 1 week Modified: head/usr.bin/calendar/calendars/calendar.history Modified: head/usr.bin/calendar/calendars/calendar.history ============================================================================== --- head/usr.bin/calendar/calendars/calendar.history Wed Sep 22 21:06:43 2010 (r213031) +++ head/usr.bin/calendar/calendars/calendar.history Wed Sep 22 21:10:45 2010 (r213032) @@ -303,7 +303,7 @@ 09/12 German paratroopers rescue Mussolini from captivity in Rome, 1943 09/12 Germany annexes Sudetenland, 1938 09/13 58° C (136.4° F) measured at el Azizia, Libya, 1922 -09/13 British defeat the French at Abraham near Quebec City, 1788 +09/13 British defeat the French at the Plains of Abraham near Quebec City, 1788 09/13 Building of Hadrian's Wall begun, 122 09/13 Chiang Kai-Shek becomes president of China, 1943 09/14 Benjamin Franklin is sent to France as an American minister, 1778 From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 21:14:19 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3FCBB1065696; Wed, 22 Sep 2010 21:14:19 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2FDB08FC26; Wed, 22 Sep 2010 21:14:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MLEJYU043981; Wed, 22 Sep 2010 21:14:19 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MLEJ5H043979; Wed, 22 Sep 2010 21:14:19 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201009222114.o8MLEJ5H043979@svn.freebsd.org> From: Edwin Groothuis Date: Wed, 22 Sep 2010 21:14:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213033 - head/usr.bin/calendar/calendars X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 21:14:19 -0000 Author: edwin Date: Wed Sep 22 21:14:18 2010 New Revision: 213033 URL: http://svn.freebsd.org/changeset/base/213033 Log: And now the 2nd part of the patch: Also fix the year. PR: 150504 Submitted by: Douglas Berry Modified: head/usr.bin/calendar/calendars/calendar.history Modified: head/usr.bin/calendar/calendars/calendar.history ============================================================================== --- head/usr.bin/calendar/calendars/calendar.history Wed Sep 22 21:10:45 2010 (r213032) +++ head/usr.bin/calendar/calendars/calendar.history Wed Sep 22 21:14:18 2010 (r213033) @@ -303,7 +303,7 @@ 09/12 German paratroopers rescue Mussolini from captivity in Rome, 1943 09/12 Germany annexes Sudetenland, 1938 09/13 58° C (136.4° F) measured at el Azizia, Libya, 1922 -09/13 British defeat the French at the Plains of Abraham near Quebec City, 1788 +09/13 British defeat the French at the Plains of Abraham, just outside the walls of Quebec City, 1759 09/13 Building of Hadrian's Wall begun, 122 09/13 Chiang Kai-Shek becomes president of China, 1943 09/14 Benjamin Franklin is sent to France as an American minister, 1778 From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 21:22:20 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 98DB31065673; Wed, 22 Sep 2010 21:22:20 +0000 (UTC) (envelope-from kensmith@buffalo.edu) Received: from localmailB.acsu.buffalo.edu (localmailB.acsu.buffalo.edu [128.205.5.200]) by mx1.freebsd.org (Postfix) with ESMTP id 62C398FC0A; Wed, 22 Sep 2010 21:22:19 +0000 (UTC) Received: from localmailB.acsu.buffalo.edu (localhost [127.0.0.1]) by localhost (Postfix) with SMTP id 00F015A47; Wed, 22 Sep 2010 17:15:34 -0400 (EDT) Received: from localmailB.acsu.buffalo.edu (localhost [127.0.0.1]) by localmailB.acsu.buffalo.edu (Postfix) with ESMTP id D2B585A2D; Wed, 22 Sep 2010 17:15:28 -0400 (EDT) Received: from mweb1.acsu.buffalo.edu (mweb1.acsu.buffalo.edu [128.205.5.238]) by localmailB.acsu.buffalo.edu (Prefixe) with ESMTP id BBB0E5966; Wed, 22 Sep 2010 17:15:28 -0400 (EDT) Received: from ken-smiths-macbook-pro.local (cpe-76-180-182-44.buffalo.res.rr.com [76.180.182.44]) by mweb1.acsu.buffalo.edu (Postfix) with ESMTP id 46C945B0038; Wed, 22 Sep 2010 17:15:28 -0400 (EDT) Message-ID: <4C9A71ED.6020406@buffalo.edu> Date: Wed, 22 Sep 2010 17:15:25 -0400 From: Ken Smith User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4 MIME-Version: 1.0 To: Andriy Gapon References: <201009211507.o8LF7iVv097676@svn.freebsd.org> <4C9A1602.4020204@freebsd.org> <1285169017.64197.29.camel@buffy.york.ac.uk> <201009221558.27393.jhb@freebsd.org> <4C9A6EE6.5050301@freebsd.org> In-Reply-To: <4C9A6EE6.5050301@freebsd.org> X-Enigmail-Version: 1.1.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-PM-EL-Spam-Prob: XX: 27% Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Gavin Atkinson , src-committers@freebsd.org, John Baldwin Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 21:22:20 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 9/22/10 5:02 PM, Andriy Gapon wrote: > on 22/09/2010 22:58 John Baldwin said the following: > >> Agreed. FWIW, I actually think that this is the only change needed as >> crashinfo is enabled by default in 8.x and later. We already include symbols >> in kernels by default now, so just setting dumpdev will give you the same >> info you generally can get from a textdump in the form of a simple >> /var/crash/core.txt.N file. >> >> The other benefit of full crashdumps + crashinfo as compared to textdumps is >> that a developer can request further information in a PR followup (fire up >> kgdb and enter command 'X' and reply with the output). With a textdump any >> info not collected by the textdump is lost once the machine reboots after the >> crash. > > Agree++ > But what was the reason that dumpdev="AUTO" was reverted? > I remember that POLA was quoted at the time. > I am not sure what the astonishment actually was - perhaps 'AUTO' was not smart > enough and destroyed somebody's data? > Not everybody would notice /var getting full of crash dumps. Picture a server farm where for the most part the machines are all just plain on auto-pilot. If one or several develop a problem that causes panic's /var can become full and possibly cause the machine to stop doing something important (between panic's...). I wasn't around when the initial decision for what to have it set to was made but this was the reason for me starting to do it again when I realized I forgot to at least once, and hence the reference to POLA. Crash dumps are good for individual workstations. Crash dumps are good for servers *if* the admin knows they're having a problem and is actively working on that server to resolve the issue. But they're no so good and can cause nasty side-effects if they're happening on a machine not being watched over closely. That's the reason for the change in setting when a -stable branch gets started. - -- Ken Smith - - From there to here, from here to | kensmith@buffalo.edu there, funny things are everywhere. | - Theodore Geisel | -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkyace0ACgkQ/G14VSmup/bfKwCdGWyWxuG91GSss6q3MUFAPi2r 6iwAmgLxxEXEODYubhfOFGkzwNx9r/Au =IIBd -----END PGP SIGNATURE----- From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 21:43:49 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 24AAA1065673; Wed, 22 Sep 2010 21:43:49 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 143FC8FC14; Wed, 22 Sep 2010 21:43:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MLhmN1044579; Wed, 22 Sep 2010 21:43:48 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MLhma0044577; Wed, 22 Sep 2010 21:43:48 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009222143.o8MLhma0044577@svn.freebsd.org> From: Marius Strobl Date: Wed, 22 Sep 2010 21:43:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213034 - stable/7/usr.bin/tftp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 21:43:49 -0000 Author: marius Date: Wed Sep 22 21:43:48 2010 New Revision: 213034 URL: http://svn.freebsd.org/changeset/base/213034 Log: MFC: r183857 Use strlcpy() instead of strncpy() when we want the string to be NUL-terminated. Modified: stable/7/usr.bin/tftp/main.c Directory Properties: stable/7/usr.bin/tftp/ (props changed) Modified: stable/7/usr.bin/tftp/main.c ============================================================================== --- stable/7/usr.bin/tftp/main.c Wed Sep 22 21:14:18 2010 (r213033) +++ stable/7/usr.bin/tftp/main.c Wed Sep 22 21:43:48 2010 (r213034) @@ -233,11 +233,10 @@ setpeer0(host, port) /* res->ai_addr <= sizeof(peeraddr) is guaranteed */ memcpy(&peeraddr, res->ai_addr, res->ai_addrlen); if (res->ai_canonname) { - (void) strncpy(hostname, res->ai_canonname, + (void) strlcpy(hostname, res->ai_canonname, sizeof(hostname)); } else - (void) strncpy(hostname, host, sizeof(hostname)); - hostname[sizeof(hostname)-1] = 0; + (void) strlcpy(hostname, host, sizeof(hostname)); connected = 1; } From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 21:44:55 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BF79C1065675; Wed, 22 Sep 2010 21:44:55 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AD9B08FC21; Wed, 22 Sep 2010 21:44:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MLitNU044674; Wed, 22 Sep 2010 21:44:55 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MLitlM044669; Wed, 22 Sep 2010 21:44:55 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009222144.o8MLitlM044669@svn.freebsd.org> From: Marius Strobl Date: Wed, 22 Sep 2010 21:44:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213035 - stable/7/usr.bin/tftp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 21:44:55 -0000 Author: marius Date: Wed Sep 22 21:44:55 2010 New Revision: 213035 URL: http://svn.freebsd.org/changeset/base/213035 Log: MFC: r183858 ANSIfy, plus constify interfaces where possible. Modified: stable/7/usr.bin/tftp/extern.h stable/7/usr.bin/tftp/main.c stable/7/usr.bin/tftp/tftp.c stable/7/usr.bin/tftp/tftpsubs.c Directory Properties: stable/7/usr.bin/tftp/ (props changed) Modified: stable/7/usr.bin/tftp/extern.h ============================================================================== --- stable/7/usr.bin/tftp/extern.h Wed Sep 22 21:43:48 2010 (r213034) +++ stable/7/usr.bin/tftp/extern.h Wed Sep 22 21:44:55 2010 (r213035) @@ -34,5 +34,5 @@ * $FreeBSD$ */ -void recvfile(int, char *, char *); -void xmitfile(int, char *, char *); +void recvfile(int, const char *, const char *); +void xmitfile(int, const char *, const char *); Modified: stable/7/usr.bin/tftp/main.c ============================================================================== --- stable/7/usr.bin/tftp/main.c Wed Sep 22 21:43:48 2010 (r213034) +++ stable/7/usr.bin/tftp/main.c Wed Sep 22 21:44:55 2010 (r213035) @@ -109,9 +109,9 @@ void status(int, char **); static void command(void) __dead2; static const char *command_prompt(void); -static void getusage(char *); +static void getusage(const char *); static void makeargv(void); -static void putusage(char *); +static void putusage(const char *); static void settftpmode(const char *); char *tail(char *); @@ -157,9 +157,7 @@ struct cmd cmdtab[] = { }; int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { f = -1; strcpy(mode, "netascii"); @@ -177,9 +175,7 @@ main(argc, argv) char hostname[MAXHOSTNAMELEN]; void -setpeer0(host, port) - char *host; - const char *port; +setpeer0(char *host, const char *port) { struct addrinfo hints, *res0, *res; int error; @@ -244,9 +240,7 @@ setpeer0(host, port) } void -setpeer(argc, argv) - int argc; - char *argv[]; +setpeer(int argc, char *argv[]) { if (argc < 2) { @@ -281,9 +275,7 @@ struct modes { }; void -modecmd(argc, argv) - int argc; - char *argv[]; +modecmd(int argc, char *argv[]) { struct modes *p; const char *sep; @@ -316,26 +308,21 @@ modecmd(argc, argv) } void -setbinary(argc, argv) - int argc __unused; - char *argv[] __unused; +setbinary(int argc __unused, char *argv[] __unused) { settftpmode("octet"); } void -setascii(argc, argv) - int argc __unused; - char *argv[] __unused; +setascii(int argc __unused, char *argv[] __unused) { settftpmode("netascii"); } static void -settftpmode(newmode) - const char *newmode; +settftpmode(const char *newmode) { strcpy(mode, newmode); if (verbose) @@ -347,9 +334,7 @@ settftpmode(newmode) * Send file(s). */ void -put(argc, argv) - int argc; - char *argv[]; +put(int argc, char *argv[]) { int fd; int n; @@ -421,8 +406,7 @@ put(argc, argv) } static void -putusage(s) - char *s; +putusage(const char *s) { printf("usage: %s file [[host:]remotename]\n", s); printf(" %s file1 file2 ... fileN [[host:]remote-directory]\n", s); @@ -432,9 +416,7 @@ putusage(s) * Receive file(s). */ void -get(argc, argv) - int argc; - char *argv[]; +get(int argc, char *argv[]) { int fd; int n; @@ -504,8 +486,7 @@ get(argc, argv) } static void -getusage(s) - char *s; +getusage(const char *s) { printf("usage: %s [host:]file [localname]\n", s); printf(" %s [host1:]file1 [host2:]file2 ... [hostN:]fileN\n", s); @@ -514,9 +495,7 @@ getusage(s) int rexmtval = TIMEOUT; void -setrexmt(argc, argv) - int argc; - char *argv[]; +setrexmt(int argc, char *argv[]) { int t; @@ -542,9 +521,7 @@ setrexmt(argc, argv) int maxtimeout = 5 * TIMEOUT; void -settimeout(argc, argv) - int argc; - char *argv[]; +settimeout(int argc, char *argv[]) { int t; @@ -568,9 +545,7 @@ settimeout(argc, argv) } void -status(argc, argv) - int argc __unused; - char *argv[] __unused; +status(int argc __unused, char *argv[] __unused) { if (connected) printf("Connected to %s.\n", hostname); @@ -583,8 +558,7 @@ status(argc, argv) } void -intr(dummy) - int dummy __unused; +intr(int dummy __unused) { signal(SIGALRM, SIG_IGN); @@ -593,8 +567,7 @@ intr(dummy) } char * -tail(filename) - char *filename; +tail(char *filename) { char *s; @@ -610,7 +583,7 @@ tail(filename) } static const char * -command_prompt() +command_prompt(void) { return ("tftp> "); @@ -620,7 +593,7 @@ command_prompt() * Command parser. */ static void -command() +command(void) { HistEvent he; struct cmd *c; @@ -679,8 +652,7 @@ command() } struct cmd * -getcmd(name) - char *name; +getcmd(char *name) { const char *p, *q; struct cmd *c, *found; @@ -711,7 +683,7 @@ getcmd(name) * Slice a string up into argc/argv. */ static void -makeargv() +makeargv(void) { char *cp; char **argp = margv; @@ -736,9 +708,7 @@ makeargv() } void -quit(argc, argv) - int argc __unused; - char *argv[] __unused; +quit(int argc __unused, char *argv[] __unused) { exit(txrx_error); } @@ -747,9 +717,7 @@ quit(argc, argv) * Help command. */ void -help(argc, argv) - int argc; - char *argv[]; +help(int argc, char *argv[]) { struct cmd *c; @@ -773,18 +741,14 @@ help(argc, argv) } void -settrace(argc, argv) - int argc __unused; - char **argv __unused; +settrace(int argc __unused, char **argv __unused) { trace = !trace; printf("Packet tracing %s.\n", trace ? "on" : "off"); } void -setverbose(argc, argv) - int argc __unused; - char **argv __unused; +setverbose(int argc __unused, char **argv __unused) { verbose = !verbose; printf("Verbose mode %s.\n", verbose ? "on" : "off"); Modified: stable/7/usr.bin/tftp/tftp.c ============================================================================== --- stable/7/usr.bin/tftp/tftp.c Wed Sep 22 21:43:48 2010 (r213034) +++ stable/7/usr.bin/tftp/tftp.c Wed Sep 22 21:44:55 2010 (r213035) @@ -80,23 +80,20 @@ int timeout; jmp_buf toplevel; jmp_buf timeoutbuf; -static void nak(int, struct sockaddr *); +static void nak(int, const struct sockaddr *); static int makerequest(int, const char *, struct tftphdr *, const char *); static void printstats(const char *, unsigned long); static void startclock(void); static void stopclock(void); static void timer(int); static void tpacket(const char *, struct tftphdr *, int); -static int cmpport(struct sockaddr *, struct sockaddr *); +static int cmpport(const struct sockaddr *, const struct sockaddr *); /* * Send the requested file. */ void -xmitfile(fd, name, mode) - int fd; - char *name; - char *mode; +xmitfile(int fd, const char *name, const char *mode) { struct tftphdr *ap; /* data and ack packets */ struct tftphdr *dp; @@ -214,10 +211,7 @@ abort: * Receive a file. */ void -recvfile(fd, name, mode) - int fd; - char *name; - char *mode; +recvfile(int fd, const char *name, const char *mode) { struct tftphdr *ap; struct tftphdr *dp; @@ -339,11 +333,7 @@ abort: /* ok to ack, since user */ } static int -makerequest(request, name, tp, mode) - int request; - const char *name; - struct tftphdr *tp; - const char *mode; +makerequest(int request, const char *name, struct tftphdr *tp, const char *mode) { char *cp; @@ -380,9 +370,7 @@ struct errmsg { * offset by 100. */ static void -nak(error, peer) - int error; - struct sockaddr *peer; +nak(int error, const struct sockaddr *peer) { struct errmsg *pe; struct tftphdr *tp; @@ -407,10 +395,7 @@ nak(error, peer) } static void -tpacket(s, tp, n) - const char *s; - struct tftphdr *tp; - int n; +tpacket(const char *s, struct tftphdr *tp, int n) { static const char *opcodes[] = { "#0", "RRQ", "WRQ", "DATA", "ACK", "ERROR" }; @@ -449,23 +434,21 @@ struct timeval tstart; struct timeval tstop; static void -startclock() +startclock(void) { (void)gettimeofday(&tstart, NULL); } static void -stopclock() +stopclock(void) { (void)gettimeofday(&tstop, NULL); } static void -printstats(direction, amount) - const char *direction; - unsigned long amount; +printstats(const char *direction, unsigned long amount) { double delta; /* compute delta in 1/10's second units */ @@ -479,8 +462,7 @@ printstats(direction, amount) } static void -timer(sig) - int sig __unused; +timer(int sig __unused) { timeout += rexmtval; @@ -493,9 +475,7 @@ timer(sig) } static int -cmpport(sa, sb) - struct sockaddr *sa; - struct sockaddr *sb; +cmpport(const struct sockaddr *sa, const struct sockaddr *sb) { char a[NI_MAXSERV], b[NI_MAXSERV]; Modified: stable/7/usr.bin/tftp/tftpsubs.c ============================================================================== --- stable/7/usr.bin/tftp/tftpsubs.c Wed Sep 22 21:43:48 2010 (r213034) +++ stable/7/usr.bin/tftp/tftpsubs.c Wed Sep 22 21:44:55 2010 (r213035) @@ -85,9 +85,8 @@ static struct tftphdr *rw_init(int); struct tftphdr *w_init(void) { return rw_init(0); } /* write-behind */ struct tftphdr *r_init(void) { return rw_init(1); } /* read-ahead */ -static struct tftphdr * -rw_init(x) /* init for either read-ahead or write-behind */ - int x; /* zero for write-behind, one for read-head */ +static struct tftphdr * /* init for either read-ahead or write-behind */ +rw_init(int x) /* zero for write-behind, one for read-head */ { newline = 0; /* init crlf flag */ prevchar = -1; @@ -103,10 +102,9 @@ rw_init(x) /* init for either read-ahe Free it and return next buffer filled with data. */ int -readit(file, dpp, convert) - FILE *file; /* file opened for read */ - struct tftphdr **dpp; - int convert; /* if true, convert to ascii */ +readit(FILE *file, /* file opened for read */ + struct tftphdr **dpp, + int convert) /* if true, convert to ascii */ { struct bf *b; @@ -126,9 +124,8 @@ readit(file, dpp, convert) * conversions are lf -> cr,lf and cr -> cr, nul */ void -read_ahead(file, convert) - FILE *file; /* file opened for read */ - int convert; /* if true, convert to ascii */ +read_ahead(FILE *file, /* file opened for read */ + int convert) /* if true, convert to ascii */ { register int i; register char *p; @@ -175,10 +172,7 @@ read_ahead(file, convert) available. */ int -writeit(file, dpp, ct, convert) - FILE *file; - struct tftphdr **dpp; - int ct, convert; +writeit(FILE *file, struct tftphdr **dpp, int ct, int convert) { bfs[current].counter = ct; /* set size of data to write */ current = !current; /* switch to other buffer */ @@ -196,9 +190,7 @@ writeit(file, dpp, ct, convert) * CR followed by anything else. In this case we leave it alone. */ int -write_behind(file, convert) - FILE *file; - int convert; +write_behind(FILE *file, int convert) { char *buf; int count; @@ -255,8 +247,7 @@ skipit: */ int -synchnet(f) - int f; /* socket to flush */ +synchnet(int f) /* socket to flush */ { int i, j = 0; char rbuf[PKTSIZE]; From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 21:53:48 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C9E13106566C; Wed, 22 Sep 2010 21:53:48 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 99C628FC08; Wed, 22 Sep 2010 21:53:48 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 48C0D46B46; Wed, 22 Sep 2010 17:53:48 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 415F58A04E; Wed, 22 Sep 2010 17:53:47 -0400 (EDT) From: John Baldwin To: Ken Smith Date: Wed, 22 Sep 2010 17:53:21 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201009211507.o8LF7iVv097676@svn.freebsd.org> <4C9A6EE6.5050301@freebsd.org> <4C9A71ED.6020406@buffalo.edu> In-Reply-To: <4C9A71ED.6020406@buffalo.edu> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201009221753.21408.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Wed, 22 Sep 2010 17:53:47 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Gavin Atkinson , src-committers@freebsd.org, Andriy Gapon Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 21:53:48 -0000 On Wednesday, September 22, 2010 5:15:25 pm Ken Smith wrote: > On 9/22/10 5:02 PM, Andriy Gapon wrote: > > on 22/09/2010 22:58 John Baldwin said the following: > > > >> Agreed. FWIW, I actually think that this is the only change needed as > >> crashinfo is enabled by default in 8.x and later. We already include symbols > >> in kernels by default now, so just setting dumpdev will give you the same > >> info you generally can get from a textdump in the form of a simple > >> /var/crash/core.txt.N file. > >> > >> The other benefit of full crashdumps + crashinfo as compared to textdumps is > >> that a developer can request further information in a PR followup (fire up > >> kgdb and enter command 'X' and reply with the output). With a textdump any > >> info not collected by the textdump is lost once the machine reboots after the > >> crash. > > > > Agree++ > > But what was the reason that dumpdev="AUTO" was reverted? > > I remember that POLA was quoted at the time. > > I am not sure what the astonishment actually was - perhaps 'AUTO' was not smart > > enough and destroyed somebody's data? > > > > > Not everybody would notice /var getting full of crash dumps. > Picture a server farm where for the most part the machines > are all just plain on auto-pilot. If one or several develop > a problem that causes panic's /var can become full and possibly > cause the machine to stop doing something important (between > panic's...). I wasn't around when the initial decision for > what to have it set to was made but this was the reason for > me starting to do it again when I realized I forgot to at > least once, and hence the reference to POLA. > > Crash dumps are good for individual workstations. Crash > dumps are good for servers *if* the admin knows they're > having a problem and is actively working on that server > to resolve the issue. But they're no so good and can > cause nasty side-effects if they're happening on a machine > not being watched over closely. That's the reason for > the change in setting when a -stable branch gets started. FWIW, the Y! version of crashinfo auto-deletes crash dumps based on the available disk space for precisely this reason. With that addition crashinfo works quite well on a very large server farm. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 21:54:14 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2652B1065670; Wed, 22 Sep 2010 21:54:14 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 142C78FC1B; Wed, 22 Sep 2010 21:54:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MLsEHh045066; Wed, 22 Sep 2010 21:54:14 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MLsENI045062; Wed, 22 Sep 2010 21:54:14 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009222154.o8MLsENI045062@svn.freebsd.org> From: Marius Strobl Date: Wed, 22 Sep 2010 21:54:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213036 - stable/8/usr.bin/tftp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 21:54:14 -0000 Author: marius Date: Wed Sep 22 21:54:13 2010 New Revision: 213036 URL: http://svn.freebsd.org/changeset/base/213036 Log: MFC: r207607, r207621, r209112, r209550, r209551 Go ahead and merge the work edwin@ on tftpd into the tree. It is a lot better than what's in the tree now. Edwin tested it at a prior employer, but can't test it today. I've found that it works a lot better with the various uboot versions that I've used in my embedded work. Here's the pkg-descr from the port that describes the changes: It all started when we got some new routers, which told me the following when trying to upload configuration or download images from it: The TFTP server doesn't support the blocksize option. My curiousity was triggered, it took me some reading of RFCs and other documentation to find out what was possible and what could be done. Was plain TFTP very simple in its handshake, TFTP with options was kind of messy because of its backwards capability: The first packet returned could either be an acknowledgement of options, or the first data packet. Going through the source code of src/libexec/tftpd and going through the code of src/usr.bin/tftp showed that there was a lot of duplicate code, and the addition of options would only increase the amount of duplicate code. After all, both the client and the server can act as a sender and receiver. At the end, it ended up with a nearly complete rewrite of the tftp client and server. It has been tested against the following TFTP clients and servers: - Itself (yay!) - The standard FreeBSD tftp client and server - The Fedora Core 6 tftp client and server - Cisco router tftp client - Extreme Networks tftp client It supports the following RFCs: RFC1350 - THE TFTP PROTOCOL (REVISION 2) RFC2347 - TFTP Option Extension RFC2348 - TFTP Blocksize Option RFC2349 - TFTP Timeout Interval and Transfer Size Options RFC3617 - Uniform Resource Identifier (URI) Scheme and Applicability Statement for the Trivial File Transfer Protocol (TFTP) It supports the following unofficial TFTP Options as described at http://www.compuphase.com/tftp.htm: blksize2 - Block size restricted to powers of 2, excluding protocol headers rollover - Block counter roll-over (roll back to zero or to one) From the tftp program point of view the following things are changed: - New commands: "blocksize", "blocksize2", "rollover" and "options" - Development features: "debug" and "packetdrop" If you try this tftp/tftpd implementation, please let me know if it works (or doesn't work) and against which implementaion so I can get a list of confirmed working systems. Author: Edwin Groothuis Added: stable/8/usr.bin/tftp/tftp.h - copied unchanged from r207621, head/usr.bin/tftp/tftp.h Deleted: stable/8/usr.bin/tftp/extern.h stable/8/usr.bin/tftp/tftpsubs.c stable/8/usr.bin/tftp/tftpsubs.h Modified: stable/8/usr.bin/tftp/Makefile stable/8/usr.bin/tftp/main.c stable/8/usr.bin/tftp/tftp.1 stable/8/usr.bin/tftp/tftp.c Directory Properties: stable/8/usr.bin/tftp/ (props changed) Modified: stable/8/usr.bin/tftp/Makefile ============================================================================== --- stable/8/usr.bin/tftp/Makefile Wed Sep 22 21:44:55 2010 (r213035) +++ stable/8/usr.bin/tftp/Makefile Wed Sep 22 21:54:13 2010 (r213036) @@ -1,9 +1,13 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 # $FreeBSD$ +CFLAGS=-g -Wall +WARNS= 3 PROG= tftp -SRCS= main.c tftp.c tftpsubs.c +SRCS= main.c tftp.c tftp-utils.c tftp-io.c tftp-file.c tftp-transfer.c tftp-options.c DPADD= ${LIBEDIT} ${LIBTERMCAP} LDADD= -ledit -ltermcap +CFLAGS+=-I${.CURDIR}/../../libexec/tftpd -I${.CURDIR}/../../usr.bin/tftp +.PATH: ${.CURDIR}/../../libexec/tftpd .include Modified: stable/8/usr.bin/tftp/main.c ============================================================================== --- stable/8/usr.bin/tftp/main.c Wed Sep 22 21:44:55 2010 (r213035) +++ stable/8/usr.bin/tftp/main.c Wed Sep 22 21:54:13 2010 (r213036) @@ -54,12 +54,14 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include #include - #include +#include #include #include @@ -72,119 +74,212 @@ __FBSDID("$FreeBSD$"); #include #include -#include "extern.h" +#include "tftp-utils.h" +#include "tftp-io.h" +#include "tftp-options.h" +#include "tftp.h" #define MAXLINE 200 #define TIMEOUT 5 /* secs between rexmt's */ -struct sockaddr_storage peeraddr; -int f; -int trace; -int verbose; -int connected; -char mode[32]; -char line[MAXLINE]; -int margc; +static struct sockaddr_storage peeraddr; +static int connected; +static char mode[32]; +jmp_buf toplevel; +volatile int txrx_error; +static int peer; + #define MAX_MARGV 20 -char *margv[MAX_MARGV]; -jmp_buf toplevel; -volatile int txrx_error; - -void get(int, char **); -void help(int, char **); -void intr(int); -void modecmd(int, char **); -void put(int, char **); -void quit(int, char **); -void setascii(int, char **); -void setbinary(int, char **); -void setpeer0(char *, const char *); -void setpeer(int, char **); -void setrexmt(int, char **); -void settimeout(int, char **); -void settrace(int, char **); -void setverbose(int, char **); -void status(int, char **); +static int margc; +static char *margv[MAX_MARGV]; + +int verbose; +char *port = NULL; + +static void get(int, char **); +static void help(int, char **); +static void intr(int); +static void modecmd(int, char **); +static void put(int, char **); +static void quit(int, char **); +static void setascii(int, char **); +static void setbinary(int, char **); +static void setpeer0(char *, const char *); +static void setpeer(int, char **); +static void settimeoutpacket(int, char **); +static void settimeoutnetwork(int, char **); +static void setdebug(int, char **); +static void setverbose(int, char **); +static void showstatus(int, char **); +static void setblocksize(int, char **); +static void setblocksize2(int, char **); +static void setoptions(int, char **); +static void setrollover(int, char **); +static void setpacketdrop(int, char **); static void command(void) __dead2; static const char *command_prompt(void); -static void getusage(const char *); -static void makeargv(void); -static void putusage(const char *); +static void urihandling(char *URI); +static void getusage(char *); +static void makeargv(char *line); +static void putusage(char *); static void settftpmode(const char *); -char *tail(char *); -struct cmd *getcmd(char *); +static char *tail(char *); +static struct cmd *getcmd(char *); #define HELPINDENT (sizeof("connect")) struct cmd { const char *name; - char *help; void (*handler)(int, char **); + const char *help; }; -char vhelp[] = "toggle verbose mode"; -char thelp[] = "toggle packet tracing"; -char chelp[] = "connect to remote tftp"; -char qhelp[] = "exit tftp"; -char hhelp[] = "print help information"; -char shelp[] = "send file"; -char rhelp[] = "receive file"; -char mhelp[] = "set file transfer mode"; -char sthelp[] = "show current status"; -char xhelp[] = "set per-packet retransmission timeout"; -char ihelp[] = "set total retransmission timeout"; -char ashelp[] = "set mode to netascii"; -char bnhelp[] = "set mode to octet"; - -struct cmd cmdtab[] = { - { "connect", chelp, setpeer }, - { "mode", mhelp, modecmd }, - { "put", shelp, put }, - { "get", rhelp, get }, - { "quit", qhelp, quit }, - { "verbose", vhelp, setverbose }, - { "trace", thelp, settrace }, - { "status", sthelp, status }, - { "binary", bnhelp, setbinary }, - { "ascii", ashelp, setascii }, - { "rexmt", xhelp, setrexmt }, - { "timeout", ihelp, settimeout }, - { "?", hhelp, help }, - { NULL, NULL, NULL } +static struct cmd cmdtab[] = { + { "connect", setpeer, "connect to remote tftp" }, + { "mode", modecmd, "set file transfer mode" }, + { "put", put, "send file" }, + { "get", get, "receive file" }, + { "quit", quit, "exit tftp" }, + { "verbose", setverbose, "toggle verbose mode" }, + { "status", showstatus, "show current status" }, + { "binary", setbinary, "set mode to octet" }, + { "ascii", setascii, "set mode to netascii" }, + { "rexmt", settimeoutpacket, + "set per-packet retransmission timeout[-]" }, + { "timeout", settimeoutnetwork, + "set total retransmission timeout" }, + { "trace", setdebug, "enable 'debug packet'[-]" }, + { "debug", setdebug, "enable verbose output" }, + { "blocksize", setblocksize, "set blocksize[*]" }, + { "blocksize2", setblocksize2, "set blocksize as a power of 2[**]" }, + { "rollover", setrollover, "rollover after 64K packets[**]" }, + { "options", setoptions, + "enable or disable RFC2347 style options" }, + { "help", help, "print help information" }, + { "packetdrop", setpacketdrop, "artifical packetloss feature" }, + { "?", help, "print help information" }, + { NULL, NULL, NULL } +}; + +static struct modes { + const char *m_name; + const char *m_mode; +} modes[] = { + { "ascii", "netascii" }, + { "netascii", "netascii" }, + { "binary", "octet" }, + { "image", "octet" }, + { "octet", "octet" }, + { NULL, NULL } }; int main(int argc, char *argv[]) { - f = -1; + + acting_as_client = 1; + peer = -1; strcpy(mode, "netascii"); signal(SIGINT, intr); if (argc > 1) { if (setjmp(toplevel) != 0) exit(txrx_error); + + if (strncmp(argv[1], "tftp://", 7) == 0) { + urihandling(argv[1]); + exit(txrx_error); + } + setpeer(argc, argv); } if (setjmp(toplevel) != 0) (void)putchar('\n'); + + init_options(); command(); } -char hostname[MAXHOSTNAMELEN]; +/* + * RFC3617 handling of TFTP URIs: + * + * tftpURI = "tftp://" host "/" file [ mode ] + * mode = ";" "mode=" ( "netascii" / "octet" ) + * file = *( unreserved / escaped ) + * host = + * unreserved = + * escaped = + * + * We are cheating a little bit by allowing any mode as specified in the + * modes table defined earlier on in this file and mapping it on the real + * mode. + */ +static void +urihandling(char *URI) +{ + char uri[ARG_MAX]; + char *host = NULL; + char *path = NULL; + char *options = NULL; + char *mode = "octet"; + char *s; + char line[MAXLINE]; + int i; + + strncpy(uri, URI, ARG_MAX); + host = uri + 7; + + if ((s = strchr(host, '/')) == NULL) { + fprintf(stderr, + "Invalid URI: Couldn't find / after hostname\n"); + exit(1); + } + *s = '\0'; + path = s + 1; + + if ((s = strchr(path, ';')) != NULL) { + *s = '\0'; + options = s + 1; + + if (strncmp(options, "mode=", 5) == 0) { + mode = options; + mode += 5; + + for (i = 0; modes[i].m_name != NULL; i++) { + if (strcmp(modes[i].m_name, mode) == 0) + break; + } + if (modes[i].m_name == NULL) { + fprintf(stderr, "Invalid mode: '%s'\n", mode); + exit(1); + } + settftpmode(modes[i].m_mode); + } + } else { + settftpmode("octet"); + } + + setpeer0(host, NULL); + + sprintf(line, "get %s", path); + makeargv(line); + get(margc, margv); +} + +static char hostname[MAXHOSTNAMELEN]; -void -setpeer0(char *host, const char *port) +static void +setpeer0(char *host, const char *lport) { struct addrinfo hints, *res0, *res; int error; - struct sockaddr_storage ss; const char *cause = "unknown"; if (connected) { - close(f); - f = -1; + close(peer); + peer = -1; } connected = 0; @@ -193,9 +288,9 @@ setpeer0(char *host, const char *port) hints.ai_socktype = SOCK_DGRAM; hints.ai_protocol = IPPROTO_UDP; hints.ai_flags = AI_CANONNAME; - if (!port) - port = "tftp"; - error = getaddrinfo(host, port, &hints, &res0); + if (!lport) + lport = "tftp"; + error = getaddrinfo(host, lport, &hints, &res0); if (error) { warnx("%s", gai_strerror(error)); return; @@ -204,50 +299,53 @@ setpeer0(char *host, const char *port) for (res = res0; res; res = res->ai_next) { if (res->ai_addrlen > sizeof(peeraddr)) continue; - f = socket(res->ai_family, res->ai_socktype, res->ai_protocol); - if (f < 0) { + peer = socket(res->ai_family, res->ai_socktype, + res->ai_protocol); + if (peer < 0) { cause = "socket"; continue; } - memset(&ss, 0, sizeof(ss)); - ss.ss_family = res->ai_family; - ss.ss_len = res->ai_addrlen; - if (bind(f, (struct sockaddr *)&ss, ss.ss_len) < 0) { + memset(&peer_sock, 0, sizeof(peer_sock)); + peer_sock.ss_family = res->ai_family; + peer_sock.ss_len = res->ai_addrlen; + if (bind(peer, (struct sockaddr *)&peer_sock, peer_sock.ss_len) < 0) { cause = "bind"; - close(f); - f = -1; + close(peer); + peer = -1; continue; } break; } - if (f < 0) + if (peer < 0) warn("%s", cause); else { /* res->ai_addr <= sizeof(peeraddr) is guaranteed */ - memcpy(&peeraddr, res->ai_addr, res->ai_addrlen); + memcpy(&peer_sock, res->ai_addr, res->ai_addrlen); if (res->ai_canonname) { - (void) strlcpy(hostname, res->ai_canonname, + (void) strncpy(hostname, res->ai_canonname, sizeof(hostname)); } else - (void) strlcpy(hostname, host, sizeof(hostname)); + (void) strncpy(hostname, host, sizeof(hostname)); + hostname[sizeof(hostname)-1] = 0; connected = 1; } freeaddrinfo(res0); } -void +static void setpeer(int argc, char *argv[]) { + char line[MAXLINE]; if (argc < 2) { strcpy(line, "Connect "); printf("(to) "); fgets(&line[strlen(line)], sizeof line - strlen(line), stdin); - makeargv(); + makeargv(line); argc = margc; argv = margv; } @@ -255,26 +353,14 @@ setpeer(int argc, char *argv[]) printf("usage: %s [host [port]]\n", argv[0]); return; } - if (argc == 3) + if (argc == 3) { + port = argv[2]; setpeer0(argv[1], argv[2]); - else + } else setpeer0(argv[1], NULL); } -struct modes { - const char *m_name; - const char *m_mode; -} modes[] = { - { "ascii", "netascii" }, - { "netascii", "netascii" }, - { "binary", "octet" }, - { "image", "octet" }, - { "octet", "octet" }, -/* { "mail", "mail" }, */ - { 0, 0 } -}; - -void +static void modecmd(int argc, char *argv[]) { struct modes *p; @@ -298,7 +384,7 @@ modecmd(int argc, char *argv[]) printf("usage: %s [", argv[0]); sep = " "; - for (p = modes; p->m_name; p++) { + for (p = modes; p->m_name != NULL; p++) { printf("%s%s", sep, p->m_name); if (*sep == ' ') sep = " | "; @@ -307,14 +393,14 @@ modecmd(int argc, char *argv[]) return; } -void +static void setbinary(int argc __unused, char *argv[] __unused) { settftpmode("octet"); } -void +static void setascii(int argc __unused, char *argv[] __unused) { @@ -324,6 +410,7 @@ setascii(int argc __unused, char *argv[] static void settftpmode(const char *newmode) { + strcpy(mode, newmode); if (verbose) printf("mode set to %s\n", mode); @@ -333,18 +420,20 @@ settftpmode(const char *newmode) /* * Send file(s). */ -void +static void put(int argc, char *argv[]) { - int fd; - int n; - char *cp, *targ; + int fd; + int n; + char *cp, *targ; + char line[MAXLINE]; + struct stat sb; if (argc < 2) { strcpy(line, "send "); printf("(file) "); fgets(&line[strlen(line)], sizeof line - strlen(line), stdin); - makeargv(); + makeargv(line); argc = margc; argv = margv; } @@ -381,10 +470,14 @@ put(int argc, char *argv[]) warn("%s", cp); return; } + + stat(cp, &sb); + asprintf(&options[OPT_TSIZE].o_request, "%ju", sb.st_size); + if (verbose) printf("putting %s to %s:%s [%s]\n", - cp, hostname, targ, mode); - xmitfile(fd, targ, mode); + cp, hostname, targ, mode); + xmitfile(peer, port, fd, targ, mode); return; } /* this assumes the target is a directory */ @@ -398,36 +491,43 @@ put(int argc, char *argv[]) warn("%s", argv[n]); continue; } + + stat(cp, &sb); + asprintf(&options[OPT_TSIZE].o_request, "%ju", sb.st_size); + if (verbose) printf("putting %s to %s:%s [%s]\n", - argv[n], hostname, targ, mode); - xmitfile(fd, targ, mode); + argv[n], hostname, targ, mode); + xmitfile(peer, port, fd, targ, mode); } } static void -putusage(const char *s) +putusage(char *s) { - printf("usage: %s file [[host:]remotename]\n", s); + + printf("usage: %s file [remotename]\n", s); + printf(" %s file host:remotename\n", s); printf(" %s file1 file2 ... fileN [[host:]remote-directory]\n", s); } /* * Receive file(s). */ -void +static void get(int argc, char *argv[]) { int fd; int n; char *cp; char *src; + char line[MAXLINE]; if (argc < 2) { strcpy(line, "get "); printf("(files) "); fgets(&line[strlen(line)], sizeof line - strlen(line), stdin); - makeargv(); + makeargv(line); argc = margc; argv = margv; } @@ -438,6 +538,8 @@ get(int argc, char *argv[]) if (!connected) { for (n = 1; n < argc ; n++) if (rindex(argv[n], ':') == 0) { + printf("No remote host specified and " + "no host given for file '%s'\n", argv[n]); getusage(argv[0]); return; } @@ -468,8 +570,8 @@ get(int argc, char *argv[]) } if (verbose) printf("getting from %s:%s to %s [%s]\n", - hostname, src, cp, mode); - recvfile(fd, src, mode); + hostname, src, cp, mode); + recvfile(peer, port, fd, src, mode); break; } cp = tail(src); /* new .. jdg */ @@ -480,30 +582,31 @@ get(int argc, char *argv[]) } if (verbose) printf("getting from %s:%s to %s [%s]\n", - hostname, src, cp, mode); - recvfile(fd, src, mode); + hostname, src, cp, mode); + recvfile(peer, port, fd, src, mode); } } static void -getusage(const char *s) +getusage(char *s) { - printf("usage: %s [host:]file [localname]\n", s); + + printf("usage: %s file [localname]\n", s); + printf(" %s [host:]file [localname]\n", s); printf(" %s [host1:]file1 [host2:]file2 ... [hostN:]fileN\n", s); } -int rexmtval = TIMEOUT; - -void -setrexmt(int argc, char *argv[]) +static void +settimeoutpacket(int argc, char *argv[]) { int t; + char line[MAXLINE]; if (argc < 2) { - strcpy(line, "Rexmt-timeout "); + strcpy(line, "Packet timeout "); printf("(value) "); fgets(&line[strlen(line)], sizeof line - strlen(line), stdin); - makeargv(); + makeargv(line); argc = margc; argv = margv; } @@ -512,24 +615,25 @@ setrexmt(int argc, char *argv[]) return; } t = atoi(argv[1]); - if (t < 0) + if (t < 0) { printf("%s: bad value\n", argv[1]); - else - rexmtval = t; -} + return; + } -int maxtimeout = 5 * TIMEOUT; + settimeouts(t, timeoutnetwork, maxtimeouts); +} -void -settimeout(int argc, char *argv[]) +static void +settimeoutnetwork(int argc, char *argv[]) { int t; + char line[MAXLINE]; if (argc < 2) { - strcpy(line, "Maximum-timeout "); + strcpy(line, "Network timeout "); printf("(value) "); fgets(&line[strlen(line)], sizeof line - strlen(line), stdin); - makeargv(); + makeargv(line); argc = margc; argv = margv; } @@ -538,26 +642,36 @@ settimeout(int argc, char *argv[]) return; } t = atoi(argv[1]); - if (t < 0) + if (t < 0) { printf("%s: bad value\n", argv[1]); - else - maxtimeout = t; + return; + } + + settimeouts(timeoutpacket, t, maxtimeouts); } -void -status(int argc __unused, char *argv[] __unused) +static void +showstatus(int argc __unused, char *argv[] __unused) { - if (connected) - printf("Connected to %s.\n", hostname); - else - printf("Not connected.\n"); - printf("Mode: %s Verbose: %s Tracing: %s\n", mode, - verbose ? "on" : "off", trace ? "on" : "off"); - printf("Rexmt-interval: %d seconds, Max-timeout: %d seconds\n", - rexmtval, maxtimeout); + + printf("Remote host: %s\n", + connected ? hostname : "none specified yet"); + printf("RFC2347 Options support: %s\n", + options_rfc_enabled ? "enabled" : "disabled"); + printf("Non-RFC defined options support: %s\n", + options_extra_enabled ? "enabled" : "disabled"); + printf("Mode: %s\n", mode); + printf("Verbose: %s\n", verbose ? "on" : "off"); + printf("Debug: %s\n", debug_show(debug)); + printf("Artificial packetloss: %d in 100 packets\n", + packetdroppercentage); + printf("Segment size: %d bytes\n", segsize); + printf("Network timeout: %d seconds\n", timeoutpacket); + printf("Maximum network timeout: %d seconds\n", timeoutnetwork); + printf("Maximum timeouts: %d \n", maxtimeouts); } -void +static void intr(int dummy __unused) { @@ -566,7 +680,7 @@ intr(int dummy __unused) longjmp(toplevel, -1); } -char * +static char * tail(char *filename) { char *s; @@ -583,7 +697,7 @@ tail(char *filename) } static const char * -command_prompt(void) +command_prompt() { return ("tftp> "); @@ -602,6 +716,7 @@ command(void) const char *bp; char *cp; int len, num, vrbose; + char line[MAXLINE]; vrbose = isatty(0); if (vrbose) { @@ -623,6 +738,7 @@ command(void) line[len] = '\0'; history(hist, &he, H_ENTER, bp); } else { + line[0] = 0; if (fgets(line, sizeof line , stdin) == 0) { if (feof(stdin)) { exit(txrx_error); @@ -635,7 +751,7 @@ command(void) *cp = '\0'; if (line[0] == 0) continue; - makeargv(); + makeargv(line); if (margc == 0) continue; c = getcmd(margv[0]); @@ -651,7 +767,7 @@ command(void) } } -struct cmd * +static struct cmd * getcmd(char *name) { const char *p, *q; @@ -683,15 +799,15 @@ getcmd(char *name) * Slice a string up into argc/argv. */ static void -makeargv(void) +makeargv(char *line) { char *cp; char **argp = margv; margc = 0; - if ((cp = strchr(line, '\n'))) + if ((cp = strchr(line, '\n')) != NULL) *cp = '\0'; - for (cp = line; margc < MAX_MARGV - 1 && *cp;) { + for (cp = line; margc < MAX_MARGV - 1 && *cp != '\0';) { while (isspace(*cp)) cp++; if (*cp == '\0') @@ -707,16 +823,17 @@ makeargv(void) *argp++ = 0; } -void +static void quit(int argc __unused, char *argv[] __unused) { + exit(txrx_error); } /* * Help command. */ -void +static void help(int argc, char *argv[]) { struct cmd *c; @@ -725,6 +842,10 @@ help(int argc, char *argv[]) printf("Commands may be abbreviated. Commands are:\n\n"); for (c = cmdtab; c->name; c++) printf("%-*s\t%s\n", (int)HELPINDENT, c->name, c->help); + + printf("\n[-] : You shouldn't use these ones anymore.\n"); + printf("[*] : RFC2834 options support required.\n"); + printf("[**] : Non-standard RFC2834 option.\n"); return; } while (--argc > 0) { @@ -732,24 +853,211 @@ help(int argc, char *argv[]) arg = *++argv; c = getcmd(arg); if (c == (struct cmd *)-1) - printf("?Ambiguous help command %s\n", arg); + printf("?Ambiguous help command: %s\n", arg); else if (c == (struct cmd *)0) - printf("?Invalid help command %s\n", arg); + printf("?Invalid help command: %s\n", arg); else printf("%s\n", c->help); } } -void -settrace(int argc __unused, char **argv __unused) +static void +setverbose(int argc __unused, char *argv[] __unused) { - trace = !trace; - printf("Packet tracing %s.\n", trace ? "on" : "off"); -} -void -setverbose(int argc __unused, char **argv __unused) -{ verbose = !verbose; printf("Verbose mode %s.\n", verbose ? "on" : "off"); } + +static void +setoptions(int argc, char *argv[]) +{ + + if (argc == 2) { + if (strcasecmp(argv[1], "enable") == 0 || + strcasecmp(argv[1], "on") == 0) { + options_extra_enabled = 1; + options_rfc_enabled = 1; + } + if (strcasecmp(argv[1], "disable") == 0 || + strcasecmp(argv[1], "off") == 0) { + options_extra_enabled = 0; + options_rfc_enabled = 0; + } + if (strcasecmp(argv[1], "extra") == 0) + options_extra_enabled = !options_extra_enabled; + } + printf("Support for RFC2347 style options are now %s.\n", + options_rfc_enabled ? "enabled" : "disabled"); + printf("Support for non-RFC defined options are now %s.\n", + options_extra_enabled ? "enabled" : "disabled"); + + printf("\nThe following options are available:\n" + "\toptions on : enable support for RFC2347 style options\n" + "\toptions off : disable support for RFC2347 style options\n" + "\toptions extra : toggle support for non-RFC defined options\n" + ); +} + +static void +setrollover(int argc, char *argv[]) +{ + + if (argc == 2) { + if (strcasecmp(argv[1], "never") == 0 || + strcasecmp(argv[1], "none") == 0) { + free(options[OPT_ROLLOVER].o_request); + options[OPT_ROLLOVER].o_request = NULL; + } + if (strcasecmp(argv[1], "1") == 0) { + free(options[OPT_ROLLOVER].o_request); + options[OPT_ROLLOVER].o_request = strdup("1"); + } + if (strcasecmp(argv[1], "0") == 0) { + free(options[OPT_ROLLOVER].o_request); + options[OPT_ROLLOVER].o_request = strdup("0"); + } + } + printf("Support for the rollover options is %s.\n", + options[OPT_ROLLOVER].o_request != NULL ? "enabled" : "disabled"); + if (options[OPT_ROLLOVER].o_request != NULL) + printf("Block rollover will be to block %s.\n", + options[OPT_ROLLOVER].o_request); + + + printf("\nThe following rollover options are available:\n" + "\trollover 0 : rollover to block zero (default)\n" + "\trollover 1 : rollover to block one\n" + "\trollover never : do not support the rollover option\n" + "\trollover none : do not support the rollover option\n" + ); +} + +static void +setdebug(int argc, char *argv[]) +{ + int i; + + if (argc != 1) { + i = 1; + while (i < argc) + debug ^= debug_find(argv[i++]); + } + printf("The following debugging is enabled: %s\n", debug_show(debug)); + + printf("\nThe following debugs are available:\n"); + i = 0; + while (debugs[i].name != NULL) { + printf("\t%s\t%s\n", debugs[i].name, debugs[i].desc); + i++; + } +} + +static void +setblocksize(int argc, char *argv[]) +{ + + if (!options_rfc_enabled) + printf("RFC2347 style options are not enabled " + "(but proceding anyway)\n"); + + if (argc != 1) { + int size = atoi(argv[1]); + size_t max; + char maxbuffer[100]; + int *maxdgram; + + max = sizeof(maxbuffer); + if (sysctlbyname("net.inet.udp.maxdgram", + maxbuffer, &max, NULL, 0) < 0) { + perror("sysctl: net.inet.udp.maxdgram"); + return; + } + maxdgram = (int *)maxbuffer; + + if (size < BLKSIZE_MIN || size > BLKSIZE_MAX) { + printf("Blocksize should be between %d and %d bytes.\n", + BLKSIZE_MIN, BLKSIZE_MAX); + return; + } else if (size > *maxdgram - 4) { + printf("Blocksize can't be bigger than %d bytes due " + "to the net.inet.udp.maxdgram sysctl limitation.\n", + *maxdgram - 4); + asprintf(&options[OPT_BLKSIZE].o_request, + "%d", *maxdgram - 4); + } else { + asprintf(&options[OPT_BLKSIZE].o_request, "%d", size); + } + } + printf("Blocksize is now %s bytes.\n", options[OPT_BLKSIZE].o_request); +} + +static void +setblocksize2(int argc, char *argv[]) +{ + + if (!options_rfc_enabled || !options_extra_enabled) + printf( + "RFC2347 style or non-RFC defined options are not enabled " + "(but proceding anyway)\n"); + + if (argc != 1) { + int size = atoi(argv[1]); + int i; + size_t max; + char maxbuffer[100]; + int *maxdgram; + + int sizes[] = { + 8, 16, 32, 64, 128, 256, 512, 1024, + 2048, 4096, 8192, 16384, 32768, 0 + }; + + max = sizeof(maxbuffer); + if (sysctlbyname("net.inet.udp.maxdgram", + maxbuffer, &max, NULL, 0) < 0) { + perror("sysctl: net.inet.udp.maxdgram"); + return; + } + maxdgram = (int *)maxbuffer; + + for (i = 0; sizes[i] != 0; i++) { + if (sizes[i] == size) break; + } + if (sizes[i] == 0) { + printf("Blocksize2 should be a power of two between " + "8 and 32768.\n"); + return; + } + + if (size < BLKSIZE_MIN || size > BLKSIZE_MAX) { + printf("Blocksize2 should be between " *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 21:54:16 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5885A1065679; Wed, 22 Sep 2010 21:54:16 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 46B0F8FC1D; Wed, 22 Sep 2010 21:54:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MLsGi3045103; Wed, 22 Sep 2010 21:54:16 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MLsGtr045099; Wed, 22 Sep 2010 21:54:16 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009222154.o8MLsGtr045099@svn.freebsd.org> From: Marius Strobl Date: Wed, 22 Sep 2010 21:54:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213037 - stable/7/usr.bin/tftp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 21:54:16 -0000 Author: marius Date: Wed Sep 22 21:54:16 2010 New Revision: 213037 URL: http://svn.freebsd.org/changeset/base/213037 Log: MFC: r207607, r207621, r209112, r209550, r209551 Go ahead and merge the work edwin@ on tftpd into the tree. It is a lot better than what's in the tree now. Edwin tested it at a prior employer, but can't test it today. I've found that it works a lot better with the various uboot versions that I've used in my embedded work. Here's the pkg-descr from the port that describes the changes: It all started when we got some new routers, which told me the following when trying to upload configuration or download images from it: The TFTP server doesn't support the blocksize option. My curiousity was triggered, it took me some reading of RFCs and other documentation to find out what was possible and what could be done. Was plain TFTP very simple in its handshake, TFTP with options was kind of messy because of its backwards capability: The first packet returned could either be an acknowledgement of options, or the first data packet. Going through the source code of src/libexec/tftpd and going through the code of src/usr.bin/tftp showed that there was a lot of duplicate code, and the addition of options would only increase the amount of duplicate code. After all, both the client and the server can act as a sender and receiver. At the end, it ended up with a nearly complete rewrite of the tftp client and server. It has been tested against the following TFTP clients and servers: - Itself (yay!) - The standard FreeBSD tftp client and server - The Fedora Core 6 tftp client and server - Cisco router tftp client - Extreme Networks tftp client It supports the following RFCs: RFC1350 - THE TFTP PROTOCOL (REVISION 2) RFC2347 - TFTP Option Extension RFC2348 - TFTP Blocksize Option RFC2349 - TFTP Timeout Interval and Transfer Size Options RFC3617 - Uniform Resource Identifier (URI) Scheme and Applicability Statement for the Trivial File Transfer Protocol (TFTP) It supports the following unofficial TFTP Options as described at http://www.compuphase.com/tftp.htm: blksize2 - Block size restricted to powers of 2, excluding protocol headers rollover - Block counter roll-over (roll back to zero or to one) From the tftp program point of view the following things are changed: - New commands: "blocksize", "blocksize2", "rollover" and "options" - Development features: "debug" and "packetdrop" If you try this tftp/tftpd implementation, please let me know if it works (or doesn't work) and against which implementaion so I can get a list of confirmed working systems. Author: Edwin Groothuis Added: stable/7/usr.bin/tftp/tftp.h - copied unchanged from r207621, head/usr.bin/tftp/tftp.h Deleted: stable/7/usr.bin/tftp/extern.h stable/7/usr.bin/tftp/tftpsubs.c stable/7/usr.bin/tftp/tftpsubs.h Modified: stable/7/usr.bin/tftp/Makefile stable/7/usr.bin/tftp/main.c stable/7/usr.bin/tftp/tftp.1 stable/7/usr.bin/tftp/tftp.c Directory Properties: stable/7/usr.bin/tftp/ (props changed) Modified: stable/7/usr.bin/tftp/Makefile ============================================================================== --- stable/7/usr.bin/tftp/Makefile Wed Sep 22 21:54:13 2010 (r213036) +++ stable/7/usr.bin/tftp/Makefile Wed Sep 22 21:54:16 2010 (r213037) @@ -1,9 +1,13 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 # $FreeBSD$ +CFLAGS=-g -Wall +WARNS= 3 PROG= tftp -SRCS= main.c tftp.c tftpsubs.c +SRCS= main.c tftp.c tftp-utils.c tftp-io.c tftp-file.c tftp-transfer.c tftp-options.c DPADD= ${LIBEDIT} ${LIBTERMCAP} LDADD= -ledit -ltermcap +CFLAGS+=-I${.CURDIR}/../../libexec/tftpd -I${.CURDIR}/../../usr.bin/tftp +.PATH: ${.CURDIR}/../../libexec/tftpd .include Modified: stable/7/usr.bin/tftp/main.c ============================================================================== --- stable/7/usr.bin/tftp/main.c Wed Sep 22 21:54:13 2010 (r213036) +++ stable/7/usr.bin/tftp/main.c Wed Sep 22 21:54:16 2010 (r213037) @@ -54,12 +54,14 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include #include - #include +#include #include #include @@ -72,119 +74,212 @@ __FBSDID("$FreeBSD$"); #include #include -#include "extern.h" +#include "tftp-utils.h" +#include "tftp-io.h" +#include "tftp-options.h" +#include "tftp.h" #define MAXLINE 200 #define TIMEOUT 5 /* secs between rexmt's */ -struct sockaddr_storage peeraddr; -int f; -int trace; -int verbose; -int connected; -char mode[32]; -char line[MAXLINE]; -int margc; +static struct sockaddr_storage peeraddr; +static int connected; +static char mode[32]; +jmp_buf toplevel; +volatile int txrx_error; +static int peer; + #define MAX_MARGV 20 -char *margv[MAX_MARGV]; -jmp_buf toplevel; -volatile int txrx_error; - -void get(int, char **); -void help(int, char **); -void intr(int); -void modecmd(int, char **); -void put(int, char **); -void quit(int, char **); -void setascii(int, char **); -void setbinary(int, char **); -void setpeer0(char *, const char *); -void setpeer(int, char **); -void setrexmt(int, char **); -void settimeout(int, char **); -void settrace(int, char **); -void setverbose(int, char **); -void status(int, char **); +static int margc; +static char *margv[MAX_MARGV]; + +int verbose; +char *port = NULL; + +static void get(int, char **); +static void help(int, char **); +static void intr(int); +static void modecmd(int, char **); +static void put(int, char **); +static void quit(int, char **); +static void setascii(int, char **); +static void setbinary(int, char **); +static void setpeer0(char *, const char *); +static void setpeer(int, char **); +static void settimeoutpacket(int, char **); +static void settimeoutnetwork(int, char **); +static void setdebug(int, char **); +static void setverbose(int, char **); +static void showstatus(int, char **); +static void setblocksize(int, char **); +static void setblocksize2(int, char **); +static void setoptions(int, char **); +static void setrollover(int, char **); +static void setpacketdrop(int, char **); static void command(void) __dead2; static const char *command_prompt(void); -static void getusage(const char *); -static void makeargv(void); -static void putusage(const char *); +static void urihandling(char *URI); +static void getusage(char *); +static void makeargv(char *line); +static void putusage(char *); static void settftpmode(const char *); -char *tail(char *); -struct cmd *getcmd(char *); +static char *tail(char *); +static struct cmd *getcmd(char *); #define HELPINDENT (sizeof("connect")) struct cmd { const char *name; - char *help; void (*handler)(int, char **); + const char *help; }; -char vhelp[] = "toggle verbose mode"; -char thelp[] = "toggle packet tracing"; -char chelp[] = "connect to remote tftp"; -char qhelp[] = "exit tftp"; -char hhelp[] = "print help information"; -char shelp[] = "send file"; -char rhelp[] = "receive file"; -char mhelp[] = "set file transfer mode"; -char sthelp[] = "show current status"; -char xhelp[] = "set per-packet retransmission timeout"; -char ihelp[] = "set total retransmission timeout"; -char ashelp[] = "set mode to netascii"; -char bnhelp[] = "set mode to octet"; - -struct cmd cmdtab[] = { - { "connect", chelp, setpeer }, - { "mode", mhelp, modecmd }, - { "put", shelp, put }, - { "get", rhelp, get }, - { "quit", qhelp, quit }, - { "verbose", vhelp, setverbose }, - { "trace", thelp, settrace }, - { "status", sthelp, status }, - { "binary", bnhelp, setbinary }, - { "ascii", ashelp, setascii }, - { "rexmt", xhelp, setrexmt }, - { "timeout", ihelp, settimeout }, - { "?", hhelp, help }, - { NULL, NULL, NULL } +static struct cmd cmdtab[] = { + { "connect", setpeer, "connect to remote tftp" }, + { "mode", modecmd, "set file transfer mode" }, + { "put", put, "send file" }, + { "get", get, "receive file" }, + { "quit", quit, "exit tftp" }, + { "verbose", setverbose, "toggle verbose mode" }, + { "status", showstatus, "show current status" }, + { "binary", setbinary, "set mode to octet" }, + { "ascii", setascii, "set mode to netascii" }, + { "rexmt", settimeoutpacket, + "set per-packet retransmission timeout[-]" }, + { "timeout", settimeoutnetwork, + "set total retransmission timeout" }, + { "trace", setdebug, "enable 'debug packet'[-]" }, + { "debug", setdebug, "enable verbose output" }, + { "blocksize", setblocksize, "set blocksize[*]" }, + { "blocksize2", setblocksize2, "set blocksize as a power of 2[**]" }, + { "rollover", setrollover, "rollover after 64K packets[**]" }, + { "options", setoptions, + "enable or disable RFC2347 style options" }, + { "help", help, "print help information" }, + { "packetdrop", setpacketdrop, "artifical packetloss feature" }, + { "?", help, "print help information" }, + { NULL, NULL, NULL } +}; + +static struct modes { + const char *m_name; + const char *m_mode; +} modes[] = { + { "ascii", "netascii" }, + { "netascii", "netascii" }, + { "binary", "octet" }, + { "image", "octet" }, + { "octet", "octet" }, + { NULL, NULL } }; int main(int argc, char *argv[]) { - f = -1; + + acting_as_client = 1; + peer = -1; strcpy(mode, "netascii"); signal(SIGINT, intr); if (argc > 1) { if (setjmp(toplevel) != 0) exit(txrx_error); + + if (strncmp(argv[1], "tftp://", 7) == 0) { + urihandling(argv[1]); + exit(txrx_error); + } + setpeer(argc, argv); } if (setjmp(toplevel) != 0) (void)putchar('\n'); + + init_options(); command(); } -char hostname[MAXHOSTNAMELEN]; +/* + * RFC3617 handling of TFTP URIs: + * + * tftpURI = "tftp://" host "/" file [ mode ] + * mode = ";" "mode=" ( "netascii" / "octet" ) + * file = *( unreserved / escaped ) + * host = + * unreserved = + * escaped = + * + * We are cheating a little bit by allowing any mode as specified in the + * modes table defined earlier on in this file and mapping it on the real + * mode. + */ +static void +urihandling(char *URI) +{ + char uri[ARG_MAX]; + char *host = NULL; + char *path = NULL; + char *options = NULL; + char *mode = "octet"; + char *s; + char line[MAXLINE]; + int i; + + strncpy(uri, URI, ARG_MAX); + host = uri + 7; + + if ((s = strchr(host, '/')) == NULL) { + fprintf(stderr, + "Invalid URI: Couldn't find / after hostname\n"); + exit(1); + } + *s = '\0'; + path = s + 1; + + if ((s = strchr(path, ';')) != NULL) { + *s = '\0'; + options = s + 1; + + if (strncmp(options, "mode=", 5) == 0) { + mode = options; + mode += 5; + + for (i = 0; modes[i].m_name != NULL; i++) { + if (strcmp(modes[i].m_name, mode) == 0) + break; + } + if (modes[i].m_name == NULL) { + fprintf(stderr, "Invalid mode: '%s'\n", mode); + exit(1); + } + settftpmode(modes[i].m_mode); + } + } else { + settftpmode("octet"); + } + + setpeer0(host, NULL); + + sprintf(line, "get %s", path); + makeargv(line); + get(margc, margv); +} + +static char hostname[MAXHOSTNAMELEN]; -void -setpeer0(char *host, const char *port) +static void +setpeer0(char *host, const char *lport) { struct addrinfo hints, *res0, *res; int error; - struct sockaddr_storage ss; const char *cause = "unknown"; if (connected) { - close(f); - f = -1; + close(peer); + peer = -1; } connected = 0; @@ -193,9 +288,9 @@ setpeer0(char *host, const char *port) hints.ai_socktype = SOCK_DGRAM; hints.ai_protocol = IPPROTO_UDP; hints.ai_flags = AI_CANONNAME; - if (!port) - port = "tftp"; - error = getaddrinfo(host, port, &hints, &res0); + if (!lport) + lport = "tftp"; + error = getaddrinfo(host, lport, &hints, &res0); if (error) { warnx("%s", gai_strerror(error)); return; @@ -204,50 +299,53 @@ setpeer0(char *host, const char *port) for (res = res0; res; res = res->ai_next) { if (res->ai_addrlen > sizeof(peeraddr)) continue; - f = socket(res->ai_family, res->ai_socktype, res->ai_protocol); - if (f < 0) { + peer = socket(res->ai_family, res->ai_socktype, + res->ai_protocol); + if (peer < 0) { cause = "socket"; continue; } - memset(&ss, 0, sizeof(ss)); - ss.ss_family = res->ai_family; - ss.ss_len = res->ai_addrlen; - if (bind(f, (struct sockaddr *)&ss, ss.ss_len) < 0) { + memset(&peer_sock, 0, sizeof(peer_sock)); + peer_sock.ss_family = res->ai_family; + peer_sock.ss_len = res->ai_addrlen; + if (bind(peer, (struct sockaddr *)&peer_sock, peer_sock.ss_len) < 0) { cause = "bind"; - close(f); - f = -1; + close(peer); + peer = -1; continue; } break; } - if (f < 0) + if (peer < 0) warn("%s", cause); else { /* res->ai_addr <= sizeof(peeraddr) is guaranteed */ - memcpy(&peeraddr, res->ai_addr, res->ai_addrlen); + memcpy(&peer_sock, res->ai_addr, res->ai_addrlen); if (res->ai_canonname) { - (void) strlcpy(hostname, res->ai_canonname, + (void) strncpy(hostname, res->ai_canonname, sizeof(hostname)); } else - (void) strlcpy(hostname, host, sizeof(hostname)); + (void) strncpy(hostname, host, sizeof(hostname)); + hostname[sizeof(hostname)-1] = 0; connected = 1; } freeaddrinfo(res0); } -void +static void setpeer(int argc, char *argv[]) { + char line[MAXLINE]; if (argc < 2) { strcpy(line, "Connect "); printf("(to) "); fgets(&line[strlen(line)], sizeof line - strlen(line), stdin); - makeargv(); + makeargv(line); argc = margc; argv = margv; } @@ -255,26 +353,14 @@ setpeer(int argc, char *argv[]) printf("usage: %s [host [port]]\n", argv[0]); return; } - if (argc == 3) + if (argc == 3) { + port = argv[2]; setpeer0(argv[1], argv[2]); - else + } else setpeer0(argv[1], NULL); } -struct modes { - const char *m_name; - const char *m_mode; -} modes[] = { - { "ascii", "netascii" }, - { "netascii", "netascii" }, - { "binary", "octet" }, - { "image", "octet" }, - { "octet", "octet" }, -/* { "mail", "mail" }, */ - { 0, 0 } -}; - -void +static void modecmd(int argc, char *argv[]) { struct modes *p; @@ -298,7 +384,7 @@ modecmd(int argc, char *argv[]) printf("usage: %s [", argv[0]); sep = " "; - for (p = modes; p->m_name; p++) { + for (p = modes; p->m_name != NULL; p++) { printf("%s%s", sep, p->m_name); if (*sep == ' ') sep = " | "; @@ -307,14 +393,14 @@ modecmd(int argc, char *argv[]) return; } -void +static void setbinary(int argc __unused, char *argv[] __unused) { settftpmode("octet"); } -void +static void setascii(int argc __unused, char *argv[] __unused) { @@ -324,6 +410,7 @@ setascii(int argc __unused, char *argv[] static void settftpmode(const char *newmode) { + strcpy(mode, newmode); if (verbose) printf("mode set to %s\n", mode); @@ -333,18 +420,20 @@ settftpmode(const char *newmode) /* * Send file(s). */ -void +static void put(int argc, char *argv[]) { - int fd; - int n; - char *cp, *targ; + int fd; + int n; + char *cp, *targ; + char line[MAXLINE]; + struct stat sb; if (argc < 2) { strcpy(line, "send "); printf("(file) "); fgets(&line[strlen(line)], sizeof line - strlen(line), stdin); - makeargv(); + makeargv(line); argc = margc; argv = margv; } @@ -381,10 +470,14 @@ put(int argc, char *argv[]) warn("%s", cp); return; } + + stat(cp, &sb); + asprintf(&options[OPT_TSIZE].o_request, "%ju", sb.st_size); + if (verbose) printf("putting %s to %s:%s [%s]\n", - cp, hostname, targ, mode); - xmitfile(fd, targ, mode); + cp, hostname, targ, mode); + xmitfile(peer, port, fd, targ, mode); return; } /* this assumes the target is a directory */ @@ -398,36 +491,43 @@ put(int argc, char *argv[]) warn("%s", argv[n]); continue; } + + stat(cp, &sb); + asprintf(&options[OPT_TSIZE].o_request, "%ju", sb.st_size); + if (verbose) printf("putting %s to %s:%s [%s]\n", - argv[n], hostname, targ, mode); - xmitfile(fd, targ, mode); + argv[n], hostname, targ, mode); + xmitfile(peer, port, fd, targ, mode); } } static void -putusage(const char *s) +putusage(char *s) { - printf("usage: %s file [[host:]remotename]\n", s); + + printf("usage: %s file [remotename]\n", s); + printf(" %s file host:remotename\n", s); printf(" %s file1 file2 ... fileN [[host:]remote-directory]\n", s); } /* * Receive file(s). */ -void +static void get(int argc, char *argv[]) { int fd; int n; char *cp; char *src; + char line[MAXLINE]; if (argc < 2) { strcpy(line, "get "); printf("(files) "); fgets(&line[strlen(line)], sizeof line - strlen(line), stdin); - makeargv(); + makeargv(line); argc = margc; argv = margv; } @@ -438,6 +538,8 @@ get(int argc, char *argv[]) if (!connected) { for (n = 1; n < argc ; n++) if (rindex(argv[n], ':') == 0) { + printf("No remote host specified and " + "no host given for file '%s'\n", argv[n]); getusage(argv[0]); return; } @@ -468,8 +570,8 @@ get(int argc, char *argv[]) } if (verbose) printf("getting from %s:%s to %s [%s]\n", - hostname, src, cp, mode); - recvfile(fd, src, mode); + hostname, src, cp, mode); + recvfile(peer, port, fd, src, mode); break; } cp = tail(src); /* new .. jdg */ @@ -480,30 +582,31 @@ get(int argc, char *argv[]) } if (verbose) printf("getting from %s:%s to %s [%s]\n", - hostname, src, cp, mode); - recvfile(fd, src, mode); + hostname, src, cp, mode); + recvfile(peer, port, fd, src, mode); } } static void -getusage(const char *s) +getusage(char *s) { - printf("usage: %s [host:]file [localname]\n", s); + + printf("usage: %s file [localname]\n", s); + printf(" %s [host:]file [localname]\n", s); printf(" %s [host1:]file1 [host2:]file2 ... [hostN:]fileN\n", s); } -int rexmtval = TIMEOUT; - -void -setrexmt(int argc, char *argv[]) +static void +settimeoutpacket(int argc, char *argv[]) { int t; + char line[MAXLINE]; if (argc < 2) { - strcpy(line, "Rexmt-timeout "); + strcpy(line, "Packet timeout "); printf("(value) "); fgets(&line[strlen(line)], sizeof line - strlen(line), stdin); - makeargv(); + makeargv(line); argc = margc; argv = margv; } @@ -512,24 +615,25 @@ setrexmt(int argc, char *argv[]) return; } t = atoi(argv[1]); - if (t < 0) + if (t < 0) { printf("%s: bad value\n", argv[1]); - else - rexmtval = t; -} + return; + } -int maxtimeout = 5 * TIMEOUT; + settimeouts(t, timeoutnetwork, maxtimeouts); +} -void -settimeout(int argc, char *argv[]) +static void +settimeoutnetwork(int argc, char *argv[]) { int t; + char line[MAXLINE]; if (argc < 2) { - strcpy(line, "Maximum-timeout "); + strcpy(line, "Network timeout "); printf("(value) "); fgets(&line[strlen(line)], sizeof line - strlen(line), stdin); - makeargv(); + makeargv(line); argc = margc; argv = margv; } @@ -538,26 +642,36 @@ settimeout(int argc, char *argv[]) return; } t = atoi(argv[1]); - if (t < 0) + if (t < 0) { printf("%s: bad value\n", argv[1]); - else - maxtimeout = t; + return; + } + + settimeouts(timeoutpacket, t, maxtimeouts); } -void -status(int argc __unused, char *argv[] __unused) +static void +showstatus(int argc __unused, char *argv[] __unused) { - if (connected) - printf("Connected to %s.\n", hostname); - else - printf("Not connected.\n"); - printf("Mode: %s Verbose: %s Tracing: %s\n", mode, - verbose ? "on" : "off", trace ? "on" : "off"); - printf("Rexmt-interval: %d seconds, Max-timeout: %d seconds\n", - rexmtval, maxtimeout); + + printf("Remote host: %s\n", + connected ? hostname : "none specified yet"); + printf("RFC2347 Options support: %s\n", + options_rfc_enabled ? "enabled" : "disabled"); + printf("Non-RFC defined options support: %s\n", + options_extra_enabled ? "enabled" : "disabled"); + printf("Mode: %s\n", mode); + printf("Verbose: %s\n", verbose ? "on" : "off"); + printf("Debug: %s\n", debug_show(debug)); + printf("Artificial packetloss: %d in 100 packets\n", + packetdroppercentage); + printf("Segment size: %d bytes\n", segsize); + printf("Network timeout: %d seconds\n", timeoutpacket); + printf("Maximum network timeout: %d seconds\n", timeoutnetwork); + printf("Maximum timeouts: %d \n", maxtimeouts); } -void +static void intr(int dummy __unused) { @@ -566,7 +680,7 @@ intr(int dummy __unused) longjmp(toplevel, -1); } -char * +static char * tail(char *filename) { char *s; @@ -583,7 +697,7 @@ tail(char *filename) } static const char * -command_prompt(void) +command_prompt() { return ("tftp> "); @@ -602,6 +716,7 @@ command(void) const char *bp; char *cp; int len, num, vrbose; + char line[MAXLINE]; vrbose = isatty(0); if (vrbose) { @@ -623,6 +738,7 @@ command(void) line[len] = '\0'; history(hist, &he, H_ENTER, bp); } else { + line[0] = 0; if (fgets(line, sizeof line , stdin) == 0) { if (feof(stdin)) { exit(txrx_error); @@ -635,7 +751,7 @@ command(void) *cp = '\0'; if (line[0] == 0) continue; - makeargv(); + makeargv(line); if (margc == 0) continue; c = getcmd(margv[0]); @@ -651,7 +767,7 @@ command(void) } } -struct cmd * +static struct cmd * getcmd(char *name) { const char *p, *q; @@ -683,15 +799,15 @@ getcmd(char *name) * Slice a string up into argc/argv. */ static void -makeargv(void) +makeargv(char *line) { char *cp; char **argp = margv; margc = 0; - if ((cp = strchr(line, '\n'))) + if ((cp = strchr(line, '\n')) != NULL) *cp = '\0'; - for (cp = line; margc < MAX_MARGV - 1 && *cp;) { + for (cp = line; margc < MAX_MARGV - 1 && *cp != '\0';) { while (isspace(*cp)) cp++; if (*cp == '\0') @@ -707,16 +823,17 @@ makeargv(void) *argp++ = 0; } -void +static void quit(int argc __unused, char *argv[] __unused) { + exit(txrx_error); } /* * Help command. */ -void +static void help(int argc, char *argv[]) { struct cmd *c; @@ -725,6 +842,10 @@ help(int argc, char *argv[]) printf("Commands may be abbreviated. Commands are:\n\n"); for (c = cmdtab; c->name; c++) printf("%-*s\t%s\n", (int)HELPINDENT, c->name, c->help); + + printf("\n[-] : You shouldn't use these ones anymore.\n"); + printf("[*] : RFC2834 options support required.\n"); + printf("[**] : Non-standard RFC2834 option.\n"); return; } while (--argc > 0) { @@ -732,24 +853,211 @@ help(int argc, char *argv[]) arg = *++argv; c = getcmd(arg); if (c == (struct cmd *)-1) - printf("?Ambiguous help command %s\n", arg); + printf("?Ambiguous help command: %s\n", arg); else if (c == (struct cmd *)0) - printf("?Invalid help command %s\n", arg); + printf("?Invalid help command: %s\n", arg); else printf("%s\n", c->help); } } -void -settrace(int argc __unused, char **argv __unused) +static void +setverbose(int argc __unused, char *argv[] __unused) { - trace = !trace; - printf("Packet tracing %s.\n", trace ? "on" : "off"); -} -void -setverbose(int argc __unused, char **argv __unused) -{ verbose = !verbose; printf("Verbose mode %s.\n", verbose ? "on" : "off"); } + +static void +setoptions(int argc, char *argv[]) +{ + + if (argc == 2) { + if (strcasecmp(argv[1], "enable") == 0 || + strcasecmp(argv[1], "on") == 0) { + options_extra_enabled = 1; + options_rfc_enabled = 1; + } + if (strcasecmp(argv[1], "disable") == 0 || + strcasecmp(argv[1], "off") == 0) { + options_extra_enabled = 0; + options_rfc_enabled = 0; + } + if (strcasecmp(argv[1], "extra") == 0) + options_extra_enabled = !options_extra_enabled; + } + printf("Support for RFC2347 style options are now %s.\n", + options_rfc_enabled ? "enabled" : "disabled"); + printf("Support for non-RFC defined options are now %s.\n", + options_extra_enabled ? "enabled" : "disabled"); + + printf("\nThe following options are available:\n" + "\toptions on : enable support for RFC2347 style options\n" + "\toptions off : disable support for RFC2347 style options\n" + "\toptions extra : toggle support for non-RFC defined options\n" + ); +} + +static void +setrollover(int argc, char *argv[]) +{ + + if (argc == 2) { + if (strcasecmp(argv[1], "never") == 0 || + strcasecmp(argv[1], "none") == 0) { + free(options[OPT_ROLLOVER].o_request); + options[OPT_ROLLOVER].o_request = NULL; + } + if (strcasecmp(argv[1], "1") == 0) { + free(options[OPT_ROLLOVER].o_request); + options[OPT_ROLLOVER].o_request = strdup("1"); + } + if (strcasecmp(argv[1], "0") == 0) { + free(options[OPT_ROLLOVER].o_request); + options[OPT_ROLLOVER].o_request = strdup("0"); + } + } + printf("Support for the rollover options is %s.\n", + options[OPT_ROLLOVER].o_request != NULL ? "enabled" : "disabled"); + if (options[OPT_ROLLOVER].o_request != NULL) + printf("Block rollover will be to block %s.\n", + options[OPT_ROLLOVER].o_request); + + + printf("\nThe following rollover options are available:\n" + "\trollover 0 : rollover to block zero (default)\n" + "\trollover 1 : rollover to block one\n" + "\trollover never : do not support the rollover option\n" + "\trollover none : do not support the rollover option\n" + ); +} + +static void +setdebug(int argc, char *argv[]) +{ + int i; + + if (argc != 1) { + i = 1; + while (i < argc) + debug ^= debug_find(argv[i++]); + } + printf("The following debugging is enabled: %s\n", debug_show(debug)); + + printf("\nThe following debugs are available:\n"); + i = 0; + while (debugs[i].name != NULL) { + printf("\t%s\t%s\n", debugs[i].name, debugs[i].desc); + i++; + } +} + +static void +setblocksize(int argc, char *argv[]) +{ + + if (!options_rfc_enabled) + printf("RFC2347 style options are not enabled " + "(but proceding anyway)\n"); + + if (argc != 1) { + int size = atoi(argv[1]); + size_t max; + char maxbuffer[100]; + int *maxdgram; + + max = sizeof(maxbuffer); + if (sysctlbyname("net.inet.udp.maxdgram", + maxbuffer, &max, NULL, 0) < 0) { + perror("sysctl: net.inet.udp.maxdgram"); + return; + } + maxdgram = (int *)maxbuffer; + + if (size < BLKSIZE_MIN || size > BLKSIZE_MAX) { + printf("Blocksize should be between %d and %d bytes.\n", + BLKSIZE_MIN, BLKSIZE_MAX); + return; + } else if (size > *maxdgram - 4) { + printf("Blocksize can't be bigger than %d bytes due " + "to the net.inet.udp.maxdgram sysctl limitation.\n", + *maxdgram - 4); + asprintf(&options[OPT_BLKSIZE].o_request, + "%d", *maxdgram - 4); + } else { + asprintf(&options[OPT_BLKSIZE].o_request, "%d", size); + } + } + printf("Blocksize is now %s bytes.\n", options[OPT_BLKSIZE].o_request); +} + +static void +setblocksize2(int argc, char *argv[]) +{ + + if (!options_rfc_enabled || !options_extra_enabled) + printf( + "RFC2347 style or non-RFC defined options are not enabled " + "(but proceding anyway)\n"); + + if (argc != 1) { + int size = atoi(argv[1]); + int i; + size_t max; + char maxbuffer[100]; + int *maxdgram; + + int sizes[] = { + 8, 16, 32, 64, 128, 256, 512, 1024, + 2048, 4096, 8192, 16384, 32768, 0 + }; + + max = sizeof(maxbuffer); + if (sysctlbyname("net.inet.udp.maxdgram", + maxbuffer, &max, NULL, 0) < 0) { + perror("sysctl: net.inet.udp.maxdgram"); + return; + } + maxdgram = (int *)maxbuffer; + + for (i = 0; sizes[i] != 0; i++) { + if (sizes[i] == size) break; + } + if (sizes[i] == 0) { + printf("Blocksize2 should be a power of two between " + "8 and 32768.\n"); + return; + } + + if (size < BLKSIZE_MIN || size > BLKSIZE_MAX) { + printf("Blocksize2 should be between " *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 21:54:30 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A83D10657A2; Wed, 22 Sep 2010 21:54:30 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 580B68FC27; Wed, 22 Sep 2010 21:54:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MLsUCv045154; Wed, 22 Sep 2010 21:54:30 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MLsUd2045144; Wed, 22 Sep 2010 21:54:30 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009222154.o8MLsUd2045144@svn.freebsd.org> From: Marius Strobl Date: Wed, 22 Sep 2010 21:54:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213038 - stable/8/libexec/tftpd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 21:54:30 -0000 Author: marius Date: Wed Sep 22 21:54:30 2010 New Revision: 213038 URL: http://svn.freebsd.org/changeset/base/213038 Log: MFC: r207608, r207614, r212651, r212665 Go ahead and merge the work edwin@ on tftpd into the tree. It is a lot better than what's in the tree now. Edwin tested it at a prior employer, but can't test it today. I've found that it works a lot better with the various uboot versions that I've used in my embedded work. Here's the pkg-descr from the port that describes the changes: It all started when we got some new routers, which told me the following when trying to upload configuration or download images from it: The TFTP server doesn't support the blocksize option. My curiousity was triggered, it took me some reading of RFCs and other documentation to find out what was possible and what could be done. Was plain TFTP very simple in its handshake, TFTP with options was kind of messy because of its backwards capability: The first packet returned could either be an acknowledgement of options, or the first data packet. Going through the source code of src/libexec/tftpd and going through the code of src/usr.bin/tftp showed that there was a lot of duplicate code, and the addition of options would only increase the amount of duplicate code. After all, both the client and the server can act as a sender and receiver. At the end, it ended up with a nearly complete rewrite of the tftp client and server. It has been tested against the following TFTP clients and servers: - Itself (yay!) - The standard FreeBSD tftp client and server - The Fedora Core 6 tftp client and server - Cisco router tftp client - Extreme Networks tftp client It supports the following RFCs: RFC1350 - THE TFTP PROTOCOL (REVISION 2) RFC2347 - TFTP Option Extension RFC2348 - TFTP Blocksize Option RFC2349 - TFTP Timeout Interval and Transfer Size Options RFC3617 - Uniform Resource Identifier (URI) Scheme and Applicability Statement for the Trivial File Transfer Protocol (TFTP) It supports the following unofficial TFTP Options as described at http://www.compuphase.com/tftp.htm: blksize2 - Block size restricted to powers of 2, excluding protocol headers rollover - Block counter roll-over (roll back to zero or to one) From the tftp program point of view the following things are changed: - New commands: "blocksize", "blocksize2", "rollover" and "options" - Development features: "debug" and "packetdrop" If you try this tftp/tftpd implementation, please let me know if it works (or doesn't work) and against which implementaion so I can get a list of confirmed working systems. Author: Edwin Groothuis Added: stable/8/libexec/tftpd/tftp-file.c - copied unchanged from r207614, head/libexec/tftpd/tftp-file.c stable/8/libexec/tftpd/tftp-file.h - copied unchanged from r207614, head/libexec/tftpd/tftp-file.h stable/8/libexec/tftpd/tftp-io.c - copied, changed from r207614, head/libexec/tftpd/tftp-io.c stable/8/libexec/tftpd/tftp-io.h - copied unchanged from r207614, head/libexec/tftpd/tftp-io.h stable/8/libexec/tftpd/tftp-options.c - copied unchanged from r207614, head/libexec/tftpd/tftp-options.c stable/8/libexec/tftpd/tftp-options.h - copied unchanged from r207614, head/libexec/tftpd/tftp-options.h stable/8/libexec/tftpd/tftp-transfer.c - copied unchanged from r207614, head/libexec/tftpd/tftp-transfer.c stable/8/libexec/tftpd/tftp-transfer.h - copied unchanged from r207614, head/libexec/tftpd/tftp-transfer.h stable/8/libexec/tftpd/tftp-utils.c - copied unchanged from r207614, head/libexec/tftpd/tftp-utils.c stable/8/libexec/tftpd/tftp-utils.h - copied unchanged from r207614, head/libexec/tftpd/tftp-utils.h Modified: stable/8/libexec/tftpd/Makefile stable/8/libexec/tftpd/tftpd.8 stable/8/libexec/tftpd/tftpd.c Directory Properties: stable/8/libexec/tftpd/ (props changed) Modified: stable/8/libexec/tftpd/Makefile ============================================================================== --- stable/8/libexec/tftpd/Makefile Wed Sep 22 21:54:16 2010 (r213037) +++ stable/8/libexec/tftpd/Makefile Wed Sep 22 21:54:30 2010 (r213038) @@ -2,12 +2,13 @@ # $FreeBSD$ PROG= tftpd -SRCS= tftpd.c tftpsubs.c -DPADD= ${LIBUTIL} -LDADD= -lutil +SRCS= tftpd.c tftp-io.c tftp-utils.c tftp-file.c tftp-transfer.c tftp-options.c +WARNS= 3 WFORMAT=0 MAN= tftpd.8 -CFLAGS+=-I${.CURDIR}/../../usr.bin/tftp +CFLAGS+=-I${.CURDIR}/../../usr.bin/tftp -I${.CURDIR}/../../libexec/tftpd .PATH: ${.CURDIR}/../../usr.bin/tftp +COPTFLAGS = -O +LDFLAGS= -lwrap .include Copied: stable/8/libexec/tftpd/tftp-file.c (from r207614, head/libexec/tftpd/tftp-file.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/libexec/tftpd/tftp-file.c Wed Sep 22 21:54:30 2010 (r213038, copy of r207614, head/libexec/tftpd/tftp-file.c) @@ -0,0 +1,257 @@ +/* + * Copyright (C) 2008 Edwin Groothuis. 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 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 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 "tftp-file.h" +#include "tftp-utils.h" + +static FILE *file; +static int convert; + +static char convbuffer[66000]; +static int gotcr = 0; + +static size_t +convert_from_net(char *buffer, size_t count) +{ + size_t i, n; + + /* + * Convert all CR/LF to LF and all CR,NUL to CR + */ + + n = 0; + for (i = 0; i < count; i++) { + + if (gotcr == 0) { + convbuffer[n++] = buffer[i]; + gotcr = (buffer[i] == '\r'); + continue; + } + + /* CR, NULL -> CR */ + if (buffer[i] == '\0') { + gotcr = 0; + continue; + } + + /* CR, LF -> LF */ + if (buffer[i] == '\n') { + if (n == 0) { + if (ftell(file) != 0) { + fseek(file, -1, SEEK_END); + convbuffer[n++] = '\n'; + } else { + /* This shouldn't happen */ + tftp_log(LOG_ERR, + "Received LF as first character"); + abort(); + } + } else + convbuffer[n-1] = '\n'; + gotcr = 0; + continue; + } + + /* Everything else just accept as is */ + convbuffer[n++] = buffer[i]; + gotcr = (buffer[i] == '\r'); + continue; + } + + return fwrite(convbuffer, 1, n, file); +} + +static size_t +convert_to_net(char *buffer, size_t count, int init) +{ + size_t i; + static size_t n = 0, read = 0; + static int newline = 0; + + if (init) { + newline = 0; + n = 0; + read = 0; + return 0 ; + } + + /* + * Convert all LF to CR,LF and all CR to CR,NUL + */ + i = 0; + + if (newline) { + buffer[i++] = newline; + newline = 0; + } + + while (i < count) { + if (n == read) { + /* When done we're done */ + if (feof(file)) break; + + /* Otherwise read another bunch */ + read = fread(convbuffer, 1, count, file); + if (read == 0) break; + n = 0; + } + + /* CR -> CR,NULL */ + if (convbuffer[n] == '\r') { + buffer[i++] = '\r'; + buffer[i++] = '\0'; + n++; + continue; + } + + /* LF -> CR,LF */ + if (convbuffer[n] == '\n') { + buffer[i++] = '\r'; + buffer[i++] = '\n'; + n++; + continue; + } + + buffer[i++] = convbuffer[n++]; + } + + if (i > count) { + /* + * Whoops... that isn't alllowed (but it will happen + * when there is a CR or LF at the end of the buffer) + */ + newline = buffer[i-1]; + } + + if (i < count) { + /* We are done! */ + return i; + } else + return count; + +} + +int +write_init(int fd, FILE *f, const char *mode) +{ + + if (f == NULL) { + file = fdopen(fd, "w"); + if (file == NULL) { + int en = errno; + tftp_log(LOG_ERR, "fdopen() failed: %s", + strerror(errno)); + return en; + } + } else + file = f; + convert = !strcmp(mode, "netascii"); + return 0; +} + +size_t +write_file(char *buffer, int count) +{ + + if (convert == 0) + return fwrite(buffer, 1, count, file); + + return convert_from_net(buffer, count); +} + +int +write_close(void) +{ + + if (fclose(file) != 0) { + tftp_log(LOG_ERR, "fclose() failed: %s", strerror(errno)); + return 1; + } + return 0; +} + +int +read_init(int fd, FILE *f, const char *mode) +{ + + convert_to_net(NULL, 0, 1); + if (f == NULL) { + file = fdopen(fd, "r"); + if (file == NULL) { + int en = errno; + tftp_log(LOG_ERR, "fdopen() failed: %s", + strerror(errno)); + return en; + } + } else + file = f; + convert = !strcmp(mode, "netascii"); + return 0; +} + +size_t +read_file(char *buffer, int count) +{ + + if (convert == 0) + return fread(buffer, 1, count, file); + + return convert_to_net(buffer, count, 0); +} + +int +read_close(void) +{ + + if (fclose(file) != 0) { + tftp_log(LOG_ERR, "fclose() failed: %s", strerror(errno)); + return 1; + } + return 0; +} + + +int +synchnet(int peer) +{ + + return 0; +} Copied: stable/8/libexec/tftpd/tftp-file.h (from r207614, head/libexec/tftpd/tftp-file.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/libexec/tftpd/tftp-file.h Wed Sep 22 21:54:30 2010 (r213038, copy of r207614, head/libexec/tftpd/tftp-file.h) @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2008 Edwin Groothuis. 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 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 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$"); + +int write_init(int fd, FILE *f, const char *mode); +size_t write_file(char *buffer, int count); +int write_close(void); + +int read_init(int fd, FILE *f, const char *mode); +size_t read_file(char *buffer, int count); +int read_close(void); + +int synchnet(int peer); Copied and modified: stable/8/libexec/tftpd/tftp-io.c (from r207614, head/libexec/tftpd/tftp-io.c) ============================================================================== --- head/libexec/tftpd/tftp-io.c Tue May 4 13:07:40 2010 (r207614, copy source) +++ stable/8/libexec/tftpd/tftp-io.c Wed Sep 22 21:54:30 2010 (r213038) @@ -398,8 +398,6 @@ receive_packet(int peer, char *data, int int n; static int waiting; - pfrom = (from == NULL) ? &from_local : from; - if (debug&DEBUG_PACKETS) tftp_log(LOG_DEBUG, "Waiting %d seconds for packet", timeoutpacket); @@ -423,6 +421,7 @@ receive_packet(int peer, char *data, int } waiting++; + pfrom = (from == NULL) ? &from_local : from; fromlen = sizeof(*pfrom); n = recvfrom(peer, data, size, 0, (struct sockaddr *)pfrom, &fromlen); Copied: stable/8/libexec/tftpd/tftp-io.h (from r207614, head/libexec/tftpd/tftp-io.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/libexec/tftpd/tftp-io.h Wed Sep 22 21:54:30 2010 (r213038, copy of r207614, head/libexec/tftpd/tftp-io.h) @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2008 Edwin Groothuis. 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 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 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 RP_NONE 0 +#define RP_RECVFROM -1 +#define RP_TOOSMALL -2 +#define RP_ERROR -3 +#define RP_WRONGSOURCE -4 +#define RP_TIMEOUT -5 +#define RP_TOOBIG -6 + +const char *errtomsg(int); +void send_error(int peer, int); +int send_wrq(int peer, char *, char *); +int send_rrq(int peer, char *, char *); +int send_oack(int peer); +int send_ack(int peer, unsigned short); +int send_data(int peer, uint16_t, char *, int); +int receive_packet(int peer, char *, int, struct sockaddr_storage *, int); + +extern struct sockaddr_storage peer_sock; +extern struct sockaddr_storage me_sock; Copied: stable/8/libexec/tftpd/tftp-options.c (from r207614, head/libexec/tftpd/tftp-options.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/libexec/tftpd/tftp-options.c Wed Sep 22 21:54:30 2010 (r213038, copy of r207614, head/libexec/tftpd/tftp-options.c) @@ -0,0 +1,390 @@ +/* + * Copyright (C) 2008 Edwin Groothuis. 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 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 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 "tftp-utils.h" +#include "tftp-io.h" +#include "tftp-options.h" + +/* + * Option handlers + */ + +struct options options[] = { + { "tsize", NULL, NULL, NULL /* option_tsize */, 1 }, + { "timeout", NULL, NULL, option_timeout, 1 }, + { "blksize", NULL, NULL, option_blksize, 1 }, + { "blksize2", NULL, NULL, option_blksize2, 0 }, + { "rollover", NULL, NULL, option_rollover, 0 }, + { NULL, NULL, NULL, NULL, 0 } +}; + +/* By default allow them */ +int options_rfc_enabled = 1; +int options_extra_enabled = 1; + +/* + * Rules for the option handlers: + * - If there is no o_request, there will be no processing. + * + * For servers + * - Logging is done as warnings. + * - The handler exit()s if there is a serious problem with the + * values submitted in the option. + * + * For clients + * - Logging is done as errors. After all, the server shouldn't + * return rubbish. + * - The handler returns if there is a serious problem with the + * values submitted in the option. + * - Sending the EBADOP packets is done by the handler. + */ + +int +option_tsize(int peer, struct tftphdr *tp, int mode, struct stat *stbuf) +{ + + if (options[OPT_TSIZE].o_request == NULL) + return (0); + + if (mode == RRQ) + asprintf(&options[OPT_TSIZE].o_reply, + "%ju", stbuf->st_size); + else + /* XXX Allows writes of all sizes. */ + options[OPT_TSIZE].o_reply = + strdup(options[OPT_TSIZE].o_request); + return (0); +} + +int +option_timeout(int peer) +{ + + if (options[OPT_TIMEOUT].o_request == NULL) + return (0); + + int to = atoi(options[OPT_TIMEOUT].o_request); + if (to < TIMEOUT_MIN || to > TIMEOUT_MAX) { + tftp_log(acting_as_client ? LOG_ERR : LOG_WARNING, + "Received bad value for timeout. " + "Should be between %d and %d, received %s", + TIMEOUT_MIN, TIMEOUT_MAX); + send_error(peer, EBADOP); + if (acting_as_client) + return (1); + exit(1); + } else { + timeoutpacket = to; + options[OPT_TIMEOUT].o_reply = + strdup(options[OPT_TIMEOUT].o_request); + } + settimeouts(timeoutpacket, timeoutnetwork, maxtimeouts); + + if (debug&DEBUG_OPTIONS) + tftp_log(LOG_DEBUG, "Setting timeout to '%s'", + options[OPT_TIMEOUT].o_reply); + + return (0); +} + +int +option_rollover(int peer) +{ + + if (options[OPT_ROLLOVER].o_request == NULL) + return (0); + + if (strcmp(options[OPT_ROLLOVER].o_request, "0") != 0 + && strcmp(options[OPT_ROLLOVER].o_request, "1") != 0) { + tftp_log(acting_as_client ? LOG_ERR : LOG_WARNING, + "Bad value for rollover, " + "should be either 0 or 1, received '%s', " + "ignoring request", + options[OPT_ROLLOVER].o_request); + if (acting_as_client) { + send_error(peer, EBADOP); + return (1); + } + return (0); + } + options[OPT_ROLLOVER].o_reply = + strdup(options[OPT_ROLLOVER].o_request); + + if (debug&DEBUG_OPTIONS) + tftp_log(LOG_DEBUG, "Setting rollover to '%s'", + options[OPT_ROLLOVER].o_reply); + + return (0); +} + +int +option_blksize(int peer) +{ + int *maxdgram; + char maxbuffer[100]; + size_t len; + + if (options[OPT_BLKSIZE].o_request == NULL) + return (0); + + /* maximum size of an UDP packet according to the system */ + len = sizeof(maxbuffer); + if (sysctlbyname("net.inet.udp.maxdgram", + maxbuffer, &len, NULL, 0) < 0) { + tftp_log(LOG_ERR, "sysctl: net.inet.udp.maxdgram"); + return (acting_as_client ? 1 : 0); + } + maxdgram = (int *)maxbuffer; + + int size = atoi(options[OPT_BLKSIZE].o_request); + if (size < BLKSIZE_MIN || size > BLKSIZE_MAX) { + if (acting_as_client) { + tftp_log(LOG_ERR, + "Invalid blocksize (%d bytes), aborting", + size); + send_error(peer, EBADOP); + return (1); + } else { + tftp_log(LOG_WARNING, + "Invalid blocksize (%d bytes), ignoring request", + size); + return (0); + } + } + + if (size > *maxdgram) { + if (acting_as_client) { + tftp_log(LOG_ERR, + "Invalid blocksize (%d bytes), " + "net.inet.udp.maxdgram sysctl limits it to " + "%d bytes.\n", size, *maxdgram); + send_error(peer, EBADOP); + return (1); + } else { + tftp_log(LOG_WARNING, + "Invalid blocksize (%d bytes), " + "net.inet.udp.maxdgram sysctl limits it to " + "%d bytes.\n", size, *maxdgram); + size = *maxdgram; + /* No reason to return */ + } + } + + asprintf(&options[OPT_BLKSIZE].o_reply, "%d", size); + segsize = size; + pktsize = size + 4; + if (debug&DEBUG_OPTIONS) + tftp_log(LOG_DEBUG, "Setting blksize to '%s'", + options[OPT_BLKSIZE].o_reply); + + return (0); +} + +int +option_blksize2(int peer) +{ + int *maxdgram; + char maxbuffer[100]; + int size, i; + size_t len; + + int sizes[] = { + 8, 16, 32, 64, 128, 256, 512, 1024, + 2048, 4096, 8192, 16384, 32768, 0 + }; + + if (options[OPT_BLKSIZE2].o_request == NULL) + return (0); + + /* maximum size of an UDP packet according to the system */ + len = sizeof(maxbuffer); + if (sysctlbyname("net.inet.udp.maxdgram", + maxbuffer, &len, NULL, 0) < 0) { + tftp_log(LOG_ERR, "sysctl: net.inet.udp.maxdgram"); + return (acting_as_client ? 1 : 0); + } + maxdgram = (int *)maxbuffer; + + size = atoi(options[OPT_BLKSIZE2].o_request); + for (i = 0; sizes[i] != 0; i++) { + if (size == sizes[i]) break; + } + if (sizes[i] == 0) { + tftp_log(LOG_INFO, + "Invalid blocksize2 (%d bytes), ignoring request", size); + return (acting_as_client ? 1 : 0); + } + + if (size > *maxdgram) { + for (i = 0; sizes[i+1] != 0; i++) { + if (*maxdgram < sizes[i+1]) break; + } + tftp_log(LOG_INFO, + "Invalid blocksize2 (%d bytes), net.inet.udp.maxdgram " + "sysctl limits it to %d bytes.\n", size, *maxdgram); + size = sizes[i]; + /* No need to return */ + } + + asprintf(&options[OPT_BLKSIZE2].o_reply, "%d", size); + segsize = size; + pktsize = size + 4; + if (debug&DEBUG_OPTIONS) + tftp_log(LOG_DEBUG, "Setting blksize2 to '%s'", + options[OPT_BLKSIZE2].o_reply); + + return (0); +} + +/* + * Append the available options to the header + */ +uint16_t +make_options(int peer, char *buffer, uint16_t size) { + int i; + char *value; + const char *option; + uint16_t length; + uint16_t returnsize = 0; + + if (!options_rfc_enabled) return (0); + + for (i = 0; options[i].o_type != NULL; i++) { + if (options[i].rfc == 0 && !options_extra_enabled) + continue; + + option = options[i].o_type; + if (acting_as_client) + value = options[i].o_request; + else + value = options[i].o_reply; + if (value == NULL) + continue; + + length = strlen(value) + strlen(option) + 2; + if (size <= length) { + tftp_log(LOG_ERR, + "Running out of option space for " + "option '%s' with value '%s': " + "needed %d bytes, got %d bytes", + option, value, size, length); + continue; + } + + sprintf(buffer, "%s%c%s%c", option, '\000', value, '\000'); + size -= length; + buffer += length; + returnsize += length; + } + + return (returnsize); +} + +/* + * Parse the received options in the header + */ +int +parse_options(int peer, char *buffer, uint16_t size) +{ + int i, options_failed; + char *c, *cp, *option, *value; + + if (!options_rfc_enabled) return (0); + + /* Parse the options */ + cp = buffer; + options_failed = 0; + while (size > 0) { + option = cp; + i = get_field(peer, cp, size); + cp += i; + + value = cp; + i = get_field(peer, cp, size); + cp += i; + + /* We are at the end */ + if (*option == '\0') break; + + if (debug&DEBUG_OPTIONS) + tftp_log(LOG_DEBUG, + "option: '%s' value: '%s'", option, value); + + for (c = option; *c; c++) + if (isupper(*c)) + *c = tolower(*c); + for (i = 0; options[i].o_type != NULL; i++) { + if (strcmp(option, options[i].o_type) == 0) { + if (!acting_as_client) + options[i].o_request = value; + if (!options_extra_enabled && !options[i].rfc) { + tftp_log(LOG_INFO, + "Option '%s' with value '%s' found " + "but it is not an RFC option", + option, value); + continue; + } + if (options[i].o_handler) + options_failed += + (options[i].o_handler)(peer); + break; + } + } + if (options[i].o_type == NULL) + tftp_log(LOG_WARNING, + "Unknown option: '%s'", option); + + size -= strlen(option) + strlen(value) + 2; + } + + return (options_failed); +} + +/* + * Set some default values in the options + */ +void +init_options(void) +{ + + options[OPT_ROLLOVER].o_request = strdup("0"); +} Copied: stable/8/libexec/tftpd/tftp-options.h (from r207614, head/libexec/tftpd/tftp-options.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/libexec/tftpd/tftp-options.h Wed Sep 22 21:54:30 2010 (r213038, copy of r207614, head/libexec/tftpd/tftp-options.h) @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2008 Edwin Groothuis. 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 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 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$"); + +/* + * Options + */ + +void init_options(void); +uint16_t make_options(int peer, char *buffer, uint16_t size); +int parse_options(int peer, char *buffer, uint16_t size); + +/* Call back functions */ +int option_tsize(int peer, struct tftphdr *, int, struct stat *); +int option_timeout(int peer); +int option_blksize(int peer); +int option_blksize2(int peer); +int option_rollover(int peer); + +extern int options_extra_enabled; +extern int options_rfc_enabled; + +struct options { + const char *o_type; + char *o_request; + char *o_reply; + int (*o_handler)(int peer); + int rfc; +}; + +extern struct options options[]; +enum opt_enum { + OPT_TSIZE = 0, + OPT_TIMEOUT, + OPT_BLKSIZE, + OPT_BLKSIZE2, + OPT_ROLLOVER, +}; Copied: stable/8/libexec/tftpd/tftp-transfer.c (from r207614, head/libexec/tftpd/tftp-transfer.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/libexec/tftpd/tftp-transfer.c Wed Sep 22 21:54:30 2010 (r213038, copy of r207614, head/libexec/tftpd/tftp-transfer.c) @@ -0,0 +1,318 @@ +/* + * Copyright (C) 2008 Edwin Groothuis. 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 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 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 "tftp-file.h" +#include "tftp-io.h" +#include "tftp-utils.h" +#include "tftp-options.h" +#include "tftp-transfer.h" + +/* + * Send a file via the TFTP data session. + */ +void +tftp_send(int peer, uint16_t *block, struct tftp_stats *ts) +{ + struct tftphdr *rp; + int size, n_data, n_ack, try; + uint16_t oldblock; + char sendbuffer[MAXPKTSIZE]; + char recvbuffer[MAXPKTSIZE]; + + rp = (struct tftphdr *)recvbuffer; + *block = 1; + ts->amount = 0; + do { + if (debug&DEBUG_SIMPLE) + tftp_log(LOG_DEBUG, "Sending block %d", *block); + + size = read_file(sendbuffer, segsize); + if (size < 0) { + tftp_log(LOG_ERR, "read_file returned %d", size); + send_error(peer, errno + 100); + goto abort; + } + + for (try = 0; ; try++) { + n_data = send_data(peer, *block, sendbuffer, size); + if (n_data > 0) { + if (try == maxtimeouts) { + tftp_log(LOG_ERR, + "Cannot send DATA packet #%d, " + "giving up", *block); + return; + } + tftp_log(LOG_ERR, + "Cannot send DATA packet #%d, trying again", + *block); + continue; + } + + n_ack = receive_packet(peer, recvbuffer, + MAXPKTSIZE, NULL, timeoutpacket); + if (n_ack < 0) { + if (n_ack == RP_TIMEOUT) { + if (try == maxtimeouts) { + tftp_log(LOG_ERR, + "Timeout #%d send ACK %d " + "giving up", try, *block); + return; + } + tftp_log(LOG_WARNING, + "Timeout #%d on ACK %d", + try, *block); + continue; + } + + /* Either read failure or ERROR packet */ + if (debug&DEBUG_SIMPLE) + tftp_log(LOG_ERR, "Aborting: %s", + rp_strerror(n_ack)); + goto abort; + } + if (rp->th_opcode == ACK) { + ts->blocks++; + if (rp->th_block == *block) { + ts->amount += size; + break; + } + + /* Re-synchronize with the other side */ + (void) synchnet(peer); + if (rp->th_block == (*block - 1)) { + ts->retries++; + continue; + } + } + + } + oldblock = *block; + (*block)++; + if (oldblock > *block) { + if (options[OPT_ROLLOVER].o_request == NULL) { + tftp_log(LOG_ERR, + "Block rollover but not allowed."); + send_error(peer, EBADOP); + gettimeofday(&(ts->tstop), NULL); + return; + } + + *block = atoi(options[OPT_ROLLOVER].o_request); + ts->rollovers++; + } + gettimeofday(&(ts->tstop), NULL); + } while (size == segsize); +abort: + return; +} + +/* + * Receive a file via the TFTP data session. + * *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 21:54:34 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 962CD106577D; Wed, 22 Sep 2010 21:54:34 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 612A28FC12; Wed, 22 Sep 2010 21:54:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MLsYl9045198; Wed, 22 Sep 2010 21:54:34 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MLsYn1045188; Wed, 22 Sep 2010 21:54:34 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009222154.o8MLsYn1045188@svn.freebsd.org> From: Marius Strobl Date: Wed, 22 Sep 2010 21:54:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213039 - stable/7/libexec/tftpd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 21:54:34 -0000 Author: marius Date: Wed Sep 22 21:54:34 2010 New Revision: 213039 URL: http://svn.freebsd.org/changeset/base/213039 Log: MFC: r207608, r207614, r212651, r212665 Go ahead and merge the work edwin@ on tftpd into the tree. It is a lot better than what's in the tree now. Edwin tested it at a prior employer, but can't test it today. I've found that it works a lot better with the various uboot versions that I've used in my embedded work. Here's the pkg-descr from the port that describes the changes: It all started when we got some new routers, which told me the following when trying to upload configuration or download images from it: The TFTP server doesn't support the blocksize option. My curiousity was triggered, it took me some reading of RFCs and other documentation to find out what was possible and what could be done. Was plain TFTP very simple in its handshake, TFTP with options was kind of messy because of its backwards capability: The first packet returned could either be an acknowledgement of options, or the first data packet. Going through the source code of src/libexec/tftpd and going through the code of src/usr.bin/tftp showed that there was a lot of duplicate code, and the addition of options would only increase the amount of duplicate code. After all, both the client and the server can act as a sender and receiver. At the end, it ended up with a nearly complete rewrite of the tftp client and server. It has been tested against the following TFTP clients and servers: - Itself (yay!) - The standard FreeBSD tftp client and server - The Fedora Core 6 tftp client and server - Cisco router tftp client - Extreme Networks tftp client It supports the following RFCs: RFC1350 - THE TFTP PROTOCOL (REVISION 2) RFC2347 - TFTP Option Extension RFC2348 - TFTP Blocksize Option RFC2349 - TFTP Timeout Interval and Transfer Size Options RFC3617 - Uniform Resource Identifier (URI) Scheme and Applicability Statement for the Trivial File Transfer Protocol (TFTP) It supports the following unofficial TFTP Options as described at http://www.compuphase.com/tftp.htm: blksize2 - Block size restricted to powers of 2, excluding protocol headers rollover - Block counter roll-over (roll back to zero or to one) From the tftp program point of view the following things are changed: - New commands: "blocksize", "blocksize2", "rollover" and "options" - Development features: "debug" and "packetdrop" If you try this tftp/tftpd implementation, please let me know if it works (or doesn't work) and against which implementaion so I can get a list of confirmed working systems. Author: Edwin Groothuis Added: stable/7/libexec/tftpd/tftp-file.c - copied unchanged from r207614, head/libexec/tftpd/tftp-file.c stable/7/libexec/tftpd/tftp-file.h - copied unchanged from r207614, head/libexec/tftpd/tftp-file.h stable/7/libexec/tftpd/tftp-io.c - copied, changed from r207614, head/libexec/tftpd/tftp-io.c stable/7/libexec/tftpd/tftp-io.h - copied unchanged from r207614, head/libexec/tftpd/tftp-io.h stable/7/libexec/tftpd/tftp-options.c - copied unchanged from r207614, head/libexec/tftpd/tftp-options.c stable/7/libexec/tftpd/tftp-options.h - copied unchanged from r207614, head/libexec/tftpd/tftp-options.h stable/7/libexec/tftpd/tftp-transfer.c - copied unchanged from r207614, head/libexec/tftpd/tftp-transfer.c stable/7/libexec/tftpd/tftp-transfer.h - copied unchanged from r207614, head/libexec/tftpd/tftp-transfer.h stable/7/libexec/tftpd/tftp-utils.c - copied unchanged from r207614, head/libexec/tftpd/tftp-utils.c stable/7/libexec/tftpd/tftp-utils.h - copied unchanged from r207614, head/libexec/tftpd/tftp-utils.h Modified: stable/7/libexec/tftpd/Makefile stable/7/libexec/tftpd/tftpd.8 stable/7/libexec/tftpd/tftpd.c Directory Properties: stable/7/libexec/tftpd/ (props changed) Modified: stable/7/libexec/tftpd/Makefile ============================================================================== --- stable/7/libexec/tftpd/Makefile Wed Sep 22 21:54:30 2010 (r213038) +++ stable/7/libexec/tftpd/Makefile Wed Sep 22 21:54:34 2010 (r213039) @@ -2,12 +2,13 @@ # $FreeBSD$ PROG= tftpd -SRCS= tftpd.c tftpsubs.c -DPADD= ${LIBUTIL} -LDADD= -lutil +SRCS= tftpd.c tftp-io.c tftp-utils.c tftp-file.c tftp-transfer.c tftp-options.c +WARNS= 3 WFORMAT=0 MAN= tftpd.8 -CFLAGS+=-I${.CURDIR}/../../usr.bin/tftp +CFLAGS+=-I${.CURDIR}/../../usr.bin/tftp -I${.CURDIR}/../../libexec/tftpd .PATH: ${.CURDIR}/../../usr.bin/tftp +COPTFLAGS = -O +LDFLAGS= -lwrap .include Copied: stable/7/libexec/tftpd/tftp-file.c (from r207614, head/libexec/tftpd/tftp-file.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/libexec/tftpd/tftp-file.c Wed Sep 22 21:54:34 2010 (r213039, copy of r207614, head/libexec/tftpd/tftp-file.c) @@ -0,0 +1,257 @@ +/* + * Copyright (C) 2008 Edwin Groothuis. 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 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 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 "tftp-file.h" +#include "tftp-utils.h" + +static FILE *file; +static int convert; + +static char convbuffer[66000]; +static int gotcr = 0; + +static size_t +convert_from_net(char *buffer, size_t count) +{ + size_t i, n; + + /* + * Convert all CR/LF to LF and all CR,NUL to CR + */ + + n = 0; + for (i = 0; i < count; i++) { + + if (gotcr == 0) { + convbuffer[n++] = buffer[i]; + gotcr = (buffer[i] == '\r'); + continue; + } + + /* CR, NULL -> CR */ + if (buffer[i] == '\0') { + gotcr = 0; + continue; + } + + /* CR, LF -> LF */ + if (buffer[i] == '\n') { + if (n == 0) { + if (ftell(file) != 0) { + fseek(file, -1, SEEK_END); + convbuffer[n++] = '\n'; + } else { + /* This shouldn't happen */ + tftp_log(LOG_ERR, + "Received LF as first character"); + abort(); + } + } else + convbuffer[n-1] = '\n'; + gotcr = 0; + continue; + } + + /* Everything else just accept as is */ + convbuffer[n++] = buffer[i]; + gotcr = (buffer[i] == '\r'); + continue; + } + + return fwrite(convbuffer, 1, n, file); +} + +static size_t +convert_to_net(char *buffer, size_t count, int init) +{ + size_t i; + static size_t n = 0, read = 0; + static int newline = 0; + + if (init) { + newline = 0; + n = 0; + read = 0; + return 0 ; + } + + /* + * Convert all LF to CR,LF and all CR to CR,NUL + */ + i = 0; + + if (newline) { + buffer[i++] = newline; + newline = 0; + } + + while (i < count) { + if (n == read) { + /* When done we're done */ + if (feof(file)) break; + + /* Otherwise read another bunch */ + read = fread(convbuffer, 1, count, file); + if (read == 0) break; + n = 0; + } + + /* CR -> CR,NULL */ + if (convbuffer[n] == '\r') { + buffer[i++] = '\r'; + buffer[i++] = '\0'; + n++; + continue; + } + + /* LF -> CR,LF */ + if (convbuffer[n] == '\n') { + buffer[i++] = '\r'; + buffer[i++] = '\n'; + n++; + continue; + } + + buffer[i++] = convbuffer[n++]; + } + + if (i > count) { + /* + * Whoops... that isn't alllowed (but it will happen + * when there is a CR or LF at the end of the buffer) + */ + newline = buffer[i-1]; + } + + if (i < count) { + /* We are done! */ + return i; + } else + return count; + +} + +int +write_init(int fd, FILE *f, const char *mode) +{ + + if (f == NULL) { + file = fdopen(fd, "w"); + if (file == NULL) { + int en = errno; + tftp_log(LOG_ERR, "fdopen() failed: %s", + strerror(errno)); + return en; + } + } else + file = f; + convert = !strcmp(mode, "netascii"); + return 0; +} + +size_t +write_file(char *buffer, int count) +{ + + if (convert == 0) + return fwrite(buffer, 1, count, file); + + return convert_from_net(buffer, count); +} + +int +write_close(void) +{ + + if (fclose(file) != 0) { + tftp_log(LOG_ERR, "fclose() failed: %s", strerror(errno)); + return 1; + } + return 0; +} + +int +read_init(int fd, FILE *f, const char *mode) +{ + + convert_to_net(NULL, 0, 1); + if (f == NULL) { + file = fdopen(fd, "r"); + if (file == NULL) { + int en = errno; + tftp_log(LOG_ERR, "fdopen() failed: %s", + strerror(errno)); + return en; + } + } else + file = f; + convert = !strcmp(mode, "netascii"); + return 0; +} + +size_t +read_file(char *buffer, int count) +{ + + if (convert == 0) + return fread(buffer, 1, count, file); + + return convert_to_net(buffer, count, 0); +} + +int +read_close(void) +{ + + if (fclose(file) != 0) { + tftp_log(LOG_ERR, "fclose() failed: %s", strerror(errno)); + return 1; + } + return 0; +} + + +int +synchnet(int peer) +{ + + return 0; +} Copied: stable/7/libexec/tftpd/tftp-file.h (from r207614, head/libexec/tftpd/tftp-file.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/libexec/tftpd/tftp-file.h Wed Sep 22 21:54:34 2010 (r213039, copy of r207614, head/libexec/tftpd/tftp-file.h) @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2008 Edwin Groothuis. 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 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 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$"); + +int write_init(int fd, FILE *f, const char *mode); +size_t write_file(char *buffer, int count); +int write_close(void); + +int read_init(int fd, FILE *f, const char *mode); +size_t read_file(char *buffer, int count); +int read_close(void); + +int synchnet(int peer); Copied and modified: stable/7/libexec/tftpd/tftp-io.c (from r207614, head/libexec/tftpd/tftp-io.c) ============================================================================== --- head/libexec/tftpd/tftp-io.c Tue May 4 13:07:40 2010 (r207614, copy source) +++ stable/7/libexec/tftpd/tftp-io.c Wed Sep 22 21:54:34 2010 (r213039) @@ -398,8 +398,6 @@ receive_packet(int peer, char *data, int int n; static int waiting; - pfrom = (from == NULL) ? &from_local : from; - if (debug&DEBUG_PACKETS) tftp_log(LOG_DEBUG, "Waiting %d seconds for packet", timeoutpacket); @@ -423,6 +421,7 @@ receive_packet(int peer, char *data, int } waiting++; + pfrom = (from == NULL) ? &from_local : from; fromlen = sizeof(*pfrom); n = recvfrom(peer, data, size, 0, (struct sockaddr *)pfrom, &fromlen); Copied: stable/7/libexec/tftpd/tftp-io.h (from r207614, head/libexec/tftpd/tftp-io.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/libexec/tftpd/tftp-io.h Wed Sep 22 21:54:34 2010 (r213039, copy of r207614, head/libexec/tftpd/tftp-io.h) @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2008 Edwin Groothuis. 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 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 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 RP_NONE 0 +#define RP_RECVFROM -1 +#define RP_TOOSMALL -2 +#define RP_ERROR -3 +#define RP_WRONGSOURCE -4 +#define RP_TIMEOUT -5 +#define RP_TOOBIG -6 + +const char *errtomsg(int); +void send_error(int peer, int); +int send_wrq(int peer, char *, char *); +int send_rrq(int peer, char *, char *); +int send_oack(int peer); +int send_ack(int peer, unsigned short); +int send_data(int peer, uint16_t, char *, int); +int receive_packet(int peer, char *, int, struct sockaddr_storage *, int); + +extern struct sockaddr_storage peer_sock; +extern struct sockaddr_storage me_sock; Copied: stable/7/libexec/tftpd/tftp-options.c (from r207614, head/libexec/tftpd/tftp-options.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/libexec/tftpd/tftp-options.c Wed Sep 22 21:54:34 2010 (r213039, copy of r207614, head/libexec/tftpd/tftp-options.c) @@ -0,0 +1,390 @@ +/* + * Copyright (C) 2008 Edwin Groothuis. 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 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 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 "tftp-utils.h" +#include "tftp-io.h" +#include "tftp-options.h" + +/* + * Option handlers + */ + +struct options options[] = { + { "tsize", NULL, NULL, NULL /* option_tsize */, 1 }, + { "timeout", NULL, NULL, option_timeout, 1 }, + { "blksize", NULL, NULL, option_blksize, 1 }, + { "blksize2", NULL, NULL, option_blksize2, 0 }, + { "rollover", NULL, NULL, option_rollover, 0 }, + { NULL, NULL, NULL, NULL, 0 } +}; + +/* By default allow them */ +int options_rfc_enabled = 1; +int options_extra_enabled = 1; + +/* + * Rules for the option handlers: + * - If there is no o_request, there will be no processing. + * + * For servers + * - Logging is done as warnings. + * - The handler exit()s if there is a serious problem with the + * values submitted in the option. + * + * For clients + * - Logging is done as errors. After all, the server shouldn't + * return rubbish. + * - The handler returns if there is a serious problem with the + * values submitted in the option. + * - Sending the EBADOP packets is done by the handler. + */ + +int +option_tsize(int peer, struct tftphdr *tp, int mode, struct stat *stbuf) +{ + + if (options[OPT_TSIZE].o_request == NULL) + return (0); + + if (mode == RRQ) + asprintf(&options[OPT_TSIZE].o_reply, + "%ju", stbuf->st_size); + else + /* XXX Allows writes of all sizes. */ + options[OPT_TSIZE].o_reply = + strdup(options[OPT_TSIZE].o_request); + return (0); +} + +int +option_timeout(int peer) +{ + + if (options[OPT_TIMEOUT].o_request == NULL) + return (0); + + int to = atoi(options[OPT_TIMEOUT].o_request); + if (to < TIMEOUT_MIN || to > TIMEOUT_MAX) { + tftp_log(acting_as_client ? LOG_ERR : LOG_WARNING, + "Received bad value for timeout. " + "Should be between %d and %d, received %s", + TIMEOUT_MIN, TIMEOUT_MAX); + send_error(peer, EBADOP); + if (acting_as_client) + return (1); + exit(1); + } else { + timeoutpacket = to; + options[OPT_TIMEOUT].o_reply = + strdup(options[OPT_TIMEOUT].o_request); + } + settimeouts(timeoutpacket, timeoutnetwork, maxtimeouts); + + if (debug&DEBUG_OPTIONS) + tftp_log(LOG_DEBUG, "Setting timeout to '%s'", + options[OPT_TIMEOUT].o_reply); + + return (0); +} + +int +option_rollover(int peer) +{ + + if (options[OPT_ROLLOVER].o_request == NULL) + return (0); + + if (strcmp(options[OPT_ROLLOVER].o_request, "0") != 0 + && strcmp(options[OPT_ROLLOVER].o_request, "1") != 0) { + tftp_log(acting_as_client ? LOG_ERR : LOG_WARNING, + "Bad value for rollover, " + "should be either 0 or 1, received '%s', " + "ignoring request", + options[OPT_ROLLOVER].o_request); + if (acting_as_client) { + send_error(peer, EBADOP); + return (1); + } + return (0); + } + options[OPT_ROLLOVER].o_reply = + strdup(options[OPT_ROLLOVER].o_request); + + if (debug&DEBUG_OPTIONS) + tftp_log(LOG_DEBUG, "Setting rollover to '%s'", + options[OPT_ROLLOVER].o_reply); + + return (0); +} + +int +option_blksize(int peer) +{ + int *maxdgram; + char maxbuffer[100]; + size_t len; + + if (options[OPT_BLKSIZE].o_request == NULL) + return (0); + + /* maximum size of an UDP packet according to the system */ + len = sizeof(maxbuffer); + if (sysctlbyname("net.inet.udp.maxdgram", + maxbuffer, &len, NULL, 0) < 0) { + tftp_log(LOG_ERR, "sysctl: net.inet.udp.maxdgram"); + return (acting_as_client ? 1 : 0); + } + maxdgram = (int *)maxbuffer; + + int size = atoi(options[OPT_BLKSIZE].o_request); + if (size < BLKSIZE_MIN || size > BLKSIZE_MAX) { + if (acting_as_client) { + tftp_log(LOG_ERR, + "Invalid blocksize (%d bytes), aborting", + size); + send_error(peer, EBADOP); + return (1); + } else { + tftp_log(LOG_WARNING, + "Invalid blocksize (%d bytes), ignoring request", + size); + return (0); + } + } + + if (size > *maxdgram) { + if (acting_as_client) { + tftp_log(LOG_ERR, + "Invalid blocksize (%d bytes), " + "net.inet.udp.maxdgram sysctl limits it to " + "%d bytes.\n", size, *maxdgram); + send_error(peer, EBADOP); + return (1); + } else { + tftp_log(LOG_WARNING, + "Invalid blocksize (%d bytes), " + "net.inet.udp.maxdgram sysctl limits it to " + "%d bytes.\n", size, *maxdgram); + size = *maxdgram; + /* No reason to return */ + } + } + + asprintf(&options[OPT_BLKSIZE].o_reply, "%d", size); + segsize = size; + pktsize = size + 4; + if (debug&DEBUG_OPTIONS) + tftp_log(LOG_DEBUG, "Setting blksize to '%s'", + options[OPT_BLKSIZE].o_reply); + + return (0); +} + +int +option_blksize2(int peer) +{ + int *maxdgram; + char maxbuffer[100]; + int size, i; + size_t len; + + int sizes[] = { + 8, 16, 32, 64, 128, 256, 512, 1024, + 2048, 4096, 8192, 16384, 32768, 0 + }; + + if (options[OPT_BLKSIZE2].o_request == NULL) + return (0); + + /* maximum size of an UDP packet according to the system */ + len = sizeof(maxbuffer); + if (sysctlbyname("net.inet.udp.maxdgram", + maxbuffer, &len, NULL, 0) < 0) { + tftp_log(LOG_ERR, "sysctl: net.inet.udp.maxdgram"); + return (acting_as_client ? 1 : 0); + } + maxdgram = (int *)maxbuffer; + + size = atoi(options[OPT_BLKSIZE2].o_request); + for (i = 0; sizes[i] != 0; i++) { + if (size == sizes[i]) break; + } + if (sizes[i] == 0) { + tftp_log(LOG_INFO, + "Invalid blocksize2 (%d bytes), ignoring request", size); + return (acting_as_client ? 1 : 0); + } + + if (size > *maxdgram) { + for (i = 0; sizes[i+1] != 0; i++) { + if (*maxdgram < sizes[i+1]) break; + } + tftp_log(LOG_INFO, + "Invalid blocksize2 (%d bytes), net.inet.udp.maxdgram " + "sysctl limits it to %d bytes.\n", size, *maxdgram); + size = sizes[i]; + /* No need to return */ + } + + asprintf(&options[OPT_BLKSIZE2].o_reply, "%d", size); + segsize = size; + pktsize = size + 4; + if (debug&DEBUG_OPTIONS) + tftp_log(LOG_DEBUG, "Setting blksize2 to '%s'", + options[OPT_BLKSIZE2].o_reply); + + return (0); +} + +/* + * Append the available options to the header + */ +uint16_t +make_options(int peer, char *buffer, uint16_t size) { + int i; + char *value; + const char *option; + uint16_t length; + uint16_t returnsize = 0; + + if (!options_rfc_enabled) return (0); + + for (i = 0; options[i].o_type != NULL; i++) { + if (options[i].rfc == 0 && !options_extra_enabled) + continue; + + option = options[i].o_type; + if (acting_as_client) + value = options[i].o_request; + else + value = options[i].o_reply; + if (value == NULL) + continue; + + length = strlen(value) + strlen(option) + 2; + if (size <= length) { + tftp_log(LOG_ERR, + "Running out of option space for " + "option '%s' with value '%s': " + "needed %d bytes, got %d bytes", + option, value, size, length); + continue; + } + + sprintf(buffer, "%s%c%s%c", option, '\000', value, '\000'); + size -= length; + buffer += length; + returnsize += length; + } + + return (returnsize); +} + +/* + * Parse the received options in the header + */ +int +parse_options(int peer, char *buffer, uint16_t size) +{ + int i, options_failed; + char *c, *cp, *option, *value; + + if (!options_rfc_enabled) return (0); + + /* Parse the options */ + cp = buffer; + options_failed = 0; + while (size > 0) { + option = cp; + i = get_field(peer, cp, size); + cp += i; + + value = cp; + i = get_field(peer, cp, size); + cp += i; + + /* We are at the end */ + if (*option == '\0') break; + + if (debug&DEBUG_OPTIONS) + tftp_log(LOG_DEBUG, + "option: '%s' value: '%s'", option, value); + + for (c = option; *c; c++) + if (isupper(*c)) + *c = tolower(*c); + for (i = 0; options[i].o_type != NULL; i++) { + if (strcmp(option, options[i].o_type) == 0) { + if (!acting_as_client) + options[i].o_request = value; + if (!options_extra_enabled && !options[i].rfc) { + tftp_log(LOG_INFO, + "Option '%s' with value '%s' found " + "but it is not an RFC option", + option, value); + continue; + } + if (options[i].o_handler) + options_failed += + (options[i].o_handler)(peer); + break; + } + } + if (options[i].o_type == NULL) + tftp_log(LOG_WARNING, + "Unknown option: '%s'", option); + + size -= strlen(option) + strlen(value) + 2; + } + + return (options_failed); +} + +/* + * Set some default values in the options + */ +void +init_options(void) +{ + + options[OPT_ROLLOVER].o_request = strdup("0"); +} Copied: stable/7/libexec/tftpd/tftp-options.h (from r207614, head/libexec/tftpd/tftp-options.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/libexec/tftpd/tftp-options.h Wed Sep 22 21:54:34 2010 (r213039, copy of r207614, head/libexec/tftpd/tftp-options.h) @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2008 Edwin Groothuis. 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 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 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$"); + +/* + * Options + */ + +void init_options(void); +uint16_t make_options(int peer, char *buffer, uint16_t size); +int parse_options(int peer, char *buffer, uint16_t size); + +/* Call back functions */ +int option_tsize(int peer, struct tftphdr *, int, struct stat *); +int option_timeout(int peer); +int option_blksize(int peer); +int option_blksize2(int peer); +int option_rollover(int peer); + +extern int options_extra_enabled; +extern int options_rfc_enabled; + +struct options { + const char *o_type; + char *o_request; + char *o_reply; + int (*o_handler)(int peer); + int rfc; +}; + +extern struct options options[]; +enum opt_enum { + OPT_TSIZE = 0, + OPT_TIMEOUT, + OPT_BLKSIZE, + OPT_BLKSIZE2, + OPT_ROLLOVER, +}; Copied: stable/7/libexec/tftpd/tftp-transfer.c (from r207614, head/libexec/tftpd/tftp-transfer.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/libexec/tftpd/tftp-transfer.c Wed Sep 22 21:54:34 2010 (r213039, copy of r207614, head/libexec/tftpd/tftp-transfer.c) @@ -0,0 +1,318 @@ +/* + * Copyright (C) 2008 Edwin Groothuis. 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 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 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 "tftp-file.h" +#include "tftp-io.h" +#include "tftp-utils.h" +#include "tftp-options.h" +#include "tftp-transfer.h" + +/* + * Send a file via the TFTP data session. + */ +void +tftp_send(int peer, uint16_t *block, struct tftp_stats *ts) +{ + struct tftphdr *rp; + int size, n_data, n_ack, try; + uint16_t oldblock; + char sendbuffer[MAXPKTSIZE]; + char recvbuffer[MAXPKTSIZE]; + + rp = (struct tftphdr *)recvbuffer; + *block = 1; + ts->amount = 0; + do { + if (debug&DEBUG_SIMPLE) + tftp_log(LOG_DEBUG, "Sending block %d", *block); + + size = read_file(sendbuffer, segsize); + if (size < 0) { + tftp_log(LOG_ERR, "read_file returned %d", size); + send_error(peer, errno + 100); + goto abort; + } + + for (try = 0; ; try++) { + n_data = send_data(peer, *block, sendbuffer, size); + if (n_data > 0) { + if (try == maxtimeouts) { + tftp_log(LOG_ERR, + "Cannot send DATA packet #%d, " + "giving up", *block); + return; + } + tftp_log(LOG_ERR, + "Cannot send DATA packet #%d, trying again", + *block); + continue; + } + + n_ack = receive_packet(peer, recvbuffer, + MAXPKTSIZE, NULL, timeoutpacket); + if (n_ack < 0) { + if (n_ack == RP_TIMEOUT) { + if (try == maxtimeouts) { + tftp_log(LOG_ERR, + "Timeout #%d send ACK %d " + "giving up", try, *block); + return; + } + tftp_log(LOG_WARNING, + "Timeout #%d on ACK %d", + try, *block); + continue; + } + + /* Either read failure or ERROR packet */ + if (debug&DEBUG_SIMPLE) + tftp_log(LOG_ERR, "Aborting: %s", + rp_strerror(n_ack)); + goto abort; + } + if (rp->th_opcode == ACK) { + ts->blocks++; + if (rp->th_block == *block) { + ts->amount += size; + break; + } + + /* Re-synchronize with the other side */ + (void) synchnet(peer); + if (rp->th_block == (*block - 1)) { + ts->retries++; + continue; + } + } + + } + oldblock = *block; + (*block)++; + if (oldblock > *block) { + if (options[OPT_ROLLOVER].o_request == NULL) { + tftp_log(LOG_ERR, + "Block rollover but not allowed."); + send_error(peer, EBADOP); + gettimeofday(&(ts->tstop), NULL); + return; + } + + *block = atoi(options[OPT_ROLLOVER].o_request); + ts->rollovers++; + } + gettimeofday(&(ts->tstop), NULL); + } while (size == segsize); +abort: + return; +} + +/* + * Receive a file via the TFTP data session. + * *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 21:57:03 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7909F1065670; Wed, 22 Sep 2010 21:57:03 +0000 (UTC) (envelope-from bruce@cran.org.uk) Received: from queueout02-winn.ispmail.ntl.com (queueout02-winn.ispmail.ntl.com [81.103.221.56]) by mx1.freebsd.org (Postfix) with ESMTP id 199768FC13; Wed, 22 Sep 2010 21:57:01 +0000 (UTC) Received: from know-smtpout-4.server.virginmedia.net ([62.254.123.4]) by mtaout03-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20100922212445.ZFKO3075.mtaout03-winn.ispmail.ntl.com@know-smtpout-4.server.virginmedia.net>; Wed, 22 Sep 2010 22:24:45 +0100 Received: from [86.31.87.130] (helo=unknown) by know-smtpout-4.server.virginmedia.net with esmtp (Exim 4.63) (envelope-from ) id 1OyWo1-0002NQ-80; Wed, 22 Sep 2010 22:24:45 +0100 Date: Wed, 22 Sep 2010 22:24:41 +0100 From: Bruce Cran To: Andriy Gapon Message-ID: <20100922222441.00002f27@unknown> In-Reply-To: <4C9A6EE6.5050301@freebsd.org> References: <201009211507.o8LF7iVv097676@svn.freebsd.org> <4C9A1602.4020204@freebsd.org> <1285169017.64197.29.camel@buffy.york.ac.uk> <201009221558.27393.jhb@freebsd.org> <4C9A6EE6.5050301@freebsd.org> X-Mailer: Claws Mail 3.7.6 (GTK+ 2.16.6; i586-pc-mingw32msvc) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Cloudmark-Analysis: v=1.1 cv=3ENABmdyEd/Fm7fR7+mZIuMDn6+IErAeEhlfWBImZFk= c=1 sm=0 a=eMkYoSNlslsA:10 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=mLnWKSbTkEf9j1wKOzIA:9 a=y6gBx-ZuQ5kXiikVPmfYdMhZ_6IA:4 a=CjuIK1q_8ugA:10 a=SV7veod9ZcQA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Gavin Atkinson , src-committers@freebsd.org, John Baldwin Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 21:57:03 -0000 On Thu, 23 Sep 2010 00:02:30 +0300 Andriy Gapon wrote: > But what was the reason that dumpdev="AUTO" was reverted? > I remember that POLA was quoted at the time. > I am not sure what the astonishment actually was - perhaps 'AUTO' was > not smart enough and destroyed somebody's data? > The problem with "AUTO" is that it takes time to do the dump unless using textdumps; it also has the potential of failing and leaving the system unusable until someone resets it. I believe the argument was that for production servers you want the system to be up and running again as soon as possible after a crash. -- Bruce Cran From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 22:16:48 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7E92D106564A; Wed, 22 Sep 2010 22:16:48 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 536E08FC1A; Wed, 22 Sep 2010 22:16:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MMGmMx045799; Wed, 22 Sep 2010 22:16:48 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MMGmJh045797; Wed, 22 Sep 2010 22:16:48 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201009222216.o8MMGmJh045797@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 22 Sep 2010 22:16:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213040 - stable/8/sys/dev/syscons X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 22:16:48 -0000 Author: jkim Date: Wed Sep 22 22:16:48 2010 New Revision: 213040 URL: http://svn.freebsd.org/changeset/base/213040 Log: MFC: r212806 Rework r210248. Although it fixed most of problems, it did not fix one particular edge case where X-axis resolution is not multiple of font width. Now we just advance enough scan lines, then deduct a partial scan line. It is more intuitive than the previous code. Apply the same wisdom to EGA and VGA planar renderers for consistency. Modified: stable/8/sys/dev/syscons/scvgarndr.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/syscons/scvgarndr.c ============================================================================== --- stable/8/sys/dev/syscons/scvgarndr.c Wed Sep 22 21:54:34 2010 (r213039) +++ stable/8/sys/dev/syscons/scvgarndr.c Wed Sep 22 22:16:48 2010 (r213040) @@ -713,8 +713,7 @@ vga_egadraw(scr_stat *scp, int from, int } ++d; if ((i % scp->xsize) == scp->xsize - 1) - d += scp->xoff*2 - + (scp->font_size - 1)*line_width; + d += scp->font_size * line_width - scp->xsize; } outw(GDCIDX, 0x0000); /* set/reset */ outw(GDCIDX, 0x0001); /* set/reset enable */ @@ -766,9 +765,8 @@ vga_vgadraw_direct(scr_stat *scp, int fr d += 8 * pixel_size; if ((i % scp->xsize) == scp->xsize - 1) - d += scp->xoff * scp->font_size * pixel_size + - scp->font_size * line_width - - scp->xpixel * pixel_size; + d += scp->font_size * line_width - + scp->xsize * 8 * pixel_size; } } @@ -824,8 +822,7 @@ vga_vgadraw_planar(scr_stat *scp, int fr } ++d; if ((i % scp->xsize) == scp->xsize - 1) - d += scp->xoff*2 - + (scp->font_size - 1)*line_width; + d += scp->font_size * line_width - scp->xsize; } outw(GDCIDX, 0x0005); /* read mode 0, write mode 0 */ outw(GDCIDX, 0x0000); /* set/reset */ From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 22:17:40 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 54F121065674; Wed, 22 Sep 2010 22:17:40 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2A0BB8FC25; Wed, 22 Sep 2010 22:17:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MMHeOM045854; Wed, 22 Sep 2010 22:17:40 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MMHeTQ045852; Wed, 22 Sep 2010 22:17:40 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201009222217.o8MMHeTQ045852@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 22 Sep 2010 22:17:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213041 - stable/7/sys/dev/syscons X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 22:17:40 -0000 Author: jkim Date: Wed Sep 22 22:17:39 2010 New Revision: 213041 URL: http://svn.freebsd.org/changeset/base/213041 Log: MFC: r212806 Rework r210248. Although it fixed most of problems, it did not fix one particular edge case where X-axis resolution is not multiple of font width. Now we just advance enough scan lines, then deduct a partial scan line. It is more intuitive than the previous code. Apply the same wisdom to EGA and VGA planar renderers for consistency. Modified: stable/7/sys/dev/syscons/scvgarndr.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/syscons/scvgarndr.c ============================================================================== --- stable/7/sys/dev/syscons/scvgarndr.c Wed Sep 22 22:16:48 2010 (r213040) +++ stable/7/sys/dev/syscons/scvgarndr.c Wed Sep 22 22:17:39 2010 (r213041) @@ -705,8 +705,7 @@ vga_egadraw(scr_stat *scp, int from, int } ++d; if ((i % scp->xsize) == scp->xsize - 1) - d += scp->xoff*2 - + (scp->font_size - 1)*line_width; + d += scp->font_size * line_width - scp->xsize; } outw(GDCIDX, 0x0000); /* set/reset */ outw(GDCIDX, 0x0001); /* set/reset enable */ @@ -758,9 +757,8 @@ vga_vgadraw_direct(scr_stat *scp, int fr d += 8 * pixel_size; if ((i % scp->xsize) == scp->xsize - 1) - d += scp->xoff * scp->font_size * pixel_size + - scp->font_size * line_width - - scp->xpixel * pixel_size; + d += scp->font_size * line_width - + scp->xsize * 8 * pixel_size; } } @@ -816,8 +814,7 @@ vga_vgadraw_planar(scr_stat *scp, int fr } ++d; if ((i % scp->xsize) == scp->xsize - 1) - d += scp->xoff*2 - + (scp->font_size - 1)*line_width; + d += scp->font_size * line_width - scp->xsize; } outw(GDCIDX, 0x0005); /* read mode 0, write mode 0 */ outw(GDCIDX, 0x0000); /* set/reset */ From owner-svn-src-all@FreeBSD.ORG Wed Sep 22 23:41:03 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F4B5106566C; Wed, 22 Sep 2010 23:41:03 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F2B8C8FC1D; Wed, 22 Sep 2010 23:41:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MNf2Q5047636; Wed, 22 Sep 2010 23:41:02 GMT (envelope-from emax@svn.freebsd.org) Received: (from emax@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8MNf25m047634; Wed, 22 Sep 2010 23:41:02 GMT (envelope-from emax@svn.freebsd.org) Message-Id: <201009222341.o8MNf25m047634@svn.freebsd.org> From: Maksim Yevmenkin Date: Wed, 22 Sep 2010 23:41:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213042 - head/lib/libbluetooth X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 23:41:03 -0000 Author: emax Date: Wed Sep 22 23:41:02 2010 New Revision: 213042 URL: http://svn.freebsd.org/changeset/base/213042 Log: Add the following Linux BlueZ compatibility macros: htobs(), htobl(), btohs() and btohl() PR: kern/136386 Submitted by: Monty Hall < kungfu_disciple at sbcglobal dot net > MFC after: 1 week Modified: head/lib/libbluetooth/bluetooth.h Modified: head/lib/libbluetooth/bluetooth.h ============================================================================== --- head/lib/libbluetooth/bluetooth.h Wed Sep 22 22:17:39 2010 (r213041) +++ head/lib/libbluetooth/bluetooth.h Wed Sep 22 23:41:02 2010 (r213042) @@ -59,6 +59,10 @@ __BEGIN_DECLS #define bacpy(dst, src) memcpy((dst), (src), sizeof(bdaddr_t)) #define ba2str(ba, str) bt_ntoa((ba), (str)) #define str2ba(str, ba) (bt_aton((str), (ba)) == 1? 0 : -1) +#define htobs(d) htole16(d) +#define htobl(d) htole32(d) +#define btohs(d) le16toh(d) +#define btohl(d) le32toh(d) /* * Interface to the outside world From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 01:24:33 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C065B1065673; Thu, 23 Sep 2010 01:24:33 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AFCF08FC12; Thu, 23 Sep 2010 01:24:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8N1OXF8050005; Thu, 23 Sep 2010 01:24:33 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8N1OXQT050003; Thu, 23 Sep 2010 01:24:33 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201009230124.o8N1OXQT050003@svn.freebsd.org> From: Xin LI Date: Thu, 23 Sep 2010 01:24:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213044 - head/usr.bin/gzip X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 01:24:33 -0000 Author: delphij Date: Thu Sep 23 01:24:33 2010 New Revision: 213044 URL: http://svn.freebsd.org/changeset/base/213044 Log: In the past gunzip(1) write()'s after each inflate return. This is not optimal from a performance standpoint since the write buffer is not necessarily be filled up when the inflate rountine reached the end of input buffer and it's not the end of file. This problem gets uncovered by trying to pipe gunzip -c output to a GEOM device directly, which enforces the writes be multiple of sector size. Sponsored by: iXsystems, Inc. Reported by: jpaetzel MFC after: 2 weeks Modified: head/usr.bin/gzip/gzip.c Modified: head/usr.bin/gzip/gzip.c ============================================================================== --- head/usr.bin/gzip/gzip.c Thu Sep 23 01:19:31 2010 (r213043) +++ head/usr.bin/gzip/gzip.c Thu Sep 23 01:24:33 2010 (r213044) @@ -916,6 +916,8 @@ gz_uncompress(int in, int out, char *pre switch (error) { /* Z_BUF_ERROR goes with Z_FINISH... */ case Z_BUF_ERROR: + if (z.avail_out > 0 && !done_reading) + continue; case Z_STREAM_END: case Z_OK: break; From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 01:30:50 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8CF561065672; Thu, 23 Sep 2010 01:30:50 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7B9E08FC15; Thu, 23 Sep 2010 01:30:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8N1Uo2e050173; Thu, 23 Sep 2010 01:30:50 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8N1Uo8K050171; Thu, 23 Sep 2010 01:30:50 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201009230130.o8N1Uo8K050171@svn.freebsd.org> From: Xin LI Date: Thu, 23 Sep 2010 01:30:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213045 - stable/8/sys/dev/alc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 01:30:50 -0000 Author: delphij Date: Thu Sep 23 01:30:50 2010 New Revision: 213045 URL: http://svn.freebsd.org/changeset/base/213045 Log: MFC r212764: status bits should be &'ed against status to be really functional. Reported by: Jike Song Reviewed by: yongari Modified: stable/8/sys/dev/alc/if_alc.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/alc/if_alc.c ============================================================================== --- stable/8/sys/dev/alc/if_alc.c Thu Sep 23 01:24:33 2010 (r213044) +++ stable/8/sys/dev/alc/if_alc.c Thu Sep 23 01:30:50 2010 (r213045) @@ -2948,8 +2948,8 @@ alc_rxeof(struct alc_softc *sc, struct r * errored frames. */ status |= RRD_TCP_UDPCSUM_NOK | RRD_IPCSUM_NOK; - if ((RRD_ERR_CRC | RRD_ERR_ALIGN | RRD_ERR_TRUNC | - RRD_ERR_RUNT) != 0) + if ((status & (RRD_ERR_CRC | RRD_ERR_ALIGN | + RRD_ERR_TRUNC | RRD_ERR_RUNT)) != 0) return; } From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 01:38:53 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B0484106566C; Thu, 23 Sep 2010 01:38:52 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9EF4B8FC0C; Thu, 23 Sep 2010 01:38:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8N1cqXH050385; Thu, 23 Sep 2010 01:38:52 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8N1cqJI050383; Thu, 23 Sep 2010 01:38:52 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201009230138.o8N1cqJI050383@svn.freebsd.org> From: Xin LI Date: Thu, 23 Sep 2010 01:38:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213046 - stable/7/sys/dev/alc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 01:38:53 -0000 Author: delphij Date: Thu Sep 23 01:38:52 2010 New Revision: 213046 URL: http://svn.freebsd.org/changeset/base/213046 Log: MFC r212764: status bits should be &'ed against status to be really functional. Reported by: Jike Song Reviewed by: yongari Modified: stable/7/sys/dev/alc/if_alc.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/alc/if_alc.c ============================================================================== --- stable/7/sys/dev/alc/if_alc.c Thu Sep 23 01:30:50 2010 (r213045) +++ stable/7/sys/dev/alc/if_alc.c Thu Sep 23 01:38:52 2010 (r213046) @@ -2948,8 +2948,8 @@ alc_rxeof(struct alc_softc *sc, struct r * errored frames. */ status |= RRD_TCP_UDPCSUM_NOK | RRD_IPCSUM_NOK; - if ((RRD_ERR_CRC | RRD_ERR_ALIGN | RRD_ERR_TRUNC | - RRD_ERR_RUNT) != 0) + if ((status & (RRD_ERR_CRC | RRD_ERR_ALIGN | + RRD_ERR_TRUNC | RRD_ERR_RUNT)) != 0) return; } From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 05:17:37 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 263BC1065670; Thu, 23 Sep 2010 05:17:37 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 15D9E8FC0C; Thu, 23 Sep 2010 05:17:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8N5Ha3T054810; Thu, 23 Sep 2010 05:17:36 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8N5Hapb054808; Thu, 23 Sep 2010 05:17:36 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201009230517.o8N5Hapb054808@svn.freebsd.org> From: "Jayachandran C." Date: Thu, 23 Sep 2010 05:17:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213047 - head/sys/dev/ata/chipsets X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 05:17:37 -0000 Author: jchandra Date: Thu Sep 23 05:17:36 2010 New Revision: 213047 URL: http://svn.freebsd.org/changeset/base/213047 Log: Add missing byteswap, works on big endian systems now (tested on Netlogic XLS MIPS processor). Submitted by: Sreekanth M. S. Reviewed by: mav Modified: head/sys/dev/ata/chipsets/ata-siliconimage.c Modified: head/sys/dev/ata/chipsets/ata-siliconimage.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-siliconimage.c Thu Sep 23 01:38:52 2010 (r213046) +++ head/sys/dev/ata/chipsets/ata-siliconimage.c Thu Sep 23 05:17:36 2010 (r213047) @@ -649,7 +649,7 @@ ata_siiprb_end_transaction(struct ata_re /* update progress */ if (!(request->status & ATA_S_ERROR) && !(request->flags & ATA_R_TIMEOUT)) { if (request->flags & ATA_R_READ) - request->donecount = prb->transfer_count; + request->donecount = le32toh(prb->transfer_count); else request->donecount = request->bytecount; } From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 05:24:50 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CAF461065695; Thu, 23 Sep 2010 05:24:50 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BADE68FC08; Thu, 23 Sep 2010 05:24:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8N5OoVE055001; Thu, 23 Sep 2010 05:24:50 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8N5Oo9R054999; Thu, 23 Sep 2010 05:24:50 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201009230524.o8N5Oo9R054999@svn.freebsd.org> From: "Jayachandran C." Date: Thu, 23 Sep 2010 05:24:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213048 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 05:24:50 -0000 Author: jchandra Date: Thu Sep 23 05:24:50 2010 New Revision: 213048 URL: http://svn.freebsd.org/changeset/base/213048 Log: Add MIPS platform, this will make bsdlabel(8) work on MIPS (when invoked without a -m option. -m mips is still not supported) Modified: head/sys/sys/disklabel.h Modified: head/sys/sys/disklabel.h ============================================================================== --- head/sys/sys/disklabel.h Thu Sep 23 05:17:36 2010 (r213047) +++ head/sys/sys/disklabel.h Thu Sep 23 05:24:50 2010 (r213048) @@ -52,7 +52,7 @@ /* XXX these should be defined per controller (or drive) elsewhere, not here! */ #if defined(__i386__) || defined(__amd64__) || defined(__arm__) || \ - defined(__ia64__) || defined(__powerpc__) + defined(__ia64__) || defined(__powerpc__) || defined(__mips__) #define LABELSECTOR 1 /* sector containing label */ #define LABELOFFSET 0 /* offset of label in sector */ #endif From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 09:02:10 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CCEB01065672; Thu, 23 Sep 2010 09:02:10 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B94138FC13; Thu, 23 Sep 2010 09:02:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8N92AUg059374; Thu, 23 Sep 2010 09:02:10 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8N92AhE059361; Thu, 23 Sep 2010 09:02:10 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009230902.o8N92AhE059361@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 23 Sep 2010 09:02:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213049 - stable/8/sbin/hastd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 09:02:10 -0000 Author: pjd Date: Thu Sep 23 09:02:10 2010 New Revision: 213049 URL: http://svn.freebsd.org/changeset/base/213049 Log: MFC r208028,r210368,r210702,r210869,r210870,r210872,r210873,r210875,r210876, r210879,r210880,r210881,r210882,r210883,r210886,r210892,r211397,r211407, r211452,r211875,r211876,r211877,r211878,r211879,r211880,r211881,r211882, r211883,r211884,r211885,r211886,r211887,r211895,r211896,r211897,r211898, r211899,r211975,r211976,r211977,r211978,r211979,r211981,r211982,r211983, r211984,r212033,r212034,r212036,r212037,r212038,r212046,r212049,r212051, r212052,r212899,r213003,r213004,r213006,r213007,r213008,r213009: r208028: mdoc: move remaining sections into consistent order This pertains mostly to FILES, HISTORY, EXIT STATUS and AUTHORS sections. Found by: mdocml lint run Reviewed by: ru r210368: Actually, only the fullsync mode is implemented, not memsync mode. Correct manual page. r210702: Spelling fixes. r210869: Add an argument to the proto_register() function which allows protocol to declare it is the default and be placed at the end of the queue so it is checked last. r210870: Now that TCP will be checked last we don't need any knowledge about other protocols. r210872: Mark two more places that we won't reach. r210873: Keep $FreeBSD$ in __FBSDID() only for C files. r210875: Problem with assertion is that it logs on stderr. Add two macros: PJDLOG_ASSERT() and PJDLOG_VERIFY() that will check the given condition and log the problem where appropriate. The difference between those two is that PJDLOG_VERIFY() always work and PJDLOG_ASSERT() can be turned off by defining NDEBUG. r210876: Assert that various buffers we are large enough. r210879: - Use pjdlog_exitx() to log errors and exit instead of errx(). - Use 'unable to' (instead of 'cannot') consistently. r210880: Reset signal handlers after fork(). r210881: Allow to use 'none' keywork as remote address in case second cluster node is not setup yet. r210882: Make control_set_role() more public. We will need it soon. r210883: Prepare configuration parsing code to be called multiple times: - Don't exit on errors if not requested. - Don't keep configuration in global variable, but allocate memory for configuration. - Call yyrestart() before yyparse() so that on error in configuration file we will start from the begining next time and not from the place we left of. r210886: Implement configuration reload on SIGHUP. This includes: - Load added resources. - Stop and forget removed resources. - Update modified resources in least intrusive way, ie. don't touch /dev/hast/ unless path to local component or provider name were modified. Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com r210892: Document 'none' value for remote. Reviewed by: dougb r211397: Fix typos, spelling, formatting and mdoc mistakes found by Nobuyuki while translating these manual pages. Minor corrections by me. Submitted by: Nobuyuki Koganemaru r211407: The 'size' variable is there to limit how many bytes we want to copy from 'addr'. It is very likely that size of 'addr' is larger than 'size', so checking strlcpy() return value is bogus. r211452: For some setups sending data in 128kB chunks makes communication very slow. No idea why. 32kB on the other hand seems to work properly everywhere. Reported by: Thomas Steen Rasmussen r211875: Make comment more readable. Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com r211876: Add mtx_owned() implementation. Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com r211877: Add QUEUE_INSERT() and QUEUE_TAKE() macros that simplify the code a bit. Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com r211878: We have sync_start() function to start synchronization, introduce sync_stop() function to stop it. Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com r211879: Log that synchronization was interrupted in a proper place. Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com r211880: Don't increase number synchronized bytes in case of an error. Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com r211881: - Remove redundant and incorrect 'old' word from debug message. - Log disconnects as warnings. Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com r211882: Implement keepalive mechanism inside HAST protocol so we can detect secondary node failures quickly for HAST resources that are rarely modified. Remove XXX from a comment now that the guard thread never sleeps infinitely. Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com r211883: Reduce indent where possible. Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com r211884: When logging to stdout/stderr don't close those descriptors after fork(). Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com r211885: - Run hooks in background - don't block waiting for them to finish. - Keep all hooks we're running in a global list, so we can report when they finish and also report when they are running for too long. Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com r211886: Allow to execute specified program on various HAST events. Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com r211887: Document new 'exec' parameter. Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com r211895: Add hooks execution. Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com r211896: Check if no signals were delivered just before going to sleep. Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com r211897: Correct when we log interrupted synchronization. Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com r211898: When logging to stdout/stderr, flush after each log. Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com r211899: When SIGTERM or SIGINT is received, terminate worker processes. Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com r211975: Implement mtx_destroy() and rw_destroy(). Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com r211976: - Add hook_fini() which should be called after fork() from the main hastd process, once it start to use hooks. - Add hook_check_one() in case the caller expects different child processes and once it can recognize it, it will pass pid and status to hook_check_one(). Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com r211977: Allow to run hooks from the main hastd process. Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com r211978: - Call hook on role change. - Document new event. Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com r211979: Disconnect after logging errors. Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com r211981: - Move functionality responsible for checking one connection to separate function to make code more readable. - Be sure not to reconnect too often in case of signal delivery, etc. Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com r211982: Use sigtimedwait(2) for signals handling in primary process. This fixes various races and eliminates use of pthread* API in signal handler. Pointed out by: kib With help from: jilles Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com r211983: Execute hook when split-brain is detected. Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com r211984: Execute hook when connection between the nodes is established or lost. Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com r212033: Constify arguments we can constify. Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com r212034: Use pjdlog_exit() before fork(). Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com r212036: When someone gives NULL as data, assume this is because he want to declare connection side only. Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com r212037: We only want to know if descriptors are ready for reading. Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com r212038: Because it is very hard to make fork(2) from threaded process safe (we are limited to async-signal safe functions in the child process), move all hooks execution to the main (non-threaded) process. Do it by maintaining connection (socketpair) between child and parent and sending events from the child to parent, so it can execute the hook. This is step in right direction for others reasons too. For example there is one less problem to drop privs in worker processes. Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com r212046: Mask only those signals that we want to handle. Suggested by: jilles Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com r212049: Forgot to add event.c and event.h in r212038. Pointed out by: pluknet Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com r212051: Correct error message. Submitted by: Mikolaj Golub r212052: Include process PID in log messages. Submitted by: Mikolaj Golub r212899: Add __dead2 to functions that we know they are going to exit. r213003: Sort includes. r213004: If we are unable to receive control message is most likely because the main process died. Instead of entering infinite loop, terminate. r213006: Fix descriptor leaks: when child exits, we have to close control and event socket pairs. We did that only in one case out of three. r213007: Fix possible deadlock where worker process sends an event to the main process while the main process sends control message to the worker process, but worker process hasn't started control thread yet, because it waits for reply from the main process. The fix is to start the control thread before sending any events. Reported and fix suggested by: Mikolaj Golub r213008: Assert that descriptor numbers are sane. r213009: Switch to sigprocmask(2) API also in the main process and secondary process. This way the primary process inherits signal mask from the main process, which fixes a race where signal is delivered to the primary process before configuring signal mask. Reported by: Mikolaj Golub Added: stable/8/sbin/hastd/event.c - copied unchanged from r212049, head/sbin/hastd/event.c stable/8/sbin/hastd/event.h - copied unchanged from r212049, head/sbin/hastd/event.h Modified: stable/8/sbin/hastd/Makefile stable/8/sbin/hastd/control.c stable/8/sbin/hastd/control.h stable/8/sbin/hastd/hast.conf.5 stable/8/sbin/hastd/hast.h stable/8/sbin/hastd/hast_proto.c stable/8/sbin/hastd/hast_proto.h stable/8/sbin/hastd/hastd.8 stable/8/sbin/hastd/hastd.c stable/8/sbin/hastd/hastd.h stable/8/sbin/hastd/hooks.c stable/8/sbin/hastd/hooks.h stable/8/sbin/hastd/parse.y stable/8/sbin/hastd/pjdlog.c stable/8/sbin/hastd/pjdlog.h stable/8/sbin/hastd/primary.c stable/8/sbin/hastd/proto.c stable/8/sbin/hastd/proto.h stable/8/sbin/hastd/proto_common.c stable/8/sbin/hastd/proto_impl.h stable/8/sbin/hastd/proto_socketpair.c stable/8/sbin/hastd/proto_tcp4.c stable/8/sbin/hastd/proto_uds.c stable/8/sbin/hastd/secondary.c stable/8/sbin/hastd/synch.h stable/8/sbin/hastd/token.l Directory Properties: stable/8/sbin/hastd/ (props changed) Modified: stable/8/sbin/hastd/Makefile ============================================================================== --- stable/8/sbin/hastd/Makefile Thu Sep 23 05:24:50 2010 (r213048) +++ stable/8/sbin/hastd/Makefile Thu Sep 23 09:02:10 2010 (r213049) @@ -5,7 +5,7 @@ PROG= hastd SRCS= activemap.c SRCS+= control.c -SRCS+= ebuf.c +SRCS+= ebuf.c event.c SRCS+= hast_proto.c hastd.c hooks.c SRCS+= metadata.c SRCS+= nv.c Modified: stable/8/sbin/hastd/control.c ============================================================================== --- stable/8/sbin/hastd/control.c Thu Sep 23 05:24:50 2010 (r213048) +++ stable/8/sbin/hastd/control.c Thu Sep 23 09:02:10 2010 (r213049) @@ -32,17 +32,19 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include +#include #include #include +#include #include "hast.h" #include "hastd.h" #include "hast_proto.h" +#include "hooks.h" #include "nv.h" #include "pjdlog.h" #include "proto.h" @@ -50,19 +52,31 @@ __FBSDID("$FreeBSD$"); #include "control.h" -static void -control_set_role(struct hastd_config *cfg, struct nv *nvout, uint8_t role, - struct hast_resource *res, const char *name, unsigned int no) +void +child_cleanup(struct hast_resource *res) { - assert(cfg != NULL); - assert(nvout != NULL); - assert(name != NULL); + proto_close(res->hr_ctrl); + res->hr_ctrl = NULL; + proto_close(res->hr_event); + res->hr_event = NULL; + res->hr_workerpid = 0; +} + +static void +control_set_role_common(struct hastd_config *cfg, struct nv *nvout, + uint8_t role, struct hast_resource *res, const char *name, unsigned int no) +{ + int oldrole; /* Name is always needed. */ - nv_add_string(nvout, name, "resource%u", no); + if (name != NULL) + nv_add_string(nvout, name, "resource%u", no); if (res == NULL) { + assert(cfg != NULL); + assert(name != NULL); + TAILQ_FOREACH(res, &cfg->hc_resources, hr_next) { if (strcmp(res->hr_name, name) == 0) break; @@ -85,6 +99,7 @@ control_set_role(struct hastd_config *cf pjdlog_info("Role changed to %s.", role2str(role)); /* Change role to the new one. */ + oldrole = res->hr_role; res->hr_role = role; pjdlog_prefix_set("[%s] (%s) ", res->hr_name, role2str(res->hr_role)); @@ -106,13 +121,22 @@ control_set_role(struct hastd_config *cf pjdlog_debug(1, "Worker process %u stopped.", (unsigned int)res->hr_workerpid); } - res->hr_workerpid = 0; + child_cleanup(res); } /* Start worker process if we are changing to primary. */ if (role == HAST_ROLE_PRIMARY) hastd_primary(res); pjdlog_prefix_set("%s", ""); + hook_exec(res->hr_exec, "role", res->hr_name, role2str(oldrole), + role2str(res->hr_role), NULL); +} + +void +control_set_role(struct hast_resource *res, uint8_t role) +{ + + control_set_role_common(NULL, NULL, role, res, NULL, 0); } static void @@ -306,7 +330,7 @@ control_handle(struct hastd_config *cfg) TAILQ_FOREACH(res, &cfg->hc_resources, hr_next) { switch (cmd) { case HASTCTL_SET_ROLE: - control_set_role(cfg, nvout, role, res, + control_set_role_common(cfg, nvout, role, res, res->hr_name, ii++); break; case HASTCTL_STATUS: @@ -329,8 +353,8 @@ control_handle(struct hastd_config *cfg) break; switch (cmd) { case HASTCTL_SET_ROLE: - control_set_role(cfg, nvout, role, NULL, str, - ii); + control_set_role_common(cfg, nvout, role, NULL, + str, ii); break; case HASTCTL_STATUS: control_status(cfg, nvout, NULL, str, ii); @@ -375,7 +399,8 @@ ctrl_thread(void *arg) pthread_exit(NULL); pjdlog_errno(LOG_ERR, "Unable to receive control message"); - continue; + kill(getpid(), SIGTERM); + pthread_exit(NULL); } cmd = nv_get_uint8(nvin, "cmd"); if (cmd == 0) { Modified: stable/8/sbin/hastd/control.h ============================================================================== --- stable/8/sbin/hastd/control.h Thu Sep 23 05:24:50 2010 (r213048) +++ stable/8/sbin/hastd/control.h Thu Sep 23 09:02:10 2010 (r213049) @@ -36,6 +36,11 @@ #define HASTCTL_STATUS 2 struct hastd_config; +struct hast_resource; + +void child_cleanup(struct hast_resource *res); + +void control_set_role(struct hast_resource *res, uint8_t role); void control_handle(struct hastd_config *cfg); Copied: stable/8/sbin/hastd/event.c (from r212049, head/sbin/hastd/event.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sbin/hastd/event.c Thu Sep 23 09:02:10 2010 (r213049, copy of r212049, head/sbin/hastd/event.c) @@ -0,0 +1,162 @@ +/*- + * Copyright (c) 2010 Pawel Jakub Dawidek + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include "hast.h" +#include "hast_proto.h" +#include "hooks.h" +#include "nv.h" +#include "pjdlog.h" +#include "proto.h" +#include "subr.h" + +#include "event.h" + +void +event_send(const struct hast_resource *res, int event) +{ + struct nv *nvin, *nvout; + int error; + + assert(res != NULL); + assert(event >= EVENT_MIN && event <= EVENT_MAX); + + nvin = nvout = NULL; + + /* + * Prepare and send event to parent process. + */ + nvout = nv_alloc(); + nv_add_uint8(nvout, (uint8_t)event, "event"); + error = nv_error(nvout); + if (error != 0) { + pjdlog_common(LOG_ERR, 0, error, + "Unable to prepare event header"); + goto done; + } + if (hast_proto_send(res, res->hr_event, nvout, NULL, 0) < 0) { + pjdlog_errno(LOG_ERR, "Unable to send event header"); + goto done; + } + if (hast_proto_recv_hdr(res->hr_event, &nvin) < 0) { + pjdlog_errno(LOG_ERR, "Unable to receive event header"); + goto done; + } + /* + * Do nothing with the answer. We only wait for it to be sure not + * to exit too quickly after sending an event and exiting immediately. + */ +done: + if (nvin != NULL) + nv_free(nvin); + if (nvout != NULL) + nv_free(nvout); +} + +int +event_recv(const struct hast_resource *res) +{ + struct nv *nvin, *nvout; + const char *evstr; + uint8_t event; + int error; + + assert(res != NULL); + + nvin = nvout = NULL; + + if (hast_proto_recv_hdr(res->hr_event, &nvin) < 0) { + /* + * First error log as debug. This is because worker process + * most likely exited. + */ + pjdlog_common(LOG_DEBUG, 1, errno, + "Unable to receive event header"); + goto fail; + } + + event = nv_get_uint8(nvin, "event"); + if (event == EVENT_NONE) { + pjdlog_error("Event header is missing 'event' field."); + goto fail; + } + + switch (event) { + case EVENT_CONNECT: + evstr = "connect"; + break; + case EVENT_DISCONNECT: + evstr = "disconnect"; + break; + case EVENT_SYNCSTART: + evstr = "syncstart"; + break; + case EVENT_SYNCDONE: + evstr = "syncdone"; + break; + case EVENT_SYNCINTR: + evstr = "syncintr"; + break; + case EVENT_SPLITBRAIN: + evstr = "split-brain"; + break; + default: + pjdlog_error("Event header contain invalid event number (%hhu).", + event); + goto fail; + } + + pjdlog_prefix_set("[%s] (%s) ", res->hr_name, role2str(res->hr_role)); + hook_exec(res->hr_exec, evstr, res->hr_name, NULL); + pjdlog_prefix_set("%s", ""); + + nvout = nv_alloc(); + nv_add_int16(nvout, 0, "error"); + error = nv_error(nvout); + if (error != 0) { + pjdlog_common(LOG_ERR, 0, error, + "Unable to prepare event header"); + goto fail; + } + if (hast_proto_send(res, res->hr_event, nvout, NULL, 0) < 0) { + pjdlog_errno(LOG_ERR, "Unable to send event header"); + goto fail; + } + nv_free(nvin); + nv_free(nvout); + return (0); +fail: + if (nvin != NULL) + nv_free(nvin); + if (nvout != NULL) + nv_free(nvout); + return (-1); +} Copied: stable/8/sbin/hastd/event.h (from r212049, head/sbin/hastd/event.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sbin/hastd/event.h Thu Sep 23 09:02:10 2010 (r213049, copy of r212049, head/sbin/hastd/event.h) @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 2010 Pawel Jakub Dawidek + * 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$ + */ + +#ifndef _EVENT_H_ +#define _EVENT_H_ + +#define EVENT_NONE 0 +#define EVENT_CONNECT 1 +#define EVENT_DISCONNECT 2 +#define EVENT_SYNCSTART 3 +#define EVENT_SYNCDONE 4 +#define EVENT_SYNCINTR 5 +#define EVENT_SPLITBRAIN 6 + +#define EVENT_MIN EVENT_CONNECT +#define EVENT_MAX EVENT_SPLITBRAIN + +void event_send(const struct hast_resource *res, int event); +int event_recv(const struct hast_resource *res); + +#endif /* !_EVENT_H_ */ Modified: stable/8/sbin/hastd/hast.conf.5 ============================================================================== --- stable/8/sbin/hastd/hast.conf.5 Thu Sep 23 05:24:50 2010 (r213048) +++ stable/8/sbin/hastd/hast.conf.5 Thu Sep 23 09:02:10 2010 (r213049) @@ -1,4 +1,5 @@ .\" Copyright (c) 2010 The FreeBSD Foundation +.\" Copyright (c) 2010 Pawel Jakub Dawidek .\" All rights reserved. .\" .\" This software was developed by Pawel Jakub Dawidek under sponsorship from @@ -27,14 +28,14 @@ .\" .\" $FreeBSD$ .\" -.Dd February 1, 2010 +.Dd August 30, 2010 .Dt HAST.CONF 5 .Os .Sh NAME .Nm hast.conf .Nd configuration file for the .Xr hastd 8 -deamon and the +daemon and the .Xr hastctl 8 utility. .Sh DESCRIPTION @@ -59,6 +60,7 @@ control listen replication timeout +exec on { # Node section @@ -78,6 +80,7 @@ resource { name local timeout + exec on { # Resource-node section @@ -169,14 +172,16 @@ The only situation where some small amou the data is stored on primary node and sent to the secondary. Secondary node then acknowledges data receipt and primary reports success to an application. -However, it may happen that the seconderay goes down before the received +However, it may happen that the secondary goes down before the received data is really stored locally. Before secondary node returns, primary node dies entirely. When the secondary node comes back to life it becomes the new primary. Unfortunately some small amount of data which was confirmed to be stored to the application was lost. -The risk of such a situation is very small, which is the reason for this -mode to be the default. +The risk of such a situation is very small. +The +.Ic memsync +replication mode is currently not implemented. .It Ic fullsync .Pp Mark the write operation as completed when local as well as remote @@ -184,7 +189,7 @@ write completes. This is the safest and the slowest replication mode. The .Ic fullsync -replication mode is currently not implemented. +replication mode is the default. .It Ic async .Pp The write operation is reported as complete right after the local write @@ -201,6 +206,76 @@ replication mode is currently not implem Connection timeout in seconds. The default value is .Va 5 . +.It Ic exec Aq path +.Pp +Execute the given program on various HAST events. +Below is the list of currently implemented events and arguments the given +program is executed with: +.Bl -tag -width ".Ic xxxx" +.It Ic " role " +.Pp +Executed on both primary and secondary nodes when resource role is changed. +.Pp +.It Ic " connect " +.Pp +Executed on both primary and secondary nodes when connection for the given +resource between the nodes is established. +.Pp +.It Ic " disconnect " +.Pp +Executed on both primary and secondary nodes when connection for the given +resource between the nodes is lost. +.Pp +.It Ic " syncstart " +.Pp +Executed on primary node when synchronization process of secondary node is +started. +.Pp +.It Ic " syncdone " +.Pp +Executed on primary node when synchronization process of secondary node is +completed successfully. +.Pp +.It Ic " syncintr " +.Pp +Executed on primary node when synchronization process of secondary node is +interrupted, most likely due to secondary node outage or connection failure +between the nodes. +.Pp +.It Ic " split-brain " +.Pp +Executed on both primary and secondary nodes when split-brain condition is +detected. +.Pp +.El +The +.Aq path +argument should contain full path to executable program. +If the given program exits with code different than +.Va 0 , +.Nm hastd +will log it as an error. +.Pp +The +.Aq resource +argument is resource name from the configuration file. +.Pp +The +.Aq oldrole +argument is previous resource role (before the change). +It can be one of: +.Ar init , +.Ar secondary , +.Ar primary . +.Pp +The +.Aq newrole +argument is current resource role (after the change). +It can be one of: +.Ar init , +.Ar secondary , +.Ar primary . +.Pp .It Ic name Aq name .Pp GEOM provider name that will appear as @@ -223,6 +298,24 @@ When operating as a primary node this ad the secondary node. When operating as a secondary node only connections from this address will be accepted. +.Pp +A special value of +.Va none +can be used when the remote address is not yet known (eg. the other node is not +set up yet). +.El +.Sh FILES +.Bl -tag -width ".Pa /var/run/hastctl" -compact +.It Pa /etc/hast.conf +The default +.Nm +configuration file. +.It Pa /var/run/hastctl +Control socket used by the +.Xr hastctl 8 +control utility to communicate with the +.Xr hastd 8 +daemon. .El .Sh EXAMPLES The example configuration file can look as follows: @@ -248,19 +341,6 @@ resource tank { } } .Ed -.Sh FILES -.Bl -tag -width ".Pa /var/run/hastctl" -compact -.It Pa /etc/hast.conf -The default -.Nm -configuration file. -.It Pa /var/run/hastctl -Control socket used by the -.Xr hastctl 8 -control utility to communicate with the -.Xr hastd 8 -daemon. -.El .Sh SEE ALSO .Xr gethostname 3 , .Xr geom 4 , Modified: stable/8/sbin/hastd/hast.h ============================================================================== --- stable/8/sbin/hastd/hast.h Thu Sep 23 05:24:50 2010 (r213048) +++ stable/8/sbin/hastd/hast.h Thu Sep 23 09:02:10 2010 (r213049) @@ -48,7 +48,12 @@ #include "proto.h" -#define HAST_PROTO_VERSION 0 +/* + * Version history: + * 0 - initial version + * 1 - HIO_KEEPALIVE added + */ +#define HAST_PROTO_VERSION 1 #define EHAST_OK 0 #define EHAST_NOENTRY 1 @@ -74,6 +79,7 @@ #define HIO_WRITE 2 #define HIO_DELETE 3 #define HIO_FLUSH 4 +#define HIO_KEEPALIVE 5 #define HAST_TIMEOUT 5 #define HAST_CONFIG "/etc/hast.conf" @@ -121,6 +127,8 @@ struct hast_resource { int hr_extentsize; /* Maximum number of extents that are kept dirty. */ int hr_keepdirty; + /* Path to a program to execute on various events. */ + char hr_exec[PATH_MAX]; /* Path to local component. */ char hr_localpath[PATH_MAX]; @@ -173,6 +181,8 @@ struct hast_resource { pid_t hr_workerpid; /* Control connection between parent and child. */ struct proto_conn *hr_ctrl; + /* Events from child to parent. */ + struct proto_conn *hr_event; /* Activemap structure. */ struct activemap *hr_amp; @@ -183,7 +193,7 @@ struct hast_resource { TAILQ_ENTRY(hast_resource) hr_next; }; -struct hastd_config *yy_config_parse(const char *config); +struct hastd_config *yy_config_parse(const char *config, bool exitonerror); void yy_config_free(struct hastd_config *config); void yyerror(const char *); Modified: stable/8/sbin/hastd/hast_proto.c ============================================================================== --- stable/8/sbin/hastd/hast_proto.c Thu Sep 23 05:24:50 2010 (r213048) +++ stable/8/sbin/hastd/hast_proto.c Thu Sep 23 09:02:10 2010 (r213049) @@ -56,8 +56,10 @@ struct hast_main_header { uint32_t size; } __packed; -typedef int hps_send_t(struct hast_resource *, struct nv *nv, void **, size_t *, bool *); -typedef int hps_recv_t(struct hast_resource *, struct nv *nv, void **, size_t *, bool *); +typedef int hps_send_t(const struct hast_resource *, struct nv *nv, void **, + size_t *, bool *); +typedef int hps_recv_t(const struct hast_resource *, struct nv *nv, void **, + size_t *, bool *); struct hast_pipe_stage { const char *hps_name; @@ -65,14 +67,14 @@ struct hast_pipe_stage { hps_recv_t *hps_recv; }; -static int compression_send(struct hast_resource *res, struct nv *nv, +static int compression_send(const struct hast_resource *res, struct nv *nv, void **datap, size_t *sizep, bool *freedatap); -static int compression_recv(struct hast_resource *res, struct nv *nv, +static int compression_recv(const struct hast_resource *res, struct nv *nv, void **datap, size_t *sizep, bool *freedatap); #ifdef HAVE_CRYPTO -static int checksum_send(struct hast_resource *res, struct nv *nv, +static int checksum_send(const struct hast_resource *res, struct nv *nv, void **datap, size_t *sizep, bool *freedatap); -static int checksum_recv(struct hast_resource *res, struct nv *nv, +static int checksum_recv(const struct hast_resource *res, struct nv *nv, void **datap, size_t *sizep, bool *freedatap); #endif @@ -84,7 +86,7 @@ static struct hast_pipe_stage pipeline[] }; static int -compression_send(struct hast_resource *res, struct nv *nv, void **datap, +compression_send(const struct hast_resource *res, struct nv *nv, void **datap, size_t *sizep, bool *freedatap) { unsigned char *newbuf; @@ -132,7 +134,7 @@ compression_send(struct hast_resource *r } static int -compression_recv(struct hast_resource *res, struct nv *nv, void **datap, +compression_recv(const struct hast_resource *res, struct nv *nv, void **datap, size_t *sizep, bool *freedatap) { unsigned char *newbuf; @@ -169,7 +171,7 @@ compression_recv(struct hast_resource *r #ifdef HAVE_CRYPTO static int -checksum_send(struct hast_resource *res, struct nv *nv, void **datap, +checksum_send(const struct hast_resource *res, struct nv *nv, void **datap, size_t *sizep, bool *freedatap __unused) { unsigned char hash[SHA256_DIGEST_LENGTH]; @@ -188,7 +190,7 @@ checksum_send(struct hast_resource *res, } static int -checksum_recv(struct hast_resource *res, struct nv *nv, void **datap, +checksum_recv(const struct hast_resource *res, struct nv *nv, void **datap, size_t *sizep, bool *freedatap __unused) { unsigned char chash[SHA256_DIGEST_LENGTH]; @@ -236,7 +238,7 @@ checksum_recv(struct hast_resource *res, * There can be no data at all (data is NULL then). */ int -hast_proto_send(struct hast_resource *res, struct proto_conn *conn, +hast_proto_send(const struct hast_resource *res, struct proto_conn *conn, struct nv *nv, const void *data, size_t size) { struct hast_main_header hdr; @@ -293,7 +295,7 @@ end: } int -hast_proto_recv_hdr(struct proto_conn *conn, struct nv **nvp) +hast_proto_recv_hdr(const struct proto_conn *conn, struct nv **nvp) { struct hast_main_header hdr; struct nv *nv; @@ -335,7 +337,7 @@ fail: } int -hast_proto_recv_data(struct hast_resource *res, struct proto_conn *conn, +hast_proto_recv_data(const struct hast_resource *res, struct proto_conn *conn, struct nv *nv, void *data, size_t size) { unsigned int ii; @@ -384,7 +386,7 @@ if (ret < 0) printf("%s:%u %s\n", __func } int -hast_proto_recv(struct hast_resource *res, struct proto_conn *conn, +hast_proto_recv(const struct hast_resource *res, struct proto_conn *conn, struct nv **nvp, void *data, size_t size) { struct nv *nv; Modified: stable/8/sbin/hastd/hast_proto.h ============================================================================== --- stable/8/sbin/hastd/hast_proto.h Thu Sep 23 05:24:50 2010 (r213048) +++ stable/8/sbin/hastd/hast_proto.h Thu Sep 23 09:02:10 2010 (r213049) @@ -37,12 +37,12 @@ #include #include -int hast_proto_send(struct hast_resource *res, struct proto_conn *conn, +int hast_proto_send(const struct hast_resource *res, struct proto_conn *conn, struct nv *nv, const void *data, size_t size); -int hast_proto_recv(struct hast_resource *res, struct proto_conn *conn, +int hast_proto_recv(const struct hast_resource *res, struct proto_conn *conn, struct nv **nvp, void *data, size_t size); -int hast_proto_recv_hdr(struct proto_conn *conn, struct nv **nvp); -int hast_proto_recv_data(struct hast_resource *res, struct proto_conn *conn, - struct nv *nv, void *data, size_t size); +int hast_proto_recv_hdr(const struct proto_conn *conn, struct nv **nvp); +int hast_proto_recv_data(const struct hast_resource *res, + struct proto_conn *conn, struct nv *nv, void *data, size_t size); #endif /* !_HAST_PROTO_H_ */ Modified: stable/8/sbin/hastd/hastd.8 ============================================================================== --- stable/8/sbin/hastd/hastd.8 Thu Sep 23 05:24:50 2010 (r213048) +++ stable/8/sbin/hastd/hastd.8 Thu Sep 23 09:02:10 2010 (r213049) @@ -170,6 +170,23 @@ stored. The default location is .Pa /var/run/hastd.pid . .El +.Sh FILES +.Bl -tag -width ".Pa /var/run/hastctl" -compact +.It Pa /etc/hast.conf +The configuration file for +.Nm +and +.Xr hastctl 8 . +.It Pa /var/run/hastctl +Control socket used by the +.Xr hastctl 8 +control utility to communicate with +.Nm . +.It Pa /var/run/hastd.pid +The default location of the +.Nm +PID file. +.El .Sh EXIT STATUS Exit status is 0 on success, or one of the values described in .Xr sysexits 3 @@ -196,23 +213,6 @@ nodeA# hastctl role primary shared nodeA# newfs -U /dev/hast/shared nodeA# mount -o noatime /dev/hast/shared /shared .Ed -.Sh FILES -.Bl -tag -width ".Pa /var/run/hastctl" -compact -.It Pa /etc/hast.conf -The configuration file for -.Nm -and -.Xr hastctl 8 . -.It Pa /var/run/hastctl -Control socket used by the -.Xr hastctl 8 -control utility to communicate with -.Nm . -.It Pa /var/run/hastd.pid -The default location of the -.Nm -PID file. -.El .Sh SEE ALSO .Xr sysexits 3 , .Xr geom 4 , Modified: stable/8/sbin/hastd/hastd.c ============================================================================== --- stable/8/sbin/hastd/hastd.c Thu Sep 23 05:24:50 2010 (r213048) +++ stable/8/sbin/hastd/hastd.c Thu Sep 23 09:02:10 2010 (r213049) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2009-2010 The FreeBSD Foundation + * Copyright (c) 2010 Pawel Jakub Dawidek * All rights reserved. * * This software was developed by Pawel Jakub Dawidek under sponsorship from @@ -51,24 +52,25 @@ __FBSDID("$FreeBSD$"); #include #include "control.h" +#include "event.h" #include "hast.h" #include "hast_proto.h" #include "hastd.h" +#include "hooks.h" #include "subr.h" /* Path to configuration file. */ -static const char *cfgpath = HAST_CONFIG; +const char *cfgpath = HAST_CONFIG; /* Hastd configuration. */ static struct hastd_config *cfg; -/* Was SIGCHLD signal received? */ -static bool sigchld_received = false; -/* Was SIGHUP signal received? */ -static bool sighup_received = false; /* Was SIGINT or SIGTERM signal received? */ bool sigexit_received = false; /* PID file handle. */ struct pidfh *pfh; +/* How often check for hooks running for too long. */ +#define REPORT_INTERVAL 10 + static void usage(void) { @@ -77,22 +79,6 @@ usage(void) } static void -sighandler(int sig) -{ - - switch (sig) { - case SIGCHLD: - sigchld_received = true; - break; - case SIGHUP: - sighup_received = true; - break; - default: - assert(!"invalid condition"); - } -} - -static void g_gate_load(void) { @@ -139,15 +125,16 @@ child_exit(void) if (res == NULL) { /* * This can happen when new connection arrives and we - * cancel child responsible for the old one. + * cancel child responsible for the old one or if this + * was hook which we executed. */ + hook_check_one(pid, status); continue; } pjdlog_prefix_set("[%s] (%s) ", res->hr_name, role2str(res->hr_role)); child_exit_log(pid, status); - proto_close(res->hr_ctrl); - res->hr_workerpid = 0; + child_cleanup(res); if (res->hr_role == HAST_ROLE_PRIMARY) { /* * Restart child process if it was killed by signal @@ -169,12 +156,226 @@ child_exit(void) } } +static bool +resource_needs_restart(const struct hast_resource *res0, + const struct hast_resource *res1) +{ + + assert(strcmp(res0->hr_name, res1->hr_name) == 0); + + if (strcmp(res0->hr_provname, res1->hr_provname) != 0) + return (true); + if (strcmp(res0->hr_localpath, res1->hr_localpath) != 0) + return (true); + if (res0->hr_role == HAST_ROLE_INIT || + res0->hr_role == HAST_ROLE_SECONDARY) { + if (strcmp(res0->hr_remoteaddr, res1->hr_remoteaddr) != 0) + return (true); + if (res0->hr_replication != res1->hr_replication) + return (true); + if (res0->hr_timeout != res1->hr_timeout) + return (true); + if (strcmp(res0->hr_exec, res1->hr_exec) != 0) + return (true); + } + return (false); +} + +static bool +resource_needs_reload(const struct hast_resource *res0, + const struct hast_resource *res1) +{ + + assert(strcmp(res0->hr_name, res1->hr_name) == 0); + assert(strcmp(res0->hr_provname, res1->hr_provname) == 0); + assert(strcmp(res0->hr_localpath, res1->hr_localpath) == 0); + + if (res0->hr_role != HAST_ROLE_PRIMARY) + return (false); + + if (strcmp(res0->hr_remoteaddr, res1->hr_remoteaddr) != 0) + return (true); + if (res0->hr_replication != res1->hr_replication) + return (true); + if (res0->hr_timeout != res1->hr_timeout) + return (true); + if (strcmp(res0->hr_exec, res1->hr_exec) != 0) + return (true); + return (false); +} + static void hastd_reload(void) { + struct hastd_config *newcfg; + struct hast_resource *nres, *cres, *tres; + uint8_t role; + + pjdlog_info("Reloading configuration..."); + + newcfg = yy_config_parse(cfgpath, false); + if (newcfg == NULL) + goto failed; + + /* + * Check if control address has changed. + */ + if (strcmp(cfg->hc_controladdr, newcfg->hc_controladdr) != 0) { + if (proto_server(newcfg->hc_controladdr, + &newcfg->hc_controlconn) < 0) { + pjdlog_errno(LOG_ERR, + "Unable to listen on control address %s", + newcfg->hc_controladdr); + goto failed; + } + } + /* + * Check if listen address has changed. + */ + if (strcmp(cfg->hc_listenaddr, newcfg->hc_listenaddr) != 0) { + if (proto_server(newcfg->hc_listenaddr, + &newcfg->hc_listenconn) < 0) { + pjdlog_errno(LOG_ERR, "Unable to listen on address %s", + newcfg->hc_listenaddr); + goto failed; + } + } + /* + * Only when both control and listen sockets are successfully + * initialized switch them to new configuration. + */ + if (newcfg->hc_controlconn != NULL) { + pjdlog_info("Control socket changed from %s to %s.", + cfg->hc_controladdr, newcfg->hc_controladdr); + proto_close(cfg->hc_controlconn); + cfg->hc_controlconn = newcfg->hc_controlconn; + newcfg->hc_controlconn = NULL; + strlcpy(cfg->hc_controladdr, newcfg->hc_controladdr, + sizeof(cfg->hc_controladdr)); + } + if (newcfg->hc_listenconn != NULL) { + pjdlog_info("Listen socket changed from %s to %s.", + cfg->hc_listenaddr, newcfg->hc_listenaddr); + proto_close(cfg->hc_listenconn); + cfg->hc_listenconn = newcfg->hc_listenconn; + newcfg->hc_listenconn = NULL; + strlcpy(cfg->hc_listenaddr, newcfg->hc_listenaddr, + sizeof(cfg->hc_listenaddr)); + } - /* TODO */ - pjdlog_warning("Configuration reload is not implemented."); + /* + * Stop and remove resources that were removed from the configuration. + */ + TAILQ_FOREACH_SAFE(cres, &cfg->hc_resources, hr_next, tres) { + TAILQ_FOREACH(nres, &newcfg->hc_resources, hr_next) { + if (strcmp(cres->hr_name, nres->hr_name) == 0) + break; + } + if (nres == NULL) { + control_set_role(cres, HAST_ROLE_INIT); + TAILQ_REMOVE(&cfg->hc_resources, cres, hr_next); + pjdlog_info("Resource %s removed.", cres->hr_name); + free(cres); + } + } + /* + * Move new resources to the current configuration. + */ + TAILQ_FOREACH_SAFE(nres, &newcfg->hc_resources, hr_next, tres) { + TAILQ_FOREACH(cres, &cfg->hc_resources, hr_next) { + if (strcmp(cres->hr_name, nres->hr_name) == 0) + break; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 09:05:41 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5E2A31065679; Thu, 23 Sep 2010 09:05:41 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 438AF8FC18; Thu, 23 Sep 2010 09:05:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8N95fgd059524; Thu, 23 Sep 2010 09:05:41 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8N95fVf059521; Thu, 23 Sep 2010 09:05:41 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009230905.o8N95fVf059521@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 23 Sep 2010 09:05:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213050 - stable/8/sbin/hastctl X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 09:05:41 -0000 Author: pjd Date: Thu Sep 23 09:05:40 2010 New Revision: 213050 URL: http://svn.freebsd.org/changeset/base/213050 Log: MFC r208028,r210628,r210909,r210912,r211397: r208028: mdoc: move remaining sections into consistent order This pertains mostly to FILES, HISTORY, EXIT STATUS and AUTHORS sections. Found by: mdocml lint run Reviewed by: ru r210628: Fix typo. PR: docs/149033 Submitted by: Kolar r210909: Update the arguments to yy_config_parse() to match r210883. Choose the more conservative option ('yes' to exit on error) to match the equivalent code in hastd. r210912: Force commit to remind me about MFCing r210909. r211397: Fix typos, spelling, formatting and mdoc mistakes found by Nobuyuki while translating these manual pages. Minor corrections by me. Submitted by: Nobuyuki Koganemaru Modified: stable/8/sbin/hastctl/hastctl.8 stable/8/sbin/hastctl/hastctl.c Directory Properties: stable/8/sbin/hastctl/ (props changed) Modified: stable/8/sbin/hastctl/hastctl.8 ============================================================================== --- stable/8/sbin/hastctl/hastctl.8 Thu Sep 23 09:02:10 2010 (r213049) +++ stable/8/sbin/hastctl/hastctl.8 Thu Sep 23 09:05:40 2010 (r213050) @@ -105,7 +105,7 @@ The default extent size is Maximum number of dirty extents to keep dirty all the time. Most recently used extents are kept dirty to reduce number of metadata updates. -The default numer of most recently used extents which will be kept +The default number of most recently used extents which will be kept dirty is .Va 64 . .It Fl m Ar mediasize @@ -153,6 +153,20 @@ Print debugging information. This option can be specified multiple times to raise the verbosity level. .El +.Sh FILES +.Bl -tag -width ".Pa /var/run/hastctl" -compact +.It Pa /etc/hast.conf +Configuration file for +.Nm +and +.Xr hastd 8 . +.It Pa /var/run/hastctl +Control socket used by +.Nm +to communicate with the +.Xr hastd 8 +daemon. +.El .Sh EXIT STATUS Exit status is 0 on success, or one of the values described in .Xr sysexits 3 @@ -164,7 +178,7 @@ nodeB# hastctl create shared nodeB# hastd nodeB# hastctl role secondary shared -nodeB# hastctl create shared +nodeA# hastctl create shared nodeA# hastd nodeA# hastctl role primary shared nodeA# newfs -U /dev/hast/shared @@ -185,20 +199,6 @@ nodeB# fsck -t ufs /dev/hast/shared nodeB# mount -o noatime /dev/hast/shared /shared nodeB# application_start .Ed -.Sh FILES -.Bl -tag -width ".Pa /var/run/hastctl" -compact -.It Pa /etc/hast.conf -Configuration file for -.Nm -and -.Xr hastd 8 . -.It Pa /var/run/hastctl -Control socket used by -.Nm -to communicate with the -.Xr hastd 8 -daemon. -.El .Sh SEE ALSO .Xr sysexits 3 , .Xr geom 4 , Modified: stable/8/sbin/hastctl/hastctl.c ============================================================================== --- stable/8/sbin/hastctl/hastctl.c Thu Sep 23 09:02:10 2010 (r213049) +++ stable/8/sbin/hastctl/hastctl.c Thu Sep 23 09:05:40 2010 (r213050) @@ -432,7 +432,7 @@ main(int argc, char *argv[]) pjdlog_debug_set(debug); - cfg = yy_config_parse(cfgpath); + cfg = yy_config_parse(cfgpath, true); assert(cfg != NULL); switch (cmd) { From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 09:52:28 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4BD4F106564A; Thu, 23 Sep 2010 09:52:28 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1E2A38FC0C; Thu, 23 Sep 2010 09:52:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8N9qSGp060547; Thu, 23 Sep 2010 09:52:28 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8N9qRiu060545; Thu, 23 Sep 2010 09:52:28 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201009230952.o8N9qRiu060545@svn.freebsd.org> From: Gavin Atkinson Date: Thu, 23 Sep 2010 09:52:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213051 - stable/8/sys/dev/usb/serial X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 09:52:28 -0000 Author: gavin Date: Thu Sep 23 09:52:27 2010 New Revision: 213051 URL: http://svn.freebsd.org/changeset/base/213051 Log: Merge r211083 from head: The PL2302X can support any baud rate <= 6Mbps, allow any rate to be set. PR: usb/128324 Submitted by: Mike Durian (original patch) Modified: stable/8/sys/dev/usb/serial/uplcom.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/usb/serial/uplcom.c ============================================================================== --- stable/8/sys/dev/usb/serial/uplcom.c Thu Sep 23 09:05:40 2010 (r213050) +++ stable/8/sys/dev/usb/serial/uplcom.c Thu Sep 23 09:52:27 2010 (r213051) @@ -597,25 +597,33 @@ static const int32_t uplcom_rates[] = { static int uplcom_pre_param(struct ucom_softc *ucom, struct termios *t) { + struct uplcom_softc *sc = ucom->sc_parent; uint8_t i; DPRINTF("\n"); - /* check requested baud rate */ - - for (i = 0;; i++) { - - if (i != N_UPLCOM_RATES) { - if (uplcom_rates[i] == t->c_ospeed) { - break; - } - } else { - DPRINTF("invalid baud rate (%d)\n", t->c_ospeed); - return (EIO); + /** + * Check requested baud rate. + * + * The PL2303 can only set specific baud rates, up to 1228800 baud. + * The PL2303X can set any baud rate up to 6Mb. + * The PL2303HX rev. D can set any baud rate up to 12Mb. + * + * XXX: We currently cannot identify the PL2303HX rev. D, so treat + * it the same as the PL2303X. + */ + if (sc->sc_chiptype == TYPE_PL2303) { + for (i = 0; i < N_UPLCOM_RATES; i++) { + if (uplcom_rates[i] == t->c_ospeed) + return (0); } + } else { + if (t->c_ospeed <= 6000000) + return (0); } - return (0); + DPRINTF("uplcom_param: bad baud rate (%d)\n", t->c_ospeed); + return (EIO); } static void From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 09:56:02 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C1700106566B; Thu, 23 Sep 2010 09:56:02 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AEAE08FC1D; Thu, 23 Sep 2010 09:56:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8N9u2wx060688; Thu, 23 Sep 2010 09:56:02 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8N9u2sL060685; Thu, 23 Sep 2010 09:56:02 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201009230956.o8N9u2sL060685@svn.freebsd.org> From: Gavin Atkinson Date: Thu, 23 Sep 2010 09:56:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213052 - in stable/8/sys/dev/usb: . serial X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 09:56:03 -0000 Author: gavin Date: Thu Sep 23 09:56:02 2010 New Revision: 213052 URL: http://svn.freebsd.org/changeset/base/213052 Log: Merge r211111 from head: Attempt to autodetect the cype of chipset, rather than storing this within the device table. This code uses the same algorithm as used in the Linux, NetBSD and DragonflyBSD driver. While investigating this, it became apparent that the Linux driver always initialises the device, and not just in the PL2303HX case. Change uplcom(4) to do the same. This change allows us to synchronize our device ID list with Linux and NetBSD, without requiring knowledge of the chipset in use. Merge r209967, 209968 from head (by takawata): One more Prolific serial device ID. Modified: stable/8/sys/dev/usb/serial/uplcom.c stable/8/sys/dev/usb/usbdevs Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/usb/serial/uplcom.c ============================================================================== --- stable/8/sys/dev/usb/serial/uplcom.c Thu Sep 23 09:52:27 2010 (r213051) +++ stable/8/sys/dev/usb/serial/uplcom.c Thu Sep 23 09:56:02 2010 (r213052) @@ -144,7 +144,7 @@ SYSCTL_INT(_hw_usb_uplcom, OID_AUTO, deb #define RSAQ_STATUS_DCD 0x01 #define TYPE_PL2303 0 -#define TYPE_PL2303X 1 +#define TYPE_PL2303HX 1 enum { UPLCOM_BULK_DT_WR, @@ -174,7 +174,9 @@ struct uplcom_softc { /* prototypes */ static usb_error_t uplcom_reset(struct uplcom_softc *, struct usb_device *); -static int uplcom_pl2303x_init(struct usb_device *); +static usb_error_t uplcom_pl2303_do(struct usb_device *, int8_t, uint8_t, + uint16_t, uint16_t, uint16_t); +static int uplcom_pl2303_init(struct usb_device *, uint8_t); static void uplcom_cfg_set_dtr(struct ucom_softc *, uint8_t); static void uplcom_cfg_set_rts(struct ucom_softc *, uint8_t); static void uplcom_cfg_set_break(struct ucom_softc *, uint8_t); @@ -243,57 +245,33 @@ static struct ucom_callback uplcom_callb .ucom_poll = &uplcom_poll, }; -#define UPLCOM_DEV(v,p,rl,rh,t) \ - { USB_VENDOR(USB_VENDOR_##v), USB_PRODUCT(USB_PRODUCT_##v##_##p), \ - USB_DEV_BCD_GTEQ(rl), USB_DEV_BCD_LTEQ(rh), USB_DRIVER_INFO(TYPE_##t) } +#define UPLCOM_DEV(v,p) \ + { USB_VENDOR(USB_VENDOR_##v), USB_PRODUCT(USB_PRODUCT_##v##_##p) } static const struct usb_device_id uplcom_devs[] = { - /* Belkin F5U257 */ - UPLCOM_DEV(BELKIN, F5U257, 0, 0xFFFF, PL2303X), - /* I/O DATA USB-RSAQ */ - UPLCOM_DEV(IODATA, USBRSAQ, 0, 0xFFFF, PL2303), - /* I/O DATA USB-RSAQ2 */ - UPLCOM_DEV(PROLIFIC, RSAQ2, 0, 0xFFFF, PL2303), - /* I/O DATA USB-RSAQ3 */ - UPLCOM_DEV(PROLIFIC, RSAQ3, 0, 0xFFFF, PL2303X), - /* PLANEX USB-RS232 URS-03 */ - UPLCOM_DEV(ATEN, UC232A, 0, 0xFFFF, PL2303), - /* TrendNet TU-S9 */ - UPLCOM_DEV(PROLIFIC, PL2303, 0x0400, 0xFFFF, PL2303X), - /* ST Lab USB-SERIAL-4 */ - UPLCOM_DEV(PROLIFIC, PL2303, 0x0300, 0x03FF, PL2303X), - /* IOGEAR/ATEN UC-232A (also ST Lab USB-SERIAL-1) */ - UPLCOM_DEV(PROLIFIC, PL2303, 0, 0x02FF, PL2303), - /* TDK USB-PHS Adapter UHA6400 */ - UPLCOM_DEV(TDK, UHA6400, 0, 0xFFFF, PL2303), - /* RATOC REX-USB60 */ - UPLCOM_DEV(RATOC, REXUSB60, 0, 0xFFFF, PL2303), - /* ELECOM UC-SGT */ - UPLCOM_DEV(ELECOM, UCSGT, 0, 0xFFFF, PL2303), - UPLCOM_DEV(ELECOM, UCSGT0, 0, 0xFFFF, PL2303), - /* Sagem USB-Serial Controller */ - UPLCOM_DEV(SAGEM, USBSERIAL, 0, 0xFFFF, PL2303X), - /* Sony Ericsson USB Cable */ - UPLCOM_DEV(SONYERICSSON, DCU10, 0, 0xFFFF, PL2303), - /* SOURCENEXT KeikaiDenwa 8 */ - UPLCOM_DEV(SOURCENEXT, KEIKAI8, 0, 0xFFFF, PL2303), - /* SOURCENEXT KeikaiDenwa 8 with charger */ - UPLCOM_DEV(SOURCENEXT, KEIKAI8_CHG, 0, 0, PL2303), - /* HAL Corporation Crossam2+USB */ - UPLCOM_DEV(HAL, IMR001, 0, 0xFFFF, PL2303), - /* Sitecom USB to Serial */ - UPLCOM_DEV(SITECOM, SERIAL, 0, 0xFFFF, PL2303), - /* Tripp-Lite U209-000-R */ - UPLCOM_DEV(TRIPPLITE, U209, 0, 0xFFFF, PL2303X), - UPLCOM_DEV(RADIOSHACK, USBCABLE, 0, 0xFFFF, PL2303), - /* Prolific Pharos */ - UPLCOM_DEV(PROLIFIC, PHAROS, 0, 0xFFFF, PL2303), - /* Willcom W-SIM */ - UPLCOM_DEV(PROLIFIC2, WSIM, 0, 0xFFFF, PL2303X), - /* Mobile Action MA-620 Infrared Adapter */ - UPLCOM_DEV(MOBILEACTION, MA620, 0, 0xFFFF, PL2303X), - /* Corega CG-USBRS232R */ - UPLCOM_DEV(COREGA, CGUSBRS232R, 0, 0xFFFF, PL2303X), + UPLCOM_DEV(ATEN, UC232A), /* PLANEX USB-RS232 URS-03 */ + UPLCOM_DEV(BELKIN, F5U257), /* Belkin F5U257 */ + UPLCOM_DEV(COREGA, CGUSBRS232R), /* Corega CG-USBRS232R */ + UPLCOM_DEV(ELECOM, UCSGT), /* ELECOM UC-SGT */ + UPLCOM_DEV(ELECOM, UCSGT0), /* ELECOM UC-SGT */ + UPLCOM_DEV(HAL, IMR001), /* HAL Corporation Crossam2+USB */ + UPLCOM_DEV(IODATA, USBRSAQ), /* I/O DATA USB-RSAQ */ + UPLCOM_DEV(IODATA, USBRSAQ5), /* I/O DATA USB-RSAQ5 */ + UPLCOM_DEV(MOBILEACTION, MA620), /* Mobile Action MA-620 Infrared Adapter */ + UPLCOM_DEV(PROLIFIC, PHAROS), /* Prolific Pharos */ + UPLCOM_DEV(PROLIFIC, PL2303), /* Generic */ + UPLCOM_DEV(PROLIFIC, RSAQ2), /* I/O DATA USB-RSAQ2 */ + UPLCOM_DEV(PROLIFIC, RSAQ3), /* I/O DATA USB-RSAQ3 */ + UPLCOM_DEV(PROLIFIC2, WSIM), /* Willcom W-SIM */ + UPLCOM_DEV(RADIOSHACK, USBCABLE), + UPLCOM_DEV(RATOC, REXUSB60), /* RATOC REX-USB60 */ + UPLCOM_DEV(SAGEM, USBSERIAL), /* Sagem USB-Serial Controller */ + UPLCOM_DEV(SITECOM, SERIAL), /* Sitecom USB to Serial */ + UPLCOM_DEV(SONYERICSSON, DCU10), /* Sony Ericsson USB Cable */ + UPLCOM_DEV(SOURCENEXT, KEIKAI8), /* SOURCENEXT KeikaiDenwa 8 */ + UPLCOM_DEV(SOURCENEXT, KEIKAI8_CHG), /* SOURCENEXT KeikaiDenwa 8 with charger */ + UPLCOM_DEV(TDK, UHA6400), /* TDK USB-PHS Adapter UHA6400 */ + UPLCOM_DEV(TRIPPLITE, U209), /* Tripp-Lite U209-000-R */ }; #undef UPLCOM_DEV @@ -343,6 +321,7 @@ uplcom_attach(device_t dev) struct uplcom_softc *sc = device_get_softc(dev); struct usb_interface *iface; struct usb_interface_descriptor *id; + struct usb_device_descriptor *dd; int error; DPRINTFN(11, "\n"); @@ -352,11 +331,19 @@ uplcom_attach(device_t dev) DPRINTF("sc = %p\n", sc); - sc->sc_chiptype = USB_GET_DRIVER_INFO(uaa); sc->sc_udev = uaa->device; + /* Determine the chip type. This algorithm is taken from Linux. */ + dd = usbd_get_device_descriptor(sc->sc_udev); + if (dd->bDeviceClass == 0x02) + sc->sc_chiptype = TYPE_PL2303; + else if (dd->bMaxPacketSize == 0x40) + sc->sc_chiptype = TYPE_PL2303HX; + else + sc->sc_chiptype = TYPE_PL2303; + DPRINTF("chiptype: %s\n", - (sc->sc_chiptype == TYPE_PL2303X) ? + (sc->sc_chiptype == TYPE_PL2303HX) ? "2303X" : "2303"); /* @@ -420,11 +407,9 @@ uplcom_attach(device_t dev) * do the initialization during attach so that the system does not * sleep during open: */ - if (sc->sc_chiptype == TYPE_PL2303X) { - if (uplcom_pl2303x_init(uaa->device)) { - device_printf(dev, "init failed\n"); - goto detach; - } + if (uplcom_pl2303_init(uaa->device, sc->sc_chiptype)) { + device_printf(dev, "init failed\n"); + goto detach; } return (0); @@ -462,56 +447,58 @@ uplcom_reset(struct uplcom_softc *sc, st return (usbd_do_request(udev, NULL, &req, NULL)); } -struct pl2303x_init { - uint8_t req_type; - uint8_t request; - uint16_t value; - uint16_t index; - uint16_t length; -}; - -static const struct pl2303x_init pl2303x[] = { - {UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8484, 0, 1}, - {UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x0404, 0, 0}, - {UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8484, 0, 1}, - {UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8383, 0, 1}, - {UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8484, 0, 1}, - {UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x0404, 1, 0}, - {UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8484, 0, 1}, - {UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8383, 0, 1}, - {UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0, 1, 0}, - {UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 1, 0, 0}, - {UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 2, 0x44, 0}, - {UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 8, 0, 0}, - {UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 9, 0, 0}, -}; - -#define N_PL2302X_INIT (sizeof(pl2303x)/sizeof(pl2303x[0])) - -static int -uplcom_pl2303x_init(struct usb_device *udev) +static usb_error_t +uplcom_pl2303_do(struct usb_device *udev, int8_t req_type, uint8_t request, + uint16_t value, uint16_t index, uint16_t length) { struct usb_device_request req; usb_error_t err; uint8_t buf[4]; - uint8_t i; - for (i = 0; i != N_PL2302X_INIT; i++) { - req.bmRequestType = pl2303x[i].req_type; - req.bRequest = pl2303x[i].request; - USETW(req.wValue, pl2303x[i].value); - USETW(req.wIndex, pl2303x[i].index); - USETW(req.wLength, pl2303x[i].length); - - err = usbd_do_request(udev, NULL, &req, buf); - if (err) { - DPRINTF("error=%s\n", usbd_errstr(err)); - return (EIO); - } + req.bmRequestType = req_type; + req.bRequest = request; + USETW(req.wValue, value); + USETW(req.wIndex, index); + USETW(req.wLength, length); + + err = usbd_do_request(udev, NULL, &req, buf); + if (err) { + DPRINTF("error=%s\n", usbd_errstr(err)); + return (1); } return (0); } +static int +uplcom_pl2303_init(struct usb_device *udev, uint8_t chiptype) +{ + int err; + + if (uplcom_pl2303_do(udev, UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8484, 0, 1) + || uplcom_pl2303_do(udev, UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x0404, 0, 0) + || uplcom_pl2303_do(udev, UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8484, 0, 1) + || uplcom_pl2303_do(udev, UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8383, 0, 1) + || uplcom_pl2303_do(udev, UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8484, 0, 1) + || uplcom_pl2303_do(udev, UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x0404, 1, 0) + || uplcom_pl2303_do(udev, UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8484, 0, 1) + || uplcom_pl2303_do(udev, UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8383, 0, 1) + || uplcom_pl2303_do(udev, UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0, 1, 0) + || uplcom_pl2303_do(udev, UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 1, 0, 0)) + return (EIO); + + if (chiptype == TYPE_PL2303HX) + err = uplcom_pl2303_do(udev, UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 2, 0x44, 0); + else + err = uplcom_pl2303_do(udev, UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 2, 0x24, 0); + if (err) + return (EIO); + + if (uplcom_pl2303_do(udev, UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 8, 0, 0) + || uplcom_pl2303_do(udev, UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 9, 0, 0)) + return (EIO); + return (0); +} + static void uplcom_cfg_set_dtr(struct ucom_softc *ucom, uint8_t onoff) { @@ -612,7 +599,7 @@ uplcom_pre_param(struct ucom_softc *ucom * XXX: We currently cannot identify the PL2303HX rev. D, so treat * it the same as the PL2303X. */ - if (sc->sc_chiptype == TYPE_PL2303) { + if (sc->sc_chiptype != TYPE_PL2303HX) { for (i = 0; i < N_UPLCOM_RATES; i++) { if (uplcom_rates[i] == t->c_ospeed) return (0); @@ -691,7 +678,7 @@ uplcom_cfg_param(struct ucom_softc *ucom req.bmRequestType = UT_WRITE_VENDOR_DEVICE; req.bRequest = UPLCOM_SET_REQUEST; USETW(req.wValue, 0); - if (sc->sc_chiptype == TYPE_PL2303X) + if (sc->sc_chiptype == TYPE_PL2303HX) USETW(req.wIndex, UPLCOM_SET_CRTSCTS_PL2303X); else USETW(req.wIndex, UPLCOM_SET_CRTSCTS); Modified: stable/8/sys/dev/usb/usbdevs ============================================================================== --- stable/8/sys/dev/usb/usbdevs Thu Sep 23 09:52:27 2010 (r213051) +++ stable/8/sys/dev/usb/usbdevs Thu Sep 23 09:56:02 2010 (r213052) @@ -1865,6 +1865,7 @@ product IODATA RT3072_2 0x0945 RT3072 product IODATA RT3072_3 0x0947 RT3072 product IODATA RT3072_4 0x0948 RT3072 product IODATA USBRSAQ 0x0a03 Serial USB-RSAQ1 +product IODATA USBRSAQ5 0x0a0e Serial USB-RSAQ5 product IODATA2 USB2SC 0x0a09 USB2.0-SCSI Bridge USB2-SC /* Iomega products */ From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 10:03:03 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C908D106564A; Thu, 23 Sep 2010 10:03:03 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B8B7F8FC16; Thu, 23 Sep 2010 10:03:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8NA33IQ060959; Thu, 23 Sep 2010 10:03:03 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8NA33Yt060957; Thu, 23 Sep 2010 10:03:03 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009231003.o8NA33Yt060957@svn.freebsd.org> From: Marius Strobl Date: Thu, 23 Sep 2010 10:03:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213053 - head/usr.bin/tftp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 10:03:03 -0000 Author: marius Date: Thu Sep 23 10:03:03 2010 New Revision: 213053 URL: http://svn.freebsd.org/changeset/base/213053 Log: Remove an explicit assignment of the CFLAGS variable intended for debugging purposes only. MFC after: 3 days Modified: head/usr.bin/tftp/Makefile Modified: head/usr.bin/tftp/Makefile ============================================================================== --- head/usr.bin/tftp/Makefile Thu Sep 23 09:56:02 2010 (r213052) +++ head/usr.bin/tftp/Makefile Thu Sep 23 10:03:03 2010 (r213053) @@ -1,7 +1,6 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 # $FreeBSD$ -CFLAGS=-g -Wall WARNS= 3 PROG= tftp SRCS= main.c tftp.c tftp-utils.c tftp-io.c tftp-file.c tftp-transfer.c tftp-options.c From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 10:20:28 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B75EC10657B9; Thu, 23 Sep 2010 10:20:28 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A4ADA8FC18; Thu, 23 Sep 2010 10:20:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8NAKSEa061392; Thu, 23 Sep 2010 10:20:28 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8NAKS3t061389; Thu, 23 Sep 2010 10:20:28 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201009231020.o8NAKS3t061389@svn.freebsd.org> From: Gavin Atkinson Date: Thu, 23 Sep 2010 10:20:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213054 - in stable/8/sys/dev/usb: . serial X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 10:20:28 -0000 Author: gavin Date: Thu Sep 23 10:20:28 2010 New Revision: 213054 URL: http://svn.freebsd.org/changeset/base/213054 Log: Merge r211153 from head: Now that the uplcom(4) driver can autodetect the chipset type, sync the list of devices supported by uplcom(4) with the following sources: NetBSD src/sys/dev/usb/uplcom.c 1.70 OpenBSD src/sys/dev/usb/uplcom.c 1.52 Linux drivers/usb/serial/pl2303.h from kernel 2.6.35 BeOS usb_serial/driver.c 1.32 Give several devices better descriptions, and rename PROLIFIC2 -> NETINDEX while here to match everybody else. Modified: stable/8/sys/dev/usb/serial/uplcom.c stable/8/sys/dev/usb/usbdevs Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/usb/serial/uplcom.c ============================================================================== --- stable/8/sys/dev/usb/serial/uplcom.c Thu Sep 23 10:03:03 2010 (r213053) +++ stable/8/sys/dev/usb/serial/uplcom.c Thu Sep 23 10:20:28 2010 (r213054) @@ -249,29 +249,63 @@ static struct ucom_callback uplcom_callb { USB_VENDOR(USB_VENDOR_##v), USB_PRODUCT(USB_PRODUCT_##v##_##p) } static const struct usb_device_id uplcom_devs[] = { + UPLCOM_DEV(ACERP, S81), /* BenQ S81 phone */ + UPLCOM_DEV(ADLINK, ND6530), /* ADLINK ND-6530 USB-Serial */ + UPLCOM_DEV(ALCATEL, OT535), /* Alcatel One Touch 535/735 */ + UPLCOM_DEV(ALCOR, AU9720), /* Alcor AU9720 USB 2.0-RS232 */ + UPLCOM_DEV(ANCHOR, SERIAL), /* Anchor Serial adapter */ UPLCOM_DEV(ATEN, UC232A), /* PLANEX USB-RS232 URS-03 */ UPLCOM_DEV(BELKIN, F5U257), /* Belkin F5U257 */ UPLCOM_DEV(COREGA, CGUSBRS232R), /* Corega CG-USBRS232R */ + UPLCOM_DEV(EPSON, CRESSI_EDY), /* Cressi Edy diving computer */ UPLCOM_DEV(ELECOM, UCSGT), /* ELECOM UC-SGT */ UPLCOM_DEV(ELECOM, UCSGT0), /* ELECOM UC-SGT */ UPLCOM_DEV(HAL, IMR001), /* HAL Corporation Crossam2+USB */ + UPLCOM_DEV(HP, LD220), /* HP LD220 POS Display */ UPLCOM_DEV(IODATA, USBRSAQ), /* I/O DATA USB-RSAQ */ UPLCOM_DEV(IODATA, USBRSAQ5), /* I/O DATA USB-RSAQ5 */ + UPLCOM_DEV(ITEGNO, WM1080A), /* iTegno WM1080A GSM/GFPRS modem */ + UPLCOM_DEV(ITEGNO, WM2080A), /* iTegno WM2080A CDMA modem */ + UPLCOM_DEV(LEADTEK, 9531), /* Leadtek 9531 GPS */ + UPLCOM_DEV(MICROSOFT, 700WX), /* Microsoft Palm 700WX */ UPLCOM_DEV(MOBILEACTION, MA620), /* Mobile Action MA-620 Infrared Adapter */ + UPLCOM_DEV(NETINDEX, WS002IN), /* Willcom W-S002IN */ + UPLCOM_DEV(NOKIA2, CA42), /* Nokia CA-42 cable */ + UPLCOM_DEV(OTI, DKU5), /* OTI DKU-5 cable */ + UPLCOM_DEV(PANASONIC, TYTP50P6S), /* Panasonic TY-TP50P6-S flat screen */ + UPLCOM_DEV(PLX, CA42), /* PLX CA-42 clone cable */ + UPLCOM_DEV(PROLIFIC, ALLTRONIX_GPRS), /* Alltronix ACM003U00 modem */ + UPLCOM_DEV(PROLIFIC, ALDIGA_AL11U), /* AlDiga AL-11U modem */ + UPLCOM_DEV(PROLIFIC, DCU11), /* DCU-11 Phone Cable */ + UPLCOM_DEV(PROLIFIC, HCR331), /* HCR331 Card Reader */ + UPLCOM_DEV(PROLIFIC, MICROMAX_610U), /* Micromax 610U modem */ UPLCOM_DEV(PROLIFIC, PHAROS), /* Prolific Pharos */ - UPLCOM_DEV(PROLIFIC, PL2303), /* Generic */ + UPLCOM_DEV(PROLIFIC, PL2303), /* Generic adapter */ UPLCOM_DEV(PROLIFIC, RSAQ2), /* I/O DATA USB-RSAQ2 */ UPLCOM_DEV(PROLIFIC, RSAQ3), /* I/O DATA USB-RSAQ3 */ - UPLCOM_DEV(PROLIFIC2, WSIM), /* Willcom W-SIM */ + UPLCOM_DEV(PROLIFIC2, PL2303), /* Prolific adapter */ UPLCOM_DEV(RADIOSHACK, USBCABLE), UPLCOM_DEV(RATOC, REXUSB60), /* RATOC REX-USB60 */ UPLCOM_DEV(SAGEM, USBSERIAL), /* Sagem USB-Serial Controller */ + UPLCOM_DEV(SAMSUNG, I330), /* Samsung I330 phone cradle */ + UPLCOM_DEV(SANWA, KB_USB2), /* Sanwa KB-USB2 Multimeter cable */ + UPLCOM_DEV(SIEMENS3, EF81), /* Seimens EF81 */ + UPLCOM_DEV(SIEMENS3, SX1), /* Seimens SX1 */ + UPLCOM_DEV(SIEMENS3, X65), /* Seimens X65 */ + UPLCOM_DEV(SIEMENS3, X75), /* Seimens X75 */ UPLCOM_DEV(SITECOM, SERIAL), /* Sitecom USB to Serial */ - UPLCOM_DEV(SONYERICSSON, DCU10), /* Sony Ericsson USB Cable */ + UPLCOM_DEV(SMART, PL2303), /* SMART Technologies */ + UPLCOM_DEV(SONY, QN3), /* Sony QN3 phone cable */ + UPLCOM_DEV(SONYERICSSON, DATAPILOT), /* Sony Ericsson Datapilot */ + UPLCOM_DEV(SONYERICSSON, DCU10), /* Sony Ericsson DCU-10 Cable */ UPLCOM_DEV(SOURCENEXT, KEIKAI8), /* SOURCENEXT KeikaiDenwa 8 */ UPLCOM_DEV(SOURCENEXT, KEIKAI8_CHG), /* SOURCENEXT KeikaiDenwa 8 with charger */ + UPLCOM_DEV(SPEEDDRAGON, MS3303H), /* Speed Dragon USB-Serial */ + UPLCOM_DEV(SYNTECH, CPT8001C), /* Syntech CPT-8001C Barcode scanner */ UPLCOM_DEV(TDK, UHA6400), /* TDK USB-PHS Adapter UHA6400 */ + UPLCOM_DEV(TDK, UPA9664), /* TDK USB-PHS Adapter UPA9664 */ UPLCOM_DEV(TRIPPLITE, U209), /* Tripp-Lite U209-000-R */ + UPLCOM_DEV(YCCABLE, PL2303), /* YC Cable USB-Serial */ }; #undef UPLCOM_DEV Modified: stable/8/sys/dev/usb/usbdevs ============================================================================== --- stable/8/sys/dev/usb/usbdevs Thu Sep 23 10:03:03 2010 (r213053) +++ stable/8/sys/dev/usb/usbdevs Thu Sep 23 10:20:28 2010 (r213054) @@ -379,6 +379,7 @@ vendor GRIFFIN 0x077d Griffin Technolog vendor SANDISK 0x0781 SanDisk vendor JENOPTIK 0x0784 Jenoptik vendor LOGITEC 0x0789 Logitec +vendor NOKIA2 0x078b Nokia vendor BRIMAX 0x078e Brimax vendor AXIS 0x0792 Axis Communications vendor ABL 0x0794 ABL Electronics @@ -502,9 +503,11 @@ vendor TEKRAM 0x0b3b Tekram Technology vendor HAL 0x0b41 HAL Corporation vendor EMS 0x0b43 EMS Production vendor NEC2 0x0b62 NEC +vendor ADLINK 0x0b63 ADLINK Technoligy, Inc. vendor ATI2 0x0b6f ATI vendor ZEEVO 0x0b7a Zeevo, Inc. vendor KURUSUGAWA 0x0b7e Kurusugawa Electronics, Inc. +vendor SMART 0x0b8c Smart Technologies vendor ASIX 0x0b95 ASIX Electronics vendor O2MICRO 0x0b97 O2 Micro, Inc. vendor USR 0x0baf U.S. Robotics @@ -582,9 +585,10 @@ vendor SERVERWORKS 0x1166 ServerWorks vendor DLINK3 0x1186 Dlink vendor ACERCM 0x1189 Acer Communications & Multimedia vendor SIERRA 0x1199 Sierra Wireless +vendor SANWA 0x11ad Sanwa Electric Instrument Co., Ltd. vendor TOPFIELD 0x11db Topfield Co., Ltd vendor SIEMENS3 0x11f5 Siemens -vendor PROLIFIC2 0x11f6 Prolific +vendor NETINDEX 0x11f6 NetIndex vendor ALCATEL 0x11f7 Alcatel vendor UNKNOWN3 0x1233 Unknown vendor vendor TSUNAMI 0x1241 Tsunami @@ -696,6 +700,7 @@ vendor WCH 0x4348 QinHeng Electronics vendor ACEECA 0x4766 Aceeca vendor AVERATEC 0x50c2 Averatec vendor SWEEX 0x5173 Sweex +vendor PROLIFIC2 0x5372 Prolific Technologies vendor ONSPEC2 0x55aa OnSpec Electronic Inc. vendor ZINWELL 0x5a57 Zinwell vendor SITECOM 0x6189 Sitecom @@ -805,6 +810,7 @@ product ACERP ACERSCAN_620U 0x2060 Acers product ACERP ACERSCAN_4300U 0x20b0 Benq 3300U/4300U product ACERP ACERSCAN_640BT 0x20be Acerscan 640BT product ACERP ACERSCAN_1240U 0x20c0 Acerscan 1240U +product ACERP S81 0x4027 BenQ S81 phone product ACERP H10 0x4068 AWL400 Wireless Adapter product ACERP ATAPI 0x6003 ATA/ATAPI Adapter product ACERP AWL300 0x9000 AWL300 Wireless Adapter @@ -835,6 +841,9 @@ product ADAPTEC AWN8020 0x0020 AWN-8020 /* Addtron products */ product ADDTRON AWU120 0xff31 AWU-120 +/* ADLINK Texhnology products */ +product ADLINK ND6530 0x6530 ND-6530 USB-Serial + /* ADMtek products */ product ADMTEK PEGASUSII_4 0x07c2 AN986A Ethernet product ADMTEK PEGASUS 0x0986 AN986 Ethernet @@ -894,6 +903,9 @@ product AIRTIES RT3070 0x2310 RT3070 /* AKS products */ product AKS USBHASP 0x0001 USB-HASP 0.06 +/* Alcatel products */ +product ALCATEL OT535 0x02df One Touch 535/735 + /* Alcor Micro, Inc. products */ product ALCOR2 KBD_HUB 0x2802 Kbd Hub @@ -905,6 +917,7 @@ product ALCOR AU9814 0x9215 AU9814 Hub product ALCOR UMCR_9361 0x9361 USB Multimedia Card Reader product ALCOR SM_KBD 0x9410 MicroConnectors/StrongMan Keyboard product ALCOR NEC_KBD_HUB 0x9472 NEC Kbd Hub +product ALCOR AU9720 0x9720 USB2 - RS-232 product ALCOR AU6390 0x6390 AU6390 USB-IDE converter /* Alink products */ @@ -963,6 +976,7 @@ product AMIT RT2870_1 0x0012 RT2870 product AMIT2 RT2870 0x0008 RT2870 /* Anchor products */ +product ANCHOR SERIAL 0x2008 Serial product ANCHOR EZUSB 0x2131 EZUSB product ANCHOR EZLINK 0x2720 EZLINK @@ -1500,6 +1514,7 @@ product EPSON 1270 0x0120 Perfection 12 product EPSON 2480 0x0121 Perfection 2480 scanner product EPSON 3590 0x0122 Perfection 3590 scanner product EPSON 4990 0x012a Perfection 4990 Photo scanner +product EPSON CRESSI_EDY 0x0521 Cressi Edy diving computer product EPSON STYLUS_875DC 0x0601 Stylus Photo 875DC Card Reader product EPSON STYLUS_895 0x0602 Stylus Photo 895 Card Reader product EPSON CX5400 0x0808 CX5400 scanner @@ -1735,6 +1750,7 @@ product HP HS2300 0x1e1d HS2300 HSDPA product HP 640C 0x2004 DeskJet 640c product HP 4670V 0x3005 ScanJet 4670v product HP P1100 0x3102 Photosmart P1100 +product HP LD220 0x3524 LD220 POS Display product HP OJ4215 0x3d11 OfficeJet 4215 product HP HN210E 0x811c Ethernet HN210E product HP2 C500 0x6002 PhotoSmart C500 @@ -1872,6 +1888,10 @@ product IODATA2 USB2SC 0x0a09 USB2.0-SC product IOMEGA ZIP100 0x0001 Zip 100 product IOMEGA ZIP250 0x0030 Zip 250 +/* iTegno products */ +product ITEGNO WM1080A 0x1080 WM1080A GSM/GPRS modem +product ITEGNO WM2080A 0x2080 WM2080A CDMA modem + /* Ituner networks products */ product ITUNERNET USBLCD2X20 0x0002 USB-LCD 2x20 product ITUNERNET USBLCD4X20 0xc001 USB-LCD 4x20 @@ -1971,6 +1991,9 @@ product KYOCERA2 KPC680 0x180a Qualcomm product LACIE HD 0xa601 Hard Disk product LACIE CDRW 0xa602 CD R/W +/* Leadtek products */ +product LEADTEK 9531 0x2101 9531 GPS + /* Lexar products */ product LEXAR JUMPSHOT 0x0001 jumpSHOT CompactFlash Reader product LEXAR CF_READER 0xb002 USB CF Reader @@ -2130,6 +2153,7 @@ product MICROSOFT TBEXPLORER 0x0024 Trac product MICROSOFT INTELLIEYE 0x0025 IntelliEye mouse product MICROSOFT INETPRO2 0x002b Internet Keyboard Pro product MICROSOFT MN510 0x006e MN510 Wireless +product MICROSOFT 700WX 0x0079 Palm 700WX product MICROSOFT MN110 0x007a 10/100 USB NIC product MICROSOFT WLINTELLIMOUSE 0x008c Wireless Optical IntelliMouse product MICROSOFT WLNOTEBOOK 0x00b9 Wireless Optical Mouse (Model 1023) @@ -2263,6 +2287,9 @@ product NETGEAR3 WPN111 0x5f00 WPN111 product NETGEAR3 WPN111_NF 0x5f01 WPN111 (no firmware) product NETGEAR3 WPN111_2 0x5f02 WPN111 +/* NetIndex products */ +product NETINDEX WS002IN 0x2001 Willcom WS002IN + /* Nikon products */ product NIKON E990 0x0102 Digital Camera E990 product NIKON LS40 0x4000 CoolScan LS40 ED @@ -2274,6 +2301,7 @@ product NOVATECH RT2573 0x9021 RT2573 /* Nokia products */ product NOKIA N958GB 0x0070 Nokia N95 8GBc +product NOKIA2 CA42 0x1234 CA-42 cable /* Novatel Wireless products */ product NOVATEL V640 0x1100 Merlin V620 @@ -2378,6 +2406,9 @@ product OQO BT01 0x0003 model 01 Blueto product OQO ETHER01PLUS 0x7720 model 01+ Ethernet product OQO ETHER01 0x8150 model 01 Ethernet interface +/* Ours Technology Inc. */ +product OTI DKU5 0x6858 DKU-5 Serial + /* Owen.ru products */ product OWEN AC4 0x0004 AC4 USB-RS485 converter @@ -2401,6 +2432,7 @@ product PANASONIC KXLRW32AN 0x0d09 CD-R product PANASONIC KXLCB20AN 0x0d0a CD-R Drive KXL-CB20AN product PANASONIC KXLCB35AN 0x0d0e DVD-ROM & CD-R/RW product PANASONIC SDCAAE 0x1b00 MultiMediaCard +product PANASONIC TYTP50P6S 0x3900 TY-TP50P6-S 50in Touch Panel /* PARA Industrial products */ product PARA RT3070 0x8888 RT3070 @@ -2497,14 +2529,19 @@ product PRIMAX PCGAUMS1 0x4d04 Sony PCG product PROLIFIC PL2301 0x0000 PL2301 Host-Host interface product PROLIFIC PL2302 0x0001 PL2302 Host-Host interface product PROLIFIC RSAQ2 0x04bb PL2303 Serial (IODATA USB-RSAQ2) +product PROLIFIC ALLTRONIX_GPRS 0x0609 Alltronix ACM003U00 modem +product PROLIFIC ALDIGA_AL11U 0x0611 AlDiga AL-11U modem +product PROLIFIC MICROMAX_610U 0x0612 Micromax 610U +product PROLIFIC DCU11 0x1234 DCU-11 Phone Cable product PROLIFIC PL2303 0x2303 PL2303 Serial (ATEN/IOGEAR UC232A) product PROLIFIC PL2305 0x2305 Parallel printer product PROLIFIC ATAPI4 0x2307 ATAPI-4 Controller product PROLIFIC PL2501 0x2501 PL2501 Host-Host interface product PROLIFIC PL2506 0x2506 PL2506 USB to IDE Bridge +product PROLIFIC HCR331 0x331a HCR331 Hybrid Card Reader product PROLIFIC PHAROS 0xaaa0 Prolific Pharos product PROLIFIC RSAQ3 0xaaa2 PL2303 Serial Adapter (IODATA USB-RSAQ3) -product PROLIFIC2 WSIM 0x2001 Willcom WSIM +product PROLIFIC2 PL2303 0x2303 PL2303 Serial Adapter /* Putercom products */ product PUTERCOM UPA100 0x047e USB-1284 BRIDGE @@ -2640,6 +2677,10 @@ product RALINK RT8070 0x8070 RT8070 product RALINK RT2570_3 0x9020 RT2500USB Wireless Adapter product RALINK RT2573_2 0x9021 RT2501USB Wireless Adapter +/* RATOC Systems products */ +product RATOC REXUSB60 0xb000 USB serial adapter REX-USB60 +product RATOC REXUSB60F 0xb020 USB serial adapter REX-USB60F + /* ReakTek products */ /* Green House and CompUSA OEM this part */ product REALTEK USBKR100 0x8150 USBKR100 USB Ethernet @@ -2680,8 +2721,8 @@ product SAGEM XG76NA 0x0062 XG-76NA product SAMSUNG ML6060 0x3008 ML-6060 laser printer product SAMSUNG YP_U2 0x5050 YP-U2 MP3 Player product SAMSUNG YP_U4 0x5092 YP-U4 MP3 Player - product SAMSUNG I500 0x6601 I500 Palm USB Phone +product SAMSUNG I330 0x8001 I330 phone cradle product SAMSUNG2 RT2870_1 0x2018 RT2870 /* Samsung Techwin products */ @@ -2698,6 +2739,9 @@ product SANDISK SDCZ2_256 0x7104 Cruzer product SANDISK SDCZ4_128 0x7112 Cruzer Micro 128MB product SANDISK SDCZ4_256 0x7113 Cruzer Micro 256MB +/* Sanwa Electric Instrument Co., Ltd. products */ +product SANWA KB_USB2 0x0701 KB-USB2 multimeter cable + /* Sanyo Electric products */ product SANYO SCP4900 0x0701 Sanyo SCP-4900 USB Phone @@ -2759,6 +2803,7 @@ product SIEMENS2 WL54G 0x3c06 54g USB N product SIEMENS3 SX1 0x0001 SX1 product SIEMENS3 X65 0x0003 X65 product SIEMENS3 X75 0x0004 X75 +product SIEMENS3 EF81 0x0005 EF81 /* Sierra Wireless products */ product SIERRA EM5625 0x0017 EM5625 @@ -2933,6 +2978,9 @@ product SITECOMEU WL113R2 0x9712 WL-113 product SKANHEX MD_7425 0x410a MD 7425 Camera product SKANHEX SX_520Z 0x5200 SX 520z Camera +/* Smart Technologies products */ +product SMART PL2303 0x2303 Serial adapter + /* SmartBridges products */ product SMARTBRIDGES SMARTLINK 0x0001 SmartLink USB Ethernet product SMARTBRIDGES SMARTNIC 0x0003 smartNIC 2 PnP Ethernet @@ -2972,9 +3020,11 @@ product SONY CLIE_NX60 0x00da Sony Clie product SONY CLIE_TH55 0x0144 Sony Clie th55 product SONY CLIE_TJ37 0x0169 Sony Clie tj37 product SONY RF_RECEIVER 0x01db Sony RF mouse/kbd Receiver VGP-WRC1 +product SONY QN3 0x0437 Sony QN3 CMD-Jxx phone cable /* Sony Ericsson products */ -product SONYERICSSON DCU10 0x0528 USB Cable +product SONYERICSSON DCU10 0x0528 DCU-10 Phone Data Cable +product SONYERICSSON DATAPILOT 0x2003 Datapilot Phone Cable /* SOURCENEXT products */ product SOURCENEXT KEIKAI8 0x039f KeikaiDenwa 8 @@ -2985,6 +3035,9 @@ product SPARKLAN RT2573 0x0004 RT2573 product SPARKLAN RT2870_1 0x0006 RT2870 product SPARKLAN RT3070 0x0010 RT3070 +/* Speed Dragon Multimedia products */ +product SPEEDDRAGON MS3303H 0x110b MS3303H Serial + /* Sphairon Access Systems GmbH products */ product SPHAIRON UB801R 0x0110 UB801R @@ -3038,6 +3091,7 @@ product SUN KBD_HUB 0x100e Kbd Hub product SUPERTOP IDE 0x6600 USB-IDE /* Syntech products */ +product SYNTECH CPT8001C 0x0001 CPT-8001C Barcode scanner product SYNTECH CYPHERLAB100 0x1000 CipherLab USB Barcode Scanner /* Teclast products */ @@ -3262,6 +3316,12 @@ product YAMAHA RTW65I 0x4002 NetVolante product YANO U640MO 0x0101 U640MO-03 product YANO FW800HD 0x05fc METALWEAR-HDD +/* Y.C. Cable products */ +product YCCABLE PL2303 0x0fba PL2303 Serial + +/* Y-E Data products */ +product YEDATA FLASHBUSTERU 0x0000 Flashbuster-U + /* Yiso Wireless Co. products */ product YISO C893 0xc893 CDMA 2000 1xEVDO PC Card From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 10:43:38 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 331D2106566B; Thu, 23 Sep 2010 10:43:38 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 22C098FC1A; Thu, 23 Sep 2010 10:43:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8NAhc6R061835; Thu, 23 Sep 2010 10:43:38 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8NAhcY5061833; Thu, 23 Sep 2010 10:43:38 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009231043.o8NAhcY5061833@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 23 Sep 2010 10:43:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213055 - head/sys/geom/eli X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 10:43:38 -0000 Author: pjd Date: Thu Sep 23 10:43:37 2010 New Revision: 213055 URL: http://svn.freebsd.org/changeset/base/213055 Log: When trashing metadata, flush after each write. MFC after: 1 week Modified: head/sys/geom/eli/g_eli_ctl.c Modified: head/sys/geom/eli/g_eli_ctl.c ============================================================================== --- head/sys/geom/eli/g_eli_ctl.c Thu Sep 23 10:20:28 2010 (r213054) +++ head/sys/geom/eli/g_eli_ctl.c Thu Sep 23 10:43:37 2010 (r213055) @@ -739,6 +739,13 @@ g_eli_kill_one(struct g_eli_softc *sc) if (error == 0) error = err; } + err = g_io_flush(cp); + if (err != 0) { + G_ELI_DEBUG(0, "Cannot flush %s (error=%d).", + pp->name, err); + if (error == 0) + error = err; + } } free(sector, M_ELI); } From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 10:50:17 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E36151065674; Thu, 23 Sep 2010 10:50:17 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B89C58FC1B; Thu, 23 Sep 2010 10:50:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8NAoHob062018; Thu, 23 Sep 2010 10:50:17 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8NAoHTd062016; Thu, 23 Sep 2010 10:50:17 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009231050.o8NAoHTd062016@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 23 Sep 2010 10:50:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213056 - head/sbin/geom/class/eli X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 10:50:18 -0000 Author: pjd Date: Thu Sep 23 10:50:17 2010 New Revision: 213056 URL: http://svn.freebsd.org/changeset/base/213056 Log: Simplify code a bit by using g_*() API from libgeom. MFC after: 1 week Modified: head/sbin/geom/class/eli/geom_eli.c Modified: head/sbin/geom/class/eli/geom_eli.c ============================================================================== --- head/sbin/geom/class/eli/geom_eli.c Thu Sep 23 10:43:37 2010 (r213055) +++ head/sbin/geom/class/eli/geom_eli.c Thu Sep 23 10:50:17 2010 (r213056) @@ -1268,7 +1268,7 @@ eli_resize(struct gctl_req *req) struct g_eli_metadata md; const char *prov; unsigned char *sector; - unsigned secsize; + ssize_t secsize; off_t mediasize, oldsize; int nargs, provfd; @@ -1283,21 +1283,15 @@ eli_resize(struct gctl_req *req) sector = NULL; secsize = 0; - provfd = open(prov, O_RDWR); - if (provfd == -1 && errno == ENOENT && prov[0] != '/') { - char devprov[MAXPATHLEN]; - - snprintf(devprov, sizeof(devprov), "%s%s", _PATH_DEV, prov); - provfd = open(devprov, O_RDWR); - } + provfd = g_open(prov, 1); if (provfd == -1) { gctl_error(req, "Cannot open %s: %s.", prov, strerror(errno)); goto out; } - mediasize = g_get_mediasize(prov); - secsize = g_get_sectorsize(prov); - if (mediasize == 0 || secsize == 0) { + mediasize = g_mediasize(provfd); + secsize = g_sectorsize(provfd); + if (mediasize == -1 || secsize == -1) { gctl_error(req, "Cannot get information about %s: %s.", prov, strerror(errno)); goto out; @@ -1316,8 +1310,7 @@ eli_resize(struct gctl_req *req) } /* Read metadata from the 'oldsize' offset. */ - if (pread(provfd, sector, secsize, oldsize - secsize) != - (ssize_t)secsize) { + if (pread(provfd, sector, secsize, oldsize - secsize) != secsize) { gctl_error(req, "Cannot read old metadata: %s.", strerror(errno)); goto out; @@ -1344,23 +1337,21 @@ eli_resize(struct gctl_req *req) */ md.md_provsize = mediasize; eli_metadata_encode(&md, sector); - if (pwrite(provfd, sector, secsize, mediasize - secsize) != - (ssize_t)secsize) { + if (pwrite(provfd, sector, secsize, mediasize - secsize) != secsize) { gctl_error(req, "Cannot write metadata: %s.", strerror(errno)); goto out; } /* Now trash the old metadata. */ arc4rand(sector, secsize); - if (pwrite(provfd, sector, secsize, oldsize - secsize) != - (ssize_t)secsize) { + if (pwrite(provfd, sector, secsize, oldsize - secsize) != secsize) { gctl_error(req, "Failed to clobber old metadata: %s.", strerror(errno)); goto out; } out: - if (provfd > 0) - close(provfd); + if (provfd >= 0) + (void)g_close(provfd); if (sector != NULL) { bzero(sector, secsize); free(sector); From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 10:55:46 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 34C1F1065697; Thu, 23 Sep 2010 10:55:46 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 09CA18FC19; Thu, 23 Sep 2010 10:55:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8NAtjlK062156; Thu, 23 Sep 2010 10:55:45 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8NAtjqE062154; Thu, 23 Sep 2010 10:55:45 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009231055.o8NAtjqE062154@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 23 Sep 2010 10:55:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213057 - head/sbin/geom/class/eli X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 10:55:46 -0000 Author: pjd Date: Thu Sep 23 10:55:45 2010 New Revision: 213057 URL: http://svn.freebsd.org/changeset/base/213057 Log: - Make use of g_*() API. - Flush cache after writing metadata. MFC after: 1 week Modified: head/sbin/geom/class/eli/geom_eli.c Modified: head/sbin/geom/class/eli/geom_eli.c ============================================================================== --- head/sbin/geom/class/eli/geom_eli.c Thu Sep 23 10:50:17 2010 (r213056) +++ head/sbin/geom/class/eli/geom_eli.c Thu Sep 23 10:55:45 2010 (r213057) @@ -1176,7 +1176,7 @@ eli_restore(struct gctl_req *req) struct g_eli_metadata md; const char *file, *prov; unsigned char *sector; - unsigned secsize; + ssize_t secsize; off_t mediasize; int nargs, filefd, provfd; @@ -1197,21 +1197,15 @@ eli_restore(struct gctl_req *req) gctl_error(req, "Cannot open %s: %s.", file, strerror(errno)); goto out; } - provfd = open(prov, O_WRONLY); - if (provfd == -1 && errno == ENOENT && prov[0] != '/') { - char devprov[MAXPATHLEN]; - - snprintf(devprov, sizeof(devprov), "%s%s", _PATH_DEV, prov); - provfd = open(devprov, O_WRONLY); - } + provfd = g_open(prov, 1); if (provfd == -1) { gctl_error(req, "Cannot open %s: %s.", prov, strerror(errno)); goto out; } - mediasize = g_get_mediasize(prov); - secsize = g_get_sectorsize(prov); - if (mediasize == 0 || secsize == 0) { + mediasize = g_mediasize(provfd); + secsize = g_sectorsize(provfd); + if (mediasize == -1 || secsize == -1) { gctl_error(req, "Cannot get informations about %s: %s.", prov, strerror(errno)); goto out; @@ -1224,7 +1218,7 @@ eli_restore(struct gctl_req *req) } /* Read metadata from the backup file. */ - if (read(filefd, sector, secsize) != (ssize_t)secsize) { + if (read(filefd, sector, secsize) != secsize) { gctl_error(req, "Cannot read from %s: %s.", file, strerror(errno)); goto out; @@ -1246,16 +1240,16 @@ eli_restore(struct gctl_req *req) } } /* Write metadata from the provider. */ - if (pwrite(provfd, sector, secsize, mediasize - secsize) != - (ssize_t)secsize) { + if (pwrite(provfd, sector, secsize, mediasize - secsize) != secsize) { gctl_error(req, "Cannot write metadata: %s.", strerror(errno)); goto out; } + (void)g_flush(provfd); out: - if (provfd > 0) - close(provfd); - if (filefd > 0) - close(filefd); + if (provfd >= 0) + (void)g_close(provfd); + if (filefd >= 0) + (void)close(filefd); if (sector != NULL) { bzero(sector, secsize); free(sector); @@ -1341,6 +1335,7 @@ eli_resize(struct gctl_req *req) gctl_error(req, "Cannot write metadata: %s.", strerror(errno)); goto out; } + (void)g_flush(provfd); /* Now trash the old metadata. */ arc4rand(sector, secsize); From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 10:58:13 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A68201065673; Thu, 23 Sep 2010 10:58:13 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 964EA8FC21; Thu, 23 Sep 2010 10:58:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8NAwD1Y066674; Thu, 23 Sep 2010 10:58:13 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8NAwDUo066672; Thu, 23 Sep 2010 10:58:13 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009231058.o8NAwDUo066672@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 23 Sep 2010 10:58:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213058 - head/sbin/geom/class/eli X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 10:58:13 -0000 Author: pjd Date: Thu Sep 23 10:58:13 2010 New Revision: 213058 URL: http://svn.freebsd.org/changeset/base/213058 Log: Because we first write metadata into new place and then trash old place we don't want situation where old size is equal to new size, as we will trash newly written metadata. MFC after: 1 week Modified: head/sbin/geom/class/eli/geom_eli.c Modified: head/sbin/geom/class/eli/geom_eli.c ============================================================================== --- head/sbin/geom/class/eli/geom_eli.c Thu Sep 23 10:55:45 2010 (r213057) +++ head/sbin/geom/class/eli/geom_eli.c Thu Sep 23 10:58:13 2010 (r213058) @@ -1302,6 +1302,10 @@ eli_resize(struct gctl_req *req) gctl_error(req, "Invalid oldsize: Out of range."); goto out; } + if (oldsize == mediasize) { + gctl_error(req, "Size hasn't changed."); + goto out; + } /* Read metadata from the 'oldsize' offset. */ if (pread(provfd, sector, secsize, oldsize - secsize) != secsize) { From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 11:04:51 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 31342106564A; Thu, 23 Sep 2010 11:04:51 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 063798FC08; Thu, 23 Sep 2010 11:04:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8NB4oZF066862; Thu, 23 Sep 2010 11:04:50 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8NB4oXl066860; Thu, 23 Sep 2010 11:04:50 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009231104.o8NB4oXl066860@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 23 Sep 2010 11:04:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213059 - head/sbin/geom/class/eli X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 11:04:51 -0000 Author: pjd Date: Thu Sep 23 11:04:50 2010 New Revision: 213059 URL: http://svn.freebsd.org/changeset/base/213059 Log: - Use g_*() API when doing backups. - fsync() created filed. MFC after: 1 week Modified: head/sbin/geom/class/eli/geom_eli.c Modified: head/sbin/geom/class/eli/geom_eli.c ============================================================================== --- head/sbin/geom/class/eli/geom_eli.c Thu Sep 23 10:58:13 2010 (r213058) +++ head/sbin/geom/class/eli/geom_eli.c Thu Sep 23 11:04:50 2010 (r213059) @@ -1081,8 +1081,8 @@ static int eli_backup_create(struct gctl_req *req, const char *prov, const char *file) { struct g_eli_metadata md; - unsigned secsize; unsigned char *sector; + ssize_t secsize; off_t mediasize; int filefd, provfd, ret; @@ -1091,13 +1091,7 @@ eli_backup_create(struct gctl_req *req, sector = NULL; secsize = 0; - provfd = open(prov, O_RDONLY); - if (provfd == -1 && errno == ENOENT && prov[0] != '/') { - char devprov[MAXPATHLEN]; - - snprintf(devprov, sizeof(devprov), "%s%s", _PATH_DEV, prov); - provfd = open(devprov, O_RDONLY); - } + provfd = g_open(prov, 0); if (provfd == -1) { gctl_error(req, "Cannot open %s: %s.", prov, strerror(errno)); goto out; @@ -1108,9 +1102,9 @@ eli_backup_create(struct gctl_req *req, goto out; } - mediasize = g_get_mediasize(prov); - secsize = g_get_sectorsize(prov); - if (mediasize == 0 || secsize == 0) { + mediasize = g_mediasize(provfd); + secsize = g_sectorsize(provfd); + if (mediasize == -1 || secsize == -1) { gctl_error(req, "Cannot get informations about %s: %s.", prov, strerror(errno)); goto out; @@ -1123,8 +1117,7 @@ eli_backup_create(struct gctl_req *req, } /* Read metadata from the provider. */ - if (pread(provfd, sector, secsize, mediasize - secsize) != - (ssize_t)secsize) { + if (pread(provfd, sector, secsize, mediasize - secsize) != secsize) { gctl_error(req, "Cannot read metadata: %s.", strerror(errno)); goto out; } @@ -1134,18 +1127,19 @@ eli_backup_create(struct gctl_req *req, goto out; } /* Write metadata to the destination file. */ - if (write(filefd, sector, secsize) != (ssize_t)secsize) { + if (write(filefd, sector, secsize) != secsize) { gctl_error(req, "Cannot write to %s: %s.", file, strerror(errno)); goto out; } + (void)fsync(filefd); /* Success. */ ret = 0; out: - if (provfd > 0) - close(provfd); - if (filefd > 0) - close(filefd); + if (provfd >= 0) + (void)g_close(provfd); + if (filefd >= 0) + (void)close(filefd); if (sector != NULL) { bzero(sector, secsize); free(sector); From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 11:18:02 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AE3C8106564A; Thu, 23 Sep 2010 11:18:02 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 937048FC17; Thu, 23 Sep 2010 11:18:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8NBI2PQ067149; Thu, 23 Sep 2010 11:18:02 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8NBI25C067147; Thu, 23 Sep 2010 11:18:02 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009231118.o8NBI25C067147@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 23 Sep 2010 11:18:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213060 - head/sbin/geom/class/eli X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 11:18:02 -0000 Author: pjd Date: Thu Sep 23 11:18:02 2010 New Revision: 213060 URL: http://svn.freebsd.org/changeset/base/213060 Log: - When trashing metadata, repeat overwrite kern.geom.eli.overwrites times. - Flush write cache after each write. MFC after: 1 week Modified: head/sbin/geom/class/eli/geom_eli.c Modified: head/sbin/geom/class/eli/geom_eli.c ============================================================================== --- head/sbin/geom/class/eli/geom_eli.c Thu Sep 23 11:04:50 2010 (r213059) +++ head/sbin/geom/class/eli/geom_eli.c Thu Sep 23 11:18:02 2010 (r213060) @@ -27,6 +27,9 @@ #include __FBSDID("$FreeBSD$"); +#include +#include + #include #include #include @@ -1015,11 +1018,54 @@ eli_delkey(struct gctl_req *req) eli_delkey_detached(req, prov); } +static int +eli_trash_metadata(struct gctl_req *req, const char *prov, int fd, off_t offset) +{ + unsigned int overwrites; + unsigned char *sector; + ssize_t size; + int error; + + size = sizeof(overwrites); + if (sysctlbyname("kern.geom.eli.overwrites", &overwrites, &size, + NULL, 0) == -1 || overwrites == 0) { + overwrites = G_ELI_OVERWRITES; + } + + size = g_sectorsize(fd); + if (size <= 0) { + gctl_error(req, "Cannot obtain provider sector size %s: %s.", + prov, strerror(errno)); + return (-1); + } + sector = malloc(size); + if (sector == NULL) { + gctl_error(req, "Cannot allocate %zd bytes of memory.", size); + return (-1); + } + + error = 0; + do { + arc4rand(sector, size); + if (pwrite(fd, sector, size, offset) != size) { + if (error == 0) + error = errno; + } + (void)g_flush(fd); + } while (--overwrites > 0); + if (error != 0) { + gctl_error(req, "Cannot trash metadata on provider %s: %s.", + prov, strerror(error)); + return (-1); + } + return (0); +} + static void eli_kill_detached(struct gctl_req *req, const char *prov) { - struct g_eli_metadata md; - int error; + off_t offset; + int fd; /* * NOTE: Maybe we should verify if this is geli provider first, @@ -1036,12 +1082,22 @@ eli_kill_detached(struct gctl_req *req, } #endif - arc4rand((unsigned char *)&md, sizeof(md)); - error = g_metadata_store(prov, (unsigned char *)&md, sizeof(md)); - if (error != 0) { - gctl_error(req, "Cannot write metadata to %s: %s.", prov, - strerror(error)); + fd = g_open(prov, 1); + if (fd == -1) { + gctl_error(req, "Cannot open provider %s: %s.", prov, + strerror(errno)); + return; } + offset = g_mediasize(fd) - g_sectorsize(fd); + if (offset <= 0) { + gctl_error(req, + "Cannot obtain media size or sector size for provider %s: %s.", + prov, strerror(errno)); + (void)g_close(fd); + return; + } + (void)eli_trash_metadata(req, prov, fd, offset); + (void)g_close(fd); } static void @@ -1336,12 +1392,8 @@ eli_resize(struct gctl_req *req) (void)g_flush(provfd); /* Now trash the old metadata. */ - arc4rand(sector, secsize); - if (pwrite(provfd, sector, secsize, oldsize - secsize) != secsize) { - gctl_error(req, "Failed to clobber old metadata: %s.", - strerror(errno)); + if (eli_trash_metadata(req, prov, provfd, oldsize - secsize) == -1) goto out; - } out: if (provfd >= 0) (void)g_close(provfd); From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 11:19:04 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9A08410656A5; Thu, 23 Sep 2010 11:19:04 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 89BFB8FC15; Thu, 23 Sep 2010 11:19:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8NBJ4Lu067202; Thu, 23 Sep 2010 11:19:04 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8NBJ4MZ067199; Thu, 23 Sep 2010 11:19:04 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201009231119.o8NBJ4MZ067199@svn.freebsd.org> From: Gavin Atkinson Date: Thu, 23 Sep 2010 11:19:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213061 - head/share/dict X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 11:19:04 -0000 Author: gavin Date: Thu Sep 23 11:19:03 2010 New Revision: 213061 URL: http://svn.freebsd.org/changeset/base/213061 Log: Various changes from various sources: - Add "children" [1] - Add "acknowledgement", "acknowledgment", "Austria" and "haunted" [2] - Add "near", "antidisestablishmentarianism" and "Persephone" [2] - "Transvaal" should be capitalized [2] - Correct spelling of "structurelessness" and "Athena" [2] - Add missing atomic elements [3] - Add various words from "word of the day" lists [3] PR: conf/149756 [1] Submitted by: Nick Johnson [1] Obtained from: NetBSD [2], OpenBSD [3] MFC after: 1 week Modified: head/share/dict/web2 Modified: head/share/dict/web2 ============================================================================== --- head/share/dict/web2 Thu Sep 23 11:18:02 2010 (r213060) +++ head/share/dict/web2 Thu Sep 23 11:19:03 2010 (r213061) @@ -1545,9 +1545,11 @@ ackman acknow acknowledge acknowledgeable +acknowledgement acknowledged acknowledgedly acknowledger +acknowledgment aclastic acle acleidian @@ -3875,6 +3877,7 @@ agee Agelacrinites Agelacrinitidae Agelaius +agelast Agelaus ageless agelessness @@ -3995,6 +3998,7 @@ agist agistator agistment agistor +agita agitable agitant agitate @@ -4298,7 +4302,6 @@ Ahriman Ahrimanian ahsan Aht -Ahtena ahu ahuatle ahuehuete @@ -10059,6 +10062,7 @@ antidiphtheric antidiphtherin antidiphtheritic antidisciplinarian +antidisestablishmentarianism antidivine antidivorce antidogmatic @@ -15091,6 +15095,7 @@ atheizer athelia atheling athematic +Athena Athenaea athenaeum athenee @@ -15891,6 +15896,7 @@ australopithecine Australopithecus Australorp Austrasian +Austria Austrian Austrianize Austric @@ -21543,6 +21549,7 @@ betinge betipple betire betis +betise betitle betocsin betoil @@ -21833,6 +21840,7 @@ bibble bibbler bibbons bibcock +bibelot bibenzyl bibi Bibio @@ -24298,6 +24306,7 @@ bohereen bohireen boho bohor +bohrium bohunk boid Boidae @@ -24606,6 +24615,7 @@ boo boob boobery boobily +booboisie boobook booby boobyalla @@ -25158,6 +25168,7 @@ bouldery boule boulevard boulevardize +bouleversement boultel boulter boulterer @@ -28540,6 +28551,7 @@ caesaropopism Caesarotomy Caesarship caesious +caesium caesura caesural caesuric @@ -34554,6 +34566,7 @@ childlike childlikeness childly childness +children childrenite childridden childship @@ -41256,6 +41269,7 @@ congenitally congenitalness conger congeree +congeries congest congested congestible @@ -57000,6 +57014,7 @@ dopebook doper dopester dopey +doppelganger doppelkummel Dopper dopper @@ -58202,6 +58217,7 @@ dubitatingly dubitation dubitative dubitatively +dubnium Duboisia duboisin duboisine @@ -58916,6 +58932,7 @@ dysphagic dysphasia dysphasic dysphemia +dysphemism dysphonia dysphonic dysphoria @@ -60001,6 +60018,7 @@ eimer Eimeria einkorn Einsteinian +einsteinium Eireannach Eirene eiresione @@ -65389,6 +65407,7 @@ eudaimonia eudaimonism eudaimonist Eudemian +eudemonia Eudendrium Eudeve eudiagnostic @@ -69151,6 +69170,7 @@ fermentum fermerer fermery fermila +fermium fermorite fern fernandinite @@ -81692,6 +81712,7 @@ hagworm hah Hahnemannian Hahnemannism +hahnium Haiathalah Haida Haidan @@ -82659,6 +82680,7 @@ Hasmonaean hasp hassar hassel +hassium hassle hassock hassocky @@ -82789,6 +82811,7 @@ haunching haunchless haunchy haunt +haunted haunter hauntingly haunty @@ -87139,6 +87162,7 @@ homuncular homunculus homy Hon +honcho honda hondo Honduran @@ -100289,6 +100313,7 @@ jokish jokist jokul joky +joliotium joll jolleyman jollier @@ -101349,6 +101374,7 @@ katun katurai Katy katydid +katzenjammer Kauravas kauri kava @@ -103074,6 +103100,7 @@ kuphar kupper Kuranko kurbash +kurchatovium kurchicine kurchine Kurd @@ -104905,6 +104932,7 @@ lawny lawproof Lawrence lawrencite +lawrencium Lawrie lawrightman Lawson @@ -106402,6 +106430,7 @@ Lide lidflower lidgate lidless +lido lie liebenerite Liebfraumilch @@ -113272,6 +113301,7 @@ Meissa Meistersinger meith Meithei +meitnerium meizoseismal meizoseismic mejorana @@ -113727,6 +113757,7 @@ mendacity Mendaite Mende mendee +mendelevium Mendelian Mendelianism Mendelianist @@ -114041,6 +114072,7 @@ Mercurochrome mercurophen mercurous Mercury +mercury mercy mercyproof merdivorous @@ -122875,6 +122907,7 @@ neanthropic neap neaped Neapolitan +near nearable nearabout nearabouts @@ -124385,6 +124418,7 @@ nielled niellist niello Niels +nielsbohrium niepa Nierembergia Niersteiner @@ -124792,6 +124826,7 @@ nobble nobbler nobbut nobby +nobelium nobiliary nobilify nobilitate @@ -143301,6 +143336,7 @@ perseitol perseity persentiscency Persephassa +Persephone Persepolitan perseverance perseverant @@ -159783,6 +159819,7 @@ pukeweed Pukhtun pukish pukishness +pukka pukras puku puky @@ -171928,6 +171965,7 @@ ruther rutherford rutherfordine rutherfordite +rutherfordium ruthful ruthfully ruthfulness @@ -176365,6 +176403,7 @@ Seabee seaberry seaboard seaborderer +seaborgium seabound seacannie seacatch @@ -176892,6 +176931,7 @@ segregational segregationist segregative segregator +segue Sehyo seiche Seid @@ -182226,6 +182266,7 @@ situational situla situlae situs +sitzmark Sium Siusi Siuslaw @@ -191095,6 +191136,7 @@ structuration structure structured structureless +structurelessness structurely structurist strudel @@ -191193,7 +191235,6 @@ stuccoworker stuccoyer stuck stuckling -stucturelessness stud studbook studder @@ -206200,7 +206241,7 @@ transuranian transuranic transuranium transuterine -transvaal +Transvaal Transvaaler Transvaalian transvaluate From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 11:19:48 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E83BB1065696; Thu, 23 Sep 2010 11:19:48 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D83288FC2E; Thu, 23 Sep 2010 11:19:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8NBJmwG067253; Thu, 23 Sep 2010 11:19:48 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8NBJmWh067250; Thu, 23 Sep 2010 11:19:48 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009231119.o8NBJmWh067250@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 23 Sep 2010 11:19:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213062 - head/sys/geom/eli X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 11:19:49 -0000 Author: pjd Date: Thu Sep 23 11:19:48 2010 New Revision: 213062 URL: http://svn.freebsd.org/changeset/base/213062 Log: Define default overwrite count, so that userland can use it. MFC after: 1 week Modified: head/sys/geom/eli/g_eli.c head/sys/geom/eli/g_eli.h Modified: head/sys/geom/eli/g_eli.c ============================================================================== --- head/sys/geom/eli/g_eli.c Thu Sep 23 11:19:03 2010 (r213061) +++ head/sys/geom/eli/g_eli.c Thu Sep 23 11:19:48 2010 (r213062) @@ -69,7 +69,7 @@ TUNABLE_INT("kern.geom.eli.visible_passp SYSCTL_UINT(_kern_geom_eli, OID_AUTO, visible_passphrase, CTLFLAG_RW, &g_eli_visible_passphrase, 0, "Turn on echo when entering the passphrase (for debug purposes only!!)"); -u_int g_eli_overwrites = 5; +u_int g_eli_overwrites = G_ELI_OVERWRITES; TUNABLE_INT("kern.geom.eli.overwrites", &g_eli_overwrites); SYSCTL_UINT(_kern_geom_eli, OID_AUTO, overwrites, CTLFLAG_RW, &g_eli_overwrites, 0, "Number of times on-disk keys should be overwritten when destroying them"); Modified: head/sys/geom/eli/g_eli.h ============================================================================== --- head/sys/geom/eli/g_eli.h Thu Sep 23 11:19:03 2010 (r213061) +++ head/sys/geom/eli/g_eli.h Thu Sep 23 11:19:48 2010 (r213062) @@ -97,6 +97,7 @@ #define G_ELI_DATAIVKEYLEN (G_ELI_DATAKEYLEN + G_ELI_IVKEYLEN) /* Data-Key, IV-Key, HMAC_SHA512(Derived-Key, Data-Key+IV-Key) */ #define G_ELI_MKEYLEN (G_ELI_DATAIVKEYLEN + SHA512_MDLEN) +#define G_ELI_OVERWRITES 5 #ifdef _KERNEL extern u_int g_eli_debug; From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 11:23:11 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 30DD9106566B; Thu, 23 Sep 2010 11:23:11 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 20A748FC1D; Thu, 23 Sep 2010 11:23:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8NBNBYm067376; Thu, 23 Sep 2010 11:23:11 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8NBNBjo067374; Thu, 23 Sep 2010 11:23:11 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009231123.o8NBNBjo067374@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 23 Sep 2010 11:23:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213063 - head/sys/geom/eli X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 11:23:11 -0000 Author: pjd Date: Thu Sep 23 11:23:10 2010 New Revision: 213063 URL: http://svn.freebsd.org/changeset/base/213063 Log: Make the code similar to the code in g_eli_integrity.c. MFC after: 1 week Modified: head/sys/geom/eli/g_eli_privacy.c Modified: head/sys/geom/eli/g_eli_privacy.c ============================================================================== --- head/sys/geom/eli/g_eli_privacy.c Thu Sep 23 11:19:48 2010 (r213062) +++ head/sys/geom/eli/g_eli_privacy.c Thu Sep 23 11:23:10 2010 (r213063) @@ -175,8 +175,9 @@ g_eli_crypto_run(struct g_eli_worker *wr struct cryptodesc *crd; struct uio *uio; struct iovec *iov; - u_int i, nsec, add, secsize; + u_int i, nsec, secsize; int err, error; + off_t dstoff; size_t size; u_char *p, *data; @@ -219,7 +220,7 @@ g_eli_crypto_run(struct g_eli_worker *wr } error = 0; - for (i = 0, add = 0; i < nsec; i++, add += secsize) { + for (i = 0, dstoff = bp->bio_offset; i < nsec; i++, dstoff += secsize) { crp = (struct cryptop *)p; p += sizeof(*crp); crd = (struct cryptodesc *)p; p += sizeof(*crd); uio = (struct uio *)p; p += sizeof(*uio); @@ -256,7 +257,7 @@ g_eli_crypto_run(struct g_eli_worker *wr crd->crd_alg = sc->sc_ealgo; crd->crd_key = sc->sc_ekey; crd->crd_klen = sc->sc_ekeylen; - g_eli_crypto_ivgen(sc, bp->bio_offset + add, crd->crd_iv, + g_eli_crypto_ivgen(sc, dstoff, crd->crd_iv, sizeof(crd->crd_iv)); crd->crd_next = NULL; From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 11:26:38 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 93A5A106564A; Thu, 23 Sep 2010 11:26:38 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 832718FC1C; Thu, 23 Sep 2010 11:26:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8NBQcde067478; Thu, 23 Sep 2010 11:26:38 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8NBQcNK067475; Thu, 23 Sep 2010 11:26:38 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009231126.o8NBQcNK067475@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 23 Sep 2010 11:26:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213064 - head/sys/crypto/aesni X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 11:26:38 -0000 Author: pjd Date: Thu Sep 23 11:26:38 2010 New Revision: 213064 URL: http://svn.freebsd.org/changeset/base/213064 Log: Simplify code a bit. MFC after: 1 week Modified: head/sys/crypto/aesni/aesni.c head/sys/crypto/aesni/aesni_wrap.c Modified: head/sys/crypto/aesni/aesni.c ============================================================================== --- head/sys/crypto/aesni/aesni.c Thu Sep 23 11:23:10 2010 (r213063) +++ head/sys/crypto/aesni/aesni.c Thu Sep 23 11:26:38 2010 (r213064) @@ -69,14 +69,12 @@ aesni_identify(driver_t *drv, device_t p static int aesni_probe(device_t dev) { - char capp[32]; if ((cpu_feature2 & CPUID2_AESNI) == 0) { device_printf(dev, "No AESNI support.\n"); return (EINVAL); } - strlcpy(capp, "AES-CBC", sizeof(capp)); - device_set_desc_copy(dev, capp); + device_set_desc_copy(dev, "AES-CBC"); return (0); } Modified: head/sys/crypto/aesni/aesni_wrap.c ============================================================================== --- head/sys/crypto/aesni/aesni_wrap.c Thu Sep 23 11:23:10 2010 (r213063) +++ head/sys/crypto/aesni/aesni_wrap.c Thu Sep 23 11:26:38 2010 (r213064) @@ -147,15 +147,13 @@ aesni_cipher_process(struct aesni_sessio int error, allocated; buf = aesni_cipher_alloc(enccrd, crp, &allocated); - if (buf == NULL) { - error = ENOMEM; - goto out; - } + if (buf == NULL) + return (ENOMEM); td = curthread; error = fpu_kern_enter(td, &ses->fpu_ctx, FPU_KERN_NORMAL); if (error != 0) - goto out1; + goto out; if ((enccrd->crd_flags & CRD_F_ENCRYPT) != 0) { if ((enccrd->crd_flags & CRD_F_IV_EXPLICIT) != 0) @@ -184,11 +182,10 @@ aesni_cipher_process(struct aesni_sessio crypto_copydata(crp->crp_flags, crp->crp_buf, enccrd->crd_skip + enccrd->crd_len - AES_BLOCK_LEN, AES_BLOCK_LEN, ses->iv); - out1: + out: if (allocated) { bzero(buf, enccrd->crd_len); free(buf, M_AESNI); } - out: return (error); } From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 11:33:29 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9896D106566C; Thu, 23 Sep 2010 11:33:29 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 886AD8FC1A; Thu, 23 Sep 2010 11:33:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8NBXTSB067649; Thu, 23 Sep 2010 11:33:29 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8NBXTs7067647; Thu, 23 Sep 2010 11:33:29 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009231133.o8NBXTs7067647@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 23 Sep 2010 11:33:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213065 - head/sys/opencrypto X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 11:33:29 -0000 Author: pjd Date: Thu Sep 23 11:33:29 2010 New Revision: 213065 URL: http://svn.freebsd.org/changeset/base/213065 Log: Remove redundant space. MFC after: 1 week Modified: head/sys/opencrypto/xform.c Modified: head/sys/opencrypto/xform.c ============================================================================== --- head/sys/opencrypto/xform.c Thu Sep 23 11:26:38 2010 (r213064) +++ head/sys/opencrypto/xform.c Thu Sep 23 11:33:29 2010 (r213065) @@ -226,7 +226,7 @@ struct auth_hash auth_hash_hmac_ripemd_1 }; struct auth_hash auth_hash_key_md5 = { - CRYPTO_MD5_KPDK, "Keyed MD5", + CRYPTO_MD5_KPDK, "Keyed MD5", 0, MD5_KPDK_HASH_LEN, 0, sizeof(MD5_CTX), (void (*)(void *)) MD5Init, MD5Update_int, (void (*)(u_int8_t *, void *)) MD5Final From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 11:46:54 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4C4B61065675; Thu, 23 Sep 2010 11:46:54 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 21AA18FC12; Thu, 23 Sep 2010 11:46:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8NBkslk067955; Thu, 23 Sep 2010 11:46:54 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8NBksYt067953; Thu, 23 Sep 2010 11:46:54 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009231146.o8NBksYt067953@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 23 Sep 2010 11:46:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213066 - head/sys/crypto/aesni X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 11:46:54 -0000 Author: pjd Date: Thu Sep 23 11:46:53 2010 New Revision: 213066 URL: http://svn.freebsd.org/changeset/base/213066 Log: Add support for CRD_F_KEY_EXPLICIT flag. MFC after: 1 week Modified: head/sys/crypto/aesni/aesni_wrap.c Modified: head/sys/crypto/aesni/aesni_wrap.c ============================================================================== --- head/sys/crypto/aesni/aesni_wrap.c Thu Sep 23 11:33:29 2010 (r213065) +++ head/sys/crypto/aesni/aesni_wrap.c Thu Sep 23 11:46:53 2010 (r213066) @@ -105,13 +105,12 @@ aesni_decrypt_ecb(int rounds, const void } } -int -aesni_cipher_setup(struct aesni_session *ses, struct cryptoini *encini) +static int +aesni_cipher_setup_common(struct aesni_session *ses, const uint8_t *key, + int keylen) { - struct thread *td; - int error; - switch (encini->cri_klen) { + switch (keylen) { case 128: ses->rounds = AES128_ROUNDS; break; @@ -124,18 +123,28 @@ aesni_cipher_setup(struct aesni_session default: return (EINVAL); } + + aesni_set_enckey(key, ses->enc_schedule, ses->rounds); + aesni_set_deckey(ses->enc_schedule, ses->dec_schedule, ses->rounds); + arc4rand(ses->iv, sizeof(ses->iv), 0); - td = curthread; - error = fpu_kern_enter(td, &ses->fpu_ctx, FPU_KERN_NORMAL); - if (error == 0) { - aesni_set_enckey(encini->cri_key, ses->enc_schedule, - ses->rounds); - aesni_set_deckey(ses->enc_schedule, ses->dec_schedule, - ses->rounds); - arc4rand(ses->iv, sizeof(ses->iv), 0); - fpu_kern_leave(td, &ses->fpu_ctx); - } - return (error); + return (0); +} + +int +aesni_cipher_setup(struct aesni_session *ses, struct cryptoini *encini) +{ + struct thread *td; + int error; + + td = curthread; + error = fpu_kern_enter(td, &ses->fpu_ctx, FPU_KERN_NORMAL); + if (error == 0) { + error = aesni_cipher_setup_common(ses, encini->cri_key, + encini->cri_klen); + fpu_kern_leave(td, &ses->fpu_ctx); + } + return (error); } int @@ -154,6 +163,13 @@ aesni_cipher_process(struct aesni_sessio error = fpu_kern_enter(td, &ses->fpu_ctx, FPU_KERN_NORMAL); if (error != 0) goto out; + + if ((enccrd->crd_flags & CRD_F_KEY_EXPLICIT) != 0) { + error = aesni_cipher_setup_common(ses, enccrd->crd_key, + enccrd->crd_klen); + if (error != 0) + goto out; + } if ((enccrd->crd_flags & CRD_F_ENCRYPT) != 0) { if ((enccrd->crd_flags & CRD_F_IV_EXPLICIT) != 0) From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 11:49:47 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 97108106566B; Thu, 23 Sep 2010 11:49:47 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 85ACF8FC0C; Thu, 23 Sep 2010 11:49:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8NBnlCf068056; Thu, 23 Sep 2010 11:49:47 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8NBnlOV068050; Thu, 23 Sep 2010 11:49:47 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009231149.o8NBnlOV068050@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 23 Sep 2010 11:49:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213067 - head/sys/geom/eli X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 11:49:47 -0000 Author: pjd Date: Thu Sep 23 11:49:47 2010 New Revision: 213067 URL: http://svn.freebsd.org/changeset/base/213067 Log: Implement switching of data encryption key every 2^20 blocks. This ensures the same encryption key won't be used for more than 2^20 blocks (sectors). This will be the default now. MFC after: 1 week Modified: head/sys/geom/eli/g_eli.c head/sys/geom/eli/g_eli.h head/sys/geom/eli/g_eli_integrity.c head/sys/geom/eli/g_eli_key.c head/sys/geom/eli/g_eli_privacy.c Modified: head/sys/geom/eli/g_eli.c ============================================================================== --- head/sys/geom/eli/g_eli.c Thu Sep 23 11:46:53 2010 (r213066) +++ head/sys/geom/eli/g_eli.c Thu Sep 23 11:49:47 2010 (r213067) @@ -375,6 +375,34 @@ g_eli_worker(void *arg) } /* + * Select encryption key. If G_ELI_FLAG_SINGLE_KEY is present we only have one + * key available for all the data. If the flag is not present select the key + * based on data offset. + */ +uint8_t * +g_eli_crypto_key(struct g_eli_softc *sc, off_t offset, size_t blocksize) +{ + u_int nkey; + + if (sc->sc_nekeys == 1) + return (sc->sc_ekeys[0]); + + KASSERT(sc->sc_nekeys > 1, ("%s: sc_nekeys=%u", __func__, + sc->sc_nekeys)); + KASSERT((sc->sc_flags & G_ELI_FLAG_SINGLE_KEY) == 0, + ("%s: SINGLE_KEY flag set, but sc_nekeys=%u", __func__, + sc->sc_nekeys)); + + /* We switch key every 2^G_ELI_KEY_SHIFT blocks. */ + nkey = (offset >> G_ELI_KEY_SHIFT) / blocksize; + + KASSERT(nkey < sc->sc_nekeys, ("%s: nkey=%u >= sc_nekeys=%u", __func__, + nkey, sc->sc_nekeys)); + + return (sc->sc_ekeys[nkey]); +} + +/* * Here we generate IV. It is unique for every sector. */ void @@ -548,13 +576,10 @@ g_eli_create(struct gctl_req *req, struc /* Backward compatibility. */ if (md->md_version < 4) sc->sc_flags |= G_ELI_FLAG_NATIVE_BYTE_ORDER; + if (md->md_version < 5) + sc->sc_flags |= G_ELI_FLAG_SINGLE_KEY; sc->sc_ealgo = md->md_ealgo; sc->sc_nkey = nkey; - /* - * Remember the keys in our softc structure. - */ - g_eli_mkey_propagate(sc, mkey); - sc->sc_ekeylen = md->md_keylen; if (sc->sc_flags & G_ELI_FLAG_AUTH) { sc->sc_akeylen = sizeof(sc->sc_akey) * 8; @@ -584,14 +609,6 @@ g_eli_create(struct gctl_req *req, struc sizeof(sc->sc_akey)); } - /* - * Precalculate SHA256 for IV generation. - * This is expensive operation and we can do it only once now or for - * every access to sector, so now will be much better. - */ - SHA256_Init(&sc->sc_ivctx); - SHA256_Update(&sc->sc_ivctx, sc->sc_ivkey, sizeof(sc->sc_ivkey)); - gp->softc = sc; sc->sc_geom = gp; @@ -633,12 +650,37 @@ g_eli_create(struct gctl_req *req, struc goto failed; } + sc->sc_sectorsize = md->md_sectorsize; + sc->sc_mediasize = bpp->mediasize; + if (!(sc->sc_flags & G_ELI_FLAG_ONETIME)) + sc->sc_mediasize -= bpp->sectorsize; + if (!(sc->sc_flags & G_ELI_FLAG_AUTH)) + sc->sc_mediasize -= (sc->sc_mediasize % sc->sc_sectorsize); + else { + sc->sc_mediasize /= sc->sc_bytes_per_sector; + sc->sc_mediasize *= sc->sc_sectorsize; + } + + /* + * Remember the keys in our softc structure. + */ + g_eli_mkey_propagate(sc, mkey); + sc->sc_ekeylen = md->md_keylen; + + /* + * Precalculate SHA256 for IV generation. + * This is expensive operation and we can do it only once now or for + * every access to sector, so now will be much better. + */ + SHA256_Init(&sc->sc_ivctx); + SHA256_Update(&sc->sc_ivctx, sc->sc_ivkey, sizeof(sc->sc_ivkey)); + LIST_INIT(&sc->sc_workers); bzero(&crie, sizeof(crie)); crie.cri_alg = sc->sc_ealgo; crie.cri_klen = sc->sc_ekeylen; - crie.cri_key = sc->sc_ekey; + crie.cri_key = sc->sc_ekeys[0]; if (sc->sc_flags & G_ELI_FLAG_AUTH) { bzero(&cria, sizeof(cria)); cria.cri_alg = sc->sc_aalgo; @@ -715,16 +757,8 @@ g_eli_create(struct gctl_req *req, struc * Create decrypted provider. */ pp = g_new_providerf(gp, "%s%s", bpp->name, G_ELI_SUFFIX); - pp->sectorsize = md->md_sectorsize; - pp->mediasize = bpp->mediasize; - if (!(sc->sc_flags & G_ELI_FLAG_ONETIME)) - pp->mediasize -= bpp->sectorsize; - if (!(sc->sc_flags & G_ELI_FLAG_AUTH)) - pp->mediasize -= (pp->mediasize % pp->sectorsize); - else { - pp->mediasize /= sc->sc_bytes_per_sector; - pp->mediasize *= pp->sectorsize; - } + pp->mediasize = sc->sc_mediasize; + pp->sectorsize = sc->sc_sectorsize; g_error_provider(pp, 0); @@ -755,6 +789,11 @@ failed: } g_destroy_consumer(cp); g_destroy_geom(gp); + if (sc->sc_ekeys != NULL) { + bzero(sc->sc_ekeys, + sc->sc_nekeys * (sizeof(uint8_t *) + G_ELI_DATAKEYLEN)); + free(sc->sc_ekeys, M_ELI); + } bzero(sc, sizeof(*sc)); free(sc, M_ELI); return (NULL); @@ -794,6 +833,9 @@ g_eli_destroy(struct g_eli_softc *sc, bo } mtx_destroy(&sc->sc_queue_mtx); gp->softc = NULL; + bzero(sc->sc_ekeys, + sc->sc_nekeys * (sizeof(uint8_t *) + G_ELI_DATAKEYLEN)); + free(sc->sc_ekeys, M_ELI); bzero(sc, sizeof(*sc)); free(sc, M_ELI); @@ -1042,6 +1084,7 @@ g_eli_dumpconf(struct sbuf *sb, const ch sbuf_printf(sb, name); \ } \ } while (0) + ADD_FLAG(G_ELI_FLAG_SINGLE_KEY, "SINGLE-KEY"); ADD_FLAG(G_ELI_FLAG_NATIVE_BYTE_ORDER, "NATIVE-BYTE-ORDER"); ADD_FLAG(G_ELI_FLAG_ONETIME, "ONETIME"); ADD_FLAG(G_ELI_FLAG_BOOT, "BOOT"); Modified: head/sys/geom/eli/g_eli.h ============================================================================== --- head/sys/geom/eli/g_eli.h Thu Sep 23 11:46:53 2010 (r213066) +++ head/sys/geom/eli/g_eli.h Thu Sep 23 11:49:47 2010 (r213067) @@ -60,8 +60,9 @@ * 3 - Added 'configure' subcommand. * 4 - IV is generated from offset converted to little-endian * (flag G_ELI_FLAG_NATIVE_BYTE_ORDER will be set for older versions). + * 5 - Added multiple encrypton keys. */ -#define G_ELI_VERSION 4 +#define G_ELI_VERSION 5 /* ON DISK FLAGS. */ /* Use random, onetime keys. */ @@ -83,6 +84,8 @@ #define G_ELI_FLAG_DESTROY 0x00020000 /* Provider uses native byte-order for IV generation. */ #define G_ELI_FLAG_NATIVE_BYTE_ORDER 0x00040000 +/* Provider uses single encryption key. */ +#define G_ELI_FLAG_SINGLE_KEY 0x00080000 #define SHA512_MDLEN 64 #define G_ELI_AUTH_SECKEYLEN SHA256_DIGEST_LENGTH @@ -98,6 +101,8 @@ /* Data-Key, IV-Key, HMAC_SHA512(Derived-Key, Data-Key+IV-Key) */ #define G_ELI_MKEYLEN (G_ELI_DATAIVKEYLEN + SHA512_MDLEN) #define G_ELI_OVERWRITES 5 +/* Switch data encryption key every 2^20 blocks. */ +#define G_ELI_KEY_SHIFT 20 #ifdef _KERNEL extern u_int g_eli_debug; @@ -139,27 +144,30 @@ struct g_eli_worker { }; struct g_eli_softc { - struct g_geom *sc_geom; - u_int sc_crypto; - uint8_t sc_mkey[G_ELI_DATAIVKEYLEN]; - uint8_t sc_ekey[G_ELI_DATAKEYLEN]; - u_int sc_ealgo; - u_int sc_ekeylen; - uint8_t sc_akey[G_ELI_AUTHKEYLEN]; - u_int sc_aalgo; - u_int sc_akeylen; - u_int sc_alen; - SHA256_CTX sc_akeyctx; - uint8_t sc_ivkey[G_ELI_IVKEYLEN]; - SHA256_CTX sc_ivctx; - int sc_nkey; - uint32_t sc_flags; - u_int sc_bytes_per_sector; - u_int sc_data_per_sector; + struct g_geom *sc_geom; + u_int sc_crypto; + uint8_t sc_mkey[G_ELI_DATAIVKEYLEN]; + uint8_t **sc_ekeys; + u_int sc_nekeys; + u_int sc_ealgo; + u_int sc_ekeylen; + uint8_t sc_akey[G_ELI_AUTHKEYLEN]; + u_int sc_aalgo; + u_int sc_akeylen; + u_int sc_alen; + SHA256_CTX sc_akeyctx; + uint8_t sc_ivkey[G_ELI_IVKEYLEN]; + SHA256_CTX sc_ivctx; + int sc_nkey; + uint32_t sc_flags; + off_t sc_mediasize; + size_t sc_sectorsize; + u_int sc_bytes_per_sector; + u_int sc_data_per_sector; /* Only for software cryptography. */ struct bio_queue_head sc_queue; - struct mtx sc_queue_mtx; + struct mtx sc_queue_mtx; LIST_HEAD(, g_eli_worker) sc_workers; }; #define sc_name sc_geom->name @@ -231,7 +239,7 @@ eli_metadata_decode_v0(const u_char *dat } static __inline int -eli_metadata_decode_v1v2v3v4(const u_char *data, struct g_eli_metadata *md) +eli_metadata_decode_v1v2v3v4v5(const u_char *data, struct g_eli_metadata *md) { MD5_CTX ctx; const u_char *p; @@ -269,7 +277,8 @@ eli_metadata_decode(const u_char *data, case 2: case 3: case 4: - error = eli_metadata_decode_v1v2v3v4(data, md); + case 5: + error = eli_metadata_decode_v1v2v3v4v5(data, md); break; default: error = EINVAL; @@ -461,6 +470,8 @@ void g_eli_config(struct gctl_req *req, void g_eli_read_done(struct bio *bp); void g_eli_write_done(struct bio *bp); int g_eli_crypto_rerun(struct cryptop *crp); +uint8_t *g_eli_crypto_key(struct g_eli_softc *sc, off_t offset, + size_t blocksize); void g_eli_crypto_ivgen(struct g_eli_softc *sc, off_t offset, u_char *iv, size_t size); Modified: head/sys/geom/eli/g_eli_integrity.c ============================================================================== --- head/sys/geom/eli/g_eli_integrity.c Thu Sep 23 11:46:53 2010 (r213066) +++ head/sys/geom/eli/g_eli_integrity.c Thu Sep 23 11:49:47 2010 (r213067) @@ -507,7 +507,7 @@ g_eli_auth_run(struct g_eli_worker *wr, if (bp->bio_cmd == BIO_WRITE) crde->crd_flags |= CRD_F_ENCRYPT; crde->crd_alg = sc->sc_ealgo; - crde->crd_key = sc->sc_ekey; + crde->crd_key = g_eli_crypto_key(sc, dstoff, encr_secsize); crde->crd_klen = sc->sc_ekeylen; g_eli_crypto_ivgen(sc, dstoff, crde->crd_iv, sizeof(crde->crd_iv)); Modified: head/sys/geom/eli/g_eli_key.c ============================================================================== --- head/sys/geom/eli/g_eli_key.c Thu Sep 23 11:46:53 2010 (r213066) +++ head/sys/geom/eli/g_eli_key.c Thu Sep 23 11:49:47 2010 (r213067) @@ -43,6 +43,9 @@ __FBSDID("$FreeBSD$"); #include +#ifdef _KERNEL +MALLOC_DECLARE(M_ELI); +#endif /* * Verify if the given 'key' is correct. @@ -178,6 +181,46 @@ g_eli_mkey_encrypt(unsigned algo, const } #ifdef _KERNEL +static void +g_eli_ekeys_generate(struct g_eli_softc *sc) +{ + uint8_t *keys; + u_int kno; + off_t mediasize; + size_t blocksize; + struct { + char magic[4]; + uint8_t keyno[8]; + } __packed hmacdata; + + KASSERT((sc->sc_flags & G_ELI_FLAG_SINGLE_KEY) == 0, + ("%s: G_ELI_FLAG_SINGLE_KEY flag present", __func__)); + + if ((sc->sc_flags & G_ELI_FLAG_AUTH) != 0) { + struct g_provider *pp; + + pp = LIST_FIRST(&sc->sc_geom->consumer)->provider; + mediasize = pp->mediasize; + blocksize = pp->sectorsize; + } else { + mediasize = sc->sc_mediasize; + blocksize = sc->sc_sectorsize; + } + sc->sc_nekeys = ((mediasize - 1) >> G_ELI_KEY_SHIFT) / blocksize + 1; + sc->sc_ekeys = + malloc(sc->sc_nekeys * (sizeof(uint8_t *) + G_ELI_DATAKEYLEN), + M_ELI, M_WAITOK); + keys = (uint8_t *)(sc->sc_ekeys + sc->sc_nekeys); + bcopy("ekey", hmacdata.magic, 4); + for (kno = 0; kno < sc->sc_nekeys; kno++, keys += G_ELI_DATAKEYLEN) { + sc->sc_ekeys[kno] = keys; + le64enc(hmacdata.keyno, (uint64_t)kno); + g_eli_crypto_hmac(sc->sc_mkey, G_ELI_MAXKEYLEN, + (uint8_t *)&hmacdata, sizeof(hmacdata), + sc->sc_ekeys[kno], 0); + } +} + /* * When doing encryption only, copy IV key and encryption key. * When doing encryption and authentication, copy IV key, generate encryption @@ -193,16 +236,33 @@ g_eli_mkey_propagate(struct g_eli_softc bcopy(mkey, sc->sc_ivkey, sizeof(sc->sc_ivkey)); mkey += sizeof(sc->sc_ivkey); - if (!(sc->sc_flags & G_ELI_FLAG_AUTH)) { - bcopy(mkey, sc->sc_ekey, sizeof(sc->sc_ekey)); + /* + * The authentication key is: akey = HMAC_SHA512(Master-Key, 0x11) + */ + if ((sc->sc_flags & G_ELI_FLAG_AUTH) != 0) { + g_eli_crypto_hmac(mkey, G_ELI_MAXKEYLEN, "\x11", 1, + sc->sc_akey, 0); } else { - /* - * The encryption key is: ekey = HMAC_SHA512(Master-Key, 0x10) - * The authentication key is: akey = HMAC_SHA512(Master-Key, 0x11) - */ - g_eli_crypto_hmac(mkey, G_ELI_MAXKEYLEN, "\x10", 1, sc->sc_ekey, 0); - g_eli_crypto_hmac(mkey, G_ELI_MAXKEYLEN, "\x11", 1, sc->sc_akey, 0); + arc4rand(sc->sc_akey, sizeof(sc->sc_akey), 0); } + if ((sc->sc_flags & G_ELI_FLAG_SINGLE_KEY) != 0) { + sc->sc_nekeys = 1; + sc->sc_ekeys = malloc(sc->sc_nekeys * + (sizeof(uint8_t *) + G_ELI_DATAKEYLEN), M_ELI, M_WAITOK); + sc->sc_ekeys[0] = (uint8_t *)(sc->sc_ekeys + sc->sc_nekeys); + if ((sc->sc_flags & G_ELI_FLAG_AUTH) == 0) + bcopy(mkey, sc->sc_ekeys[0], G_ELI_DATAKEYLEN); + else { + /* + * The encryption key is: ekey = HMAC_SHA512(Master-Key, 0x10) + */ + g_eli_crypto_hmac(mkey, G_ELI_MAXKEYLEN, "\x10", 1, + sc->sc_ekeys[0], 0); + } + } else { + /* Generate all encryption keys. */ + g_eli_ekeys_generate(sc); + } } #endif Modified: head/sys/geom/eli/g_eli_privacy.c ============================================================================== --- head/sys/geom/eli/g_eli_privacy.c Thu Sep 23 11:46:53 2010 (r213066) +++ head/sys/geom/eli/g_eli_privacy.c Thu Sep 23 11:49:47 2010 (r213067) @@ -252,10 +252,12 @@ g_eli_crypto_run(struct g_eli_worker *wr crd->crd_skip = 0; crd->crd_len = secsize; crd->crd_flags = CRD_F_IV_EXPLICIT | CRD_F_IV_PRESENT; + if (sc->sc_nekeys > 1) + crd->crd_flags |= CRD_F_KEY_EXPLICIT; if (bp->bio_cmd == BIO_WRITE) crd->crd_flags |= CRD_F_ENCRYPT; crd->crd_alg = sc->sc_ealgo; - crd->crd_key = sc->sc_ekey; + crd->crd_key = g_eli_crypto_key(sc, dstoff, secsize); crd->crd_klen = sc->sc_ekeylen; g_eli_crypto_ivgen(sc, dstoff, crd->crd_iv, sizeof(crd->crd_iv)); From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 11:52:33 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 189FA106564A; Thu, 23 Sep 2010 11:52:33 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0757B8FC15; Thu, 23 Sep 2010 11:52:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8NBqXpB068161; Thu, 23 Sep 2010 11:52:33 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8NBqWBa068155; Thu, 23 Sep 2010 11:52:32 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009231152.o8NBqWBa068155@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 23 Sep 2010 11:52:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213068 - head/sys/opencrypto X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 11:52:33 -0000 Author: pjd Date: Thu Sep 23 11:52:32 2010 New Revision: 213068 URL: http://svn.freebsd.org/changeset/base/213068 Log: Add support for AES-XTS. Obtained from: OpenBSD MFC after: 1 week Modified: head/sys/opencrypto/cryptodev.c head/sys/opencrypto/cryptodev.h head/sys/opencrypto/cryptosoft.c head/sys/opencrypto/xform.c head/sys/opencrypto/xform.h Modified: head/sys/opencrypto/cryptodev.c ============================================================================== --- head/sys/opencrypto/cryptodev.c Thu Sep 23 11:49:47 2010 (r213067) +++ head/sys/opencrypto/cryptodev.c Thu Sep 23 11:52:32 2010 (r213068) @@ -419,6 +419,9 @@ cryptof_ioctl( case CRYPTO_AES_CBC: txform = &enc_xform_rijndael128; break; + case CRYPTO_AES_XTS: + txform = &enc_xform_aes_xts; + break; case CRYPTO_NULL_CBC: txform = &enc_xform_null; break; Modified: head/sys/opencrypto/cryptodev.h ============================================================================== --- head/sys/opencrypto/cryptodev.h Thu Sep 23 11:49:47 2010 (r213067) +++ head/sys/opencrypto/cryptodev.h Thu Sep 23 11:52:32 2010 (r213068) @@ -123,7 +123,8 @@ #define CRYPTO_SHA2_384_HMAC 19 #define CRYPTO_SHA2_512_HMAC 20 #define CRYPTO_CAMELLIA_CBC 21 -#define CRYPTO_ALGORITHM_MAX 21 /* Keep updated - see below */ +#define CRYPTO_AES_XTS 22 +#define CRYPTO_ALGORITHM_MAX 22 /* Keep updated - see below */ /* Algorithm flags */ #define CRYPTO_ALG_FLAG_SUPPORTED 0x01 /* Algorithm is supported */ Modified: head/sys/opencrypto/cryptosoft.c ============================================================================== --- head/sys/opencrypto/cryptosoft.c Thu Sep 23 11:49:47 2010 (r213067) +++ head/sys/opencrypto/cryptosoft.c Thu Sep 23 11:52:32 2010 (r213068) @@ -114,8 +114,16 @@ swcr_encdec(struct cryptodesc *crd, stru if (error) return (error); } + ivp = iv; + /* + * xforms that provide a reinit method perform all IV + * handling themselves. + */ + if (exf->reinit) + exf->reinit(sw->sw_kschedule, iv); + if (flags & CRYPTO_F_IMBUF) { struct mbuf *m = (struct mbuf *) buf; @@ -135,7 +143,15 @@ swcr_encdec(struct cryptodesc *crd, stru m_copydata(m, k, blks, blk); /* Actual encryption/decryption */ - if (crd->crd_flags & CRD_F_ENCRYPT) { + if (exf->reinit) { + if (crd->crd_flags & CRD_F_ENCRYPT) { + exf->encrypt(sw->sw_kschedule, + blk); + } else { + exf->decrypt(sw->sw_kschedule, + blk); + } + } else if (crd->crd_flags & CRD_F_ENCRYPT) { /* XOR with previous block */ for (j = 0; j < blks; j++) blk[j] ^= ivp[j]; @@ -205,7 +221,15 @@ swcr_encdec(struct cryptodesc *crd, stru idat = mtod(m, unsigned char *) + k; while (m->m_len >= k + blks && i > 0) { - if (crd->crd_flags & CRD_F_ENCRYPT) { + if (exf->reinit) { + if (crd->crd_flags & CRD_F_ENCRYPT) { + exf->encrypt(sw->sw_kschedule, + idat); + } else { + exf->decrypt(sw->sw_kschedule, + idat); + } + } else if (crd->crd_flags & CRD_F_ENCRYPT) { /* XOR with previous block/IV */ for (j = 0; j < blks; j++) idat[j] ^= ivp[j]; @@ -261,7 +285,15 @@ swcr_encdec(struct cryptodesc *crd, stru cuio_copydata(uio, k, blks, blk); /* Actual encryption/decryption */ - if (crd->crd_flags & CRD_F_ENCRYPT) { + if (exf->reinit) { + if (crd->crd_flags & CRD_F_ENCRYPT) { + exf->encrypt(sw->sw_kschedule, + blk); + } else { + exf->decrypt(sw->sw_kschedule, + blk); + } + } else if (crd->crd_flags & CRD_F_ENCRYPT) { /* XOR with previous block */ for (j = 0; j < blks; j++) blk[j] ^= ivp[j]; @@ -319,7 +351,15 @@ swcr_encdec(struct cryptodesc *crd, stru idat = (char *)iov->iov_base + k; while (iov->iov_len >= k + blks && i > 0) { - if (crd->crd_flags & CRD_F_ENCRYPT) { + if (exf->reinit) { + if (crd->crd_flags & CRD_F_ENCRYPT) { + exf->encrypt(sw->sw_kschedule, + idat); + } else { + exf->decrypt(sw->sw_kschedule, + idat); + } + } else if (crd->crd_flags & CRD_F_ENCRYPT) { /* XOR with previous block/IV */ for (j = 0; j < blks; j++) idat[j] ^= ivp[j]; @@ -360,7 +400,15 @@ swcr_encdec(struct cryptodesc *crd, stru return 0; /* Done with iovec encryption/decryption */ } else { /* contiguous buffer */ - if (crd->crd_flags & CRD_F_ENCRYPT) { + if (exf->reinit) { + for (i = crd->crd_skip; + i < crd->crd_skip + crd->crd_len; i += blks) { + if (crd->crd_flags & CRD_F_ENCRYPT) + exf->encrypt(sw->sw_kschedule, buf + i); + else + exf->decrypt(sw->sw_kschedule, buf + i); + } + } else if (crd->crd_flags & CRD_F_ENCRYPT) { for (i = crd->crd_skip; i < crd->crd_skip + crd->crd_len; i += blks) { /* XOR with the IV/previous block, as appropriate. */ @@ -687,6 +735,9 @@ swcr_newsession(device_t dev, u_int32_t case CRYPTO_RIJNDAEL128_CBC: txf = &enc_xform_rijndael128; goto enccommon; + case CRYPTO_AES_XTS: + txf = &enc_xform_aes_xts; + goto enccommon; case CRYPTO_CAMELLIA_CBC: txf = &enc_xform_camellia; goto enccommon; @@ -845,6 +896,7 @@ swcr_freesession(device_t dev, u_int64_t case CRYPTO_CAST_CBC: case CRYPTO_SKIPJACK_CBC: case CRYPTO_RIJNDAEL128_CBC: + case CRYPTO_AES_XTS: case CRYPTO_CAMELLIA_CBC: case CRYPTO_NULL_CBC: txf = swd->sw_exf; @@ -958,6 +1010,7 @@ swcr_process(device_t dev, struct crypto case CRYPTO_CAST_CBC: case CRYPTO_SKIPJACK_CBC: case CRYPTO_RIJNDAEL128_CBC: + case CRYPTO_AES_XTS: case CRYPTO_CAMELLIA_CBC: if ((crp->crp_etype = swcr_encdec(crd, sw, crp->crp_buf, crp->crp_flags)) != 0) @@ -1050,6 +1103,7 @@ swcr_attach(device_t dev) REGISTER(CRYPTO_MD5); REGISTER(CRYPTO_SHA1); REGISTER(CRYPTO_RIJNDAEL128_CBC); + REGISTER(CRYPTO_AES_XTS); REGISTER(CRYPTO_CAMELLIA_CBC); REGISTER(CRYPTO_DEFLATE_COMP); #undef REGISTER Modified: head/sys/opencrypto/xform.c ============================================================================== --- head/sys/opencrypto/xform.c Thu Sep 23 11:49:47 2010 (r213067) +++ head/sys/opencrypto/xform.c Thu Sep 23 11:52:32 2010 (r213068) @@ -64,40 +64,48 @@ __FBSDID("$FreeBSD$"); #include #include -static void null_encrypt(caddr_t, u_int8_t *); -static void null_decrypt(caddr_t, u_int8_t *); -static int null_setkey(u_int8_t **, u_int8_t *, int); -static void null_zerokey(u_int8_t **); - +static int null_setkey(u_int8_t **, u_int8_t *, int); static int des1_setkey(u_int8_t **, u_int8_t *, int); static int des3_setkey(u_int8_t **, u_int8_t *, int); static int blf_setkey(u_int8_t **, u_int8_t *, int); static int cast5_setkey(u_int8_t **, u_int8_t *, int); static int skipjack_setkey(u_int8_t **, u_int8_t *, int); static int rijndael128_setkey(u_int8_t **, u_int8_t *, int); +static int aes_xts_setkey(u_int8_t **, u_int8_t *, int); static int cml_setkey(u_int8_t **, u_int8_t *, int); + +static void null_encrypt(caddr_t, u_int8_t *); static void des1_encrypt(caddr_t, u_int8_t *); static void des3_encrypt(caddr_t, u_int8_t *); static void blf_encrypt(caddr_t, u_int8_t *); static void cast5_encrypt(caddr_t, u_int8_t *); static void skipjack_encrypt(caddr_t, u_int8_t *); static void rijndael128_encrypt(caddr_t, u_int8_t *); +static void aes_xts_encrypt(caddr_t, u_int8_t *); static void cml_encrypt(caddr_t, u_int8_t *); + +static void null_decrypt(caddr_t, u_int8_t *); static void des1_decrypt(caddr_t, u_int8_t *); static void des3_decrypt(caddr_t, u_int8_t *); static void blf_decrypt(caddr_t, u_int8_t *); static void cast5_decrypt(caddr_t, u_int8_t *); static void skipjack_decrypt(caddr_t, u_int8_t *); static void rijndael128_decrypt(caddr_t, u_int8_t *); +static void aes_xts_decrypt(caddr_t, u_int8_t *); static void cml_decrypt(caddr_t, u_int8_t *); + +static void null_zerokey(u_int8_t **); static void des1_zerokey(u_int8_t **); static void des3_zerokey(u_int8_t **); static void blf_zerokey(u_int8_t **); static void cast5_zerokey(u_int8_t **); static void skipjack_zerokey(u_int8_t **); static void rijndael128_zerokey(u_int8_t **); +static void aes_xts_zerokey(u_int8_t **); static void cml_zerokey(u_int8_t **); +static void aes_xts_reinit(caddr_t, u_int8_t *); + static void null_init(void *); static int null_update(void *, u_int8_t *, u_int16_t); static void null_final(u_int8_t *, void *); @@ -124,6 +132,7 @@ struct enc_xform enc_xform_null = { null_decrypt, null_setkey, null_zerokey, + NULL }; struct enc_xform enc_xform_des = { @@ -133,6 +142,7 @@ struct enc_xform enc_xform_des = { des1_decrypt, des1_setkey, des1_zerokey, + NULL }; struct enc_xform enc_xform_3des = { @@ -141,7 +151,8 @@ struct enc_xform enc_xform_3des = { des3_encrypt, des3_decrypt, des3_setkey, - des3_zerokey + des3_zerokey, + NULL }; struct enc_xform enc_xform_blf = { @@ -150,7 +161,8 @@ struct enc_xform enc_xform_blf = { blf_encrypt, blf_decrypt, blf_setkey, - blf_zerokey + blf_zerokey, + NULL }; struct enc_xform enc_xform_cast5 = { @@ -159,7 +171,8 @@ struct enc_xform enc_xform_cast5 = { cast5_encrypt, cast5_decrypt, cast5_setkey, - cast5_zerokey + cast5_zerokey, + NULL }; struct enc_xform enc_xform_skipjack = { @@ -168,7 +181,8 @@ struct enc_xform enc_xform_skipjack = { skipjack_encrypt, skipjack_decrypt, skipjack_setkey, - skipjack_zerokey + skipjack_zerokey, + NULL }; struct enc_xform enc_xform_rijndael128 = { @@ -178,6 +192,17 @@ struct enc_xform enc_xform_rijndael128 = rijndael128_decrypt, rijndael128_setkey, rijndael128_zerokey, + NULL +}; + +struct enc_xform enc_xform_aes_xts = { + CRYPTO_AES_XTS, "AES-XTS", + RIJNDAEL128_BLOCK_LEN, 32, 64, + aes_xts_encrypt, + aes_xts_decrypt, + aes_xts_setkey, + aes_xts_zerokey, + aes_xts_reinit }; struct enc_xform enc_xform_arc4 = { @@ -187,6 +212,7 @@ struct enc_xform enc_xform_arc4 = { NULL, NULL, NULL, + NULL }; struct enc_xform enc_xform_camellia = { @@ -196,6 +222,7 @@ struct enc_xform enc_xform_camellia = { cml_decrypt, cml_setkey, cml_zerokey, + NULL }; /* Authentication instances */ @@ -547,6 +574,107 @@ rijndael128_zerokey(u_int8_t **sched) *sched = NULL; } +#define AES_XTS_BLOCKSIZE 16 +#define AES_XTS_IVSIZE 8 +#define AES_XTS_ALPHA 0x87 /* GF(2^128) generator polynomial */ + +struct aes_xts_ctx { + rijndael_ctx key1; + rijndael_ctx key2; + u_int8_t tweak[AES_XTS_BLOCKSIZE]; +}; + +void +aes_xts_reinit(caddr_t key, u_int8_t *iv) +{ + struct aes_xts_ctx *ctx = (struct aes_xts_ctx *)key; + u_int64_t blocknum; + u_int i; + + /* + * Prepare tweak as E_k2(IV). IV is specified as LE representation + * of a 64-bit block number which we allow to be passed in directly. + */ + bcopy(iv, &blocknum, AES_XTS_IVSIZE); + for (i = 0; i < AES_XTS_IVSIZE; i++) { + ctx->tweak[i] = blocknum & 0xff; + blocknum >>= 8; + } + /* Last 64 bits of IV are always zero */ + bzero(ctx->tweak + AES_XTS_IVSIZE, AES_XTS_IVSIZE); + + rijndael_encrypt(&ctx->key2, ctx->tweak, ctx->tweak); +} + +static void +aes_xts_crypt(struct aes_xts_ctx *ctx, u_int8_t *data, u_int do_encrypt) +{ + u_int8_t block[AES_XTS_BLOCKSIZE]; + u_int i, carry_in, carry_out; + + for (i = 0; i < AES_XTS_BLOCKSIZE; i++) + block[i] = data[i] ^ ctx->tweak[i]; + + if (do_encrypt) + rijndael_encrypt(&ctx->key1, block, data); + else + rijndael_decrypt(&ctx->key1, block, data); + + for (i = 0; i < AES_XTS_BLOCKSIZE; i++) + data[i] ^= ctx->tweak[i]; + + /* Exponentiate tweak */ + carry_in = 0; + for (i = 0; i < AES_XTS_BLOCKSIZE; i++) { + carry_out = ctx->tweak[i] & 0x80; + ctx->tweak[i] = (ctx->tweak[i] << 1) | (carry_in ? 1 : 0); + carry_in = carry_out; + } + if (carry_in) + ctx->tweak[0] ^= AES_XTS_ALPHA; + bzero(block, sizeof(block)); +} + +void +aes_xts_encrypt(caddr_t key, u_int8_t *data) +{ + aes_xts_crypt((struct aes_xts_ctx *)key, data, 1); +} + +void +aes_xts_decrypt(caddr_t key, u_int8_t *data) +{ + aes_xts_crypt((struct aes_xts_ctx *)key, data, 0); +} + +int +aes_xts_setkey(u_int8_t **sched, u_int8_t *key, int len) +{ + struct aes_xts_ctx *ctx; + + if (len != 32 && len != 64) + return EINVAL; + + *sched = malloc(sizeof(struct aes_xts_ctx), M_CRYPTO_DATA, + M_NOWAIT | M_ZERO); + if (*sched == NULL) + return ENOMEM; + ctx = (struct aes_xts_ctx *)*sched; + + rijndael_set_key(&ctx->key1, key, len * 4); + rijndael_set_key(&ctx->key2, key + (len / 2), len * 4); + + return 0; +} + +void +aes_xts_zerokey(u_int8_t **sched) +{ + bzero(*sched, sizeof(struct aes_xts_ctx)); + free(*sched, M_CRYPTO_DATA); + *sched = NULL; +} + static void cml_encrypt(caddr_t key, u_int8_t *blk) { Modified: head/sys/opencrypto/xform.h ============================================================================== --- head/sys/opencrypto/xform.h Thu Sep 23 11:49:47 2010 (r213067) +++ head/sys/opencrypto/xform.h Thu Sep 23 11:52:32 2010 (r213068) @@ -54,6 +54,7 @@ struct enc_xform { void (*decrypt) (caddr_t, u_int8_t *); int (*setkey) (u_int8_t **, u_int8_t *, int len); void (*zerokey) (u_int8_t **); + void (*reinit) (caddr_t, u_int8_t *); }; struct comp_algo { @@ -80,6 +81,7 @@ extern struct enc_xform enc_xform_blf; extern struct enc_xform enc_xform_cast5; extern struct enc_xform enc_xform_skipjack; extern struct enc_xform enc_xform_rijndael128; +extern struct enc_xform enc_xform_aes_xts; extern struct enc_xform enc_xform_arc4; extern struct enc_xform enc_xform_camellia; From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 11:57:25 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 600FE106566B; Thu, 23 Sep 2010 11:57:25 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4E9EC8FC08; Thu, 23 Sep 2010 11:57:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8NBvPw0068298; Thu, 23 Sep 2010 11:57:25 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8NBvPwv068294; Thu, 23 Sep 2010 11:57:25 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009231157.o8NBvPwv068294@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 23 Sep 2010 11:57:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213069 - head/sys/crypto/aesni X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 11:57:25 -0000 Author: pjd Date: Thu Sep 23 11:57:25 2010 New Revision: 213069 URL: http://svn.freebsd.org/changeset/base/213069 Log: Add support for CRYPTO_AES_XTS. MFC after: 1 week Modified: head/sys/crypto/aesni/aesni.c head/sys/crypto/aesni/aesni.h head/sys/crypto/aesni/aesni_wrap.c Modified: head/sys/crypto/aesni/aesni.c ============================================================================== --- head/sys/crypto/aesni/aesni.c Thu Sep 23 11:52:32 2010 (r213068) +++ head/sys/crypto/aesni/aesni.c Thu Sep 23 11:57:25 2010 (r213069) @@ -74,7 +74,7 @@ aesni_probe(device_t dev) device_printf(dev, "No AESNI support.\n"); return (EINVAL); } - device_set_desc_copy(dev, "AES-CBC"); + device_set_desc_copy(dev, "AES-CBC,AES-XTS"); return (0); } @@ -94,6 +94,7 @@ aesni_attach(device_t dev) rw_init(&sc->lock, "aesni_lock"); crypto_register(sc->cid, CRYPTO_AES_CBC, 0, 0); + crypto_register(sc->cid, CRYPTO_AES_XTS, 0, 0); return (0); } @@ -140,6 +141,7 @@ aesni_newsession(device_t dev, uint32_t for (; cri != NULL; cri = cri->cri_next) { switch (cri->cri_alg) { case CRYPTO_AES_CBC: + case CRYPTO_AES_XTS: if (encini != NULL) return (EINVAL); encini = cri; @@ -172,6 +174,7 @@ aesni_newsession(device_t dev, uint32_t ses->used = 1; TAILQ_INSERT_TAIL(&sc->sessions, ses, next); rw_wunlock(&sc->lock); + ses->algo = encini->cri_alg; error = aesni_cipher_setup(ses, encini); if (error != 0) { @@ -243,6 +246,7 @@ aesni_process(device_t dev, struct crypt for (crd = crp->crp_desc; crd != NULL; crd = crd->crd_next) { switch (crd->crd_alg) { case CRYPTO_AES_CBC: + case CRYPTO_AES_XTS: if (enccrd != NULL) { error = EINVAL; goto out; Modified: head/sys/crypto/aesni/aesni.h ============================================================================== --- head/sys/crypto/aesni/aesni.h Thu Sep 23 11:52:32 2010 (r213068) +++ head/sys/crypto/aesni/aesni.h Thu Sep 23 11:57:25 2010 (r213069) @@ -55,7 +55,9 @@ struct aesni_session { uint8_t enc_schedule[AES_SCHED_LEN] __aligned(16); uint8_t dec_schedule[AES_SCHED_LEN] __aligned(16); + uint8_t xts_schedule[AES_SCHED_LEN] __aligned(16); uint8_t iv[AES_BLOCK_LEN]; + int algo; int rounds; /* uint8_t *ses_ictx; */ /* uint8_t *ses_octx; */ Modified: head/sys/crypto/aesni/aesni_wrap.c ============================================================================== --- head/sys/crypto/aesni/aesni_wrap.c Thu Sep 23 11:52:32 2010 (r213068) +++ head/sys/crypto/aesni/aesni_wrap.c Thu Sep 23 11:57:25 2010 (r213069) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2010 Konstantin Belousov + * Copyright (c) 2010 Pawel Jakub Dawidek * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -105,28 +106,138 @@ aesni_decrypt_ecb(int rounds, const void } } +#define AES_XTS_BLOCKSIZE 16 +#define AES_XTS_IVSIZE 8 +#define AES_XTS_ALPHA 0x87 /* GF(2^128) generator polynomial */ + +static void +aesni_crypt_xts_block(int rounds, const void *key_schedule, uint8_t *tweak, + const uint8_t *from, uint8_t *to, int do_encrypt) +{ + uint8_t block[AES_XTS_BLOCKSIZE]; + u_int i, carry_in, carry_out; + + for (i = 0; i < AES_XTS_BLOCKSIZE; i++) + block[i] = from[i] ^ tweak[i]; + + if (do_encrypt) + aesni_enc(rounds - 1, key_schedule, block, to, NULL); + else + aesni_dec(rounds - 1, key_schedule, block, to, NULL); + + for (i = 0; i < AES_XTS_BLOCKSIZE; i++) + to[i] ^= tweak[i]; + + /* Exponentiate tweak. */ + carry_in = 0; + for (i = 0; i < AES_XTS_BLOCKSIZE; i++) { + carry_out = tweak[i] & 0x80; + tweak[i] = (tweak[i] << 1) | (carry_in ? 1 : 0); + carry_in = carry_out; + } + if (carry_in) + tweak[0] ^= AES_XTS_ALPHA; + bzero(block, sizeof(block)); +} + +static void +aesni_crypt_xts(int rounds, const void *data_schedule, + const void *tweak_schedule, size_t len, const uint8_t *from, uint8_t *to, + const uint8_t iv[AES_BLOCK_LEN], int do_encrypt) +{ + uint8_t tweak[AES_XTS_BLOCKSIZE]; + uint64_t blocknum; + size_t i; + + /* + * Prepare tweak as E_k2(IV). IV is specified as LE representation + * of a 64-bit block number which we allow to be passed in directly. + */ + bcopy(iv, &blocknum, AES_XTS_IVSIZE); + for (i = 0; i < AES_XTS_IVSIZE; i++) { + tweak[i] = blocknum & 0xff; + blocknum >>= 8; + } + /* Last 64 bits of IV are always zero. */ + bzero(tweak + AES_XTS_IVSIZE, AES_XTS_IVSIZE); + aesni_enc(rounds - 1, tweak_schedule, tweak, tweak, NULL); + + len /= AES_XTS_BLOCKSIZE; + for (i = 0; i < len; i++) { + aesni_crypt_xts_block(rounds, data_schedule, tweak, from, to, + do_encrypt); + from += AES_XTS_BLOCKSIZE; + to += AES_XTS_BLOCKSIZE; + } + + bzero(tweak, sizeof(tweak)); +} + +static void +aesni_encrypt_xts(int rounds, const void *data_schedule, + const void *tweak_schedule, size_t len, const uint8_t *from, uint8_t *to, + const uint8_t iv[AES_BLOCK_LEN]) +{ + + aesni_crypt_xts(rounds, data_schedule, tweak_schedule, len, from, to, + iv, 1); +} + +static void +aesni_decrypt_xts(int rounds, const void *data_schedule, + const void *tweak_schedule, size_t len, const uint8_t *from, uint8_t *to, + const uint8_t iv[AES_BLOCK_LEN]) +{ + + aesni_crypt_xts(rounds, data_schedule, tweak_schedule, len, from, to, + iv, 0); +} + static int aesni_cipher_setup_common(struct aesni_session *ses, const uint8_t *key, int keylen) { - switch (keylen) { - case 128: - ses->rounds = AES128_ROUNDS; - break; - case 192: - ses->rounds = AES192_ROUNDS; + switch (ses->algo) { + case CRYPTO_AES_CBC: + switch (keylen) { + case 128: + ses->rounds = AES128_ROUNDS; + break; + case 192: + ses->rounds = AES192_ROUNDS; + break; + case 256: + ses->rounds = AES256_ROUNDS; + break; + default: + return (EINVAL); + } break; - case 256: - ses->rounds = AES256_ROUNDS; + case CRYPTO_AES_XTS: + switch (keylen) { + case 256: + ses->rounds = AES128_ROUNDS; + break; + case 512: + ses->rounds = AES256_ROUNDS; + break; + default: + return (EINVAL); + } break; default: return (EINVAL); } - + aesni_set_enckey(key, ses->enc_schedule, ses->rounds); aesni_set_deckey(ses->enc_schedule, ses->dec_schedule, ses->rounds); - arc4rand(ses->iv, sizeof(ses->iv), 0); + if (ses->algo == CRYPTO_AES_XTS) + arc4rand(ses->iv, sizeof(ses->iv), 0); + else /* if (ses->algo == CRYPTO_AES_XTS) */ { + aesni_set_enckey(key + keylen / 16, ses->xts_schedule, + ses->rounds); + } return (0); } @@ -137,14 +248,14 @@ aesni_cipher_setup(struct aesni_session struct thread *td; int error; - td = curthread; - error = fpu_kern_enter(td, &ses->fpu_ctx, FPU_KERN_NORMAL); - if (error == 0) { + td = curthread; + error = fpu_kern_enter(td, &ses->fpu_ctx, FPU_KERN_NORMAL); + if (error == 0) { error = aesni_cipher_setup_common(ses, encini->cri_key, encini->cri_klen); - fpu_kern_leave(td, &ses->fpu_ctx); - } - return (error); + fpu_kern_leave(td, &ses->fpu_ctx); + } + return (error); } int @@ -163,7 +274,7 @@ aesni_cipher_process(struct aesni_sessio error = fpu_kern_enter(td, &ses->fpu_ctx, FPU_KERN_NORMAL); if (error != 0) goto out; - + if ((enccrd->crd_flags & CRD_F_KEY_EXPLICIT) != 0) { error = aesni_cipher_setup_common(ses, enccrd->crd_key, enccrd->crd_klen); @@ -174,21 +285,31 @@ aesni_cipher_process(struct aesni_sessio if ((enccrd->crd_flags & CRD_F_ENCRYPT) != 0) { if ((enccrd->crd_flags & CRD_F_IV_EXPLICIT) != 0) bcopy(enccrd->crd_iv, ses->iv, AES_BLOCK_LEN); - if ((enccrd->crd_flags & CRD_F_IV_PRESENT) == 0) crypto_copyback(crp->crp_flags, crp->crp_buf, enccrd->crd_inject, AES_BLOCK_LEN, ses->iv); - - aesni_encrypt_cbc(ses->rounds, ses->enc_schedule, - enccrd->crd_len, buf, buf, ses->iv); + if (ses->algo == CRYPTO_AES_CBC) { + aesni_encrypt_cbc(ses->rounds, ses->enc_schedule, + enccrd->crd_len, buf, buf, ses->iv); + } else /* if (ses->algo == CRYPTO_AES_XTS) */ { + aesni_encrypt_xts(ses->rounds, ses->enc_schedule, + ses->xts_schedule, enccrd->crd_len, buf, buf, + ses->iv); + } } else { if ((enccrd->crd_flags & CRD_F_IV_EXPLICIT) != 0) bcopy(enccrd->crd_iv, ses->iv, AES_BLOCK_LEN); else crypto_copydata(crp->crp_flags, crp->crp_buf, enccrd->crd_inject, AES_BLOCK_LEN, ses->iv); - aesni_decrypt_cbc(ses->rounds, ses->dec_schedule, - enccrd->crd_len, buf, ses->iv); + if (ses->algo == CRYPTO_AES_CBC) { + aesni_decrypt_cbc(ses->rounds, ses->dec_schedule, + enccrd->crd_len, buf, ses->iv); + } else /* if (ses->algo == CRYPTO_AES_XTS) */ { + aesni_decrypt_xts(ses->rounds, ses->enc_schedule, + ses->xts_schedule, enccrd->crd_len, buf, buf, + ses->iv); + } } fpu_kern_leave(td, &ses->fpu_ctx); if (allocated) From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 11:58:37 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3FFCE106564A; Thu, 23 Sep 2010 11:58:37 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2EF668FC13; Thu, 23 Sep 2010 11:58:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8NBwbOc068359; Thu, 23 Sep 2010 11:58:37 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8NBwbDA068353; Thu, 23 Sep 2010 11:58:37 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009231158.o8NBwbDA068353@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 23 Sep 2010 11:58:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213070 - head/sys/geom/eli X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 11:58:37 -0000 Author: pjd Date: Thu Sep 23 11:58:36 2010 New Revision: 213070 URL: http://svn.freebsd.org/changeset/base/213070 Log: Add support for AES-XTS. This will be the default now. MFC after: 1 week Modified: head/sys/geom/eli/g_eli.c head/sys/geom/eli/g_eli.h head/sys/geom/eli/g_eli_crypto.c head/sys/geom/eli/g_eli_integrity.c head/sys/geom/eli/g_eli_privacy.c Modified: head/sys/geom/eli/g_eli.c ============================================================================== --- head/sys/geom/eli/g_eli.c Thu Sep 23 11:57:25 2010 (r213069) +++ head/sys/geom/eli/g_eli.c Thu Sep 23 11:58:36 2010 (r213070) @@ -409,18 +409,31 @@ void g_eli_crypto_ivgen(struct g_eli_softc *sc, off_t offset, u_char *iv, size_t size) { - u_char off[8], hash[SHA256_DIGEST_LENGTH]; - SHA256_CTX ctx; + uint8_t off[8]; if ((sc->sc_flags & G_ELI_FLAG_NATIVE_BYTE_ORDER) != 0) bcopy(&offset, off, sizeof(off)); else le64enc(off, (uint64_t)offset); - /* Copy precalculated SHA256 context for IV-Key. */ - bcopy(&sc->sc_ivctx, &ctx, sizeof(ctx)); - SHA256_Update(&ctx, off, sizeof(off)); - SHA256_Final(hash, &ctx); - bcopy(hash, iv, size); + + switch (sc->sc_ealgo) { + case CRYPTO_AES_XTS: + bcopy(off, iv, sizeof(off)); + bzero(iv + sizeof(off), size - sizeof(off)); + break; + default: + { + u_char hash[SHA256_DIGEST_LENGTH]; + SHA256_CTX ctx; + + /* Copy precalculated SHA256 context for IV-Key. */ + bcopy(&sc->sc_ivctx, &ctx, sizeof(ctx)); + SHA256_Update(&ctx, off, sizeof(off)); + SHA256_Final(hash, &ctx); + bcopy(hash, iv, MIN(sizeof(hash), size)); + break; + } + } } int @@ -672,14 +685,23 @@ g_eli_create(struct gctl_req *req, struc * This is expensive operation and we can do it only once now or for * every access to sector, so now will be much better. */ - SHA256_Init(&sc->sc_ivctx); - SHA256_Update(&sc->sc_ivctx, sc->sc_ivkey, sizeof(sc->sc_ivkey)); + switch (sc->sc_ealgo) { + case CRYPTO_AES_XTS: + break; + default: + SHA256_Init(&sc->sc_ivctx); + SHA256_Update(&sc->sc_ivctx, sc->sc_ivkey, + sizeof(sc->sc_ivkey)); + break; + } LIST_INIT(&sc->sc_workers); bzero(&crie, sizeof(crie)); crie.cri_alg = sc->sc_ealgo; crie.cri_klen = sc->sc_ekeylen; + if (sc->sc_ealgo == CRYPTO_AES_XTS) + crie.cri_klen <<= 1; crie.cri_key = sc->sc_ekeys[0]; if (sc->sc_flags & G_ELI_FLAG_AUTH) { bzero(&cria, sizeof(cria)); Modified: head/sys/geom/eli/g_eli.h ============================================================================== --- head/sys/geom/eli/g_eli.h Thu Sep 23 11:57:25 2010 (r213069) +++ head/sys/geom/eli/g_eli.h Thu Sep 23 11:58:36 2010 (r213070) @@ -60,7 +60,7 @@ * 3 - Added 'configure' subcommand. * 4 - IV is generated from offset converted to little-endian * (flag G_ELI_FLAG_NATIVE_BYTE_ORDER will be set for older versions). - * 5 - Added multiple encrypton keys. + * 5 - Added multiple encrypton keys and AES-XTS support. */ #define G_ELI_VERSION 5 @@ -294,14 +294,26 @@ g_eli_str2ealgo(const char *name) if (strcasecmp("null", name) == 0) return (CRYPTO_NULL_CBC); + else if (strcasecmp("null-cbc", name) == 0) + return (CRYPTO_NULL_CBC); else if (strcasecmp("aes", name) == 0) + return (CRYPTO_AES_XTS); + else if (strcasecmp("aes-cbc", name) == 0) return (CRYPTO_AES_CBC); + else if (strcasecmp("aes-xts", name) == 0) + return (CRYPTO_AES_XTS); else if (strcasecmp("blowfish", name) == 0) return (CRYPTO_BLF_CBC); + else if (strcasecmp("blowfish-cbc", name) == 0) + return (CRYPTO_BLF_CBC); else if (strcasecmp("camellia", name) == 0) return (CRYPTO_CAMELLIA_CBC); + else if (strcasecmp("camellia-cbc", name) == 0) + return (CRYPTO_CAMELLIA_CBC); else if (strcasecmp("3des", name) == 0) return (CRYPTO_3DES_CBC); + else if (strcasecmp("3des-cbc", name) == 0) + return (CRYPTO_3DES_CBC); return (CRYPTO_ALGORITHM_MIN - 1); } @@ -333,6 +345,8 @@ g_eli_algo2str(u_int algo) return ("NULL"); case CRYPTO_AES_CBC: return ("AES-CBC"); + case CRYPTO_AES_XTS: + return ("AES-XTS"); case CRYPTO_BLF_CBC: return ("Blowfish-CBC"); case CRYPTO_CAMELLIA_CBC: @@ -418,6 +432,16 @@ g_eli_keylen(u_int algo, u_int keylen) default: return (0); } + case CRYPTO_AES_XTS: + switch (keylen) { + case 0: + return (128); + case 128: + case 256: + return (keylen); + default: + return (0); + } case CRYPTO_BLF_CBC: if (keylen == 0) return (128); Modified: head/sys/geom/eli/g_eli_crypto.c ============================================================================== --- head/sys/geom/eli/g_eli_crypto.c Thu Sep 23 11:57:25 2010 (r213069) +++ head/sys/geom/eli/g_eli_crypto.c Thu Sep 23 11:58:36 2010 (r213070) @@ -69,6 +69,9 @@ g_eli_crypto_cipher(u_int algo, int enc, u_char *p; int error; + KASSERT(algo != CRYPTO_AES_XTS, + ("%s: CRYPTO_AES_XTS unexpected here", __func__)); + bzero(&cri, sizeof(cri)); cri.cri_alg = algo; cri.cri_key = __DECONST(void *, key); @@ -136,6 +139,8 @@ g_eli_crypto_cipher(u_int algo, int enc, u_char iv[keysize]; int outsize; + assert(algo != CRYPTO_AES_XTS); + switch (algo) { case CRYPTO_NULL_CBC: type = EVP_enc_null(); @@ -212,6 +217,10 @@ g_eli_crypto_encrypt(u_int algo, u_char const u_char *key, size_t keysize) { + /* We prefer AES-CBC for metadata protection. */ + if (algo == CRYPTO_AES_XTS) + algo = CRYPTO_AES_CBC; + return (g_eli_crypto_cipher(algo, 1, data, datasize, key, keysize)); } @@ -220,6 +229,10 @@ g_eli_crypto_decrypt(u_int algo, u_char const u_char *key, size_t keysize) { + /* We prefer AES-CBC for metadata protection. */ + if (algo == CRYPTO_AES_XTS) + algo = CRYPTO_AES_CBC; + return (g_eli_crypto_cipher(algo, 0, data, datasize, key, keysize)); } Modified: head/sys/geom/eli/g_eli_integrity.c ============================================================================== --- head/sys/geom/eli/g_eli_integrity.c Thu Sep 23 11:57:25 2010 (r213069) +++ head/sys/geom/eli/g_eli_integrity.c Thu Sep 23 11:58:36 2010 (r213070) @@ -509,6 +509,8 @@ g_eli_auth_run(struct g_eli_worker *wr, crde->crd_alg = sc->sc_ealgo; crde->crd_key = g_eli_crypto_key(sc, dstoff, encr_secsize); crde->crd_klen = sc->sc_ekeylen; + if (sc->sc_ealgo == CRYPTO_AES_XTS) + crde->crd_klen <<= 1; g_eli_crypto_ivgen(sc, dstoff, crde->crd_iv, sizeof(crde->crd_iv)); Modified: head/sys/geom/eli/g_eli_privacy.c ============================================================================== --- head/sys/geom/eli/g_eli_privacy.c Thu Sep 23 11:57:25 2010 (r213069) +++ head/sys/geom/eli/g_eli_privacy.c Thu Sep 23 11:58:36 2010 (r213070) @@ -259,6 +259,8 @@ g_eli_crypto_run(struct g_eli_worker *wr crd->crd_alg = sc->sc_ealgo; crd->crd_key = g_eli_crypto_key(sc, dstoff, secsize); crd->crd_klen = sc->sc_ekeylen; + if (sc->sc_ealgo == CRYPTO_AES_XTS) + crd->crd_klen <<= 1; g_eli_crypto_ivgen(sc, dstoff, crd->crd_iv, sizeof(crd->crd_iv)); crd->crd_next = NULL; From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 12:00:40 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E47D11065675; Thu, 23 Sep 2010 12:00:40 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B9A0E8FC21; Thu, 23 Sep 2010 12:00:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8NC0ema068467; Thu, 23 Sep 2010 12:00:40 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8NC0elw068465; Thu, 23 Sep 2010 12:00:40 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009231200.o8NC0elw068465@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 23 Sep 2010 12:00:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213071 - head/sbin/geom/class/eli X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 12:00:41 -0000 Author: pjd Date: Thu Sep 23 12:00:40 2010 New Revision: 213071 URL: http://svn.freebsd.org/changeset/base/213071 Log: Document AES-XTS. MFC after: 1 week Modified: head/sbin/geom/class/eli/geli.8 Modified: head/sbin/geom/class/eli/geli.8 ============================================================================== --- head/sbin/geom/class/eli/geli.8 Thu Sep 23 11:58:36 2010 (r213070) +++ head/sbin/geom/class/eli/geli.8 Thu Sep 23 12:00:40 2010 (r213071) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2005-2008 Pawel Jakub Dawidek +.\" Copyright (c) 2005-2010 Pawel Jakub Dawidek .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 20, 2010 +.Dd September 23, 2010 .Dt GELI 8 .Os .Sh NAME @@ -151,11 +151,12 @@ framework, so when there is crypto hardw will make use of it automatically. .It Supports many cryptographic algorithms (currently -.Nm AES , -.Nm Blowfish , -.Nm Camellia +.Nm AES-XTS , +.Nm AES-CBC , +.Nm Blowfish-CBC , +.Nm Camellia-CBC and -.Nm 3DES ) . +.Nm 3DES-CBC ) . .It Can optionally perform data authentication (integrity verification) utilizing one of the following algorithms: @@ -257,13 +258,14 @@ as the .It Fl e Ar ealgo Encryption algorithm to use. Currently supported algorithms are: -.Nm AES , -.Nm Blowfish , -.Nm Camellia +.Nm AES-XTS , +.Nm AES-CBC , +.Nm Blowfish-CBC , +.Nm Camellia-CBC and -.Nm 3DES . +.Nm 3DES-CBC . The default and recommended algorithm is -.Nm AES . +.Nm AES-XTS . .It Fl i Ar iterations Number of iterations to use with PKCS#5v2. If this option is not specified, @@ -283,13 +285,13 @@ Here is how more than one file with a ke Key length to use with the given cryptographic algorithm. If not given, the default key length for the given algorithm is used, which is: 128 for -.Nm AES , -128 for -.Nm Blowfish , -128 for -.Nm Camellia +.Nm AES-XTS , +.Nm AES-CBC , +.Nm Blowfish-CBC +and +.Nm Camellia-CBC and 192 for -.Nm 3DES . +.Nm 3DES-CBC . .It Fl P Do not use passphrase as the key component. .It Fl s Ar sectorsize @@ -709,6 +711,21 @@ update the metadata: # geli resize -s 1g ada0p1 # geli attach -k keyfile -p ada0p1 .Ed +.Sh ENCRYPTION MODES +.Nm +supports two encryption modes: +.Nm XTS , +which was standarized as +.Nm IEE P1619 +and +.Nm CBC +with unpredictable IV. +The +.Nm CBC +mode used by +.Nm +is very similar to the mode +.Nm ESSIV . .Sh DATA AUTHENTICATION .Nm can verify data integrity when an authentication algorithm is specified. From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 12:02:09 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 225C0106566B; Thu, 23 Sep 2010 12:02:09 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 11B678FC17; Thu, 23 Sep 2010 12:02:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8NC28x1068541; Thu, 23 Sep 2010 12:02:08 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8NC285E068533; Thu, 23 Sep 2010 12:02:08 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009231202.o8NC285E068533@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 23 Sep 2010 12:02:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213072 - head/sys/geom/eli X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 12:02:09 -0000 Author: pjd Date: Thu Sep 23 12:02:08 2010 New Revision: 213072 URL: http://svn.freebsd.org/changeset/base/213072 Log: Update copyright years. MFC after: 1 week Modified: head/sys/geom/eli/g_eli.c head/sys/geom/eli/g_eli.h head/sys/geom/eli/g_eli_crypto.c head/sys/geom/eli/g_eli_ctl.c head/sys/geom/eli/g_eli_integrity.c head/sys/geom/eli/g_eli_key.c head/sys/geom/eli/g_eli_privacy.c Modified: head/sys/geom/eli/g_eli.c ============================================================================== --- head/sys/geom/eli/g_eli.c Thu Sep 23 12:00:40 2010 (r213071) +++ head/sys/geom/eli/g_eli.c Thu Sep 23 12:02:08 2010 (r213072) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2005-2006 Pawel Jakub Dawidek + * Copyright (c) 2005-2010 Pawel Jakub Dawidek * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/geom/eli/g_eli.h ============================================================================== --- head/sys/geom/eli/g_eli.h Thu Sep 23 12:00:40 2010 (r213071) +++ head/sys/geom/eli/g_eli.h Thu Sep 23 12:02:08 2010 (r213072) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2005-2006 Pawel Jakub Dawidek + * Copyright (c) 2005-2010 Pawel Jakub Dawidek * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/geom/eli/g_eli_crypto.c ============================================================================== --- head/sys/geom/eli/g_eli_crypto.c Thu Sep 23 12:00:40 2010 (r213071) +++ head/sys/geom/eli/g_eli_crypto.c Thu Sep 23 12:02:08 2010 (r213072) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2005 Pawel Jakub Dawidek + * Copyright (c) 2005-2010 Pawel Jakub Dawidek * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/geom/eli/g_eli_ctl.c ============================================================================== --- head/sys/geom/eli/g_eli_ctl.c Thu Sep 23 12:00:40 2010 (r213071) +++ head/sys/geom/eli/g_eli_ctl.c Thu Sep 23 12:02:08 2010 (r213072) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2005 Pawel Jakub Dawidek + * Copyright (c) 2005-2010 Pawel Jakub Dawidek * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/geom/eli/g_eli_integrity.c ============================================================================== --- head/sys/geom/eli/g_eli_integrity.c Thu Sep 23 12:00:40 2010 (r213071) +++ head/sys/geom/eli/g_eli_integrity.c Thu Sep 23 12:02:08 2010 (r213072) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2005-2006 Pawel Jakub Dawidek + * Copyright (c) 2005-2010 Pawel Jakub Dawidek * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/geom/eli/g_eli_key.c ============================================================================== --- head/sys/geom/eli/g_eli_key.c Thu Sep 23 12:00:40 2010 (r213071) +++ head/sys/geom/eli/g_eli_key.c Thu Sep 23 12:02:08 2010 (r213072) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2005 Pawel Jakub Dawidek + * Copyright (c) 2005-2010 Pawel Jakub Dawidek * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/geom/eli/g_eli_privacy.c ============================================================================== --- head/sys/geom/eli/g_eli_privacy.c Thu Sep 23 12:00:40 2010 (r213071) +++ head/sys/geom/eli/g_eli_privacy.c Thu Sep 23 12:02:08 2010 (r213072) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2005-2006 Pawel Jakub Dawidek + * Copyright (c) 2005-2010 Pawel Jakub Dawidek * All rights reserved. * * Redistribution and use in source and binary forms, with or without From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 12:02:42 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 934AF10656C2; Thu, 23 Sep 2010 12:02:42 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 82ACF8FC17; Thu, 23 Sep 2010 12:02:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8NC2gRI068596; Thu, 23 Sep 2010 12:02:42 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8NC2gIn068594; Thu, 23 Sep 2010 12:02:42 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009231202.o8NC2gIn068594@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 23 Sep 2010 12:02:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213073 - head/sbin/geom/class/eli X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 12:02:42 -0000 Author: pjd Date: Thu Sep 23 12:02:42 2010 New Revision: 213073 URL: http://svn.freebsd.org/changeset/base/213073 Log: Update copyright years. MFC after: 1 week Modified: head/sbin/geom/class/eli/geom_eli.c Modified: head/sbin/geom/class/eli/geom_eli.c ============================================================================== --- head/sbin/geom/class/eli/geom_eli.c Thu Sep 23 12:02:08 2010 (r213072) +++ head/sbin/geom/class/eli/geom_eli.c Thu Sep 23 12:02:42 2010 (r213073) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2004-2008 Pawel Jakub Dawidek + * Copyright (c) 2004-2010 Pawel Jakub Dawidek * All rights reserved. * * Redistribution and use in source and binary forms, with or without From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 12:04:13 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2223E10656A5; Thu, 23 Sep 2010 12:04:13 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 10CD38FC25; Thu, 23 Sep 2010 12:04:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8NC4CLr068745; Thu, 23 Sep 2010 12:04:12 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8NC4ChR068742; Thu, 23 Sep 2010 12:04:12 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009231204.o8NC4ChR068742@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 23 Sep 2010 12:04:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213074 - head/sbin/geom/misc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 12:04:13 -0000 Author: pjd Date: Thu Sep 23 12:04:12 2010 New Revision: 213074 URL: http://svn.freebsd.org/changeset/base/213074 Log: - Simplify code by using g_*() API. - Don't use u_char and u_int in userland. - Change 'unsigned' to 'unsigned int'. - Update copyright years. MFC after: 1 week Modified: head/sbin/geom/misc/subr.c head/sbin/geom/misc/subr.h Modified: head/sbin/geom/misc/subr.c ============================================================================== --- head/sbin/geom/misc/subr.c Thu Sep 23 12:02:42 2010 (r213073) +++ head/sbin/geom/misc/subr.c Thu Sep 23 12:04:12 2010 (r213074) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2004 Pawel Jakub Dawidek + * Copyright (c) 2004-2010 Pawel Jakub Dawidek * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -54,30 +54,20 @@ struct std_metadata { }; static void -std_metadata_decode(const u_char *data, struct std_metadata *md) +std_metadata_decode(const unsigned char *data, struct std_metadata *md) { bcopy(data, md->md_magic, sizeof(md->md_magic)); md->md_version = le32dec(data + 16); } -static void -pathgen(const char *name, char *path, size_t size) -{ - - if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) != 0) - snprintf(path, size, "%s%s", _PATH_DEV, name); - else - strlcpy(path, name, size); -} - /* * Greatest Common Divisor. */ -static unsigned -gcd(unsigned a, unsigned b) +static unsigned int +gcd(unsigned int a, unsigned int b) { - u_int c; + unsigned int c; while (b != 0) { c = a; @@ -90,8 +80,8 @@ gcd(unsigned a, unsigned b) /* * Least Common Multiple. */ -unsigned -g_lcm(unsigned a, unsigned b) +unsigned int +g_lcm(unsigned int a, unsigned int b) { return ((a * b) / gcd(a, b)); @@ -129,7 +119,7 @@ bitcount32(uint32_t x) * */ int -g_parse_lba(const char *lbastr, unsigned sectorsize, off_t *sectors) +g_parse_lba(const char *lbastr, unsigned int sectorsize, off_t *sectors) { off_t number, mult, unit; char *s; @@ -200,76 +190,69 @@ done: off_t g_get_mediasize(const char *name) { - char path[MAXPATHLEN]; off_t mediasize; int fd; - pathgen(name, path, sizeof(path)); - fd = open(path, O_RDONLY); + fd = g_open(name, 0); if (fd == -1) return (0); - if (ioctl(fd, DIOCGMEDIASIZE, &mediasize) < 0) { - close(fd); - return (0); - } - close(fd); + mediasize = g_mediasize(fd); + if (mediasize == -1) + mediasize = 0; + (void)g_close(fd); return (mediasize); } -unsigned +unsigned int g_get_sectorsize(const char *name) { - char path[MAXPATHLEN]; - unsigned sectorsize; + ssize_t sectorsize; int fd; - pathgen(name, path, sizeof(path)); - fd = open(path, O_RDONLY); + fd = g_open(name, 0); if (fd == -1) return (0); - if (ioctl(fd, DIOCGSECTORSIZE, §orsize) < 0) { - close(fd); - return (0); - } - close(fd); - return (sectorsize); + sectorsize = g_sectorsize(fd); + if (sectorsize == -1) + sectorsize = 0; + (void)g_close(fd); + return ((unsigned int)sectorsize); } int -g_metadata_read(const char *name, u_char *md, size_t size, const char *magic) +g_metadata_read(const char *name, unsigned char *md, size_t size, + const char *magic) { struct std_metadata stdmd; - char path[MAXPATHLEN]; - unsigned sectorsize; + unsigned char *sector; + ssize_t sectorsize; off_t mediasize; - u_char *sector; int error, fd; - pathgen(name, path, sizeof(path)); sector = NULL; error = 0; - fd = open(path, O_RDONLY); + fd = g_open(name, 0); if (fd == -1) return (errno); - mediasize = g_get_mediasize(name); - if (mediasize == 0) { + mediasize = g_mediasize(fd); + if (mediasize == -1) { error = errno; goto out; } - sectorsize = g_get_sectorsize(name); - if (sectorsize == 0) { + sectorsize = g_sectorsize(fd); + if (sectorsize == -1) { error = errno; goto out; } - assert(sectorsize >= size); + assert(sectorsize >= (ssize_t)size); sector = malloc(sectorsize); if (sector == NULL) { error = ENOMEM; goto out; } if (pread(fd, sector, sectorsize, mediasize - sectorsize) != - (ssize_t)sectorsize) { + sectorsize) { error = errno; goto out; } @@ -284,37 +267,35 @@ g_metadata_read(const char *name, u_char out: if (sector != NULL) free(sector); - close(fd); + g_close(fd); return (error); } int -g_metadata_store(const char *name, u_char *md, size_t size) +g_metadata_store(const char *name, const unsigned char *md, size_t size) { - char path[MAXPATHLEN]; - unsigned sectorsize; + unsigned char *sector; + ssize_t sectorsize; off_t mediasize; - u_char *sector; int error, fd; - pathgen(name, path, sizeof(path)); sector = NULL; error = 0; - fd = open(path, O_WRONLY); + fd = g_open(name, 1); if (fd == -1) return (errno); - mediasize = g_get_mediasize(name); - if (mediasize == 0) { + mediasize = g_mediasize(fd); + if (mediasize == -1) { error = errno; goto out; } - sectorsize = g_get_sectorsize(name); - if (sectorsize == 0) { + sectorsize = g_sectorsize(fd); + if (sectorsize == -1) { error = errno; goto out; } - assert(sectorsize >= size); + assert(sectorsize >= (ssize_t)size); sector = malloc(sectorsize); if (sector == NULL) { error = ENOMEM; @@ -322,15 +303,15 @@ g_metadata_store(const char *name, u_cha } bcopy(md, sector, size); if (pwrite(fd, sector, sectorsize, mediasize - sectorsize) != - (ssize_t)sectorsize) { + sectorsize) { error = errno; goto out; } - (void)ioctl(fd, DIOCGFLUSH, NULL); + (void)g_flush(fd); out: if (sector != NULL) free(sector); - close(fd); + (void)g_close(fd); return (error); } @@ -338,25 +319,23 @@ int g_metadata_clear(const char *name, const char *magic) { struct std_metadata md; - char path[MAXPATHLEN]; - unsigned sectorsize; + unsigned char *sector; + ssize_t sectorsize; off_t mediasize; - u_char *sector; int error, fd; - pathgen(name, path, sizeof(path)); sector = NULL; error = 0; - fd = open(path, O_RDWR); + fd = g_open(name, 1); if (fd == -1) return (errno); - mediasize = g_get_mediasize(name); + mediasize = g_mediasize(fd); if (mediasize == 0) { error = errno; goto out; } - sectorsize = g_get_sectorsize(name); + sectorsize = g_sectorsize(fd); if (sectorsize == 0) { error = errno; goto out; @@ -368,7 +347,7 @@ g_metadata_clear(const char *name, const } if (magic != NULL) { if (pread(fd, sector, sectorsize, mediasize - sectorsize) != - (ssize_t)sectorsize) { + sectorsize) { error = errno; goto out; } @@ -380,15 +359,15 @@ g_metadata_clear(const char *name, const } bzero(sector, sectorsize); if (pwrite(fd, sector, sectorsize, mediasize - sectorsize) != - (ssize_t)sectorsize) { + sectorsize) { error = errno; goto out; } - (void)ioctl(fd, DIOCGFLUSH, NULL); + (void)g_flush(fd); out: if (sector != NULL) free(sector); - close(fd); + g_close(fd); return (error); } @@ -412,8 +391,8 @@ gctl_get_param(struct gctl_req *req, siz { struct gctl_req_arg *argp; char param[256]; + unsigned int i; void *p; - unsigned i; vsnprintf(param, sizeof(param), pfmt, ap); for (i = 0; i < req->narg; i++) { @@ -486,7 +465,7 @@ gctl_change_param(struct gctl_req *req, const void *value) { struct gctl_req_arg *ap; - unsigned i; + unsigned int i; if (req == NULL || req->error != NULL) return (EDOOFUS); Modified: head/sbin/geom/misc/subr.h ============================================================================== --- head/sbin/geom/misc/subr.h Thu Sep 23 12:02:42 2010 (r213073) +++ head/sbin/geom/misc/subr.h Thu Sep 23 12:04:12 2010 (r213074) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2004 Pawel Jakub Dawidek + * Copyright (c) 2004-2010 Pawel Jakub Dawidek * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,16 +30,16 @@ #define _SUBR_H_ #include -unsigned g_lcm(unsigned a, unsigned b); +unsigned int g_lcm(unsigned int a, unsigned int b); uint32_t bitcount32(uint32_t x); -int g_parse_lba(const char *lbastr, unsigned sectorsize, off_t *sectors); +int g_parse_lba(const char *lbastr, unsigned int sectorsize, off_t *sectors); off_t g_get_mediasize(const char *name); -unsigned g_get_sectorsize(const char *name); +unsigned int g_get_sectorsize(const char *name); -int g_metadata_read(const char *name, u_char *md, size_t size, +int g_metadata_read(const char *name, unsigned char *md, size_t size, const char *magic); -int g_metadata_store(const char *name, u_char *md, size_t size); +int g_metadata_store(const char *name, const unsigned char *md, size_t size); int g_metadata_clear(const char *name, const char *magic); void gctl_error(struct gctl_req *req, const char *error, ...) __printflike(2, 3); From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 14:06:15 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 75187106564A; Thu, 23 Sep 2010 14:06:15 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 644C78FC12; Thu, 23 Sep 2010 14:06:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8NE6FsE071317; Thu, 23 Sep 2010 14:06:15 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8NE6FuZ071314; Thu, 23 Sep 2010 14:06:15 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009231406.o8NE6FuZ071314@svn.freebsd.org> From: Marius Strobl Date: Thu, 23 Sep 2010 14:06:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213075 - in head: libexec/tftpd usr.bin/tftp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 14:06:15 -0000 Author: marius Date: Thu Sep 23 14:06:15 2010 New Revision: 213075 URL: http://svn.freebsd.org/changeset/base/213075 Log: Try to adhere to style.Makefile(5). MFC after: 3 days Modified: head/libexec/tftpd/Makefile head/usr.bin/tftp/Makefile Modified: head/libexec/tftpd/Makefile ============================================================================== --- head/libexec/tftpd/Makefile Thu Sep 23 12:04:12 2010 (r213074) +++ head/libexec/tftpd/Makefile Thu Sep 23 14:06:15 2010 (r213075) @@ -2,13 +2,11 @@ # $FreeBSD$ PROG= tftpd -SRCS= tftpd.c tftp-io.c tftp-utils.c tftp-file.c tftp-transfer.c tftp-options.c +MAN= tftpd.8 +SRCS= tftp-file.c tftp-io.c tftp-options.c tftp-transfer.c tftp-utils.c +SRCS+= tftpd.c WARNS= 3 WFORMAT=0 -MAN= tftpd.8 -CFLAGS+=-I${.CURDIR}/../../usr.bin/tftp -I${.CURDIR}/../../libexec/tftpd -.PATH: ${.CURDIR}/../../usr.bin/tftp -COPTFLAGS = -O LDFLAGS= -lwrap .include Modified: head/usr.bin/tftp/Makefile ============================================================================== --- head/usr.bin/tftp/Makefile Thu Sep 23 12:04:12 2010 (r213074) +++ head/usr.bin/tftp/Makefile Thu Sep 23 14:06:15 2010 (r213075) @@ -1,12 +1,14 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 # $FreeBSD$ -WARNS= 3 +.PATH: ${.CURDIR}/../../libexec/tftpd + PROG= tftp -SRCS= main.c tftp.c tftp-utils.c tftp-io.c tftp-file.c tftp-transfer.c tftp-options.c +SRCS= main.c tftp-file.c tftp-io.c tftp-options.c tftp-transfer.c +SRCS+= tftp-utils.c tftp.c +WARNS= 3 +CFLAGS+=-I${.CURDIR}/../../libexec/tftpd DPADD= ${LIBEDIT} ${LIBTERMCAP} LDADD= -ledit -ltermcap -CFLAGS+=-I${.CURDIR}/../../libexec/tftpd -I${.CURDIR}/../../usr.bin/tftp -.PATH: ${.CURDIR}/../../libexec/tftpd .include From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 14:25:57 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 00B0E106566C; Thu, 23 Sep 2010 14:25:57 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id C6A338FC1C; Thu, 23 Sep 2010 14:25:56 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 7337346C0A; Thu, 23 Sep 2010 10:25:56 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 43E8F8A04F; Thu, 23 Sep 2010 10:25:55 -0400 (EDT) From: John Baldwin To: Bruce Cran Date: Thu, 23 Sep 2010 09:53:55 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201009211507.o8LF7iVv097676@svn.freebsd.org> <4C9A6EE6.5050301@freebsd.org> <20100922222441.00002f27@unknown> In-Reply-To: <20100922222441.00002f27@unknown> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201009230953.56201.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Thu, 23 Sep 2010 10:25:55 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Gavin Atkinson , src-committers@freebsd.org, Andriy Gapon Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 14:25:57 -0000 On Wednesday, September 22, 2010 5:24:41 pm Bruce Cran wrote: > On Thu, 23 Sep 2010 00:02:30 +0300 > Andriy Gapon wrote: > > > But what was the reason that dumpdev="AUTO" was reverted? > > I remember that POLA was quoted at the time. > > I am not sure what the astonishment actually was - perhaps 'AUTO' was > > not smart enough and destroyed somebody's data? > > > > The problem with "AUTO" is that it takes time to do the dump unless > using textdumps; it also has the potential of failing and leaving the > system unusable until someone resets it. I believe the argument was > that for production servers you want the system to be up and running > again as soon as possible after a crash. minidumps have made the time issue less of a concern on large-memory systems (full dumps do indeed take a long time on modern systems). I think textdumps are just as likely to fail as regular dumps though since they both use the same code for writing out the dump, they just write different bits to the dump area. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 14:31:20 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 19BE5106567A; Thu, 23 Sep 2010 14:31:20 +0000 (UTC) (envelope-from mj@feral.com) Received: from ns1.feral.com (ns1.feral.com [192.67.166.1]) by mx1.freebsd.org (Postfix) with ESMTP id BA5388FC1A; Thu, 23 Sep 2010 14:31:19 +0000 (UTC) Received: from [192.168.1.2] (m206-63.dsl.tsoft.com [198.144.206.63]) by ns1.feral.com (8.14.3/8.14.3) with ESMTP id o8NEVFvh035307; Thu, 23 Sep 2010 07:31:15 -0700 (PDT) (envelope-from mj@feral.com) Message-ID: <4C9B64B1.4090907@feral.com> Date: Thu, 23 Sep 2010 07:31:13 -0700 From: Matthew Jacob Organization: Feral Software User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4 MIME-Version: 1.0 To: John Baldwin References: <201009211507.o8LF7iVv097676@svn.freebsd.org> <4C9A6EE6.5050301@freebsd.org> <20100922222441.00002f27@unknown> <201009230953.56201.jhb@freebsd.org> In-Reply-To: <201009230953.56201.jhb@freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-4.2.6 (ns1.feral.com [192.67.166.1]); Thu, 23 Sep 2010 07:31:15 -0700 (PDT) Cc: Bruce Cran , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, Andriy Gapon , Gavin Atkinson , svn-src-head@FreeBSD.org Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 14:31:20 -0000 There are a lot of accelerations that can be applied here- so much so that Panasas elected to stick with minidumps rather than go to text dumps, even though there is a fairly hard time limit that a blade can be down before more drastic error recovery mechanisms for the shelf kick in. It turns out that the big issue here was more the savecore time coming back up rather than the time of dumping. > minidumps have made the time issue less of a concern on large-memory systems > (full dumps do indeed take a long time on modern systems). I think textdumps > are just as likely to fail as regular dumps though since they both use the > same code for writing out the dump, they just write different bits to the dump > area. > From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 14:49:02 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B112E106566B; Thu, 23 Sep 2010 14:49:02 +0000 (UTC) (envelope-from avg@freebsd.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 3431B8FC0A; Thu, 23 Sep 2010 14:49:00 +0000 (UTC) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id RAA26161; Thu, 23 Sep 2010 17:48:59 +0300 (EEST) (envelope-from avg@freebsd.org) Message-ID: <4C9B68DB.9010401@freebsd.org> Date: Thu, 23 Sep 2010 17:48:59 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.9) Gecko/20100920 Lightning/1.0b2 Thunderbird/3.1.4 MIME-Version: 1.0 To: John Baldwin References: <201009211507.o8LF7iVv097676@svn.freebsd.org> <4C9A6EE6.5050301@freebsd.org> <20100922222441.00002f27@unknown> <201009230953.56201.jhb@freebsd.org> In-Reply-To: <201009230953.56201.jhb@freebsd.org> X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Bruce Cran , svn-src-head@freebsd.org, svn-src-all@freebsd.org, Gavin Atkinson , src-committers@freebsd.org Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 14:49:02 -0000 on 23/09/2010 16:53 John Baldwin said the following: > minidumps have made the time issue less of a concern on large-memory systems > (full dumps do indeed take a long time on modern systems). I think textdumps > are just as likely to fail as regular dumps though since they both use the > same code for writing out the dump, they just write different bits to the dump > area. Well, minidumps are not always very small. And there's still that issue of other CPUs still running during panic->dumping and thus (mini-)dump maps getting changed (larger) after dump size calculations which results in an aborted dump. -- Andriy Gapon From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 14:59:11 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E02891065696; Thu, 23 Sep 2010 14:59:10 +0000 (UTC) (envelope-from kensmith@buffalo.edu) Received: from localmailB.acsu.buffalo.edu (localmail.buffalo.edu [128.205.5.200]) by mx1.freebsd.org (Postfix) with ESMTP id 96B018FC22; Thu, 23 Sep 2010 14:59:10 +0000 (UTC) Received: from localmailB.acsu.buffalo.edu (localhost [127.0.0.1]) by localhost (Postfix) with SMTP id B9FED2F3D; Thu, 23 Sep 2010 10:59:09 -0400 (EDT) Received: from localmailB.acsu.buffalo.edu (localhost [127.0.0.1]) by localmailB.acsu.buffalo.edu (Postfix) with ESMTP id 2A6A029A6; Thu, 23 Sep 2010 10:58:08 -0400 (EDT) Received: from mweb2.acsu.buffalo.edu (mweb2.acsu.buffalo.edu [128.205.5.239]) by localmailB.acsu.buffalo.edu (Prefixe) with ESMTP id 033D92E95; Thu, 23 Sep 2010 10:58:08 -0400 (EDT) Received: from [128.205.32.76] (bauer.cse.buffalo.edu [128.205.32.76]) by mweb2.acsu.buffalo.edu (Postfix) with ESMTP id E1B3C207A9; Thu, 23 Sep 2010 10:58:07 -0400 (EDT) From: Ken Smith To: Bruce Cran In-Reply-To: <20100922222441.00002f27@unknown> References: <201009211507.o8LF7iVv097676@svn.freebsd.org> <4C9A1602.4020204@freebsd.org> <1285169017.64197.29.camel@buffy.york.ac.uk> <201009221558.27393.jhb@freebsd.org> <4C9A6EE6.5050301@freebsd.org> <20100922222441.00002f27@unknown> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-3A6k1mQFOC+28WuonU2M" Date: Thu, 23 Sep 2010 10:58:07 -0400 Message-ID: <1285253887.95760.33.camel@bauer.cse.buffalo.edu> Mime-Version: 1.0 X-Mailer: Evolution 2.28.2 FreeBSD GNOME Team Port X-PM-EL-Spam-Prob: : 8% Cc: src-committers@freebsd.org, John Baldwin , svn-src-all@freebsd.org, Andriy Gapon , Gavin Atkinson , svn-src-head@freebsd.org Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 14:59:11 -0000 --=-3A6k1mQFOC+28WuonU2M Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable On Wed, 2010-09-22 at 22:24 +0100, Bruce Cran wrote: > On Thu, 23 Sep 2010 00:02:30 +0300 > Andriy Gapon wrote: >=20 > > But what was the reason that dumpdev=3D"AUTO" was reverted? > > I remember that POLA was quoted at the time. > > I am not sure what the astonishment actually was - perhaps 'AUTO' was > > not smart enough and destroyed somebody's data? > >=20 >=20 > The problem with "AUTO" is that it takes time to do the dump unless > using textdumps; it also has the potential of failing and leaving the > system unusable until someone resets it. I believe the argument was > that for production servers you want the system to be up and running > again as soon as possible after a crash.=20 >=20 I'm (extremely!) sympathetic with people wanting to make it easier to get debugging information in PRs and that sort of thing. But just so you know - unless I hear otherwise I'll be continuing to try to remember to flip it off as the stable branches get created. The issues talked about so far all contribute to the reason for that. But one of the more basic gut reactions to it all is that the users want to be interested in helping with the debugging (even if just providing the requested info) for any sort of crash information to be useful. And at the point we shift something from -current to -stable the percentage of people actively interested in participating in that sort of stuff flip. The bulk of people using -current know it's risky and they do it out of some interest in debugging stuff. The *bulk* of people using -stable are less interested or flat out not interested. And have no clue what crash dumps are, may be challenged to notice partition-getting-full issues, etc. I'm open to having my mind changed about this if there is enough push-back. Just saying I'm not there yet. --=20 Ken Smith - From there to here, from here to | kensmith@buffalo.edu there, funny things are everywhere. | - Theodore Geisel | --=-3A6k1mQFOC+28WuonU2M Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEABECAAYFAkybau8ACgkQ/G14VSmup/adhwCdEPdurdcRqfpLCuMKzQX8TuP5 BecAn25cOvpqh1t9VMh2prMpV0LHXDek =vGKa -----END PGP SIGNATURE----- --=-3A6k1mQFOC+28WuonU2M-- From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 17:12:47 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 567F21065673; Thu, 23 Sep 2010 17:12:47 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 45C398FC20; Thu, 23 Sep 2010 17:12:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8NHClBF075384; Thu, 23 Sep 2010 17:12:47 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8NHClB9075382; Thu, 23 Sep 2010 17:12:47 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201009231712.o8NHClB9075382@svn.freebsd.org> From: Warner Losh Date: Thu, 23 Sep 2010 17:12:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213077 - head/sys/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 17:12:47 -0000 Author: imp Date: Thu Sep 23 17:12:47 2010 New Revision: 213077 URL: http://svn.freebsd.org/changeset/base/213077 Log: Simplify how we find the kernel source. Rather than depending on sys, or some variation in the path, the new version assumes that $0 is newvers.sh path, and that dirname $0/.. is the same as $S aka $SYSDIR. It also removes knowledge of ${MACHINE} and ${MACHINE_ARCH}, which is also good. # I've had this in my tree for about 6 months now, which is why I # didn't notice that I broke it in r209510 and that was fixed in # r212954. This should finally resolve the issues people had with # r204824 as well as address the issues that motivated r204824. Modified: head/sys/conf/newvers.sh Modified: head/sys/conf/newvers.sh ============================================================================== --- head/sys/conf/newvers.sh Thu Sep 23 15:10:28 2010 (r213076) +++ head/sys/conf/newvers.sh Thu Sep 23 17:12:47 2010 (r213077) @@ -38,13 +38,14 @@ if [ "X${BRANCH_OVERRIDE}" != "X" ]; the fi RELEASE="${REVISION}-${BRANCH}" VERSION="${TYPE} ${RELEASE}" +SYSDIR=$(dirname $0)/.. if [ "X${PARAMFILE}" != "X" ]; then RELDATE=$(awk '/__FreeBSD_version.*propagated to newvers/ {print $3}' \ ${PARAMFILE}) else RELDATE=$(awk '/__FreeBSD_version.*propagated to newvers/ {print $3}' \ - $(dirname $0)/../sys/param.h) + ${SYSDIR}/sys/param.h) fi @@ -87,51 +88,43 @@ touch version v=`cat version` u=${USER:-root} d=`pwd` h=${HOSTNAME:-`hostname`} t=`date` i=`${MAKE:-make} -V KERN_IDENT` -case "$d" in -*/sys/*) - SRCDIR=${d##*obj} - if [ -n "$MACHINE" ]; then - SRCDIR=${SRCDIR##/$MACHINE.$MACHINE_ARCH} +for dir in /bin /usr/bin /usr/local/bin; do + if [ -d "${SYSDIR}/.svn" -a -x "${dir}/svnversion" ] ; then + svnversion=${dir}/svnversion + break + fi + if [ -d "${SYSDIR}/../.git" -a -x "${dir}/git" ] ; then + git_cmd="${dir}/git --git-dir=${SYSDIR}/../.git" + break fi - SRCDIR=${SRCDIR%%/sys/*} +done - for dir in /bin /usr/bin /usr/local/bin; do - if [ -d "${SRCDIR}/sys/.svn" -a -x "${dir}/svnversion" ] ; then - svnversion=${dir}/svnversion - break - fi - if [ -d "${SRCDIR}/.git" -a -x "${dir}/git" ] ; then - git_cmd="${dir}/git --git-dir=${SRCDIR}/.git" - break - fi - done +if [ -n "$svnversion" ] ; then + echo "$svnversion" + svn=" r`cd ${SYSDIR} && $svnversion`" +fi - if [ -n "$svnversion" ] ; then - svn=" r`cd ${SRCDIR}/sys && $svnversion`" - fi - if [ -n "$git_cmd" ] ; then - git=`$git_cmd rev-parse --verify --short HEAD 2>/dev/null` - svn=`$git_cmd svn find-rev $git 2>/dev/null` - if [ -n "$svn" ] ; then +if [ -n "$git_cmd" ] ; then + git=`$git_cmd rev-parse --verify --short HEAD 2>/dev/null` + svn=`$git_cmd svn find-rev $git 2>/dev/null` + if [ -n "$svn" ] ; then + svn=" r${svn}" + git="=${git}" + else + svn=`$git_cmd log | fgrep 'git-svn-id:' | head -1 | \ + sed -n 's/^.*@\([0-9][0-9]*\).*$/\1/p'` + if [ -n $svn ] ; then svn=" r${svn}" - git="=${git}" + git="+${git}" else - svn=`$git_cmd log | fgrep 'git-svn-id:' | head -1 | \ - sed -n 's/^.*@\([0-9][0-9]*\).*$/\1/p'` - if [ -n $svn ] ; then - svn=" r${svn}" - git="+${git}" - else - git=" ${git}" - fi - fi - if $git_cmd --work-tree=${SRCDIR} diff-index \ - --name-only HEAD | read dummy; then - git="${git}-dirty" + git=" ${git}" fi fi - ;; -esac + if $git_cmd --work-tree=${SYSDIR}/.. diff-index \ + --name-only HEAD | read dummy; then + git="${git}-dirty" + fi +fi cat << EOF > vers.c $COPYRIGHT From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 17:30:00 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 23061106566B; Thu, 23 Sep 2010 17:30:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E5F288FC0A; Thu, 23 Sep 2010 17:29:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8NHTxBK075758; Thu, 23 Sep 2010 17:29:59 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8NHTxSQ075756; Thu, 23 Sep 2010 17:29:59 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201009231729.o8NHTxSQ075756@svn.freebsd.org> From: Warner Losh Date: Thu, 23 Sep 2010 17:29:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213078 - head/sys/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 17:30:00 -0000 Author: imp Date: Thu Sep 23 17:29:59 2010 New Revision: 213078 URL: http://svn.freebsd.org/changeset/base/213078 Log: Clean up stray line in 213077 Modified: head/sys/conf/newvers.sh Modified: head/sys/conf/newvers.sh ============================================================================== --- head/sys/conf/newvers.sh Thu Sep 23 17:12:47 2010 (r213077) +++ head/sys/conf/newvers.sh Thu Sep 23 17:29:59 2010 (r213078) @@ -48,7 +48,6 @@ else ${SYSDIR}/sys/param.h) fi - b=share/examples/etc/bsd-style-copyright year=`date '+%Y'` # look for copyright template From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 17:37:57 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DBE6E106567A; Thu, 23 Sep 2010 17:37:57 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B01E78FC16; Thu, 23 Sep 2010 17:37:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8NHbvUe075974; Thu, 23 Sep 2010 17:37:57 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8NHbv5x075972; Thu, 23 Sep 2010 17:37:57 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201009231737.o8NHbv5x075972@svn.freebsd.org> From: Jilles Tjoelker Date: Thu, 23 Sep 2010 17:37:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213079 - stable/8/bin/expr X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 17:37:58 -0000 Author: jilles Date: Thu Sep 23 17:37:57 2010 New Revision: 213079 URL: http://svn.freebsd.org/changeset/base/213079 Log: MFC r212390: expr(1): Add sh(1) versions of examples, remove an incorrect example. The three examples are better done using sh(1) itself these days. The example expr -- "$a" : ".*" is incorrect in the general case, as "$a" may be an operator. Modified: stable/8/bin/expr/expr.1 Directory Properties: stable/8/bin/expr/ (props changed) Modified: stable/8/bin/expr/expr.1 ============================================================================== --- stable/8/bin/expr/expr.1 Thu Sep 23 17:29:59 2010 (r213078) +++ stable/8/bin/expr/expr.1 Thu Sep 23 17:37:57 2010 (r213079) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 12, 2004 +.Dd September 9, 2010 .Dt EXPR 1 .Os .Sh NAME @@ -217,6 +217,9 @@ command, one might rearrange the express More generally, parenthesize possibly-negative values: .Dl "a=$(expr \e( $a \e) + 1)" .It +With shell arithmetic, no escaping is required: +.Dl "a=$((a + 1))" +.It This example prints the filename portion of a pathname stored in variable .Va a . @@ -229,6 +232,12 @@ The .Li // characters resolve this ambiguity. .Dl "expr \*q//$a\*q \&: '.*/\e(.*\e)'" +.It +With modern +.Xr sh 1 +syntax, +.Dl "\*q${a##*/}\*q" +expands to the same value. .El .Pp The following examples output the number of characters in variable @@ -237,19 +246,21 @@ Again, if .Va a might begin with a hyphen, it is necessary to prevent it from being interpreted as an option to -.Nm . +.Nm , +and +.Va a +might be interpreted as an operator. .Bl -bullet .It -If the -.Nm -command conforms to -.St -p1003.1-2001 , -this is simple: -.Dl "expr -- \*q$a\*q \&: \*q.*\*q" -.It -For portability to older systems, however, a more complicated command +To deal with all of this, a complicated command is required: .Dl "expr \e( \*qX$a\*q \&: \*q.*\*q \e) - 1" +.It +With modern +.Xr sh 1 +syntax, this can be done much more easily: +.Dl "${#a}" +expands to the required number. .El .Sh SEE ALSO .Xr sh 1 , From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 17:47:46 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9972F1065693; Thu, 23 Sep 2010 17:47:46 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 891A58FC12; Thu, 23 Sep 2010 17:47:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8NHlkdk076197; Thu, 23 Sep 2010 17:47:46 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8NHlk3x076195; Thu, 23 Sep 2010 17:47:46 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201009231747.o8NHlk3x076195@svn.freebsd.org> From: Ed Maste Date: Thu, 23 Sep 2010 17:47:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213080 - head/sys/rpc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 17:47:46 -0000 Author: emaste Date: Thu Sep 23 17:47:46 2010 New Revision: 213080 URL: http://svn.freebsd.org/changeset/base/213080 Log: Remove unnecessary weak reference that was apparently copied from the version of this function in lib/libc/inet/inet_pton.c MFC after: 1 week Modified: head/sys/rpc/inet_pton.c Modified: head/sys/rpc/inet_pton.c ============================================================================== --- head/sys/rpc/inet_pton.c Thu Sep 23 17:37:57 2010 (r213079) +++ head/sys/rpc/inet_pton.c Thu Sep 23 17:47:46 2010 (r213080) @@ -218,11 +218,4 @@ inet_pton6(const char *src, u_char *dst) return (1); } -/* - * Weak aliases for applications that use certain private entry points, - * and fail to include . - */ -#undef inet_pton -__weak_reference(__inet_pton, inet_pton); - /*! \file */ From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 18:00:03 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1FB41106566B; Thu, 23 Sep 2010 18:00:03 +0000 (UTC) (envelope-from gavin@ury.york.ac.uk) Received: from gse-mta-27.emailfiltering.com (gse-mta-27-tx.emailfiltering.com [194.116.198.158]) by mx1.freebsd.org (Postfix) with ESMTP id 1DCD98FC14; Thu, 23 Sep 2010 18:00:01 +0000 (UTC) Received: from mail-gw5.york.ac.uk ([144.32.129.29]) by gse-mta-27.emailfiltering.com with emfmta (version 4.6.0.72) by TLS id 755133664 for kensmith@buffalo.edu; 31e5c2905fa20a47; Thu, 23 Sep 2010 18:59:55 +0100 Received: from ury.york.ac.uk ([144.32.108.81]:38213) by mail-gw5.york.ac.uk with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1Oyq5J-0006Zx-TJ; Thu, 23 Sep 2010 18:59:53 +0100 Received: from gavin (helo=localhost) by ury.york.ac.uk with local-esmtp (Exim 4.72) (envelope-from ) id 1Oyq5J-0007cT-Ls; Thu, 23 Sep 2010 18:59:53 +0100 Date: Thu, 23 Sep 2010 18:59:53 +0100 (BST) From: Gavin Atkinson X-X-Sender: gavin@ury.york.ac.uk To: Ken Smith In-Reply-To: <1285253887.95760.33.camel@bauer.cse.buffalo.edu> Message-ID: References: <201009211507.o8LF7iVv097676@svn.freebsd.org> <4C9A1602.4020204@freebsd.org> <1285169017.64197.29.camel@buffy.york.ac.uk> <201009221558.27393.jhb@freebsd.org> <4C9A6EE6.5050301@freebsd.org> <20100922222441.00002f27@unknown> <1285253887.95760.33.camel@bauer.cse.buffalo.edu> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: Cc: Bruce Cran , src-committers@freebsd.org, John Baldwin , svn-src-all@freebsd.org, Andriy Gapon , svn-src-head@freebsd.org Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 18:00:03 -0000 On Thu, 23 Sep 2010, Ken Smith wrote: > The issues talked about so far all contribute to the reason for that. > But one of the more basic gut reactions to it all is that the users > want to be interested in helping with the debugging (even if just > providing the requested info) for any sort of crash information > to be useful. And at the point we shift something from -current > to -stable the percentage of people actively interested in participating > in that sort of stuff flip. The bulk of people using -current > know it's risky and they do it out of some interest in debugging > stuff. The *bulk* of people using -stable are less interested or > flat out not interested. And have no clue what crash dumps are, > may be challenged to notice partition-getting-full issues, etc. I'm not sure I buy this argument, I'm afraid. Part of the advantage of having all this done automatically on the as-shipped release media is that end users don't have to be interested in debugging - crashinfo(8) does most of the work for them. There's no easy way to actually determine figures, but even if say only 10-15% of crashes can be diagnosed and corrected just from the output of crashinfo(8) then that's a huge win for the project as a whole. I'm guessing 10-15% is not unrealistic. I appreciate the issue about filling partitions is a valid one. Would a possible compromise be that on release media, crashinfo(8) or similar will default to only keeping the most recent coredump or similar? Given /var now defaults to 4GB, Defaulting to keeping a single core is probably acceptable. Gavin From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 18:55:55 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F3AD31065789; Thu, 23 Sep 2010 18:55:54 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B3C678FC2A; Thu, 23 Sep 2010 18:55:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8NItsSB077662; Thu, 23 Sep 2010 18:55:54 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8NIts49077660; Thu, 23 Sep 2010 18:55:54 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009231855.o8NIts49077660@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 23 Sep 2010 18:55:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213081 - head/sys/dev/bge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 18:55:55 -0000 Author: yongari Date: Thu Sep 23 18:55:54 2010 New Revision: 213081 URL: http://svn.freebsd.org/changeset/base/213081 Log: Always show asic/chip revision in device attach phase. There are too many bge(4) controllers there and model name does not necessarily match asic/chip revision. Relying on VPD string made it hard to identify exact asic/chip revision so the first step to debug bge(4) was getting exact asic/chip information with verbose boot which may not be available on production server. Modified: head/sys/dev/bge/if_bge.c Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Thu Sep 23 17:47:46 2010 (r213080) +++ head/sys/dev/bge/if_bge.c Thu Sep 23 18:55:54 2010 (r213081) @@ -2644,12 +2644,11 @@ bge_attach(device_t dev) goto fail; } - if (bootverbose) - device_printf(dev, - "CHIP ID 0x%08x; ASIC REV 0x%02x; CHIP REV 0x%02x; %s\n", - sc->bge_chipid, sc->bge_asicrev, sc->bge_chiprev, - (sc->bge_flags & BGE_FLAG_PCIX) ? "PCI-X" : - ((sc->bge_flags & BGE_FLAG_PCIE) ? "PCI-E" : "PCI")); + device_printf(dev, + "CHIP ID 0x%08x; ASIC REV 0x%02x; CHIP REV 0x%02x; %s\n", + sc->bge_chipid, sc->bge_asicrev, sc->bge_chiprev, + (sc->bge_flags & BGE_FLAG_PCIX) ? "PCI-X" : + ((sc->bge_flags & BGE_FLAG_PCIE) ? "PCI-E" : "PCI")); BGE_LOCK_INIT(sc, device_get_nameunit(dev)); From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 19:21:49 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7443F106564A; Thu, 23 Sep 2010 19:21:49 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4863B8FC0A; Thu, 23 Sep 2010 19:21:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8NJLnFV078197; Thu, 23 Sep 2010 19:21:49 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8NJLn0E078195; Thu, 23 Sep 2010 19:21:49 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201009231921.o8NJLn0E078195@svn.freebsd.org> From: Jilles Tjoelker Date: Thu, 23 Sep 2010 19:21:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213082 - stable/7/bin/expr X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:21:49 -0000 Author: jilles Date: Thu Sep 23 19:21:49 2010 New Revision: 213082 URL: http://svn.freebsd.org/changeset/base/213082 Log: MFC r212390: expr(1): Add sh(1) versions of examples, remove an incorrect example. The three examples are better done using sh(1) itself these days. The example expr -- "$a" : ".*" is incorrect in the general case, as "$a" may be an operator. Modified: stable/7/bin/expr/expr.1 Directory Properties: stable/7/bin/expr/ (props changed) Modified: stable/7/bin/expr/expr.1 ============================================================================== --- stable/7/bin/expr/expr.1 Thu Sep 23 18:55:54 2010 (r213081) +++ stable/7/bin/expr/expr.1 Thu Sep 23 19:21:49 2010 (r213082) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 12, 2004 +.Dd September 9, 2010 .Dt EXPR 1 .Os .Sh NAME @@ -217,6 +217,9 @@ command, one might rearrange the express More generally, parenthesize possibly-negative values: .Dl "a=$(expr \e( $a \e) + 1)" .It +With shell arithmetic, no escaping is required: +.Dl "a=$((a + 1))" +.It This example prints the filename portion of a pathname stored in variable .Va a . @@ -229,6 +232,12 @@ The .Li // characters resolve this ambiguity. .Dl "expr \*q//$a\*q \&: '.*/\e(.*\e)'" +.It +With modern +.Xr sh 1 +syntax, +.Dl "\*q${a##*/}\*q" +expands to the same value. .El .Pp The following examples output the number of characters in variable @@ -237,19 +246,21 @@ Again, if .Va a might begin with a hyphen, it is necessary to prevent it from being interpreted as an option to -.Nm . +.Nm , +and +.Va a +might be interpreted as an operator. .Bl -bullet .It -If the -.Nm -command conforms to -.St -p1003.1-2001 , -this is simple: -.Dl "expr -- \*q$a\*q \&: \*q.*\*q" -.It -For portability to older systems, however, a more complicated command +To deal with all of this, a complicated command is required: .Dl "expr \e( \*qX$a\*q \&: \*q.*\*q \e) - 1" +.It +With modern +.Xr sh 1 +syntax, this can be done much more easily: +.Dl "${#a}" +expands to the required number. .El .Sh SEE ALSO .Xr sh 1 , From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 19:36:34 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E8F46106567A; Thu, 23 Sep 2010 19:36:34 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D7AD18FC1A; Thu, 23 Sep 2010 19:36:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8NJaYi4078541; Thu, 23 Sep 2010 19:36:34 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8NJaYI2078539; Thu, 23 Sep 2010 19:36:34 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201009231936.o8NJaYI2078539@svn.freebsd.org> From: Jilles Tjoelker Date: Thu, 23 Sep 2010 19:36:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213083 - stable/7/bin/test X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:36:35 -0000 Author: jilles Date: Thu Sep 23 19:36:34 2010 New Revision: 213083 URL: http://svn.freebsd.org/changeset/base/213083 Log: MFC r212418: test(1): Clarify grammar ambiguity and -a/-o vs shell &&/||. Modified: stable/7/bin/test/test.1 Directory Properties: stable/7/bin/test/ (props changed) Modified: stable/7/bin/test/test.1 ============================================================================== --- stable/7/bin/test/test.1 Thu Sep 23 19:21:49 2010 (r213082) +++ stable/7/bin/test/test.1 Thu Sep 23 19:36:34 2010 (r213083) @@ -32,7 +32,7 @@ .\" @(#)test.1 8.1 (Berkeley) 5/31/93 .\" $FreeBSD$ .\" -.Dd July 31, 2006 +.Dd September 10, 2010 .Dt TEST 1 .Os .Sh NAME @@ -310,6 +310,14 @@ are evaluated consistently according to standards document. All other cases are subject to the ambiguity in the command semantics. +.Pp +In particular, only expressions containing +.Fl a , +.Fl o , +.Cm \&( +or +.Cm \&) +can be ambiguous. .Sh EXIT STATUS The .Nm @@ -338,12 +346,11 @@ specification. Both sides are always evaluated in .Fl a and -.Fl o , -unlike in the logical operators of -.Xr sh 1 . +.Fl o . For instance, the writable status of .Pa file will be tested by the following command even though the former expression indicated false, which results in a gratuitous access to the file system: -.Pp .Dl "[ -z abc -a -w file ]" +To avoid this, write +.Dl "[ -z abc ] && [ -w file ]" From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 19:38:09 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51363106567A; Thu, 23 Sep 2010 19:38:09 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 401E78FC23; Thu, 23 Sep 2010 19:38:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8NJc9gl078616; Thu, 23 Sep 2010 19:38:09 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8NJc94V078614; Thu, 23 Sep 2010 19:38:09 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201009231938.o8NJc94V078614@svn.freebsd.org> From: Jilles Tjoelker Date: Thu, 23 Sep 2010 19:38:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213084 - stable/7/bin/test X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:38:09 -0000 Author: jilles Date: Thu Sep 23 19:38:08 2010 New Revision: 213084 URL: http://svn.freebsd.org/changeset/base/213084 Log: MFC r212419: test(1): Fix markup, ( and ) must be separate arguments so leave spaces. Modified: stable/7/bin/test/test.1 Directory Properties: stable/7/bin/test/ (props changed) Modified: stable/7/bin/test/test.1 ============================================================================== --- stable/7/bin/test/test.1 Thu Sep 23 19:36:34 2010 (r213083) +++ stable/7/bin/test/test.1 Thu Sep 23 19:38:08 2010 (r213084) @@ -282,7 +282,7 @@ True if either or .Ar expression2 are true. -.It Cm \&( Ns Ar expression Ns Cm \&) +.It Cm \&( Ar expression Cm \&) True if expression is true. .El .Pp From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 20:37:30 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1A0C51065675; Thu, 23 Sep 2010 20:37:30 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 087738FC08; Thu, 23 Sep 2010 20:37:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8NKbT7o079886; Thu, 23 Sep 2010 20:37:29 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8NKbTkv079885; Thu, 23 Sep 2010 20:37:29 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201009232037.o8NKbTkv079885@svn.freebsd.org> From: Jilles Tjoelker Date: Thu, 23 Sep 2010 20:37:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213085 - stable/8/tools/regression/bin/sh/builtins X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 20:37:30 -0000 Author: jilles Date: Thu Sep 23 20:37:29 2010 New Revision: 213085 URL: http://svn.freebsd.org/changeset/base/213085 Log: MFC r212187: sh: Add a test that 'read' leaves the file pointer at the correct place. Naive buffering would break the common while read x... construct, which did not appear to be tested yet. Added: stable/8/tools/regression/bin/sh/builtins/read2.0 - copied unchanged from r212187, head/tools/regression/bin/sh/builtins/read2.0 Modified: Directory Properties: stable/8/tools/regression/bin/sh/ (props changed) Copied: stable/8/tools/regression/bin/sh/builtins/read2.0 (from r212187, head/tools/regression/bin/sh/builtins/read2.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/builtins/read2.0 Thu Sep 23 20:37:29 2010 (r213085, copy of r212187, head/tools/regression/bin/sh/builtins/read2.0) @@ -0,0 +1,31 @@ +# $FreeBSD$ + +set -e +{ + echo 1 + echo two + echo three +} | { + read x + [ "$x" = 1 ] + (read x + [ "$x" = two ]) + read x + [ "$x" = three ] +} + +T=`mktemp sh-test.XXXXXX` +trap 'rm -f "$T"' 0 +{ + echo 1 + echo two + echo three +} >$T +{ + read x + [ "$x" = 1 ] + (read x + [ "$x" = two ]) + read x + [ "$x" = three ] +} <$T From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 20:49:34 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 01C341065674; Thu, 23 Sep 2010 20:49:34 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C9CB58FC18; Thu, 23 Sep 2010 20:49:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8NKnXYg080148; Thu, 23 Sep 2010 20:49:33 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8NKnXhd080146; Thu, 23 Sep 2010 20:49:33 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201009232049.o8NKnXhd080146@svn.freebsd.org> From: Jilles Tjoelker Date: Thu, 23 Sep 2010 20:49:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213086 - stable/8/tools/regression/bin/sh/builtins X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 20:49:34 -0000 Author: jilles Date: Thu Sep 23 20:49:33 2010 New Revision: 213086 URL: http://svn.freebsd.org/changeset/base/213086 Log: MFC r212330: sh: Add simple tests for backslashes in the read builtin. Added: stable/8/tools/regression/bin/sh/builtins/read3.0 - copied unchanged from r212330, head/tools/regression/bin/sh/builtins/read3.0 stable/8/tools/regression/bin/sh/builtins/read3.0.stdout - copied unchanged from r212330, head/tools/regression/bin/sh/builtins/read3.0.stdout Modified: Directory Properties: stable/8/tools/regression/bin/sh/ (props changed) Copied: stable/8/tools/regression/bin/sh/builtins/read3.0 (from r212330, head/tools/regression/bin/sh/builtins/read3.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/builtins/read3.0 Thu Sep 23 20:49:33 2010 (r213086, copy of r212330, head/tools/regression/bin/sh/builtins/read3.0) @@ -0,0 +1,11 @@ +# $FreeBSD$ + +printf '%s\n' 'a\ b c' | { read a b; printf '%s\n' "x${a}x${b}x"; } +printf '%s\n' 'a b\ c' | { read a b; printf '%s\n' "x${a}x${b}x"; } +printf '%s\n' 'a\:b:c' | { IFS=: read a b; printf '%s\n' "x${a}x${b}x"; } +printf '%s\n' 'a:b\:c' | { IFS=: read a b; printf '%s\n' "x${a}x${b}x"; } +printf '%s\n' '\ a' | { read a b; printf '%s\n' "x${a}x${b}x"; } +printf '%s\n' '\:a' | { IFS=: read a b; printf '%s\n' "x${a}x${b}x"; } +printf '%s\n' '\\' | { read a b; printf '%s\n' "x${a}x${b}x"; } +printf '%s\n' '\\\ a' | { read a b; printf '%s\n' "x${a}x${b}x"; } +printf '%s\n' '\\\ a' | { read -r a b; printf '%s\n' "x${a}x${b}x"; } Copied: stable/8/tools/regression/bin/sh/builtins/read3.0.stdout (from r212330, head/tools/regression/bin/sh/builtins/read3.0.stdout) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/builtins/read3.0.stdout Thu Sep 23 20:49:33 2010 (r213086, copy of r212330, head/tools/regression/bin/sh/builtins/read3.0.stdout) @@ -0,0 +1,9 @@ +xa bxcx +xaxb cx +xa:bxcx +xaxb:cx +x axx +x:axx +x\xx +x\ axx +x\\\xax From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 21:36:10 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 947111065696; Thu, 23 Sep 2010 21:36:10 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 67E358FC16; Thu, 23 Sep 2010 21:36:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8NLaAFx081161; Thu, 23 Sep 2010 21:36:10 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8NLaAjG081157; Thu, 23 Sep 2010 21:36:10 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201009232136.o8NLaAjG081157@svn.freebsd.org> From: Jilles Tjoelker Date: Thu, 23 Sep 2010 21:36:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213087 - in stable/8: bin/sh tools/regression/bin/sh/builtins X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 21:36:10 -0000 Author: jilles Date: Thu Sep 23 21:36:10 2010 New Revision: 213087 URL: http://svn.freebsd.org/changeset/base/213087 Log: MFC r212339: sh: Fix 'read' if all chars before the first IFS char are backslash-escaped. Backslash-escaped characters did not set the flag for a non-IFS character. Added: stable/8/tools/regression/bin/sh/builtins/read4.0 - copied unchanged from r212339, head/tools/regression/bin/sh/builtins/read4.0 stable/8/tools/regression/bin/sh/builtins/read4.0.stdout - copied unchanged from r212339, head/tools/regression/bin/sh/builtins/read4.0.stdout Modified: stable/8/bin/sh/miscbltin.c Directory Properties: stable/8/bin/sh/ (props changed) stable/8/tools/regression/bin/sh/ (props changed) Modified: stable/8/bin/sh/miscbltin.c ============================================================================== --- stable/8/bin/sh/miscbltin.c Thu Sep 23 20:49:33 2010 (r213086) +++ stable/8/bin/sh/miscbltin.c Thu Sep 23 21:36:10 2010 (r213087) @@ -174,6 +174,7 @@ readcmd(int argc __unused, char **argv _ continue; if (backslash) { backslash = 0; + startword = 0; if (c != '\n') STPUTC(c, p); continue; Copied: stable/8/tools/regression/bin/sh/builtins/read4.0 (from r212339, head/tools/regression/bin/sh/builtins/read4.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/builtins/read4.0 Thu Sep 23 21:36:10 2010 (r213087, copy of r212339, head/tools/regression/bin/sh/builtins/read4.0) @@ -0,0 +1,10 @@ +# $FreeBSD$ + +printf '%s\n' '\a\ b c' | { read a b; printf '%s\n' "x${a}x${b}x"; } +printf '%s\n' '\a b\ c' | { read a b; printf '%s\n' "x${a}x${b}x"; } +printf '%s\n' '\a\:b:c' | { IFS=: read a b; printf '%s\n' "x${a}x${b}x"; } +printf '%s\n' '\a:b\:c' | { IFS=: read a b; printf '%s\n' "x${a}x${b}x"; } +printf '%s\n' '\\ a' | { read a b; printf '%s\n' "x${a}x${b}x"; } +printf '%s\n' '\\:a' | { IFS=: read a b; printf '%s\n' "x${a}x${b}x"; } +printf '%s\n' '\\\ a' | { read a b; printf '%s\n' "x${a}x${b}x"; } +printf '%s\n' '\\\:a' | { IFS=: read a b; printf '%s\n' "x${a}x${b}x"; } Copied: stable/8/tools/regression/bin/sh/builtins/read4.0.stdout (from r212339, head/tools/regression/bin/sh/builtins/read4.0.stdout) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/builtins/read4.0.stdout Thu Sep 23 21:36:10 2010 (r213087, copy of r212339, head/tools/regression/bin/sh/builtins/read4.0.stdout) @@ -0,0 +1,8 @@ +xa bxcx +xaxb cx +xa:bxcx +xaxb:cx +x\xax +x\xax +x\ axx +x\:axx From owner-svn-src-all@FreeBSD.ORG Thu Sep 23 23:05:31 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A046D106566B; Thu, 23 Sep 2010 23:05:31 +0000 (UTC) (envelope-from ivoras@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8EA818FC13; Thu, 23 Sep 2010 23:05:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8NN5V4b083017; Thu, 23 Sep 2010 23:05:31 GMT (envelope-from ivoras@svn.freebsd.org) Received: (from ivoras@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8NN5V2C083015; Thu, 23 Sep 2010 23:05:31 GMT (envelope-from ivoras@svn.freebsd.org) Message-Id: <201009232305.o8NN5V2C083015@svn.freebsd.org> From: Ivan Voras Date: Thu, 23 Sep 2010 23:05:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213088 - stable/8/sys/fs/tmpfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 23:05:31 -0000 Author: ivoras Date: Thu Sep 23 23:05:31 2010 New Revision: 213088 URL: http://svn.freebsd.org/changeset/base/213088 Log: MFC r212305 : Avoid "Entry can disappear before we lock fdvp" panic. Modified: stable/8/sys/fs/tmpfs/tmpfs_vnops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/8/sys/fs/tmpfs/tmpfs_vnops.c Thu Sep 23 21:36:10 2010 (r213087) +++ stable/8/sys/fs/tmpfs/tmpfs_vnops.c Thu Sep 23 23:05:31 2010 (r213088) @@ -902,10 +902,14 @@ tmpfs_rename(struct vop_rename_args *v) fnode = VP_TO_TMPFS_NODE(fvp); de = tmpfs_dir_lookup(fdnode, fnode, fcnp); - /* Avoid manipulating '.' and '..' entries. */ + /* Entry can disappear before we lock fdvp, + * also avoid manipulating '.' and '..' entries. */ if (de == NULL) { - MPASS(fvp->v_type == VDIR); - error = EINVAL; + if ((fcnp->cn_flags & ISDOTDOT) != 0 || + (fcnp->cn_namelen == 1 && fcnp->cn_nameptr[0] == '.')) + error = EINVAL; + else + error = ENOENT; goto out_locked; } MPASS(de->td_node == fnode); From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 00:14:24 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 78CE8106566C; Fri, 24 Sep 2010 00:14:24 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 669C48FC20; Fri, 24 Sep 2010 00:14:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8O0EOM8084406; Fri, 24 Sep 2010 00:14:24 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8O0EOA8084403; Fri, 24 Sep 2010 00:14:24 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201009240014.o8O0EOA8084403@svn.freebsd.org> From: Juli Mallett Date: Fri, 24 Sep 2010 00:14:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213089 - head/sys/mips/cavium X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 00:14:24 -0000 Author: jmallett Date: Fri Sep 24 00:14:24 2010 New Revision: 213089 URL: http://svn.freebsd.org/changeset/base/213089 Log: Flesh out PCI bus support some: o) Reset and configure the bus from scratch rather than expecting U-Boot to do it for us. Values and configuration from Linux, U-Boot and comments in the Cavium Simple Executive sources. o) Do a resource assignment and bus numbering pass in the absence of a PCI BIOS or firmware that will do it for us. XXX This has to be the third or fourth instance of this in FreeBSD and it would be nice to have it become part of the PCI bus driver itself, like it is on Linux. o) Fix interrupt mapping for and adjust bus configuration for the Lanner MR-955, based on information provided by Lanner. Modified: head/sys/mips/cavium/octopci.c head/sys/mips/cavium/octopcireg.h Modified: head/sys/mips/cavium/octopci.c ============================================================================== --- head/sys/mips/cavium/octopci.c Thu Sep 23 23:05:31 2010 (r213088) +++ head/sys/mips/cavium/octopci.c Fri Sep 24 00:14:24 2010 (r213089) @@ -61,13 +61,19 @@ __FBSDID("$FreeBSD$"); #include "pcib_if.h" +#define NPI_WRITE(addr, value) cvmx_write64_uint32((addr) ^ 4, (value)) +#define NPI_READ(addr) cvmx_read64_uint32((addr) ^ 4) + struct octopci_softc { device_t sc_dev; unsigned sc_domain; unsigned sc_bus; + unsigned sc_io_next; struct rman sc_io; + + unsigned sc_mem1_next; struct rman sc_mem1; }; @@ -86,6 +92,9 @@ static void octopci_write_config(device_ uint32_t, int); static int octopci_route_interrupt(device_t, device_t, int); +static void octopci_init_bar(device_t, unsigned, unsigned, unsigned, unsigned); +static unsigned octopci_init_device(device_t, unsigned, unsigned, unsigned, unsigned); +static unsigned octopci_init_bus(device_t, unsigned); static uint64_t octopci_cs_addr(unsigned, unsigned, unsigned, unsigned); static void @@ -108,13 +117,205 @@ static int octopci_attach(device_t dev) { struct octopci_softc *sc; + cvmx_npi_mem_access_subid_t npi_mem_access_subid; + cvmx_npi_pci_int_arb_cfg_t npi_pci_int_arb_cfg; + cvmx_npi_ctl_status_t npi_ctl_status; + cvmx_pci_ctl_status_2_t pci_ctl_status_2; + cvmx_pci_cfg56_t pci_cfg56; + cvmx_pci_cfg22_t pci_cfg22; + cvmx_pci_cfg16_t pci_cfg16; + cvmx_pci_cfg19_t pci_cfg19; + cvmx_pci_cfg01_t pci_cfg01; + unsigned subbus; + unsigned i; int error; /* - * XXX - * We currently rely on U-Boot to set up the PCI in host state. We - * should properly initialize the PCI bus here. + * Reset the PCI bus. + */ + cvmx_write_csr(CVMX_CIU_SOFT_PRST, 0x1); + cvmx_read_csr(CVMX_CIU_SOFT_PRST); + + DELAY(2000); + + npi_ctl_status.u64 = 0; + npi_ctl_status.s.max_word = 1; + npi_ctl_status.s.timer = 1; + cvmx_write_csr(CVMX_NPI_CTL_STATUS, npi_ctl_status.u64); + + /* + * Set host mode. + */ + switch (cvmx_sysinfo_get()->board_type) { +#if defined(OCTEON_VENDOR_LANNER) + case CVMX_BOARD_TYPE_CUST_LANNER_MR955: + /* 32-bit PCI-X */ + cvmx_write_csr(CVMX_CIU_SOFT_PRST, 0x0); + break; +#endif + default: + /* 64-bit PCI-X */ + cvmx_write_csr(CVMX_CIU_SOFT_PRST, 0x4); + break; + } + cvmx_read_csr(CVMX_CIU_SOFT_PRST); + + DELAY(2000); + + /* + * Enable BARs and configure big BAR mode. + */ + pci_ctl_status_2.u32 = 0; + pci_ctl_status_2.s.bb1_hole = 5; /* 256MB hole in BAR1 */ + pci_ctl_status_2.s.bb1_siz = 1; /* BAR1 is 2GB */ + pci_ctl_status_2.s.bb_ca = 1; /* Bypass cache for big BAR */ + pci_ctl_status_2.s.bb_es = 1; /* Do big BAR byte-swapping */ + pci_ctl_status_2.s.bb1 = 1; /* BAR1 is big */ + pci_ctl_status_2.s.bb0 = 1; /* BAR0 is big */ + pci_ctl_status_2.s.bar2pres = 1; /* BAR2 present */ + pci_ctl_status_2.s.pmo_amod = 1; /* Round-robin priority */ + pci_ctl_status_2.s.tsr_hwm = 1; + pci_ctl_status_2.s.bar2_enb = 1; /* Enable BAR2 */ + pci_ctl_status_2.s.bar2_esx = 1; /* Do BAR2 byte-swapping */ + pci_ctl_status_2.s.bar2_cax = 1; /* Bypass cache for BAR2 */ + + NPI_WRITE(CVMX_NPI_PCI_CTL_STATUS_2, pci_ctl_status_2.u32); + + DELAY(2000); + + pci_ctl_status_2.u32 = NPI_READ(CVMX_NPI_PCI_CTL_STATUS_2); + + device_printf(dev, "%u-bit PCI%s bus.\n", + pci_ctl_status_2.s.ap_64ad ? 64 : 32, + pci_ctl_status_2.s.ap_pcix ? "-X" : ""); + + /* + * Set up transaction splitting, etc., parameters. + */ + pci_cfg19.u32 = 0; + pci_cfg19.s.mrbcm = 1; + if (pci_ctl_status_2.s.ap_pcix) { + pci_cfg19.s.mdrrmc = 0; + pci_cfg19.s.tdomc = 4; + } else { + pci_cfg19.s.mdrrmc = 2; + pci_cfg19.s.tdomc = 1; + } + NPI_WRITE(CVMX_NPI_PCI_CFG19, pci_cfg19.u32); + NPI_READ(CVMX_NPI_PCI_CFG19); + + /* + * Set up PCI error handling and memory access. */ + pci_cfg01.u32 = 0; + pci_cfg01.s.fbbe = 1; + pci_cfg01.s.see = 1; + pci_cfg01.s.pee = 1; + pci_cfg01.s.me = 1; + pci_cfg01.s.msae = 1; + if (pci_ctl_status_2.s.ap_pcix) { + pci_cfg01.s.fbb = 0; + } else { + pci_cfg01.s.fbb = 1; + } + NPI_WRITE(CVMX_NPI_PCI_CFG01, pci_cfg01.u32); + NPI_READ(CVMX_NPI_PCI_CFG01); + + /* + * Enable the Octeon bus arbiter. + */ + npi_pci_int_arb_cfg.u64 = 0; + npi_pci_int_arb_cfg.s.en = 1; + cvmx_write_csr(CVMX_NPI_PCI_INT_ARB_CFG, npi_pci_int_arb_cfg.u64); + + /* + * Disable master latency timer. + */ + pci_cfg16.u32 = 0; + pci_cfg16.s.mltd = 1; + NPI_WRITE(CVMX_NPI_PCI_CFG16, pci_cfg16.u32); + NPI_READ(CVMX_NPI_PCI_CFG16); + + /* + * Configure master arbiter. + */ + pci_cfg22.u32 = 0; + pci_cfg22.s.flush = 1; + pci_cfg22.s.mrv = 255; + NPI_WRITE(CVMX_NPI_PCI_CFG22, pci_cfg22.u32); + NPI_READ(CVMX_NPI_PCI_CFG22); + + /* + * Set up PCI-X capabilities. + */ + if (pci_ctl_status_2.s.ap_pcix) { + pci_cfg56.u32 = 0; + pci_cfg56.s.most = 3; + pci_cfg56.s.roe = 1; /* Enable relaxed ordering */ + pci_cfg56.s.dpere = 1; + pci_cfg56.s.ncp = 0xe8; + pci_cfg56.s.pxcid = 7; + NPI_WRITE(CVMX_NPI_PCI_CFG56, pci_cfg56.u32); + NPI_READ(CVMX_NPI_PCI_CFG56); + } + + NPI_WRITE(CVMX_NPI_PCI_READ_CMD_6, 0x22); + NPI_READ(CVMX_NPI_PCI_READ_CMD_6); + NPI_WRITE(CVMX_NPI_PCI_READ_CMD_C, 0x33); + NPI_READ(CVMX_NPI_PCI_READ_CMD_C); + NPI_WRITE(CVMX_NPI_PCI_READ_CMD_E, 0x33); + NPI_READ(CVMX_NPI_PCI_READ_CMD_E); + + /* + * Configure MEM1 sub-DID access. + */ + npi_mem_access_subid.u64 = 0; + npi_mem_access_subid.s.esr = 1; /* Byte-swap on read */ + npi_mem_access_subid.s.esw = 1; /* Byte-swap on write */ + switch (cvmx_sysinfo_get()->board_type) { +#if defined(OCTEON_VENDOR_LANNER) + case CVMX_BOARD_TYPE_CUST_LANNER_MR955: + npi_mem_access_subid.s.shortl = 1; + break; +#endif + default: + break; + } + cvmx_write_csr(CVMX_NPI_MEM_ACCESS_SUBID3, npi_mem_access_subid.u64); + + /* + * Configure BAR2. Linux says this has to come first. + */ + NPI_WRITE(CVMX_NPI_PCI_CFG08, 0x00000000); + NPI_READ(CVMX_NPI_PCI_CFG08); + NPI_WRITE(CVMX_NPI_PCI_CFG09, 0x00000080); + NPI_READ(CVMX_NPI_PCI_CFG09); + + /* + * Disable BAR1 IndexX. + */ + for (i = 0; i < 32; i++) { + NPI_WRITE(CVMX_NPI_PCI_BAR1_INDEXX(i), 0); + NPI_READ(CVMX_NPI_PCI_BAR1_INDEXX(i)); + } + + /* + * Configure BAR0 and BAR1. + */ + NPI_WRITE(CVMX_NPI_PCI_CFG04, 0x00000000); + NPI_READ(CVMX_NPI_PCI_CFG04); + NPI_WRITE(CVMX_NPI_PCI_CFG05, 0x00000000); + NPI_READ(CVMX_NPI_PCI_CFG05); + + NPI_WRITE(CVMX_NPI_PCI_CFG06, 0x80000000); + NPI_READ(CVMX_NPI_PCI_CFG06); + NPI_WRITE(CVMX_NPI_PCI_CFG07, 0x00000000); + NPI_READ(CVMX_NPI_PCI_CFG07); + + /* + * Clear PCI interrupts. + */ + cvmx_write_csr(CVMX_NPI_PCI_INT_SUM2, 0xffffffffffffffffull); sc = device_get_softc(dev); sc->sc_dev = dev; @@ -143,6 +344,19 @@ octopci_attach(device_t dev) if (error != 0) return (error); + /* + * Next offsets for resource allocation in octopci_init_bar. + */ + sc->sc_io_next = 0; + sc->sc_mem1_next = 0; + + /* + * Configure devices. + */ + octopci_write_config(dev, 0, 0, 0, PCIR_SUBBUS_1, 0xff, 1); + subbus = octopci_init_bus(dev, 0); + octopci_write_config(dev, 0, 0, 0, PCIR_SUBBUS_1, subbus, 1); + device_add_child(dev, "pci", 0); return (bus_generic_attach(dev)); @@ -336,12 +550,20 @@ octopci_route_interrupt(device_t dev, de func = pci_get_function(child); #if defined(OCTEON_VENDOR_LANNER) - if (slot < 32) { - if (slot == 3 || slot == 9) - irq = pin; - else - irq = pin - 1; - return (CVMX_IRQ_PCI_INT0 + (irq & 3)); + switch (cvmx_sysinfo_get()->board_type) { + case CVMX_BOARD_TYPE_CUST_LANNER_MR955: + return (CVMX_IRQ_PCI_INT0 + pin - 1); + case CVMX_BOARD_TYPE_CUST_LANNER_MR320: + if (slot < 32) { + if (slot == 3 || slot == 9) + irq = pin; + else + irq = pin - 1; + return (CVMX_IRQ_PCI_INT0 + (irq & 3)); + } + break; + default: + break; } #endif @@ -350,6 +572,184 @@ octopci_route_interrupt(device_t dev, de return (CVMX_IRQ_PCI_INT0 + (irq & 3)); } +static void +octopci_init_bar(device_t dev, unsigned b, unsigned s, unsigned f, unsigned barnum) +{ + struct octopci_softc *sc; + uint32_t bar; + unsigned size; + + sc = device_get_softc(dev); + + octopci_write_config(dev, b, s, f, PCIR_BAR(barnum), 0xffffffff, 4); + bar = octopci_read_config(dev, b, s, f, PCIR_BAR(barnum), 4); + + if (bar == 0) { + /* Bar not implemented. */ + return; + } + + /* XXX Some of this is wrong for 64-bit busses. */ + + if (PCI_BAR_IO(bar)) { + size = ~(bar & PCIM_BAR_IO_BASE) + 1; + + sc->sc_io_next = (sc->sc_io_next + size - 1) & ~(size - 1); + if (sc->sc_io_next + size > CVMX_OCT_PCI_IO_SIZE) { + device_printf(dev, "%02x.%02x:%02x: no ports for BAR%u.\n", + b, s, f, barnum); + return; + } + octopci_write_config(dev, b, s, f, PCIR_BAR(barnum), + CVMX_OCT_PCI_IO_BASE + sc->sc_io_next, 4); + sc->sc_io_next += size; + } else { + size = ~(bar & (uint32_t)PCIM_BAR_MEM_BASE) + 1; + + sc->sc_mem1_next = (sc->sc_mem1_next + size - 1) & ~(size - 1); + if (sc->sc_mem1_next + size > CVMX_OCT_PCI_MEM1_SIZE) { + device_printf(dev, "%02x.%02x:%02x: no memory for BAR%u.\n", + b, s, f, barnum); + return; + } + octopci_write_config(dev, b, s, f, PCIR_BAR(barnum), + CVMX_OCT_PCI_MEM1_BASE + sc->sc_mem1_next, 4); + sc->sc_mem1_next += size; + } +} + +static unsigned +octopci_init_device(device_t dev, unsigned b, unsigned s, unsigned f, unsigned secbus) +{ + unsigned barnum, bars; + uint8_t brctl; + uint8_t class, subclass; + uint8_t command; + uint8_t hdrtype; + + /* Read header type (again.) */ + hdrtype = octopci_read_config(dev, b, s, f, PCIR_HDRTYPE, 1); + + /* Program BARs. */ + switch (hdrtype & PCIM_HDRTYPE) { + case PCIM_HDRTYPE_NORMAL: + bars = 6; + break; + case PCIM_HDRTYPE_BRIDGE: + bars = 2; + break; + case PCIM_HDRTYPE_CARDBUS: + bars = 0; + break; + default: + device_printf(dev, "%02x.%02x:%02x: invalid header type %#x\n", + b, s, f, hdrtype); + return (secbus); + } + + for (barnum = 0; barnum < bars; barnum++) + octopci_init_bar(dev, b, s, f, barnum); + + /* Enable memory and I/O. */ + command = octopci_read_config(dev, b, s, f, PCIR_COMMAND, 1); + command |= PCIM_CMD_MEMEN | PCIM_CMD_PORTEN; + + /* Enable bus mastering. */ + command |= PCIM_CMD_BUSMASTEREN; + octopci_write_config(dev, b, s, f, PCIR_COMMAND, command, 1); + + /* Configure PCI-PCI bridges. */ + class = octopci_read_config(dev, b, s, f, PCIR_CLASS, 1); + if (class != PCIC_BRIDGE) + return (secbus); + + subclass = octopci_read_config(dev, b, s, f, PCIR_SUBCLASS, 1); + if (subclass != PCIS_BRIDGE_PCI) + return (secbus); + + /* Enable errors and parity checking. Do a bus reset. */ + brctl = octopci_read_config(dev, b, s, f, PCIR_BRIDGECTL_1, 1); + brctl |= PCIB_BCR_PERR_ENABLE | PCIB_BCR_SERR_ENABLE; + + /* Perform a secondary bus reset. */ + brctl |= PCIB_BCR_SECBUS_RESET; + octopci_write_config(dev, b, s, f, PCIR_BRIDGECTL_1, brctl, 1); + DELAY(100000); + brctl &= ~PCIB_BCR_SECBUS_RESET; + octopci_write_config(dev, b, s, f, PCIR_BRIDGECTL_1, brctl, 1); + + secbus++; + + /* Program memory and I/O ranges. */ + octopci_write_config(dev, b, s, f, PCIR_MEMBASE_1, + CVMX_OCT_PCI_MEM1_BASE >> 16, 2); + octopci_write_config(dev, b, s, f, PCIR_MEMLIMIT_1, + (CVMX_OCT_PCI_MEM1_BASE + CVMX_OCT_PCI_MEM1_SIZE - 1) >> 16, 2); + + octopci_write_config(dev, b, s, f, PCIR_IOBASEL_1, + CVMX_OCT_PCI_IO_BASE >> 8, 1); + octopci_write_config(dev, b, s, f, PCIR_IOBASEH_1, + CVMX_OCT_PCI_IO_BASE >> 16, 2); + + octopci_write_config(dev, b, s, f, PCIR_IOLIMITL_1, + (CVMX_OCT_PCI_IO_BASE + CVMX_OCT_PCI_IO_SIZE - 1) >> 8, 1); + octopci_write_config(dev, b, s, f, PCIR_IOLIMITH_1, + (CVMX_OCT_PCI_IO_BASE + CVMX_OCT_PCI_IO_SIZE - 1) >> 16, 2); + + /* Program prefetchable memory decoder. */ + /* XXX */ + + /* Probe secondary/subordinate buses. */ + octopci_write_config(dev, b, s, f, PCIR_PRIBUS_1, b, 1); + octopci_write_config(dev, b, s, f, PCIR_SECBUS_1, secbus, 1); + octopci_write_config(dev, b, s, f, PCIR_SUBBUS_1, 0xff, 1); + + /* Perform a secondary bus reset. */ + brctl |= PCIB_BCR_SECBUS_RESET; + octopci_write_config(dev, b, s, f, PCIR_BRIDGECTL_1, brctl, 1); + DELAY(100000); + brctl &= ~PCIB_BCR_SECBUS_RESET; + octopci_write_config(dev, b, s, f, PCIR_BRIDGECTL_1, brctl, 1); + + /* Give the bus time to settle now before reading configspace. */ + DELAY(100000); + + secbus = octopci_init_bus(dev, secbus); + + octopci_write_config(dev, b, s, f, PCIR_SUBBUS_1, secbus, 1); + + return (secbus); +} + +static unsigned +octopci_init_bus(device_t dev, unsigned b) +{ + unsigned s, f; + uint8_t hdrtype; + unsigned secbus; + + secbus = b; + + for (s = 0; s <= PCI_SLOTMAX; s++) { + for (f = 0; f <= PCI_FUNCMAX; f++) { + hdrtype = octopci_read_config(dev, b, s, f, PCIR_HDRTYPE, 1); + + if (hdrtype == 0xff) { + if (f == 0) + break; /* Next slot. */ + continue; /* Next function. */ + } + + secbus = octopci_init_device(dev, b, s, f, secbus); + + if (f == 0 && (hdrtype & PCIM_MFDEV) == 0) + break; /* Next slot. */ + } + } + + return (secbus); +} + static uint64_t octopci_cs_addr(unsigned bus, unsigned slot, unsigned func, unsigned reg) { Modified: head/sys/mips/cavium/octopcireg.h ============================================================================== --- head/sys/mips/cavium/octopcireg.h Thu Sep 23 23:05:31 2010 (r213088) +++ head/sys/mips/cavium/octopcireg.h Fri Sep 24 00:14:24 2010 (r213089) @@ -96,10 +96,10 @@ typedef union #define CVMX_OCT_SUBDID_PCI_MEM3 5 #define CVMX_OCT_SUBDID_PCI_MEM4 6 -#define CVMX_OCT_PCI_IO_BASE 0x00001000 +#define CVMX_OCT_PCI_IO_BASE 0x00004000 #define CVMX_OCT_PCI_IO_SIZE 0x08000000 -#define CVMX_OCT_PCI_MEM1_BASE 0x80000000 -#define CVMX_OCT_PCI_MEM1_SIZE 0x40000000 +#define CVMX_OCT_PCI_MEM1_BASE 0xf0000000 +#define CVMX_OCT_PCI_MEM1_SIZE 0x0f000000 #endif /* !_CAVIUM_OCTOPCIREG_H_ */ From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 01:26:46 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 10C3F106564A; Fri, 24 Sep 2010 01:26:46 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail02.syd.optusnet.com.au (mail02.syd.optusnet.com.au [211.29.132.183]) by mx1.freebsd.org (Postfix) with ESMTP id 9B6698FC15; Fri, 24 Sep 2010 01:26:45 +0000 (UTC) Received: from c122-107-116-249.carlnfd1.nsw.optusnet.com.au (c122-107-116-249.carlnfd1.nsw.optusnet.com.au [122.107.116.249]) by mail02.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o8O1QfjK024882 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 24 Sep 2010 11:26:42 +1000 Date: Fri, 24 Sep 2010 11:26:41 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Marcel Moolenaar In-Reply-To: <11C42F9D-7201-4804-8923-430F28E58C57@mac.com> Message-ID: <20100924105219.J780@delplex.bde.org> References: <201009200420.o8K4KtKn026514@svn.freebsd.org> <20100920163758.A788@besplex.bde.org> <11C42F9D-7201-4804-8923-430F28E58C57@mac.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Marcel Moolenaar , src-committers@freebsd.org, Bruce Evans Subject: Re: svn commit: r212886 - head/sbin/growfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 01:26:46 -0000 On Mon, 20 Sep 2010, Marcel Moolenaar wrote: > On Sep 19, 2010, at 11:55 PM, Bruce Evans wrote: > >> On Mon, 20 Sep 2010, Marcel Moolenaar wrote: >> >>> Log: >>> Unbreak the build on strong-aligned architectures (arm, ia64). >>> Casting from (char *) to (struct ufs1_dinode *) changes the >>> alignment requirement of the pointer and GCC does not know that >>> the pointer is adequately aligned (due to malloc(3)), and warns >>> about it. Cast to (void *) first to by-pass the check. >> >> A previous version in which the pointer (iobuf) the correct type to >> begin with was better. It used to have type void *, but now has type >> caddr_t (whose existence is a bug), in order to abuse caddr_t by >> assuming that it is char * to do pointer arithmetic on it in 1 place >> (iobuf + sblock.fs_cgsize). The 7 other places where iobuf is used >> only assume that caddr_t is a pointer (or perhaps a [u]intptr_t). >> >> growfs has no other instances of caddr_t. > > My first instinct was to retype iobuf as (void *), but saw > the pointer arithmetic and decided against it. If we had > a macro that one can use to add X number of bytes to a pointer > to any, I would have used that. Other macros to add X number > of short, int, long, could be handy too, but that may not be > as useful as for bytes. > > Would it be useful to add a macro like (don't mind the name): > > #define ADDBYTESTOPOINTER(ptr, cnt) \ > ((__typeof(ptr))(void *)((uintptr_t)(void *)(ptr) + (cnt))) As you may know, I like such macros in system headers as much as I like __DECONST() -- they are good enough for lining /dev/null but only after suitable heating :-). They are unportable and make it too easy to use wrong types. They are OK in individual applications, but most applications should have few instances of pointer frobbing so they don't need macros for it except to highlight its bogusness. The above implementation has the technical error of casting away any qualifiers of (ptr). __DECONST() is OK in that respect (it is good for it to be an error if it removes more than a const qualifier, but it has the technical error of not casting uintptr_t to (void *). If you don't bother with the cast to (void *), then you could also not bother with the cast to (const void *), except the latter has the advantage of detecting removal of more than a const qualifier -- perhaps that was intentional. Both depend on the bug that -Wcast-qual doesn't work for casting to uintptr_t. I think I prefer casting to (char *) than to uintptr_t for adding byte offsets to pointers. These give different problems with casting away qualifiers, as mentioned above. Perhaps the best way is application- dependent. But portable applications cannot use uintptr_t for this except in negatively useful ifdefs, since uintptr_t might not exist. IMO, the correct fix for fixing -Wcast-qual errors is to not use -Wcast-qual. The Standard method for removing type qualifiers is to explicitly cast them away, and -Wcast-qual breaks this. But bogus casts are still too common, so first you have to find them all. There should be a -Wbogus-cast option to help find them. This is a DWIM option so I don't know how to implement it :-). It could start by warning about casts that are null on all target, then warn about casts that are null on the current target. There should remain a cast-qual option that only applies to implicit casts (for assignments and function calls). Bruce From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 02:35:47 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6D774106564A for ; Fri, 24 Sep 2010 02:35:47 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 2B1528FC18 for ; Fri, 24 Sep 2010 02:35:47 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id o8O2VYgZ024003; Thu, 23 Sep 2010 20:31:35 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Thu, 23 Sep 2010 20:31:43 -0600 (MDT) Message-Id: <20100923.203143.19192035494300157.imp@bsdimp.com> To: gavin@FreeBSD.org From: "M. Warner Losh" In-Reply-To: References: <20100922222441.00002f27@unknown> <1285253887.95760.33.camel@bauer.cse.buffalo.edu> X-Mailer: Mew version 6.3 on Emacs 22.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: bruce@cran.org.uk, src-committers@FreeBSD.org, jhb@FreeBSD.org, kensmith@buffalo.edu, svn-src-all@FreeBSD.org, avg@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 02:35:47 -0000 In message: Gavin Atkinson writes: : On Thu, 23 Sep 2010, Ken Smith wrote: : > The issues talked about so far all contribute to the reason for that. : > But one of the more basic gut reactions to it all is that the users : > want to be interested in helping with the debugging (even if just : > providing the requested info) for any sort of crash information : > to be useful. And at the point we shift something from -current : > to -stable the percentage of people actively interested in participating : > in that sort of stuff flip. The bulk of people using -current : > know it's risky and they do it out of some interest in debugging : > stuff. The *bulk* of people using -stable are less interested or : > flat out not interested. And have no clue what crash dumps are, : > may be challenged to notice partition-getting-full issues, etc. : : I'm not sure I buy this argument, I'm afraid. Part of the advantage of : having all this done automatically on the as-shipped release media is that : end users don't have to be interested in debugging - crashinfo(8) does : most of the work for them. There's no easy way to actually determine : figures, but even if say only 10-15% of crashes can be diagnosed and : corrected just from the output of crashinfo(8) then that's a huge win for : the project as a whole. I'm guessing 10-15% is not unrealistic. : : I appreciate the issue about filling partitions is a valid one. Would a : possible compromise be that on release media, crashinfo(8) or similar will : default to only keeping the most recent coredump or similar? Given /var : now defaults to 4GB, Defaulting to keeping a single core is probably : acceptable. Furthermore, if we aren't interested in crash dumps by default, why do we install the huge .symbols files? Warner From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 02:41:53 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 47EF4106564A; Fri, 24 Sep 2010 02:41:53 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2BCE28FC13; Fri, 24 Sep 2010 02:41:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8O2frpF087295; Fri, 24 Sep 2010 02:41:53 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8O2frHM087292; Fri, 24 Sep 2010 02:41:53 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201009240241.o8O2frHM087292@svn.freebsd.org> From: Juli Mallett Date: Fri, 24 Sep 2010 02:41:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213090 - head/sys/mips/cavium X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 02:41:53 -0000 Author: jmallett Date: Fri Sep 24 02:41:52 2010 New Revision: 213090 URL: http://svn.freebsd.org/changeset/base/213090 Log: o) Add bus_teardown_intr for pci and ciu. This allows the Promise SATA driver to try to switch interrupt handlers at setup. It's not a very good implementation of bus_teardown_intr, though. o) Set cache line size and latency timers for PCI devices per Linux. Modified: head/sys/mips/cavium/ciu.c head/sys/mips/cavium/octopci.c Modified: head/sys/mips/cavium/ciu.c ============================================================================== --- head/sys/mips/cavium/ciu.c Fri Sep 24 00:14:24 2010 (r213089) +++ head/sys/mips/cavium/ciu.c Fri Sep 24 02:41:52 2010 (r213090) @@ -78,6 +78,8 @@ static struct resource *ciu_alloc_resour static int ciu_setup_intr(device_t, device_t, struct resource *, int, driver_filter_t *, driver_intr_t *, void *, void **); +static int ciu_teardown_intr(device_t, device_t, + struct resource *, void *); static void ciu_hinted_child(device_t, const char *, int); static void ciu_en0_intr_mask(void *); @@ -230,6 +232,19 @@ ciu_setup_intr(device_t bus, device_t ch return (0); } +static int +ciu_teardown_intr(device_t bus, device_t child, struct resource *res, + void *cookie) +{ + int error; + + error = intr_event_remove_handler(cookie); + if (error != 0) + return (error); + + return (0); +} + static void ciu_hinted_child(device_t bus, const char *dname, int dunit) { @@ -342,7 +357,7 @@ static device_method_t ciu_methods[] = { DEVMETHOD(bus_alloc_resource, ciu_alloc_resource), DEVMETHOD(bus_activate_resource,bus_generic_activate_resource), DEVMETHOD(bus_setup_intr, ciu_setup_intr), - DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), + DEVMETHOD(bus_teardown_intr, ciu_teardown_intr), DEVMETHOD(bus_add_child, bus_generic_add_child), DEVMETHOD(bus_hinted_child, ciu_hinted_child), Modified: head/sys/mips/cavium/octopci.c ============================================================================== --- head/sys/mips/cavium/octopci.c Fri Sep 24 00:14:24 2010 (r213089) +++ head/sys/mips/cavium/octopci.c Fri Sep 24 02:41:52 2010 (r213090) @@ -658,6 +658,16 @@ octopci_init_device(device_t dev, unsign command |= PCIM_CMD_BUSMASTEREN; octopci_write_config(dev, b, s, f, PCIR_COMMAND, command, 1); + /* + * Set cache line size. On Octeon it should be 128 bytes, + * but according to Linux some Intel bridges have trouble + * with values over 64 bytes, so use 64 bytes. + */ + octopci_write_config(dev, b, s, f, PCIR_CACHELNSZ, 16, 1); + + /* Set latency timer. */ + octopci_write_config(dev, b, s, f, PCIR_LATTIMER, 48, 1); + /* Configure PCI-PCI bridges. */ class = octopci_read_config(dev, b, s, f, PCIR_CLASS, 1); if (class != PCIC_BRIDGE) @@ -783,6 +793,7 @@ static device_method_t octopci_methods[] DEVMETHOD(bus_activate_resource,octopci_activate_resource), DEVMETHOD(bus_deactivate_resource,bus_generic_deactivate_resource), DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), + DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), DEVMETHOD(bus_add_child, bus_generic_add_child), From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 03:08:21 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1BC55106566B; Fri, 24 Sep 2010 03:08:21 +0000 (UTC) (envelope-from doconnor@gsoft.com.au) Received: from cain.gsoft.com.au (cain.gsoft.com.au [203.31.81.10]) by mx1.freebsd.org (Postfix) with ESMTP id 731CC8FC16; Fri, 24 Sep 2010 03:08:20 +0000 (UTC) Received: from ur.gsoft.com.au (Ur.gsoft.com.au [203.31.81.44]) (authenticated bits=0) by cain.gsoft.com.au (8.14.4/8.14.3) with ESMTP id o8O385CG065045 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Fri, 24 Sep 2010 12:38:11 +0930 (CST) (envelope-from doconnor@gsoft.com.au) Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: text/plain; charset=us-ascii From: "Daniel O'Connor" In-Reply-To: <1285253887.95760.33.camel@bauer.cse.buffalo.edu> Date: Fri, 24 Sep 2010 12:38:05 +0930 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201009211507.o8LF7iVv097676@svn.freebsd.org> <4C9A1602.4020204@freebsd.org> <1285169017.64197.29.camel@buffy.york.ac.uk> <201009221558.27393.jhb@freebsd.org> <4C9A6EE6.5050301@freebsd.org> <20100922222441.00002f27@unknown> <1285253887.95760.33.camel@bauer.cse.buffalo.edu> To: Ken Smith X-Mailer: Apple Mail (2.1081) X-Spam-Score: -2.51 () ALL_TRUSTED,BAYES_00,T_RP_MATCHES_RCVD X-Scanned-By: MIMEDefang 2.67 on 203.31.81.10 Cc: Bruce Cran , src-committers@freebsd.org, John Baldwin , svn-src-all@freebsd.org, Andriy Gapon , Gavin Atkinson , svn-src-head@freebsd.org Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 03:08:21 -0000 On 24/09/2010, at 24:28, Ken Smith wrote: > stuff. The *bulk* of people using -stable are less interested or > flat out not interested. And have no clue what crash dumps are, > may be challenged to notice partition-getting-full issues, etc. >=20 > I'm open to having my mind changed about this if there is enough > push-back. Just saying I'm not there yet. I'd say people are uninterested in debugging right up until their system = panics and they want to stop it doing that :) -- Daniel O'Connor software and network engineer for Genesis Software - http://www.gsoft.com.au "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 03:30:25 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3521B106566C; Fri, 24 Sep 2010 03:30:25 +0000 (UTC) (envelope-from kensmith@buffalo.edu) Received: from localmailD.acsu.buffalo.edu (localmailD.acsu.buffalo.edu [128.205.5.208]) by mx1.freebsd.org (Postfix) with ESMTP id EF86A8FC0A; Fri, 24 Sep 2010 03:30:24 +0000 (UTC) Received: from localmailD.acsu.buffalo.edu (localhost [127.0.0.1]) by localhost (Postfix) with SMTP id A9EBC18180C; Thu, 23 Sep 2010 23:11:39 -0400 (EDT) Received: from localmailD.acsu.buffalo.edu (localhost [127.0.0.1]) by localmailD.acsu.buffalo.edu (Postfix) with ESMTP id 82CA8C1A0E; Thu, 23 Sep 2010 23:11:38 -0400 (EDT) Received: from mweb1.acsu.buffalo.edu (mweb1.acsu.buffalo.edu [128.205.5.238]) by localmailD.acsu.buffalo.edu (Prefixe) with ESMTP id 66A66C188B; Thu, 23 Sep 2010 23:11:38 -0400 (EDT) Received: from [192.168.1.101] (cpe-76-180-182-44.buffalo.res.rr.com [76.180.182.44]) by mweb1.acsu.buffalo.edu (Postfix) with ESMTP id CBA3F264001; Thu, 23 Sep 2010 23:11:37 -0400 (EDT) From: Ken Smith To: "M. Warner Losh" In-Reply-To: <20100923.203143.19192035494300157.imp@bsdimp.com> References: <20100922222441.00002f27@unknown> <1285253887.95760.33.camel@bauer.cse.buffalo.edu> <20100923.203143.19192035494300157.imp@bsdimp.com> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-CwXNp4MEp8Z5xqbc5zLq" Organization: U. Buffalo Date: Thu, 23 Sep 2010 23:11:24 -0400 Message-ID: <1285297884.17619.17.camel@neo.cse.buffalo.edu> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 FreeBSD GNOME Team Port X-PM-EL-Spam-Prob: XX: 27% Cc: bruce@cran.org.uk, src-committers@FreeBSD.org, jhb@FreeBSD.org, svn-src-all@FreeBSD.org, avg@FreeBSD.org, gavin@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 03:30:25 -0000 --=-CwXNp4MEp8Z5xqbc5zLq Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable On Thu, 2010-09-23 at 20:31 -0600, M. Warner Losh wrote: > In message: > Gavin Atkinson writes: > : On Thu, 23 Sep 2010, Ken Smith wrote: > : > The issues talked about so far all contribute to the reason for that. > : > But one of the more basic gut reactions to it all is that the users > : > want to be interested in helping with the debugging (even if just > : > providing the requested info) for any sort of crash information > : > to be useful. And at the point we shift something from -current > : > to -stable the percentage of people actively interested in participat= ing > : > in that sort of stuff flip. The bulk of people using -current > : > know it's risky and they do it out of some interest in debugging > : > stuff. The *bulk* of people using -stable are less interested or > : > flat out not interested. And have no clue what crash dumps are, > : > may be challenged to notice partition-getting-full issues, etc. > :=20 > : I'm not sure I buy this argument, I'm afraid. Part of the advantage of= =20 > : having all this done automatically on the as-shipped release media is t= hat=20 > : end users don't have to be interested in debugging - crashinfo(8) does= =20 > : most of the work for them. There's no easy way to actually determine= =20 > : figures, but even if say only 10-15% of crashes can be diagnosed and= =20 > : corrected just from the output of crashinfo(8) then that's a huge win f= or=20 > : the project as a whole. I'm guessing 10-15% is not unrealistic. > :=20 > : I appreciate the issue about filling partitions is a valid one. Would = a=20 > : possible compromise be that on release media, crashinfo(8) or similar w= ill=20 > : default to only keeping the most recent coredump or similar? Given /va= r=20 > : now defaults to 4GB, Defaulting to keeping a single core is probably= =20 > : acceptable. >=20 > Furthermore, if we aren't interested in crash dumps by default, why do > we install the huge .symbols files? >=20 > Warner >=20 Because disks are big and (again, just trying to explain my understanding of what I inherited) we want all the support to be in place, just not turned on. There is a difference between "You can give us much better information by doing and then making a one-line change to rc.conf" versus "You can give us much better information by making a one-line change to rc.conf". This is definitely one I don't have a strong enough opinion on to fight over, I sympathize with both sides. If the general consensus is mostly towards changing so be it. I've got no way to tell what percentage of users would have any clue what to do with the crash info versus users who would be negatively impacted simply by the fact their systems are generating stuff they're completely ignorant of and will never touch. --=20 Ken Smith - From there to here, from here to | kensmith@buffalo.edu there, funny things are everywhere. | - Theodore Geisel | --=-CwXNp4MEp8Z5xqbc5zLq Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEABECAAYFAkycFtQACgkQ/G14VSmup/ZvagCePkYQEJEZ8YtKVyJk4cWzXcfu agsAnjrcZYs5KPcrI371BiAL/rTxKnJA =UmHi -----END PGP SIGNATURE----- --=-CwXNp4MEp8Z5xqbc5zLq-- From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 04:46:46 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7E667106564A; Fri, 24 Sep 2010 04:46:46 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6D47D8FC1A; Fri, 24 Sep 2010 04:46:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8O4kkZN090102; Fri, 24 Sep 2010 04:46:46 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8O4kkp6090099; Fri, 24 Sep 2010 04:46:46 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201009240446.o8O4kkp6090099@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Fri, 24 Sep 2010 04:46:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213091 - head/sys/dev/hifn X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 04:46:46 -0000 Author: gonzo Date: Fri Sep 24 04:46:46 2010 New Revision: 213091 URL: http://svn.freebsd.org/changeset/base/213091 Log: - Do not place variables to memory allocated by busdma. pre/post ops might invalidate cache and hence effectively void validity of values Modified: head/sys/dev/hifn/hifn7751.c head/sys/dev/hifn/hifn7751var.h Modified: head/sys/dev/hifn/hifn7751.c ============================================================================== --- head/sys/dev/hifn/hifn7751.c Fri Sep 24 02:41:52 2010 (r213090) +++ head/sys/dev/hifn/hifn7751.c Fri Sep 24 04:46:46 2010 (r213091) @@ -1372,45 +1372,45 @@ hifn_alloc_slot(struct hifn_softc *sc, i { struct hifn_dma *dma = sc->sc_dma; - if (dma->cmdi == HIFN_D_CMD_RSIZE) { - dma->cmdi = 0; + if (sc->sc_cmdi == HIFN_D_CMD_RSIZE) { + sc->sc_cmdi = 0; dma->cmdr[HIFN_D_CMD_RSIZE].l = htole32(HIFN_D_VALID | HIFN_D_JUMP | HIFN_D_MASKDONEIRQ); HIFN_CMDR_SYNC(sc, HIFN_D_CMD_RSIZE, BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD); } - *cmdp = dma->cmdi++; - dma->cmdk = dma->cmdi; + *cmdp = sc->sc_cmdi++; + sc->sc_cmdk = sc->sc_cmdi; - if (dma->srci == HIFN_D_SRC_RSIZE) { - dma->srci = 0; + if (sc->sc_srci == HIFN_D_SRC_RSIZE) { + sc->sc_srci = 0; dma->srcr[HIFN_D_SRC_RSIZE].l = htole32(HIFN_D_VALID | HIFN_D_JUMP | HIFN_D_MASKDONEIRQ); HIFN_SRCR_SYNC(sc, HIFN_D_SRC_RSIZE, BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD); } - *srcp = dma->srci++; - dma->srck = dma->srci; + *srcp = sc->sc_srci++; + sc->sc_srck = sc->sc_srci; - if (dma->dsti == HIFN_D_DST_RSIZE) { - dma->dsti = 0; + if (sc->sc_dsti == HIFN_D_DST_RSIZE) { + sc->sc_dsti = 0; dma->dstr[HIFN_D_DST_RSIZE].l = htole32(HIFN_D_VALID | HIFN_D_JUMP | HIFN_D_MASKDONEIRQ); HIFN_DSTR_SYNC(sc, HIFN_D_DST_RSIZE, BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD); } - *dstp = dma->dsti++; - dma->dstk = dma->dsti; + *dstp = sc->sc_dsti++; + sc->sc_dstk = sc->sc_dsti; - if (dma->resi == HIFN_D_RES_RSIZE) { - dma->resi = 0; + if (sc->sc_resi == HIFN_D_RES_RSIZE) { + sc->sc_resi = 0; dma->resr[HIFN_D_RES_RSIZE].l = htole32(HIFN_D_VALID | HIFN_D_JUMP | HIFN_D_MASKDONEIRQ); HIFN_RESR_SYNC(sc, HIFN_D_RES_RSIZE, BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD); } - *resp = dma->resi++; - dma->resk = dma->resi; + *resp = sc->sc_resi++; + sc->sc_resk = sc->sc_resi; } static int @@ -1563,9 +1563,9 @@ hifn_init_dma(struct hifn_softc *sc) dma->resr[HIFN_D_RES_RSIZE].p = htole32(sc->sc_dma_physaddr + offsetof(struct hifn_dma, resr[0])); - dma->cmdu = dma->srcu = dma->dstu = dma->resu = 0; - dma->cmdi = dma->srci = dma->dsti = dma->resi = 0; - dma->cmdk = dma->srck = dma->dstk = dma->resk = 0; + sc->sc_cmdu = sc->sc_srcu = sc->sc_dstu = sc->sc_resu = 0; + sc->sc_cmdi = sc->sc_srci = sc->sc_dsti = sc->sc_resi = 0; + sc->sc_cmdk = sc->sc_srck = sc->sc_dstk = sc->sc_resk = 0; } /* @@ -1723,7 +1723,7 @@ hifn_dmamap_load_dst(struct hifn_softc * u_int32_t p, l; int idx, used = 0, i; - idx = dma->dsti; + idx = sc->sc_dsti; for (i = 0; i < dst->nsegs - 1; i++) { dma->dstr[idx].p = htole32(dst->segs[i].ds_addr); dma->dstr[idx].l = htole32(HIFN_D_VALID | @@ -1764,8 +1764,8 @@ hifn_dmamap_load_dst(struct hifn_softc * idx = hifn_dmamap_dstwrap(sc, idx); - dma->dsti = idx; - dma->dstu += used; + sc->sc_dsti = idx; + sc->sc_dstu += used; return (idx); } @@ -1792,7 +1792,7 @@ hifn_dmamap_load_src(struct hifn_softc * int idx, i; u_int32_t last = 0; - idx = dma->srci; + idx = sc->sc_srci; for (i = 0; i < src->nsegs; i++) { if (i == src->nsegs - 1) last = HIFN_D_LAST; @@ -1805,8 +1805,8 @@ hifn_dmamap_load_src(struct hifn_softc * idx = hifn_dmamap_srcwrap(sc, idx); } - dma->srci = idx; - dma->srcu += src->nsegs; + sc->sc_srci = idx; + sc->sc_srcu += src->nsegs; return (idx); } @@ -1840,13 +1840,13 @@ hifn_crypto( * NB: check this first since it's easy. */ HIFN_LOCK(sc); - if ((dma->cmdu + 1) > HIFN_D_CMD_RSIZE || - (dma->resu + 1) > HIFN_D_RES_RSIZE) { + if ((sc->sc_cmdu + 1) > HIFN_D_CMD_RSIZE || + (sc->sc_resu + 1) > HIFN_D_RES_RSIZE) { #ifdef HIFN_DEBUG if (hifn_debug) { device_printf(sc->sc_dev, "cmd/result exhaustion, cmdu %u resu %u\n", - dma->cmdu, dma->resu); + sc->sc_cmdu, sc->sc_resu); } #endif hifnstats.hst_nomem_cr++; @@ -1916,14 +1916,14 @@ hifn_crypto( } if (m0 == NULL) { hifnstats.hst_nomem_mbuf++; - err = dma->cmdu ? ERESTART : ENOMEM; + err = sc->sc_cmdu ? ERESTART : ENOMEM; goto err_srcmap; } if (totlen >= MINCLSIZE) { MCLGET(m0, M_DONTWAIT); if ((m0->m_flags & M_EXT) == 0) { hifnstats.hst_nomem_mcl++; - err = dma->cmdu ? ERESTART : ENOMEM; + err = sc->sc_cmdu ? ERESTART : ENOMEM; m_freem(m0); goto err_srcmap; } @@ -1937,7 +1937,7 @@ hifn_crypto( MGET(m, M_DONTWAIT, MT_DATA); if (m == NULL) { hifnstats.hst_nomem_mbuf++; - err = dma->cmdu ? ERESTART : ENOMEM; + err = sc->sc_cmdu ? ERESTART : ENOMEM; m_freem(m0); goto err_srcmap; } @@ -1946,7 +1946,7 @@ hifn_crypto( MCLGET(m, M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) { hifnstats.hst_nomem_mcl++; - err = dma->cmdu ? ERESTART : ENOMEM; + err = sc->sc_cmdu ? ERESTART : ENOMEM; mlast->m_next = m; m_freem(m0); goto err_srcmap; @@ -1994,7 +1994,7 @@ hifn_crypto( "Entering cmd: stat %8x ien %8x u %d/%d/%d/%d n %d/%d\n", READ_REG_1(sc, HIFN_1_DMA_CSR), READ_REG_1(sc, HIFN_1_DMA_IER), - dma->cmdu, dma->srcu, dma->dstu, dma->resu, + sc->sc_cmdu, sc->sc_srcu, sc->sc_dstu, sc->sc_resu, cmd->src_nsegs, cmd->dst_nsegs); } #endif @@ -2012,14 +2012,14 @@ hifn_crypto( /* * need N src, and N dst */ - if ((dma->srcu + cmd->src_nsegs) > HIFN_D_SRC_RSIZE || - (dma->dstu + cmd->dst_nsegs + 1) > HIFN_D_DST_RSIZE) { + if ((sc->sc_srcu + cmd->src_nsegs) > HIFN_D_SRC_RSIZE || + (sc->sc_dstu + cmd->dst_nsegs + 1) > HIFN_D_DST_RSIZE) { #ifdef HIFN_DEBUG if (hifn_debug) { device_printf(sc->sc_dev, "src/dst exhaustion, srcu %u+%u dstu %u+%u\n", - dma->srcu, cmd->src_nsegs, - dma->dstu, cmd->dst_nsegs); + sc->sc_srcu, cmd->src_nsegs, + sc->sc_dstu, cmd->dst_nsegs); } #endif hifnstats.hst_nomem_sd++; @@ -2027,14 +2027,14 @@ hifn_crypto( goto err_dstmap; } - if (dma->cmdi == HIFN_D_CMD_RSIZE) { - dma->cmdi = 0; + if (sc->sc_cmdi == HIFN_D_CMD_RSIZE) { + sc->sc_cmdi = 0; dma->cmdr[HIFN_D_CMD_RSIZE].l = htole32(HIFN_D_VALID | HIFN_D_JUMP | HIFN_D_MASKDONEIRQ); HIFN_CMDR_SYNC(sc, HIFN_D_CMD_RSIZE, BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD); } - cmdi = dma->cmdi++; + cmdi = sc->sc_cmdi++; cmdlen = hifn_write_command(cmd, dma->command_bufs[cmdi]); HIFN_CMD_SYNC(sc, cmdi, BUS_DMASYNC_PREWRITE); @@ -2043,14 +2043,14 @@ hifn_crypto( HIFN_D_MASKDONEIRQ); HIFN_CMDR_SYNC(sc, cmdi, BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD); - dma->cmdu++; + sc->sc_cmdu++; /* * We don't worry about missing an interrupt (which a "command wait" * interrupt salvages us from), unless there is more than one command * in the queue. */ - if (dma->cmdu > 1) { + if (sc->sc_cmdu > 1) { sc->sc_dmaier |= HIFN_DMAIER_C_WAIT; WRITE_REG_1(sc, HIFN_1_DMA_IER, sc->sc_dmaier); } @@ -2068,17 +2068,17 @@ hifn_crypto( if (hifn_debug) printf("load res\n"); #endif - if (dma->resi == HIFN_D_RES_RSIZE) { - dma->resi = 0; + if (sc->sc_resi == HIFN_D_RES_RSIZE) { + sc->sc_resi = 0; dma->resr[HIFN_D_RES_RSIZE].l = htole32(HIFN_D_VALID | HIFN_D_JUMP | HIFN_D_MASKDONEIRQ); HIFN_RESR_SYNC(sc, HIFN_D_RES_RSIZE, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); } - resi = dma->resi++; - KASSERT(dma->hifn_commands[resi] == NULL, + resi = sc->sc_resi++; + KASSERT(sc->sc_hifn_commands[resi] == NULL, ("hifn_crypto: command slot %u busy", resi)); - dma->hifn_commands[resi] = cmd; + sc->sc_hifn_commands[resi] = cmd; HIFN_RES_SYNC(sc, resi, BUS_DMASYNC_PREREAD); if ((hint & CRYPTO_HINT_MORE) && sc->sc_curbatch < hifn_maxbatch) { dma->resr[resi].l = htole32(HIFN_MAX_RESULT | @@ -2094,7 +2094,7 @@ hifn_crypto( } HIFN_RESR_SYNC(sc, resi, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); - dma->resu++; + sc->sc_resu++; if (cmd->sloplen) cmd->slopidx = resi; @@ -2159,22 +2159,21 @@ hifn_tick(void* vsc) HIFN_LOCK(sc); if (sc->sc_active == 0) { - struct hifn_dma *dma = sc->sc_dma; u_int32_t r = 0; - if (dma->cmdu == 0 && sc->sc_c_busy) { + if (sc->sc_cmdu == 0 && sc->sc_c_busy) { sc->sc_c_busy = 0; r |= HIFN_DMACSR_C_CTRL_DIS; } - if (dma->srcu == 0 && sc->sc_s_busy) { + if (sc->sc_srcu == 0 && sc->sc_s_busy) { sc->sc_s_busy = 0; r |= HIFN_DMACSR_S_CTRL_DIS; } - if (dma->dstu == 0 && sc->sc_d_busy) { + if (sc->sc_dstu == 0 && sc->sc_d_busy) { sc->sc_d_busy = 0; r |= HIFN_DMACSR_D_CTRL_DIS; } - if (dma->resu == 0 && sc->sc_r_busy) { + if (sc->sc_resu == 0 && sc->sc_r_busy) { sc->sc_r_busy = 0; r |= HIFN_DMACSR_R_CTRL_DIS; } @@ -2209,9 +2208,9 @@ hifn_intr(void *arg) device_printf(sc->sc_dev, "irq: stat %08x ien %08x damier %08x i %d/%d/%d/%d k %d/%d/%d/%d u %d/%d/%d/%d\n", dmacsr, READ_REG_1(sc, HIFN_1_DMA_IER), sc->sc_dmaier, - dma->cmdi, dma->srci, dma->dsti, dma->resi, - dma->cmdk, dma->srck, dma->dstk, dma->resk, - dma->cmdu, dma->srcu, dma->dstu, dma->resu); + sc->sc_cmdi, sc->sc_srci, sc->sc_dsti, sc->sc_resi, + sc->sc_cmdk, sc->sc_srck, sc->sc_dstk, sc->sc_resk, + sc->sc_cmdu, sc->sc_srcu, sc->sc_dstu, sc->sc_resu); } #endif @@ -2243,7 +2242,7 @@ hifn_intr(void *arg) return; } - if ((dmacsr & HIFN_DMACSR_C_WAIT) && (dma->cmdu == 0)) { + if ((dmacsr & HIFN_DMACSR_C_WAIT) && (sc->sc_cmdu == 0)) { /* * If no slots to process and we receive a "waiting on * command" interrupt, we disable the "waiting on command" @@ -2254,7 +2253,7 @@ hifn_intr(void *arg) } /* clear the rings */ - i = dma->resk; u = dma->resu; + i = sc->sc_resk; u = sc->sc_resu; while (u != 0) { HIFN_RESR_SYNC(sc, i, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); @@ -2269,10 +2268,10 @@ hifn_intr(void *arg) u_int8_t *macbuf = NULL; HIFN_RES_SYNC(sc, i, BUS_DMASYNC_POSTREAD); - cmd = dma->hifn_commands[i]; + cmd = sc->sc_hifn_commands[i]; KASSERT(cmd != NULL, ("hifn_intr: null command slot %u", i)); - dma->hifn_commands[i] = NULL; + sc->sc_hifn_commands[i] = NULL; if (cmd->base_masks & HIFN_BASE_CMD_MAC) { macbuf = dma->result_bufs[i]; @@ -2287,9 +2286,9 @@ hifn_intr(void *arg) if (++i == (HIFN_D_RES_RSIZE + 1)) i = 0; } - dma->resk = i; dma->resu = u; + sc->sc_resk = i; sc->sc_resu = u; - i = dma->srck; u = dma->srcu; + i = sc->sc_srck; u = sc->sc_srcu; while (u != 0) { if (i == HIFN_D_SRC_RSIZE) i = 0; @@ -2302,9 +2301,9 @@ hifn_intr(void *arg) } i++, u--; } - dma->srck = i; dma->srcu = u; + sc->sc_srck = i; sc->sc_srcu = u; - i = dma->cmdk; u = dma->cmdu; + i = sc->sc_cmdk; u = sc->sc_cmdu; while (u != 0) { HIFN_CMDR_SYNC(sc, i, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); @@ -2320,7 +2319,7 @@ hifn_intr(void *arg) if (++i == (HIFN_D_CMD_RSIZE + 1)) i = 0; } - dma->cmdk = i; dma->cmdu = u; + sc->sc_cmdk = i; sc->sc_cmdu = u; HIFN_UNLOCK(sc); @@ -2331,7 +2330,7 @@ hifn_intr(void *arg) device_printf(sc->sc_dev, "wakeup crypto (%x) u %d/%d/%d/%d\n", sc->sc_needwakeup, - dma->cmdu, dma->srcu, dma->dstu, dma->resu); + sc->sc_cmdu, sc->sc_srcu, sc->sc_dstu, sc->sc_resu); #endif sc->sc_needwakeup &= ~wakeup; crypto_unblock(sc->sc_cid, wakeup); @@ -2725,11 +2724,11 @@ hifn_abort(struct hifn_softc *sc) struct cryptop *crp; int i, u; - i = dma->resk; u = dma->resu; + i = sc->sc_resk; u = sc->sc_resu; while (u != 0) { - cmd = dma->hifn_commands[i]; + cmd = sc->sc_hifn_commands[i]; KASSERT(cmd != NULL, ("hifn_abort: null command slot %u", i)); - dma->hifn_commands[i] = NULL; + sc->sc_hifn_commands[i] = NULL; crp = cmd->crp; if ((dma->resr[i].l & htole32(HIFN_D_VALID)) == 0) { @@ -2783,7 +2782,7 @@ hifn_abort(struct hifn_softc *sc) i = 0; u--; } - dma->resk = i; dma->resu = u; + sc->sc_resk = i; sc->sc_resu = u; hifn_reset_board(sc, 1); hifn_init_dma(sc); @@ -2831,7 +2830,7 @@ hifn_callback(struct hifn_softc *sc, str (caddr_t)&dma->slop[cmd->slopidx]); } - i = dma->dstk; u = dma->dstu; + i = sc->sc_dstk; u = sc->sc_dstu; while (u != 0) { if (i == HIFN_D_DST_RSIZE) i = 0; @@ -2844,7 +2843,7 @@ hifn_callback(struct hifn_softc *sc, str } i++, u--; } - dma->dstk = i; dma->dstu = u; + sc->sc_dstk = i; sc->sc_dstu = u; hifnstats.hst_obytes += cmd->dst_mapsize; Modified: head/sys/dev/hifn/hifn7751var.h ============================================================================== --- head/sys/dev/hifn/hifn7751var.h Fri Sep 24 02:41:52 2010 (r213090) +++ head/sys/dev/hifn/hifn7751var.h Fri Sep 24 04:46:46 2010 (r213091) @@ -81,7 +81,8 @@ #define MAX_SCATTER 64 /* - * Data structure to hold all 4 rings and any other ring related data. + * Data structure to hold all 4 rings and any other ring related data + * that should reside in DMA. */ struct hifn_dma { /* @@ -93,22 +94,13 @@ struct hifn_dma { struct hifn_desc dstr[HIFN_D_DST_RSIZE+1]; struct hifn_desc resr[HIFN_D_RES_RSIZE+1]; - struct hifn_command *hifn_commands[HIFN_D_RES_RSIZE]; u_char command_bufs[HIFN_D_CMD_RSIZE][HIFN_MAX_COMMAND]; u_char result_bufs[HIFN_D_CMD_RSIZE][HIFN_MAX_RESULT]; u_int32_t slop[HIFN_D_CMD_RSIZE]; - u_int64_t test_src, test_dst; +} ; - /* - * Our current positions for insertion and removal from the desriptor - * rings. - */ - int cmdi, srci, dsti, resi; - volatile int cmdu, srcu, dstu, resu; - int cmdk, srck, dstk, resk; -}; struct hifn_session { int hs_used; @@ -157,6 +149,15 @@ struct hifn_softc { bus_dma_segment_t sc_dmasegs[1]; bus_addr_t sc_dma_physaddr;/* physical address of sc_dma */ int sc_dmansegs; + struct hifn_command *sc_hifn_commands[HIFN_D_RES_RSIZE]; + /* + * Our current positions for insertion and removal from the desriptor + * rings. + */ + int sc_cmdi, sc_srci, sc_dsti, sc_resi; + volatile int sc_cmdu, sc_srcu, sc_dstu, sc_resu; + int sc_cmdk, sc_srck, sc_dstk, sc_resk; + int32_t sc_cid; int sc_maxses; int sc_nsessions; From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 06:14:18 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C5611065670; Fri, 24 Sep 2010 06:14:18 +0000 (UTC) (envelope-from rpaulo@freebsd.org) Received: from karen.lavabit.com (karen.lavabit.com [72.249.41.33]) by mx1.freebsd.org (Postfix) with ESMTP id D68BC8FC0C; Fri, 24 Sep 2010 06:14:17 +0000 (UTC) Received: from d.earth.lavabit.com (d.earth.lavabit.com [192.168.111.13]) by karen.lavabit.com (Postfix) with ESMTP id 3458711B954; Fri, 24 Sep 2010 01:14:17 -0500 (CDT) Received: from 10.0.10.3 (221.163.108.93.rev.vodafone.pt [93.108.163.221]) by lavabit.com with ESMTP id XMVUNJA3PVJ2; Fri, 24 Sep 2010 01:14:17 -0500 Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: text/plain; charset=us-ascii From: Rui Paulo In-Reply-To: <20100923070247.L716@delplex.bde.org> Date: Fri, 24 Sep 2010 07:14:13 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <3CC9503B-35BA-4637-8909-CBC6674ACDDA@freebsd.org> References: <201009221800.o8MI0Ze3038214@svn.freebsd.org> <20100923070247.L716@delplex.bde.org> To: Bruce Evans X-Mailer: Apple Mail (2.1081) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r213002 - in stable/8: include lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 06:14:18 -0000 On 22 Sep 2010, at 22:08, Bruce Evans wrote: > On Wed, 22 Sep 2010, Rui Paulo wrote: >=20 >> Log: >> MFC r197804 (rwatson): >> Add basename_r(3) to complement basename(3). basename_r(3) which = accepts >> a caller-allocated buffer of at least MAXPATHLEN, rather than using = a >> global buffer. >=20 > MAXPATHLEN has been deprecated for more than 20 years. Please don't = use > it in new interfaces. A few man pages, not including basename.3, have > been updated to spell it PATH_MAX (should be {PATH_MAX}). I'm not going to fix this because the interface will most likely change = to something that doesn't require PATH_MAX. But thanks for pointing this = out. >=20 >> Note about semantics: while this interface is not POSIXy, there's >> another major platform that uses it (Android) and the semantics = between >> the two platforms are pretty much the same. >=20 > It is also not non-POSIX... >=20 >> Modified: stable/8/include/libgen.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 >> --- stable/8/include/libgen.h Wed Sep 22 16:54:22 2010 = (r213001) >> +++ stable/8/include/libgen.h Wed Sep 22 18:00:34 2010 = (r213002) >> @@ -36,6 +36,7 @@ >> __BEGIN_DECLS >>=20 >> char *basename(const char *); >> +char *basename_r(const char *, char *); >> char *dirname(const char *); >> #if 0 >> char *regcmp(const char *, ...); >>=20 >=20 > ...since it is declared in the POSIX namespace. I don't know of a better place to declare it. Regards, -- Rui Paulo From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 07:14:15 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 384281065673; Fri, 24 Sep 2010 07:14:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 289D88FC16; Fri, 24 Sep 2010 07:14:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8O7EFoi093169; Fri, 24 Sep 2010 07:14:15 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8O7EFT5093167; Fri, 24 Sep 2010 07:14:15 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009240714.o8O7EFT5093167@svn.freebsd.org> From: Alexander Motin Date: Fri, 24 Sep 2010 07:14:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213092 - head/sys/dev/ata/chipsets X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 07:14:15 -0000 Author: mav Date: Fri Sep 24 07:14:14 2010 New Revision: 213092 URL: http://svn.freebsd.org/changeset/base/213092 Log: Add missing le32toh(), same as recently done in ata-siliconimage.c. Modified: head/sys/dev/ata/chipsets/ata-ahci.c Modified: head/sys/dev/ata/chipsets/ata-ahci.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-ahci.c Fri Sep 24 04:46:46 2010 (r213091) +++ head/sys/dev/ata/chipsets/ata-ahci.c Fri Sep 24 07:14:14 2010 (r213092) @@ -563,7 +563,7 @@ ata_ahci_end_transaction(struct ata_requ /* record how much data we actually moved */ clp = (struct ata_ahci_cmd_list *) (ch->dma.work + ATA_AHCI_CL_OFFSET); - request->donecount = clp->bytecount; + request->donecount = le32toh(clp->bytecount); /* release SG list etc */ ch->dma.unload(request); From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 07:23:48 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A0D6F1065670; Fri, 24 Sep 2010 07:23:48 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9010A8FC1E; Fri, 24 Sep 2010 07:23:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8O7Nm9b093385; Fri, 24 Sep 2010 07:23:48 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8O7NmTR093383; Fri, 24 Sep 2010 07:23:48 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201009240723.o8O7NmTR093383@svn.freebsd.org> From: Andriy Gapon Date: Fri, 24 Sep 2010 07:23:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213093 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 07:23:48 -0000 Author: avg Date: Fri Sep 24 07:23:48 2010 New Revision: 213093 URL: http://svn.freebsd.org/changeset/base/213093 Log: MFC r212782: zfs+sendfile: advance uio_offset upon reading as well Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Fri Sep 24 07:14:14 2010 (r213092) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Fri Sep 24 07:23:48 2010 (r213093) @@ -500,8 +500,10 @@ again: } VM_OBJECT_LOCK(obj); vm_page_wakeup(m); - if (error == 0) + if (error == 0) { uio->uio_resid -= bytes; + uio->uio_offset += bytes; + } } else { dirbytes += bytes; } From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 07:27:54 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3903D1065679; Fri, 24 Sep 2010 07:27:54 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 28D238FC26; Fri, 24 Sep 2010 07:27:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8O7RsnR093516; Fri, 24 Sep 2010 07:27:54 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8O7RsWw093514; Fri, 24 Sep 2010 07:27:54 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201009240727.o8O7RsWw093514@svn.freebsd.org> From: Andriy Gapon Date: Fri, 24 Sep 2010 07:27:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213094 - stable/8/sbin/reboot X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 07:27:54 -0000 Author: avg Date: Fri Sep 24 07:27:53 2010 New Revision: 213094 URL: http://svn.freebsd.org/changeset/base/213094 Log: MFC r212789: nextboot: warn about limitations of /boot/nextboot.conf on ZFS Modified: stable/8/sbin/reboot/nextboot.sh Directory Properties: stable/8/sbin/reboot/ (props changed) Modified: stable/8/sbin/reboot/nextboot.sh ============================================================================== --- stable/8/sbin/reboot/nextboot.sh Fri Sep 24 07:23:48 2010 (r213093) +++ stable/8/sbin/reboot/nextboot.sh Fri Sep 24 07:27:53 2010 (r213094) @@ -50,6 +50,14 @@ if [ ${force} = "NO" -a ! -d /boot/${ker exit 1 fi +df -Tn "/boot/" 2>/dev/null | while read _fs _type _other ; do + [ "zfs" = "${_type}" ] || continue + cat 1>&2 <<-EOF + WARNING: loader(8) has only R/O support for ZFS + nextboot.conf will NOT be reset in case of kernel boot failure + EOF +done + cat > ${nextboot_file} << EOF nextboot_enable="YES" kernel="${kernel}" From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 07:29:29 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CEECA1065670; Fri, 24 Sep 2010 07:29:29 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BECF48FC0A; Fri, 24 Sep 2010 07:29:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8O7TTOM093608; Fri, 24 Sep 2010 07:29:29 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8O7TT9E093606; Fri, 24 Sep 2010 07:29:29 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201009240729.o8O7TT9E093606@svn.freebsd.org> From: Andriy Gapon Date: Fri, 24 Sep 2010 07:29:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213095 - stable/7/sbin/reboot X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 07:29:29 -0000 Author: avg Date: Fri Sep 24 07:29:29 2010 New Revision: 213095 URL: http://svn.freebsd.org/changeset/base/213095 Log: MFC r212789: nextboot: warn about limitations of /boot/nextboot.conf on ZFS Modified: stable/7/sbin/reboot/nextboot.sh Directory Properties: stable/7/sbin/reboot/ (props changed) Modified: stable/7/sbin/reboot/nextboot.sh ============================================================================== --- stable/7/sbin/reboot/nextboot.sh Fri Sep 24 07:27:53 2010 (r213094) +++ stable/7/sbin/reboot/nextboot.sh Fri Sep 24 07:29:29 2010 (r213095) @@ -50,6 +50,14 @@ if [ ${force} = "NO" -a ! -d /boot/${ker exit 1 fi +df -Tn "/boot/" 2>/dev/null | while read _fs _type _other ; do + [ "zfs" = "${_type}" ] || continue + cat 1>&2 <<-EOF + WARNING: loader(8) has only R/O support for ZFS + nextboot.conf will NOT be reset in case of kernel boot failure + EOF +done + cat > ${nextboot_file} << EOF nextboot_enable="YES" kernel="${kernel}" From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 07:52:07 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9454A106566C; Fri, 24 Sep 2010 07:52:07 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 69E9C8FC1C; Fri, 24 Sep 2010 07:52:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8O7q7MI094106; Fri, 24 Sep 2010 07:52:07 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8O7q7Zh094102; Fri, 24 Sep 2010 07:52:07 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201009240752.o8O7q7Zh094102@svn.freebsd.org> From: David Xu Date: Fri, 24 Sep 2010 07:52:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213096 - head/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 07:52:07 -0000 Author: davidxu Date: Fri Sep 24 07:52:07 2010 New Revision: 213096 URL: http://svn.freebsd.org/changeset/base/213096 Log: In most cases, cancel_point and cancel_async needn't be checked again, because cancellation is almostly checked at cancellation points. Modified: head/lib/libthr/thread/thr_cancel.c head/lib/libthr/thread/thr_fork.c head/lib/libthr/thread/thr_private.h Modified: head/lib/libthr/thread/thr_cancel.c ============================================================================== --- head/lib/libthr/thread/thr_cancel.c Fri Sep 24 07:29:29 2010 (r213095) +++ head/lib/libthr/thread/thr_cancel.c Fri Sep 24 07:52:07 2010 (r213096) @@ -131,9 +131,7 @@ _pthread_testcancel(void) { struct pthread *curthread = _get_curthread(); - curthread->cancel_point = 1; testcancel(curthread); - curthread->cancel_point = 0; } void @@ -159,7 +157,7 @@ _thr_cancel_enter2(struct pthread *curth void _thr_cancel_leave(struct pthread *curthread, int maycancel) { + curthread->cancel_point = 0; if (maycancel) testcancel(curthread); - curthread->cancel_point = 0; } Modified: head/lib/libthr/thread/thr_fork.c ============================================================================== --- head/lib/libthr/thread/thr_fork.c Fri Sep 24 07:29:29 2010 (r213095) +++ head/lib/libthr/thread/thr_fork.c Fri Sep 24 07:52:07 2010 (r213096) @@ -248,7 +248,8 @@ _fork(void) _thr_rwlock_unlock(&_thr_atfork_lock); curthread->no_cancel = cancelsave; /* test async cancel */ - _thr_testcancel(curthread); + if (curthread->cancel_async) + _thr_testcancel(curthread); } errno = errsave; Modified: head/lib/libthr/thread/thr_private.h ============================================================================== --- head/lib/libthr/thread/thr_private.h Fri Sep 24 07:29:29 2010 (r213095) +++ head/lib/libthr/thread/thr_private.h Fri Sep 24 07:52:07 2010 (r213096) @@ -357,7 +357,6 @@ struct pthread { #define SHOULD_CANCEL(thr) \ ((thr)->cancel_pending && (thr)->cancel_enable && \ - ((thr)->cancel_point || (thr)->cancel_async) && \ (thr)->no_cancel == 0) /* Cancellation is enabled */ From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 08:30:28 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 15724106566B; Fri, 24 Sep 2010 08:30:28 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail09.syd.optusnet.com.au (mail09.syd.optusnet.com.au [211.29.132.190]) by mx1.freebsd.org (Postfix) with ESMTP id 86D048FC0A; Fri, 24 Sep 2010 08:30:27 +0000 (UTC) Received: from c122-107-116-249.carlnfd1.nsw.optusnet.com.au (c122-107-116-249.carlnfd1.nsw.optusnet.com.au [122.107.116.249]) by mail09.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o8O8UNJV022578 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 24 Sep 2010 18:30:24 +1000 Date: Fri, 24 Sep 2010 18:30:23 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Rui Paulo In-Reply-To: <3CC9503B-35BA-4637-8909-CBC6674ACDDA@freebsd.org> Message-ID: <20100924182633.I715@delplex.bde.org> References: <201009221800.o8MI0Ze3038214@svn.freebsd.org> <20100923070247.L716@delplex.bde.org> <3CC9503B-35BA-4637-8909-CBC6674ACDDA@freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-stable@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, svn-src-stable-8@FreeBSD.org, Bruce Evans Subject: Re: svn commit: r213002 - in stable/8: include lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 08:30:28 -0000 On Fri, 24 Sep 2010, Rui Paulo wrote: > On 22 Sep 2010, at 22:08, Bruce Evans wrote: > >> On Wed, 22 Sep 2010, Rui Paulo wrote: >>> Note about semantics: while this interface is not POSIXy, there's >>> another major platform that uses it (Android) and the semantics between >>> the two platforms are pretty much the same. >> >> It is also not non-POSIX... >> >>> Modified: stable/8/include/libgen.h >>> ============================================================================== >>> --- stable/8/include/libgen.h Wed Sep 22 16:54:22 2010 (r213001) >>> +++ stable/8/include/libgen.h Wed Sep 22 18:00:34 2010 (r213002) >>> @@ -36,6 +36,7 @@ >>> __BEGIN_DECLS >>> >>> char *basename(const char *); >>> +char *basename_r(const char *, char *); >>> char *dirname(const char *); >>> #if 0 >>> char *regcmp(const char *, ...); >>> >> >> ...since it is declared in the POSIX namespace. > > I don't know of a better place to declare it. Er, inside an ifdef for a non-POSIX namespace of course. See almost any header that has more than 3 active declarations in it. Bruce From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 08:40:43 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DFA91106566C; Fri, 24 Sep 2010 08:40:43 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CF0138FC24; Fri, 24 Sep 2010 08:40:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8O8ehec095304; Fri, 24 Sep 2010 08:40:43 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8O8eha0095301; Fri, 24 Sep 2010 08:40:43 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201009240840.o8O8eha0095301@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Fri, 24 Sep 2010 08:40:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213097 - head/sbin/geom/class/part X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 08:40:44 -0000 Author: ae Date: Fri Sep 24 08:40:43 2010 New Revision: 213097 URL: http://svn.freebsd.org/changeset/base/213097 Log: Implement "force" (-F) option for gpart destroy verb. This option doesn't passed to kernel and handled in user-space. With -F option gpart creates new "delete" request for each partition in table. Each request has flags="X" that disables auto-commit feature. Last request is the original "destroy" request. It has own flags and can have disabled or enabled auto-commit feature. If error is occurred when deleting partitions, then new "undo" request is created and all changes will be rolled back. Approved by: kib (mentor) Modified: head/sbin/geom/class/part/geom_part.c head/sbin/geom/class/part/gpart.8 Modified: head/sbin/geom/class/part/geom_part.c ============================================================================== --- head/sbin/geom/class/part/geom_part.c Fri Sep 24 07:52:07 2010 (r213096) +++ head/sbin/geom/class/part/geom_part.c Fri Sep 24 08:40:43 2010 (r213097) @@ -67,6 +67,7 @@ static char ssize[32]; #define GPART_PARAM_BOOTCODE "bootcode" #define GPART_PARAM_INDEX "index" #define GPART_PARAM_PARTCODE "partcode" +#define GPART_PARAM_FORCE "force" static struct gclass *find_class(struct gmesh *, const char *); static struct ggeom * find_geom(struct gclass *, const char *); @@ -84,6 +85,8 @@ static void gpart_show_geom(struct ggeom static int gpart_show_hasopt(struct gctl_req *, const char *, const char *); static void gpart_write_partcode(struct ggeom *, int, void *, ssize_t); static void gpart_write_partcode_vtoc8(struct ggeom *, int, void *); +static void gpart_destroy(struct gctl_req *, unsigned int); +static void gpart_print_error(const char *); struct g_command PUBSYM(class_commands)[] = { { "add", 0, gpart_issue, { @@ -120,10 +123,11 @@ struct g_command PUBSYM(class_commands)[ G_OPT_SENTINEL }, "-i index [-f flags] geom" }, - { "destroy", 0, gpart_issue, { + { "destroy", 0, gpart_destroy, { + { 'F', GPART_PARAM_FORCE, NULL, G_TYPE_BOOL }, { 'f', "flags", GPART_FLAGS, G_TYPE_STRING }, G_OPT_SENTINEL }, - "[-f flags] geom" + "[-F] [-f flags] geom" }, { "modify", 0, gpart_issue, { { 'i', GPART_PARAM_INDEX, NULL, G_TYPE_NUMBER }, @@ -854,10 +858,104 @@ gpart_bootcode(struct gctl_req *req, uns } static void +gpart_destroy(struct gctl_req *req, unsigned int fl) +{ + struct gmesh mesh; + struct gclass *classp; + struct gctl_req *req2; + struct ggeom *gp; + struct gprovider *pp; + const char *s; + int error, val; + intmax_t idx; + + if (gctl_has_param(req, GPART_PARAM_FORCE)) { + val = gctl_get_int(req, GPART_PARAM_FORCE); + error = gctl_delete_param(req, GPART_PARAM_FORCE); + if (error) + errc(EXIT_FAILURE, error, "internal error"); + if (val == 0) + goto done; + s = gctl_get_ascii(req, "class"); + if (s == NULL) + abort(); + error = geom_gettree(&mesh); + if (error != 0) + errc(EXIT_FAILURE, error, "Cannot get GEOM tree"); + classp = find_class(&mesh, s); + if (classp == NULL) { + geom_deletetree(&mesh); + errx(EXIT_FAILURE, "Class %s not found.", s); + } + s = gctl_get_ascii(req, "arg0"); + if (s == NULL) + abort(); + gp = find_geom(classp, s); + if (gp == NULL) + errx(EXIT_FAILURE, "No such geom: %s.", s); + val = 0; + LIST_FOREACH(pp, &gp->lg_provider, lg_provider){ + s = find_provcfg(pp, "index"); + if (s == NULL) + errx(EXIT_FAILURE, "Index not found for %s.", + pp->lg_name); + idx = strtoimax(s, NULL, 0); + req2 = gctl_get_handle(); + gctl_ro_param(req2, "class", -1, classp->lg_name); + gctl_ro_param(req2, "arg0", -1, gp->lg_name); + gctl_ro_param(req2, "verb", -1, "delete"); + gctl_ro_param(req2, GPART_PARAM_INDEX, + sizeof(intmax_t), &idx); + gctl_ro_param(req2, "flags", -1, "X"); + s = gctl_issue(req2); + if (s != NULL && s[0] != '\0') { + gpart_print_error(s); + gctl_free(req2); + if (val) { /* try to undo changes */ + req2 = gctl_get_handle(); + gctl_ro_param(req2, "verb", -1, + "undo"); + gctl_ro_param(req2, "class", -1, + classp->lg_name); + gctl_ro_param(req2, "arg0", -1, + gp->lg_name); + gctl_issue(req2); + gctl_free(req2); + } + geom_deletetree(&mesh); + exit(EXIT_FAILURE); + } + gctl_free(req2); + val = 1; + } + geom_deletetree(&mesh); + } +done: + gpart_issue(req, fl); +} + +static void +gpart_print_error(const char *errstr) +{ + char *errmsg; + int error; + + error = strtol(errstr, &errmsg, 0); + if (errmsg != errstr) { + while (errmsg[0] == ' ') + errmsg++; + if (errmsg[0] != '\0') + warnc(error, "%s", errmsg); + else + warnc(error, NULL); + } else + warnx("%s", errmsg); +} + +static void gpart_issue(struct gctl_req *req, unsigned int fl __unused) { char buf[4096]; - char *errmsg; const char *errstr; int error, status; @@ -883,17 +981,7 @@ gpart_issue(struct gctl_req *req, unsign goto done; } - error = strtol(errstr, &errmsg, 0); - if (errmsg != errstr) { - while (errmsg[0] == ' ') - errmsg++; - if (errmsg[0] != '\0') - warnc(error, "%s", errmsg); - else - warnc(error, NULL); - } else - warnx("%s", errmsg); - + gpart_print_error(errstr); status = EXIT_FAILURE; done: Modified: head/sbin/geom/class/part/gpart.8 ============================================================================== --- head/sbin/geom/class/part/gpart.8 Fri Sep 24 07:52:07 2010 (r213096) +++ head/sbin/geom/class/part/gpart.8 Fri Sep 24 08:40:43 2010 (r213097) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 27, 2010 +.Dd Sep 24, 2010 .Dt GPART 8 .Os .Sh NAME @@ -118,6 +118,7 @@ utility: .\" ==== DESTROY ==== .Nm .Cm destroy +.Op Fl F .Op Fl f Ar flags .Ar geom .\" ==== MODIFY ==== @@ -317,6 +318,8 @@ Destroy the partitioning scheme as imple .Pp Additional options include: .Bl -tag -width 10n +.It Fl F +Forced destroying of the partition table even if it is not empty. .It Fl f Ar flags Additional operational flags. See the section entitled From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 09:04:16 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B372B106564A; Fri, 24 Sep 2010 09:04:16 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A29AA8FC0C; Fri, 24 Sep 2010 09:04:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8O94G8E095809; Fri, 24 Sep 2010 09:04:16 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8O94GVM095803; Fri, 24 Sep 2010 09:04:16 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201009240904.o8O94GVM095803@svn.freebsd.org> From: David Xu Date: Fri, 24 Sep 2010 09:04:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213098 - in head/sys: amd64/conf i386/conf pc98/conf powerpc/conf sparc64/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 09:04:16 -0000 Author: davidxu Date: Fri Sep 24 09:04:16 2010 New Revision: 213098 URL: http://svn.freebsd.org/changeset/base/213098 Log: Now userland POSIX semaphore is based on umtx. The kernel module is only used to support binary compatible, if want to run old binary, you need to kldload the module. Modified: head/sys/amd64/conf/GENERIC head/sys/i386/conf/GENERIC head/sys/pc98/conf/GENERIC head/sys/powerpc/conf/GENERIC head/sys/sparc64/conf/GENERIC Modified: head/sys/amd64/conf/GENERIC ============================================================================== --- head/sys/amd64/conf/GENERIC Fri Sep 24 08:40:43 2010 (r213097) +++ head/sys/amd64/conf/GENERIC Fri Sep 24 09:04:16 2010 (r213098) @@ -55,7 +55,6 @@ options STACK # stack(9) support options SYSVSHM # SYSV-style shared memory options SYSVMSG # SYSV-style message queues options SYSVSEM # SYSV-style semaphores -options P1003_1B_SEMAPHORES # POSIX-style semaphores options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions options PRINTF_BUFR_SIZE=128 # Prevent printf output being interspersed. options KBD_INSTALL_CDEV # install a CDEV entry in /dev Modified: head/sys/i386/conf/GENERIC ============================================================================== --- head/sys/i386/conf/GENERIC Fri Sep 24 08:40:43 2010 (r213097) +++ head/sys/i386/conf/GENERIC Fri Sep 24 09:04:16 2010 (r213098) @@ -56,7 +56,6 @@ options STACK # stack(9) support options SYSVSHM # SYSV-style shared memory options SYSVMSG # SYSV-style message queues options SYSVSEM # SYSV-style semaphores -options P1003_1B_SEMAPHORES # POSIX-style semaphores options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions options PRINTF_BUFR_SIZE=128 # Prevent printf output being interspersed. options KBD_INSTALL_CDEV # install a CDEV entry in /dev Modified: head/sys/pc98/conf/GENERIC ============================================================================== --- head/sys/pc98/conf/GENERIC Fri Sep 24 08:40:43 2010 (r213097) +++ head/sys/pc98/conf/GENERIC Fri Sep 24 09:04:16 2010 (r213098) @@ -59,7 +59,6 @@ options STACK # stack(9) support options SYSVSHM # SYSV-style shared memory options SYSVMSG # SYSV-style message queues options SYSVSEM # SYSV-style semaphores -options P1003_1B_SEMAPHORES # POSIX-style semaphores options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions options KBD_INSTALL_CDEV # install a CDEV entry in /dev options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4) Modified: head/sys/powerpc/conf/GENERIC ============================================================================== --- head/sys/powerpc/conf/GENERIC Fri Sep 24 08:40:43 2010 (r213097) +++ head/sys/powerpc/conf/GENERIC Fri Sep 24 09:04:16 2010 (r213098) @@ -60,7 +60,6 @@ options STACK #stack(9) support options SYSVSHM #SYSV-style shared memory options SYSVMSG #SYSV-style message queues options SYSVSEM #SYSV-style semaphores -options P1003_1B_SEMAPHORES # POSIX-style semaphores options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4) options AUDIT # Security event auditing Modified: head/sys/sparc64/conf/GENERIC ============================================================================== --- head/sys/sparc64/conf/GENERIC Fri Sep 24 08:40:43 2010 (r213097) +++ head/sys/sparc64/conf/GENERIC Fri Sep 24 09:04:16 2010 (r213098) @@ -56,7 +56,6 @@ options STACK # stack(9) support options SYSVSHM # SYSV-style shared memory options SYSVMSG # SYSV-style message queues options SYSVSEM # SYSV-style semaphores -options P1003_1B_SEMAPHORES # POSIX-style semaphores options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions options PRINTF_BUFR_SIZE=128 # Prevent printf output being interspersed. options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4) From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 09:29:43 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 08F18106566B; Fri, 24 Sep 2010 09:29:43 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-qy0-f175.google.com (mail-qy0-f175.google.com [209.85.216.175]) by mx1.freebsd.org (Postfix) with ESMTP id 7FECE8FC12; Fri, 24 Sep 2010 09:29:42 +0000 (UTC) Received: by qyk31 with SMTP id 31so1091095qyk.13 for ; Fri, 24 Sep 2010 02:29:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=FL/TkrC/eIFbTCXzj5r/aCiH1XqdJmHYjzu85rW5JsQ=; b=mSp2aomPfEMPb3Vu0EOZ3Odly+9OnczMvZPChTBmGHg7871qdM7mGusD0fNscT+K5u 5oqPXV/g3HRhUjUlnKep9VkXQXtPjDuqp7bc1B1NR332Y7uQdRWqM20K344Kx3CgNAJ8 vRVrK3ttY27ZY8ctVhN/JQa19QVO70XdzTkys= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=dkIWrwSvOBKCIeUdLJ8fTeWWxLMRFMUBFsw/j8NOkydxdbFm4iULpNdVAZSrOMwZzM uCbWLaWe4Zm1UvhrKf5CIM2KSU2D0z3I+IPHpGuox/rHKD/gJvCg2YuJKoE709NWphLC i1LAzm8OjNNCSpt98CPcSV0AcnZp8TUsqhv4o= MIME-Version: 1.0 Received: by 10.229.1.161 with SMTP id 33mr2276118qcf.279.1285320581619; Fri, 24 Sep 2010 02:29:41 -0700 (PDT) Received: by 10.229.50.8 with HTTP; Fri, 24 Sep 2010 02:29:41 -0700 (PDT) In-Reply-To: <201009240840.o8O8eha0095301@svn.freebsd.org> References: <201009240840.o8O8eha0095301@svn.freebsd.org> Date: Fri, 24 Sep 2010 13:29:41 +0400 Message-ID: From: pluknet To: "Andrey V. Elsukov" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r213097 - head/sbin/geom/class/part X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 09:29:43 -0000 On 24 September 2010 12:40, Andrey V. Elsukov wrote: > Author: ae > Date: Fri Sep 24 08:40:43 2010 > New Revision: 213097 > URL: http://svn.freebsd.org/changeset/base/213097 > > Log: > =A0Implement "force" (-F) option for gpart destroy verb. Thank you very much! This is a very useful feature. Will you MFC it to RELENG_8? --=20 wbr, pluknet From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 09:49:44 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A69E9106566B for ; Fri, 24 Sep 2010 09:49:44 +0000 (UTC) (envelope-from bu7cher@yandex.ru) Received: from forward6.mail.yandex.net (forward6.mail.yandex.net [77.88.60.125]) by mx1.freebsd.org (Postfix) with ESMTP id D949F8FC12 for ; Fri, 24 Sep 2010 09:49:43 +0000 (UTC) Received: from smtp8.mail.yandex.net (smtp8.mail.yandex.net [77.88.61.54]) by forward6.mail.yandex.net (Yandex) with ESMTP id 24ED4BB07A8; Fri, 24 Sep 2010 13:49:42 +0400 (MSD) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1285321782; bh=ld+TnJyZxHFYk2ckuO9WSKzocYZ0eCIHEl4l1Aq5K08=; h=Message-ID:Date:From:MIME-Version:To:CC:Subject:References: In-Reply-To:Content-Type:Content-Transfer-Encoding; b=jKi6RhKrUVDLorpwdyQ2TeGcdGbGBMiIzQmHr4G32Kpri6XH9LqZBLrj4blzfbMvk Fmqbj3tcXG6nJz8T060OGI4KZy+tXOLzH6SZcU27Q83ryZZrik0jnaGp3gRl22x1mW AhOdmsl6jgT1uuC74o0UBYNuEnfpoJU3sHRuHqio= Received: from [10.43.163.197] (bu7cher.heavennet.ru [92.39.76.197]) by smtp8.mail.yandex.net (Yandex) with ESMTPSA id C99D820280A7; Fri, 24 Sep 2010 13:49:41 +0400 (MSD) Message-ID: <4C9C740D.20406@yandex.ru> Date: Fri, 24 Sep 2010 13:49:01 +0400 From: "Andrey V. Elsukov" User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.8) Gecko/20100806 Thunderbird/3.1.2 MIME-Version: 1.0 To: pluknet References: <201009240840.o8O8eha0095301@svn.freebsd.org> In-Reply-To: X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 8bit X-Yandex-TimeMark: 1285321782 X-Yandex-Spam: 1 X-Yandex-Front: smtp8.mail.yandex.net Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r213097 - head/sbin/geom/class/part X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 09:49:44 -0000 On 24.09.2010 13:29, pluknet wrote: >> Log: >> Implement "force" (-F) option for gpart destroy verb. > > Thank you very much! This is a very useful feature. > Will you MFC it to RELENG_8? It depends when pjd will do MFC of recent geom(8) stuff. -- WBR, Andrey V. Elsukov From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 10:17:30 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BB7A8106566C; Fri, 24 Sep 2010 10:17:30 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-qy0-f182.google.com (mail-qy0-f182.google.com [209.85.216.182]) by mx1.freebsd.org (Postfix) with ESMTP id 3351B8FC0A; Fri, 24 Sep 2010 10:17:29 +0000 (UTC) Received: by qyk7 with SMTP id 7so746322qyk.13 for ; Fri, 24 Sep 2010 03:17:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=wx2spGVd12hVMDcnzFzPv9pyCdCZ+Xzhm6BHgH/kLok=; b=CtQHp9Qutc5wXlQM14Q+N0bjWo7Z+Ur0J5jkJZFjqYTW7rl6fp0FaGCgFYlaJs0WS6 WiTNQxxueVdBXhdNyE1vqbwXHVysqvvfIMHgZI/y3BOWjQ6PuMZG8Bt/gZpxD8cA6ctg XGl0+Qs93NnP+ATrr3FrYQSNY4q1lCPjGrsHA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=X5wyJpULYAOqsPZcPj7dFeOOjTxfo0+TsFPcMf/s5FVnf/K/TX2OJlBKoFkrG0v5+D v7h73J7pZJcvri6f590gUmc2RyO3f1uNtXupOZ11+Soaa1Ou5sEP8V3YHZr0Mbd830s8 KLGhH5at7b/dev9/U9V4gxmUrYzWv7pC+3zLs= MIME-Version: 1.0 Received: by 10.229.215.76 with SMTP id hd12mr2378143qcb.44.1285323449379; Fri, 24 Sep 2010 03:17:29 -0700 (PDT) Received: by 10.229.50.8 with HTTP; Fri, 24 Sep 2010 03:17:29 -0700 (PDT) In-Reply-To: <201009160756.o8G7uZrg065332@svn.freebsd.org> References: <201009160756.o8G7uZrg065332@svn.freebsd.org> Date: Fri, 24 Sep 2010 14:17:29 +0400 Message-ID: From: pluknet To: Dag-Erling Smorgrav Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212723 - head/sys/compat/linprocfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 10:17:30 -0000 On 16 September 2010 11:56, Dag-Erling Smorgrav wrote: > Author: des > Date: Thu Sep 16 07:56:34 2010 > New Revision: 212723 > URL: http://svn.freebsd.org/changeset/base/212723 > > Log: > =A0Implement proc/$$/environment. > [...] > =A0/* > =A0* Filler function for proc/pid/environ > =A0*/ > =A0static int > =A0linprocfs_doprocenviron(PFS_FILL_ARGS) > =A0{ > + =A0 =A0 =A0 int ret; > > - =A0 =A0 =A0 sbuf_printf(sb, "doprocenviron\n%c", '\0'); > - =A0 =A0 =A0 return (0); > + =A0 =A0 =A0 PROC_LOCK(p); With this change I observe the following sleepable after non-sleepable: 1st 0xffffff000290b558 process lock (process lock) @ /usr/src/sys/modules/linprocfs/../../compat/linprocfs/linprocfs.c:1049 2nd 0xffffff00028f8848 user map (user map) @ /usr/src/sys/vm/vm_map.c:3525 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2a _witness_debugger() at _witness_debugger+0x2e witness_checkorder() at witness_checkorder+0x807 _sx_slock() at _sx_slock+0x55 vm_map_lookup() at vm_map_lookup+0x55 vm_fault() at vm_fault+0x113 proc_rwmem() at proc_rwmem+0x7a linprocfs_doprocenviron() at linprocfs_doprocenviron+0x122 pfs_read() at pfs_read+0x45b vn_read() at vn_read+0x256 dofileread() at dofileread+0xa1 kern_readv() at kern_readv+0x60 read() at read+0x55 syscallenter() at syscallenter+0x1aa syscall() at syscall+0x4c Xfast_syscall() at Xfast_syscall+0xe2 --- syscall (3, FreeBSD ELF64, read), rip =3D 0x80074134c, rsp =3D 0x7fffffffe9c8, rbp =3D 0 --- > + > + =A0 =A0 =A0 if ((ret =3D p_cansee(td, p)) !=3D 0) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 PROC_UNLOCK(p); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return ret; > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 ret =3D linprocfs_doargv(td, p, sb, ps_string_env); > + =A0 =A0 =A0 PROC_UNLOCK(p); > + =A0 =A0 =A0 return (ret); > =A0} From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 10:40:17 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B85CA106566C; Fri, 24 Sep 2010 10:40:17 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A679A8FC1C; Fri, 24 Sep 2010 10:40:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OAeHF6017885; Fri, 24 Sep 2010 10:40:17 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OAeHYh017876; Fri, 24 Sep 2010 10:40:17 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009241040.o8OAeHYh017876@svn.freebsd.org> From: Marius Strobl Date: Fri, 24 Sep 2010 10:40:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213099 - in head: libexec/tftpd usr.bin/tftp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 10:40:17 -0000 Author: marius Date: Fri Sep 24 10:40:17 2010 New Revision: 213099 URL: http://svn.freebsd.org/changeset/base/213099 Log: Make WARNS=6 clean. MFC after: 1 week Modified: head/libexec/tftpd/Makefile head/libexec/tftpd/tftp-file.c head/libexec/tftpd/tftp-options.c head/libexec/tftpd/tftp-utils.c head/libexec/tftpd/tftp-utils.h head/libexec/tftpd/tftpd.c head/usr.bin/tftp/Makefile head/usr.bin/tftp/main.c Modified: head/libexec/tftpd/Makefile ============================================================================== --- head/libexec/tftpd/Makefile Fri Sep 24 09:04:16 2010 (r213098) +++ head/libexec/tftpd/Makefile Fri Sep 24 10:40:17 2010 (r213099) @@ -5,7 +5,6 @@ PROG= tftpd MAN= tftpd.8 SRCS= tftp-file.c tftp-io.c tftp-options.c tftp-transfer.c tftp-utils.c SRCS+= tftpd.c -WARNS= 3 WFORMAT=0 LDFLAGS= -lwrap Modified: head/libexec/tftpd/tftp-file.c ============================================================================== --- head/libexec/tftpd/tftp-file.c Fri Sep 24 09:04:16 2010 (r213098) +++ head/libexec/tftpd/tftp-file.c Fri Sep 24 10:40:17 2010 (r213099) @@ -103,13 +103,13 @@ static size_t convert_to_net(char *buffer, size_t count, int init) { size_t i; - static size_t n = 0, read = 0; + static size_t n = 0, in = 0; static int newline = 0; if (init) { newline = 0; n = 0; - read = 0; + in = 0; return 0 ; } @@ -124,13 +124,13 @@ convert_to_net(char *buffer, size_t coun } while (i < count) { - if (n == read) { + if (n == in) { /* When done we're done */ if (feof(file)) break; /* Otherwise read another bunch */ - read = fread(convbuffer, 1, count, file); - if (read == 0) break; + in = fread(convbuffer, 1, count, file); + if (in == 0) break; n = 0; } @@ -250,7 +250,7 @@ read_close(void) int -synchnet(int peer) +synchnet(int peer __unused) { return 0; Modified: head/libexec/tftpd/tftp-options.c ============================================================================== --- head/libexec/tftpd/tftp-options.c Fri Sep 24 09:04:16 2010 (r213098) +++ head/libexec/tftpd/tftp-options.c Fri Sep 24 10:40:17 2010 (r213099) @@ -79,7 +79,8 @@ int options_extra_enabled = 1; */ int -option_tsize(int peer, struct tftphdr *tp, int mode, struct stat *stbuf) +option_tsize(int peer __unused, struct tftphdr *tp __unused, int mode, + struct stat *stbuf) { if (options[OPT_TSIZE].o_request == NULL) @@ -159,21 +160,19 @@ option_rollover(int peer) int option_blksize(int peer) { - int *maxdgram; - char maxbuffer[100]; + u_long maxdgram; size_t len; if (options[OPT_BLKSIZE].o_request == NULL) return (0); /* maximum size of an UDP packet according to the system */ - len = sizeof(maxbuffer); + len = sizeof(maxdgram); if (sysctlbyname("net.inet.udp.maxdgram", - maxbuffer, &len, NULL, 0) < 0) { + &maxdgram, &len, NULL, 0) < 0) { tftp_log(LOG_ERR, "sysctl: net.inet.udp.maxdgram"); return (acting_as_client ? 1 : 0); } - maxdgram = (int *)maxbuffer; int size = atoi(options[OPT_BLKSIZE].o_request); if (size < BLKSIZE_MIN || size > BLKSIZE_MAX) { @@ -191,20 +190,20 @@ option_blksize(int peer) } } - if (size > *maxdgram) { + if (size > (int)maxdgram) { if (acting_as_client) { tftp_log(LOG_ERR, "Invalid blocksize (%d bytes), " "net.inet.udp.maxdgram sysctl limits it to " - "%d bytes.\n", size, *maxdgram); + "%d bytes.\n", size, maxdgram); send_error(peer, EBADOP); return (1); } else { tftp_log(LOG_WARNING, "Invalid blocksize (%d bytes), " "net.inet.udp.maxdgram sysctl limits it to " - "%d bytes.\n", size, *maxdgram); - size = *maxdgram; + "%d bytes.\n", size, maxdgram); + size = maxdgram; /* No reason to return */ } } @@ -220,10 +219,9 @@ option_blksize(int peer) } int -option_blksize2(int peer) +option_blksize2(int peer __unused) { - int *maxdgram; - char maxbuffer[100]; + u_long maxdgram; int size, i; size_t len; @@ -236,13 +234,12 @@ option_blksize2(int peer) return (0); /* maximum size of an UDP packet according to the system */ - len = sizeof(maxbuffer); + len = sizeof(maxdgram); if (sysctlbyname("net.inet.udp.maxdgram", - maxbuffer, &len, NULL, 0) < 0) { + &maxdgram, &len, NULL, 0) < 0) { tftp_log(LOG_ERR, "sysctl: net.inet.udp.maxdgram"); return (acting_as_client ? 1 : 0); } - maxdgram = (int *)maxbuffer; size = atoi(options[OPT_BLKSIZE2].o_request); for (i = 0; sizes[i] != 0; i++) { @@ -254,13 +251,13 @@ option_blksize2(int peer) return (acting_as_client ? 1 : 0); } - if (size > *maxdgram) { + if (size > (int)maxdgram) { for (i = 0; sizes[i+1] != 0; i++) { - if (*maxdgram < sizes[i+1]) break; + if ((int)maxdgram < sizes[i+1]) break; } tftp_log(LOG_INFO, "Invalid blocksize2 (%d bytes), net.inet.udp.maxdgram " - "sysctl limits it to %d bytes.\n", size, *maxdgram); + "sysctl limits it to %d bytes.\n", size, maxdgram); size = sizes[i]; /* No need to return */ } @@ -279,7 +276,7 @@ option_blksize2(int peer) * Append the available options to the header */ uint16_t -make_options(int peer, char *buffer, uint16_t size) { +make_options(int peer __unused, char *buffer, uint16_t size) { int i; char *value; const char *option; Modified: head/libexec/tftpd/tftp-utils.c ============================================================================== --- head/libexec/tftpd/tftp-utils.c Fri Sep 24 09:04:16 2010 (r213098) +++ head/libexec/tftpd/tftp-utils.c Fri Sep 24 10:40:17 2010 (r213099) @@ -59,7 +59,7 @@ int acting_as_client; * first timeout) to 'timeoutnetwork' (i.e. the last timeout) */ int -settimeouts(int _timeoutpacket, int _timeoutnetwork, int _maxtimeouts) +settimeouts(int _timeoutpacket, int _timeoutnetwork, int _maxtimeouts __unused) { int i; @@ -91,7 +91,7 @@ unmappedaddr(struct sockaddr_in6 *sin6) !IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) return; sin4 = (struct sockaddr_in *)sin6; - addr = *(u_int32_t *)&sin6->sin6_addr.s6_addr[12]; + memcpy(&addr, &sin6->sin6_addr.s6_addr[12], sizeof(addr)); port = sin6->sin6_port; memset(sin4, 0, sizeof(struct sockaddr_in)); sin4->sin_addr.s_addr = addr; @@ -170,7 +170,7 @@ struct packettypes packettypes[] = { { 0, NULL }, }; -char * +const char * packettype(int type) { static char failed[100]; @@ -231,7 +231,7 @@ debug_finds(char *s) return (i); } -char * +const char * debug_show(int d) { static char s[100]; @@ -317,4 +317,3 @@ printstats(const char *direction, int ve printf(" [%.0f bits/sec]", (ts->amount*8.)/delta); putchar('\n'); } - Modified: head/libexec/tftpd/tftp-utils.h ============================================================================== --- head/libexec/tftpd/tftp-utils.h Fri Sep 24 09:04:16 2010 (r213098) +++ head/libexec/tftpd/tftp-utils.h Fri Sep 24 10:40:17 2010 (r213099) @@ -64,17 +64,17 @@ ssize_t get_field(int peer, char *buffer */ struct packettypes { int value; - char *name; + const char *const name; }; extern struct packettypes packettypes[]; -char *packettype(int); +const char *packettype(int); /* * RP_ */ struct rp_errors { int error; - char *desc; + const char *const desc; }; extern struct rp_errors rp_errors[]; char *rp_strerror(int error); @@ -89,15 +89,15 @@ char *rp_strerror(int error); #define DEBUG_ACCESS 0x0008 struct debugs { int value; - char *name; - char *desc; + const char *const name; + const char *const desc; }; extern int debug; extern struct debugs debugs[]; extern int packetdroppercentage; int debug_find(char *s); int debug_finds(char *s); -char *debug_show(int d); +const char *debug_show(int d); /* * Log routines Modified: head/libexec/tftpd/tftpd.c ============================================================================== --- head/libexec/tftpd/tftpd.c Fri Sep 24 09:04:16 2010 (r213098) +++ head/libexec/tftpd/tftpd.c Fri Sep 24 10:40:17 2010 (r213099) @@ -97,7 +97,7 @@ static int suppress_naks; static int logging; static int ipchroot; static int create_new = 0; -static char *newfile_format = "%Y%m%d"; +static const char *newfile_format = "%Y%m%d"; static int increase_name = 0; static mode_t mask = S_IWGRP | S_IWOTH; @@ -785,7 +785,6 @@ static void tftp_xmitfile(int peer, const char *mode) { uint16_t block; - uint32_t amount; time_t now; struct tftp_stats ts; @@ -799,13 +798,12 @@ tftp_xmitfile(int peer, const char *mode read_close(); if (debug&DEBUG_SIMPLE) tftp_log(LOG_INFO, "Sent %d bytes in %d seconds", - amount, time(NULL) - now); + ts.amount, time(NULL) - now); } static void tftp_recvfile(int peer, const char *mode) { - uint32_t filesize; uint16_t block; struct timeval now1, now2; struct tftp_stats ts; @@ -820,6 +818,7 @@ tftp_recvfile(int peer, const char *mode tftp_receive(peer, &block, &ts, NULL, 0); write_close(); + gettimeofday(&now2, NULL); if (debug&DEBUG_SIMPLE) { double f; @@ -832,9 +831,8 @@ tftp_recvfile(int peer, const char *mode (now2.tv_usec - now1.tv_usec) / 100000.0; tftp_log(LOG_INFO, "Download of %d bytes in %d blocks completed after %0.1f seconds\n", - filesize, block, f); + ts.amount, block, f); } return; } - Modified: head/usr.bin/tftp/Makefile ============================================================================== --- head/usr.bin/tftp/Makefile Fri Sep 24 09:04:16 2010 (r213098) +++ head/usr.bin/tftp/Makefile Fri Sep 24 10:40:17 2010 (r213099) @@ -1,12 +1,11 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 # $FreeBSD$ -.PATH: ${.CURDIR}/../../libexec/tftpd +.PATH: ${.CURDIR}/../../libexec/tftpd PROG= tftp SRCS= main.c tftp-file.c tftp-io.c tftp-options.c tftp-transfer.c SRCS+= tftp-utils.c tftp.c -WARNS= 3 CFLAGS+=-I${.CURDIR}/../../libexec/tftpd DPADD= ${LIBEDIT} ${LIBTERMCAP} LDADD= -ledit -ltermcap Modified: head/usr.bin/tftp/main.c ============================================================================== --- head/usr.bin/tftp/main.c Fri Sep 24 09:04:16 2010 (r213098) +++ head/usr.bin/tftp/main.c Fri Sep 24 10:40:17 2010 (r213099) @@ -222,8 +222,8 @@ urihandling(char *URI) char uri[ARG_MAX]; char *host = NULL; char *path = NULL; - char *options = NULL; - char *mode = "octet"; + char *opts = NULL; + const char *tmode = "octet"; char *s; char line[MAXLINE]; int i; @@ -241,14 +241,14 @@ urihandling(char *URI) if ((s = strchr(path, ';')) != NULL) { *s = '\0'; - options = s + 1; + opts = s + 1; - if (strncmp(options, "mode=", 5) == 0) { - mode = options; - mode += 5; + if (strncmp(opts, "mode=", 5) == 0) { + tmode = opts; + tmode += 5; for (i = 0; modes[i].m_name != NULL; i++) { - if (strcmp(modes[i].m_name, mode) == 0) + if (strcmp(modes[i].m_name, tmode) == 0) break; } if (modes[i].m_name == NULL) { @@ -697,7 +697,7 @@ tail(char *filename) } static const char * -command_prompt() +command_prompt(void) { return ("tftp> "); @@ -964,27 +964,25 @@ setblocksize(int argc, char *argv[]) if (argc != 1) { int size = atoi(argv[1]); size_t max; - char maxbuffer[100]; - int *maxdgram; + u_long maxdgram; - max = sizeof(maxbuffer); + max = sizeof(maxdgram); if (sysctlbyname("net.inet.udp.maxdgram", - maxbuffer, &max, NULL, 0) < 0) { + &maxdgram, &max, NULL, 0) < 0) { perror("sysctl: net.inet.udp.maxdgram"); return; } - maxdgram = (int *)maxbuffer; if (size < BLKSIZE_MIN || size > BLKSIZE_MAX) { printf("Blocksize should be between %d and %d bytes.\n", BLKSIZE_MIN, BLKSIZE_MAX); return; - } else if (size > *maxdgram - 4) { - printf("Blocksize can't be bigger than %d bytes due " + } else if (size > (int)maxdgram - 4) { + printf("Blocksize can't be bigger than %ld bytes due " "to the net.inet.udp.maxdgram sysctl limitation.\n", - *maxdgram - 4); + maxdgram - 4); asprintf(&options[OPT_BLKSIZE].o_request, - "%d", *maxdgram - 4); + "%ld", maxdgram - 4); } else { asprintf(&options[OPT_BLKSIZE].o_request, "%d", size); } @@ -1005,21 +1003,19 @@ setblocksize2(int argc, char *argv[]) int size = atoi(argv[1]); int i; size_t max; - char maxbuffer[100]; - int *maxdgram; + u_long maxdgram; int sizes[] = { 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 0 }; - max = sizeof(maxbuffer); + max = sizeof(maxdgram); if (sysctlbyname("net.inet.udp.maxdgram", - maxbuffer, &max, NULL, 0) < 0) { + &maxdgram, &max, NULL, 0) < 0) { perror("sysctl: net.inet.udp.maxdgram"); return; } - maxdgram = (int *)maxbuffer; for (i = 0; sizes[i] != 0; i++) { if (sizes[i] == size) break; @@ -1034,12 +1030,12 @@ setblocksize2(int argc, char *argv[]) printf("Blocksize2 should be between " "%d and %d bytes.\n", BLKSIZE_MIN, BLKSIZE_MAX); return; - } else if (size > *maxdgram - 4) { - printf("Blocksize2 can't be bigger than %d bytes due " + } else if (size > (int)maxdgram - 4) { + printf("Blocksize2 can't be bigger than %ld bytes due " "to the net.inet.udp.maxdgram sysctl limitation.\n", - *maxdgram - 4); + maxdgram - 4); for (i = 0; sizes[i+1] != 0; i++) { - if (*maxdgram < sizes[i+1]) break; + if ((int)maxdgram < sizes[i+1]) break; } asprintf(&options[OPT_BLKSIZE2].o_request, "%d", sizes[i]); From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 10:59:47 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1CB07106566B; Fri, 24 Sep 2010 10:59:47 +0000 (UTC) (envelope-from gavin@ury.york.ac.uk) Received: from gse-mta-27.emailfiltering.com (gse-mta-27-tx.emailfiltering.com [194.116.198.158]) by mx1.freebsd.org (Postfix) with ESMTP id CEA278FC13; Fri, 24 Sep 2010 10:59:45 +0000 (UTC) Received: from mail-gw5.york.ac.uk ([144.32.129.29]) by gse-mta-27.emailfiltering.com with emfmta (version 4.6.0.72) by TLS id 755780012 for kensmith@buffalo.edu; 700040513cd033fa; Fri, 24 Sep 2010 11:59:31 +0100 Received: from ury.york.ac.uk ([144.32.108.81]:51201) by mail-gw5.york.ac.uk with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1Oz600-0001Hy-QQ; Fri, 24 Sep 2010 11:59:28 +0100 Received: from gavin (helo=localhost) by ury.york.ac.uk with local-esmtp (Exim 4.72) (envelope-from ) id 1Oz600-0001Gi-JR; Fri, 24 Sep 2010 11:59:28 +0100 Date: Fri, 24 Sep 2010 11:59:28 +0100 (BST) From: Gavin Atkinson X-X-Sender: gavin@ury.york.ac.uk To: Ken Smith In-Reply-To: <1285297884.17619.17.camel@neo.cse.buffalo.edu> Message-ID: References: <20100922222441.00002f27@unknown> <1285253887.95760.33.camel@bauer.cse.buffalo.edu> <20100923.203143.19192035494300157.imp@bsdimp.com> <1285297884.17619.17.camel@neo.cse.buffalo.edu> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: Cc: bruce@cran.org.uk, src-committers@FreeBSD.org, jhb@FreeBSD.org, svn-src-all@FreeBSD.org, avg@FreeBSD.org, svn-src-head@FreeBSD.org, "M. Warner Losh" Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 10:59:47 -0000 On Thu, 23 Sep 2010, Ken Smith wrote: > This is definitely one I don't have a strong enough opinion > on to fight over, I sympathize with both sides. If the > general consensus is mostly towards changing so be it. > I've got no way to tell what percentage of users would > have any clue what to do with the crash info versus users > who would be negatively impacted simply by the fact their > systems are generating stuff they're completely ignorant > of and will never touch. We could make /etc/rc.d/savecore (the script that runs crashinfo) also email root@ (or wherever the periodic output is set to go to) with a pointer to the output, and instuctions on what to do (either delete, or email it somewhere). The output isn't sanitised so we'd have to be careful here - we can't just suggest send-pr. Thanks, Gavin From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 11:53:16 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E955910656C5; Fri, 24 Sep 2010 11:53:16 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 36C1B8FC27; Fri, 24 Sep 2010 11:53:15 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id o8OBrCA3092581 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 24 Sep 2010 14:53:12 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id o8OBrBBd040491; Fri, 24 Sep 2010 14:53:11 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id o8OBrB9c040490; Fri, 24 Sep 2010 14:53:11 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 24 Sep 2010 14:53:11 +0300 From: Kostik Belousov To: pluknet Message-ID: <20100924115311.GH34228@deviant.kiev.zoral.com.ua> References: <201009160756.o8G7uZrg065332@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="c7hkjup166d4FzgN" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Dag-Erling Smorgrav Subject: Re: svn commit: r212723 - head/sys/compat/linprocfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 11:53:17 -0000 --c7hkjup166d4FzgN Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Sep 24, 2010 at 02:17:29PM +0400, pluknet wrote: > On 16 September 2010 11:56, Dag-Erling Smorgrav wrote: > > Author: des > > Date: Thu Sep 16 07:56:34 2010 > > New Revision: 212723 > > URL: http://svn.freebsd.org/changeset/base/212723 > > > > Log: > > =9AImplement proc/$$/environment. > > > [...] >=20 > > =9A/* > > =9A* Filler function for proc/pid/environ > > =9A*/ > > =9Astatic int > > =9Alinprocfs_doprocenviron(PFS_FILL_ARGS) > > =9A{ > > + =9A =9A =9A int ret; > > > > - =9A =9A =9A sbuf_printf(sb, "doprocenviron\n%c", '\0'); > > - =9A =9A =9A return (0); > > + =9A =9A =9A PROC_LOCK(p); >=20 > With this change I observe the following sleepable after non-sleepable: >=20 > 1st 0xffffff000290b558 process lock (process lock) @ > /usr/src/sys/modules/linprocfs/../../compat/linprocfs/linprocfs.c:1049 > 2nd 0xffffff00028f8848 user map (user map) @ /usr/src/sys/vm/vm_map.c:35= 25 > KDB: stack backtrace: > db_trace_self_wrapper() at db_trace_self_wrapper+0x2a > _witness_debugger() at _witness_debugger+0x2e > witness_checkorder() at witness_checkorder+0x807 > _sx_slock() at _sx_slock+0x55 > vm_map_lookup() at vm_map_lookup+0x55 > vm_fault() at vm_fault+0x113 > proc_rwmem() at proc_rwmem+0x7a > linprocfs_doprocenviron() at linprocfs_doprocenviron+0x122 > pfs_read() at pfs_read+0x45b > vn_read() at vn_read+0x256 > dofileread() at dofileread+0xa1 > kern_readv() at kern_readv+0x60 > read() at read+0x55 > syscallenter() at syscallenter+0x1aa > syscall() at syscall+0x4c > Xfast_syscall() at Xfast_syscall+0xe2 > --- syscall (3, FreeBSD ELF64, read), rip =3D 0x80074134c, rsp =3D > 0x7fffffffe9c8, rbp =3D 0 --- >=20 >=20 > > + > > + =9A =9A =9A if ((ret =3D p_cansee(td, p)) !=3D 0) { > > + =9A =9A =9A =9A =9A =9A =9A PROC_UNLOCK(p); > > + =9A =9A =9A =9A =9A =9A =9A return ret; > > + =9A =9A =9A } > > + > > + =9A =9A =9A ret =3D linprocfs_doargv(td, p, sb, ps_string_env); > > + =9A =9A =9A PROC_UNLOCK(p); > > + =9A =9A =9A return (ret); > > =9A} This is easy to fix, isn't it ? But there seems to be much more nits. First, allocating 512 * sizeof(char *)-byte object on the stack is not good. Second, the initialization of iov_len for reading the array of string pointers misses '* sizeof(char *)'. And third (probably fatal) is the lack of checks that the end of array and each string fits into the user portion of the map. I do not see why addr that already has u_long type is casted to u_long. Also, VM_MIN_ADDRESS, VM_MAXUSER_ADDRESS constants are for the native host FreeBSD ABI, they may differ from the target process limits. Formatting is separate issue, let postpone it. diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linpro= cfs.c index c7fe158..fd62b1c 100644 --- a/sys/compat/linprocfs/linprocfs.c +++ b/sys/compat/linprocfs/linprocfs.c @@ -952,12 +952,9 @@ linprocfs_doargv(struct thread *td, struct proc *p, st= ruct sbuf *sb, struct uio tmp_uio; struct ps_strings pss; int ret, i, n_elements, found_end; - u_long addr; - char* env_vector[MAX_ARGV_STR]; + u_long addr, pbegin; + char **env_vector; char env_string[UIO_CHUNK_SZ]; - char *pbegin; - - =20 #define UIO_HELPER(uio, iov, base, len, cnt, offset, sz, flg, rw, td) \ do { \ @@ -971,6 +968,10 @@ do { \ uio.uio_rw =3D (rw); \ uio.uio_td =3D (td); \ } while (0) +#define VALID_USER_ADDR(addr) \ + ((addr) >=3D p->p_sysent->sv_minuser && (addr) < p->p_sysent->sv_maxuser) + + env_vector =3D malloc(sizeof(char *) * MAX_ARGV_STR, M_TEMP, M_WAITOK); =20 UIO_HELPER(tmp_uio, iov, &pss, sizeof(struct ps_strings), 1, (off_t)(p->p_sysent->sv_psstrings), sizeof(struct ps_strings), @@ -978,37 +979,41 @@ do { \ =20 ret =3D proc_rwmem(p, &tmp_uio); if (ret !=3D 0) - return ret; + goto done; =20 /* Get the array address and the number of elements */ resolver(pss, &addr, &n_elements); =20 /* Consistent with lib/libkvm/kvm_proc.c */ - if (n_elements > MAX_ARGV_STR || (u_long)addr < VM_MIN_ADDRESS || - (u_long)addr >=3D VM_MAXUSER_ADDRESS) { - /* What error code should we return? */ - return 0; + if (n_elements > MAX_ARGV_STR || !VALID_USER_ADDR(addr) || + !VALID_USER_ADDR(addr + MAX_ARGV_STR * sizeof(char *))) { + ret =3D EFAULT; + goto done; } =20 - UIO_HELPER(tmp_uio, iov, env_vector, MAX_ARGV_STR, 1, + UIO_HELPER(tmp_uio, iov, env_vector, MAX_ARGV_STR * sizeof(char *), 1, (vm_offset_t)(addr), iov.iov_len, UIO_SYSSPACE, UIO_READ, td); =20 ret =3D proc_rwmem(p, &tmp_uio); if (ret !=3D 0) - return ret; + goto done; =20 /* Now we can iterate through the list of strings */ for (i =3D 0; i < n_elements; i++) { found_end =3D 0; - pbegin =3D env_vector[i]; - while(!found_end) { + pbegin =3D (vm_offset_t)env_vector[i]; + while (!found_end) { + if (!VALID_USER_ADDR(pbegin) || + !VALID_USER_ADDR(pbegin + sizeof(env_string))) { + ret =3D EFAULT; + goto done; + } UIO_HELPER(tmp_uio, iov, env_string, sizeof(env_string), 1, - (vm_offset_t) pbegin, iov.iov_len, UIO_SYSSPACE, - UIO_READ, td); + pbegin, iov.iov_len, UIO_SYSSPACE, UIO_READ, td); =20 ret =3D proc_rwmem(p, &tmp_uio); if (ret !=3D 0) - return ret; + goto done; =20 if (!strvalid(env_string, UIO_CHUNK_SZ)) { /* @@ -1017,7 +1022,7 @@ do { \ * the pointer */ sbuf_bcat(sb, env_string, UIO_CHUNK_SZ); - pbegin =3D &(*pbegin) + UIO_CHUNK_SZ; + pbegin +=3D UIO_CHUNK_SZ; } else { found_end =3D 1; } @@ -1025,9 +1030,12 @@ do { \ sbuf_printf(sb, "%s", env_string); } =20 +#undef VALID_USER_ADDR #undef UIO_HELPER =20 - return (0); +done: + free(env_vector, M_TEMP); + return (ret); } =20 static void @@ -1052,9 +1060,11 @@ linprocfs_doprocenviron(PFS_FILL_ARGS) PROC_UNLOCK(p); return ret; } + _PHOLD(p); + PROC_UNLOCK(p); =20 ret =3D linprocfs_doargv(td, p, sb, ps_string_env); - PROC_UNLOCK(p); + PRELE(p); return (ret); } =20 --c7hkjup166d4FzgN Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkyckScACgkQC3+MBN1Mb4gV3ACglhzFjvkwxkueLStOkEcmkot0 dJYAoJUZRbmAxaWGJZRO5f6TmOCPxOiH =/lkV -----END PGP SIGNATURE----- --c7hkjup166d4FzgN-- From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 12:24:19 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7119F1065670; Fri, 24 Sep 2010 12:24:19 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-qy0-f175.google.com (mail-qy0-f175.google.com [209.85.216.175]) by mx1.freebsd.org (Postfix) with ESMTP id E0E6F8FC0A; Fri, 24 Sep 2010 12:24:18 +0000 (UTC) Received: by qyk31 with SMTP id 31so1286454qyk.13 for ; Fri, 24 Sep 2010 05:24:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=hXGcuuIugQOXqRWtVxSXG6RpShLYjNny0BSXaRbfBj4=; b=I1ox2JwE8Sr3mHYMFWUK6/U6eXMABCaFF9J4RncGZrWnxCgUj20hoerSCUo86GCOYp eMuhi9X00LQq/I8+hc6LRdgagaF8IKEgaPYCs0MyKYCWkKVeTZUzCJTXbQ/SxbaQQ5sx nRP094ikMRlqjvwJZwPZX6cRnIe8GAGEA3CRU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=R09/2mQe/daCuH3HMgDNeTET8LAN1EEUvSHQLvLpXSoBhvE7DUlzB/Rg15AzCAoRzL /ggT5K6nWepTcXPAyO52Gjgde1akV/iPyMuHYU67oc2my8Vro01GAsO93+6TM3cW5N2R J9t5ni+2Sd59Ls3cGLtM5P13eOjrLtKxzRk58= MIME-Version: 1.0 Received: by 10.229.246.194 with SMTP id lz2mr2477723qcb.216.1285331058297; Fri, 24 Sep 2010 05:24:18 -0700 (PDT) Received: by 10.229.50.8 with HTTP; Fri, 24 Sep 2010 05:24:18 -0700 (PDT) In-Reply-To: <20100924115311.GH34228@deviant.kiev.zoral.com.ua> References: <201009160756.o8G7uZrg065332@svn.freebsd.org> <20100924115311.GH34228@deviant.kiev.zoral.com.ua> Date: Fri, 24 Sep 2010 16:24:18 +0400 Message-ID: From: pluknet To: Kostik Belousov Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Dag-Erling Smorgrav Subject: Re: svn commit: r212723 - head/sys/compat/linprocfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 12:24:19 -0000 2010/9/24 Kostik Belousov : > On Fri, Sep 24, 2010 at 02:17:29PM +0400, pluknet wrote: >> On 16 September 2010 11:56, Dag-Erling Smorgrav wrote: >> > Author: des >> > Date: Thu Sep 16 07:56:34 2010 >> > New Revision: 212723 >> > URL: http://svn.freebsd.org/changeset/base/212723 >> > >> > Log: >> > =A0Implement proc/$$/environment. >> > >> [...] >> >> > =A0/* >> > =A0* Filler function for proc/pid/environ >> > =A0*/ >> > =A0static int >> > =A0linprocfs_doprocenviron(PFS_FILL_ARGS) >> > =A0{ >> > + =A0 =A0 =A0 int ret; >> > >> > - =A0 =A0 =A0 sbuf_printf(sb, "doprocenviron\n%c", '\0'); >> > - =A0 =A0 =A0 return (0); >> > + =A0 =A0 =A0 PROC_LOCK(p); >> >> With this change I observe the following sleepable after non-sleepable: >> [LOR there] >> >> >> > + >> > + =A0 =A0 =A0 if ((ret =3D p_cansee(td, p)) !=3D 0) { >> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 PROC_UNLOCK(p); >> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return ret; >> > + =A0 =A0 =A0 } >> > + >> > + =A0 =A0 =A0 ret =3D linprocfs_doargv(td, p, sb, ps_string_env); >> > + =A0 =A0 =A0 PROC_UNLOCK(p); >> > + =A0 =A0 =A0 return (ret); >> > =A0} > > This is easy to fix, isn't it ? But there seems to be much more nits. > > First, allocating 512 * sizeof(char *)-byte object on the stack is not > good. > > Second, the initialization of iov_len for reading the array > of string pointers misses '* sizeof(char *)'. > > And third (probably fatal) is the lack of checks that the end of > array and each string fits into the user portion of the map. I do not > see why addr that already has u_long type is casted to u_long. Also, > VM_MIN_ADDRESS, VM_MAXUSER_ADDRESS constants are for the native host > FreeBSD ABI, they may differ from the target process limits. > Thanks for quick reaction. As for the latter, something doesn't quite work here. I see EFAULT against i386 process running on amd64. --=20 wbr, pluknet From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 13:01:01 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D86F41065693; Fri, 24 Sep 2010 13:01:01 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C72D78FC13; Fri, 24 Sep 2010 13:01:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OD117F020782; Fri, 24 Sep 2010 13:01:01 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OD11dr020780; Fri, 24 Sep 2010 13:01:01 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201009241301.o8OD11dr020780@svn.freebsd.org> From: David Xu Date: Fri, 24 Sep 2010 13:01:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213100 - head/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 13:01:01 -0000 Author: davidxu Date: Fri Sep 24 13:01:01 2010 New Revision: 213100 URL: http://svn.freebsd.org/changeset/base/213100 Log: inline testcancel() into thr_cancel_leave(), because cancel_pending is almost false, this makes a slight better branch predicting. Modified: head/lib/libthr/thread/thr_cancel.c Modified: head/lib/libthr/thread/thr_cancel.c ============================================================================== --- head/lib/libthr/thread/thr_cancel.c Fri Sep 24 10:40:17 2010 (r213099) +++ head/lib/libthr/thread/thr_cancel.c Fri Sep 24 13:01:01 2010 (r213100) @@ -158,6 +158,7 @@ void _thr_cancel_leave(struct pthread *curthread, int maycancel) { curthread->cancel_point = 0; - if (maycancel) - testcancel(curthread); + if (__predict_false(SHOULD_CANCEL(curthread) && + !THR_IN_CRITICAL(curthread) && maycancel)) + _pthread_exit(PTHREAD_CANCELED); } From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 13:06:53 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 91C2C106566B; Fri, 24 Sep 2010 13:06:53 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id B455E8FC22; Fri, 24 Sep 2010 13:06:52 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id o8OD6ibW098366 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 24 Sep 2010 16:06:44 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id o8OD6iJQ040830; Fri, 24 Sep 2010 16:06:44 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id o8OD6ig8040829; Fri, 24 Sep 2010 16:06:44 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 24 Sep 2010 16:06:44 +0300 From: Kostik Belousov To: pluknet Message-ID: <20100924130644.GI34228@deviant.kiev.zoral.com.ua> References: <201009160756.o8G7uZrg065332@svn.freebsd.org> <20100924115311.GH34228@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="+Z7/5fzWRHDJ0o7Q" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Dag-Erling Smorgrav Subject: Re: svn commit: r212723 - head/sys/compat/linprocfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 13:06:53 -0000 --+Z7/5fzWRHDJ0o7Q Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Sep 24, 2010 at 04:24:18PM +0400, pluknet wrote: > 2010/9/24 Kostik Belousov : > > On Fri, Sep 24, 2010 at 02:17:29PM +0400, pluknet wrote: > >> On 16 September 2010 11:56, Dag-Erling Smorgrav wrot= e: > >> > Author: des > >> > Date: Thu Sep 16 07:56:34 2010 > >> > New Revision: 212723 > >> > URL: http://svn.freebsd.org/changeset/base/212723 > >> > > >> > Log: > >> > =9AImplement proc/$$/environment. > >> > > >> [...] > >> > >> > =9A/* > >> > =9A* Filler function for proc/pid/environ > >> > =9A*/ > >> > =9Astatic int > >> > =9Alinprocfs_doprocenviron(PFS_FILL_ARGS) > >> > =9A{ > >> > + =9A =9A =9A int ret; > >> > > >> > - =9A =9A =9A sbuf_printf(sb, "doprocenviron\n%c", '\0'); > >> > - =9A =9A =9A return (0); > >> > + =9A =9A =9A PROC_LOCK(p); > >> > >> With this change I observe the following sleepable after non-sleepable: > >> > [LOR there] > >> > >> > >> > + > >> > + =9A =9A =9A if ((ret =3D p_cansee(td, p)) !=3D 0) { > >> > + =9A =9A =9A =9A =9A =9A =9A PROC_UNLOCK(p); > >> > + =9A =9A =9A =9A =9A =9A =9A return ret; > >> > + =9A =9A =9A } > >> > + > >> > + =9A =9A =9A ret =3D linprocfs_doargv(td, p, sb, ps_string_env); > >> > + =9A =9A =9A PROC_UNLOCK(p); > >> > + =9A =9A =9A return (ret); > >> > =9A} > > > > This is easy to fix, isn't it ? But there seems to be much more nits. > > > > First, allocating 512 * sizeof(char *)-byte object on the stack is not > > good. > > > > Second, the initialization of iov_len for reading the array > > of string pointers misses '* sizeof(char *)'. > > > > And third (probably fatal) is the lack of checks that the end of > > array and each string fits into the user portion of the map. I do not > > see why addr that already has u_long type is casted to u_long. Also, > > VM_MIN_ADDRESS, VM_MAXUSER_ADDRESS constants are for the native host > > FreeBSD ABI, they may differ from the target process limits. > > >=20 > Thanks for quick reaction. >=20 > As for the latter, something doesn't quite work here. > I see EFAULT against i386 process running on amd64. Right, the COMPAT_FREEBSD32 case should properly convert both struct ps_strings and array of pointers to the host structures. So this is fourth issue. diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linpro= cfs.c index c7fe158..db837e2 100644 --- a/sys/compat/linprocfs/linprocfs.c +++ b/sys/compat/linprocfs/linprocfs.c @@ -96,6 +96,10 @@ __FBSDID("$FreeBSD$"); #include #endif /* __i386__ || __amd64__ */ =20 +#ifdef COMPAT_FREEBSD32 +#include +#endif + #ifdef COMPAT_LINUX32 /* XXX */ #include #else @@ -951,13 +955,14 @@ linprocfs_doargv(struct thread *td, struct proc *p, s= truct sbuf *sb, struct iovec iov; struct uio tmp_uio; struct ps_strings pss; - int ret, i, n_elements, found_end; - u_long addr; - char* env_vector[MAX_ARGV_STR]; + int ret, i, n_elements, elm_len, found_end; + u_long addr, pbegin; + char **env_vector; char env_string[UIO_CHUNK_SZ]; - char *pbegin; - - +#ifdef COMPAT_FREEBSD32 + struct freebsd32_ps_strings pss32; + uint32_t ptr; +#endif =20 #define UIO_HELPER(uio, iov, base, len, cnt, offset, sz, flg, rw, td) \ do { \ @@ -971,63 +976,112 @@ do { \ uio.uio_rw =3D (rw); \ uio.uio_td =3D (td); \ } while (0) - - UIO_HELPER(tmp_uio, iov, &pss, sizeof(struct ps_strings), 1, - (off_t)(p->p_sysent->sv_psstrings), sizeof(struct ps_strings), - UIO_SYSSPACE, UIO_READ, td); - - ret =3D proc_rwmem(p, &tmp_uio); - if (ret !=3D 0) - return ret; +#define VALID_USER_ADDR(addr) \ + ((addr) >=3D p->p_sysent->sv_minuser && (addr) < p->p_sysent->sv_maxuser) + + env_vector =3D malloc(sizeof(char *) * MAX_ARGV_STR, M_TEMP, M_WAITOK); + +#ifdef COMPAT_FREEBSD32 + if ((p->p_sysent->sv_flags & SV_ILP32) !=3D 0) { + UIO_HELPER(tmp_uio, iov, &pss32, sizeof(pss32), 1, + (off_t)(p->p_sysent->sv_psstrings), + sizeof(pss32), UIO_SYSSPACE, UIO_READ, td); + ret =3D proc_rwmem(p, &tmp_uio); + if (ret !=3D 0) + goto done; + pss.ps_argvstr =3D PTRIN(pss32.ps_argvstr); + pss.ps_nargvstr =3D pss32.ps_nargvstr; + pss.ps_envstr =3D PTRIN(pss32.ps_envstr); + pss.ps_nenvstr =3D pss32.ps_nenvstr; + + elm_len =3D MAX_ARGV_STR * sizeof(int32_t); + } else { +#endif + UIO_HELPER(tmp_uio, iov, &pss, sizeof(pss), 1, + (off_t)(p->p_sysent->sv_psstrings), + sizeof(pss), UIO_SYSSPACE, UIO_READ, td); + ret =3D proc_rwmem(p, &tmp_uio); + if (ret !=3D 0) + goto done; + + elm_len =3D MAX_ARGV_STR * sizeof(char *); +#ifdef COMPAT_FREEBSD32 + } +#endif =20 /* Get the array address and the number of elements */ resolver(pss, &addr, &n_elements); =20 /* Consistent with lib/libkvm/kvm_proc.c */ - if (n_elements > MAX_ARGV_STR || (u_long)addr < VM_MIN_ADDRESS || - (u_long)addr >=3D VM_MAXUSER_ADDRESS) { - /* What error code should we return? */ - return 0; + if (n_elements > MAX_ARGV_STR || !VALID_USER_ADDR(addr) || + !VALID_USER_ADDR(addr + elm_len)) { + ret =3D EFAULT; + goto done; } =20 - UIO_HELPER(tmp_uio, iov, env_vector, MAX_ARGV_STR, 1, - (vm_offset_t)(addr), iov.iov_len, UIO_SYSSPACE, UIO_READ, td); +#ifdef COMPAT_FREEBSD32 + if ((p->p_sysent->sv_flags & SV_ILP32) !=3D 0) { + for (i =3D 0; i < MAX_ARGV_STR; i++) { + UIO_HELPER(tmp_uio, iov, &ptr, sizeof(ptr), 1, + (vm_offset_t)(addr + i * sizeof(uint32_t)), + iov.iov_len, UIO_SYSSPACE, UIO_READ, td); + ret =3D proc_rwmem(p, &tmp_uio); + if (ret !=3D 0) + goto done; + env_vector[i] =3D PTRIN(ptr); + } + } else { +#endif + UIO_HELPER(tmp_uio, iov, env_vector, elm_len, 1, + (vm_offset_t)(addr), iov.iov_len, UIO_SYSSPACE, UIO_READ, + td); + ret =3D proc_rwmem(p, &tmp_uio); + if (ret !=3D 0) + goto done; +#ifdef COMPAT_FREEBSD32 + } +#endif =20 - ret =3D proc_rwmem(p, &tmp_uio); - if (ret !=3D 0) - return ret; =20 /* Now we can iterate through the list of strings */ for (i =3D 0; i < n_elements; i++) { found_end =3D 0; - pbegin =3D env_vector[i]; - while(!found_end) { + pbegin =3D (vm_offset_t)env_vector[i]; + while (!found_end) { + if (!VALID_USER_ADDR(pbegin) || + !VALID_USER_ADDR(pbegin + sizeof(env_string))) { + ret =3D EFAULT; + goto done; + } UIO_HELPER(tmp_uio, iov, env_string, sizeof(env_string), 1, - (vm_offset_t) pbegin, iov.iov_len, UIO_SYSSPACE, - UIO_READ, td); + pbegin, iov.iov_len, UIO_SYSSPACE, UIO_READ, td); =20 - ret =3D proc_rwmem(p, &tmp_uio); - if (ret !=3D 0) - return ret; + ret =3D proc_rwmem(p, &tmp_uio); + if (ret !=3D 0) { + ret =3D 0; + goto done; + } =20 - if (!strvalid(env_string, UIO_CHUNK_SZ)) { + if (!strvalid(env_string, UIO_CHUNK_SZ)) { /* - * We didn't find the end of the string + * We didn't find the end of the string. * Add the string to the buffer and move - * the pointer + * the pointer. */ sbuf_bcat(sb, env_string, UIO_CHUNK_SZ); - pbegin =3D &(*pbegin) + UIO_CHUNK_SZ; - } else { + pbegin +=3D UIO_CHUNK_SZ; + } else found_end =3D 1; - } } sbuf_printf(sb, "%s", env_string); } =20 +#undef VALID_USER_ADDR #undef UIO_HELPER =20 - return (0); +done: + free(env_vector, M_TEMP); + return (ret); } =20 static void @@ -1052,9 +1106,11 @@ linprocfs_doprocenviron(PFS_FILL_ARGS) PROC_UNLOCK(p); return ret; } + _PHOLD(p); + PROC_UNLOCK(p); =20 ret =3D linprocfs_doargv(td, p, sb, ps_string_env); - PROC_UNLOCK(p); + PRELE(p); return (ret); } =20 --+Z7/5fzWRHDJ0o7Q Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkycomQACgkQC3+MBN1Mb4gm+wCg5iz9Y7aJiRsIeucwFPQ3D/HC bewAoLN9HnfvWULhs4Vm6a36njMwqkcV =V696 -----END PGP SIGNATURE----- --+Z7/5fzWRHDJ0o7Q-- From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 13:17:36 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E5D3C1065670; Fri, 24 Sep 2010 13:17:35 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id A1E028FC17; Fri, 24 Sep 2010 13:17:35 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 30D6846B35; Fri, 24 Sep 2010 09:17:35 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 326558A03C; Fri, 24 Sep 2010 09:17:34 -0400 (EDT) From: John Baldwin To: Kostik Belousov Date: Fri, 24 Sep 2010 08:34:16 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201009160756.o8G7uZrg065332@svn.freebsd.org> <20100924115311.GH34228@deviant.kiev.zoral.com.ua> In-Reply-To: <20100924115311.GH34228@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201009240834.16786.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Fri, 24 Sep 2010 09:17:34 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, pluknet , src-committers@freebsd.org, Dag-Erling Smorgrav Subject: Re: svn commit: r212723 - head/sys/compat/linprocfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 13:17:36 -0000 On Friday, September 24, 2010 7:53:11 am Kostik Belousov wrote: > On Fri, Sep 24, 2010 at 02:17:29PM +0400, pluknet wrote: > > On 16 September 2010 11:56, Dag-Erling Smorgrav wrote: > > > Author: des > > > Date: Thu Sep 16 07:56:34 2010 > > > New Revision: 212723 > > > URL: http://svn.freebsd.org/changeset/base/212723 > > > > > > Log: > > > Implement proc/$$/environment. > > > > > [...] > > > > > /* > > > * Filler function for proc/pid/environ > > > */ > > > static int > > > linprocfs_doprocenviron(PFS_FILL_ARGS) > > > { > > > + int ret; > > > > > > - sbuf_printf(sb, "doprocenviron\n%c", '\0'); > > > - return (0); > > > + PROC_LOCK(p); > > > > With this change I observe the following sleepable after non-sleepable: > > > > 1st 0xffffff000290b558 process lock (process lock) @ > > /usr/src/sys/modules/linprocfs/../../compat/linprocfs/linprocfs.c:1049 > > 2nd 0xffffff00028f8848 user map (user map) @ /usr/src/sys/vm/vm_map.c:3525 > > KDB: stack backtrace: > > db_trace_self_wrapper() at db_trace_self_wrapper+0x2a > > _witness_debugger() at _witness_debugger+0x2e > > witness_checkorder() at witness_checkorder+0x807 > > _sx_slock() at _sx_slock+0x55 > > vm_map_lookup() at vm_map_lookup+0x55 > > vm_fault() at vm_fault+0x113 > > proc_rwmem() at proc_rwmem+0x7a > > linprocfs_doprocenviron() at linprocfs_doprocenviron+0x122 > > pfs_read() at pfs_read+0x45b > > vn_read() at vn_read+0x256 > > dofileread() at dofileread+0xa1 > > kern_readv() at kern_readv+0x60 > > read() at read+0x55 > > syscallenter() at syscallenter+0x1aa > > syscall() at syscall+0x4c > > Xfast_syscall() at Xfast_syscall+0xe2 > > --- syscall (3, FreeBSD ELF64, read), rip = 0x80074134c, rsp = > > 0x7fffffffe9c8, rbp = 0 --- > > > > > > > + > > > + if ((ret = p_cansee(td, p)) != 0) { > > > + PROC_UNLOCK(p); > > > + return ret; > > > + } > > > + > > > + ret = linprocfs_doargv(td, p, sb, ps_string_env); > > > + PROC_UNLOCK(p); > > > + return (ret); > > > } > > This is easy to fix, isn't it ? But there seems to be much more nits. > > First, allocating 512 * sizeof(char *)-byte object on the stack is not > good. > > Second, the initialization of iov_len for reading the array > of string pointers misses '* sizeof(char *)'. > > And third (probably fatal) is the lack of checks that the end of > array and each string fits into the user portion of the map. I do not > see why addr that already has u_long type is casted to u_long. Also, > VM_MIN_ADDRESS, VM_MAXUSER_ADDRESS constants are for the native host > FreeBSD ABI, they may differ from the target process limits. > > Formatting is separate issue, let postpone it. > > diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c > index c7fe158..fd62b1c 100644 > --- a/sys/compat/linprocfs/linprocfs.c > +++ b/sys/compat/linprocfs/linprocfs.c > @@ -952,12 +952,9 @@ linprocfs_doargv(struct thread *td, struct proc *p, struct sbuf *sb, > struct uio tmp_uio; > struct ps_strings pss; > int ret, i, n_elements, found_end; > - u_long addr; > - char* env_vector[MAX_ARGV_STR]; > + u_long addr, pbegin; > + char **env_vector; > char env_string[UIO_CHUNK_SZ]; > - char *pbegin; > - > - > > #define UIO_HELPER(uio, iov, base, len, cnt, offset, sz, flg, rw, td) \ > do { \ > @@ -971,6 +968,10 @@ do { \ > uio.uio_rw = (rw); \ > uio.uio_td = (td); \ > } while (0) > +#define VALID_USER_ADDR(addr) \ > + ((addr) >= p->p_sysent->sv_minuser && (addr) < p->p_sysent->sv_maxuser) > + > + env_vector = malloc(sizeof(char *) * MAX_ARGV_STR, M_TEMP, M_WAITOK); > > UIO_HELPER(tmp_uio, iov, &pss, sizeof(struct ps_strings), 1, > (off_t)(p->p_sysent->sv_psstrings), sizeof(struct ps_strings), > @@ -978,37 +979,41 @@ do { \ > > ret = proc_rwmem(p, &tmp_uio); > if (ret != 0) > - return ret; > + goto done; > > /* Get the array address and the number of elements */ > resolver(pss, &addr, &n_elements); > > /* Consistent with lib/libkvm/kvm_proc.c */ > - if (n_elements > MAX_ARGV_STR || (u_long)addr < VM_MIN_ADDRESS || > - (u_long)addr >= VM_MAXUSER_ADDRESS) { > - /* What error code should we return? */ > - return 0; > + if (n_elements > MAX_ARGV_STR || !VALID_USER_ADDR(addr) || > + !VALID_USER_ADDR(addr + MAX_ARGV_STR * sizeof(char *))) { > + ret = EFAULT; > + goto done; > } > > - UIO_HELPER(tmp_uio, iov, env_vector, MAX_ARGV_STR, 1, > + UIO_HELPER(tmp_uio, iov, env_vector, MAX_ARGV_STR * sizeof(char *), 1, > (vm_offset_t)(addr), iov.iov_len, UIO_SYSSPACE, UIO_READ, td); > > ret = proc_rwmem(p, &tmp_uio); > if (ret != 0) > - return ret; > + goto done; > > /* Now we can iterate through the list of strings */ > for (i = 0; i < n_elements; i++) { > found_end = 0; > - pbegin = env_vector[i]; > - while(!found_end) { > + pbegin = (vm_offset_t)env_vector[i]; > + while (!found_end) { > + if (!VALID_USER_ADDR(pbegin) || > + !VALID_USER_ADDR(pbegin + sizeof(env_string))) { > + ret = EFAULT; > + goto done; > + } > UIO_HELPER(tmp_uio, iov, env_string, sizeof(env_string), 1, > - (vm_offset_t) pbegin, iov.iov_len, UIO_SYSSPACE, > - UIO_READ, td); > + pbegin, iov.iov_len, UIO_SYSSPACE, UIO_READ, td); > > ret = proc_rwmem(p, &tmp_uio); > if (ret != 0) > - return ret; > + goto done; > > if (!strvalid(env_string, UIO_CHUNK_SZ)) { > /* > @@ -1017,7 +1022,7 @@ do { \ > * the pointer > */ > sbuf_bcat(sb, env_string, UIO_CHUNK_SZ); > - pbegin = &(*pbegin) + UIO_CHUNK_SZ; > + pbegin += UIO_CHUNK_SZ; > } else { > found_end = 1; > } > @@ -1025,9 +1030,12 @@ do { \ > sbuf_printf(sb, "%s", env_string); > } > > +#undef VALID_USER_ADDR > #undef UIO_HELPER > > - return (0); > +done: > + free(env_vector, M_TEMP); > + return (ret); > } > > static void > @@ -1052,9 +1060,11 @@ linprocfs_doprocenviron(PFS_FILL_ARGS) > PROC_UNLOCK(p); > return ret; > } > + _PHOLD(p); > + PROC_UNLOCK(p); > > ret = linprocfs_doargv(td, p, sb, ps_string_env); > - PROC_UNLOCK(p); > + PRELE(p); > return (ret); > } You need to add a P_WEXIT check here. _PHOLD() / PRELE() do not work once P_WEXIT is set (rather, exit1() may not notice and wait for a _PHOLD() invoked to drain once P_WEXIT is set). -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 13:28:52 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2C144106566B; Fri, 24 Sep 2010 13:28:52 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id DC2758FC1C; Fri, 24 Sep 2010 13:28:51 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 61DD946B64; Fri, 24 Sep 2010 09:28:51 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 570468A03C; Fri, 24 Sep 2010 09:28:50 -0400 (EDT) From: John Baldwin To: Ken Smith Date: Fri, 24 Sep 2010 09:23:04 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <20100922222441.00002f27@unknown> <20100923.203143.19192035494300157.imp@bsdimp.com> <1285297884.17619.17.camel@neo.cse.buffalo.edu> In-Reply-To: <1285297884.17619.17.camel@neo.cse.buffalo.edu> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201009240923.04406.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Fri, 24 Sep 2010 09:28:50 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: bruce@cran.org.uk, src-committers@freebsd.org, svn-src-all@freebsd.org, avg@freebsd.org, gavin@freebsd.org, svn-src-head@freebsd.org, "M. Warner Losh" Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 13:28:52 -0000 On Thursday, September 23, 2010 11:11:24 pm Ken Smith wrote: > On Thu, 2010-09-23 at 20:31 -0600, M. Warner Losh wrote: > > In message: > > Gavin Atkinson writes: > > : On Thu, 23 Sep 2010, Ken Smith wrote: > > : > The issues talked about so far all contribute to the reason for that. > > : > But one of the more basic gut reactions to it all is that the users > > : > want to be interested in helping with the debugging (even if just > > : > providing the requested info) for any sort of crash information > > : > to be useful. And at the point we shift something from -current > > : > to -stable the percentage of people actively interested in participating > > : > in that sort of stuff flip. The bulk of people using -current > > : > know it's risky and they do it out of some interest in debugging > > : > stuff. The *bulk* of people using -stable are less interested or > > : > flat out not interested. And have no clue what crash dumps are, > > : > may be challenged to notice partition-getting-full issues, etc. > > : > > : I'm not sure I buy this argument, I'm afraid. Part of the advantage of > > : having all this done automatically on the as-shipped release media is that > > : end users don't have to be interested in debugging - crashinfo(8) does > > : most of the work for them. There's no easy way to actually determine > > : figures, but even if say only 10-15% of crashes can be diagnosed and > > : corrected just from the output of crashinfo(8) then that's a huge win for > > : the project as a whole. I'm guessing 10-15% is not unrealistic. > > : > > : I appreciate the issue about filling partitions is a valid one. Would a > > : possible compromise be that on release media, crashinfo(8) or similar will > > : default to only keeping the most recent coredump or similar? Given /var > > : now defaults to 4GB, Defaulting to keeping a single core is probably > > : acceptable. > > > > Furthermore, if we aren't interested in crash dumps by default, why do > > we install the huge .symbols files? > > > > Warner > > > > Because disks are big and (again, just trying to explain my > understanding of what I inherited) we want all the support > to be in place, just not turned on. There is a difference > between "You can give us much better information by doing > .symbols goo> and then making a one-line change to rc.conf" > versus "You can give us much better information by making > a one-line change to rc.conf". The biggest argument against this (and the reason I always enable crashdumps on all machines I am involved with) is that many panics are not easily reproducible, esp. ones that trigger under load. If dumpdev is not on by default, then the info from a rare or hard-to-trigger bug may simply be lost. Also, "just send-pr or mail the 'foo' file" is even simpler than "enable this knob in rc.conf and reproduce your issue, then come back". > This is definitely one I don't have a strong enough opinion > on to fight over, I sympathize with both sides. If the > general consensus is mostly towards changing so be it. > I've got no way to tell what percentage of users would > have any clue what to do with the crash info versus users > who would be negatively impacted simply by the fact their > systems are generating stuff they're completely ignorant > of and will never touch. Well, if we turn it on we should document it clearly. Folks are already interested in asking for help once a machine panics, and if the reply to a query on questions@ can say "please go look for a file named 'foo' and e-mail it somewhere or send-pr it", that is far simpler than having to enable dumps and reproduce the panic. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 13:32:20 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9513F106564A; Fri, 24 Sep 2010 13:32:20 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id EA5408FC12; Fri, 24 Sep 2010 13:32:19 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id o8ODWFG6000316 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 24 Sep 2010 16:32:15 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id o8ODWFmi041014; Fri, 24 Sep 2010 16:32:15 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id o8ODWFCa041013; Fri, 24 Sep 2010 16:32:15 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 24 Sep 2010 16:32:15 +0300 From: Kostik Belousov To: John Baldwin Message-ID: <20100924133215.GL34228@deviant.kiev.zoral.com.ua> References: <201009160756.o8G7uZrg065332@svn.freebsd.org> <20100924115311.GH34228@deviant.kiev.zoral.com.ua> <201009240834.16786.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="uwB7x3tnyrZQfZJI" Content-Disposition: inline In-Reply-To: <201009240834.16786.jhb@freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, pluknet , src-committers@freebsd.org, Dag-Erling Smorgrav Subject: Re: svn commit: r212723 - head/sys/compat/linprocfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 13:32:20 -0000 --uwB7x3tnyrZQfZJI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Sep 24, 2010 at 08:34:16AM -0400, John Baldwin wrote: > On Friday, September 24, 2010 7:53:11 am Kostik Belousov wrote: > > On Fri, Sep 24, 2010 at 02:17:29PM +0400, pluknet wrote: > > > On 16 September 2010 11:56, Dag-Erling Smorgrav wro= te: > > > > Author: des > > > > Date: Thu Sep 16 07:56:34 2010 > > > > New Revision: 212723 > > > > URL: http://svn.freebsd.org/changeset/base/212723 > > > > > > > > Log: > > > > Implement proc/$$/environment. > > > > > > > [...] > > >=20 > > > > /* > > > > * Filler function for proc/pid/environ > > > > */ > > > > static int > > > > linprocfs_doprocenviron(PFS_FILL_ARGS) > > > > { > > > > + int ret; > > > > > > > > - sbuf_printf(sb, "doprocenviron\n%c", '\0'); > > > > - return (0); > > > > + PROC_LOCK(p); > > >=20 > > > With this change I observe the following sleepable after non-sleepabl= e: > > >=20 > > > 1st 0xffffff000290b558 process lock (process lock) @ > > > /usr/src/sys/modules/linprocfs/../../compat/linprocfs/linprocfs.c:1049 > > > 2nd 0xffffff00028f8848 user map (user map) @=20 > /usr/src/sys/vm/vm_map.c:3525 > > > KDB: stack backtrace: > > > db_trace_self_wrapper() at db_trace_self_wrapper+0x2a > > > _witness_debugger() at _witness_debugger+0x2e > > > witness_checkorder() at witness_checkorder+0x807 > > > _sx_slock() at _sx_slock+0x55 > > > vm_map_lookup() at vm_map_lookup+0x55 > > > vm_fault() at vm_fault+0x113 > > > proc_rwmem() at proc_rwmem+0x7a > > > linprocfs_doprocenviron() at linprocfs_doprocenviron+0x122 > > > pfs_read() at pfs_read+0x45b > > > vn_read() at vn_read+0x256 > > > dofileread() at dofileread+0xa1 > > > kern_readv() at kern_readv+0x60 > > > read() at read+0x55 > > > syscallenter() at syscallenter+0x1aa > > > syscall() at syscall+0x4c > > > Xfast_syscall() at Xfast_syscall+0xe2 > > > --- syscall (3, FreeBSD ELF64, read), rip =3D 0x80074134c, rsp =3D > > > 0x7fffffffe9c8, rbp =3D 0 --- > > >=20 > > >=20 > > > > + > > > > + if ((ret =3D p_cansee(td, p)) !=3D 0) { > > > > + PROC_UNLOCK(p); > > > > + return ret; > > > > + } > > > > + > > > > + ret =3D linprocfs_doargv(td, p, sb, ps_string_env); > > > > + PROC_UNLOCK(p); > > > > + return (ret); > > > > } > >=20 > > This is easy to fix, isn't it ? But there seems to be much more nits. > >=20 > > First, allocating 512 * sizeof(char *)-byte object on the stack is not > > good. > >=20 > > Second, the initialization of iov_len for reading the array > > of string pointers misses '* sizeof(char *)'. > >=20 > > And third (probably fatal) is the lack of checks that the end of > > array and each string fits into the user portion of the map. I do not > > see why addr that already has u_long type is casted to u_long. Also, > > VM_MIN_ADDRESS, VM_MAXUSER_ADDRESS constants are for the native host > > FreeBSD ABI, they may differ from the target process limits. > >=20 > > Formatting is separate issue, let postpone it. > >=20 > > diff --git a/sys/compat/linprocfs/linprocfs.c=20 > b/sys/compat/linprocfs/linprocfs.c > > index c7fe158..fd62b1c 100644 > > --- a/sys/compat/linprocfs/linprocfs.c > > +++ b/sys/compat/linprocfs/linprocfs.c > > @@ -952,12 +952,9 @@ linprocfs_doargv(struct thread *td, struct proc *p= ,=20 > struct sbuf *sb, > > struct uio tmp_uio; > > struct ps_strings pss; > > int ret, i, n_elements, found_end; > > - u_long addr; > > - char* env_vector[MAX_ARGV_STR]; > > + u_long addr, pbegin; > > + char **env_vector; > > char env_string[UIO_CHUNK_SZ]; > > - char *pbegin; > > - > > - > > =20 > > #define UIO_HELPER(uio, iov, base, len, cnt, offset, sz, flg, rw, td) \ > > do { \ > > @@ -971,6 +968,10 @@ do { \ > > uio.uio_rw =3D (rw); \ > > uio.uio_td =3D (td); \ > > } while (0) > > +#define VALID_USER_ADDR(addr) \ > > + ((addr) >=3D p->p_sysent->sv_minuser && (addr) < p->p_sysent->sv_maxu= ser) > > + > > + env_vector =3D malloc(sizeof(char *) * MAX_ARGV_STR, M_TEMP, M_WAITOK= ); > > =20 > > UIO_HELPER(tmp_uio, iov, &pss, sizeof(struct ps_strings), 1, > > (off_t)(p->p_sysent->sv_psstrings), sizeof(struct ps_strings), > > @@ -978,37 +979,41 @@ do { \ > > =20 > > ret =3D proc_rwmem(p, &tmp_uio); > > if (ret !=3D 0) > > - return ret; > > + goto done; > > =20 > > /* Get the array address and the number of elements */ > > resolver(pss, &addr, &n_elements); > > =20 > > /* Consistent with lib/libkvm/kvm_proc.c */ > > - if (n_elements > MAX_ARGV_STR || (u_long)addr < VM_MIN_ADDRESS || > > - (u_long)addr >=3D VM_MAXUSER_ADDRESS) { > > - /* What error code should we return? */ > > - return 0; > > + if (n_elements > MAX_ARGV_STR || !VALID_USER_ADDR(addr) || > > + !VALID_USER_ADDR(addr + MAX_ARGV_STR * sizeof(char *))) { > > + ret =3D EFAULT; > > + goto done; > > } > > =20 > > - UIO_HELPER(tmp_uio, iov, env_vector, MAX_ARGV_STR, 1, > > + UIO_HELPER(tmp_uio, iov, env_vector, MAX_ARGV_STR * sizeof(char *), = 1, > > (vm_offset_t)(addr), iov.iov_len, UIO_SYSSPACE, UIO_READ, td); > > =20 > > ret =3D proc_rwmem(p, &tmp_uio); > > if (ret !=3D 0) > > - return ret; > > + goto done; > > =20 > > /* Now we can iterate through the list of strings */ > > for (i =3D 0; i < n_elements; i++) { > > found_end =3D 0; > > - pbegin =3D env_vector[i]; > > - while(!found_end) { > > + pbegin =3D (vm_offset_t)env_vector[i]; > > + while (!found_end) { > > + if (!VALID_USER_ADDR(pbegin) || > > + !VALID_USER_ADDR(pbegin + sizeof(env_string))) { > > + ret =3D EFAULT; > > + goto done; > > + } > > UIO_HELPER(tmp_uio, iov, env_string, sizeof(env_string), 1, > > - (vm_offset_t) pbegin, iov.iov_len, UIO_SYSSPACE, > > - UIO_READ, td); > > + pbegin, iov.iov_len, UIO_SYSSPACE, UIO_READ, td); > > =20 > > ret =3D proc_rwmem(p, &tmp_uio); > > if (ret !=3D 0) > > - return ret; > > + goto done; > > =20 > > if (!strvalid(env_string, UIO_CHUNK_SZ)) { > > /* > > @@ -1017,7 +1022,7 @@ do { \ > > * the pointer > > */ > > sbuf_bcat(sb, env_string, UIO_CHUNK_SZ); > > - pbegin =3D &(*pbegin) + UIO_CHUNK_SZ; > > + pbegin +=3D UIO_CHUNK_SZ; > > } else { > > found_end =3D 1; > > } > > @@ -1025,9 +1030,12 @@ do { \ > > sbuf_printf(sb, "%s", env_string); > > } > > =20 > > +#undef VALID_USER_ADDR > > #undef UIO_HELPER > > =20 > > - return (0); > > +done: > > + free(env_vector, M_TEMP); > > + return (ret); > > } > > =20 > > static void > > @@ -1052,9 +1060,11 @@ linprocfs_doprocenviron(PFS_FILL_ARGS) > > PROC_UNLOCK(p); > > return ret; > > } > > + _PHOLD(p); > > + PROC_UNLOCK(p); > > =20 > > ret =3D linprocfs_doargv(td, p, sb, ps_string_env); > > - PROC_UNLOCK(p); > > + PRELE(p); > > return (ret); > > } >=20 > You need to add a P_WEXIT check here. _PHOLD() / PRELE() do not work > once P_WEXIT is set (rather, exit1() may not notice and wait for a > _PHOLD() invoked to drain once P_WEXIT is set). Hmm, I think that PHOLD is not needed there, actually. Pseudofs checks for exiting process in pfs_visible(_proc). Before the fill method is called, process is held and unlocked. So my second _PHOLD could be removed. --uwB7x3tnyrZQfZJI Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkycqF4ACgkQC3+MBN1Mb4hZ1QCg40GXfKjzG0XjEh3fpgnA7jfx nZsAoLHvgP7PAIIt+Zlyk5pURRuALy0K =mp+o -----END PGP SIGNATURE----- --uwB7x3tnyrZQfZJI-- From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 14:25:28 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 936B5106564A; Fri, 24 Sep 2010 14:25:28 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 365AA8FC19; Fri, 24 Sep 2010 14:25:28 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 98EB146B0D; Fri, 24 Sep 2010 10:25:27 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id E4D228A03C; Fri, 24 Sep 2010 10:25:23 -0400 (EDT) From: John Baldwin To: Kostik Belousov Date: Fri, 24 Sep 2010 10:25:11 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201009160756.o8G7uZrg065332@svn.freebsd.org> <201009240834.16786.jhb@freebsd.org> <20100924133215.GL34228@deviant.kiev.zoral.com.ua> In-Reply-To: <20100924133215.GL34228@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201009241025.11877.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Fri, 24 Sep 2010 10:25:25 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, pluknet , src-committers@freebsd.org, Dag-Erling Smorgrav Subject: Re: svn commit: r212723 - head/sys/compat/linprocfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 14:25:28 -0000 On Friday, September 24, 2010 9:32:15 am Kostik Belousov wrote: > On Fri, Sep 24, 2010 at 08:34:16AM -0400, John Baldwin wrote: > > On Friday, September 24, 2010 7:53:11 am Kostik Belousov wrote: > > > On Fri, Sep 24, 2010 at 02:17:29PM +0400, pluknet wrote: > > > > On 16 September 2010 11:56, Dag-Erling Smorgrav wrote: > > > > > Author: des > > > > > Date: Thu Sep 16 07:56:34 2010 > > > > > New Revision: 212723 > > > > > URL: http://svn.freebsd.org/changeset/base/212723 > > > > > > > > > > Log: > > > > > Implement proc/$$/environment. > > > > > > > > > [...] > > > > > > > > > /* > > > > > * Filler function for proc/pid/environ > > > > > */ > > > > > static int > > > > > linprocfs_doprocenviron(PFS_FILL_ARGS) > > > > > { > > > > > + int ret; > > > > > > > > > > - sbuf_printf(sb, "doprocenviron\n%c", '\0'); > > > > > - return (0); > > > > > + PROC_LOCK(p); > > > > > > > > With this change I observe the following sleepable after non- sleepable: > > > > > > > > 1st 0xffffff000290b558 process lock (process lock) @ > > > > /usr/src/sys/modules/linprocfs/../../compat/linprocfs/linprocfs.c:1049 > > > > 2nd 0xffffff00028f8848 user map (user map) @ > > /usr/src/sys/vm/vm_map.c:3525 > > > > KDB: stack backtrace: > > > > db_trace_self_wrapper() at db_trace_self_wrapper+0x2a > > > > _witness_debugger() at _witness_debugger+0x2e > > > > witness_checkorder() at witness_checkorder+0x807 > > > > _sx_slock() at _sx_slock+0x55 > > > > vm_map_lookup() at vm_map_lookup+0x55 > > > > vm_fault() at vm_fault+0x113 > > > > proc_rwmem() at proc_rwmem+0x7a > > > > linprocfs_doprocenviron() at linprocfs_doprocenviron+0x122 > > > > pfs_read() at pfs_read+0x45b > > > > vn_read() at vn_read+0x256 > > > > dofileread() at dofileread+0xa1 > > > > kern_readv() at kern_readv+0x60 > > > > read() at read+0x55 > > > > syscallenter() at syscallenter+0x1aa > > > > syscall() at syscall+0x4c > > > > Xfast_syscall() at Xfast_syscall+0xe2 > > > > --- syscall (3, FreeBSD ELF64, read), rip = 0x80074134c, rsp = > > > > 0x7fffffffe9c8, rbp = 0 --- > > > > > > > > > > > > > + > > > > > + if ((ret = p_cansee(td, p)) != 0) { > > > > > + PROC_UNLOCK(p); > > > > > + return ret; > > > > > + } > > > > > + > > > > > + ret = linprocfs_doargv(td, p, sb, ps_string_env); > > > > > + PROC_UNLOCK(p); > > > > > + return (ret); > > > > > } > > > > > > This is easy to fix, isn't it ? But there seems to be much more nits. > > > > > > First, allocating 512 * sizeof(char *)-byte object on the stack is not > > > good. > > > > > > Second, the initialization of iov_len for reading the array > > > of string pointers misses '* sizeof(char *)'. > > > > > > And third (probably fatal) is the lack of checks that the end of > > > array and each string fits into the user portion of the map. I do not > > > see why addr that already has u_long type is casted to u_long. Also, > > > VM_MIN_ADDRESS, VM_MAXUSER_ADDRESS constants are for the native host > > > FreeBSD ABI, they may differ from the target process limits. > > > > > > Formatting is separate issue, let postpone it. > > > > > > diff --git a/sys/compat/linprocfs/linprocfs.c > > b/sys/compat/linprocfs/linprocfs.c > > > index c7fe158..fd62b1c 100644 > > > --- a/sys/compat/linprocfs/linprocfs.c > > > +++ b/sys/compat/linprocfs/linprocfs.c > > > @@ -952,12 +952,9 @@ linprocfs_doargv(struct thread *td, struct proc *p, > > struct sbuf *sb, > > > struct uio tmp_uio; > > > struct ps_strings pss; > > > int ret, i, n_elements, found_end; > > > - u_long addr; > > > - char* env_vector[MAX_ARGV_STR]; > > > + u_long addr, pbegin; > > > + char **env_vector; > > > char env_string[UIO_CHUNK_SZ]; > > > - char *pbegin; > > > - > > > - > > > > > > #define UIO_HELPER(uio, iov, base, len, cnt, offset, sz, flg, rw, td) \ > > > do { \ > > > @@ -971,6 +968,10 @@ do { \ > > > uio.uio_rw = (rw); \ > > > uio.uio_td = (td); \ > > > } while (0) > > > +#define VALID_USER_ADDR(addr) \ > > > + ((addr) >= p->p_sysent->sv_minuser && (addr) < p->p_sysent- >sv_maxuser) > > > + > > > + env_vector = malloc(sizeof(char *) * MAX_ARGV_STR, M_TEMP, M_WAITOK); > > > > > > UIO_HELPER(tmp_uio, iov, &pss, sizeof(struct ps_strings), 1, > > > (off_t)(p->p_sysent->sv_psstrings), sizeof(struct ps_strings), > > > @@ -978,37 +979,41 @@ do { \ > > > > > > ret = proc_rwmem(p, &tmp_uio); > > > if (ret != 0) > > > - return ret; > > > + goto done; > > > > > > /* Get the array address and the number of elements */ > > > resolver(pss, &addr, &n_elements); > > > > > > /* Consistent with lib/libkvm/kvm_proc.c */ > > > - if (n_elements > MAX_ARGV_STR || (u_long)addr < VM_MIN_ADDRESS || > > > - (u_long)addr >= VM_MAXUSER_ADDRESS) { > > > - /* What error code should we return? */ > > > - return 0; > > > + if (n_elements > MAX_ARGV_STR || !VALID_USER_ADDR(addr) || > > > + !VALID_USER_ADDR(addr + MAX_ARGV_STR * sizeof(char *))) { > > > + ret = EFAULT; > > > + goto done; > > > } > > > > > > - UIO_HELPER(tmp_uio, iov, env_vector, MAX_ARGV_STR, 1, > > > + UIO_HELPER(tmp_uio, iov, env_vector, MAX_ARGV_STR * sizeof(char *), 1, > > > (vm_offset_t)(addr), iov.iov_len, UIO_SYSSPACE, UIO_READ, td); > > > > > > ret = proc_rwmem(p, &tmp_uio); > > > if (ret != 0) > > > - return ret; > > > + goto done; > > > > > > /* Now we can iterate through the list of strings */ > > > for (i = 0; i < n_elements; i++) { > > > found_end = 0; > > > - pbegin = env_vector[i]; > > > - while(!found_end) { > > > + pbegin = (vm_offset_t)env_vector[i]; > > > + while (!found_end) { > > > + if (!VALID_USER_ADDR(pbegin) || > > > + !VALID_USER_ADDR(pbegin + sizeof(env_string))) { > > > + ret = EFAULT; > > > + goto done; > > > + } > > > UIO_HELPER(tmp_uio, iov, env_string, sizeof(env_string), 1, > > > - (vm_offset_t) pbegin, iov.iov_len, UIO_SYSSPACE, > > > - UIO_READ, td); > > > + pbegin, iov.iov_len, UIO_SYSSPACE, UIO_READ, td); > > > > > > ret = proc_rwmem(p, &tmp_uio); > > > if (ret != 0) > > > - return ret; > > > + goto done; > > > > > > if (!strvalid(env_string, UIO_CHUNK_SZ)) { > > > /* > > > @@ -1017,7 +1022,7 @@ do { \ > > > * the pointer > > > */ > > > sbuf_bcat(sb, env_string, UIO_CHUNK_SZ); > > > - pbegin = &(*pbegin) + UIO_CHUNK_SZ; > > > + pbegin += UIO_CHUNK_SZ; > > > } else { > > > found_end = 1; > > > } > > > @@ -1025,9 +1030,12 @@ do { \ > > > sbuf_printf(sb, "%s", env_string); > > > } > > > > > > +#undef VALID_USER_ADDR > > > #undef UIO_HELPER > > > > > > - return (0); > > > +done: > > > + free(env_vector, M_TEMP); > > > + return (ret); > > > } > > > > > > static void > > > @@ -1052,9 +1060,11 @@ linprocfs_doprocenviron(PFS_FILL_ARGS) > > > PROC_UNLOCK(p); > > > return ret; > > > } > > > + _PHOLD(p); > > > + PROC_UNLOCK(p); > > > > > > ret = linprocfs_doargv(td, p, sb, ps_string_env); > > > - PROC_UNLOCK(p); > > > + PRELE(p); > > > return (ret); > > > } > > > > You need to add a P_WEXIT check here. _PHOLD() / PRELE() do not work > > once P_WEXIT is set (rather, exit1() may not notice and wait for a > > _PHOLD() invoked to drain once P_WEXIT is set). > > Hmm, I think that PHOLD is not needed there, actually. Pseudofs > checks for exiting process in pfs_visible(_proc). Before the fill > method is called, process is held and unlocked. So my second _PHOLD > could be removed. Yes, I think that is true. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 14:38:54 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C4383106566C; Fri, 24 Sep 2010 14:38:54 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B2EAE8FC14; Fri, 24 Sep 2010 14:38:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OEcs06027432; Fri, 24 Sep 2010 14:38:54 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OEcsvR027429; Fri, 24 Sep 2010 14:38:54 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201009241438.o8OEcsvR027429@svn.freebsd.org> From: Attilio Rao Date: Fri, 24 Sep 2010 14:38:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213101 - in head/sys: netinet netinet6 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 14:38:54 -0000 Author: attilio Date: Fri Sep 24 14:38:54 2010 New Revision: 213101 URL: http://svn.freebsd.org/changeset/base/213101 Log: IP_BINDANY is not correctly handled in getsockopt() case. Fix it by specifying the correct bits. Sponsored by: Sandvine Incorporated Reviewed by: bz, emaste, rstone Obtained from: Sandvine Incorporated MFC after: 10 days Modified: head/sys/netinet/ip_output.c head/sys/netinet6/ip6_output.c Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Fri Sep 24 13:01:01 2010 (r213100) +++ head/sys/netinet/ip_output.c Fri Sep 24 14:38:54 2010 (r213101) @@ -1121,6 +1121,7 @@ ip_ctloutput(struct socket *so, struct s case IP_FAITH: case IP_ONESBCAST: case IP_DONTFRAG: + case IP_BINDANY: switch (sopt->sopt_name) { case IP_TOS: @@ -1176,6 +1177,9 @@ ip_ctloutput(struct socket *so, struct s case IP_DONTFRAG: optval = OPTBIT(INP_DONTFRAG); break; + case IP_BINDANY: + optval = OPTBIT(INP_BINDANY); + break; } error = sooptcopyout(sopt, &optval, sizeof optval); break; Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Fri Sep 24 13:01:01 2010 (r213100) +++ head/sys/netinet6/ip6_output.c Fri Sep 24 14:38:54 2010 (r213101) @@ -1823,6 +1823,7 @@ do { \ case IPV6_PORTRANGE: case IPV6_RECVTCLASS: case IPV6_AUTOFLOWLABEL: + case IPV6_BINDANY: switch (optname) { case IPV6_RECVHOPOPTS: From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 14:44:05 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 34C0A1065672; Fri, 24 Sep 2010 14:44:05 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 23E1A8FC0C; Fri, 24 Sep 2010 14:44:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OEi5Mq027881; Fri, 24 Sep 2010 14:44:05 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OEi5hs027879; Fri, 24 Sep 2010 14:44:05 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009241444.o8OEi5hs027879@svn.freebsd.org> From: Marius Strobl Date: Fri, 24 Sep 2010 14:44:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213102 - head/libexec/tftpd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 14:44:05 -0000 Author: marius Date: Fri Sep 24 14:44:04 2010 New Revision: 213102 URL: http://svn.freebsd.org/changeset/base/213102 Log: Remove the duplicate logging of failed read requests, whose error message also was inappropriate as it triggered for every EACCESS and ENOTFOUND, not just the case the -n option is intended to deal with and thus really spammed us with ~20 messages in the default configuration when booting a diskless FreeBSD client, introduced with r207608 again. MFC after: 1 week Modified: head/libexec/tftpd/tftpd.c Modified: head/libexec/tftpd/tftpd.c ============================================================================== --- head/libexec/tftpd/tftpd.c Fri Sep 24 14:38:54 2010 (r213101) +++ head/libexec/tftpd/tftpd.c Fri Sep 24 14:44:04 2010 (r213102) @@ -604,7 +604,6 @@ tftp_rrq(int peer, char *recvbuffer, ssi */ if (suppress_naks && *filename != '/' && ecode == ENOTFOUND) exit(0); - tftp_log(LOG_ERR, "Prevent NAK storm"); send_error(peer, ecode); exit(1); } From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 15:01:45 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A7056106564A; Fri, 24 Sep 2010 15:01:45 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 942F38FC24; Fri, 24 Sep 2010 15:01:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OF1jlM029019; Fri, 24 Sep 2010 15:01:45 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OF1jjG029010; Fri, 24 Sep 2010 15:01:45 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201009241501.o8OF1jjG029010@svn.freebsd.org> From: Attilio Rao Date: Fri, 24 Sep 2010 15:01:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213103 - in head/sys: conf libkern modules/krpc netinet nlm rpc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 15:01:45 -0000 Author: attilio Date: Fri Sep 24 15:01:45 2010 New Revision: 213103 URL: http://svn.freebsd.org/changeset/base/213103 Log: Make the RPC specific __rpc_inet_ntop() and __rpc_inet_pton() general in the kernel (just as inet_ntoa() and inet_aton()) are and sync their prototype accordingly with already mentioned functions. Sponsored by: Sandvine Incorporated Reviewed by: emaste, rstone Approved by: dfr MFC after: 2 weeks Added: head/sys/libkern/inet_ntop.c - copied, changed from r213102, head/sys/rpc/inet_ntop.c head/sys/libkern/inet_pton.c - copied, changed from r213102, head/sys/rpc/inet_pton.c Deleted: head/sys/rpc/inet_ntop.c head/sys/rpc/inet_pton.c Modified: head/sys/conf/files head/sys/modules/krpc/Makefile head/sys/netinet/in.h head/sys/nlm/nlm_prot_impl.c head/sys/rpc/rpc_com.h head/sys/rpc/rpc_generic.c Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Fri Sep 24 14:44:04 2010 (r213102) +++ head/sys/conf/files Fri Sep 24 15:01:45 2010 (r213103) @@ -2328,6 +2328,8 @@ libkern/iconv_xlat16.c optional libicon libkern/index.c standard libkern/inet_aton.c standard libkern/inet_ntoa.c standard +libkern/inet_ntop.c standard +libkern/inet_pton.c standard libkern/mcount.c optional profiling-routine libkern/memcmp.c standard libkern/qsort.c standard @@ -2735,8 +2737,6 @@ rpc/clnt_dg.c optional krpc | nfslockd rpc/clnt_rc.c optional krpc | nfslockd | nfsclient | nfscl | nfsd rpc/clnt_vc.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd rpc/getnetconfig.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd -rpc/inet_ntop.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd -rpc/inet_pton.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd rpc/replay.c optional krpc | nfslockd | nfsserver | nfscl | nfsd rpc/rpc_callmsg.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd rpc/rpc_generic.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd Copied and modified: head/sys/libkern/inet_ntop.c (from r213102, head/sys/rpc/inet_ntop.c) ============================================================================== --- head/sys/rpc/inet_ntop.c Fri Sep 24 14:44:04 2010 (r213102, copy source) +++ head/sys/libkern/inet_ntop.c Fri Sep 24 15:01:45 2010 (r213103) @@ -22,20 +22,18 @@ static const char rcsid[] = "$Id: inet_n __FBSDID("$FreeBSD$"); #include -#include #include #include -#include -#include +#include /*% * WARNING: Don't even consider trying to compile this on a system where * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX. */ -static const char *inet_ntop4(const u_char *src, char *dst, socklen_t size); -static const char *inet_ntop6(const u_char *src, char *dst, socklen_t size); +static char *inet_ntop4(const u_char *src, char *dst, socklen_t size); +static char *inet_ntop6(const u_char *src, char *dst, socklen_t size); /* char * * inet_ntop(af, src, dst, size) @@ -45,9 +43,8 @@ static const char *inet_ntop6(const u_ch * author: * Paul Vixie, 1996. */ -const char * -__rpc_inet_ntop(int af, const void * __restrict src, char * __restrict dst, - socklen_t size) +char * +inet_ntop(int af, const void *src, char *dst, socklen_t size) { switch (af) { case AF_INET: @@ -71,7 +68,7 @@ __rpc_inet_ntop(int af, const void * __r * author: * Paul Vixie, 1996. */ -static const char * +static char * inet_ntop4(const u_char *src, char *dst, socklen_t size) { static const char fmt[] = "%u.%u.%u.%u"; @@ -92,7 +89,7 @@ inet_ntop4(const u_char *src, char *dst, * author: * Paul Vixie, 1996. */ -static const char * +static char * inet_ntop6(const u_char *src, char *dst, socklen_t size) { /* Copied and modified: head/sys/libkern/inet_pton.c (from r213102, head/sys/rpc/inet_pton.c) ============================================================================== --- head/sys/rpc/inet_pton.c Fri Sep 24 14:44:04 2010 (r213102, copy source) +++ head/sys/libkern/inet_pton.c Fri Sep 24 15:01:45 2010 (r213103) @@ -22,12 +22,10 @@ static const char rcsid[] = "$Id: inet_p __FBSDID("$FreeBSD$"); #include -#include #include #include -#include -#include +#include #if __FreeBSD_version < 700000 #define strchr index @@ -53,7 +51,7 @@ static int inet_pton6(const char *src, u * Paul Vixie, 1996. */ int -__rpc_inet_pton(int af, const char * __restrict src, void * __restrict dst) +inet_pton(int af, const char *src, void *dst) { switch (af) { case AF_INET: Modified: head/sys/modules/krpc/Makefile ============================================================================== --- head/sys/modules/krpc/Makefile Fri Sep 24 14:44:04 2010 (r213102) +++ head/sys/modules/krpc/Makefile Fri Sep 24 15:01:45 2010 (r213103) @@ -9,8 +9,6 @@ SRCS= auth_none.c \ clnt_rc.c \ clnt_vc.c \ getnetconfig.c \ - inet_ntop.c \ - inet_pton.c \ rpc_callmsg.c \ rpc_generic.c \ rpc_prot.c \ Modified: head/sys/netinet/in.h ============================================================================== --- head/sys/netinet/in.h Fri Sep 24 14:44:04 2010 (r213102) +++ head/sys/netinet/in.h Fri Sep 24 15:01:45 2010 (r213103) @@ -726,6 +726,8 @@ int in_localip(struct in_addr); int inet_aton(const char *, struct in_addr *); /* in libkern */ char *inet_ntoa(struct in_addr); /* in libkern */ char *inet_ntoa_r(struct in_addr ina, char *buf); /* in libkern */ +char *inet_ntop(int, const void *, char *, socklen_t); /* in libkern */ +int inet_pton(int af, const char *, void *); /* in libkern */ void in_ifdetach(struct ifnet *); #define in_hosteq(s, t) ((s).s_addr == (t).s_addr) Modified: head/sys/nlm/nlm_prot_impl.c ============================================================================== --- head/sys/nlm/nlm_prot_impl.c Fri Sep 24 14:44:04 2010 (r213102) +++ head/sys/nlm/nlm_prot_impl.c Fri Sep 24 15:01:45 2010 (r213103) @@ -1055,13 +1055,13 @@ nlm_find_host_by_addr(const struct socka switch (addr->sa_family) { case AF_INET: - __rpc_inet_ntop(AF_INET, + inet_ntop(AF_INET, &((const struct sockaddr_in *) addr)->sin_addr, tmp, sizeof tmp); break; #ifdef INET6 case AF_INET6: - __rpc_inet_ntop(AF_INET6, + inet_ntop(AF_INET6, &((const struct sockaddr_in6 *) addr)->sin6_addr, tmp, sizeof tmp); break; Modified: head/sys/rpc/rpc_com.h ============================================================================== --- head/sys/rpc/rpc_com.h Fri Sep 24 14:44:04 2010 (r213102) +++ head/sys/rpc/rpc_com.h Fri Sep 24 15:01:45 2010 (r213103) @@ -111,10 +111,6 @@ extern struct netbuf *__rpc_uaddr2taddr_ extern int __rpc_seman2socktype(int); extern int __rpc_socktype2seman(int); extern int __rpc_sockisbound(struct socket*); -extern const char *__rpc_inet_ntop(int af, const void * __restrict src, - char * __restrict dst, socklen_t size); -extern int __rpc_inet_pton(int af, const char * __restrict src, - void * __restrict dst); extern int bindresvport(struct socket *so, struct sockaddr *sa); struct xucred; Modified: head/sys/rpc/rpc_generic.c ============================================================================== --- head/sys/rpc/rpc_generic.c Fri Sep 24 14:44:04 2010 (r213102) +++ head/sys/rpc/rpc_generic.c Fri Sep 24 15:01:45 2010 (r213103) @@ -306,7 +306,7 @@ __rpc_taddr2uaddr_af(int af, const struc switch (af) { case AF_INET: sin = nbuf->buf; - if (__rpc_inet_ntop(af, &sin->sin_addr, namebuf, sizeof namebuf) + if (inet_ntop(af, &sin->sin_addr, namebuf, sizeof namebuf) == NULL) return NULL; port = ntohs(sin->sin_port); @@ -318,7 +318,7 @@ __rpc_taddr2uaddr_af(int af, const struc #ifdef INET6 case AF_INET6: sin6 = nbuf->buf; - if (__rpc_inet_ntop(af, &sin6->sin6_addr, namebuf6, sizeof namebuf6) + if (inet_ntop(af, &sin6->sin6_addr, namebuf6, sizeof namebuf6) == NULL) return NULL; port = ntohs(sin6->sin6_port); @@ -396,7 +396,7 @@ __rpc_uaddr2taddr_af(int af, const char memset(sin, 0, sizeof *sin); sin->sin_family = AF_INET; sin->sin_port = htons(port); - if (__rpc_inet_pton(AF_INET, addrstr, &sin->sin_addr) <= 0) { + if (inet_pton(AF_INET, addrstr, &sin->sin_addr) <= 0) { free(sin, M_RPC); free(ret, M_RPC); ret = NULL; @@ -414,7 +414,7 @@ __rpc_uaddr2taddr_af(int af, const char memset(sin6, 0, sizeof *sin6); sin6->sin6_family = AF_INET6; sin6->sin6_port = htons(port); - if (__rpc_inet_pton(AF_INET6, addrstr, &sin6->sin6_addr) <= 0) { + if (inet_pton(AF_INET6, addrstr, &sin6->sin6_addr) <= 0) { free(sin6, M_RPC); free(ret, M_RPC); ret = NULL; From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 15:12:19 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0AFA6106566B; Fri, 24 Sep 2010 15:12:19 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D3D418FC1A; Fri, 24 Sep 2010 15:12:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OFCIEC029262; Fri, 24 Sep 2010 15:12:18 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OFCIHG029260; Fri, 24 Sep 2010 15:12:18 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009241512.o8OFCIHG029260@svn.freebsd.org> From: Marius Strobl Date: Fri, 24 Sep 2010 15:12:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213104 - head/sys/sparc64/sparc64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 15:12:19 -0000 Author: marius Date: Fri Sep 24 15:12:18 2010 New Revision: 213104 URL: http://svn.freebsd.org/changeset/base/213104 Log: minor simplifications and cosmetics Modified: head/sys/sparc64/sparc64/elf_machdep.c Modified: head/sys/sparc64/sparc64/elf_machdep.c ============================================================================== --- head/sys/sparc64/sparc64/elf_machdep.c Fri Sep 24 15:01:45 2010 (r213103) +++ head/sys/sparc64/sparc64/elf_machdep.c Fri Sep 24 15:12:18 2010 (r213104) @@ -132,8 +132,8 @@ void elf64_dump_thread(struct thread *td __unused, void *dst __unused, size_t *off __unused) { -} +} /* * The following table holds for each relocation type: @@ -219,7 +219,7 @@ static const int reloc_target_flags[] = }; #if 0 -static const char *reloc_names[] = { +static const char *const reloc_names[] = { "NONE", "RELOC_8", "RELOC_16", "RELOC_32", "DISP_8", "DISP_16", "DISP_32", "WDISP_30", "WDISP_22", "HI22", "22", "13", "LO10", "GOT10", "GOT13", @@ -275,10 +275,9 @@ static const long reloc_target_bitmask[] int elf_reloc_local(linker_file_t lf, Elf_Addr relocbase, const void *data, - int type, elf_lookup_fn lookup) + int type, elf_lookup_fn lookup __unused) { const Elf_Rela *rela; - Elf_Addr value; Elf_Addr *where; if (type != ELF_RELOC_RELA) @@ -288,10 +287,8 @@ elf_reloc_local(linker_file_t lf, Elf_Ad if (ELF64_R_TYPE_ID(rela->r_info) != R_SPARC_RELATIVE) return (-1); - value = rela->r_addend + (Elf_Addr)lf->address; - where = (Elf_Addr *)((Elf_Addr)lf->address + rela->r_offset); - - *where = elf_relocaddr(lf, value); + where = (Elf_Addr *)(relocbase + rela->r_offset); + *where = elf_relocaddr(lf, rela->r_addend + relocbase); return (0); } @@ -346,9 +343,8 @@ elf_reloc(linker_file_t lf, Elf_Addr rel if (RELOC_PC_RELATIVE(rtype)) value -= (Elf_Addr)where; - if (RELOC_BASE_RELATIVE(rtype)) { + if (RELOC_BASE_RELATIVE(rtype)) value = elf_relocaddr(lf, value + relocbase); - } mask = RELOC_VALUE_BITMASK(rtype); value >>= RELOC_VALUE_RIGHTSHIFT(rtype); From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 16:40:47 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5BDF2106566B; Fri, 24 Sep 2010 16:40:47 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4B14C8FC15; Fri, 24 Sep 2010 16:40:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OGelY7031913; Fri, 24 Sep 2010 16:40:47 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OGelKS031911; Fri, 24 Sep 2010 16:40:47 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009241640.o8OGelKS031911@svn.freebsd.org> From: Marius Strobl Date: Fri, 24 Sep 2010 16:40:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213105 - head/sys/dev/mpt X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 16:40:47 -0000 Author: marius Date: Fri Sep 24 16:40:46 2010 New Revision: 213105 URL: http://svn.freebsd.org/changeset/base/213105 Log: Improve r56796; the reply handler actually may remove the request from the chain in which case it shouldn't be removed twice. Reported by: Staale Kristoffersen MFC after: 1 week Modified: head/sys/dev/mpt/mpt.c Modified: head/sys/dev/mpt/mpt.c ============================================================================== --- head/sys/dev/mpt/mpt.c Fri Sep 24 15:12:18 2010 (r213104) +++ head/sys/dev/mpt/mpt.c Fri Sep 24 16:40:46 2010 (r213105) @@ -844,13 +844,14 @@ mpt_complete_request_chain(struct mpt_so MSG_REQUEST_HEADER *msg_hdr; u_int cb_index; - TAILQ_REMOVE(chain, req, links); msg_hdr = (MSG_REQUEST_HEADER *)req->req_vbuf; ioc_status_frame.Function = msg_hdr->Function; ioc_status_frame.MsgContext = msg_hdr->MsgContext; cb_index = MPT_CONTEXT_TO_CBI(le32toh(msg_hdr->MsgContext)); mpt_reply_handlers[cb_index](mpt, req, msg_hdr->MsgContext, &ioc_status_frame); + if (mpt_req_on_pending_list(mpt, req) != 0) + TAILQ_REMOVE(chain, req, links); } } From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 17:26:58 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 038861065672; Fri, 24 Sep 2010 17:26:58 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E5C878FC19; Fri, 24 Sep 2010 17:26:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OHQvwg032969; Fri, 24 Sep 2010 17:26:57 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OHQvvO032967; Fri, 24 Sep 2010 17:26:57 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201009241726.o8OHQvvO032967@svn.freebsd.org> From: Xin LI Date: Fri, 24 Sep 2010 17:26:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213106 - stable/8/sys/fs/tmpfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 17:26:58 -0000 Author: delphij Date: Fri Sep 24 17:26:57 2010 New Revision: 213106 URL: http://svn.freebsd.org/changeset/base/213106 Log: MFC r197850: Add a special workaround to handle UIO_NOCOPY case. This fixes data corruption observed when sendfile() is being used. Requested by: avg PR: kern/127213 Submitted by: gk Modified: stable/8/sys/fs/tmpfs/tmpfs_vnops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/8/sys/fs/tmpfs/tmpfs_vnops.c Fri Sep 24 16:40:46 2010 (r213105) +++ stable/8/sys/fs/tmpfs/tmpfs_vnops.c Fri Sep 24 17:26:57 2010 (r213106) @@ -43,6 +43,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include #include @@ -433,15 +435,72 @@ tmpfs_setattr(struct vop_setattr_args *v } /* --------------------------------------------------------------------- */ +static int +tmpfs_nocacheread(vm_object_t tobj, vm_pindex_t idx, + vm_offset_t offset, size_t tlen, struct uio *uio) +{ + vm_page_t m; + int error; + + VM_OBJECT_LOCK(tobj); + vm_object_pip_add(tobj, 1); + m = vm_page_grab(tobj, idx, VM_ALLOC_WIRED | + VM_ALLOC_ZERO | VM_ALLOC_NORMAL | VM_ALLOC_RETRY); + if (m->valid != VM_PAGE_BITS_ALL) { + if (vm_pager_has_page(tobj, idx, NULL, NULL)) { + error = vm_pager_get_pages(tobj, &m, 1, 0); + if (error != 0) { + printf("tmpfs get pages from pager error [read]\n"); + goto out; + } + } else + vm_page_zero_invalid(m, TRUE); + } + VM_OBJECT_UNLOCK(tobj); + error = uiomove_fromphys(&m, offset, tlen, uio); + VM_OBJECT_LOCK(tobj); +out: + vm_page_lock_queues(); + vm_page_unwire(m, TRUE); + vm_page_unlock_queues(); + vm_page_wakeup(m); + vm_object_pip_subtract(tobj, 1); + VM_OBJECT_UNLOCK(tobj); + + return (error); +} + +static __inline int +tmpfs_nocacheread_buf(vm_object_t tobj, vm_pindex_t idx, + vm_offset_t offset, size_t tlen, void *buf) +{ + struct uio uio; + struct iovec iov; + + uio.uio_iovcnt = 1; + uio.uio_iov = &iov; + iov.iov_base = buf; + iov.iov_len = tlen; + + uio.uio_offset = 0; + uio.uio_resid = tlen; + uio.uio_rw = UIO_READ; + uio.uio_segflg = UIO_SYSSPACE; + uio.uio_td = curthread; + + return (tmpfs_nocacheread(tobj, idx, offset, tlen, &uio)); +} static int tmpfs_mappedread(vm_object_t vobj, vm_object_t tobj, size_t len, struct uio *uio) { + struct sf_buf *sf; vm_pindex_t idx; vm_page_t m; vm_offset_t offset; off_t addr; size_t tlen; + char *ma; int error; addr = uio->uio_offset; @@ -465,33 +524,30 @@ lookupvpg: vm_page_wakeup(m); VM_OBJECT_UNLOCK(vobj); return (error); + } else if (m != NULL && uio->uio_segflg == UIO_NOCOPY) { + if (vm_page_sleep_if_busy(m, FALSE, "tmfsmr")) + goto lookupvpg; + vm_page_busy(m); + VM_OBJECT_UNLOCK(vobj); + sched_pin(); + sf = sf_buf_alloc(m, SFB_CPUPRIVATE); + ma = (char *)sf_buf_kva(sf); + error = tmpfs_nocacheread_buf(tobj, idx, offset, tlen, + ma + offset); + if (error == 0) { + uio->uio_offset += tlen; + uio->uio_resid -= tlen; + } + sf_buf_free(sf); + sched_unpin(); + VM_OBJECT_LOCK(vobj); + vm_page_wakeup(m); + VM_OBJECT_UNLOCK(vobj); + return (error); } VM_OBJECT_UNLOCK(vobj); nocache: - VM_OBJECT_LOCK(tobj); - vm_object_pip_add(tobj, 1); - m = vm_page_grab(tobj, idx, VM_ALLOC_WIRED | - VM_ALLOC_ZERO | VM_ALLOC_NORMAL | VM_ALLOC_RETRY); - if (m->valid != VM_PAGE_BITS_ALL) { - if (vm_pager_has_page(tobj, idx, NULL, NULL)) { - error = vm_pager_get_pages(tobj, &m, 1, 0); - if (error != 0) { - printf("tmpfs get pages from pager error [read]\n"); - goto out; - } - } else - vm_page_zero_invalid(m, TRUE); - } - VM_OBJECT_UNLOCK(tobj); - error = uiomove_fromphys(&m, offset, tlen, uio); - VM_OBJECT_LOCK(tobj); -out: - vm_page_lock_queues(); - vm_page_unwire(m, TRUE); - vm_page_unlock_queues(); - vm_page_wakeup(m); - vm_object_pip_subtract(tobj, 1); - VM_OBJECT_UNLOCK(tobj); + error = tmpfs_nocacheread(tobj, idx, offset, tlen, uio); return (error); } From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 17:28:19 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D19A2106566B; Fri, 24 Sep 2010 17:28:19 +0000 (UTC) (envelope-from avg@freebsd.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 556968FC14; Fri, 24 Sep 2010 17:28:17 +0000 (UTC) Received: from porto.topspin.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 UAA20098; Fri, 24 Sep 2010 20:28:16 +0300 (EEST) (envelope-from avg@freebsd.org) Received: from localhost.topspin.kiev.ua ([127.0.0.1]) by porto.topspin.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1OzC4G-0009at-78; Fri, 24 Sep 2010 20:28:16 +0300 Message-ID: <4C9CDFAF.2000103@freebsd.org> Date: Fri, 24 Sep 2010 20:28:15 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.9) Gecko/20100918 Lightning/1.0b2 Thunderbird/3.1.4 MIME-Version: 1.0 To: Xin LI References: <201009241726.o8OHQvvO032967@svn.freebsd.org> In-Reply-To: <201009241726.o8OHQvvO032967@svn.freebsd.org> X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r213106 - stable/8/sys/fs/tmpfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 17:28:19 -0000 on 24/09/2010 20:26 Xin LI said the following: > Author: delphij > Date: Fri Sep 24 17:26:57 2010 > New Revision: 213106 > URL: http://svn.freebsd.org/changeset/base/213106 > > Log: > MFC r197850: > > Add a special workaround to handle UIO_NOCOPY case. This fixes data > corruption observed when sendfile() is being used. > > Requested by: avg > PR: kern/127213 > Submitted by: gk Thank you very much! -- Andriy Gapon From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 17:53:33 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 523C5106564A; Fri, 24 Sep 2010 17:53:33 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2687B8FC22; Fri, 24 Sep 2010 17:53:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OHrXUi033620; Fri, 24 Sep 2010 17:53:33 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OHrX8H033618; Fri, 24 Sep 2010 17:53:33 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009241753.o8OHrX8H033618@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 17:53:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213107 - stable/8/sys/dev/bge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 17:53:33 -0000 Author: yongari Date: Fri Sep 24 17:53:32 2010 New Revision: 213107 URL: http://svn.freebsd.org/changeset/base/213107 Log: MFC r211594: Load tunable from loader.conf(5) instead of device.hints(5). Modified: stable/8/sys/dev/bge/if_bge.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/bge/if_bge.c ============================================================================== --- stable/8/sys/dev/bge/if_bge.c Fri Sep 24 17:26:57 2010 (r213106) +++ stable/8/sys/dev/bge/if_bge.c Fri Sep 24 17:53:32 2010 (r213107) @@ -4898,6 +4898,8 @@ bge_add_sysctls(struct bge_softc *sc) struct sysctl_ctx_list *ctx; struct sysctl_oid_list *children, *schildren; struct sysctl_oid *tree; + char tn[32]; + int unit; ctx = device_get_sysctl_ctx(sc->bge_dev); children = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->bge_dev)); @@ -4917,6 +4919,7 @@ bge_add_sysctls(struct bge_softc *sc) #endif + unit = device_get_unit(sc->bge_dev); /* * A common design characteristic for many Broadcom client controllers * is that they only support a single outstanding DMA read operation @@ -4929,13 +4932,13 @@ bge_add_sysctls(struct bge_softc *sc) * performance is about 850Mbps. However forcing coalescing mbufs * consumes a lot of CPU cycles, so leave it off by default. */ + sc->bge_forced_collapse = 0; + snprintf(tn, sizeof(tn), "dev.bge.%d.forced_collapse", unit); + TUNABLE_INT_FETCH(tn, &sc->bge_forced_collapse); SYSCTL_ADD_INT(ctx, children, OID_AUTO, "forced_collapse", CTLFLAG_RW, &sc->bge_forced_collapse, 0, "Number of fragmented TX buffers of a frame allowed before " "forced collapsing"); - resource_int_value(device_get_name(sc->bge_dev), - device_get_unit(sc->bge_dev), "forced_collapse", - &sc->bge_forced_collapse); if (BGE_IS_5705_PLUS(sc)) return; From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 17:56:12 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 851E31065673; Fri, 24 Sep 2010 17:56:12 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 59DAF8FC18; Fri, 24 Sep 2010 17:56:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OHuCxj033739; Fri, 24 Sep 2010 17:56:12 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OHuCNr033737; Fri, 24 Sep 2010 17:56:12 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009241756.o8OHuCNr033737@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 17:56:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213108 - stable/7/sys/dev/bge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 17:56:12 -0000 Author: yongari Date: Fri Sep 24 17:56:12 2010 New Revision: 213108 URL: http://svn.freebsd.org/changeset/base/213108 Log: MFC r211594: Load tunable from loader.conf(5) instead of device.hints(5). Modified: stable/7/sys/dev/bge/if_bge.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/bge/if_bge.c ============================================================================== --- stable/7/sys/dev/bge/if_bge.c Fri Sep 24 17:53:32 2010 (r213107) +++ stable/7/sys/dev/bge/if_bge.c Fri Sep 24 17:56:12 2010 (r213108) @@ -4894,6 +4894,8 @@ bge_add_sysctls(struct bge_softc *sc) struct sysctl_ctx_list *ctx; struct sysctl_oid_list *children, *schildren; struct sysctl_oid *tree; + char tn[32]; + int unit; ctx = device_get_sysctl_ctx(sc->bge_dev); children = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->bge_dev)); @@ -4913,6 +4915,7 @@ bge_add_sysctls(struct bge_softc *sc) #endif + unit = device_get_unit(sc->bge_dev); /* * A common design characteristic for many Broadcom client controllers * is that they only support a single outstanding DMA read operation @@ -4925,13 +4928,13 @@ bge_add_sysctls(struct bge_softc *sc) * performance is about 850Mbps. However forcing coalescing mbufs * consumes a lot of CPU cycles, so leave it off by default. */ + sc->bge_forced_collapse = 0; + snprintf(tn, sizeof(tn), "dev.bge.%d.forced_collapse", unit); + TUNABLE_INT_FETCH(tn, &sc->bge_forced_collapse); SYSCTL_ADD_INT(ctx, children, OID_AUTO, "forced_collapse", CTLFLAG_RW, &sc->bge_forced_collapse, 0, "Number of fragmented TX buffers of a frame allowed before " "forced collapsing"); - resource_int_value(device_get_name(sc->bge_dev), - device_get_unit(sc->bge_dev), "forced_collapse", - &sc->bge_forced_collapse); if (BGE_IS_5705_PLUS(sc)) return; From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 17:59:58 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 62464106566B; Fri, 24 Sep 2010 17:59:58 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 504A08FC12; Fri, 24 Sep 2010 17:59:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OHxwCk033892; Fri, 24 Sep 2010 17:59:58 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OHxwuF033889; Fri, 24 Sep 2010 17:59:58 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009241759.o8OHxwuF033889@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 17:59:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213109 - stable/8/sys/dev/bge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 17:59:58 -0000 Author: yongari Date: Fri Sep 24 17:59:58 2010 New Revision: 213109 URL: http://svn.freebsd.org/changeset/base/213109 Log: MFC r211596: It seems all Broadcom controllers have a bug that can generate UDP datagrams with checksum value 0 when TX UDP checksum offloading is enabled. Generating UDP checksum value 0 is RFC 768 violation. Even though the probability of generating such UDP datagrams is low, I don't want to see FreeBSD boxes to inject such datagrams into network so disable UDP checksum offloading by default. Users still override this behavior by setting a sysctl variable or loader tunable, dev.bge.%d.forced_udpcsum. I have no idea why this issue was not reported so far given that bge(4) is one of the most commonly used controller on high-end server class systems. Thanks to andre@ who passed the PR to me. PR: kern/104826 Modified: stable/8/sys/dev/bge/if_bge.c stable/8/sys/dev/bge/if_bgereg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/bge/if_bge.c ============================================================================== --- stable/8/sys/dev/bge/if_bge.c Fri Sep 24 17:56:12 2010 (r213108) +++ stable/8/sys/dev/bge/if_bge.c Fri Sep 24 17:59:58 2010 (r213109) @@ -120,7 +120,7 @@ __FBSDID("$FreeBSD$"); #include -#define BGE_CSUM_FEATURES (CSUM_IP | CSUM_TCP | CSUM_UDP) +#define BGE_CSUM_FEATURES (CSUM_IP | CSUM_TCP) #define ETHER_MIN_NOPAD (ETHER_MIN_LEN - ETHER_CRC_LEN) /* i.e., 60 */ MODULE_DEPEND(bge, pci, 1, 1, 1); @@ -2795,6 +2795,8 @@ bge_attach(device_t dev) goto fail; } + bge_add_sysctls(sc); + /* Set default tuneable values. */ sc->bge_stat_ticks = BGE_TICKS_PER_SEC; sc->bge_rx_coal_ticks = 150; @@ -2802,6 +2804,11 @@ bge_attach(device_t dev) sc->bge_rx_max_coal_bds = 10; sc->bge_tx_max_coal_bds = 10; + /* Initialize checksum features to use. */ + sc->bge_csum_features = BGE_CSUM_FEATURES; + if (sc->bge_forced_udpcsum != 0) + sc->bge_csum_features |= CSUM_UDP; + /* Set up ifnet structure */ ifp = sc->bge_ifp = if_alloc(IFT_ETHER); if (ifp == NULL) { @@ -2818,7 +2825,7 @@ bge_attach(device_t dev) ifp->if_snd.ifq_drv_maxlen = BGE_TX_RING_CNT - 1; IFQ_SET_MAXLEN(&ifp->if_snd, ifp->if_snd.ifq_drv_maxlen); IFQ_SET_READY(&ifp->if_snd); - ifp->if_hwassist = BGE_CSUM_FEATURES; + ifp->if_hwassist = sc->bge_csum_features; ifp->if_capabilities = IFCAP_HWCSUM | IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; if ((sc->bge_flags & BGE_FLAG_TSO) != 0) { @@ -2975,8 +2982,6 @@ again: device_printf(sc->bge_dev, "couldn't set up irq\n"); } - bge_add_sysctls(sc); - return (0); fail: @@ -3960,7 +3965,7 @@ bge_encap(struct bge_softc *sc, struct m return (ENOBUFS); csum_flags |= BGE_TXBDFLAG_CPU_PRE_DMA | BGE_TXBDFLAG_CPU_POST_DMA; - } else if ((m->m_pkthdr.csum_flags & BGE_CSUM_FEATURES) != 0) { + } else if ((m->m_pkthdr.csum_flags & sc->bge_csum_features) != 0) { if (m->m_pkthdr.csum_flags & CSUM_IP) csum_flags |= BGE_TXBDFLAG_IP_CSUM; if (m->m_pkthdr.csum_flags & (CSUM_TCP | CSUM_UDP)) { @@ -4237,6 +4242,17 @@ bge_init_locked(struct bge_softc *sc) /* Program VLAN tag stripping. */ bge_setvlan(sc); + /* Override UDP checksum offloading. */ + if (sc->bge_forced_udpcsum == 0) + sc->bge_csum_features &= ~CSUM_UDP; + else + sc->bge_csum_features |= CSUM_UDP; + if (ifp->if_capabilities & IFCAP_TXCSUM && + ifp->if_capenable & IFCAP_TXCSUM) { + ifp->if_hwassist &= ~(BGE_CSUM_FEATURES | CSUM_UDP); + ifp->if_hwassist |= sc->bge_csum_features; + } + /* Init RX ring. */ if (bge_init_rx_ring_std(sc) != 0) { device_printf(sc->bge_dev, "no memory for std Rx buffers.\n"); @@ -4562,9 +4578,9 @@ bge_ioctl(struct ifnet *ifp, u_long comm ifp->if_capenable ^= IFCAP_HWCSUM; if (IFCAP_HWCSUM & ifp->if_capenable && IFCAP_HWCSUM & ifp->if_capabilities) - ifp->if_hwassist |= BGE_CSUM_FEATURES; + ifp->if_hwassist |= sc->bge_csum_features; else - ifp->if_hwassist &= ~BGE_CSUM_FEATURES; + ifp->if_hwassist &= ~sc->bge_csum_features; } if ((mask & IFCAP_TSO4) != 0 && @@ -4940,6 +4956,24 @@ bge_add_sysctls(struct bge_softc *sc) "Number of fragmented TX buffers of a frame allowed before " "forced collapsing"); + /* + * It seems all Broadcom controllers have a bug that can generate UDP + * datagrams with checksum value 0 when TX UDP checksum offloading is + * enabled. Generating UDP checksum value 0 is RFC 768 violation. + * Even though the probability of generating such UDP datagrams is + * low, I don't want to see FreeBSD boxes to inject such datagrams + * into network so disable UDP checksum offloading by default. Users + * still override this behavior by setting a sysctl variable, + * dev.bge.0.forced_udpcsum. + */ + sc->bge_forced_udpcsum = 0; + snprintf(tn, sizeof(tn), "dev.bge.%d.bge_forced_udpcsum", unit); + TUNABLE_INT_FETCH(tn, &sc->bge_forced_udpcsum); + SYSCTL_ADD_INT(ctx, children, OID_AUTO, "forced_udpcsum", + CTLFLAG_RW, &sc->bge_forced_udpcsum, 0, + "Enable UDP checksum offloading even if controller can " + "generate UDP checksum value 0"); + if (BGE_IS_5705_PLUS(sc)) return; Modified: stable/8/sys/dev/bge/if_bgereg.h ============================================================================== --- stable/8/sys/dev/bge/if_bgereg.h Fri Sep 24 17:56:12 2010 (r213108) +++ stable/8/sys/dev/bge/if_bgereg.h Fri Sep 24 17:59:58 2010 (r213109) @@ -2644,6 +2644,8 @@ struct bge_softc { int bge_link_evt; /* pending link event */ int bge_timer; int bge_forced_collapse; + int bge_forced_udpcsum; + int bge_csum_features; struct callout bge_stat_ch; uint32_t bge_rx_discards; uint32_t bge_tx_discards; From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 18:01:43 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7634C106564A; Fri, 24 Sep 2010 18:01:43 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 646848FC13; Fri, 24 Sep 2010 18:01:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OI1hW7034020; Fri, 24 Sep 2010 18:01:43 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OI1hEp034017; Fri, 24 Sep 2010 18:01:43 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009241801.o8OI1hEp034017@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 18:01:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213110 - stable/7/sys/dev/bge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 18:01:43 -0000 Author: yongari Date: Fri Sep 24 18:01:43 2010 New Revision: 213110 URL: http://svn.freebsd.org/changeset/base/213110 Log: MFC r211596: It seems all Broadcom controllers have a bug that can generate UDP datagrams with checksum value 0 when TX UDP checksum offloading is enabled. Generating UDP checksum value 0 is RFC 768 violation. Even though the probability of generating such UDP datagrams is low, I don't want to see FreeBSD boxes to inject such datagrams into network so disable UDP checksum offloading by default. Users still override this behavior by setting a sysctl variable or loader tunable, dev.bge.%d.forced_udpcsum. I have no idea why this issue was not reported so far given that bge(4) is one of the most commonly used controller on high-end server class systems. Thanks to andre@ who passed the PR to me. PR: kern/104826 Modified: stable/7/sys/dev/bge/if_bge.c stable/7/sys/dev/bge/if_bgereg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/bge/if_bge.c ============================================================================== --- stable/7/sys/dev/bge/if_bge.c Fri Sep 24 17:59:58 2010 (r213109) +++ stable/7/sys/dev/bge/if_bge.c Fri Sep 24 18:01:43 2010 (r213110) @@ -120,7 +120,7 @@ __FBSDID("$FreeBSD$"); #include -#define BGE_CSUM_FEATURES (CSUM_IP | CSUM_TCP | CSUM_UDP) +#define BGE_CSUM_FEATURES (CSUM_IP | CSUM_TCP) #define ETHER_MIN_NOPAD (ETHER_MIN_LEN - ETHER_CRC_LEN) /* i.e., 60 */ MODULE_DEPEND(bge, pci, 1, 1, 1); @@ -2795,6 +2795,8 @@ bge_attach(device_t dev) goto fail; } + bge_add_sysctls(sc); + /* Set default tuneable values. */ sc->bge_stat_ticks = BGE_TICKS_PER_SEC; sc->bge_rx_coal_ticks = 150; @@ -2802,6 +2804,11 @@ bge_attach(device_t dev) sc->bge_rx_max_coal_bds = 10; sc->bge_tx_max_coal_bds = 10; + /* Initialize checksum features to use. */ + sc->bge_csum_features = BGE_CSUM_FEATURES; + if (sc->bge_forced_udpcsum != 0) + sc->bge_csum_features |= CSUM_UDP; + /* Set up ifnet structure */ ifp = sc->bge_ifp = if_alloc(IFT_ETHER); if (ifp == NULL) { @@ -2818,7 +2825,7 @@ bge_attach(device_t dev) ifp->if_snd.ifq_drv_maxlen = BGE_TX_RING_CNT - 1; IFQ_SET_MAXLEN(&ifp->if_snd, ifp->if_snd.ifq_drv_maxlen); IFQ_SET_READY(&ifp->if_snd); - ifp->if_hwassist = BGE_CSUM_FEATURES; + ifp->if_hwassist = sc->bge_csum_features; ifp->if_capabilities = IFCAP_HWCSUM | IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; if ((sc->bge_flags & BGE_FLAG_TSO) != 0) { @@ -2975,8 +2982,6 @@ again: device_printf(sc->bge_dev, "couldn't set up irq\n"); } - bge_add_sysctls(sc); - return (0); fail: @@ -3956,7 +3961,7 @@ bge_encap(struct bge_softc *sc, struct m return (ENOBUFS); csum_flags |= BGE_TXBDFLAG_CPU_PRE_DMA | BGE_TXBDFLAG_CPU_POST_DMA; - } else if ((m->m_pkthdr.csum_flags & BGE_CSUM_FEATURES) != 0) { + } else if ((m->m_pkthdr.csum_flags & sc->bge_csum_features) != 0) { if (m->m_pkthdr.csum_flags & CSUM_IP) csum_flags |= BGE_TXBDFLAG_IP_CSUM; if (m->m_pkthdr.csum_flags & (CSUM_TCP | CSUM_UDP)) { @@ -4233,6 +4238,17 @@ bge_init_locked(struct bge_softc *sc) /* Program VLAN tag stripping. */ bge_setvlan(sc); + /* Override UDP checksum offloading. */ + if (sc->bge_forced_udpcsum == 0) + sc->bge_csum_features &= ~CSUM_UDP; + else + sc->bge_csum_features |= CSUM_UDP; + if (ifp->if_capabilities & IFCAP_TXCSUM && + ifp->if_capenable & IFCAP_TXCSUM) { + ifp->if_hwassist &= ~(BGE_CSUM_FEATURES | CSUM_UDP); + ifp->if_hwassist |= sc->bge_csum_features; + } + /* Init RX ring. */ if (bge_init_rx_ring_std(sc) != 0) { device_printf(sc->bge_dev, "no memory for std Rx buffers.\n"); @@ -4558,9 +4574,9 @@ bge_ioctl(struct ifnet *ifp, u_long comm ifp->if_capenable ^= IFCAP_HWCSUM; if (IFCAP_HWCSUM & ifp->if_capenable && IFCAP_HWCSUM & ifp->if_capabilities) - ifp->if_hwassist |= BGE_CSUM_FEATURES; + ifp->if_hwassist |= sc->bge_csum_features; else - ifp->if_hwassist &= ~BGE_CSUM_FEATURES; + ifp->if_hwassist &= ~sc->bge_csum_features; } if ((mask & IFCAP_TSO4) != 0 && @@ -4936,6 +4952,24 @@ bge_add_sysctls(struct bge_softc *sc) "Number of fragmented TX buffers of a frame allowed before " "forced collapsing"); + /* + * It seems all Broadcom controllers have a bug that can generate UDP + * datagrams with checksum value 0 when TX UDP checksum offloading is + * enabled. Generating UDP checksum value 0 is RFC 768 violation. + * Even though the probability of generating such UDP datagrams is + * low, I don't want to see FreeBSD boxes to inject such datagrams + * into network so disable UDP checksum offloading by default. Users + * still override this behavior by setting a sysctl variable, + * dev.bge.0.forced_udpcsum. + */ + sc->bge_forced_udpcsum = 0; + snprintf(tn, sizeof(tn), "dev.bge.%d.bge_forced_udpcsum", unit); + TUNABLE_INT_FETCH(tn, &sc->bge_forced_udpcsum); + SYSCTL_ADD_INT(ctx, children, OID_AUTO, "forced_udpcsum", + CTLFLAG_RW, &sc->bge_forced_udpcsum, 0, + "Enable UDP checksum offloading even if controller can " + "generate UDP checksum value 0"); + if (BGE_IS_5705_PLUS(sc)) return; Modified: stable/7/sys/dev/bge/if_bgereg.h ============================================================================== --- stable/7/sys/dev/bge/if_bgereg.h Fri Sep 24 17:59:58 2010 (r213109) +++ stable/7/sys/dev/bge/if_bgereg.h Fri Sep 24 18:01:43 2010 (r213110) @@ -2644,6 +2644,8 @@ struct bge_softc { int bge_link_evt; /* pending link event */ int bge_timer; int bge_forced_collapse; + int bge_forced_udpcsum; + int bge_csum_features; struct callout bge_stat_ch; uint32_t bge_rx_discards; uint32_t bge_tx_discards; From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 18:12:19 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 66695106566B; Fri, 24 Sep 2010 18:12:19 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 550AB8FC16; Fri, 24 Sep 2010 18:12:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OICJho034392; Fri, 24 Sep 2010 18:12:19 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OICJdp034390; Fri, 24 Sep 2010 18:12:19 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009241812.o8OICJdp034390@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 18:12:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213111 - stable/8/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 18:12:19 -0000 Author: yongari Date: Fri Sep 24 18:12:19 2010 New Revision: 213111 URL: http://svn.freebsd.org/changeset/base/213111 Log: MFC r211597: Document newly introduced tunable dev.bge.%d.forced_udpcsum. While I'm here also mention tunable dev.bge.%d.forced_collapse. Modified: stable/8/share/man/man4/bge.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/bge.4 ============================================================================== --- stable/8/share/man/man4/bge.4 Fri Sep 24 18:01:43 2010 (r213110) +++ stable/8/share/man/man4/bge.4 Fri Sep 24 18:12:19 2010 (r213111) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 15, 2009 +.Dd August 21, 2010 .Dt BGE 4 .Os .Sh NAME @@ -219,6 +219,26 @@ Allow the ASF feature for cooperating wi Can cause system lockup problems on a small number of systems. Disabled by default. .El +.Sh SYSCTL VARIABLES +The following variables are available as both +.Xr sysctl 8 +variables and +.Xr loader 8 +tunables: +.Bl -tag -width indent +.It Va dev.bge.%d.forced_collapse +Allow collapsing multiple transmit buffers into a single buffer +to increase transmit performance with the cost of CPU cycles. +The default value is 0 to disable transmit buffer collapsing. +.It Va dev.bge.%d.forced_udpcsum +Enable UDP transmit checksum offloading even if controller can generate +UDP datagrams with checksum value 0. +UDP datagrams with checksum value 0 can confuse receiver host as it means +sender did not compute UDP checksum. +The default value is 0 which disables UDP transmit checksum offloading. +The interface need to be brought down and up again before a change takes +effect. +.El .Sh DIAGNOSTICS .Bl -diag .It "bge%d: couldn't map memory" From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 18:14:23 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 239E91065673; Fri, 24 Sep 2010 18:14:23 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1220D8FC0C; Fri, 24 Sep 2010 18:14:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OIEMfP034481; Fri, 24 Sep 2010 18:14:22 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OIEMA6034479; Fri, 24 Sep 2010 18:14:22 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009241814.o8OIEMA6034479@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 18:14:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213112 - stable/7/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 18:14:23 -0000 Author: yongari Date: Fri Sep 24 18:14:22 2010 New Revision: 213112 URL: http://svn.freebsd.org/changeset/base/213112 Log: MFC r211597: Document newly introduced tunable dev.bge.%d.forced_udpcsum. While I'm here also mention tunable dev.bge.%d.forced_collapse. Modified: stable/7/share/man/man4/bge.4 Directory Properties: stable/7/share/man/man4/ (props changed) Modified: stable/7/share/man/man4/bge.4 ============================================================================== --- stable/7/share/man/man4/bge.4 Fri Sep 24 18:12:19 2010 (r213111) +++ stable/7/share/man/man4/bge.4 Fri Sep 24 18:14:22 2010 (r213112) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 15, 2009 +.Dd August 21, 2010 .Dt BGE 4 .Os .Sh NAME @@ -215,6 +215,26 @@ Allow the ASF feature for cooperating wi Can cause system lockup problems on a small number of systems. Disabled by default. .El +.Sh SYSCTL VARIABLES +The following variables are available as both +.Xr sysctl 8 +variables and +.Xr loader 8 +tunables: +.Bl -tag -width indent +.It Va dev.bge.%d.forced_collapse +Allow collapsing multiple transmit buffers into a single buffer +to increase transmit performance with the cost of CPU cycles. +The default value is 0 to disable transmit buffer collapsing. +.It Va dev.bge.%d.forced_udpcsum +Enable UDP transmit checksum offloading even if controller can generate +UDP datagrams with checksum value 0. +UDP datagrams with checksum value 0 can confuse receiver host as it means +sender did not compute UDP checksum. +The default value is 0 which disables UDP transmit checksum offloading. +The interface need to be brought down and up again before a change takes +effect. +.El .Sh DIAGNOSTICS .Bl -diag .It "bge%d: couldn't map memory" From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 18:33:16 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 586311065696; Fri, 24 Sep 2010 18:33:16 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 470468FC16; Fri, 24 Sep 2010 18:33:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OIXGPn034895; Fri, 24 Sep 2010 18:33:16 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OIXGf6034893; Fri, 24 Sep 2010 18:33:16 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009241833.o8OIXGf6034893@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 18:33:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213113 - stable/8/sys/dev/xl X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 18:33:16 -0000 Author: yongari Date: Fri Sep 24 18:33:15 2010 New Revision: 213113 URL: http://svn.freebsd.org/changeset/base/213113 Log: MFC r211670: Clean up SIOCSIFCAP handler and allow RX checksum offloading could be controlled by user. Modified: stable/8/sys/dev/xl/if_xl.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/xl/if_xl.c ============================================================================== --- stable/8/sys/dev/xl/if_xl.c Fri Sep 24 18:14:22 2010 (r213112) +++ stable/8/sys/dev/xl/if_xl.c Fri Sep 24 18:33:15 2010 (r213113) @@ -3083,7 +3083,7 @@ xl_ioctl(struct ifnet *ifp, u_long comma { struct xl_softc *sc = ifp->if_softc; struct ifreq *ifr = (struct ifreq *) data; - int error = 0; + int error = 0, mask; struct mii_data *mii = NULL; u_int8_t rxfilt; @@ -3143,40 +3143,47 @@ xl_ioctl(struct ifnet *ifp, u_long comma &mii->mii_media, command); break; case SIOCSIFCAP: + mask = ifr->ifr_reqcap ^ ifp->if_capenable; #ifdef DEVICE_POLLING - if (ifr->ifr_reqcap & IFCAP_POLLING && - !(ifp->if_capenable & IFCAP_POLLING)) { - error = ether_poll_register(xl_poll, ifp); - if (error) - return(error); - XL_LOCK(sc); - /* Disable interrupts */ - CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_INTR_ENB|0); - ifp->if_capenable |= IFCAP_POLLING; - XL_UNLOCK(sc); - return (error); - } - if (!(ifr->ifr_reqcap & IFCAP_POLLING) && - ifp->if_capenable & IFCAP_POLLING) { - error = ether_poll_deregister(ifp); - /* Enable interrupts. */ - XL_LOCK(sc); - CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_INTR_ACK|0xFF); - CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_INTR_ENB|XL_INTRS); - if (sc->xl_flags & XL_FLAG_FUNCREG) - bus_space_write_4(sc->xl_ftag, sc->xl_fhandle, - 4, 0x8000); - ifp->if_capenable &= ~IFCAP_POLLING; - XL_UNLOCK(sc); - return (error); + if ((mask & IFCAP_POLLING) != 0 && + (ifp->if_capabilities & IFCAP_POLLING) != 0) { + ifp->if_capenable ^= IFCAP_POLLING; + if ((ifp->if_capenable & IFCAP_POLLING) != 0) { + error = ether_poll_register(xl_poll, ifp); + if (error) + break; + XL_LOCK(sc); + /* Disable interrupts */ + CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_INTR_ENB|0); + ifp->if_capenable |= IFCAP_POLLING; + XL_UNLOCK(sc); + } else { + error = ether_poll_deregister(ifp); + /* Enable interrupts. */ + XL_LOCK(sc); + CSR_WRITE_2(sc, XL_COMMAND, + XL_CMD_INTR_ACK | 0xFF); + CSR_WRITE_2(sc, XL_COMMAND, + XL_CMD_INTR_ENB | XL_INTRS); + if (sc->xl_flags & XL_FLAG_FUNCREG) + bus_space_write_4(sc->xl_ftag, + sc->xl_fhandle, 4, 0x8000); + XL_UNLOCK(sc); + } } #endif /* DEVICE_POLLING */ XL_LOCK(sc); - ifp->if_capenable = ifr->ifr_reqcap; - if (ifp->if_capenable & IFCAP_TXCSUM) - ifp->if_hwassist = XL905B_CSUM_FEATURES; - else - ifp->if_hwassist = 0; + if ((mask & IFCAP_TXCSUM) != 0 && + (ifp->if_capabilities & IFCAP_TXCSUM) != 0) { + ifp->if_capenable ^= IFCAP_TXCSUM; + if ((ifp->if_capenable & IFCAP_TXCSUM) != 0) + ifp->if_hwassist |= XL905B_CSUM_FEATURES; + else + ifp->if_hwassist &= ~XL905B_CSUM_FEATURES; + } + if ((mask & IFCAP_RXCSUM) != 0 && + (ifp->if_capabilities & IFCAP_RXCSUM) != 0) + ifp->if_capenable ^= IFCAP_RXCSUM; XL_UNLOCK(sc); break; default: From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 18:54:07 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F3BA7106566C; Fri, 24 Sep 2010 18:54:06 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E22A08FC14; Fri, 24 Sep 2010 18:54:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OIs64O035441; Fri, 24 Sep 2010 18:54:06 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OIs6ia035439; Fri, 24 Sep 2010 18:54:06 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009241854.o8OIs6ia035439@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 18:54:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213114 - stable/7/sys/pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 18:54:07 -0000 Author: yongari Date: Fri Sep 24 18:54:06 2010 New Revision: 213114 URL: http://svn.freebsd.org/changeset/base/213114 Log: MFC r211670: Clean up SIOCSIFCAP handler and allow RX checksum offloading could be controlled by user. Modified: stable/7/sys/pci/if_xl.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/pci/if_xl.c ============================================================================== --- stable/7/sys/pci/if_xl.c Fri Sep 24 18:33:15 2010 (r213113) +++ stable/7/sys/pci/if_xl.c Fri Sep 24 18:54:06 2010 (r213114) @@ -3107,7 +3107,7 @@ xl_ioctl(struct ifnet *ifp, u_long comma { struct xl_softc *sc = ifp->if_softc; struct ifreq *ifr = (struct ifreq *) data; - int error = 0; + int error = 0, mask; struct mii_data *mii = NULL; u_int8_t rxfilt; @@ -3167,40 +3167,47 @@ xl_ioctl(struct ifnet *ifp, u_long comma &mii->mii_media, command); break; case SIOCSIFCAP: + mask = ifr->ifr_reqcap ^ ifp->if_capenable; #ifdef DEVICE_POLLING - if (ifr->ifr_reqcap & IFCAP_POLLING && - !(ifp->if_capenable & IFCAP_POLLING)) { - error = ether_poll_register(xl_poll, ifp); - if (error) - return(error); - XL_LOCK(sc); - /* Disable interrupts */ - CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_INTR_ENB|0); - ifp->if_capenable |= IFCAP_POLLING; - XL_UNLOCK(sc); - return (error); - } - if (!(ifr->ifr_reqcap & IFCAP_POLLING) && - ifp->if_capenable & IFCAP_POLLING) { - error = ether_poll_deregister(ifp); - /* Enable interrupts. */ - XL_LOCK(sc); - CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_INTR_ACK|0xFF); - CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_INTR_ENB|XL_INTRS); - if (sc->xl_flags & XL_FLAG_FUNCREG) - bus_space_write_4(sc->xl_ftag, sc->xl_fhandle, - 4, 0x8000); - ifp->if_capenable &= ~IFCAP_POLLING; - XL_UNLOCK(sc); - return (error); + if ((mask & IFCAP_POLLING) != 0 && + (ifp->if_capabilities & IFCAP_POLLING) != 0) { + ifp->if_capenable ^= IFCAP_POLLING; + if ((ifp->if_capenable & IFCAP_POLLING) != 0) { + error = ether_poll_register(xl_poll, ifp); + if (error) + break; + XL_LOCK(sc); + /* Disable interrupts */ + CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_INTR_ENB|0); + ifp->if_capenable |= IFCAP_POLLING; + XL_UNLOCK(sc); + } else { + error = ether_poll_deregister(ifp); + /* Enable interrupts. */ + XL_LOCK(sc); + CSR_WRITE_2(sc, XL_COMMAND, + XL_CMD_INTR_ACK | 0xFF); + CSR_WRITE_2(sc, XL_COMMAND, + XL_CMD_INTR_ENB | XL_INTRS); + if (sc->xl_flags & XL_FLAG_FUNCREG) + bus_space_write_4(sc->xl_ftag, + sc->xl_fhandle, 4, 0x8000); + XL_UNLOCK(sc); + } } #endif /* DEVICE_POLLING */ XL_LOCK(sc); - ifp->if_capenable = ifr->ifr_reqcap; - if (ifp->if_capenable & IFCAP_TXCSUM) - ifp->if_hwassist = XL905B_CSUM_FEATURES; - else - ifp->if_hwassist = 0; + if ((mask & IFCAP_TXCSUM) != 0 && + (ifp->if_capabilities & IFCAP_TXCSUM) != 0) { + ifp->if_capenable ^= IFCAP_TXCSUM; + if ((ifp->if_capenable & IFCAP_TXCSUM) != 0) + ifp->if_hwassist |= XL905B_CSUM_FEATURES; + else + ifp->if_hwassist &= ~XL905B_CSUM_FEATURES; + } + if ((mask & IFCAP_RXCSUM) != 0 && + (ifp->if_capabilities & IFCAP_RXCSUM) != 0) + ifp->if_capenable ^= IFCAP_RXCSUM; XL_UNLOCK(sc); break; default: From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 18:58:05 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4AFE5106566C; Fri, 24 Sep 2010 18:58:05 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1F68C8FC14; Fri, 24 Sep 2010 18:58:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OIw5vP035588; Fri, 24 Sep 2010 18:58:05 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OIw4bT035586; Fri, 24 Sep 2010 18:58:04 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009241858.o8OIw4bT035586@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 18:58:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213115 - stable/8/sys/dev/xl X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 18:58:05 -0000 Author: yongari Date: Fri Sep 24 18:58:04 2010 New Revision: 213115 URL: http://svn.freebsd.org/changeset/base/213115 Log: MFC r211671: Remove unnecessary controller reinitialization by checking IFF_DRV_RUNNING flag. Modified: stable/8/sys/dev/xl/if_xl.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/xl/if_xl.c ============================================================================== --- stable/8/sys/dev/xl/if_xl.c Fri Sep 24 18:54:06 2010 (r213114) +++ stable/8/sys/dev/xl/if_xl.c Fri Sep 24 18:58:04 2010 (r213115) @@ -2247,6 +2247,7 @@ xl_intr(void *arg) if (status & XL_STAT_ADFAIL) { xl_reset(sc); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; xl_init_locked(sc); } @@ -2318,6 +2319,7 @@ xl_poll_locked(struct ifnet *ifp, enum p if (status & XL_STAT_ADFAIL) { xl_reset(sc); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; xl_init_locked(sc); } @@ -2745,6 +2747,8 @@ xl_init_locked(struct xl_softc *sc) XL_LOCK_ASSERT(sc); + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + return; /* * Cancel pending I/O and free all RX/TX buffers. */ @@ -2993,6 +2997,7 @@ xl_ifmedia_upd(struct ifnet *ifp) if (sc->xl_media & XL_MEDIAOPT_MII || sc->xl_media & XL_MEDIAOPT_BTX || sc->xl_media & XL_MEDIAOPT_BT4) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; xl_init_locked(sc); } else { xl_setmode(sc, ifm->ifm_media); @@ -3108,10 +3113,8 @@ xl_ioctl(struct ifnet *ifp, u_long comma CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_SET_FILT|rxfilt); XL_SEL_WIN(7); - } else { - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) - xl_init_locked(sc); - } + } else + xl_init_locked(sc); } else { if (ifp->if_drv_flags & IFF_DRV_RUNNING) xl_stop(sc); @@ -3234,6 +3237,7 @@ xl_watchdog(struct xl_softc *sc) "no carrier - transceiver cable problem?\n"); xl_reset(sc); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; xl_init_locked(sc); if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) { @@ -3364,8 +3368,10 @@ xl_resume(device_t dev) XL_LOCK(sc); xl_reset(sc); - if (ifp->if_flags & IFF_UP) + if (ifp->if_flags & IFF_UP) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; xl_init_locked(sc); + } XL_UNLOCK(sc); From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 19:00:16 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 50B97106564A; Fri, 24 Sep 2010 19:00:16 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 254CB8FC0C; Fri, 24 Sep 2010 19:00:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OJ0GUR035725; Fri, 24 Sep 2010 19:00:16 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OJ0Gjw035723; Fri, 24 Sep 2010 19:00:16 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009241900.o8OJ0Gjw035723@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 19:00:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213116 - stable/7/sys/pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:00:16 -0000 Author: yongari Date: Fri Sep 24 19:00:15 2010 New Revision: 213116 URL: http://svn.freebsd.org/changeset/base/213116 Log: MFC r211671: Remove unnecessary controller reinitialization by checking IFF_DRV_RUNNING flag. Modified: stable/7/sys/pci/if_xl.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/pci/if_xl.c ============================================================================== --- stable/7/sys/pci/if_xl.c Fri Sep 24 18:58:04 2010 (r213115) +++ stable/7/sys/pci/if_xl.c Fri Sep 24 19:00:15 2010 (r213116) @@ -2275,6 +2275,7 @@ xl_intr(void *arg) if (status & XL_STAT_ADFAIL) { xl_reset(sc); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; xl_init_locked(sc); } @@ -2343,6 +2344,7 @@ xl_poll_locked(struct ifnet *ifp, enum p if (status & XL_STAT_ADFAIL) { xl_reset(sc); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; xl_init_locked(sc); } @@ -2769,6 +2771,8 @@ xl_init_locked(struct xl_softc *sc) XL_LOCK_ASSERT(sc); + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + return; /* * Cancel pending I/O and free all RX/TX buffers. */ @@ -3017,6 +3021,7 @@ xl_ifmedia_upd(struct ifnet *ifp) if (sc->xl_media & XL_MEDIAOPT_MII || sc->xl_media & XL_MEDIAOPT_BTX || sc->xl_media & XL_MEDIAOPT_BT4) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; xl_init_locked(sc); } else { xl_setmode(sc, ifm->ifm_media); @@ -3132,10 +3137,8 @@ xl_ioctl(struct ifnet *ifp, u_long comma CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_SET_FILT|rxfilt); XL_SEL_WIN(7); - } else { - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) - xl_init_locked(sc); - } + } else + xl_init_locked(sc); } else { if (ifp->if_drv_flags & IFF_DRV_RUNNING) xl_stop(sc); @@ -3258,6 +3261,7 @@ xl_watchdog(struct xl_softc *sc) "no carrier - transceiver cable problem?\n"); xl_reset(sc); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; xl_init_locked(sc); if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) { @@ -3388,8 +3392,10 @@ xl_resume(device_t dev) XL_LOCK(sc); xl_reset(sc); - if (ifp->if_flags & IFF_UP) + if (ifp->if_flags & IFF_UP) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; xl_init_locked(sc); + } XL_UNLOCK(sc); From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 19:04:18 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2954D106566C; Fri, 24 Sep 2010 19:04:18 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0D3038FC0A; Fri, 24 Sep 2010 19:04:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OJ4HQW035875; Fri, 24 Sep 2010 19:04:17 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OJ4HtZ035873; Fri, 24 Sep 2010 19:04:17 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009241904.o8OJ4HtZ035873@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 19:04:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213117 - stable/8/sys/dev/xl X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:04:18 -0000 Author: yongari Date: Fri Sep 24 19:04:17 2010 New Revision: 213117 URL: http://svn.freebsd.org/changeset/base/213117 Log: MFC r211716: Move xl_reset() to xl_init_locked(). This will make driver initialize controller from a known good state. Previously driver used to issue controller reset while TX/RX DMA are in progress. I guess resetting controller in active TX/RX DMA cycle is to ensure stopping I/Os in xl_shutdown(). I remember some buggy controllers didn't respond with stop command if controller is under high network load at the time of shutdown so resetting controller was the only safe way to stop the I/Os. However, from my experiments, controller always responded with stop command under high network load so I think it's okay to remove the xl_reset() in device_shutdown handler. Resetting controller also will clear configured RX filter which in turn will make WOL support hard because driver have to reprogram RX filter in WOL handler as well as setting station address. Modified: stable/8/sys/dev/xl/if_xl.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/xl/if_xl.c ============================================================================== --- stable/8/sys/dev/xl/if_xl.c Fri Sep 24 19:00:15 2010 (r213116) +++ stable/8/sys/dev/xl/if_xl.c Fri Sep 24 19:04:17 2010 (r213117) @@ -1635,7 +1635,6 @@ xl_detach(device_t dev) /* These should only be active if attach succeeded */ if (device_is_attached(dev)) { XL_LOCK(sc); - xl_reset(sc); xl_stop(sc); XL_UNLOCK(sc); taskqueue_drain(taskqueue_swi, &sc->xl_task); @@ -2246,7 +2245,6 @@ xl_intr(void *arg) } if (status & XL_STAT_ADFAIL) { - xl_reset(sc); ifp->if_drv_flags &= ~IFF_DRV_RUNNING; xl_init_locked(sc); } @@ -2318,7 +2316,6 @@ xl_poll_locked(struct ifnet *ifp, enum p } if (status & XL_STAT_ADFAIL) { - xl_reset(sc); ifp->if_drv_flags &= ~IFF_DRV_RUNNING; xl_init_locked(sc); } @@ -2754,6 +2751,9 @@ xl_init_locked(struct xl_softc *sc) */ xl_stop(sc); + /* Reset the chip to a known state. */ + xl_reset(sc); + if (sc->xl_miibus == NULL) { CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_RESET); xl_wait(sc); @@ -3236,7 +3236,6 @@ xl_watchdog(struct xl_softc *sc) device_printf(sc->xl_dev, "no carrier - transceiver cable problem?\n"); - xl_reset(sc); ifp->if_drv_flags &= ~IFF_DRV_RUNNING; xl_init_locked(sc); @@ -3335,7 +3334,6 @@ xl_shutdown(device_t dev) sc = device_get_softc(dev); XL_LOCK(sc); - xl_reset(sc); xl_stop(sc); XL_UNLOCK(sc); @@ -3367,7 +3365,6 @@ xl_resume(device_t dev) XL_LOCK(sc); - xl_reset(sc); if (ifp->if_flags & IFF_UP) { ifp->if_drv_flags &= ~IFF_DRV_RUNNING; xl_init_locked(sc); From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 19:07:14 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 76747106574D; Fri, 24 Sep 2010 19:07:14 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4AD108FC08; Fri, 24 Sep 2010 19:07:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OJ7EYW035995; Fri, 24 Sep 2010 19:07:14 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OJ7EpX035993; Fri, 24 Sep 2010 19:07:14 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009241907.o8OJ7EpX035993@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 19:07:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213118 - stable/7/sys/pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:07:14 -0000 Author: yongari Date: Fri Sep 24 19:07:14 2010 New Revision: 213118 URL: http://svn.freebsd.org/changeset/base/213118 Log: MFC r211716: Move xl_reset() to xl_init_locked(). This will make driver initialize controller from a known good state. Previously driver used to issue controller reset while TX/RX DMA are in progress. I guess resetting controller in active TX/RX DMA cycle is to ensure stopping I/Os in xl_shutdown(). I remember some buggy controllers didn't respond with stop command if controller is under high network load at the time of shutdown so resetting controller was the only safe way to stop the I/Os. However, from my experiments, controller always responded with stop command under high network load so I think it's okay to remove the xl_reset() in device_shutdown handler. Resetting controller also will clear configured RX filter which in turn will make WOL support hard because driver have to reprogram RX filter in WOL handler as well as setting station address. Modified: stable/7/sys/pci/if_xl.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/pci/if_xl.c ============================================================================== --- stable/7/sys/pci/if_xl.c Fri Sep 24 19:04:17 2010 (r213117) +++ stable/7/sys/pci/if_xl.c Fri Sep 24 19:07:14 2010 (r213118) @@ -1666,7 +1666,6 @@ xl_detach(device_t dev) /* These should only be active if attach succeeded */ if (device_is_attached(dev)) { XL_LOCK(sc); - xl_reset(sc); xl_stop(sc); XL_UNLOCK(sc); taskqueue_drain(taskqueue_swi, &sc->xl_task); @@ -2274,7 +2273,6 @@ xl_intr(void *arg) } if (status & XL_STAT_ADFAIL) { - xl_reset(sc); ifp->if_drv_flags &= ~IFF_DRV_RUNNING; xl_init_locked(sc); } @@ -2343,7 +2341,6 @@ xl_poll_locked(struct ifnet *ifp, enum p } if (status & XL_STAT_ADFAIL) { - xl_reset(sc); ifp->if_drv_flags &= ~IFF_DRV_RUNNING; xl_init_locked(sc); } @@ -2778,6 +2775,9 @@ xl_init_locked(struct xl_softc *sc) */ xl_stop(sc); + /* Reset the chip to a known state. */ + xl_reset(sc); + if (sc->xl_miibus == NULL) { CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_RESET); xl_wait(sc); @@ -3260,7 +3260,6 @@ xl_watchdog(struct xl_softc *sc) device_printf(sc->xl_dev, "no carrier - transceiver cable problem?\n"); - xl_reset(sc); ifp->if_drv_flags &= ~IFF_DRV_RUNNING; xl_init_locked(sc); @@ -3359,7 +3358,6 @@ xl_shutdown(device_t dev) sc = device_get_softc(dev); XL_LOCK(sc); - xl_reset(sc); xl_stop(sc); XL_UNLOCK(sc); @@ -3391,7 +3389,6 @@ xl_resume(device_t dev) XL_LOCK(sc); - xl_reset(sc); if (ifp->if_flags & IFF_UP) { ifp->if_drv_flags &= ~IFF_DRV_RUNNING; xl_init_locked(sc); From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 19:08:56 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AF1461065672; Fri, 24 Sep 2010 19:08:56 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9DE318FC12; Fri, 24 Sep 2010 19:08:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OJ8ukM036078; Fri, 24 Sep 2010 19:08:56 GMT (envelope-from mckusick@svn.freebsd.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OJ8uW4036076; Fri, 24 Sep 2010 19:08:56 GMT (envelope-from mckusick@svn.freebsd.org) Message-Id: <201009241908.o8OJ8uW4036076@svn.freebsd.org> From: Kirk McKusick Date: Fri, 24 Sep 2010 19:08:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213119 - head/sbin/newfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:08:56 -0000 Author: mckusick Date: Fri Sep 24 19:08:56 2010 New Revision: 213119 URL: http://svn.freebsd.org/changeset/base/213119 Log: Reported problem: Large (60GB) filesystems created using "newfs -U -O 1 -b 65536 -f 8192" show incorrect results from "df" for free and used space when mounted immediately after creation. fsck on the new filesystem (before ever mounting it once) gives a "SUMMARY INFORMATION BAD" error in phase 5. This error hasn't occurred in any runs of fsck immediately after "newfs -U -b 65536 -f 8192" (leaving out the "-O 1" option). Solution: The default UFS1 superblock is located at offset 8K in the filesystem partition; the default UFS2 superblock is located at offset 64K in the filesystem partition. For UFS1 filesystems with a blocksize of 64K, the first alternate superblock resides at 64K which is the the location used for the default UFS2 superblock. By default, the system first checks for a valid superblock at the default location for a UFS2 filoesystem. For a UFS1 filesystem with a blocksize of 64K, there is a valid UFS1 superblock at this location. Thus, even though it is expected to be a backup superblock, the system will use it as its default superblock. So, we have to ensure that all the statistcs on usage are correct in this first alternate superblock as it is the superblock that will actually be used. While tracking down this problem, another limitation of UFS1 became evident. For UFS1, the number of inodes per cylinder group is stored in an int16_t. Thus the maximum number of inodes per cylinder group is limited to 2^15 - 1. This limit can easily be exceeded for block sizes of 32K and above. Thus when building UFS1 filesystems, newfs must limit the number of inodes per cylinder group to 2^15 - 1. Reported by: Guy Helmer Followup by: Bruce Cran PR: 107692 MFC after: 4 weeks Modified: head/sbin/newfs/mkfs.c Modified: head/sbin/newfs/mkfs.c ============================================================================== --- head/sbin/newfs/mkfs.c Fri Sep 24 19:07:14 2010 (r213118) +++ head/sbin/newfs/mkfs.c Fri Sep 24 19:08:56 2010 (r213119) @@ -376,16 +376,20 @@ restart: * Start packing more blocks into the cylinder group until * it cannot grow any larger, the number of cylinder groups * drops below MINCYLGRPS, or we reach the size requested. + * For UFS1 inodes per cylinder group are stored in an int16_t + * so fs_ipg is limited to 2^15 - 1. */ for ( ; sblock.fs_fpg < maxblkspercg; sblock.fs_fpg += sblock.fs_frag) { sblock.fs_ipg = roundup(howmany(sblock.fs_fpg, fragsperinode), INOPB(&sblock)); - if (sblock.fs_size / sblock.fs_fpg < MINCYLGRPS) - break; - if (CGSIZE(&sblock) < (unsigned long)sblock.fs_bsize) - continue; - if (CGSIZE(&sblock) == (unsigned long)sblock.fs_bsize) - break; + if (Oflag > 1 || (Oflag == 1 && sblock.fs_ipg <= 0x7fff)) { + if (sblock.fs_size / sblock.fs_fpg < MINCYLGRPS) + break; + if (CGSIZE(&sblock) < (unsigned long)sblock.fs_bsize) + continue; + if (CGSIZE(&sblock) == (unsigned long)sblock.fs_bsize) + break; + } sblock.fs_fpg -= sblock.fs_frag; sblock.fs_ipg = roundup(howmany(sblock.fs_fpg, fragsperinode), INOPB(&sblock)); @@ -584,8 +588,20 @@ restart: printf("** Exiting on Xflag 3\n"); exit(0); } - if (!Nflag) + if (!Nflag) { do_sbwrite(&disk); + /* + * For UFS1 filesystems with a blocksize of 64K, the first + * alternate superblock resides at the location used for + * the default UFS2 superblock. As there is a valid + * superblock at this location, the boot code will use + * it as its first choice. Thus we have to ensure that + * all of its statistcs on usage are correct. + */ + if (Oflag == 1 && sblock.fs_bsize == 65536) + wtfs(fsbtodb(&sblock, cgsblock(&sblock, 0)), + sblock.fs_bsize, (char *)&sblock); + } for (i = 0; i < sblock.fs_cssize; i += sblock.fs_bsize) wtfs(fsbtodb(&sblock, sblock.fs_csaddr + numfrags(&sblock, i)), sblock.fs_cssize - i < sblock.fs_bsize ? From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 19:09:23 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DB5901065695; Fri, 24 Sep 2010 19:09:23 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AF0588FC18; Fri, 24 Sep 2010 19:09:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OJ9NAb036130; Fri, 24 Sep 2010 19:09:23 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OJ9NS5036127; Fri, 24 Sep 2010 19:09:23 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009241909.o8OJ9NS5036127@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 19:09:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213120 - stable/8/sys/dev/xl X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:09:24 -0000 Author: yongari Date: Fri Sep 24 19:09:23 2010 New Revision: 213120 URL: http://svn.freebsd.org/changeset/base/213120 Log: MFC r211717: Implement basic WOL support. Note, not all xl(4) controllers support WOL. Some controllers require additional 3-wire auxiliary remote wakeup connector to draw power. More recent xl(4) controllers may not need the wakeup connector though. Modified: stable/8/sys/dev/xl/if_xl.c stable/8/sys/dev/xl/if_xlreg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/xl/if_xl.c ============================================================================== --- stable/8/sys/dev/xl/if_xl.c Fri Sep 24 19:08:56 2010 (r213119) +++ stable/8/sys/dev/xl/if_xl.c Fri Sep 24 19:09:23 2010 (r213120) @@ -246,6 +246,7 @@ static int xl_watchdog(struct xl_softc * static int xl_shutdown(device_t); static int xl_suspend(device_t); static int xl_resume(device_t); +static void xl_setwol(struct xl_softc *); #ifdef DEVICE_POLLING static int xl_poll(struct ifnet *ifp, enum poll_cmd cmd, int count); @@ -1145,10 +1146,10 @@ static int xl_attach(device_t dev) { u_char eaddr[ETHER_ADDR_LEN]; - u_int16_t xcvr[2]; + u_int16_t sinfo2, xcvr[2]; struct xl_softc *sc; struct ifnet *ifp; - int media; + int media, pmcap; int unit, error = 0, rid, res; uint16_t did; @@ -1405,6 +1406,18 @@ xl_attach(device_t dev) else sc->xl_type = XL_TYPE_90X; + /* Check availability of WOL. */ + if ((sc->xl_caps & XL_CAPS_PWRMGMT) != 0 && + pci_find_extcap(dev, PCIY_PMG, &pmcap) == 0) { + sc->xl_pmcap = pmcap; + sc->xl_flags |= XL_FLAG_WOL; + sinfo2 = 0; + xl_read_eeprom(sc, (caddr_t)&sinfo2, XL_EE_SOFTINFO2, 1, 0); + if ((sinfo2 & XL_SINFO2_AUX_WOL_CON) == 0 && bootverbose) + device_printf(dev, + "No auxiliary remote wakeup connector!\n"); + } + /* Set the TX start threshold for best performance. */ sc->xl_tx_thresh = XL_MIN_FRAMELEN; @@ -1419,6 +1432,8 @@ xl_attach(device_t dev) ifp->if_capabilities |= IFCAP_HWCSUM; #endif } + if ((sc->xl_flags & XL_FLAG_WOL) != 0) + ifp->if_capabilities |= IFCAP_WOL_MAGIC; ifp->if_capenable = ifp->if_capabilities; #ifdef DEVICE_POLLING ifp->if_capabilities |= IFCAP_POLLING; @@ -2765,6 +2780,15 @@ xl_init_locked(struct xl_softc *sc) if (sc->xl_miibus != NULL) mii = device_get_softc(sc->xl_miibus); + /* + * Clear WOL status and disable all WOL feature as WOL + * would interfere Rx operation under normal environments. + */ + if ((sc->xl_flags & XL_FLAG_WOL) != 0) { + XL_SEL_WIN(7); + CSR_READ_2(sc, XL_W7_BM_PME); + CSR_WRITE_2(sc, XL_W7_BM_PME, 0); + } /* Init our MAC address */ XL_SEL_WIN(2); for (i = 0; i < ETHER_ADDR_LEN; i++) { @@ -3187,6 +3211,9 @@ xl_ioctl(struct ifnet *ifp, u_long comma if ((mask & IFCAP_RXCSUM) != 0 && (ifp->if_capabilities & IFCAP_RXCSUM) != 0) ifp->if_capenable ^= IFCAP_RXCSUM; + if ((mask & IFCAP_WOL_MAGIC) != 0 && + (ifp->if_capabilities & IFCAP_WOL_MAGIC) != 0) + ifp->if_capenable ^= IFCAP_WOL_MAGIC; XL_UNLOCK(sc); break; default: @@ -3329,15 +3356,8 @@ xl_stop(struct xl_softc *sc) static int xl_shutdown(device_t dev) { - struct xl_softc *sc; - - sc = device_get_softc(dev); - - XL_LOCK(sc); - xl_stop(sc); - XL_UNLOCK(sc); - return (0); + return (xl_suspend(dev)); } static int @@ -3349,6 +3369,7 @@ xl_suspend(device_t dev) XL_LOCK(sc); xl_stop(sc); + xl_setwol(sc); XL_UNLOCK(sc); return (0); @@ -3374,3 +3395,34 @@ xl_resume(device_t dev) return (0); } + +static void +xl_setwol(struct xl_softc *sc) +{ + struct ifnet *ifp; + u_int16_t cfg, pmstat; + + if ((sc->xl_flags & XL_FLAG_WOL) == 0) + return; + + ifp = sc->xl_ifp; + XL_SEL_WIN(7); + /* Clear any pending PME events. */ + CSR_READ_2(sc, XL_W7_BM_PME); + cfg = 0; + if ((ifp->if_capenable & IFCAP_WOL_MAGIC) != 0) + cfg |= XL_BM_PME_MAGIC; + CSR_WRITE_2(sc, XL_W7_BM_PME, cfg); + /* Enable RX. */ + if ((ifp->if_capenable & IFCAP_WOL_MAGIC) != 0) + CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_ENABLE); + /* Request PME. */ + pmstat = pci_read_config(sc->xl_dev, + sc->xl_pmcap + PCIR_POWER_STATUS, 2); + if ((ifp->if_capenable & IFCAP_WOL_MAGIC) != 0) + pmstat |= PCIM_PSTAT_PMEENABLE; + else + pmstat &= ~PCIM_PSTAT_PMEENABLE; + pci_write_config(sc->xl_dev, + sc->xl_pmcap + PCIR_POWER_STATUS, pmstat, 2); +} Modified: stable/8/sys/dev/xl/if_xlreg.h ============================================================================== --- stable/8/sys/dev/xl/if_xlreg.h Fri Sep 24 19:08:56 2010 (r213119) +++ stable/8/sys/dev/xl/if_xlreg.h Fri Sep 24 19:09:23 2010 (r213120) @@ -81,6 +81,17 @@ #define XL_CAPS_100MBPS 0x1000 #define XL_CAPS_PWRMGMT 0x2000 +/* + * Bits in the software information 2 word + */ +#define XL_SINFO2_FIXED_BCAST_RX_BUG 0x0002 +#define XL_SINFO2_FIXED_ENDEC_LOOP_BUG 0x0004 +#define XL_SINFO2_AUX_WOL_CON 0x0008 +#define XL_SINFO2_PME_PULSED 0x0010 +#define XL_SINFO2_FIXED_MWI_BUG 0x0020 +#define XL_SINFO2_WOL_AFTER_PWR_LOSS 0x0040 +#define XL_SINFO2_AUTO_RST_TO_D0 0x0080 + #define XL_PACKET_SIZE 1540 #define XL_MAX_FRAMELEN (ETHER_MAX_LEN + ETHER_VLAN_ENCAP_LEN) @@ -408,7 +419,12 @@ #define XL_W7_BM_LEN 0x06 #define XL_W7_BM_STATUS 0x0B #define XL_W7_BM_TIMEr 0x0A +#define XL_W7_BM_PME 0x0C +#define XL_BM_PME_WAKE 0x0001 +#define XL_BM_PME_MAGIC 0x0002 +#define XL_BM_PME_LINKCHG 0x0004 +#define XL_BM_PME_WAKETIMER 0x0008 /* * bus master control registers */ @@ -577,6 +593,7 @@ struct xl_mii_frame { #define XL_FLAG_NO_XCVR_PWR 0x0080 #define XL_FLAG_USE_MMIO 0x0100 #define XL_FLAG_NO_MMIO 0x0200 +#define XL_FLAG_WOL 0x0400 #define XL_NO_XCVR_PWR_MAGICBITS 0x0900 @@ -599,6 +616,7 @@ struct xl_softc { u_int16_t xl_caps; u_int8_t xl_stats_no_timeout; u_int16_t xl_tx_thresh; + int xl_pmcap; int xl_if_flags; struct xl_list_data xl_ldata; struct xl_chain_data xl_cdata; From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 19:11:23 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B7B2106566B; Fri, 24 Sep 2010 19:11:23 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 105228FC16; Fri, 24 Sep 2010 19:11:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OJBM9t036350; Fri, 24 Sep 2010 19:11:22 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OJBMg9036347; Fri, 24 Sep 2010 19:11:22 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009241911.o8OJBMg9036347@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 19:11:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213121 - stable/7/sys/pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:11:23 -0000 Author: yongari Date: Fri Sep 24 19:11:22 2010 New Revision: 213121 URL: http://svn.freebsd.org/changeset/base/213121 Log: MFC r211717: Implement basic WOL support. Note, not all xl(4) controllers support WOL. Some controllers require additional 3-wire auxiliary remote wakeup connector to draw power. More recent xl(4) controllers may not need the wakeup connector though. Modified: stable/7/sys/pci/if_xl.c stable/7/sys/pci/if_xlreg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/pci/if_xl.c ============================================================================== --- stable/7/sys/pci/if_xl.c Fri Sep 24 19:09:23 2010 (r213120) +++ stable/7/sys/pci/if_xl.c Fri Sep 24 19:11:22 2010 (r213121) @@ -249,6 +249,7 @@ static int xl_watchdog(struct xl_softc * static int xl_shutdown(device_t); static int xl_suspend(device_t); static int xl_resume(device_t); +static void xl_setwol(struct xl_softc *); #ifdef DEVICE_POLLING static void xl_poll(struct ifnet *ifp, enum poll_cmd cmd, int count); @@ -1175,10 +1176,10 @@ static int xl_attach(device_t dev) { u_char eaddr[ETHER_ADDR_LEN]; - u_int16_t xcvr[2]; + u_int16_t sinfo2, xcvr[2]; struct xl_softc *sc; struct ifnet *ifp; - int media; + int media, pmcap; int unit, error = 0, rid, res; uint16_t did; @@ -1436,6 +1437,18 @@ xl_attach(device_t dev) else sc->xl_type = XL_TYPE_90X; + /* Check availability of WOL. */ + if ((sc->xl_caps & XL_CAPS_PWRMGMT) != 0 && + pci_find_extcap(dev, PCIY_PMG, &pmcap) == 0) { + sc->xl_pmcap = pmcap; + sc->xl_flags |= XL_FLAG_WOL; + sinfo2 = 0; + xl_read_eeprom(sc, (caddr_t)&sinfo2, XL_EE_SOFTINFO2, 1, 0); + if ((sinfo2 & XL_SINFO2_AUX_WOL_CON) == 0 && bootverbose) + device_printf(dev, + "No auxiliary remote wakeup connector!\n"); + } + /* Set the TX start threshold for best performance. */ sc->xl_tx_thresh = XL_MIN_FRAMELEN; @@ -1450,6 +1463,8 @@ xl_attach(device_t dev) ifp->if_capabilities |= IFCAP_HWCSUM; #endif } + if ((sc->xl_flags & XL_FLAG_WOL) != 0) + ifp->if_capabilities |= IFCAP_WOL_MAGIC; ifp->if_capenable = ifp->if_capabilities; #ifdef DEVICE_POLLING ifp->if_capabilities |= IFCAP_POLLING; @@ -2789,6 +2804,15 @@ xl_init_locked(struct xl_softc *sc) if (sc->xl_miibus != NULL) mii = device_get_softc(sc->xl_miibus); + /* + * Clear WOL status and disable all WOL feature as WOL + * would interfere Rx operation under normal environments. + */ + if ((sc->xl_flags & XL_FLAG_WOL) != 0) { + XL_SEL_WIN(7); + CSR_READ_2(sc, XL_W7_BM_PME); + CSR_WRITE_2(sc, XL_W7_BM_PME, 0); + } /* Init our MAC address */ XL_SEL_WIN(2); for (i = 0; i < ETHER_ADDR_LEN; i++) { @@ -3211,6 +3235,9 @@ xl_ioctl(struct ifnet *ifp, u_long comma if ((mask & IFCAP_RXCSUM) != 0 && (ifp->if_capabilities & IFCAP_RXCSUM) != 0) ifp->if_capenable ^= IFCAP_RXCSUM; + if ((mask & IFCAP_WOL_MAGIC) != 0 && + (ifp->if_capabilities & IFCAP_WOL_MAGIC) != 0) + ifp->if_capenable ^= IFCAP_WOL_MAGIC; XL_UNLOCK(sc); break; default: @@ -3353,15 +3380,8 @@ xl_stop(struct xl_softc *sc) static int xl_shutdown(device_t dev) { - struct xl_softc *sc; - - sc = device_get_softc(dev); - - XL_LOCK(sc); - xl_stop(sc); - XL_UNLOCK(sc); - return (0); + return (xl_suspend(dev)); } static int @@ -3373,6 +3393,7 @@ xl_suspend(device_t dev) XL_LOCK(sc); xl_stop(sc); + xl_setwol(sc); XL_UNLOCK(sc); return (0); @@ -3398,3 +3419,34 @@ xl_resume(device_t dev) return (0); } + +static void +xl_setwol(struct xl_softc *sc) +{ + struct ifnet *ifp; + u_int16_t cfg, pmstat; + + if ((sc->xl_flags & XL_FLAG_WOL) == 0) + return; + + ifp = sc->xl_ifp; + XL_SEL_WIN(7); + /* Clear any pending PME events. */ + CSR_READ_2(sc, XL_W7_BM_PME); + cfg = 0; + if ((ifp->if_capenable & IFCAP_WOL_MAGIC) != 0) + cfg |= XL_BM_PME_MAGIC; + CSR_WRITE_2(sc, XL_W7_BM_PME, cfg); + /* Enable RX. */ + if ((ifp->if_capenable & IFCAP_WOL_MAGIC) != 0) + CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_ENABLE); + /* Request PME. */ + pmstat = pci_read_config(sc->xl_dev, + sc->xl_pmcap + PCIR_POWER_STATUS, 2); + if ((ifp->if_capenable & IFCAP_WOL_MAGIC) != 0) + pmstat |= PCIM_PSTAT_PMEENABLE; + else + pmstat &= ~PCIM_PSTAT_PMEENABLE; + pci_write_config(sc->xl_dev, + sc->xl_pmcap + PCIR_POWER_STATUS, pmstat, 2); +} Modified: stable/7/sys/pci/if_xlreg.h ============================================================================== --- stable/7/sys/pci/if_xlreg.h Fri Sep 24 19:09:23 2010 (r213120) +++ stable/7/sys/pci/if_xlreg.h Fri Sep 24 19:11:22 2010 (r213121) @@ -81,6 +81,17 @@ #define XL_CAPS_100MBPS 0x1000 #define XL_CAPS_PWRMGMT 0x2000 +/* + * Bits in the software information 2 word + */ +#define XL_SINFO2_FIXED_BCAST_RX_BUG 0x0002 +#define XL_SINFO2_FIXED_ENDEC_LOOP_BUG 0x0004 +#define XL_SINFO2_AUX_WOL_CON 0x0008 +#define XL_SINFO2_PME_PULSED 0x0010 +#define XL_SINFO2_FIXED_MWI_BUG 0x0020 +#define XL_SINFO2_WOL_AFTER_PWR_LOSS 0x0040 +#define XL_SINFO2_AUTO_RST_TO_D0 0x0080 + #define XL_PACKET_SIZE 1540 #define XL_MAX_FRAMELEN (ETHER_MAX_LEN + ETHER_VLAN_ENCAP_LEN) @@ -408,7 +419,12 @@ #define XL_W7_BM_LEN 0x06 #define XL_W7_BM_STATUS 0x0B #define XL_W7_BM_TIMEr 0x0A +#define XL_W7_BM_PME 0x0C +#define XL_BM_PME_WAKE 0x0001 +#define XL_BM_PME_MAGIC 0x0002 +#define XL_BM_PME_LINKCHG 0x0004 +#define XL_BM_PME_WAKETIMER 0x0008 /* * bus master control registers */ @@ -577,6 +593,7 @@ struct xl_mii_frame { #define XL_FLAG_NO_XCVR_PWR 0x0080 #define XL_FLAG_USE_MMIO 0x0100 #define XL_FLAG_NO_MMIO 0x0200 +#define XL_FLAG_WOL 0x0400 #define XL_NO_XCVR_PWR_MAGICBITS 0x0900 @@ -600,6 +617,7 @@ struct xl_softc { u_int16_t xl_caps; u_int8_t xl_stats_no_timeout; u_int16_t xl_tx_thresh; + int xl_pmcap; int xl_if_flags; struct xl_list_data xl_ldata; struct xl_chain_data xl_cdata; From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 19:13:43 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CEF4F106566C; Fri, 24 Sep 2010 19:13:43 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BDB628FC20; Fri, 24 Sep 2010 19:13:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OJDhMw036435; Fri, 24 Sep 2010 19:13:43 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OJDhkm036433; Fri, 24 Sep 2010 19:13:43 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009241913.o8OJDhkm036433@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 19:13:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213122 - stable/8/sys/dev/ed X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:13:43 -0000 Author: yongari Date: Fri Sep 24 19:13:43 2010 New Revision: 213122 URL: http://svn.freebsd.org/changeset/base/213122 Log: MFC r211721: Fix a possible unaligned access to savebyte array. PR: kern/122195 Modified: stable/8/sys/dev/ed/if_ed.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/ed/if_ed.c ============================================================================== --- stable/8/sys/dev/ed/if_ed.c Fri Sep 24 19:11:22 2010 (r213121) +++ stable/8/sys/dev/ed/if_ed.c Fri Sep 24 19:13:43 2010 (r213122) @@ -1462,9 +1462,12 @@ ed_pio_write_mbufs(struct ed_softc *sc, } } else { /* NE2000s are a pain */ - unsigned char *data; + uint8_t *data; int len, wantbyte; - unsigned char savebyte[2]; + union { + uint16_t w; + uint8_t b[2]; + } saveword; wantbyte = 0; @@ -1474,9 +1477,9 @@ ed_pio_write_mbufs(struct ed_softc *sc, data = mtod(m, caddr_t); /* finish the last word */ if (wantbyte) { - savebyte[1] = *data; + saveword.b[1] = *data; ed_asic_outw(sc, ED_NOVELL_DATA, - *(u_short *)savebyte); + saveword.w); data++; len--; wantbyte = 0; @@ -1490,7 +1493,7 @@ ed_pio_write_mbufs(struct ed_softc *sc, } /* save last byte, if necessary */ if (len == 1) { - savebyte[0] = *data; + saveword.b[0] = *data; wantbyte = 1; } } @@ -1498,7 +1501,7 @@ ed_pio_write_mbufs(struct ed_softc *sc, } /* spit last byte */ if (wantbyte) - ed_asic_outw(sc, ED_NOVELL_DATA, *(u_short *)savebyte); + ed_asic_outw(sc, ED_NOVELL_DATA, saveword.w); } /* From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 19:15:00 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5FED6106566B; Fri, 24 Sep 2010 19:15:00 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4E8468FC13; Fri, 24 Sep 2010 19:15:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OJF0KE036509; Fri, 24 Sep 2010 19:15:00 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OJF09n036506; Fri, 24 Sep 2010 19:15:00 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009241915.o8OJF09n036506@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 19:15:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213123 - stable/7/sys/dev/ed X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:15:00 -0000 Author: yongari Date: Fri Sep 24 19:14:59 2010 New Revision: 213123 URL: http://svn.freebsd.org/changeset/base/213123 Log: MFC r211721: Fix a possible unaligned access to savebyte array. PR: kern/122195 Modified: stable/7/sys/dev/ed/if_ed.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/ed/if_ed.c ============================================================================== --- stable/7/sys/dev/ed/if_ed.c Fri Sep 24 19:13:43 2010 (r213122) +++ stable/7/sys/dev/ed/if_ed.c Fri Sep 24 19:14:59 2010 (r213123) @@ -1457,9 +1457,12 @@ ed_pio_write_mbufs(struct ed_softc *sc, } } else { /* NE2000s are a pain */ - unsigned char *data; + uint8_t *data; int len, wantbyte; - unsigned char savebyte[2]; + union { + uint16_t w; + uint8_t b[2]; + } saveword; wantbyte = 0; @@ -1469,9 +1472,9 @@ ed_pio_write_mbufs(struct ed_softc *sc, data = mtod(m, caddr_t); /* finish the last word */ if (wantbyte) { - savebyte[1] = *data; + saveword.b[1] = *data; ed_asic_outw(sc, ED_NOVELL_DATA, - *(u_short *)savebyte); + saveword.w); data++; len--; wantbyte = 0; @@ -1485,7 +1488,7 @@ ed_pio_write_mbufs(struct ed_softc *sc, } /* save last byte, if necessary */ if (len == 1) { - savebyte[0] = *data; + saveword.b[0] = *data; wantbyte = 1; } } @@ -1493,7 +1496,7 @@ ed_pio_write_mbufs(struct ed_softc *sc, } /* spit last byte */ if (wantbyte) - ed_asic_outw(sc, ED_NOVELL_DATA, *(u_short *)savebyte); + ed_asic_outw(sc, ED_NOVELL_DATA, saveword.w); } /* From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 19:15:29 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ABB4F10656C0; Fri, 24 Sep 2010 19:15:29 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 54AC28FC0A; Fri, 24 Sep 2010 19:15:29 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 2AA0945CD9; Fri, 24 Sep 2010 21:15:28 +0200 (CEST) Received: from localhost (chello089077043238.chello.pl [89.77.43.238]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id 7FF9445C99; Fri, 24 Sep 2010 21:15:22 +0200 (CEST) Date: Fri, 24 Sep 2010 21:15:04 +0200 From: Pawel Jakub Dawidek To: "Andrey V. Elsukov" Message-ID: <20100924191504.GC2236@garage.freebsd.pl> References: <201009240840.o8O8eha0095301@svn.freebsd.org> <4C9C740D.20406@yandex.ru> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="B4IIlcmfBL/1gGOG" Content-Disposition: inline In-Reply-To: <4C9C740D.20406@yandex.ru> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 9.0-CURRENT amd64 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-0.6 required=4.5 tests=BAYES_00,RCVD_IN_SORBS_DUL autolearn=no version=3.0.4 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, pluknet , src-committers@freebsd.org Subject: Re: svn commit: r213097 - head/sbin/geom/class/part X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:15:29 -0000 --B4IIlcmfBL/1gGOG Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Sep 24, 2010 at 01:49:01PM +0400, Andrey V. Elsukov wrote: > On 24.09.2010 13:29, pluknet wrote: > >> Log: > >> Implement "force" (-F) option for gpart destroy verb. > >=20 > > Thank you very much! This is a very useful feature. > > Will you MFC it to RELENG_8? >=20 > It depends when pjd will do MFC of recent geom(8) stuff. If you are talking about G_TYPE_ASCNUM removal, I probably won't MFC it. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --B4IIlcmfBL/1gGOG Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkyc+LcACgkQForvXbEpPzQL9QCgv1NsTyIe3L82pqni6+13pQXv vHsAoMFIM0MzK+W4l82kuGNCCz+41x+N =30cR -----END PGP SIGNATURE----- --B4IIlcmfBL/1gGOG-- From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 19:16:43 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 379F1106564A; Fri, 24 Sep 2010 19:16:43 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2645F8FC13; Fri, 24 Sep 2010 19:16:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OJGhxM036595; Fri, 24 Sep 2010 19:16:43 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OJGhwi036593; Fri, 24 Sep 2010 19:16:43 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009241916.o8OJGhwi036593@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 19:16:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213124 - stable/8/sys/dev/ed X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:16:43 -0000 Author: yongari Date: Fri Sep 24 19:16:42 2010 New Revision: 213124 URL: http://svn.freebsd.org/changeset/base/213124 Log: MFC r211764: Add PNP id for Compex RL2000. I'm not sure whether adding this logical id is correct or not because Compex RL2000 is in the list of supported hardware list. I guess the Compex RL2000 could be PCI variant while the controller in question is ISA controller. It seems PNP compat id didn't match or it had multiple compat ids so isa_pnp_probe() seemed to return ENOENT. PR: kern/80853 Modified: stable/8/sys/dev/ed/if_ed_isa.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/ed/if_ed_isa.c ============================================================================== --- stable/8/sys/dev/ed/if_ed_isa.c Fri Sep 24 19:14:59 2010 (r213123) +++ stable/8/sys/dev/ed/if_ed_isa.c Fri Sep 24 19:16:42 2010 (r213124) @@ -58,6 +58,7 @@ static struct isa_pnp_id ed_ids[] = { { 0x0131d805, NULL }, /* ANX3101 */ { 0x4cf48906, NULL }, /* ATIf44c */ { 0x01200507, NULL }, /* AXE2001 */ + { 0x0115180e, NULL }, /* CPX1501 */ { 0x0090252a, NULL }, /* JQE9000 */ { 0x0020832e, NULL }, /* KTC2000 */ { 0xd680d041, NULL }, /* PNP80d6 */ From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 19:18:03 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD580106564A; Fri, 24 Sep 2010 19:18:03 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CC30B8FC21; Fri, 24 Sep 2010 19:18:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OJI3lK036674; Fri, 24 Sep 2010 19:18:03 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OJI3R5036672; Fri, 24 Sep 2010 19:18:03 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009241918.o8OJI3R5036672@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 19:18:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213125 - stable/7/sys/dev/ed X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:18:04 -0000 Author: yongari Date: Fri Sep 24 19:18:03 2010 New Revision: 213125 URL: http://svn.freebsd.org/changeset/base/213125 Log: MFC r211764: Add PNP id for Compex RL2000. I'm not sure whether adding this logical id is correct or not because Compex RL2000 is in the list of supported hardware list. I guess the Compex RL2000 could be PCI variant while the controller in question is ISA controller. It seems PNP compat id didn't match or it had multiple compat ids so isa_pnp_probe() seemed to return ENOENT. PR: kern/80853 Modified: stable/7/sys/dev/ed/if_ed_isa.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/ed/if_ed_isa.c ============================================================================== --- stable/7/sys/dev/ed/if_ed_isa.c Fri Sep 24 19:16:42 2010 (r213124) +++ stable/7/sys/dev/ed/if_ed_isa.c Fri Sep 24 19:18:03 2010 (r213125) @@ -58,6 +58,7 @@ static struct isa_pnp_id ed_ids[] = { { 0x0131d805, NULL }, /* ANX3101 */ { 0x4cf48906, NULL }, /* ATIf44c */ { 0x01200507, NULL }, /* AXE2001 */ + { 0x0115180e, NULL }, /* CPX1501 */ { 0x0090252a, NULL }, /* JQE9000 */ { 0x0020832e, NULL }, /* KTC2000 */ { 0xd680d041, NULL }, /* PNP80d6 */ From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 19:19:53 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AC728106564A; Fri, 24 Sep 2010 19:19:53 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9B2758FC14; Fri, 24 Sep 2010 19:19:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OJJrSO036754; Fri, 24 Sep 2010 19:19:53 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OJJrbx036752; Fri, 24 Sep 2010 19:19:53 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009241919.o8OJJrbx036752@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 19:19:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213126 - stable/8/sys/dev/vr X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:19:53 -0000 Author: yongari Date: Fri Sep 24 19:19:53 2010 New Revision: 213126 URL: http://svn.freebsd.org/changeset/base/213126 Log: MFC r211765: Remove unnecessary controller reinitialization. CAM filter handling was rewritten long time ago so it should not require controller reinitialization. PR: kern/87506 Modified: stable/8/sys/dev/vr/if_vr.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/vr/if_vr.c ============================================================================== --- stable/8/sys/dev/vr/if_vr.c Fri Sep 24 19:18:03 2010 (r213125) +++ stable/8/sys/dev/vr/if_vr.c Fri Sep 24 19:19:53 2010 (r213126) @@ -1560,6 +1560,7 @@ vr_tick(void *xsc) sc->vr_stat.num_restart++; vr_stop(sc); vr_reset(sc); + sc->vr_ifp->if_drv_flags &= ~IFF_DRV_RUNNING; vr_init_locked(sc); sc->vr_flags &= ~VR_F_RESTART; } @@ -2016,6 +2017,9 @@ vr_init_locked(struct vr_softc *sc) ifp = sc->vr_ifp; mii = device_get_softc(sc->vr_miibus); + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + return; + /* Cancel pending I/O and free all RX/TX buffers. */ vr_stop(sc); vr_reset(sc); @@ -2287,6 +2291,7 @@ vr_watchdog(struct vr_softc *sc) if_printf(sc->vr_ifp, "watchdog timeout " "(missed link)\n"); ifp->if_oerrors++; + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; vr_init_locked(sc); return; } @@ -2296,6 +2301,7 @@ vr_watchdog(struct vr_softc *sc) vr_stop(sc); vr_reset(sc); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; vr_init_locked(sc); if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 19:22:41 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 80C901065670; Fri, 24 Sep 2010 19:22:41 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6F82B8FC20; Fri, 24 Sep 2010 19:22:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OJMfPq036872; Fri, 24 Sep 2010 19:22:41 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OJMfvT036870; Fri, 24 Sep 2010 19:22:41 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009241922.o8OJMfvT036870@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 19:22:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213127 - stable/7/sys/dev/vr X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:22:41 -0000 Author: yongari Date: Fri Sep 24 19:22:41 2010 New Revision: 213127 URL: http://svn.freebsd.org/changeset/base/213127 Log: MFC r211765: Remove unnecessary controller reinitialization. CAM filter handling was rewritten long time ago so it should not require controller reinitialization. PR: kern/87506 Modified: stable/7/sys/dev/vr/if_vr.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/vr/if_vr.c ============================================================================== --- stable/7/sys/dev/vr/if_vr.c Fri Sep 24 19:19:53 2010 (r213126) +++ stable/7/sys/dev/vr/if_vr.c Fri Sep 24 19:22:41 2010 (r213127) @@ -1557,6 +1557,7 @@ vr_tick(void *xsc) sc->vr_stat.num_restart++; vr_stop(sc); vr_reset(sc); + sc->vr_ifp->if_drv_flags &= ~IFF_DRV_RUNNING; vr_init_locked(sc); sc->vr_flags &= ~VR_F_RESTART; } @@ -2008,6 +2009,9 @@ vr_init_locked(struct vr_softc *sc) ifp = sc->vr_ifp; mii = device_get_softc(sc->vr_miibus); + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + return; + /* Cancel pending I/O and free all RX/TX buffers. */ vr_stop(sc); vr_reset(sc); @@ -2279,6 +2283,7 @@ vr_watchdog(struct vr_softc *sc) if_printf(sc->vr_ifp, "watchdog timeout " "(missed link)\n"); ifp->if_oerrors++; + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; vr_init_locked(sc); return; } @@ -2288,6 +2293,7 @@ vr_watchdog(struct vr_softc *sc) vr_stop(sc); vr_reset(sc); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; vr_init_locked(sc); if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 19:24:46 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4DA32106566C; Fri, 24 Sep 2010 19:24:46 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3C7F38FC20; Fri, 24 Sep 2010 19:24:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OJOktZ036966; Fri, 24 Sep 2010 19:24:46 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OJOkaQ036964; Fri, 24 Sep 2010 19:24:46 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009241924.o8OJOkaQ036964@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 19:24:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213128 - stable/8/sys/dev/vr X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:24:46 -0000 Author: yongari Date: Fri Sep 24 19:24:45 2010 New Revision: 213128 URL: http://svn.freebsd.org/changeset/base/213128 Log: MFC r211766: vr_init_locked() will stop and reset the controller. Remove unnecessary vr_stop()/vr_reset() calls. Modified: stable/8/sys/dev/vr/if_vr.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/vr/if_vr.c ============================================================================== --- stable/8/sys/dev/vr/if_vr.c Fri Sep 24 19:22:41 2010 (r213127) +++ stable/8/sys/dev/vr/if_vr.c Fri Sep 24 19:24:45 2010 (r213128) @@ -1558,8 +1558,6 @@ vr_tick(void *xsc) if ((sc->vr_flags & VR_F_RESTART) != 0) { device_printf(sc->vr_dev, "restarting\n"); sc->vr_stat.num_restart++; - vr_stop(sc); - vr_reset(sc); sc->vr_ifp->if_drv_flags &= ~IFF_DRV_RUNNING; vr_init_locked(sc); sc->vr_flags &= ~VR_F_RESTART; @@ -2299,8 +2297,6 @@ vr_watchdog(struct vr_softc *sc) ifp->if_oerrors++; if_printf(ifp, "watchdog timeout\n"); - vr_stop(sc); - vr_reset(sc); ifp->if_drv_flags &= ~IFF_DRV_RUNNING; vr_init_locked(sc); From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 19:26:27 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B2E49106566B; Fri, 24 Sep 2010 19:26:27 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A1C0A8FC18; Fri, 24 Sep 2010 19:26:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OJQRFK037050; Fri, 24 Sep 2010 19:26:27 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OJQRsS037048; Fri, 24 Sep 2010 19:26:27 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009241926.o8OJQRsS037048@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 19:26:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213129 - stable/7/sys/dev/vr X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:26:27 -0000 Author: yongari Date: Fri Sep 24 19:26:27 2010 New Revision: 213129 URL: http://svn.freebsd.org/changeset/base/213129 Log: MFC r211766: vr_init_locked() will stop and reset the controller. Remove unnecessary vr_stop()/vr_reset() calls. Modified: stable/7/sys/dev/vr/if_vr.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/vr/if_vr.c ============================================================================== --- stable/7/sys/dev/vr/if_vr.c Fri Sep 24 19:24:45 2010 (r213128) +++ stable/7/sys/dev/vr/if_vr.c Fri Sep 24 19:26:27 2010 (r213129) @@ -1555,8 +1555,6 @@ vr_tick(void *xsc) if ((sc->vr_flags & VR_F_RESTART) != 0) { device_printf(sc->vr_dev, "restarting\n"); sc->vr_stat.num_restart++; - vr_stop(sc); - vr_reset(sc); sc->vr_ifp->if_drv_flags &= ~IFF_DRV_RUNNING; vr_init_locked(sc); sc->vr_flags &= ~VR_F_RESTART; @@ -2291,8 +2289,6 @@ vr_watchdog(struct vr_softc *sc) ifp->if_oerrors++; if_printf(ifp, "watchdog timeout\n"); - vr_stop(sc); - vr_reset(sc); ifp->if_drv_flags &= ~IFF_DRV_RUNNING; vr_init_locked(sc); From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 19:27:47 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DDB81106566B; Fri, 24 Sep 2010 19:27:47 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B23FF8FC14; Fri, 24 Sep 2010 19:27:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OJRlQp037126; Fri, 24 Sep 2010 19:27:47 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OJRl6l037124; Fri, 24 Sep 2010 19:27:47 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009241927.o8OJRl6l037124@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 19:27:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213130 - stable/8/sys/pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:27:48 -0000 Author: yongari Date: Fri Sep 24 19:27:47 2010 New Revision: 213130 URL: http://svn.freebsd.org/changeset/base/213130 Log: MFC r211767: Remove unnecessary controller reinitialization. PR: kern/87506 Modified: stable/8/sys/pci/if_rl.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/pci/if_rl.c ============================================================================== --- stable/8/sys/pci/if_rl.c Fri Sep 24 19:26:27 2010 (r213129) +++ stable/8/sys/pci/if_rl.c Fri Sep 24 19:27:47 2010 (r213130) @@ -1302,6 +1302,7 @@ rl_rxeof(struct rl_softc *sc) total_len < ETHER_MIN_LEN || total_len > ETHER_MAX_LEN + ETHER_VLAN_ENCAP_LEN) { ifp->if_ierrors++; + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; rl_init_locked(sc); return (rx_npkts); } @@ -1413,6 +1414,7 @@ rl_txeof(struct rl_softc *sc) CSR_WRITE_4(sc, RL_TXCFG, RL_TXCFG_CONFIG); oldthresh = sc->rl_txthresh; /* error recovery */ + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; rl_init_locked(sc); /* restore original threshold */ sc->rl_txthresh = oldthresh; @@ -1606,8 +1608,10 @@ rl_poll_locked(struct ifnet *ifp, enum p /* XXX We should check behaviour on receiver stalls. */ - if (status & RL_ISR_SYSTEM_ERR) + if (status & RL_ISR_SYSTEM_ERR) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; rl_init_locked(sc); + } } return (rx_npkts); } @@ -1645,8 +1649,10 @@ rl_intr(void *arg) rl_rxeof(sc); if ((status & RL_ISR_TX_OK) || (status & RL_ISR_TX_ERR)) rl_txeof(sc); - if (status & RL_ISR_SYSTEM_ERR) + if (status & RL_ISR_SYSTEM_ERR) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; rl_init_locked(sc); + } } if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) @@ -1808,6 +1814,9 @@ rl_init_locked(struct rl_softc *sc) mii = device_get_softc(sc->rl_miibus); + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + return; + /* * Cancel pending I/O and free all RX/TX buffers. */ @@ -2036,6 +2045,7 @@ rl_watchdog(struct rl_softc *sc) rl_txeof(sc); rl_rxeof(sc); + sc->rl_ifp->if_drv_flags &= ~IFF_DRV_RUNNING; rl_init_locked(sc); } From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 19:29:02 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 46B371065672; Fri, 24 Sep 2010 19:29:02 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1B4078FC0C; Fri, 24 Sep 2010 19:29:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OJT2mg037200; Fri, 24 Sep 2010 19:29:02 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OJT1wP037198; Fri, 24 Sep 2010 19:29:01 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009241929.o8OJT1wP037198@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 19:29:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213131 - stable/7/sys/pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:29:02 -0000 Author: yongari Date: Fri Sep 24 19:29:01 2010 New Revision: 213131 URL: http://svn.freebsd.org/changeset/base/213131 Log: MFC r211767: Remove unnecessary controller reinitialization. PR: kern/87506 Modified: stable/7/sys/pci/if_rl.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/pci/if_rl.c ============================================================================== --- stable/7/sys/pci/if_rl.c Fri Sep 24 19:27:47 2010 (r213130) +++ stable/7/sys/pci/if_rl.c Fri Sep 24 19:29:01 2010 (r213131) @@ -1301,6 +1301,7 @@ rl_rxeof(struct rl_softc *sc) total_len < ETHER_MIN_LEN || total_len > ETHER_MAX_LEN + ETHER_VLAN_ENCAP_LEN) { ifp->if_ierrors++; + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; rl_init_locked(sc); return; } @@ -1410,6 +1411,7 @@ rl_txeof(struct rl_softc *sc) CSR_WRITE_4(sc, RL_TXCFG, RL_TXCFG_CONFIG); oldthresh = sc->rl_txthresh; /* error recovery */ + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; rl_init_locked(sc); /* restore original threshold */ sc->rl_txthresh = oldthresh; @@ -1600,8 +1602,10 @@ rl_poll_locked(struct ifnet *ifp, enum p /* XXX We should check behaviour on receiver stalls. */ - if (status & RL_ISR_SYSTEM_ERR) + if (status & RL_ISR_SYSTEM_ERR) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; rl_init_locked(sc); + } } } #endif /* DEVICE_POLLING */ @@ -1638,8 +1642,10 @@ rl_intr(void *arg) rl_rxeof(sc); if ((status & RL_ISR_TX_OK) || (status & RL_ISR_TX_ERR)) rl_txeof(sc); - if (status & RL_ISR_SYSTEM_ERR) + if (status & RL_ISR_SYSTEM_ERR) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; rl_init_locked(sc); + } } if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) @@ -1801,6 +1807,9 @@ rl_init_locked(struct rl_softc *sc) mii = device_get_softc(sc->rl_miibus); + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + return; + /* * Cancel pending I/O and free all RX/TX buffers. */ @@ -2029,6 +2038,7 @@ rl_watchdog(struct rl_softc *sc) rl_txeof(sc); rl_rxeof(sc); + sc->rl_ifp->if_drv_flags &= ~IFF_DRV_RUNNING; rl_init_locked(sc); } From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 19:30:34 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E212610656A3; Fri, 24 Sep 2010 19:30:34 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B672D8FC0C; Fri, 24 Sep 2010 19:30:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OJUYFR037284; Fri, 24 Sep 2010 19:30:34 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OJUYTx037282; Fri, 24 Sep 2010 19:30:34 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009241930.o8OJUYTx037282@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 19:30:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213132 - stable/8/sys/dev/age X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:30:35 -0000 Author: yongari Date: Fri Sep 24 19:30:34 2010 New Revision: 213132 URL: http://svn.freebsd.org/changeset/base/213132 Log: MFC r211768: Remove unnecessary controller reinitialization. PR: kern/87506 Modified: stable/8/sys/dev/age/if_age.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/age/if_age.c ============================================================================== --- stable/8/sys/dev/age/if_age.c Fri Sep 24 19:29:01 2010 (r213131) +++ stable/8/sys/dev/age/if_age.c Fri Sep 24 19:30:34 2010 (r213132) @@ -1781,6 +1781,7 @@ age_watchdog(struct age_softc *sc) if ((sc->age_flags & AGE_FLAG_LINK) == 0) { if_printf(sc->age_ifp, "watchdog timeout (missed link)\n"); ifp->if_oerrors++; + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; age_init_locked(sc); return; } @@ -1793,6 +1794,7 @@ age_watchdog(struct age_softc *sc) } if_printf(sc->age_ifp, "watchdog timeout\n"); ifp->if_oerrors++; + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; age_init_locked(sc); if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) taskqueue_enqueue(sc->age_tq, &sc->age_tx_task); @@ -1817,8 +1819,10 @@ age_ioctl(struct ifnet *ifp, u_long cmd, else if (ifp->if_mtu != ifr->ifr_mtu) { AGE_LOCK(sc); ifp->if_mtu = ifr->ifr_mtu; - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; age_init_locked(sc); + } AGE_UNLOCK(sc); } break; @@ -2165,6 +2169,7 @@ age_int_task(void *arg, int pending) if ((status & INTR_DMA_WR_TO_RST) != 0) device_printf(sc->age_dev, "DMA write error! -- resetting\n"); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; age_init_locked(sc); } if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) @@ -2529,6 +2534,9 @@ age_init_locked(struct age_softc *sc) ifp = sc->age_ifp; mii = device_get_softc(sc->age_miibus); + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + return; + /* * Cancel any pending I/O. */ From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 19:31:09 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1895D10656A3; Fri, 24 Sep 2010 19:31:09 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 085FE8FC0C; Fri, 24 Sep 2010 19:31:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OJV8nh037348; Fri, 24 Sep 2010 19:31:08 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OJV8B4037346; Fri, 24 Sep 2010 19:31:08 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009241931.o8OJV8B4037346@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Fri, 24 Sep 2010 19:31:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213133 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:31:09 -0000 Author: pjd Date: Fri Sep 24 19:31:08 2010 New Revision: 213133 URL: http://svn.freebsd.org/changeset/base/213133 Log: Add three GPT attributes: GPT_ENT_ATTR_BOOTME - this is bootable partition GPT_ENT_ATTR_BOOTONCE - try to boot only once from this partition GPT_ENT_ATTR_BOOTFAILED - set this flag if we cannot boot from partition containing GPT_ENT_ATTR_BOOTONCE flag; note that if we cannot boot from partition that contains only GPT_ENT_ATTR_BOOTME flag, the GPT_ENT_ATTR_BOOTFAILED flag won't be set According to wikipedia Microsoft TechNet says that attributes are divided into two halves: the lower 4 bytes representing partition independent attributes, and the upper 4 bytes are partition type dependent. Microsoft is already using bits 60 (read-only), 62 (hidden) and 63 (do not automount) and I'd like to not collide with those, so we are using bit 59 (bootme), 58 (bootonce) and 57 (bootfailed). Reviewed by: arch (Message-ID: <20100917234542.GE1902@garage.freebsd.pl>) MFC after: 2 weeks Modified: head/sys/sys/gpt.h Modified: head/sys/sys/gpt.h ============================================================================== --- head/sys/sys/gpt.h Fri Sep 24 19:30:34 2010 (r213132) +++ head/sys/sys/gpt.h Fri Sep 24 19:31:08 2010 (r213133) @@ -65,6 +65,9 @@ struct gpt_ent { uint64_t ent_lba_end; uint64_t ent_attr; #define GPT_ENT_ATTR_PLATFORM (1ULL << 0) +#define GPT_ENT_ATTR_BOOTME (1ULL << 59) +#define GPT_ENT_ATTR_BOOTONCE (1ULL << 58) +#define GPT_ENT_ATTR_BOOTFAILED (1ULL << 57) uint16_t ent_name[36]; /* UTF-16. */ }; From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 19:31:53 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 756801065674; Fri, 24 Sep 2010 19:31:53 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4A04C8FC1A; Fri, 24 Sep 2010 19:31:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OJVra4037394; Fri, 24 Sep 2010 19:31:53 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OJVrbv037392; Fri, 24 Sep 2010 19:31:53 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009241931.o8OJVrbv037392@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 19:31:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213134 - stable/7/sys/dev/age X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:31:53 -0000 Author: yongari Date: Fri Sep 24 19:31:53 2010 New Revision: 213134 URL: http://svn.freebsd.org/changeset/base/213134 Log: MFC r211768: Remove unnecessary controller reinitialization. PR: kern/87506 Modified: stable/7/sys/dev/age/if_age.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/age/if_age.c ============================================================================== --- stable/7/sys/dev/age/if_age.c Fri Sep 24 19:31:08 2010 (r213133) +++ stable/7/sys/dev/age/if_age.c Fri Sep 24 19:31:53 2010 (r213134) @@ -1781,6 +1781,7 @@ age_watchdog(struct age_softc *sc) if ((sc->age_flags & AGE_FLAG_LINK) == 0) { if_printf(sc->age_ifp, "watchdog timeout (missed link)\n"); ifp->if_oerrors++; + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; age_init_locked(sc); return; } @@ -1793,6 +1794,7 @@ age_watchdog(struct age_softc *sc) } if_printf(sc->age_ifp, "watchdog timeout\n"); ifp->if_oerrors++; + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; age_init_locked(sc); if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) taskqueue_enqueue(sc->age_tq, &sc->age_tx_task); @@ -1817,8 +1819,10 @@ age_ioctl(struct ifnet *ifp, u_long cmd, else if (ifp->if_mtu != ifr->ifr_mtu) { AGE_LOCK(sc); ifp->if_mtu = ifr->ifr_mtu; - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; age_init_locked(sc); + } AGE_UNLOCK(sc); } break; @@ -2165,6 +2169,7 @@ age_int_task(void *arg, int pending) if ((status & INTR_DMA_WR_TO_RST) != 0) device_printf(sc->age_dev, "DMA write error! -- resetting\n"); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; age_init_locked(sc); } if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) @@ -2529,6 +2534,9 @@ age_init_locked(struct age_softc *sc) ifp = sc->age_ifp; mii = device_get_softc(sc->age_miibus); + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + return; + /* * Cancel any pending I/O. */ From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 19:33:47 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 614241065674; Fri, 24 Sep 2010 19:33:47 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 503B98FC16; Fri, 24 Sep 2010 19:33:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OJXlFV037477; Fri, 24 Sep 2010 19:33:47 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OJXlCr037475; Fri, 24 Sep 2010 19:33:47 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009241933.o8OJXlCr037475@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Fri, 24 Sep 2010 19:33:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213135 - head/sys/geom/part X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:33:47 -0000 Author: pjd Date: Fri Sep 24 19:33:47 2010 New Revision: 213135 URL: http://svn.freebsd.org/changeset/base/213135 Log: Allow to configure GPT attributes. It shouldn't be allowed to set bootfailed attribute (it should be allowed only to unset it), but for test purposes it might be useful, so the current code allows it. Reviewed by: arch@ (Message-ID: <20100917234542.GE1902@garage.freebsd.pl>) MFC after: 2 weeks Modified: head/sys/geom/part/g_part_gpt.c Modified: head/sys/geom/part/g_part_gpt.c ============================================================================== --- head/sys/geom/part/g_part_gpt.c Fri Sep 24 19:31:53 2010 (r213134) +++ head/sys/geom/part/g_part_gpt.c Fri Sep 24 19:33:47 2010 (r213135) @@ -100,6 +100,8 @@ static const char *g_part_gpt_name(struc char *, size_t); static int g_part_gpt_probe(struct g_part_table *, struct g_consumer *); static int g_part_gpt_read(struct g_part_table *, struct g_consumer *); +static int g_part_gpt_setunset(struct g_part_table *table, + struct g_part_entry *baseentry, const char *attrib, unsigned int set); static const char *g_part_gpt_type(struct g_part_table *, struct g_part_entry *, char *, size_t); static int g_part_gpt_write(struct g_part_table *, struct g_consumer *); @@ -118,6 +120,7 @@ static kobj_method_t g_part_gpt_methods[ KOBJMETHOD(g_part_name, g_part_gpt_name), KOBJMETHOD(g_part_probe, g_part_gpt_probe), KOBJMETHOD(g_part_read, g_part_gpt_read), + KOBJMETHOD(g_part_setunset, g_part_gpt_setunset), KOBJMETHOD(g_part_type, g_part_gpt_type), KOBJMETHOD(g_part_write, g_part_gpt_write), { 0, 0 } @@ -519,6 +522,16 @@ g_part_gpt_dumpconf(struct g_part_table g_gpt_printf_utf16(sb, entry->ent.ent_name, sizeof(entry->ent.ent_name) >> 1); sbuf_printf(sb, "\n"); + if (entry->ent.ent_attr & GPT_ENT_ATTR_BOOTME) + sbuf_printf(sb, "%sbootme\n", indent); + if (entry->ent.ent_attr & GPT_ENT_ATTR_BOOTONCE) { + sbuf_printf(sb, "%sbootonce\n", + indent); + } + if (entry->ent.ent_attr & GPT_ENT_ATTR_BOOTFAILED) { + sbuf_printf(sb, "%sbootfailed\n", + indent); + } sbuf_printf(sb, "%s", indent); sbuf_printf_uuid(sb, &entry->ent.ent_type); sbuf_printf(sb, "\n"); @@ -755,6 +768,78 @@ g_part_gpt_read(struct g_part_table *bas return (0); } +static int +g_part_gpt_setunset(struct g_part_table *table, struct g_part_entry *baseentry, + const char *attrib, unsigned int set) +{ + struct g_part_entry *iter; + struct g_part_gpt_entry *entry; + int changed, bootme, bootonce, bootfailed; + + bootme = bootonce = bootfailed = 0; + if (strcasecmp(attrib, "bootme") == 0) { + bootme = 1; + } else if (strcasecmp(attrib, "bootonce") == 0) { + /* BOOTME is set automatically with BOOTONCE, but not unset. */ + bootonce = 1; + if (set) + bootme = 1; + } else if (strcasecmp(attrib, "bootfailed") == 0) { + /* + * It should only be possible to unset BOOTFAILED, but it might + * be useful for test purposes to also be able to set it. + */ + bootfailed = 1; + } + if (!bootme && !bootonce && !bootfailed) + return (EINVAL); + + LIST_FOREACH(iter, &table->gpt_entry, gpe_entry) { + if (iter->gpe_deleted) + continue; + if (iter != baseentry) + continue; + changed = 0; + entry = (struct g_part_gpt_entry *)iter; + if (set) { + if (bootme && + !(entry->ent.ent_attr & GPT_ENT_ATTR_BOOTME)) { + entry->ent.ent_attr |= GPT_ENT_ATTR_BOOTME; + changed = 1; + } + if (bootonce && + !(entry->ent.ent_attr & GPT_ENT_ATTR_BOOTONCE)) { + entry->ent.ent_attr |= GPT_ENT_ATTR_BOOTONCE; + changed = 1; + } + if (bootfailed && + !(entry->ent.ent_attr & GPT_ENT_ATTR_BOOTFAILED)) { + entry->ent.ent_attr |= GPT_ENT_ATTR_BOOTFAILED; + changed = 1; + } + } else { + if (bootme && + (entry->ent.ent_attr & GPT_ENT_ATTR_BOOTME)) { + entry->ent.ent_attr &= ~GPT_ENT_ATTR_BOOTME; + changed = 1; + } + if (bootonce && + (entry->ent.ent_attr & GPT_ENT_ATTR_BOOTONCE)) { + entry->ent.ent_attr &= ~GPT_ENT_ATTR_BOOTONCE; + changed = 1; + } + if (bootfailed && + (entry->ent.ent_attr & GPT_ENT_ATTR_BOOTFAILED)) { + entry->ent.ent_attr &= ~GPT_ENT_ATTR_BOOTFAILED; + changed = 1; + } + } + if (changed && !iter->gpe_created) + iter->gpe_modified = 1; + } + return (0); +} + static const char * g_part_gpt_type(struct g_part_table *basetable, struct g_part_entry *baseentry, char *buf, size_t bufsz) From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 19:49:13 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 70A931065670; Fri, 24 Sep 2010 19:49:13 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5D2008FC13; Fri, 24 Sep 2010 19:49:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OJnD9g037849; Fri, 24 Sep 2010 19:49:13 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OJnDht037838; Fri, 24 Sep 2010 19:49:13 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009241949.o8OJnDht037838@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Fri, 24 Sep 2010 19:49:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213136 - in head/sys/boot: common i386/common i386/gptboot i386/gptzfsboot i386/zfsboot zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:49:13 -0000 Author: pjd Date: Fri Sep 24 19:49:12 2010 New Revision: 213136 URL: http://svn.freebsd.org/changeset/base/213136 Log: - Split code shared by almost any boot loader into separate files and clean up most layering violations: sys/boot/i386/common/rbx.h: RBX_* defines OPT_SET() OPT_CHECK() sys/boot/common/util.[ch]: memcpy() memset() memcmp() bcpy() bzero() bcmp() strcmp() strncmp() [new] strcpy() strcat() strchr() strlen() printf() sys/boot/i386/common/cons.[ch]: ioctrl putc() xputc() putchar() getc() xgetc() keyhit() [now takes number of seconds as an argument] getstr() sys/boot/i386/common/drv.[ch]: struct dsk drvread() drvwrite() [new] drvsize() [new] sys/boot/common/crc32.[ch] [new] sys/boot/common/gpt.[ch] [new] - Teach gptboot and gptzfsboot about new files. I haven't touched the rest, but there is still a lot of code duplication to be removed. - Implement full GPT support. Currently we just read primary header and partition table and don't care about checksums, etc. After this change we verify checksums of primary header and primary partition table and if there is a problem we fall back to backup header and backup partition table. - Clean up most messages to use prefix of boot program, so in case of an error we know where the error comes from, eg.: gptboot: unable to read primary GPT header - If we can't boot, print boot prompt only once and not every five seconds. - Honour newly added GPT attributes: bootme - this is bootable partition bootonce - try to boot from this partition only once bootfailed - we failed to boot from this partition - Change boot order of gptboot to the following: 1. Try to boot from all the partitions that have both 'bootme' and 'bootonce' attributes one by one. 2. Try to boot from all the partitions that have only 'bootme' attribute one by one. 3. If there are no partitions with 'bootme' attribute, boot from the first UFS partition. - The 'bootonce' functionality is implemented in the following way: 1. Walk through all the partitions and when 'bootonce' attribute is found without 'bootme' attribute, remove 'bootonce' attribute and set 'bootfailed' attribute. 'bootonce' attribute alone means that we tried to boot from this partition, but boot failed after leaving gptboot and machine was restarted. 2. Find partition with both 'bootme' and 'bootonce' attributes. 3. Remove 'bootme' attribute. 4. Try to execute /boot/loader or /boot/kernel/kernel from that partition. If succeeded we stop here. 5. If execution failed, remove 'bootonce' and set 'bootfailed'. 6. Go to 2. If whole boot succeeded there is new /etc/rc.d/gptboot script coming that will log all partitions that we failed to boot from (the ones with 'bootfailed' attribute) and will remove this attribute. It will also find partition with 'bootonce' attribute - this is the partition we booted from successfully. The script will log success and remove the attribute. All the GPT updates we do here goes to both primary and backup GPT if they are valid. We don't touch headers or partition tables when checksum doesn't match. Reviewed by: arch (Message-ID: <20100917234542.GE1902@garage.freebsd.pl>) Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com MFC after: 2 weeks Added: head/sys/boot/common/crc32.c (contents, props changed) head/sys/boot/common/crc32.h (contents, props changed) head/sys/boot/common/gpt.c (contents, props changed) head/sys/boot/common/gpt.h (contents, props changed) head/sys/boot/common/util.c (contents, props changed) head/sys/boot/common/util.h (contents, props changed) head/sys/boot/i386/common/ head/sys/boot/i386/common/cons.c (contents, props changed) head/sys/boot/i386/common/cons.h (contents, props changed) head/sys/boot/i386/common/drv.c (contents, props changed) head/sys/boot/i386/common/drv.h (contents, props changed) head/sys/boot/i386/common/rbx.h (contents, props changed) Modified: head/sys/boot/i386/gptboot/Makefile head/sys/boot/i386/gptboot/gptboot.c head/sys/boot/i386/gptzfsboot/Makefile head/sys/boot/i386/zfsboot/Makefile head/sys/boot/i386/zfsboot/zfsboot.c head/sys/boot/zfs/Makefile head/sys/boot/zfs/zfsimpl.c Added: head/sys/boot/common/crc32.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/boot/common/crc32.c Fri Sep 24 19:49:12 2010 (r213136) @@ -0,0 +1,108 @@ +/*- + * COPYRIGHT (C) 1986 Gary S. Brown. You may use this program, or + * code or tables extracted from it, as desired without restriction. + */ + +/* + * First, the polynomial itself and its table of feedback terms. The + * polynomial is + * X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0 + * + * Note that we take it "backwards" and put the highest-order term in + * the lowest-order bit. The X^32 term is "implied"; the LSB is the + * X^31 term, etc. The X^0 term (usually shown as "+1") results in + * the MSB being 1 + * + * Note that the usual hardware shift register implementation, which + * is what we're using (we're merely optimizing it by doing eight-bit + * chunks at a time) shifts bits into the lowest-order term. In our + * implementation, that means shifting towards the right. Why do we + * do it this way? Because the calculated CRC must be transmitted in + * order from highest-order term to lowest-order term. UARTs transmit + * characters in order from LSB to MSB. By storing the CRC this way + * we hand it to the UART in the order low-byte to high-byte; the UART + * sends each low-bit to hight-bit; and the result is transmission bit + * by bit from highest- to lowest-order term without requiring any bit + * shuffling on our part. Reception works similarly + * + * The feedback terms table consists of 256, 32-bit entries. Notes + * + * The table can be generated at runtime if desired; code to do so + * is shown later. It might not be obvious, but the feedback + * terms simply represent the results of eight shift/xor opera + * tions for all combinations of data and CRC register values + * + * The values must be right-shifted by eight bits by the "updcrc + * logic; the shift must be unsigned (bring in zeroes). On some + * hardware you could probably optimize the shift in assembler by + * using byte-swap instructions + * polynomial $edb88320 + * + * + * CRC32 code derived from work by Gary S. Brown. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +#include "crc32.h" + +static uint32_t crc32_tab[] = { + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, + 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, + 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, + 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, + 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, + 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, + 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, + 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, + 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, + 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, + 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, + 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, + 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, + 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, + 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, + 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, + 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, + 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, + 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, + 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, + 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, + 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, + 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, + 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, + 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, + 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, + 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, + 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, + 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, + 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, + 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, + 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, + 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, + 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, + 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, + 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, + 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, + 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, + 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d +}; + +uint32_t +crc32(const void *buf, size_t size) +{ + const uint8_t *p = buf; + uint32_t crc; + + crc = ~0U; + while (size--) + crc = crc32_tab[(crc ^ *p++) & 0xFF] ^ (crc >> 8); + return (crc ^ ~0U); +} Added: head/sys/boot/common/crc32.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/boot/common/crc32.h Fri Sep 24 19:49:12 2010 (r213136) @@ -0,0 +1,13 @@ +/*- + * COPYRIGHT (C) 1986 Gary S. Brown. You may use this program, or + * code or tables extracted from it, as desired without restriction. + * + * $FreeBSD$ + */ + +#ifndef _CRC32_H_ +#define _CRC32_H_ + +uint32_t crc32(const void *buf, size_t size); + +#endif /* !_CRC32_H_ */ Added: head/sys/boot/common/gpt.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/boot/common/gpt.c Fri Sep 24 19:49:12 2010 (r213136) @@ -0,0 +1,381 @@ +/*- + * Copyright (c) 2010 Pawel Jakub Dawidek + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#ifndef LITTLE_ENDIAN +#error gpt.c works only for little endian architectures +#endif + +#include "crc32.h" +#include "drv.h" +#include "util.h" +#include "gpt.h" + +#define MAXTBLENTS 128 + +static struct gpt_hdr hdr_primary, hdr_backup, *gpthdr; +static uint64_t hdr_primary_lba, hdr_backup_lba; +static struct gpt_ent table_primary[MAXTBLENTS], table_backup[MAXTBLENTS]; +static struct gpt_ent *gpttable; +static int curent, bootonce; + +/* + * Buffer below 64kB passed on gptread(), which can hold at least + * one sector od data (512 bytes). + */ +static char *secbuf; + +static void +gptupdate(const char *which, struct dsk *dskp, struct gpt_hdr *hdr, + struct gpt_ent *table) +{ + int entries_per_sec, firstent; + daddr_t slba; + + /* + * We need to update the following for both primary and backup GPT: + * 1. Sector on disk that contains curent partition. + * 2. Partition table checksum. + * 3. Header checksum. + * 4. Header on disk. + */ + + entries_per_sec = DEV_BSIZE / hdr->hdr_entsz; + slba = curent / entries_per_sec; + firstent = slba * entries_per_sec; + bcpy(&table[firstent], secbuf, DEV_BSIZE); + slba += hdr->hdr_lba_table; + if (drvwrite(dskp, secbuf, slba, 1)) { + printf("%s: unable to update %s GPT partition table\n", + BOOTPROG, which); + return; + } + hdr->hdr_crc_table = crc32(table, hdr->hdr_entries * hdr->hdr_entsz); + hdr->hdr_crc_self = 0; + hdr->hdr_crc_self = crc32(hdr, hdr->hdr_size); + bzero(secbuf, DEV_BSIZE); + bcpy(hdr, secbuf, hdr->hdr_size); + if (drvwrite(dskp, secbuf, hdr->hdr_lba_self, 1)) { + printf("%s: unable to update %s GPT header\n", BOOTPROG, which); + return; + } +} + +int +gptfind(const uuid_t *uuid, struct dsk *dskp, int part) +{ + struct gpt_ent *ent; + int firsttry; + + if (part >= 0) { + if (part == 0 || part > gpthdr->hdr_entries) { + printf("%s: invalid partition index\n", BOOTPROG); + return (-1); + } + ent = &gpttable[part - 1]; + if (bcmp(&ent->ent_type, uuid, sizeof(uuid_t)) != 0) { + printf("%s: specified partition is not UFS\n", + BOOTPROG); + return (-1); + } + curent = part - 1; + goto found; + } + + firsttry = (curent == -1); + curent++; + if (curent >= gpthdr->hdr_entries) { + curent = gpthdr->hdr_entries; + return (-1); + } + if (bootonce) { + /* + * First look for partition with both GPT_ENT_ATTR_BOOTME and + * GPT_ENT_ATTR_BOOTONCE flags. + */ + for (; curent < gpthdr->hdr_entries; curent++) { + ent = &gpttable[curent]; + if (bcmp(&ent->ent_type, uuid, sizeof(uuid_t)) != 0) + continue; + if (!(ent->ent_attr & GPT_ENT_ATTR_BOOTME)) + continue; + if (!(ent->ent_attr & GPT_ENT_ATTR_BOOTONCE)) + continue; + /* Ok, found one. */ + goto found; + } + bootonce = 0; + curent = 0; + } + for (; curent < gpthdr->hdr_entries; curent++) { + ent = &gpttable[curent]; + if (bcmp(&ent->ent_type, uuid, sizeof(uuid_t)) != 0) + continue; + if (!(ent->ent_attr & GPT_ENT_ATTR_BOOTME)) + continue; + if (ent->ent_attr & GPT_ENT_ATTR_BOOTONCE) + continue; + /* Ok, found one. */ + goto found; + } + if (firsttry) { + /* + * No partition with BOOTME flag was found, try to boot from + * first UFS partition. + */ + for (curent = 0; curent < gpthdr->hdr_entries; curent++) { + ent = &gpttable[curent]; + if (bcmp(&ent->ent_type, uuid, sizeof(uuid_t)) != 0) + continue; + /* Ok, found one. */ + goto found; + } + } + return (-1); +found: + dskp->part = curent + 1; + ent = &gpttable[curent]; + dskp->start = ent->ent_lba_start; + if (ent->ent_attr & GPT_ENT_ATTR_BOOTONCE) { + /* + * Clear BOOTME, but leave BOOTONCE set before trying to + * boot from this partition. + */ + if (hdr_primary_lba > 0) { + table_primary[curent].ent_attr &= ~GPT_ENT_ATTR_BOOTME; + gptupdate("primary", dskp, &hdr_primary, table_primary); + } + if (hdr_backup_lba > 0) { + table_backup[curent].ent_attr &= ~GPT_ENT_ATTR_BOOTME; + gptupdate("backup", dskp, &hdr_backup, table_backup); + } + } + return (0); +} + +static int +gptread_hdr(const char *which, struct dsk *dskp, struct gpt_hdr *hdr, + uint64_t hdrlba) +{ + uint32_t crc; + + if (drvread(dskp, secbuf, hdrlba, 1)) { + printf("%s: unable to read %s GPT header\n", BOOTPROG, which); + return (-1); + } + bcpy(secbuf, hdr, sizeof(*hdr)); + if (bcmp(hdr->hdr_sig, GPT_HDR_SIG, sizeof(hdr->hdr_sig)) != 0 || + hdr->hdr_lba_self != hdrlba || hdr->hdr_revision < 0x00010000 || + hdr->hdr_entsz < sizeof(struct gpt_ent) || + hdr->hdr_entries > MAXTBLENTS || DEV_BSIZE % hdr->hdr_entsz != 0) { + printf("%s: invalid %s GPT header\n", BOOTPROG, which); + return (-1); + } + crc = hdr->hdr_crc_self; + hdr->hdr_crc_self = 0; + if (crc32(hdr, hdr->hdr_size) != crc) { + printf("%s: %s GPT header checksum mismatch\n", BOOTPROG, + which); + return (-1); + } + hdr->hdr_crc_self = crc; + return (0); +} + +void +gptbootfailed(struct dsk *dskp) +{ + + if (!(gpttable[curent].ent_attr & GPT_ENT_ATTR_BOOTONCE)) + return; + + if (hdr_primary_lba > 0) { + table_primary[curent].ent_attr &= ~GPT_ENT_ATTR_BOOTONCE; + table_primary[curent].ent_attr |= GPT_ENT_ATTR_BOOTFAILED; + gptupdate("primary", dskp, &hdr_primary, table_primary); + } + if (hdr_backup_lba > 0) { + table_backup[curent].ent_attr &= ~GPT_ENT_ATTR_BOOTONCE; + table_backup[curent].ent_attr |= GPT_ENT_ATTR_BOOTFAILED; + gptupdate("backup", dskp, &hdr_backup, table_backup); + } +} + +static void +gptbootconv(const char *which, struct dsk *dskp, struct gpt_hdr *hdr, + struct gpt_ent *table) +{ + struct gpt_ent *ent; + daddr_t slba; + int table_updated, sector_updated; + int entries_per_sec, nent, part; + + table_updated = 0; + entries_per_sec = DEV_BSIZE / hdr->hdr_entsz; + for (nent = 0, slba = hdr->hdr_lba_table; + slba < hdr->hdr_lba_table + hdr->hdr_entries / entries_per_sec; + slba++, nent += entries_per_sec) { + sector_updated = 0; + for (part = 0; part < entries_per_sec; part++) { + ent = &table[nent + part]; + if ((ent->ent_attr & (GPT_ENT_ATTR_BOOTME | + GPT_ENT_ATTR_BOOTONCE | + GPT_ENT_ATTR_BOOTFAILED)) != + GPT_ENT_ATTR_BOOTONCE) { + continue; + } + ent->ent_attr &= ~GPT_ENT_ATTR_BOOTONCE; + ent->ent_attr |= GPT_ENT_ATTR_BOOTFAILED; + table_updated = 1; + sector_updated = 1; + } + if (!sector_updated) + continue; + bcpy(&table[nent], secbuf, DEV_BSIZE); + if (drvwrite(dskp, secbuf, slba, 1)) { + printf("%s: unable to update %s GPT partition table\n", + BOOTPROG, which); + } + } + if (!table_updated) + return; + hdr->hdr_crc_table = crc32(table, hdr->hdr_entries * hdr->hdr_entsz); + hdr->hdr_crc_self = 0; + hdr->hdr_crc_self = crc32(hdr, hdr->hdr_size); + bzero(secbuf, DEV_BSIZE); + bcpy(hdr, secbuf, hdr->hdr_size); + if (drvwrite(dskp, secbuf, hdr->hdr_lba_self, 1)) + printf("%s: unable to update %s GPT header\n", BOOTPROG, which); +} + +static int +gptread_table(const char *which, const uuid_t *uuid, struct dsk *dskp, + struct gpt_hdr *hdr, struct gpt_ent *table) +{ + struct gpt_ent *ent; + int entries_per_sec; + int part, nent; + daddr_t slba; + + if (hdr->hdr_entries == 0) + return (0); + + entries_per_sec = DEV_BSIZE / hdr->hdr_entsz; + slba = hdr->hdr_lba_table; + nent = 0; + for (;;) { + if (drvread(dskp, secbuf, slba, 1)) { + printf("%s: unable to read %s GPT partition table\n", + BOOTPROG, which); + return (-1); + } + ent = (struct gpt_ent *)secbuf; + for (part = 0; part < entries_per_sec; part++, ent++) { + bcpy(ent, &table[nent], sizeof(table[nent])); + if (++nent >= hdr->hdr_entries) + break; + } + if (nent >= hdr->hdr_entries) + break; + slba++; + } + if (crc32(table, nent * hdr->hdr_entsz) != hdr->hdr_crc_table) { + printf("%s: %s GPT table checksum mismatch\n", BOOTPROG, which); + return (-1); + } + return (0); +} + +int +gptread(const uuid_t *uuid, struct dsk *dskp, char *buf) +{ + uint64_t altlba; + + /* + * Read and verify both GPT headers: primary and backup. + */ + + secbuf = buf; + hdr_primary_lba = hdr_backup_lba = 0; + curent = -1; + bootonce = 1; + dskp->start = 0; + + if (gptread_hdr("primary", dskp, &hdr_primary, 1) == 0 && + gptread_table("primary", uuid, dskp, &hdr_primary, + table_primary) == 0) { + hdr_primary_lba = hdr_primary.hdr_lba_self; + gpthdr = &hdr_primary; + gpttable = table_primary; + } + + altlba = drvsize(dskp); + if (altlba > 0) + altlba--; + else if (hdr_primary_lba > 0) { + /* + * If we cannot obtain disk size, but primary header + * is valid, we can get backup header location from + * there. + */ + altlba = hdr_primary.hdr_lba_alt; + } + if (altlba == 0) + printf("%s: unable to locate backup GPT header\n", BOOTPROG); + else if (gptread_hdr("backup", dskp, &hdr_backup, altlba) == 0 && + gptread_table("backup", uuid, dskp, &hdr_backup, + table_backup) == 0) { + hdr_backup_lba = hdr_backup.hdr_lba_self; + if (hdr_primary_lba == 0) { + gpthdr = &hdr_backup; + gpttable = table_backup; + printf("%s: using backup GPT\n", BOOTPROG); + } + } + + /* + * Convert all BOOTONCE without BOOTME flags into BOOTFAILED. + * BOOTONCE without BOOTME means that we tried to boot from it, + * but failed after leaving gptboot and machine was rebooted. + * We don't want to leave partitions marked as BOOTONCE only, + * because when we boot successfully start-up scripts should + * find at most one partition with only BOOTONCE flag and this + * will mean that we booted from that partition. + */ + if (hdr_primary_lba != 0) + gptbootconv("primary", dskp, &hdr_primary, table_primary); + if (hdr_backup_lba != 0) + gptbootconv("backup", dskp, &hdr_backup, table_backup); + + if (hdr_primary_lba == 0 && hdr_backup_lba == 0) + return (-1); + return (0); +} Added: head/sys/boot/common/gpt.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/boot/common/gpt.h Fri Sep 24 19:49:12 2010 (r213136) @@ -0,0 +1,39 @@ +/*- + * Copyright (c) 2010 Pawel Jakub Dawidek + * 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$ + */ + +#ifndef _GPT_H_ +#define _GPT_H_ + +#include +#include + +int gptread(const uuid_t *uuid, struct dsk *dskp, char *buf); +int gptfind(const uuid_t *uuid, struct dsk *dskp, int part); +void gptbootfailed(struct dsk *dskp); + +#endif /* !_GPT_H_ */ Added: head/sys/boot/common/util.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/boot/common/util.c Fri Sep 24 19:49:12 2010 (r213136) @@ -0,0 +1,176 @@ +/*- + * Copyright (c) 1998 Robert Nordier + * Copyright (c) 2010 Pawel Jakub Dawidek + * All rights reserved. + * + * Redistribution and use in source and binary forms are freely + * permitted provided that the above copyright notice and this + * paragraph and the following disclaimer are duplicated in all + * such forms. + * + * This software is provided "AS IS" and without any express or + * implied warranties, including, without limitation, the implied + * warranties of merchantability and fitness for a particular + * purpose. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +#include + +#include "cons.h" +#include "util.h" + +void +memcpy(void *dst, const void *src, int len) +{ + const char *s = src; + char *d = dst; + + while (len--) + *d++ = *s++; +} + +void +memset(void *b, int c, size_t len) +{ + char *bp = b; + + while (len--) + *bp++ = (unsigned char)c; +} + +int +memcmp(const void *b1, const void *b2, size_t len) +{ + const unsigned char *p1, *p2; + + for (p1 = b1, p2 = b2; len > 0; len--, p1++, p2++) { + if (*p1 != *p2) + return ((*p1) - (*p2)); + } + return (0); +} + +int +strcmp(const char *s1, const char *s2) +{ + + for (; *s1 == *s2 && *s1 != '\0'; s1++, s2++) + ; + return ((unsigned char)*s1 - (unsigned char)*s2); +} + +int +strncmp(const char *s1, const char *s2, size_t len) +{ + + for (; *s1 == *s2 && *s1 != '\0' && len > 0; len--, s1++, s2++) + ; + return ((unsigned char)*s1 - (unsigned char)*s2); +} + +void +strcpy(char *dst, const char *src) +{ + + while (*src != '\0') + *dst++ = *src++; + *dst = '\0'; +} + +void +strcat(char *dst, const char *src) +{ + + while (*dst != '\0') + dst++; + while (*src != '\0') + *dst++ = *src++; + *dst = '\0'; +} + +char * +strchr(const char *s, char ch) +{ + + for (; *s != '\0'; s++) { + if (*s == ch) + return ((char *)(uintptr_t)(const void *)s); + } + return (NULL); +} + +size_t +strlen(const char *s) +{ + size_t len = 0; + + while (*s++ != '\0') + len++; + return (len); +} + +void +printf(const char *fmt, ...) +{ + va_list ap; + const char *hex = "0123456789abcdef"; + char buf[10], *s; + unsigned long long u; + int c, l; + + va_start(ap, fmt); + while ((c = *fmt++) != '\0') { + if (c != '%') { + putchar(c); + continue; + } + l = 0; +nextfmt: + c = *fmt++; + switch (c) { + case 'l': + l++; + goto nextfmt; + case 'c': + putchar(va_arg(ap, int)); + break; + case 's': + for (s = va_arg(ap, char *); *s != '\0'; s++) + putchar(*s); + break; + case 'd': /* A lie, always prints unsigned */ + case 'u': + case 'x': + switch (l) { + case 2: + u = va_arg(ap, unsigned long long); + break; + case 1: + u = va_arg(ap, unsigned long); + break; + default: + u = va_arg(ap, unsigned int); + break; + } + s = buf; + if (c == 'd' || c == 'u') { + do + *s++ = '0' + (u % 10U); + while (u /= 10); + } else { + do + *s++ = hex[u & 0xfu]; + while (u >>= 4); + } + while (--s >= buf) + putchar(*s); + break; + } + } + va_end(ap); +} Added: head/sys/boot/common/util.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/boot/common/util.h Fri Sep 24 19:49:12 2010 (r213136) @@ -0,0 +1,53 @@ +/*- + * Copyright (c) 2010 Pawel Jakub Dawidek + * 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$ + */ + +#ifndef _UTIL_H_ +#define _UTIL_H_ + +#include + +#include + +void memcpy(void *dst, const void *src, int len); +void memset(void *b, int c, size_t len); +int memcmp(const void *b1, const void *b2, size_t len); + +#define bcpy(src, dst, len) memcpy((dst), (src), (len)) +#define bzero(buf, size) memset((buf), 0, (size)) +#define bcmp(b1, b2, len) (memcmp((b1), (b2), (len)) != 0) + +int strcmp(const char *s1, const char *s2); +int strncmp(const char *s1, const char *s2, size_t len); +void strcpy(char *dst, const char *src); +void strcat(char *dst, const char *src); +char *strchr(const char *s, char ch); +size_t strlen(const char *s); + +void printf(const char *fmt, ...); + +#endif /* !_UTIL_H_ */ Added: head/sys/boot/i386/common/cons.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/boot/i386/common/cons.c Fri Sep 24 19:49:12 2010 (r213136) @@ -0,0 +1,152 @@ +/*- + * Copyright (c) 1998 Robert Nordier + * All rights reserved. + * + * Redistribution and use in source and binary forms are freely + * permitted provided that the above copyright notice and this + * paragraph and the following disclaimer are duplicated in all + * such forms. + * + * This software is provided "AS IS" and without any express or + * implied warranties, including, without limitation, the implied + * warranties of merchantability and fitness for a particular + * purpose. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +#include + +#include + +#include "lib.h" +#include "rbx.h" +#include "util.h" +#include "cons.h" + +#define V86_ZR(x) ((x) & PSL_Z) + +#define SECOND 18 /* Circa that many ticks in a second. */ + +uint8_t ioctrl = IO_KEYBOARD; + +void +putc(int c) +{ + + v86.addr = 0x10; + v86.eax = 0xe00 | (c & 0xff); + v86.ebx = 0x7; + v86int(); +} + +void +xputc(int c) +{ + + if (ioctrl & IO_KEYBOARD) + putc(c); + if (ioctrl & IO_SERIAL) + sio_putc(c); +} + +void +putchar(int c) +{ + + if (c == '\n') + xputc('\r'); + xputc(c); +} + +int +getc(int fn) +{ + + /* + * The extra comparison against zero is an attempt to work around + * what appears to be a bug in QEMU and Bochs. Both emulators + * sometimes report a key-press with scancode one and ascii zero + * when no such key is pressed in reality. As far as I can tell, + * this only happens shortly after a reboot. + */ + v86.ctl = V86_FLAGS; + v86.addr = 0x16; + v86.eax = fn << 8; + v86int(); + return fn == 0 ? v86.eax & 0xff : (!V86_ZR(v86.efl) && (v86.eax & 0xff)); +} + +int +xgetc(int fn) +{ + + if (OPT_CHECK(RBX_NOINTR)) + return (0); + for (;;) { + if (ioctrl & IO_KEYBOARD && getc(1)) + return (fn ? 1 : getc(0)); + if (ioctrl & IO_SERIAL && sio_ischar()) + return (fn ? 1 : sio_getc()); + if (fn) + return (0); + } + /* NOTREACHED */ +} + +int +keyhit(unsigned int secs) +{ + uint32_t t0, t1; + + if (OPT_CHECK(RBX_NOINTR)) + return (0); + secs *= SECOND; + t0 = 0; + for (;;) { + if (xgetc(1)) + return (1); + if (secs > 0) { + t1 = *(uint32_t *)PTOV(0x46c); + if (!t0) + t0 = t1; + if (t1 < t0 || t1 >= t0 + secs) + return (0); + } + } + /* NOTREACHED */ +} + +void +getstr(char *cmdstr, size_t cmdstrsize) +{ + char *s; + int c; + + s = cmdstr; + for (;;) { + switch (c = xgetc(0)) { + case 0: + break; + case '\177': + case '\b': + if (s > cmdstr) { + s--; + printf("\b \b"); + } + break; + case '\n': + case '\r': + *s = 0; + return; + default: + if (s - cmdstr < cmdstrsize - 1) + *s++ = c; + putchar(c); + break; + } + } +} Added: head/sys/boot/i386/common/cons.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/boot/i386/common/cons.h Fri Sep 24 19:49:12 2010 (r213136) @@ -0,0 +1,34 @@ +/*- + * Copyright (c) 1998 Robert Nordier + * All rights reserved. + * + * Redistribution and use in source and binary forms are freely + * permitted provided that the above copyright notice and this + * paragraph and the following disclaimer are duplicated in all + * such forms. + * + * This software is provided "AS IS" and without any express or + * implied warranties, including, without limitation, the implied + * warranties of merchantability and fitness for a particular + * purpose. + * + * $FreeBSD$ + */ + +#ifndef _CONS_H_ +#define _CONS_H_ + +#define IO_KEYBOARD 1 +#define IO_SERIAL 2 + +extern uint8_t ioctrl; + +void putc(int c); +void xputc(int c); +void putchar(int c); +int getc(int fn); +int xgetc(int fn); +int keyhit(unsigned int secs); +void getstr(char *cmdstr, size_t cmdstrsize); + +#endif /* !_CONS_H_ */ Added: head/sys/boot/i386/common/drv.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/boot/i386/common/drv.c Fri Sep 24 19:49:12 2010 (r213136) @@ -0,0 +1,131 @@ +/*- + * Copyright (c) 1998 Robert Nordier + * Copyright (c) 2010 Pawel Jakub Dawidek + * All rights reserved. + * + * Redistribution and use in source and binary forms are freely + * permitted provided that the above copyright notice and this + * paragraph and the following disclaimer are duplicated in all + * such forms. + * + * This software is provided "AS IS" and without any express or + * implied warranties, including, without limitation, the implied + * warranties of merchantability and fitness for a particular + * purpose. + */ + +#include *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 19:53:56 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 02F9E106566C; Fri, 24 Sep 2010 19:53:56 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E63CC8FC08; Fri, 24 Sep 2010 19:53:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OJrtKd038000; Fri, 24 Sep 2010 19:53:55 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OJrtP0037997; Fri, 24 Sep 2010 19:53:55 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009241953.o8OJrtP0037997@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Fri, 24 Sep 2010 19:53:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213137 - head/etc/rc.d X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 19:53:56 -0000 Author: pjd Date: Fri Sep 24 19:53:55 2010 New Revision: 213137 URL: http://svn.freebsd.org/changeset/base/213137 Log: Add gptboot script that is responsible for: - looking for partition with 'bootonce' attribute alone (without 'bootme' attribute), removing it and logging that we successfully booted from this partition. - looking for partitions with 'bootfailed' attribute, removing it and logging that we failed to boot from this partition. Reviewed by: arch (Message-ID: <20100917234542.GE1902@garage.freebsd.pl>) Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com MFC after: 2 weeks Added: head/etc/rc.d/gptboot (contents, props changed) Modified: head/etc/rc.d/Makefile Modified: head/etc/rc.d/Makefile ============================================================================== --- head/etc/rc.d/Makefile Fri Sep 24 19:49:12 2010 (r213136) +++ head/etc/rc.d/Makefile Fri Sep 24 19:53:55 2010 (r213137) @@ -11,7 +11,7 @@ FILES= DAEMON FILESYSTEMS LOGIN NETWORKI dmesg dumpon \ encswap \ faith fsck ftp-proxy ftpd \ - gbde geli geli2 gssd \ + gbde geli geli2 gptboot gssd \ hastd hcsecd \ hostapd hostid hostid_save hostname \ inetd initrandom \ Added: head/etc/rc.d/gptboot ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/etc/rc.d/gptboot Fri Sep 24 19:53:55 2010 (r213137) @@ -0,0 +1,76 @@ +#!/bin/sh +# +# Copyright (c) 2010 Pawel Jakub Dawidek +# 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$ +# + +# PROVIDE: gptboot +# REQUIRE: mountcritremote +# KEYWORD: nojail + +. /etc/rc.subr + +name="gptboot" +start_cmd="gptboot_report" + +gptboot_report() +{ + gpart show | \ + egrep '(^=>| freebsd-ufs .*(\[|,)(bootfailed|bootonce)(,|\]))' | \ + sed 's/^=>//' | \ + egrep -v '(\[|,)bootme(,|\])' | \ + while read start size pos type attrs rest; do + case "${pos}" in + [0-9]*) + if [ -n "${disk}" ]; then + part="${disk}p${pos}" + echo "${attrs}" | egrep -q '(\[|,)bootfailed(,|\])' + bootfailed=$? + echo "${attrs}" | egrep -q '(\[|,)bootonce(,|\])' + bootonce=$? + if [ ${bootfailed} -eq 0 ]; then + logger -t gptboot -p local0.notice "Boot from ${part} failed." + gpart unset -a bootfailed -i ${pos} ${disk} >/dev/null + elif [ ${bootonce} -eq 0 ]; then + # We want to log success after all failures. + echo -n "Boot from ${part} succeeded." + gpart unset -a bootonce -i ${pos} ${disk} >/dev/null + fi + fi + ;; + *) + if [ "${type}" = "GPT" ]; then + disk="${pos}" + else + disk="" + fi + ;; + esac + done | logger -t gptboot -p local0.notice +} + +load_rc_config $name +run_rc_command "$1" From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 20:04:24 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 32B25106564A; Fri, 24 Sep 2010 20:04:24 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 215A68FC13; Fri, 24 Sep 2010 20:04:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OK4OW7038312; Fri, 24 Sep 2010 20:04:24 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OK4OZQ038310; Fri, 24 Sep 2010 20:04:24 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009242004.o8OK4OZQ038310@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 20:04:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213138 - stable/7/sys/pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 20:04:24 -0000 Author: yongari Date: Fri Sep 24 20:04:23 2010 New Revision: 213138 URL: http://svn.freebsd.org/changeset/base/213138 Log: MFC r195484: Make xl(4) build with Tx checksum offload. PR: kern/136409 Modified: stable/7/sys/pci/if_xl.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/pci/if_xl.c ============================================================================== --- stable/7/sys/pci/if_xl.c Fri Sep 24 19:53:55 2010 (r213137) +++ stable/7/sys/pci/if_xl.c Fri Sep 24 20:04:23 2010 (r213138) @@ -2509,12 +2509,12 @@ xl_encap(struct xl_softc *sc, struct xl_ status = XL_TXSTAT_RND_DEFEAT; #ifndef XL905B_TXCSUM_BROKEN - if (m_head->m_pkthdr.csum_flags) { - if (m_head->m_pkthdr.csum_flags & CSUM_IP) + if ((*m_head)->m_pkthdr.csum_flags) { + if ((*m_head)->m_pkthdr.csum_flags & CSUM_IP) status |= XL_TXSTAT_IPCKSUM; - if (m_head->m_pkthdr.csum_flags & CSUM_TCP) + if ((*m_head)->m_pkthdr.csum_flags & CSUM_TCP) status |= XL_TXSTAT_TCPCKSUM; - if (m_head->m_pkthdr.csum_flags & CSUM_UDP) + if ((*m_head)->m_pkthdr.csum_flags & CSUM_UDP) status |= XL_TXSTAT_UDPCKSUM; } #endif From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 20:09:00 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 20CBB106564A; Fri, 24 Sep 2010 20:09:00 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0F5178FC13; Fri, 24 Sep 2010 20:09:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OK8xtJ038457; Fri, 24 Sep 2010 20:08:59 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OK8xYj038455; Fri, 24 Sep 2010 20:08:59 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009242008.o8OK8xYj038455@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 24 Sep 2010 20:08:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213139 - stable/7/sys/pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 20:09:00 -0000 Author: yongari Date: Fri Sep 24 20:08:59 2010 New Revision: 213139 URL: http://svn.freebsd.org/changeset/base/213139 Log: MFC r191609: remove dead code with reference to IFQ_HANDOFF Modified: stable/7/sys/pci/if_xl.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/pci/if_xl.c ============================================================================== --- stable/7/sys/pci/if_xl.c Fri Sep 24 20:04:23 2010 (r213138) +++ stable/7/sys/pci/if_xl.c Fri Sep 24 20:08:59 2010 (r213139) @@ -803,32 +803,6 @@ xl_setmulti_hash(struct xl_softc *sc) CSR_WRITE_2(sc, XL_COMMAND, rxfilt | XL_CMD_RX_SET_FILT); } -#ifdef notdef -static void -xl_testpacket(struct xl_softc *sc) -{ - struct mbuf *m; - struct ifnet *ifp = sc->xl_ifp; - - MGETHDR(m, M_DONTWAIT, MT_DATA); - - if (m == NULL) - return; - - bcopy(IF_LLADDR(sc->xl_ifp), - mtod(m, struct ether_header *)->ether_dhost, ETHER_ADDR_LEN); - bcopy(IF_LLADDR(sc->xl_ifp), - mtod(m, struct ether_header *)->ether_shost, ETHER_ADDR_LEN); - mtod(m, struct ether_header *)->ether_type = htons(3); - mtod(m, unsigned char *)[14] = 0; - mtod(m, unsigned char *)[15] = 0; - mtod(m, unsigned char *)[16] = 0xE3; - m->m_len = m->m_pkthdr.len = sizeof(struct ether_header) + 3; - IFQ_ENQUEUE(&ifp->if_snd, m); - xl_start(ifp); -} -#endif - static void xl_setcfg(struct xl_softc *sc) { From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 20:29:21 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A36BC1065679 for ; Fri, 24 Sep 2010 20:29:21 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from mail2.fluidhosting.com (mx21.fluidhosting.com [204.14.89.4]) by mx1.freebsd.org (Postfix) with ESMTP id 2BF7A8FC1F for ; Fri, 24 Sep 2010 20:29:20 +0000 (UTC) Received: (qmail 7118 invoked by uid 399); 24 Sep 2010 20:29:19 -0000 Received: from localhost (HELO ?192.168.0.142?) (dougb@dougbarton.us@127.0.0.1) by localhost with ESMTPAM; 24 Sep 2010 20:29:19 -0000 X-Originating-IP: 127.0.0.1 X-Sender: dougb@dougbarton.us Message-ID: <4C9D0A1F.7050804@FreeBSD.org> Date: Fri, 24 Sep 2010 13:29:19 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4 MIME-Version: 1.0 To: John Baldwin References: <20100922222441.00002f27@unknown> <20100923.203143.19192035494300157.imp@bsdimp.com> <1285297884.17619.17.camel@neo.cse.buffalo.edu> <201009240923.04406.jhb@freebsd.org> In-Reply-To: <201009240923.04406.jhb@freebsd.org> X-Enigmail-Version: 1.2a1pre OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: bruce@cran.org.uk, src-committers@freebsd.org, Ken Smith , svn-src-all@freebsd.org, avg@freebsd.org, gavin@freebsd.org, svn-src-head@freebsd.org, "M. Warner Losh" Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 20:29:21 -0000 On 9/24/2010 6:23 AM, John Baldwin wrote: > The biggest argument against this (and the reason I always enable crashdumps > on all machines I am involved with) is that many panics are not easily > reproducible, esp. ones that trigger under load. If dumpdev is not on by > default, then the info from a rare or hard-to-trigger bug may simply be lost. > Also, "just send-pr or mail the 'foo' file" is even simpler than "enable this > knob in rc.conf and reproduce your issue, then come back". I agree with John, and the others who have expressed similar sentiments. All of the technical problems that prevent this have solutions, particularly if Y! is willing to donate the patch that prevents multiple dumps from filling the disk. FWIW, Doug -- ... and that's just a little bit of history repeating. -- Propellerheads Improve the effectiveness of your Internet presence with a domain name makeover! http://SupersetSolutions.com/ From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 20:48:42 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 20CCB106564A for ; Fri, 24 Sep 2010 20:48:42 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from mail2.fluidhosting.com (mx21.fluidhosting.com [204.14.89.4]) by mx1.freebsd.org (Postfix) with ESMTP id BCA778FC08 for ; Fri, 24 Sep 2010 20:48:41 +0000 (UTC) Received: (qmail 9015 invoked by uid 399); 24 Sep 2010 20:48:40 -0000 Received: from localhost (HELO ?192.168.0.142?) (dougb@dougbarton.us@127.0.0.1) by localhost with ESMTPAM; 24 Sep 2010 20:48:40 -0000 X-Originating-IP: 127.0.0.1 X-Sender: dougb@dougbarton.us Message-ID: <4C9D0EA7.1060900@FreeBSD.org> Date: Fri, 24 Sep 2010 13:48:39 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4 MIME-Version: 1.0 To: Rui Paulo References: <201009221800.o8MI0Ze3038214@svn.freebsd.org> <20100923070247.L716@delplex.bde.org> <3CC9503B-35BA-4637-8909-CBC6674ACDDA@freebsd.org> In-Reply-To: <3CC9503B-35BA-4637-8909-CBC6674ACDDA@freebsd.org> X-Enigmail-Version: 1.2a1pre OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org, Bruce Evans Subject: Re: svn commit: r213002 - in stable/8: include lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 20:48:42 -0000 On 9/23/2010 11:14 PM, Rui Paulo wrote: > On 22 Sep 2010, at 22:08, Bruce Evans wrote: > >> On Wed, 22 Sep 2010, Rui Paulo wrote: >> >>> Log: >>> MFC r197804 (rwatson): >>> Add basename_r(3) to complement basename(3). basename_r(3) which accepts >>> a caller-allocated buffer of at least MAXPATHLEN, rather than using a >>> global buffer. >> >> MAXPATHLEN has been deprecated for more than 20 years. Please don't use >> it in new interfaces. A few man pages, not including basename.3, have >> been updated to spell it PATH_MAX (should be {PATH_MAX}). > > I'm not going to fix this because the interface will most likely change to something that doesn't require PATH_MAX. But thanks for pointing this out. There are 2 possibilities. The first is that you do actually fix it soon, in which case the change Bruce asked for is harmless churn. This is common and accepted in HEAD. The other possibility (which happens to us all) is that the intended fixup never occurs, so the inappropriate code lingers and is ultimately forgotten. The potential cost in this case is much higher than the potential cost of some harmless churn. Bonus points if someone copies and pastes your code in the intervening period. Doug -- ... and that's just a little bit of history repeating. -- Propellerheads Improve the effectiveness of your Internet presence with a domain name makeover! http://SupersetSolutions.com/ From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 20:52:58 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ECFC9106567A; Fri, 24 Sep 2010 20:52:57 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from tarsier.geekcn.org (tarsier.geekcn.org [IPv6:2001:470:a803::1]) by mx1.freebsd.org (Postfix) with ESMTP id 61CF58FC26; Fri, 24 Sep 2010 20:52:57 +0000 (UTC) Received: from mail.geekcn.org (tarsier.geekcn.org [211.166.10.233]) by tarsier.geekcn.org (Postfix) with ESMTP id 2BD8BA686DE; Sat, 25 Sep 2010 04:52:56 +0800 (CST) X-Virus-Scanned: amavisd-new at geekcn.org Received: from tarsier.geekcn.org ([211.166.10.233]) by mail.geekcn.org (mail.geekcn.org [211.166.10.233]) (amavisd-new, port 10024) with LMTP id PBM1M1F1uc+G; Sat, 25 Sep 2010 04:52:50 +0800 (CST) Received: from delta.delphij.net (drawbridge.ixsystems.com [206.40.55.65]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tarsier.geekcn.org (Postfix) with ESMTPSA id 8B932A6868C; Sat, 25 Sep 2010 04:52:47 +0800 (CST) DomainKey-Signature: a=rsa-sha1; s=default; d=delphij.net; c=nofws; q=dns; h=message-id:date:from:reply-to:organization:user-agent: mime-version:to:cc:subject:references:in-reply-to: x-enigmail-version:openpgp:content-type:content-transfer-encoding; b=vNXUaZg8IzHzj993UsfNi7RTztzGjA+RRGhLWPbUW/FaMlojN8LGTHCgRx20/lsze 5GUzJl7Yjzoif0gvGfk3w== Message-ID: <4C9D0F9C.1020607@delphij.net> Date: Fri, 24 Sep 2010 13:52:44 -0700 From: Xin LI Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.1.12) Gecko/20100920 Thunderbird/3.0.8 ThunderBrowse/3.3.2 MIME-Version: 1.0 To: "M. Warner Losh" References: <20100922222441.00002f27@unknown> <1285253887.95760.33.camel@bauer.cse.buffalo.edu> <20100923.203143.19192035494300157.imp@bsdimp.com> In-Reply-To: <20100923.203143.19192035494300157.imp@bsdimp.com> X-Enigmail-Version: 1.0.1 OpenPGP: id=3FCA37C1; url=http://www.delphij.net/delphij.asc Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: bruce@cran.org.uk, src-committers@FreeBSD.ORG, kensmith@buffalo.edu, jhb@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, avg@FreeBSD.ORG, gavin@FreeBSD.ORG, svn-src-head@FreeBSD.ORG Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: d@delphij.net List-Id: "SVN commit messages 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 Sep 2010 20:52:58 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 2010/09/23 19:31, M. Warner Losh wrote: > In message: > Gavin Atkinson writes: > : On Thu, 23 Sep 2010, Ken Smith wrote: > : > The issues talked about so far all contribute to the reason for that. > : > But one of the more basic gut reactions to it all is that the users > : > want to be interested in helping with the debugging (even if just > : > providing the requested info) for any sort of crash information > : > to be useful. And at the point we shift something from -current > : > to -stable the percentage of people actively interested in participating > : > in that sort of stuff flip. The bulk of people using -current > : > know it's risky and they do it out of some interest in debugging > : > stuff. The *bulk* of people using -stable are less interested or > : > flat out not interested. And have no clue what crash dumps are, > : > may be challenged to notice partition-getting-full issues, etc. > : > : I'm not sure I buy this argument, I'm afraid. Part of the advantage of > : having all this done automatically on the as-shipped release media is that > : end users don't have to be interested in debugging - crashinfo(8) does > : most of the work for them. There's no easy way to actually determine > : figures, but even if say only 10-15% of crashes can be diagnosed and > : corrected just from the output of crashinfo(8) then that's a huge win for > : the project as a whole. I'm guessing 10-15% is not unrealistic. > : > : I appreciate the issue about filling partitions is a valid one. Would a > : possible compromise be that on release media, crashinfo(8) or similar will > : default to only keeping the most recent coredump or similar? Given /var > : now defaults to 4GB, Defaulting to keeping a single core is probably > : acceptable. > > Furthermore, if we aren't interested in crash dumps by default, why do > we install the huge .symbols files? +1. Even textdump would be a huge help for the project (except it depends on KDB/DDB which should be considered more thoroughly due to security consequences). Cheers, - -- Xin LI http://www.delphij.net/ FreeBSD - The Power to Serve! Live free or die -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (FreeBSD) iQEcBAEBCAAGBQJMnQ+cAAoJEATO+BI/yjfBv+gH/27HC9fRFNlYh28YypZFjK/K FWKed15ZK+kR8pAvpONibBY/yWAWzsYyCxADn0q2aGAYItukQkonZnTWAQTbcbaG d4begzGOrr9xWRYbIar8VvLM7mlUu99FNVkscFMsNvkD6mMP7N6MB9SNnqg/yRSo jbSUceIkASnZni0poHoAKCpBJsPu2Yt/XnBXhbtR6tzHiWZKqKMCm5yfDHvH0+Cw kNcR6jInnGJk8f2qk2a6h2Qtu6/R9vwkmidtBCX7CLba07yRHP/cgjiAN79AgnKx 7AHw5ZCItGJMjyGukuc1eSBPJluzmTRXwhzZt+zbTB5He3gWe78jRkylDoj0qMw= =TtpC -----END PGP SIGNATURE----- From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 21:23:23 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9E9F2106566C; Fri, 24 Sep 2010 21:23:23 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 730808FC13; Fri, 24 Sep 2010 21:23:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8OLNNXP040138; Fri, 24 Sep 2010 21:23:23 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8OLNN1A040136; Fri, 24 Sep 2010 21:23:23 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201009242123.o8OLNN1A040136@svn.freebsd.org> From: Juli Mallett Date: Fri, 24 Sep 2010 21:23:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213140 - head/sys/mips/cavium X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 21:23:23 -0000 Author: jmallett Date: Fri Sep 24 21:23:23 2010 New Revision: 213140 URL: http://svn.freebsd.org/changeset/base/213140 Log: Make the vast majority of Simple Executive files standard. Perhaps some of these could be made dependent on either of the octusb or octe options, but making them standard fixes a number of option combinations that were previously broken. Modified: head/sys/mips/cavium/files.octeon1 Modified: head/sys/mips/cavium/files.octeon1 ============================================================================== --- head/sys/mips/cavium/files.octeon1 Fri Sep 24 20:08:59 2010 (r213139) +++ head/sys/mips/cavium/files.octeon1 Fri Sep 24 21:23:23 2010 (r213140) @@ -39,30 +39,29 @@ mips/cavium/octopci_bus_space.c option mips/cavium/usb/octusb.c optional usb octusb mips/cavium/usb/octusb_octeon.c optional usb octusb -contrib/octeon-sdk/cvmx-cmd-queue.c optional octe -contrib/octeon-sdk/cvmx-fpa.c optional octe -contrib/octeon-sdk/cvmx-helper.c optional octe -contrib/octeon-sdk/cvmx-helper-board.c optional octe -contrib/octeon-sdk/cvmx-helper-errata.c optional octe -contrib/octeon-sdk/cvmx-helper-fpa.c optional octe -contrib/octeon-sdk/cvmx-helper-loop.c optional octe -contrib/octeon-sdk/cvmx-helper-npi.c optional octe -contrib/octeon-sdk/cvmx-helper-rgmii.c optional octe -contrib/octeon-sdk/cvmx-helper-sgmii.c optional octe -contrib/octeon-sdk/cvmx-helper-spi.c optional octe -contrib/octeon-sdk/cvmx-helper-util.c optional octe -contrib/octeon-sdk/cvmx-helper-xaui.c optional octe -contrib/octeon-sdk/cvmx-pko.c optional octe -contrib/octeon-sdk/cvmx-spi.c optional octe -contrib/octeon-sdk/cvmx-spi4000.c optional octe -contrib/octeon-sdk/cvmx-twsi.c optional octe - contrib/octeon-sdk/cvmx-usb.c optional octusb # XXX Some files could be excluded in some configurations. Making them # optional but on in the default config would seem reasonable. +contrib/octeon-sdk/cvmx-cmd-queue.c standard contrib/octeon-sdk/cvmx-bootmem.c standard +contrib/octeon-sdk/cvmx-fpa.c standard +contrib/octeon-sdk/cvmx-helper.c standard +contrib/octeon-sdk/cvmx-helper-board.c standard +contrib/octeon-sdk/cvmx-helper-errata.c standard +contrib/octeon-sdk/cvmx-helper-fpa.c standard +contrib/octeon-sdk/cvmx-helper-loop.c standard +contrib/octeon-sdk/cvmx-helper-npi.c standard +contrib/octeon-sdk/cvmx-helper-rgmii.c standard +contrib/octeon-sdk/cvmx-helper-sgmii.c standard +contrib/octeon-sdk/cvmx-helper-spi.c standard +contrib/octeon-sdk/cvmx-helper-util.c standard +contrib/octeon-sdk/cvmx-helper-xaui.c standard +contrib/octeon-sdk/cvmx-pko.c standard +contrib/octeon-sdk/cvmx-spi.c standard +contrib/octeon-sdk/cvmx-spi4000.c standard contrib/octeon-sdk/cvmx-sysinfo.c standard contrib/octeon-sdk/cvmx-thunder.c standard +contrib/octeon-sdk/cvmx-twsi.c standard contrib/octeon-sdk/cvmx-warn.c standard contrib/octeon-sdk/octeon-model.c standard From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 23:47:42 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BE3EF1065675; Fri, 24 Sep 2010 23:47:42 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AC7FF8FC18; Fri, 24 Sep 2010 23:47:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8ONlgU3043100; Fri, 24 Sep 2010 23:47:42 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8ONlgOd043098; Fri, 24 Sep 2010 23:47:42 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201009242347.o8ONlgOd043098@svn.freebsd.org> From: Xin LI Date: Fri, 24 Sep 2010 23:47:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213144 - stable/8/lib/libutil X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 23:47:42 -0000 Author: delphij Date: Fri Sep 24 23:47:42 2010 New Revision: 213144 URL: http://svn.freebsd.org/changeset/base/213144 Log: MFC r211393 (des): In setusercontext(), do not apply user settings unless running as the user in question (usually but not necessarily because we were called with LOGIN_SETUSER). This plugs a hole where users could raise their resource limits and expand their CPU mask. Approved by: des Modified: stable/8/lib/libutil/login_class.c Directory Properties: stable/8/lib/libutil/ (props changed) Modified: stable/8/lib/libutil/login_class.c ============================================================================== --- stable/8/lib/libutil/login_class.c Fri Sep 24 21:55:44 2010 (r213143) +++ stable/8/lib/libutil/login_class.c Fri Sep 24 23:47:42 2010 (r213144) @@ -525,7 +525,7 @@ setusercontext(login_cap_t *lc, const st /* * Now, we repeat some of the above for the user's private entries */ - if ((lc = login_getuserclass(pwd)) != NULL) { + if (getuid() == uid && (lc = login_getuserclass(pwd)) != NULL) { mymask = setlogincontext(lc, pwd, mymask, flags); login_close(lc); } From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 23:48:29 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 89BDC1065674; Fri, 24 Sep 2010 23:48:29 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 77D918FC0A; Fri, 24 Sep 2010 23:48:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8ONmThX043167; Fri, 24 Sep 2010 23:48:29 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8ONmTl8043165; Fri, 24 Sep 2010 23:48:29 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201009242348.o8ONmTl8043165@svn.freebsd.org> From: Xin LI Date: Fri, 24 Sep 2010 23:48:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213145 - stable/7/lib/libutil X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 23:48:29 -0000 Author: delphij Date: Fri Sep 24 23:48:29 2010 New Revision: 213145 URL: http://svn.freebsd.org/changeset/base/213145 Log: MFC r211393 (by des): In setusercontext(), do not apply user settings unless running as the user in question (usually but not necessarily because we were called with LOGIN_SETUSER). This plugs a hole where users could raise their resource limits and expand their CPU mask. Approved by: des Modified: stable/7/lib/libutil/login_class.c Directory Properties: stable/7/lib/libutil/ (props changed) Modified: stable/7/lib/libutil/login_class.c ============================================================================== --- stable/7/lib/libutil/login_class.c Fri Sep 24 23:47:42 2010 (r213144) +++ stable/7/lib/libutil/login_class.c Fri Sep 24 23:48:29 2010 (r213145) @@ -523,7 +523,7 @@ setusercontext(login_cap_t *lc, const st /* * Now, we repeat some of the above for the user's private entries */ - if ((lc = login_getuserclass(pwd)) != NULL) { + if (getuid() == uid && (lc = login_getuserclass(pwd)) != NULL) { mymask = setlogincontext(lc, pwd, mymask, flags); login_close(lc); } From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 23:50:01 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4759F1065670; Fri, 24 Sep 2010 23:50:01 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id 0307F8FC15; Fri, 24 Sep 2010 23:50:00 +0000 (UTC) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id D12C21FFC34; Fri, 24 Sep 2010 23:49:59 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id ABD198452F; Sat, 25 Sep 2010 01:49:59 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Kostik Belousov References: <201009160756.o8G7uZrg065332@svn.freebsd.org> <20100924115311.GH34228@deviant.kiev.zoral.com.ua> Date: Sat, 25 Sep 2010 01:49:59 +0200 In-Reply-To: <20100924115311.GH34228@deviant.kiev.zoral.com.ua> (Kostik Belousov's message of "Fri, 24 Sep 2010 14:53:11 +0300") Message-ID: <86d3s2og60.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (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, pluknet , src-committers@freebsd.org Subject: Re: svn commit: r212723 - head/sys/compat/linprocfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 23:50:01 -0000 Kostik Belousov writes: > This is easy to fix, isn't it ? But there seems to be much more nits. > > First, allocating 512 * sizeof(char *)-byte object on the stack is not > good. > > Second, the initialization of iov_len for reading the array > of string pointers misses '* sizeof(char *)'. > > And third (probably fatal) is the lack of checks that the end of > array and each string fits into the user portion of the map. I do not > see why addr that already has u_long type is casted to u_long. Also, > VM_MIN_ADDRESS, VM_MAXUSER_ADDRESS constants are for the native host > FreeBSD ABI, they may differ from the target process limits. Blah, I clearly didn't look closely enough at the final version. The original patch used malloc() but introduced a potential race condition due to having to drop the process lock. I wrote a version that used _PHOLD() / _PRELE() to hold the process across the unlock / malloc / lock window, but the originator had trouble with it (albeit only in qemu, not on real hardware), and I wasn't 100% sure my reasoning was sound, so I accepted his suggested solution. I'll look into this tomorrow. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 23:51:45 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BFC0C106564A; Fri, 24 Sep 2010 23:51:45 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ADF648FC08; Fri, 24 Sep 2010 23:51:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8ONpjhx043279; Fri, 24 Sep 2010 23:51:45 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8ONpjEr043277; Fri, 24 Sep 2010 23:51:45 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201009242351.o8ONpjEr043277@svn.freebsd.org> From: Xin LI Date: Fri, 24 Sep 2010 23:51:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213146 - stable/6/lib/libutil X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 23:51:45 -0000 Author: delphij Date: Fri Sep 24 23:51:45 2010 New Revision: 213146 URL: http://svn.freebsd.org/changeset/base/213146 Log: MFC r211393 (by des): In setusercontext(), do not apply user settings unless running as the user in question (usually but not necessarily because we were called with LOGIN_SETUSER). This plugs a hole where users could raise their resource limits and expand their CPU mask. Approved by: des Modified: stable/6/lib/libutil/login_class.c Directory Properties: stable/6/lib/libutil/ (props changed) Modified: stable/6/lib/libutil/login_class.c ============================================================================== --- stable/6/lib/libutil/login_class.c Fri Sep 24 23:48:29 2010 (r213145) +++ stable/6/lib/libutil/login_class.c Fri Sep 24 23:51:45 2010 (r213146) @@ -415,7 +415,7 @@ setusercontext(login_cap_t *lc, const st /* * Now, we repeat some of the above for the user's private entries */ - if ((lc = login_getuserclass(pwd)) != NULL) { + if (getuid() == uid && (lc = login_getuserclass(pwd)) != NULL) { mymask = setlogincontext(lc, pwd, mymask, flags); login_close(lc); } From owner-svn-src-all@FreeBSD.ORG Fri Sep 24 23:54:03 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CD602106564A; Fri, 24 Sep 2010 23:54:03 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BC3D88FC12; Fri, 24 Sep 2010 23:54:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8ONs3kM043353; Fri, 24 Sep 2010 23:54:03 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8ONs34F043351; Fri, 24 Sep 2010 23:54:03 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201009242354.o8ONs34F043351@svn.freebsd.org> From: Marius Strobl Date: Fri, 24 Sep 2010 23:54:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213147 - head/sys/dev/mpt X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 23:54:03 -0000 Author: marius Date: Fri Sep 24 23:54:03 2010 New Revision: 213147 URL: http://svn.freebsd.org/changeset/base/213147 Log: Take mpt_req_on_{free,pending}_list() out from under INVARIANTS as these are generally useful and not just for debugging. Modified: head/sys/dev/mpt/mpt.h Modified: head/sys/dev/mpt/mpt.h ============================================================================== --- head/sys/dev/mpt/mpt.h Fri Sep 24 23:51:45 2010 (r213146) +++ head/sys/dev/mpt/mpt.h Fri Sep 24 23:54:03 2010 (r213147) @@ -1157,19 +1157,13 @@ mpt_tag_2_req(struct mpt_softc *mpt, uin KASSERT(mpt->tgt_cmd_ptrs[rtg], ("no cmd backpointer")); return (mpt->tgt_cmd_ptrs[rtg]); } - +#endif static __inline int mpt_req_on_free_list(struct mpt_softc *, request_t *); static __inline int mpt_req_on_pending_list(struct mpt_softc *, request_t *); -static __inline void -mpt_req_spcl(struct mpt_softc *, request_t *, const char *, int); -static __inline void -mpt_req_not_spcl(struct mpt_softc *, request_t *, const char *, int); - - /* * Is request on freelist? */ @@ -1202,6 +1196,12 @@ mpt_req_on_pending_list(struct mpt_softc return (0); } +#ifdef INVARIANTS +static __inline void +mpt_req_spcl(struct mpt_softc *, request_t *, const char *, int); +static __inline void +mpt_req_not_spcl(struct mpt_softc *, request_t *, const char *, int); + /* * Make sure that req *is* part of one of the special lists */ From owner-svn-src-all@FreeBSD.ORG Sat Sep 25 00:55:13 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BC9F41065674; Sat, 25 Sep 2010 00:55:13 +0000 (UTC) (envelope-from peterjeremy@acm.org) Received: from fallbackmx10.syd.optusnet.com.au (fallbackmx10.syd.optusnet.com.au [211.29.132.251]) by mx1.freebsd.org (Postfix) with ESMTP id 3E3328FC1A; Sat, 25 Sep 2010 00:55:13 +0000 (UTC) Received: from mail35.syd.optusnet.com.au (mail35.syd.optusnet.com.au [211.29.133.51]) by fallbackmx10.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o8OMrupM023521; Sat, 25 Sep 2010 08:53:56 +1000 Received: from server.vk2pj.dyndns.org (c220-239-116-103.belrs4.nsw.optusnet.com.au [220.239.116.103]) by mail35.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o8OMrqa2005695 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 25 Sep 2010 08:53:53 +1000 X-Bogosity: Ham, spamicity=0.000000 Received: from server.vk2pj.dyndns.org (localhost.vk2pj.dyndns.org [127.0.0.1]) by server.vk2pj.dyndns.org (8.14.4/8.14.4) with ESMTP id o8OMrqmq022394; Sat, 25 Sep 2010 08:53:52 +1000 (EST) (envelope-from peter@server.vk2pj.dyndns.org) Received: (from peter@localhost) by server.vk2pj.dyndns.org (8.14.4/8.14.4/Submit) id o8OMrqoq022393; Sat, 25 Sep 2010 08:53:52 +1000 (EST) (envelope-from peter) Date: Sat, 25 Sep 2010 08:53:52 +1000 From: Peter Jeremy To: freebsd-arch@freebsd.org Message-ID: <20100924225352.GD49476@server.vk2pj.dyndns.org> References: <201009211507.o8LF7iVv097676@svn.freebsd.org> <4C9A1602.4020204@freebsd.org> <1285169017.64197.29.camel@buffy.york.ac.uk> <201009221558.27393.jhb@freebsd.org> <4C9A6EE6.5050301@freebsd.org> <20100922222441.00002f27@unknown> <1285253887.95760.33.camel@bauer.cse.buffalo.edu> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="8w3uRX/HFJGApMzv" Content-Disposition: inline In-Reply-To: X-PGP-Key: http://members.optusnet.com.au/peterjeremy/pubkey.asc User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 00:55:13 -0000 --8w3uRX/HFJGApMzv Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable [Pruning CC list and re-adding freebsd-arch on the (forlorn) hope that this thread will move to where it belongs] On 2010-Sep-23 07:31:13 -0700, Matthew Jacob wrote: >It turns out that the big issue here was more the savecore time coming=20 >back up rather than the time of dumping. In my experience, the problem isn't so much the savecore time as the time to run /usr/bin/crashinfo. Whilst savecore needs to run early (before anything tramples on the crashdump in swap), the latter could run at any time. It would seem reasonable to either run crashinfo in the background or as a batchjob triggered by /etc/rc.d/savecore. On 2010-Sep-23 18:59:53 +0100, Gavin Atkinson wrote: >I appreciate the issue about filling partitions is a valid one. Would a= =20 >possible compromise be that on release media, crashinfo(8) or similar will= =20 >default to only keeping the most recent coredump or similar? Given /var= =20 >now defaults to 4GB, Defaulting to keeping a single core is probably=20 >acceptable. savecore already has support for a 'minfree' file to prevent crashdumps filling the crashdir. Maybe the default install should include a minfree set to (say) 512MB. --=20 Peter Jeremy --8w3uRX/HFJGApMzv Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.15 (FreeBSD) iEYEARECAAYFAkydLAAACgkQ/opHv/APuIeBZwCgrPXGmE7tyoHtpXnxO14kZa9q ezAAoIqq9p9cKpm2pD4gHQbBqSEWcATJ =tjph -----END PGP SIGNATURE----- --8w3uRX/HFJGApMzv-- From owner-svn-src-all@FreeBSD.ORG Sat Sep 25 01:18:01 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B84A3106564A; Sat, 25 Sep 2010 01:18:01 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A5D4B8FC17; Sat, 25 Sep 2010 01:18:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8P1I1Wj045194; Sat, 25 Sep 2010 01:18:01 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8P1I1La045188; Sat, 25 Sep 2010 01:18:01 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201009250118.o8P1I1La045188@svn.freebsd.org> From: Juli Mallett Date: Sat, 25 Sep 2010 01:18:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213150 - head/sys/mips/cavium/octe X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 01:18:01 -0000 Author: jmallett Date: Sat Sep 25 01:18:01 2010 New Revision: 213150 URL: http://svn.freebsd.org/changeset/base/213150 Log: Handle link updates in a task. Modified: head/sys/mips/cavium/octe/cavium-ethernet.h head/sys/mips/cavium/octe/ethernet-rgmii.c head/sys/mips/cavium/octe/ethernet-sgmii.c head/sys/mips/cavium/octe/ethernet-xaui.c head/sys/mips/cavium/octe/ethernet.c Modified: head/sys/mips/cavium/octe/cavium-ethernet.h ============================================================================== --- head/sys/mips/cavium/octe/cavium-ethernet.h Sat Sep 25 00:01:55 2010 (r213149) +++ head/sys/mips/cavium/octe/cavium-ethernet.h Sat Sep 25 01:18:01 2010 (r213150) @@ -75,6 +75,8 @@ typedef struct { struct ifqueue tx_free_queue[16]; + int need_link_update; + struct task link_task; struct ifmedia media; int if_flags; Modified: head/sys/mips/cavium/octe/ethernet-rgmii.c ============================================================================== --- head/sys/mips/cavium/octe/ethernet-rgmii.c Sat Sep 25 00:01:55 2010 (r213149) +++ head/sys/mips/cavium/octe/ethernet-rgmii.c Sat Sep 25 01:18:01 2010 (r213150) @@ -136,27 +136,8 @@ static void cvm_oct_rgmii_poll(struct if link_info = cvmx_helper_link_autoconf(priv->port); priv->link_info = link_info.u64; + priv->need_link_update = 1; mtx_unlock_spin(&global_register_lock); - - /* Tell Linux */ - if (link_info.s.link_up) { - - if_link_state_change(ifp, LINK_STATE_UP); - if (priv->queue != -1) - DEBUGPRINT("%s: %u Mbps %s duplex, port %2d, queue %2d\n", - if_name(ifp), link_info.s.speed, - (link_info.s.full_duplex) ? "Full" : "Half", - priv->port, priv->queue); - else - DEBUGPRINT("%s: %u Mbps %s duplex, port %2d, POW\n", - if_name(ifp), link_info.s.speed, - (link_info.s.full_duplex) ? "Full" : "Half", - priv->port); - } else { - - if_link_state_change(ifp, LINK_STATE_DOWN); - DEBUGPRINT("%s: Link down\n", if_name(ifp)); - } } Modified: head/sys/mips/cavium/octe/ethernet-sgmii.c ============================================================================== --- head/sys/mips/cavium/octe/ethernet-sgmii.c Sat Sep 25 00:01:55 2010 (r213149) +++ head/sys/mips/cavium/octe/ethernet-sgmii.c Sat Sep 25 01:18:01 2010 (r213150) @@ -93,25 +93,7 @@ static void cvm_oct_sgmii_poll(struct if link_info = cvmx_helper_link_autoconf(priv->port); priv->link_info = link_info.u64; - - /* Tell Linux */ - if (link_info.s.link_up) { - - if_link_state_change(ifp, LINK_STATE_UP); - if (priv->queue != -1) - DEBUGPRINT("%s: %u Mbps %s duplex, port %2d, queue %2d\n", - if_name(ifp), link_info.s.speed, - (link_info.s.full_duplex) ? "Full" : "Half", - priv->port, priv->queue); - else - DEBUGPRINT("%s: %u Mbps %s duplex, port %2d, POW\n", - if_name(ifp), link_info.s.speed, - (link_info.s.full_duplex) ? "Full" : "Half", - priv->port); - } else { - if_link_state_change(ifp, LINK_STATE_DOWN); - DEBUGPRINT("%s: Link down\n", if_name(ifp)); - } + priv->need_link_update = 1; } int cvm_oct_sgmii_init(struct ifnet *ifp) Modified: head/sys/mips/cavium/octe/ethernet-xaui.c ============================================================================== --- head/sys/mips/cavium/octe/ethernet-xaui.c Sat Sep 25 00:01:55 2010 (r213149) +++ head/sys/mips/cavium/octe/ethernet-xaui.c Sat Sep 25 01:18:01 2010 (r213150) @@ -92,25 +92,7 @@ static void cvm_oct_xaui_poll(struct ifn link_info = cvmx_helper_link_autoconf(priv->port); priv->link_info = link_info.u64; - - /* Tell Linux */ - if (link_info.s.link_up) { - - if_link_state_change(ifp, LINK_STATE_UP); - if (priv->queue != -1) - DEBUGPRINT("%s: %u Mbps %s duplex, port %2d, queue %2d\n", - if_name(ifp), link_info.s.speed, - (link_info.s.full_duplex) ? "Full" : "Half", - priv->port, priv->queue); - else - DEBUGPRINT("%s: %u Mbps %s duplex, port %2d, POW\n", - if_name(ifp), link_info.s.speed, - (link_info.s.full_duplex) ? "Full" : "Half", - priv->port); - } else { - if_link_state_change(ifp, LINK_STATE_DOWN); - DEBUGPRINT("%s: Link down\n", if_name(ifp)); - } + priv->need_link_update = 1; } Modified: head/sys/mips/cavium/octe/ethernet.c ============================================================================== --- head/sys/mips/cavium/octe/ethernet.c Sat Sep 25 00:01:55 2010 (r213149) +++ head/sys/mips/cavium/octe/ethernet.c Sat Sep 25 01:18:01 2010 (r213150) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -129,6 +130,40 @@ static struct callout cvm_oct_poll_timer */ struct ifnet *cvm_oct_device[TOTAL_NUMBER_OF_PORTS]; +/** + * Task to handle link status changes. + */ +static struct taskqueue *cvm_oct_link_taskq; + +/** + * Function to update link status. + */ +static void cvm_oct_update_link(void *context, int pending) +{ + cvm_oct_private_t *priv = (cvm_oct_private_t *)context; + struct ifnet *ifp = priv->ifp; + cvmx_helper_link_info_t link_info; + + link_info.u64 = priv->link_info; + + if (link_info.s.link_up) { + if_link_state_change(ifp, LINK_STATE_UP); + if (priv->queue != -1) + DEBUGPRINT("%s: %u Mbps %s duplex, port %2d, queue %2d\n", + if_name(ifp), link_info.s.speed, + (link_info.s.full_duplex) ? "Full" : "Half", + priv->port, priv->queue); + else + DEBUGPRINT("%s: %u Mbps %s duplex, port %2d, POW\n", + if_name(ifp), link_info.s.speed, + (link_info.s.full_duplex) ? "Full" : "Half", + priv->port); + } else { + if_link_state_change(ifp, LINK_STATE_DOWN); + DEBUGPRINT("%s: Link down\n", if_name(ifp)); + } + priv->need_link_update = 0; +} /** * Periodic timer tick for slow management operations @@ -149,6 +184,10 @@ static void cvm_do_timer(void *arg) if (MDIO_TRYLOCK()) { priv->poll(cvm_oct_device[port]); MDIO_UNLOCK(); + + if (priv->need_link_update) { + taskqueue_enqueue(cvm_oct_link_taskq, &priv->link_task); + } } } @@ -323,6 +362,11 @@ int cvm_oct_init_module(device_t bus) memset(cvm_oct_device, 0, sizeof(cvm_oct_device)); + cvm_oct_link_taskq = taskqueue_create("octe link", M_NOWAIT, + taskqueue_thread_enqueue, &cvm_oct_link_taskq); + taskqueue_start_threads(&cvm_oct_link_taskq, 1, PI_NET, + "octe link taskq"); + /* Initialize the FAU used for counting packet buffers that need to be freed */ cvmx_fau_atomic_write32(FAU_NUM_PACKET_BUFFERS_TO_FREE, 0); @@ -345,6 +389,7 @@ int cvm_oct_init_module(device_t bus) priv->imode = CVMX_HELPER_INTERFACE_MODE_DISABLED; priv->port = CVMX_PIP_NUM_INPUT_PORTS; priv->queue = -1; + TASK_INIT(&priv->link_task, 0, cvm_oct_update_link, priv); device_set_desc(dev, "Cavium Octeon POW Ethernet\n"); @@ -398,6 +443,7 @@ int cvm_oct_init_module(device_t bus) priv->fau = fau - cvmx_pko_get_num_queues(port) * 4; for (qos = 0; qos < cvmx_pko_get_num_queues(port); qos++) cvmx_fau_atomic_write32(priv->fau+qos*4, 0); + TASK_INIT(&priv->link_task, 0, cvm_oct_update_link, priv); switch (priv->imode) { From owner-svn-src-all@FreeBSD.ORG Sat Sep 25 01:57:47 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 738961065674; Sat, 25 Sep 2010 01:57:47 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 606DE8FC0C; Sat, 25 Sep 2010 01:57:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8P1vlth046058; Sat, 25 Sep 2010 01:57:47 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8P1vlb2046043; Sat, 25 Sep 2010 01:57:47 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201009250157.o8P1vlb2046043@svn.freebsd.org> From: David Xu Date: Sat, 25 Sep 2010 01:57:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213153 - in head/lib: libc libc/gen libc/include librt libthr libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 01:57:47 -0000 Author: davidxu Date: Sat Sep 25 01:57:47 2010 New Revision: 213153 URL: http://svn.freebsd.org/changeset/base/213153 Log: To support stack unwinding for cancellation points, add -fexceptions flag for them, two functions _pthread_cancel_enter and _pthread_cancel_leave are added to let thread enter and leave a cancellation point, it also makes it possible that other functions can be cancellation points in libraries without having to be rewritten in libthr. Modified: head/lib/libc/Makefile head/lib/libc/gen/Makefile.inc head/lib/libc/gen/Symbol.map head/lib/libc/gen/_pthread_stubs.c head/lib/libc/gen/sem.c head/lib/libc/gen/sem_new.c head/lib/libc/include/libc_private.h head/lib/librt/Makefile head/lib/librt/mq.c head/lib/libthr/Makefile head/lib/libthr/pthread.map head/lib/libthr/thread/thr_cancel.c head/lib/libthr/thread/thr_init.c head/lib/libthr/thread/thr_private.h Modified: head/lib/libc/Makefile ============================================================================== --- head/lib/libc/Makefile Sat Sep 25 01:25:48 2010 (r213152) +++ head/lib/libc/Makefile Sat Sep 25 01:57:47 2010 (r213153) @@ -31,6 +31,11 @@ CLEANFILES+=tags INSTALL_PIC_ARCHIVE= PRECIOUSLIB= +.ifndef NO_THREAD_STACK_UNWIND +CANCELPOINTS_CFLAGS=-fexceptions +CFLAGS+=${CANCELPOINTS_CFLAGS} +.endif + # # Only link with static libgcc.a (no libgcc_eh.a). # @@ -145,3 +150,5 @@ CWARNFLAGS:= ${.IMPSRC:Ngdtoa_*.c:C/^.+$ SSP_CFLAGS:= ${SSP_CFLAGS:S/^-fstack-protector-all$/-fstack-protector/} # Disable stack protection for SSP symbols. SSP_CFLAGS:= ${.IMPSRC:N*/stack_protector.c:C/^.+$/${SSP_CFLAGS}/} +# Generate stack unwinding tables for cancellation points +CANCELPOINTS_CFLAGS:= ${.IMPSRC:Mcancelpoints_*:C/^.+$/${CANCELPOINTS_CFLAGS}/:C/^$//} Modified: head/lib/libc/gen/Makefile.inc ============================================================================== --- head/lib/libc/gen/Makefile.inc Sat Sep 25 01:25:48 2010 (r213152) +++ head/lib/libc/gen/Makefile.inc Sat Sep 25 01:57:47 2010 (r213153) @@ -25,7 +25,7 @@ SRCS+= __getosreldate.c __xuname.c \ pause.c pmadvise.c popen.c posix_spawn.c \ psignal.c pututxline.c pw_scan.c pwcache.c \ raise.c readdir.c readpassphrase.c rewinddir.c \ - scandir.c seed48.c seekdir.c sem.c sem_new.c semctl.c \ + scandir.c seed48.c seekdir.c semctl.c \ setdomainname.c sethostname.c setjmperr.c setmode.c \ setproctitle.c setprogname.c siginterrupt.c siglist.c signal.c \ sigsetops.c sleep.c srand48.c statvfs.c stringlist.c strtofflags.c \ @@ -35,6 +35,14 @@ SRCS+= __getosreldate.c __xuname.c \ usleep.c utime.c utxdb.c valloc.c vis.c wait.c wait3.c waitpid.c \ wordexp.c +CANCELPOINTS_SRCS=sem.c sem_new.c +.for src in ${CANCELPOINTS_SRCS} +SRCS+=cancelpoints_${src} +CLEANFILES+=cancelpoints_${src} +cancelpoints_${src}: + ln -sf ${.CURDIR}/gen/${src} ${.TARGET} +.endfor + SYM_MAPS+=${.CURDIR}/gen/Symbol.map # machine-dependent gen sources Modified: head/lib/libc/gen/Symbol.map ============================================================================== --- head/lib/libc/gen/Symbol.map Sat Sep 25 01:25:48 2010 (r213152) +++ head/lib/libc/gen/Symbol.map Sat Sep 25 01:57:47 2010 (r213153) @@ -403,6 +403,8 @@ FBSDprivate_1.0 { _pthread_attr_setstackaddr; _pthread_attr_setstacksize; _pthread_cancel; + _pthread_cancel_enter; + _pthread_cancel_leave; _pthread_cleanup_pop; _pthread_cleanup_push; _pthread_cond_broadcast; Modified: head/lib/libc/gen/_pthread_stubs.c ============================================================================== --- head/lib/libc/gen/_pthread_stubs.c Sat Sep 25 01:25:48 2010 (r213152) +++ head/lib/libc/gen/_pthread_stubs.c Sat Sep 25 01:57:47 2010 (r213153) @@ -121,6 +121,8 @@ pthread_func_entry_t __thr_jtable[PJT_MA {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_TESTCANCEL */ {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_CLEANUP_POP_IMP */ {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_CLEANUP_PUSH_IMP */ + {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_CANCEL_ENTER */ + {PJT_DUAL_ENTRY(stub_zero)}, /* PJT_CANCEL_LEAVE */ }; /* @@ -269,6 +271,8 @@ STUB_FUNC2(pthread_setcanceltype, PJT_SE STUB_FUNC(pthread_testcancel, PJT_TESTCANCEL, void) STUB_FUNC1(__pthread_cleanup_pop_imp, PJT_CLEANUP_POP_IMP, int, int) STUB_FUNC2(__pthread_cleanup_push_imp, PJT_CLEANUP_PUSH_IMP, void, void*, void *); +STUB_FUNC1(_pthread_cancel_enter, PJT_CANCEL_ENTER, int, int) +STUB_FUNC1(_pthread_cancel_leave, PJT_CANCEL_LEAVE, int, int) static int stub_zero(void) Modified: head/lib/libc/gen/sem.c ============================================================================== --- head/lib/libc/gen/sem.c Sat Sep 25 01:25:48 2010 (r213152) +++ head/lib/libc/gen/sem.c Sat Sep 25 01:57:47 2010 (r213153) @@ -312,21 +312,6 @@ _libc_sem_unlink_compat(const char *name } static int -enable_async_cancel(void) -{ - int old; - - _pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &old); - return (old); -} - -static void -restore_async_cancel(int val) -{ - _pthread_setcanceltype(val, NULL); -} - -static int _umtx_wait_uint(volatile unsigned *mtx, unsigned id, const struct timespec *timeout) { if (timeout && (timeout->tv_sec < 0 || (timeout->tv_sec == 0 && @@ -371,15 +356,15 @@ _libc_sem_timedwait_compat(sem_t * __res const struct timespec * __restrict abstime) { struct timespec ts, ts2; - int val, retval, saved_cancel; + int val, retval; if (sem_check_validity(sem) != 0) return (-1); if ((*sem)->syssem != 0) { - saved_cancel = enable_async_cancel(); - retval = ksem_wait((*sem)->semid); - restore_async_cancel(saved_cancel); + _pthread_cancel_enter(1); + retval = ksem_wait((*sem)->semid); /* XXX no timeout */ + _pthread_cancel_leave(retval == -1); return (retval); } @@ -390,8 +375,10 @@ _libc_sem_timedwait_compat(sem_t * __res if (atomic_cmpset_acq_int(&(*sem)->count, val, val - 1)) return (0); } - if (retval) + if (retval) { + _pthread_testcancel(); break; + } if (abstime) { if (abstime->tv_nsec >= 1000000000 || abstime->tv_nsec < 0) { errno = EINVAL; @@ -402,9 +389,9 @@ _libc_sem_timedwait_compat(sem_t * __res } atomic_add_int(&(*sem)->nwaiters, 1); pthread_cleanup_push(sem_cancel_handler, sem); - saved_cancel = enable_async_cancel(); + _pthread_cancel_enter(1); retval = _umtx_wait_uint(&(*sem)->count, 0, abstime ? &ts2 : NULL); - restore_async_cancel(saved_cancel); + _pthread_cancel_leave(0); pthread_cleanup_pop(0); atomic_add_int(&(*sem)->nwaiters, -1); } Modified: head/lib/libc/gen/sem_new.c ============================================================================== --- head/lib/libc/gen/sem_new.c Sat Sep 25 01:25:48 2010 (r213152) +++ head/lib/libc/gen/sem_new.c Sat Sep 25 01:57:47 2010 (r213153) @@ -47,6 +47,7 @@ #include #include #include "un-namespace.h" +#include "libc_private.h" __weak_reference(_sem_close, sem_close); __weak_reference(_sem_destroy, sem_destroy); @@ -364,15 +365,6 @@ _sem_trywait(sem_t *sem) return (-1); } -static void -sem_cancel_handler(void *arg) -{ - sem_t *sem = arg; - - if (sem->_kern._has_waiters && sem->_kern._count) - usem_wake(&sem->_kern); -} - #define TIMESPEC_SUB(dst, src, val) \ do { \ (dst)->tv_sec = (src)->tv_sec - (val)->tv_sec; \ @@ -384,27 +376,12 @@ sem_cancel_handler(void *arg) } while (0) -static __inline int -enable_async_cancel(void) -{ - int old; - - _pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &old); - return (old); -} - -static __inline void -restore_async_cancel(int val) -{ - _pthread_setcanceltype(val, NULL); -} - int _sem_timedwait(sem_t * __restrict sem, const struct timespec * __restrict abstime) { struct timespec ts, ts2; - int val, retval, saved_cancel; + int val, retval; if (sem_check_validity(sem) != 0) return (-1); @@ -416,8 +393,10 @@ _sem_timedwait(sem_t * __restrict sem, return (0); } - if (retval) + if (retval) { + _pthread_testcancel(); break; + } /* * The timeout argument is only supposed to @@ -431,11 +410,9 @@ _sem_timedwait(sem_t * __restrict sem, clock_gettime(CLOCK_REALTIME, &ts); TIMESPEC_SUB(&ts2, abstime, &ts); } - pthread_cleanup_push(sem_cancel_handler, sem); - saved_cancel = enable_async_cancel(); + _pthread_cancel_enter(1); retval = usem_wait(&sem->_kern, abstime ? &ts2 : NULL); - restore_async_cancel(saved_cancel); - pthread_cleanup_pop(0); + _pthread_cancel_leave(0); } return (retval); } Modified: head/lib/libc/include/libc_private.h ============================================================================== --- head/lib/libc/include/libc_private.h Sat Sep 25 01:25:48 2010 (r213152) +++ head/lib/libc/include/libc_private.h Sat Sep 25 01:57:47 2010 (r213153) @@ -129,6 +129,8 @@ typedef enum { PJT_TESTCANCEL, PJT_CLEANUP_POP_IMP, PJT_CLEANUP_PUSH_IMP, + PJT_CANCEL_ENTER, + PJT_CANCEL_LEAVE, PJT_MAX } pjt_index_t; @@ -217,4 +219,7 @@ int _elf_aux_info(int aux, void *buf, in struct dl_phdr_info; int __elf_phdr_match_addr(struct dl_phdr_info *, void *); +void _pthread_cancel_enter(int); +void _pthread_cancel_leave(int); + #endif /* _LIBC_PRIVATE_H_ */ Modified: head/lib/librt/Makefile ============================================================================== --- head/lib/librt/Makefile Sat Sep 25 01:25:48 2010 (r213152) +++ head/lib/librt/Makefile Sat Sep 25 01:57:47 2010 (r213153) @@ -3,14 +3,15 @@ LIB=rt SHLIB_MAJOR= 1 CFLAGS+=-I${.CURDIR}/../libc/include -I${.CURDIR} +.ifndef NO_THREAD_STACK_UNWIND +CFLAGS+=-fexceptions +.endif CFLAGS+=-Winline -Wall -g DPADD= ${LIBPTHREAD} LDADD= -lpthread WARNS?= 2 -#MAN= libthr.3 - SRCS+= aio.c mq.c sigev_thread.c timer.c PRECIOUSLIB= Modified: head/lib/librt/mq.c ============================================================================== --- head/lib/librt/mq.c Sat Sep 25 01:25:48 2010 (r213152) +++ head/lib/librt/mq.c Sat Sep 25 01:57:47 2010 (r213153) @@ -39,6 +39,7 @@ #include #include "sigev_thread.h" #include "un-namespace.h" +#include "libc_private.h" extern int __sys_kmq_notify(int, const struct sigevent *); extern int __sys_kmq_open(const char *, int, mode_t, @@ -200,12 +201,11 @@ ssize_t __mq_timedreceive_cancel(mqd_t mqd, char *buf, size_t len, unsigned *prio, const struct timespec *timeout) { - int oldtype; int ret; - _pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); + _pthread_cancel_enter(1); ret = __sys_kmq_timedreceive(mqd->oshandle, buf, len, prio, timeout); - _pthread_setcanceltype(oldtype, NULL); + _pthread_cancel_leave(ret == -1); return (ret); } @@ -219,12 +219,11 @@ __mq_receive(mqd_t mqd, char *buf, size_ ssize_t __mq_receive_cancel(mqd_t mqd, char *buf, size_t len, unsigned *prio) { - int oldtype; int ret; - _pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); + _pthread_cancel_enter(1); ret = __sys_kmq_timedreceive(mqd->oshandle, buf, len, prio, NULL); - _pthread_setcanceltype(oldtype, NULL); + _pthread_cancel_leave(ret == -1); return (ret); } ssize_t @@ -239,12 +238,11 @@ ssize_t __mq_timedsend_cancel(mqd_t mqd, char *buf, size_t len, unsigned prio, const struct timespec *timeout) { - int oldtype; int ret; - _pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); + _pthread_cancel_enter(1); ret = __sys_kmq_timedsend(mqd->oshandle, buf, len, prio, timeout); - _pthread_setcanceltype(oldtype, NULL); + _pthread_cancel_leave(ret == -1); return (ret); } @@ -259,12 +257,11 @@ __mq_send(mqd_t mqd, char *buf, size_t l ssize_t __mq_send_cancel(mqd_t mqd, char *buf, size_t len, unsigned prio) { - int oldtype; int ret; - _pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); + _pthread_cancel_enter(1); ret = __sys_kmq_timedsend(mqd->oshandle, buf, len, prio, NULL); - _pthread_setcanceltype(oldtype, NULL); + _pthread_cancel_leave(ret == -1); return (ret); } Modified: head/lib/libthr/Makefile ============================================================================== --- head/lib/libthr/Makefile Sat Sep 25 01:25:48 2010 (r213152) +++ head/lib/libthr/Makefile Sat Sep 25 01:57:47 2010 (r213153) @@ -26,9 +26,7 @@ CFLAGS+=-I${.CURDIR}/../../libexec/rtld- CFLAGS+=-I${.CURDIR}/../libthread_db CFLAGS+=-Winline -LIBTHR_UNWIND_STACK=yes - -.ifdef LIBTHR_UNWIND_STACK +.ifndef NO_THREAD_UNWIND_STACK CFLAGS+=-I${.CURDIR}/../../contrib/gcc -fexceptions CFLAGS+=-D_PTHREAD_FORCED_UNWIND .endif Modified: head/lib/libthr/pthread.map ============================================================================== --- head/lib/libthr/pthread.map Sat Sep 25 01:25:48 2010 (r213152) +++ head/lib/libthr/pthread.map Sat Sep 25 01:57:47 2010 (r213153) @@ -246,6 +246,8 @@ FBSDprivate_1.0 { _pthread_attr_setstackaddr; _pthread_attr_setstacksize; _pthread_cancel; + _pthread_cancel_enter; + _pthread_cancel_leave; _pthread_cleanup_pop; _pthread_cleanup_push; _pthread_cond_broadcast; Modified: head/lib/libthr/thread/thr_cancel.c ============================================================================== --- head/lib/libthr/thread/thr_cancel.c Sat Sep 25 01:25:48 2010 (r213152) +++ head/lib/libthr/thread/thr_cancel.c Sat Sep 25 01:57:47 2010 (r213153) @@ -162,3 +162,15 @@ _thr_cancel_leave(struct pthread *curthr !THR_IN_CRITICAL(curthread) && maycancel)) _pthread_exit(PTHREAD_CANCELED); } + +void +_pthread_cancel_enter(int maycancel) +{ + _thr_cancel_enter2(_get_curthread(), maycancel); +} + +void +_pthread_cancel_leave(int maycancel) +{ + _thr_cancel_leave(_get_curthread(), maycancel); +} Modified: head/lib/libthr/thread/thr_init.c ============================================================================== --- head/lib/libthr/thread/thr_init.c Sat Sep 25 01:25:48 2010 (r213152) +++ head/lib/libthr/thread/thr_init.c Sat Sep 25 01:57:47 2010 (r213153) @@ -248,7 +248,9 @@ static pthread_func_t jmp_table[][2] = { {DUAL_ENTRY(_pthread_sigmask)}, /* PJT_SIGMASK */ {DUAL_ENTRY(_pthread_testcancel)}, /* PJT_TESTCANCEL */ {DUAL_ENTRY(__pthread_cleanup_pop_imp)},/* PJT_CLEANUP_POP_IMP */ - {DUAL_ENTRY(__pthread_cleanup_push_imp)}/* PJT_CLEANUP_PUSH_IMP */ + {DUAL_ENTRY(__pthread_cleanup_push_imp)},/* PJT_CLEANUP_PUSH_IMP */ + {DUAL_ENTRY(_pthread_cancel_enter)}, /* PJT_CANCEL_ENTER */ + {DUAL_ENTRY(_pthread_cancel_leave)} /* PJT_CANCEL_LEAVE */ }; static int init_once = 0; Modified: head/lib/libthr/thread/thr_private.h ============================================================================== --- head/lib/libthr/thread/thr_private.h Sat Sep 25 01:25:48 2010 (r213152) +++ head/lib/libthr/thread/thr_private.h Sat Sep 25 01:57:47 2010 (r213153) @@ -716,7 +716,8 @@ int _sched_yield(void); void _pthread_cleanup_push(void (*)(void *), void *); void _pthread_cleanup_pop(int); void _pthread_exit_mask(void *status, sigset_t *mask) __dead2 __hidden; - +void _pthread_cancel_enter(int maycancel); +void _pthread_cancel_leave(int maycancel); /* #include */ #ifdef _SYS_FCNTL_H_ From owner-svn-src-all@FreeBSD.ORG Sat Sep 25 03:45:50 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EAC6E106566B; Sat, 25 Sep 2010 03:45:50 +0000 (UTC) (envelope-from lstewart@freebsd.org) Received: from lauren.room52.net (lauren.room52.net [210.50.193.198]) by mx1.freebsd.org (Postfix) with ESMTP id 95B1D8FC17; Sat, 25 Sep 2010 03:45:50 +0000 (UTC) Received: from lawrence1.loshell.room52.net (ppp59-167-184-191.static.internode.on.net [59.167.184.191]) by lauren.room52.net (Postfix) with ESMTPSA id D78137E853; Sat, 25 Sep 2010 13:45:48 +1000 (EST) Message-ID: <4C9D7068.2010100@freebsd.org> Date: Sat, 25 Sep 2010 13:45:44 +1000 From: Lawrence Stewart User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-AU; rv:1.9.2.9) Gecko/20100913 Lightning/1.0b2 Thunderbird/3.1.3 MIME-Version: 1.0 To: Marius Strobl References: <201009241640.o8OGelKS031911@svn.freebsd.org> In-Reply-To: <201009241640.o8OGelKS031911@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on lauren.room52.net Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r213105 - head/sys/dev/mpt X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 03:45:51 -0000 Hi Marius, On 09/25/10 02:40, Marius Strobl wrote: > Author: marius > Date: Fri Sep 24 16:40:46 2010 > New Revision: 213105 > URL: http://svn.freebsd.org/changeset/base/213105 > > Log: > Improve r56796; the reply handler actually may remove the request from > the chain in which case it shouldn't be removed twice. > Reported by: Staale Kristoffersen Can you please provide a bit of extra commentary about the symptoms of the issue this patch addresses? Like Staale, I'm running a FreeBSD server which uses mpt for its disk subsystem (SunFire X4100 with 2 x SATA 2.5" disks in RAID-1) and I've had a series of long running problems with the performance of the controller. I'm keeping a close eye on all mpt related commits and hope to find the cause sometime. Cheers, Lawrence From owner-svn-src-all@FreeBSD.ORG Sat Sep 25 04:20:08 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D2BC31065695; Sat, 25 Sep 2010 04:20:08 +0000 (UTC) (envelope-from doconnor@gsoft.com.au) Received: from cain.gsoft.com.au (cain.gsoft.com.au [203.31.81.10]) by mx1.freebsd.org (Postfix) with ESMTP id 507BA8FC08; Sat, 25 Sep 2010 04:20:07 +0000 (UTC) Received: from ur.dons.net.au (ppp121-45-158-72.lns6.adl6.internode.on.net [121.45.158.72]) (authenticated bits=0) by cain.gsoft.com.au (8.14.4/8.14.3) with ESMTP id o8P4JqNv090233 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Sat, 25 Sep 2010 13:49:58 +0930 (CST) (envelope-from doconnor@gsoft.com.au) Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: text/plain; charset=us-ascii From: "Daniel O'Connor" In-Reply-To: <20100924225352.GD49476@server.vk2pj.dyndns.org> Date: Sat, 25 Sep 2010 13:49:52 +0930 Content-Transfer-Encoding: 7bit Message-Id: References: <201009211507.o8LF7iVv097676@svn.freebsd.org> <4C9A1602.4020204@freebsd.org> <1285169017.64197.29.camel@buffy.york.ac.uk> <201009221558.27393.jhb@freebsd.org> <4C9A6EE6.5050301@freebsd.org> <20100922222441.00002f27@unknown> <1285253887.95760.33.camel@bauer.cse.buffalo.edu> <20100924225352.GD49476@server.vk2pj.dyndns.org> To: Peter Jeremy X-Mailer: Apple Mail (2.1081) X-Spam-Score: 0.163 () BAYES_00,RDNS_DYNAMIC X-Scanned-By: MIMEDefang 2.67 on 203.31.81.10 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, freebsd-arch@freebsd.org Subject: Re: svn commit: r212964 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 04:20:08 -0000 On 25/09/2010, at 8:23, Peter Jeremy wrote: > savecore already has support for a 'minfree' file to prevent > crashdumps filling the crashdir. Maybe the default install should > include a minfree set to (say) 512MB. Or perhaps add maxcount and set it to 1 as well as minfree at 512Mb. -- Daniel O'Connor software and network engineer for Genesis Software - http://www.gsoft.com.au "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C From owner-svn-src-all@FreeBSD.ORG Sat Sep 25 04:21:31 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C3E06106564A; Sat, 25 Sep 2010 04:21:31 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B303B8FC14; Sat, 25 Sep 2010 04:21:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8P4LVSu049176; Sat, 25 Sep 2010 04:21:31 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8P4LVVh049174; Sat, 25 Sep 2010 04:21:31 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201009250421.o8P4LVVh049174@svn.freebsd.org> From: David Xu Date: Sat, 25 Sep 2010 04:21:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213154 - head/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 04:21:31 -0000 Author: davidxu Date: Sat Sep 25 04:21:31 2010 New Revision: 213154 URL: http://svn.freebsd.org/changeset/base/213154 Log: Simplify code, and in while loop, fix operator to match the unwinding direction. Modified: head/lib/libthr/thread/thr_exit.c Modified: head/lib/libthr/thread/thr_exit.c ============================================================================== --- head/lib/libthr/thread/thr_exit.c Sat Sep 25 01:57:47 2010 (r213153) +++ head/lib/libthr/thread/thr_exit.c Sat Sep 25 04:21:31 2010 (r213154) @@ -140,17 +140,14 @@ thread_unwind_stop(int version, _Unwind_ /* XXX assume stack grows down to lower address */ cfa = _Unwind_GetCFA(context); - if (actions & _UA_END_OF_STACK) { - done = 1; - } else if (cfa >= (uintptr_t)curthread->unwind_stackend) { + if (actions & _UA_END_OF_STACK || + cfa >= (uintptr_t)curthread->unwind_stackend) { done = 1; } while ((cur = curthread->cleanup) != NULL && - (done || - ((uintptr_t)cur < (uintptr_t)curthread->unwind_stackend && - (uintptr_t)cur >= cfa))) { - __pthread_cleanup_pop_imp(1); + (done || (uintptr_t)cur <= cfa)) { + __pthread_cleanup_pop_imp(1); } if (done) From owner-svn-src-all@FreeBSD.ORG Sat Sep 25 04:26:40 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 768C2106566B; Sat, 25 Sep 2010 04:26:40 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 645DB8FC0C; Sat, 25 Sep 2010 04:26:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8P4QeBI049387; Sat, 25 Sep 2010 04:26:40 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8P4QeDZ049378; Sat, 25 Sep 2010 04:26:40 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201009250426.o8P4QeDZ049378@svn.freebsd.org> From: David Xu Date: Sat, 25 Sep 2010 04:26:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213155 - head/tools/regression/pthread/unwind X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 04:26:40 -0000 Author: davidxu Date: Sat Sep 25 04:26:40 2010 New Revision: 213155 URL: http://svn.freebsd.org/changeset/base/213155 Log: Add test cases for stack unwinding. Added: head/tools/regression/pthread/unwind/ head/tools/regression/pthread/unwind/Makefile (contents, props changed) head/tools/regression/pthread/unwind/Test.cpp (contents, props changed) head/tools/regression/pthread/unwind/catch_pthread_exit.cpp (contents, props changed) head/tools/regression/pthread/unwind/cond_wait_cancel.cpp (contents, props changed) head/tools/regression/pthread/unwind/cond_wait_cancel2.cpp (contents, props changed) head/tools/regression/pthread/unwind/main_thread_exit.cpp (contents, props changed) head/tools/regression/pthread/unwind/sem_wait_cancel.cpp (contents, props changed) head/tools/regression/pthread/unwind/thread_normal_exit.cpp (contents, props changed) Added: head/tools/regression/pthread/unwind/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/pthread/unwind/Makefile Sat Sep 25 04:26:40 2010 (r213155) @@ -0,0 +1,17 @@ +# $FreeBSD$ +all: main_thread_exit thread_normal_exit sem_wait_cancel \ + cond_wait_cancel cond_wait_cancel2 catch_pthread_exit + +.cpp: + c++ -o $@ $< -lpthread + +main_thread_exit: main_thread_exit.cpp +thread_normal_exit: thread_normal_exit.cpp +sem_wait_cancel: sem_wait_cancel.cpp +cond_wait_cancel: cond_wait_cancel.cpp +cond_wait_cancel2: cond_wait_cancel2.cpp +catch_pthread_exit: catch_pthread_exit.cpp + +clean: .PHONY + rm -rf main_thread_exit thread_normal_exit sem_wait_cancel \ + cond_wait_cancel cond_wait_cancel2 catch_pthread_exit Added: head/tools/regression/pthread/unwind/Test.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/pthread/unwind/Test.cpp Sat Sep 25 04:26:40 2010 (r213155) @@ -0,0 +1,37 @@ +/* $FreeBSD$ */ + +int destructed; +int destructed2; + +class Test { +public: + Test() { printf("Test::Test()\n"); } + ~Test() { printf("Test::~Test()\n"); destructed = 1; } +}; + +void +cleanup_handler(void *arg) +{ + destructed2 = 1; + printf("%s()\n", __func__); +} + +void +check_destruct(void) +{ + if (!destructed) + printf("Bug, object destructor is not called\n"); + else + printf("OK\n"); +} + +void +check_destruct2(void) +{ + if (!destructed) + printf("Bug, object destructor is not called\n"); + else if (!destructed2) + printf("Bug, cleanup handler is not called\n"); + else + printf("OK\n"); +} Added: head/tools/regression/pthread/unwind/catch_pthread_exit.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/pthread/unwind/catch_pthread_exit.cpp Sat Sep 25 04:26:40 2010 (r213155) @@ -0,0 +1,35 @@ +/* $FreeBSD$ */ +/* try to catch thread exiting, and rethrow the exception */ + +#include +#include +#include + +int caught; + +void * +thr_routine(void *arg) +{ + try { + pthread_exit(NULL); + } catch (...) { + caught = 1; + printf("thread exiting exception caught\n"); + /* rethrow */ + throw; + } +} + +int +main() +{ + pthread_t td; + + pthread_create(&td, NULL, thr_routine, NULL); + pthread_join(td, NULL); + if (caught) + printf("OK\n"); + else + printf("failure\n"); + return (0); +} Added: head/tools/regression/pthread/unwind/cond_wait_cancel.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/pthread/unwind/cond_wait_cancel.cpp Sat Sep 25 04:26:40 2010 (r213155) @@ -0,0 +1,39 @@ +/* $FreeBSD$ */ +/* Test stack unwinding for pthread_cond_wait function */ + +#include +#include +#include +#include + +#include "Test.cpp" + +pthread_mutex_t mtx; +pthread_cond_t cv; + +void * +thr(void *arg) +{ + Test t; + + pthread_mutex_lock(&mtx); + pthread_cond_wait(&cv, &mtx); + pthread_mutex_unlock(&mtx); + printf("Bug, thread shouldn't be here.\n"); + return (0); +} + +int +main() +{ + pthread_t td; + + pthread_mutex_init(&mtx, NULL); + pthread_cond_init(&cv, NULL); + pthread_create(&td, NULL, thr, NULL); + sleep(1); + pthread_cancel(td); + pthread_join(td, NULL); + check_destruct(); + return (0); +} Added: head/tools/regression/pthread/unwind/cond_wait_cancel2.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/pthread/unwind/cond_wait_cancel2.cpp Sat Sep 25 04:26:40 2010 (r213155) @@ -0,0 +1,56 @@ +/* + * $FreeBSD$ + * + * Test stack unwinding for mixed pthread_cleanup_push/pop and C++ + * object, both should work together. + * + */ + +#include +#include +#include +#include + +#include "Test.cpp" + +pthread_mutex_t mtx; +pthread_cond_t cv; + +void f() +{ + Test t; + + pthread_mutex_lock(&mtx); + pthread_cond_wait(&cv, &mtx); + pthread_mutex_unlock(&mtx); + printf("Bug, thread shouldn't be here.\n"); +} + +void g() +{ + f(); +} + +void * +thr(void *arg) +{ + pthread_cleanup_push(cleanup_handler, NULL); + g(); + pthread_cleanup_pop(0); + return (0); +} + +int +main() +{ + pthread_t td; + + pthread_mutex_init(&mtx, NULL); + pthread_cond_init(&cv, NULL); + pthread_create(&td, NULL, thr, NULL); + sleep(1); + pthread_cancel(td); + pthread_join(td, NULL); + check_destruct2(); + return (0); +} Added: head/tools/regression/pthread/unwind/main_thread_exit.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/pthread/unwind/main_thread_exit.cpp Sat Sep 25 04:26:40 2010 (r213155) @@ -0,0 +1,18 @@ +/* $FreeBSD$ */ +/* check unwinding for main thread */ + +#include +#include +#include + +#include "Test.cpp" + +int +main() +{ + Test test; + + atexit(check_destruct); + pthread_exit((void *)1); + return (0); +} Added: head/tools/regression/pthread/unwind/sem_wait_cancel.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/pthread/unwind/sem_wait_cancel.cpp Sat Sep 25 04:26:40 2010 (r213155) @@ -0,0 +1,35 @@ +/* $FreeBSD$ */ +/* Test stack unwinding for libc's sem */ + +#include +#include +#include +#include + +#include "Test.cpp" + +sem_t sem; + +void * +thr(void *arg) +{ + Test t; + + sem_wait(&sem); + printf("Bug, thread shouldn't be here.\n"); + return (0); +} + +int +main() +{ + pthread_t td; + + sem_init(&sem, 0, 0); + pthread_create(&td, NULL, thr, NULL); + sleep(1); + pthread_cancel(td); + pthread_join(td, NULL); + check_destruct(); + return (0); +} Added: head/tools/regression/pthread/unwind/thread_normal_exit.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/pthread/unwind/thread_normal_exit.cpp Sat Sep 25 04:26:40 2010 (r213155) @@ -0,0 +1,28 @@ +/* $FreeBSD$ */ +/* test stack unwinding for a new thread */ + +#include +#include +#include + +#include "Test.cpp" + +void * +thr_routine(void *arg) +{ + Test test; + + pthread_exit(NULL); + printf("Bug, thread shouldn't be here\n"); +} + +int +main() +{ + pthread_t td; + + pthread_create(&td, NULL, thr_routine, NULL); + pthread_join(td, NULL); + check_destruct(); + return (0); +} From owner-svn-src-all@FreeBSD.ORG Sat Sep 25 04:39:13 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C94D106564A; Sat, 25 Sep 2010 04:39:13 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EF7308FC18; Sat, 25 Sep 2010 04:39:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8P4dCAN049672; Sat, 25 Sep 2010 04:39:12 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8P4dCts049668; Sat, 25 Sep 2010 04:39:12 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201009250439.o8P4dCts049668@svn.freebsd.org> From: Juli Mallett Date: Sat, 25 Sep 2010 04:39:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213156 - head/sys/mips/cavium/octe X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 04:39:13 -0000 Author: jmallett Date: Sat Sep 25 04:39:12 2010 New Revision: 213156 URL: http://svn.freebsd.org/changeset/base/213156 Log: o) Send mbufs to BPF listeners from within cvm_oct_xmit(). o) Pin receive threads when they're running since we do access some core-local resources. Modified: head/sys/mips/cavium/octe/ethernet-rx.c head/sys/mips/cavium/octe/ethernet-tx.c head/sys/mips/cavium/octe/octe.c Modified: head/sys/mips/cavium/octe/ethernet-rx.c ============================================================================== --- head/sys/mips/cavium/octe/ethernet-rx.c Sat Sep 25 04:26:40 2010 (r213155) +++ head/sys/mips/cavium/octe/ethernet-rx.c Sat Sep 25 04:39:12 2010 (r213156) @@ -37,6 +37,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include @@ -167,7 +169,7 @@ static inline int cvm_oct_check_rcv_erro */ void cvm_oct_tasklet_rx(void *context, int pending) { - const int coreid = cvmx_get_core_num(); + int coreid; uint64_t old_group_mask; uint64_t old_scratch; int rx_count = 0; @@ -175,6 +177,9 @@ void cvm_oct_tasklet_rx(void *context, i int num_freed; int packet_not_copied; + sched_pin(); + coreid = cvmx_get_core_num(); + /* Prefetch cvm_oct_device since we know we need it soon */ CVMX_PREFETCH(cvm_oct_device, 0); @@ -388,6 +393,7 @@ void cvm_oct_tasklet_rx(void *context, i } } } + sched_unpin(); } Modified: head/sys/mips/cavium/octe/ethernet-tx.c ============================================================================== --- head/sys/mips/cavium/octe/ethernet-tx.c Sat Sep 25 04:26:40 2010 (r213155) +++ head/sys/mips/cavium/octe/ethernet-tx.c Sat Sep 25 04:39:12 2010 (r213156) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -239,6 +240,9 @@ int cvm_oct_xmit(struct mbuf *m, struct } else { /* Put this packet on the queue to be freed later */ _IF_ENQUEUE(&priv->tx_free_queue[qos], m); + + /* Pass it to any BPF listeners. */ + ETHER_BPF_MTAP(ifp, m); } if (work != NULL) cvmx_fpa_free(work, CVMX_FPA_WQE_POOL, DONT_WRITEBACK(1)); Modified: head/sys/mips/cavium/octe/octe.c ============================================================================== --- head/sys/mips/cavium/octe/octe.c Sat Sep 25 04:26:40 2010 (r213155) +++ head/sys/mips/cavium/octe/octe.c Sat Sep 25 04:39:12 2010 (r213156) @@ -310,24 +310,6 @@ octe_start(struct ifnet *ifp) OCTE_TX_UNLOCK(priv); - /* - * XXX - * - * We may not be able to pass the mbuf up to BPF for one of - * two very good reasons: - * (1) immediately after our inserting it another CPU may be - * kind enough to free it for us. - * (2) m_collapse gets called on m and we don't get back the - * modified pointer. - * - * We have some options other than an m_dup route: - * (1) use a mutex or spinlock to prevent another CPU from - * freeing it. We could lock the tx_free_list's lock, - * that would make sense. - * (2) get back the new mbuf pointer. - * (3) do the collapse here. - */ - if (priv->queue != -1) { error = cvm_oct_xmit(m, ifp); } else { From owner-svn-src-all@FreeBSD.ORG Sat Sep 25 04:41:42 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ABE26106566C; Sat, 25 Sep 2010 04:41:42 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 80BD18FC12; Sat, 25 Sep 2010 04:41:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8P4fggJ049760; Sat, 25 Sep 2010 04:41:42 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8P4fgBL049757; Sat, 25 Sep 2010 04:41:42 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201009250441.o8P4fgBL049757@svn.freebsd.org> From: Warner Losh Date: Sat, 25 Sep 2010 04:41:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213157 - head/sys/ia64/include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 04:41:42 -0000 Author: imp Date: Sat Sep 25 04:41:42 2010 New Revision: 213157 URL: http://svn.freebsd.org/changeset/base/213157 Log: Remove clauses 3 and 4, per changes to NetBSD versions of these files. Modified: head/sys/ia64/include/_stdint.h head/sys/ia64/include/bus.h Modified: head/sys/ia64/include/_stdint.h ============================================================================== --- head/sys/ia64/include/_stdint.h Sat Sep 25 04:39:12 2010 (r213156) +++ head/sys/ia64/include/_stdint.h Sat Sep 25 04:41:42 2010 (r213157) @@ -14,13 +14,6 @@ * 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 software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED Modified: head/sys/ia64/include/bus.h ============================================================================== --- head/sys/ia64/include/bus.h Sat Sep 25 04:39:12 2010 (r213156) +++ head/sys/ia64/include/bus.h Sat Sep 25 04:41:42 2010 (r213157) @@ -42,13 +42,6 @@ * 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 software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED From owner-svn-src-all@FreeBSD.ORG Sat Sep 25 04:58:47 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2F92B106564A; Sat, 25 Sep 2010 04:58:46 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DB5958FC1C; Sat, 25 Sep 2010 04:58:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8P4wkc9050128; Sat, 25 Sep 2010 04:58:46 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8P4wk7m050124; Sat, 25 Sep 2010 04:58:46 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201009250458.o8P4wk7m050124@svn.freebsd.org> From: Lawrence Stewart Date: Sat, 25 Sep 2010 04:58:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213158 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 04:58:47 -0000 Author: lstewart Date: Sat Sep 25 04:58:46 2010 New Revision: 213158 URL: http://svn.freebsd.org/changeset/base/213158 Log: Internalise reassembly queue related functionality and variables which should not be used outside of the reassembly queue implementation. Provide a new function to flush all segments from a reassembly queue and call it from the appropriate places instead of manipulating the queue directly. Sponsored by: FreeBSD Foundation Reviewed by: andre, gnn, rpaulo MFC after: 2 weeks Modified: head/sys/netinet/tcp_reass.c head/sys/netinet/tcp_subr.c head/sys/netinet/tcp_var.h Modified: head/sys/netinet/tcp_reass.c ============================================================================== --- head/sys/netinet/tcp_reass.c Sat Sep 25 04:41:42 2010 (r213157) +++ head/sys/netinet/tcp_reass.c Sat Sep 25 04:58:46 2010 (r213158) @@ -83,7 +83,8 @@ SYSCTL_VNET_INT(_net_inet_tcp_reass, OID &VNET_NAME(tcp_reass_maxseg), 0, "Global maximum number of TCP Segments in Reassembly Queue"); -VNET_DEFINE(int, tcp_reass_qsize) = 0; +static VNET_DEFINE(int, tcp_reass_qsize) = 0; +#define V_tcp_reass_qsize VNET(tcp_reass_qsize) SYSCTL_VNET_INT(_net_inet_tcp_reass, OID_AUTO, cursegments, CTLFLAG_RD, &VNET_NAME(tcp_reass_qsize), 0, "Global number of TCP Segments currently in Reassembly Queue"); @@ -100,6 +101,9 @@ SYSCTL_VNET_INT(_net_inet_tcp_reass, OID &VNET_NAME(tcp_reass_overflows), 0, "Global number of TCP Segment Reassembly Queue Overflows"); +static VNET_DEFINE(uma_zone_t, tcp_reass_zone); +#define V_tcp_reass_zone VNET(tcp_reass_zone) + /* Initialize TCP reassembly queue */ static void tcp_reass_zone_change(void *tag) @@ -109,8 +113,6 @@ tcp_reass_zone_change(void *tag) uma_zone_set_max(V_tcp_reass_zone, V_tcp_reass_maxseg); } -VNET_DEFINE(uma_zone_t, tcp_reass_zone); - void tcp_reass_init(void) { @@ -134,6 +136,26 @@ tcp_reass_destroy(void) } #endif +void +tcp_reass_flush(struct tcpcb *tp) +{ + struct tseg_qent *qe; + + INP_WLOCK_ASSERT(tp->t_inpcb); + + while ((qe = LIST_FIRST(&tp->t_segq)) != NULL) { + LIST_REMOVE(qe, tqe_q); + m_freem(qe->tqe_m); + uma_zfree(V_tcp_reass_zone, qe); + tp->t_segqlen--; + V_tcp_reass_qsize--; + } + + KASSERT((tp->t_segqlen == 0), + ("TCP reass queue %p segment count is %d instead of 0 after flush.", + tp, tp->t_segqlen)); +} + int tcp_reass(struct tcpcb *tp, struct tcphdr *th, int *tlenp, struct mbuf *m) { Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Sat Sep 25 04:41:42 2010 (r213157) +++ head/sys/netinet/tcp_subr.c Sat Sep 25 04:58:46 2010 (r213158) @@ -714,7 +714,6 @@ tcp_drop(struct tcpcb *tp, int errno) void tcp_discardcb(struct tcpcb *tp) { - struct tseg_qent *q; struct inpcb *inp = tp->t_inpcb; struct socket *so = inp->inp_socket; #ifdef INET6 @@ -801,13 +800,7 @@ tcp_discardcb(struct tcpcb *tp) } /* free the reassembly queue, if any */ - while ((q = LIST_FIRST(&tp->t_segq)) != NULL) { - LIST_REMOVE(q, tqe_q); - m_freem(q->tqe_m); - uma_zfree(V_tcp_reass_zone, q); - tp->t_segqlen--; - V_tcp_reass_qsize--; - } + tcp_reass_flush(tp); /* Disconnect offload device, if any. */ tcp_offload_detach(tp); @@ -865,7 +858,6 @@ tcp_drain(void) CURVNET_SET(vnet_iter); struct inpcb *inpb; struct tcpcb *tcpb; - struct tseg_qent *te; /* * Walk the tcpbs, if existing, and flush the reassembly queue, @@ -881,14 +873,7 @@ tcp_drain(void) continue; INP_WLOCK(inpb); if ((tcpb = intotcpcb(inpb)) != NULL) { - while ((te = LIST_FIRST(&tcpb->t_segq)) - != NULL) { - LIST_REMOVE(te, tqe_q); - m_freem(te->tqe_m); - uma_zfree(V_tcp_reass_zone, te); - tcpb->t_segqlen--; - V_tcp_reass_qsize--; - } + tcp_reass_flush(tcpb); tcp_clean_sackreport(tcpb); } INP_WUNLOCK(inpb); Modified: head/sys/netinet/tcp_var.h ============================================================================== --- head/sys/netinet/tcp_var.h Sat Sep 25 04:41:42 2010 (r213157) +++ head/sys/netinet/tcp_var.h Sat Sep 25 04:58:46 2010 (r213158) @@ -44,10 +44,6 @@ VNET_DECLARE(int, tcp_do_rfc1323); #define V_tcp_do_rfc1323 VNET(tcp_do_rfc1323) -VNET_DECLARE(int, tcp_reass_qsize); -VNET_DECLARE(struct uma_zone *, tcp_reass_zone); -#define V_tcp_reass_qsize VNET(tcp_reass_qsize) -#define V_tcp_reass_zone VNET(tcp_reass_zone) #endif /* _KERNEL */ /* TCP segment queue entry */ @@ -617,6 +613,7 @@ char *tcp_log_vain(struct in_conninfo *, const void *); int tcp_reass(struct tcpcb *, struct tcphdr *, int *, struct mbuf *); void tcp_reass_init(void); +void tcp_reass_flush(struct tcpcb *); #ifdef VIMAGE void tcp_reass_destroy(void); #endif From owner-svn-src-all@FreeBSD.ORG Sat Sep 25 06:27:11 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1B2F0106564A; Sat, 25 Sep 2010 06:27:11 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 98B358FC13; Sat, 25 Sep 2010 06:27:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8P6R9x5052164; Sat, 25 Sep 2010 06:27:09 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8P6R9wm052161; Sat, 25 Sep 2010 06:27:09 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201009250627.o8P6R9wm052161@svn.freebsd.org> From: David Xu Date: Sat, 25 Sep 2010 06:27:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213159 - head/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 06:27:11 -0000 Author: davidxu Date: Sat Sep 25 06:27:09 2010 New Revision: 213159 URL: http://svn.freebsd.org/changeset/base/213159 Log: Because old _pthread_cleanup_push/pop do not have frame address, it is incompatible with stack unwinding code, if they are invoked, disable stack unwinding for current thread, and when thread is exiting, print a warning message. Modified: head/lib/libthr/thread/thr_clean.c head/lib/libthr/thread/thr_exit.c Modified: head/lib/libthr/thread/thr_clean.c ============================================================================== --- head/lib/libthr/thread/thr_clean.c Sat Sep 25 04:58:46 2010 (r213158) +++ head/lib/libthr/thread/thr_clean.c Sat Sep 25 06:27:09 2010 (r213159) @@ -78,12 +78,10 @@ __pthread_cleanup_pop_imp(int execute) void _pthread_cleanup_push(void (*routine) (void *), void *arg) { -#ifdef _PTHREAD_FORCED_UNWIND - PANIC("_pthread_cleanup_push is not supported while stack unwinding is enabled."); -#else struct pthread *curthread = _get_curthread(); struct pthread_cleanup *newbuf; + curthread->unwind_disabled = 1; if ((newbuf = (struct pthread_cleanup *) malloc(sizeof(struct _pthread_cleanup_info))) != NULL) { newbuf->routine = routine; @@ -92,15 +90,10 @@ _pthread_cleanup_push(void (*routine) (v newbuf->prev = curthread->cleanup; curthread->cleanup = newbuf; } -#endif } void _pthread_cleanup_pop(int execute) { -#ifdef _PTHREAD_FORCED_UNWIND - PANIC("_pthread_cleanup_pop is not supported while stack unwinding is enabled."); -#else __pthread_cleanup_pop_imp(execute); -#endif } Modified: head/lib/libthr/thread/thr_exit.c ============================================================================== --- head/lib/libthr/thread/thr_exit.c Sat Sep 25 04:58:46 2010 (r213158) +++ head/lib/libthr/thread/thr_exit.c Sat Sep 25 06:27:09 2010 (r213159) @@ -51,6 +51,7 @@ static void exit_thread(void) __dead2; __weak_reference(_pthread_exit, pthread_exit); #ifdef _PTHREAD_FORCED_UNWIND +static int message_printed; static void thread_unwind(void) __dead2; #ifdef PIC @@ -220,18 +221,28 @@ _pthread_exit_mask(void *status, sigset_ /* Save the return value: */ curthread->ret = status; #ifdef _PTHREAD_FORCED_UNWIND + #ifdef PIC thread_uw_init(); +#endif /* PIC */ + +#ifdef PIC if (uwl_forcedunwind != NULL) { - thread_unwind(); - } #else if (_Unwind_ForcedUnwind != NULL) { +#endif + if (curthread->unwind_disabled) { + if (message_printed == 0) { + message_printed = 1; + _thread_printf(2, "Warning: old _pthread_cleanup_push was called, " + "stack unwinding is disabled.\n"); + } + goto cleanup; + } thread_unwind(); - } -#endif /* PIC */ - else { + } else { +cleanup: while (curthread->cleanup != NULL) { __pthread_cleanup_pop_imp(1); } From owner-svn-src-all@FreeBSD.ORG Sat Sep 25 08:19:35 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 472951065670; Sat, 25 Sep 2010 08:19:35 +0000 (UTC) (envelope-from sanpei@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3674F8FC08; Sat, 25 Sep 2010 08:19:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8P8JZhc054784; Sat, 25 Sep 2010 08:19:35 GMT (envelope-from sanpei@svn.freebsd.org) Received: (from sanpei@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8P8JZcD054782; Sat, 25 Sep 2010 08:19:35 GMT (envelope-from sanpei@svn.freebsd.org) Message-Id: <201009250819.o8P8JZcD054782@svn.freebsd.org> From: MIHIRA Sanpei Yoshiro Date: Sat, 25 Sep 2010 08:19:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213160 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 08:19:35 -0000 Author: sanpei Date: Sat Sep 25 08:19:34 2010 New Revision: 213160 URL: http://svn.freebsd.org/changeset/base/213160 Log: Add Planex UE-200TX-G2 to list of supported devices. MFC after: 1 day Modified: head/share/man/man4/axe.4 Modified: head/share/man/man4/axe.4 ============================================================================== --- head/share/man/man4/axe.4 Sat Sep 25 06:27:09 2010 (r213159) +++ head/share/man/man4/axe.4 Sat Sep 25 08:19:34 2010 (r213160) @@ -188,6 +188,8 @@ Cisco-Linksys USB200Mv2 D-Link DUBE100B1 .It Planex UE-200TX-G +.It +Planex UE-200TX-G2 .El .Sh DIAGNOSTICS .Bl -diag From owner-svn-src-all@FreeBSD.ORG Sat Sep 25 08:36:46 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A4A8D106564A; Sat, 25 Sep 2010 08:36:46 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9412F8FC0A; Sat, 25 Sep 2010 08:36:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8P8akDi055207; Sat, 25 Sep 2010 08:36:46 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8P8akbl055205; Sat, 25 Sep 2010 08:36:46 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201009250836.o8P8akbl055205@svn.freebsd.org> From: David Xu Date: Sat, 25 Sep 2010 08:36:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213161 - head/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 08:36:46 -0000 Author: davidxu Date: Sat Sep 25 08:36:46 2010 New Revision: 213161 URL: http://svn.freebsd.org/changeset/base/213161 Log: Add missing field. Modified: head/lib/libthr/thread/thr_private.h Modified: head/lib/libthr/thread/thr_private.h ============================================================================== --- head/lib/libthr/thread/thr_private.h Sat Sep 25 08:19:34 2010 (r213160) +++ head/lib/libthr/thread/thr_private.h Sat Sep 25 08:36:46 2010 (r213161) @@ -452,6 +452,7 @@ struct pthread { #ifdef _PTHREAD_FORCED_UNWIND struct _Unwind_Exception ex; void *unwind_stackend; + int unwind_disabled; #endif /* From owner-svn-src-all@FreeBSD.ORG Sat Sep 25 09:16:46 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B7C2B106564A; Sat, 25 Sep 2010 09:16:46 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A65E48FC14; Sat, 25 Sep 2010 09:16:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8P9GkL2055970; Sat, 25 Sep 2010 09:16:46 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8P9GkJQ055967; Sat, 25 Sep 2010 09:16:46 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201009250916.o8P9GkJQ055967@svn.freebsd.org> From: Lawrence Stewart Date: Sat, 25 Sep 2010 09:16:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213162 - in head: share/man/man4 sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 09:16:46 -0000 Author: lstewart Date: Sat Sep 25 09:16:46 2010 New Revision: 213162 URL: http://svn.freebsd.org/changeset/base/213162 Log: Log the number of segments currently in the reassembly queue. Sponsored by: FreeBSD Foundation Modified: head/share/man/man4/siftr.4 head/sys/netinet/siftr.c Modified: head/share/man/man4/siftr.4 ============================================================================== --- head/share/man/man4/siftr.4 Sat Sep 25 08:36:46 2010 (r213161) +++ head/share/man/man4/siftr.4 Sat Sep 25 09:16:46 2010 (r213162) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 23, 2010 +.Dd September 25, 2010 .Dt SIFTR 4 .Os .Sh NAME @@ -198,7 +198,7 @@ The data is CSV formatted. .Bd -literal -offset indent o,0xbec491a5,1238556193.463551,172.16.7.28,22,172.16.2.5,55931, \\ 1073725440,172312,6144,66560,66608,8,1,4,1448,936,1,996,255, \\ -33304,208,66608,0,208 +33304,208,66608,0,208,0 .Ed .Pp Field descriptions are as follows: @@ -328,6 +328,10 @@ The current number of bytes in the socke The current number of unacknowledged bytes in-flight. Bytes acknowledged via SACK are not excluded from this count. .El +.Bl -tag -offset indent +.It Va 26 +The current number of segments in the reassembly queue. +.El .Pp The third type of log message is written to the file when the module is disabled and ceases collecting data from the running kernel. Modified: head/sys/netinet/siftr.c ============================================================================== --- head/sys/netinet/siftr.c Sat Sep 25 08:36:46 2010 (r213161) +++ head/sys/netinet/siftr.c Sat Sep 25 09:16:46 2010 (r213162) @@ -55,7 +55,7 @@ * SIFTR should be directed to him via email: lastewart@swin.edu.au * * Initial release date: June 2007 - * Most recent update: June 2010 + * Most recent update: September 2010 ******************************************************/ #include @@ -105,7 +105,7 @@ __FBSDID("$FreeBSD$"); */ #define V_MAJOR 1 #define V_BACKBREAK 2 -#define V_BACKCOMPAT 3 +#define V_BACKCOMPAT 4 #define MODVERSION __CONCAT(V_MAJOR, __CONCAT(V_BACKBREAK, V_BACKCOMPAT)) #define MODVERSION_STR __XSTRING(V_MAJOR) "." __XSTRING(V_BACKBREAK) "." \ __XSTRING(V_BACKCOMPAT) @@ -226,6 +226,8 @@ struct pkt_node { u_int rcv_buf_cc; /* Number of bytes inflight that we are waiting on ACKs for. */ u_int sent_inflight_bytes; + /* Number of segments currently in the reassembly queue. */ + int t_segqlen; /* Link to next pkt_node in the list. */ STAILQ_ENTRY(pkt_node) nodes; }; @@ -442,7 +444,7 @@ siftr_process_pkt(struct pkt_node * pkt_ MAX_LOG_MSG_LEN, "%c,0x%08x,%zd.%06ld,%x:%x:%x:%x:%x:%x:%x:%x,%u,%x:%x:%x:" "%x:%x:%x:%x:%x,%u,%ld,%ld,%ld,%ld,%ld,%u,%u,%u,%u,%u,%u," - "%u,%d,%u,%u,%u,%u,%u\n", + "%u,%d,%u,%u,%u,%u,%u,%u\n", direction[pkt_node->direction], pkt_node->hash, pkt_node->tval.tv_sec, @@ -482,7 +484,8 @@ siftr_process_pkt(struct pkt_node * pkt_ pkt_node->snd_buf_cc, pkt_node->rcv_buf_hiwater, pkt_node->rcv_buf_cc, - pkt_node->sent_inflight_bytes); + pkt_node->sent_inflight_bytes, + pkt_node->t_segqlen); } else { /* IPv4 packet */ pkt_node->ip_laddr[0] = FIRST_OCTET(pkt_node->ip_laddr[3]); pkt_node->ip_laddr[1] = SECOND_OCTET(pkt_node->ip_laddr[3]); @@ -498,7 +501,7 @@ siftr_process_pkt(struct pkt_node * pkt_ log_buf->ae_bytesused = snprintf(log_buf->ae_data, MAX_LOG_MSG_LEN, "%c,0x%08x,%jd.%06ld,%u.%u.%u.%u,%u,%u.%u.%u.%u,%u,%ld,%ld," - "%ld,%ld,%ld,%u,%u,%u,%u,%u,%u,%u,%d,%u,%u,%u,%u,%u\n", + "%ld,%ld,%ld,%u,%u,%u,%u,%u,%u,%u,%d,%u,%u,%u,%u,%u,%u\n", direction[pkt_node->direction], pkt_node->hash, (intmax_t)pkt_node->tval.tv_sec, @@ -530,7 +533,8 @@ siftr_process_pkt(struct pkt_node * pkt_ pkt_node->snd_buf_cc, pkt_node->rcv_buf_hiwater, pkt_node->rcv_buf_cc, - pkt_node->sent_inflight_bytes); + pkt_node->sent_inflight_bytes, + pkt_node->t_segqlen); #ifdef SIFTR_IPV6 } #endif @@ -790,6 +794,7 @@ siftr_siftdata(struct pkt_node *pn, stru pn->rcv_buf_hiwater = inp->inp_socket->so_rcv.sb_hiwat; pn->rcv_buf_cc = inp->inp_socket->so_rcv.sb_cc; pn->sent_inflight_bytes = tp->snd_max - tp->snd_una; + pn->t_segqlen = tp->t_segqlen; /* We've finished accessing the tcb so release the lock. */ if (inp_locally_locked) From owner-svn-src-all@FreeBSD.ORG Sat Sep 25 09:30:29 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CB13D1065672; Sat, 25 Sep 2010 09:30:29 +0000 (UTC) (envelope-from swell.k@gmail.com) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 713E98FC1D; Sat, 25 Sep 2010 09:30:29 +0000 (UTC) Received: by iwn34 with SMTP id 34so3884501iwn.13 for ; Sat, 25 Sep 2010 02:30:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:references :date:in-reply-to:message-id:user-agent:mime-version:content-type; bh=BZMwMTj3CJPspqPqTAJIWxMOB9VzfIC/zLNPetXIUh4=; b=Qgl5jbmU/IBPEG0rN2KtTsJ59JB7aE4KdoOxaB1ZLnscKCoDJpFDOw2oW1jqHBxXGO VIHCaCw79tm6SiMMbBkYSauNbA14P3n8SHD35ysqj7mrJYRue69oJGtHNF+DaqHvSyvw WptzoJNZf8hcyVAhx/8xcQBH66j+XCLmKgjHM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; b=a/N6d/ElSZTat0HIIDGe9sVkEmpvQtYzz6ULKcLW1ZUBV4yQlQ2TRfv17aNsPTduR1 pH00HcqrGVavhXAccQzGD31kBVw4srAGEr/rAy7GidLKR4KLR+rj6iicLp8HGIPu8nLh 0hhgNZyxFBUfsZlqyXAiK8VZdXzi3q9wPKjOc= Received: by 10.231.173.9 with SMTP id n9mr5264809ibz.146.1285407021480; Sat, 25 Sep 2010 02:30:21 -0700 (PDT) Received: from localhost (tor-exit-proxy5-readme.formlessnetworking.net [208.53.142.41]) by mx.google.com with ESMTPS id g31sm3431581ibh.4.2010.09.25.02.30.15 (version=SSLv3 cipher=RC4-MD5); Sat, 25 Sep 2010 02:30:20 -0700 (PDT) From: Anonymous To: David Xu References: <201009250836.o8P8akbl055205__9540.25641917742$1285403822$gmane$org@svn.freebsd.org> Date: Sat, 25 Sep 2010 13:23:41 +0400 In-Reply-To: <201009250836.o8P8akbl055205__9540.25641917742$1285403822$gmane$org@svn.freebsd.org> (David Xu's message of "Sat, 25 Sep 2010 08:36:46 +0000 (UTC)") Message-ID: <864odemb1e.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r213161 - head/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 09:30:29 -0000 David Xu writes: > Author: davidxu > Date: Sat Sep 25 08:36:46 2010 > New Revision: 213161 > URL: http://svn.freebsd.org/changeset/base/213161 > > Log: > Add missing field. > > Modified: > head/lib/libthr/thread/thr_private.h > > Modified: head/lib/libthr/thread/thr_private.h > ============================================================================== > --- head/lib/libthr/thread/thr_private.h Sat Sep 25 08:19:34 2010 (r213160) > +++ head/lib/libthr/thread/thr_private.h Sat Sep 25 08:36:46 2010 (r213161) > @@ -452,6 +452,7 @@ struct pthread { > #ifdef _PTHREAD_FORCED_UNWIND > struct _Unwind_Exception ex; > void *unwind_stackend; > + int unwind_disabled; > #endif > > /* What about NO_THREAD_UNWIND_STACK in src.conf? cc -O2 -pipe -DPTHREAD_KERNEL -I/usr/src/lib/libthr/../libc/include -I/usr/src/lib/libthr/thread -I/usr/src/lib/libthr/../../include -I/usr/src/lib/libthr/arch/amd64/include -I/usr/src/lib/libthr/sys -I/usr/src/lib/libthr/../../libexec/rtld-elf -I/usr/src/lib/libthr/../../libexec/rtld-elf/amd64 -I/usr/src/lib/libthr/../libthread_db -Winline -D_PTHREADS_INVARIANTS -DSYSCALL_COMPAT -ggdb -std=gnu99 -Wsystem-headers -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign -c /usr/src/lib/libthr/thread/thr_clean.c /usr/src/lib/libthr/thread/thr_clean.c: In function '_pthread_cleanup_push': /usr/src/lib/libthr/thread/thr_clean.c:84: error: 'struct pthread' has no member named 'unwind_disabled' *** Error code 1 From owner-svn-src-all@FreeBSD.ORG Sat Sep 25 09:43:25 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2F16D106566B; Sat, 25 Sep 2010 09:43:25 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1EA2C8FC12; Sat, 25 Sep 2010 09:43:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8P9hPj1056518; Sat, 25 Sep 2010 09:43:25 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8P9hPPC056516; Sat, 25 Sep 2010 09:43:25 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201009250943.o8P9hPPC056516@svn.freebsd.org> From: David Xu Date: Sat, 25 Sep 2010 09:43:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213163 - head/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 09:43:25 -0000 Author: davidxu Date: Sat Sep 25 09:43:24 2010 New Revision: 213163 URL: http://svn.freebsd.org/changeset/base/213163 Log: Only access unwind_disabled when _PTHREAD_FORCED_UNWIND is defined. Modified: head/lib/libthr/thread/thr_clean.c Modified: head/lib/libthr/thread/thr_clean.c ============================================================================== --- head/lib/libthr/thread/thr_clean.c Sat Sep 25 09:16:46 2010 (r213162) +++ head/lib/libthr/thread/thr_clean.c Sat Sep 25 09:43:24 2010 (r213163) @@ -80,8 +80,9 @@ _pthread_cleanup_push(void (*routine) (v { struct pthread *curthread = _get_curthread(); struct pthread_cleanup *newbuf; - +#ifdef _PTHREAD_FORCED_UNWIND curthread->unwind_disabled = 1; +#endif if ((newbuf = (struct pthread_cleanup *) malloc(sizeof(struct _pthread_cleanup_info))) != NULL) { newbuf->routine = routine; From owner-svn-src-all@FreeBSD.ORG Sat Sep 25 10:02:12 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0FBE71065693; Sat, 25 Sep 2010 10:02:12 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id 8B74E8FC20; Sat, 25 Sep 2010 10:02:11 +0000 (UTC) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.3/8.14.3/ALCHEMY.FRANKEN.DE) with ESMTP id o8P9edWU024193; Sat, 25 Sep 2010 11:40:39 +0200 (CEST) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.3/8.14.3/Submit) id o8P9ed2l024192; Sat, 25 Sep 2010 11:40:39 +0200 (CEST) (envelope-from marius) Date: Sat, 25 Sep 2010 11:40:39 +0200 From: Marius Strobl To: Lawrence Stewart Message-ID: <20100925094039.GS46946@alchemy.franken.de> References: <201009241640.o8OGelKS031911@svn.freebsd.org> <4C9D7068.2010100@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4C9D7068.2010100@freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r213105 - head/sys/dev/mpt X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 10:02:12 -0000 On Sat, Sep 25, 2010 at 01:45:44PM +1000, Lawrence Stewart wrote: > Hi Marius, > > On 09/25/10 02:40, Marius Strobl wrote: > > Author: marius > > Date: Fri Sep 24 16:40:46 2010 > > New Revision: 213105 > > URL: http://svn.freebsd.org/changeset/base/213105 > > > > Log: > > Improve r56796; the reply handler actually may remove the request from > > the chain in which case it shouldn't be removed twice. > > Reported by: Staale Kristoffersen > > Can you please provide a bit of extra commentary about the symptoms of > the issue this patch addresses? Like Staale, I'm running a FreeBSD > server which uses mpt for its disk subsystem (SunFire X4100 with 2 x > SATA 2.5" disks in RAID-1) and I've had a series of long running > problems with the performance of the controller. I'm keeping a close eye > on all mpt related commits and hope to find the cause sometime. > In case the reply handler also removed the request this triggered a sanity check in TAILQ_REMOVE with INVARIANTS compiled in, causing a panic. I don't think it had a negative impact with INVARIANTS disabled. Also, in order to hit the problem you first had to run into a timeout leading to an IOC rest like here: http://folk.uio.no/stalk/mpt/timeout.txt i.e. I don't think this is related to your performance issue. Marius From owner-svn-src-all@FreeBSD.ORG Sat Sep 25 10:31:05 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DA54A1065674; Sat, 25 Sep 2010 10:31:05 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C9F908FC1A; Sat, 25 Sep 2010 10:31:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8PAV5ff059851; Sat, 25 Sep 2010 10:31:05 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8PAV5xh059849; Sat, 25 Sep 2010 10:31:05 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009251031.o8PAV5xh059849@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sat, 25 Sep 2010 10:31:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213164 - head/sys/geom/eli X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 10:31:05 -0000 Author: pjd Date: Sat Sep 25 10:31:05 2010 New Revision: 213164 URL: http://svn.freebsd.org/changeset/base/213164 Log: Ignore errors from BIO_FLUSH. It might confuse users that provider wasn't really killed. What we really care about are write errors only. MFC after: 2 weeks Modified: head/sys/geom/eli/g_eli_ctl.c Modified: head/sys/geom/eli/g_eli_ctl.c ============================================================================== --- head/sys/geom/eli/g_eli_ctl.c Sat Sep 25 09:43:24 2010 (r213163) +++ head/sys/geom/eli/g_eli_ctl.c Sat Sep 25 10:31:05 2010 (r213164) @@ -688,7 +688,7 @@ g_eli_ctl_delkey(struct gctl_req *req, s * Flush write cache so we don't overwrite data N times in cache * and only once on disk. */ - g_io_flush(cp); + (void)g_io_flush(cp); } bzero(&md, sizeof(md)); bzero(sector, sizeof(sector)); @@ -739,13 +739,11 @@ g_eli_kill_one(struct g_eli_softc *sc) if (error == 0) error = err; } - err = g_io_flush(cp); - if (err != 0) { - G_ELI_DEBUG(0, "Cannot flush %s (error=%d).", - pp->name, err); - if (error == 0) - error = err; - } + /* + * Flush write cache so we don't overwrite data N times + * in cache and only once on disk. + */ + (void)g_io_flush(cp); } free(sector, M_ELI); } From owner-svn-src-all@FreeBSD.ORG Sat Sep 25 10:32:04 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8E3CA106566C; Sat, 25 Sep 2010 10:32:04 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7DD568FC08; Sat, 25 Sep 2010 10:32:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8PAW4H8059902; Sat, 25 Sep 2010 10:32:04 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8PAW4om059899; Sat, 25 Sep 2010 10:32:04 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009251032.o8PAW4om059899@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sat, 25 Sep 2010 10:32:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213165 - head/sys/geom/eli X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 10:32:04 -0000 Author: pjd Date: Sat Sep 25 10:32:04 2010 New Revision: 213165 URL: http://svn.freebsd.org/changeset/base/213165 Log: Change g_eli_debug to int, so one can turn off any GELI output by setting kern.geom.eli.debug sysctl to -1. MFC after: 2 weeks Modified: head/sys/geom/eli/g_eli.c head/sys/geom/eli/g_eli.h Modified: head/sys/geom/eli/g_eli.c ============================================================================== --- head/sys/geom/eli/g_eli.c Sat Sep 25 10:31:05 2010 (r213164) +++ head/sys/geom/eli/g_eli.c Sat Sep 25 10:32:04 2010 (r213165) @@ -56,9 +56,9 @@ MALLOC_DEFINE(M_ELI, "eli data", "GEOM_E SYSCTL_DECL(_kern_geom); SYSCTL_NODE(_kern_geom, OID_AUTO, eli, CTLFLAG_RW, 0, "GEOM_ELI stuff"); -u_int g_eli_debug = 0; +int g_eli_debug = 0; TUNABLE_INT("kern.geom.eli.debug", &g_eli_debug); -SYSCTL_UINT(_kern_geom_eli, OID_AUTO, debug, CTLFLAG_RW, &g_eli_debug, 0, +SYSCTL_INT(_kern_geom_eli, OID_AUTO, debug, CTLFLAG_RW, &g_eli_debug, 0, "Debug level"); static u_int g_eli_tries = 3; TUNABLE_INT("kern.geom.eli.tries", &g_eli_tries); Modified: head/sys/geom/eli/g_eli.h ============================================================================== --- head/sys/geom/eli/g_eli.h Sat Sep 25 10:31:05 2010 (r213164) +++ head/sys/geom/eli/g_eli.h Sat Sep 25 10:32:04 2010 (r213165) @@ -105,7 +105,7 @@ #define G_ELI_KEY_SHIFT 20 #ifdef _KERNEL -extern u_int g_eli_debug; +extern int g_eli_debug; extern u_int g_eli_overwrites; extern u_int g_eli_batch; From owner-svn-src-all@FreeBSD.ORG Sat Sep 25 10:32:52 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 631E0106566C; Sat, 25 Sep 2010 10:32:52 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 52A6D8FC13; Sat, 25 Sep 2010 10:32:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8PAWq4b060064; Sat, 25 Sep 2010 10:32:52 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8PAWqrU060062; Sat, 25 Sep 2010 10:32:52 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009251032.o8PAWqrU060062@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sat, 25 Sep 2010 10:32:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213166 - head/sys/crypto/aesni X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 10:32:52 -0000 Author: pjd Date: Sat Sep 25 10:32:52 2010 New Revision: 213166 URL: http://svn.freebsd.org/changeset/base/213166 Log: Fix two copy&paste bugs. MFC after: 2 weeks Modified: head/sys/crypto/aesni/aesni_wrap.c Modified: head/sys/crypto/aesni/aesni_wrap.c ============================================================================== --- head/sys/crypto/aesni/aesni_wrap.c Sat Sep 25 10:32:04 2010 (r213165) +++ head/sys/crypto/aesni/aesni_wrap.c Sat Sep 25 10:32:52 2010 (r213166) @@ -232,7 +232,7 @@ aesni_cipher_setup_common(struct aesni_s aesni_set_enckey(key, ses->enc_schedule, ses->rounds); aesni_set_deckey(ses->enc_schedule, ses->dec_schedule, ses->rounds); - if (ses->algo == CRYPTO_AES_XTS) + if (ses->algo == CRYPTO_AES_CBC) arc4rand(ses->iv, sizeof(ses->iv), 0); else /* if (ses->algo == CRYPTO_AES_XTS) */ { aesni_set_enckey(key + keylen / 16, ses->xts_schedule, @@ -306,7 +306,7 @@ aesni_cipher_process(struct aesni_sessio aesni_decrypt_cbc(ses->rounds, ses->dec_schedule, enccrd->crd_len, buf, ses->iv); } else /* if (ses->algo == CRYPTO_AES_XTS) */ { - aesni_decrypt_xts(ses->rounds, ses->enc_schedule, + aesni_decrypt_xts(ses->rounds, ses->dec_schedule, ses->xts_schedule, enccrd->crd_len, buf, buf, ses->iv); } From owner-svn-src-all@FreeBSD.ORG Sat Sep 25 10:34:11 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A1779106566B; Sat, 25 Sep 2010 10:34:11 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 90F5D8FC0A; Sat, 25 Sep 2010 10:34:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8PAYB0w060140; Sat, 25 Sep 2010 10:34:11 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8PAYBCI060138; Sat, 25 Sep 2010 10:34:11 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009251034.o8PAYBCI060138@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sat, 25 Sep 2010 10:34:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213167 - head/tools/regression/geom_eli X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 10:34:11 -0000 Author: pjd Date: Sat Sep 25 10:34:11 2010 New Revision: 213167 URL: http://svn.freebsd.org/changeset/base/213167 Log: - Use $md instead of md0, which fixes tests when md(4) device is already present. - Correct message - we create GPT, not MBR. MFC after: 2 weeks Modified: head/tools/regression/geom_eli/resize.t Modified: head/tools/regression/geom_eli/resize.t ============================================================================== --- head/tools/regression/geom_eli/resize.t Sat Sep 25 10:32:52 2010 (r213166) +++ head/tools/regression/geom_eli/resize.t Sat Sep 25 10:34:11 2010 (r213167) @@ -124,8 +124,8 @@ geli detach ${md}a.eli # 1g to 20m, 2g to 30m and keyfile to tmp.key, and adding -B none # to geli init. -gpart create -s GPT md0 || echo -n "not " -echo ok $i - "Installed an MBR on md0" +gpart create -s GPT $md || echo -n "not " +echo ok $i - "Installed an GPT on md0" i=$((i + 1)) gpart add -s 20m -t freebsd-ufs -i 1 $md || echo -n "not " echo ok $i - "Added a 20m partition in slot 1" From owner-svn-src-all@FreeBSD.ORG Sat Sep 25 10:34:43 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 12FE0106566C; Sat, 25 Sep 2010 10:34:43 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 019CF8FC0C; Sat, 25 Sep 2010 10:34:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8PAYg7E060192; Sat, 25 Sep 2010 10:34:42 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8PAYgd1060184; Sat, 25 Sep 2010 10:34:42 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009251034.o8PAYgd1060184@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sat, 25 Sep 2010 10:34:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213168 - head/tools/regression/geom_eli X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 10:34:43 -0000 Author: pjd Date: Sat Sep 25 10:34:42 2010 New Revision: 213168 URL: http://svn.freebsd.org/changeset/base/213168 Log: Update regression tests after AES-XTS addition. MFC after: 2 weeks Modified: head/tools/regression/geom_eli/init-a.t head/tools/regression/geom_eli/init.t head/tools/regression/geom_eli/integrity-copy.t head/tools/regression/geom_eli/integrity-data.t head/tools/regression/geom_eli/integrity-hmac.t head/tools/regression/geom_eli/onetime-a.t head/tools/regression/geom_eli/onetime.t Modified: head/tools/regression/geom_eli/init-a.t ============================================================================== --- head/tools/regression/geom_eli/init-a.t Sat Sep 25 10:34:11 2010 (r213167) +++ head/tools/regression/geom_eli/init-a.t Sat Sep 25 10:34:42 2010 (r213168) @@ -6,15 +6,22 @@ no=45 sectors=100 keyfile=`mktemp /tmp/$base.XXXXXX` || exit 1 -echo "1..660" +echo "1..1380" i=1 -for cipher in aes:0 aes:128 aes:192 aes:256 \ +for cipher in aes:0 aes:128 aes:256 \ + aes-xts:0 aes-xts:128 aes-xts:256 \ + aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \ 3des:0 3des:192 \ + 3des-cbc:0 3des-cbc:192 \ blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \ blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \ blowfish:416 blowfish:448 \ - camellia:0 camellia:128 camellia:192 camellia:256; do + blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \ + blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ + blowfish-cbc:416 blowfish-cbc:448 \ + camellia:0 camellia:128 camellia:192 camellia:256 \ + camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do ealgo=${cipher%%:*} keylen=${cipher##*:} for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 hmac/sha384 hmac/sha512; do Modified: head/tools/regression/geom_eli/init.t ============================================================================== --- head/tools/regression/geom_eli/init.t Sat Sep 25 10:34:11 2010 (r213167) +++ head/tools/regression/geom_eli/init.t Sat Sep 25 10:34:42 2010 (r213168) @@ -6,15 +6,22 @@ no=45 sectors=100 keyfile=`mktemp /tmp/$base.XXXXXX` || exit 1 -echo "1..220" +echo "1..460" i=1 -for cipher in aes:0 aes:128 aes:192 aes:256 \ +for cipher in aes:0 aes:128 aes:256 \ + aes-xts:0 aes-xts:128 aes-xts:256 \ + aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \ 3des:0 3des:192 \ + 3des-cbc:0 3des-cbc:192 \ blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \ blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \ blowfish:416 blowfish:448 \ - camellia:0 camellia:128 camellia:192 camellia:256; do + blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \ + blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ + blowfish-cbc:416 blowfish-cbc:448 \ + camellia:0 camellia:128 camellia:192 camellia:256 \ + camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do ealgo=${cipher%%:*} keylen=${cipher##*:} for secsize in 512 1024 2048 4096 8192; do Modified: head/tools/regression/geom_eli/integrity-copy.t ============================================================================== --- head/tools/regression/geom_eli/integrity-copy.t Sat Sep 25 10:34:11 2010 (r213167) +++ head/tools/regression/geom_eli/integrity-copy.t Sat Sep 25 10:34:42 2010 (r213168) @@ -7,15 +7,22 @@ sectors=100 keyfile=`mktemp /tmp/$base.XXXXXX` || exit 1 sector=`mktemp /tmp/$base.XXXXXX` || exit 1 -echo "1..2640" +echo "1..5520" i=1 -for cipher in aes:0 aes:128 aes:192 aes:256 \ +for cipher in aes:0 aes:128 aes:256 \ + aes-xts:0 aes-xts:128 aes-xts:256 \ + aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \ 3des:0 3des:192 \ + 3des-cbc:0 3des-cbc:192 \ blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \ blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \ blowfish:416 blowfish:448 \ - camellia:0 camellia:128 camellia:192 camellia:256; do + blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \ + blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ + blowfish-cbc:416 blowfish-cbc:448 \ + camellia:0 camellia:128 camellia:192 camellia:256 \ + camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do ealgo=${cipher%%:*} keylen=${cipher##*:} for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 hmac/sha384 hmac/sha512; do Modified: head/tools/regression/geom_eli/integrity-data.t ============================================================================== --- head/tools/regression/geom_eli/integrity-data.t Sat Sep 25 10:34:11 2010 (r213167) +++ head/tools/regression/geom_eli/integrity-data.t Sat Sep 25 10:34:42 2010 (r213168) @@ -7,15 +7,22 @@ sectors=100 keyfile=`mktemp /tmp/$base.XXXXXX` || exit 1 sector=`mktemp /tmp/$base.XXXXXX` || exit 1 -echo "1..1320" +echo "1..2760" i=1 -for cipher in aes:0 aes:128 aes:192 aes:256 \ +for cipher in aes:0 aes:128 aes:256 \ + aes-xts:0 aes-xts:128 aes-xts:256 \ + aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \ 3des:0 3des:192 \ + 3des-cbc:0 3des-cbc:192 \ blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \ blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \ blowfish:416 blowfish:448 \ - camellia:0 camellia:128 camellia:192 camellia:256; do + blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \ + blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ + blowfish-cbc:416 blowfish-cbc:448 \ + camellia:0 camellia:128 camellia:192 camellia:256 \ + camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do ealgo=${cipher%%:*} keylen=${cipher##*:} for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 hmac/sha384 hmac/sha512; do Modified: head/tools/regression/geom_eli/integrity-hmac.t ============================================================================== --- head/tools/regression/geom_eli/integrity-hmac.t Sat Sep 25 10:34:11 2010 (r213167) +++ head/tools/regression/geom_eli/integrity-hmac.t Sat Sep 25 10:34:42 2010 (r213168) @@ -7,15 +7,22 @@ sectors=100 keyfile=`mktemp /tmp/$base.XXXXXX` || exit 1 sector=`mktemp /tmp/$base.XXXXXX` || exit 1 -echo "1..1320" +echo "1..2760" i=1 -for cipher in aes:0 aes:128 aes:192 aes:256 \ +for cipher in aes:0 aes:128 aes:256 \ + aes-xts:0 aes-xts:128 aes-xts:256 \ + aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \ 3des:0 3des:192 \ + 3des-cbc:0 3des-cbc:192 \ blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \ blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \ blowfish:416 blowfish:448 \ - camellia:0 camellia:128 camellia:192 camellia:256; do + blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \ + blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ + blowfish-cbc:416 blowfish-cbc:448 \ + camellia:0 camellia:128 camellia:192 camellia:256 \ + camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do ealgo=${cipher%%:*} keylen=${cipher##*:} for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 hmac/sha384 hmac/sha512; do Modified: head/tools/regression/geom_eli/onetime-a.t ============================================================================== --- head/tools/regression/geom_eli/onetime-a.t Sat Sep 25 10:34:11 2010 (r213167) +++ head/tools/regression/geom_eli/onetime-a.t Sat Sep 25 10:34:42 2010 (r213168) @@ -5,15 +5,22 @@ base=`basename $0` no=45 sectors=100 -echo "1..660" +echo "1..1380" i=1 -for cipher in aes:0 aes:128 aes:192 aes:256 \ +for cipher in aes:0 aes:128 aes:256 \ + aes-xts:0 aes-xts:128 aes-xts:256 \ + aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \ 3des:0 3des:192 \ + 3des-cbc:0 3des-cbc:192 \ blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \ blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \ blowfish:416 blowfish:448 \ - camellia:0 camellia:128 camellia:192 camellia:256; do + blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \ + blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ + blowfish-cbc:416 blowfish-cbc:448 \ + camellia:0 camellia:128 camellia:192 camellia:256 \ + camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do ealgo=${cipher%%:*} keylen=${cipher##*:} for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 hmac/sha384 hmac/sha512; do Modified: head/tools/regression/geom_eli/onetime.t ============================================================================== --- head/tools/regression/geom_eli/onetime.t Sat Sep 25 10:34:11 2010 (r213167) +++ head/tools/regression/geom_eli/onetime.t Sat Sep 25 10:34:42 2010 (r213168) @@ -5,15 +5,22 @@ base=`basename $0` no=45 sectors=100 -echo "1..220" +echo "1..460" i=1 -for cipher in aes:0 aes:128 aes:192 aes:256 \ +for cipher in aes:0 aes:128 aes:256 \ + aes-xts:0 aes-xts:128 aes-xts:256 \ + aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \ 3des:0 3des:192 \ + 3des-cbc:0 3des-cbc:192 \ blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \ blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \ blowfish:416 blowfish:448 \ - camellia:0 camellia:128 camellia:192 camellia:256; do + blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \ + blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \ + blowfish-cbc:416 blowfish-cbc:448 \ + camellia:0 camellia:128 camellia:192 camellia:256 \ + camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do ealgo=${cipher%%:*} keylen=${cipher##*:} for secsize in 512 1024 2048 4096 8192; do From owner-svn-src-all@FreeBSD.ORG Sat Sep 25 11:29:20 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2C9DC1065670; Sat, 25 Sep 2010 11:29:20 +0000 (UTC) (envelope-from ronald-freebsd8@klop.yi.org) Received: from smtp-out3.tiscali.nl (smtp-out3.tiscali.nl [195.241.79.178]) by mx1.freebsd.org (Postfix) with ESMTP id DF8F98FC08; Sat, 25 Sep 2010 11:29:19 +0000 (UTC) Received: from [212.123.145.58] (helo=sjakie.klop.ws) by smtp-out3.tiscali.nl with esmtp (Exim) (envelope-from ) id 1OzSmj-0006dI-GO; Sat, 25 Sep 2010 13:19:17 +0200 Received: from 212-123-145-58.ip.telfort.nl (localhost [127.0.0.1]) by sjakie.klop.ws (Postfix) with ESMTP id E3D195367; Sat, 25 Sep 2010 13:19:11 +0200 (CEST) Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, "Pawel Jakub Dawidek" References: <201009251034.o8PAYBCI060138@svn.freebsd.org> Date: Sat, 25 Sep 2010 13:19:11 +0200 MIME-Version: 1.0 From: "Ronald Klop" Message-ID: In-Reply-To: <201009251034.o8PAYBCI060138@svn.freebsd.org> User-Agent: Opera Mail/10.62 (FreeBSD) Content-Transfer-Encoding: quoted-printable Cc: Subject: Re: svn commit: r213167 - head/tools/regression/geom_eli X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 11:29:20 -0000 On Sat, 25 Sep 2010 12:34:11 +0200, Pawel Jakub Dawidek = =20 wrote: > Author: pjd > Date: Sat Sep 25 10:34:11 2010 > New Revision: 213167 > URL: http://svn.freebsd.org/changeset/base/213167 > > Log: > - Use $md instead of md0, which fixes tests when md(4) device is =20 > already > present. > - Correct message - we create GPT, not MBR. > MFC after: 2 weeks > > Modified: > head/tools/regression/geom_eli/resize.t > > Modified: head/tools/regression/geom_eli/resize.t > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=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/tools/regression/geom_eli/resize.t Sat Sep 25 10:32:52 =20 > 2010 (r213166) > +++ head/tools/regression/geom_eli/resize.t Sat Sep 25 10:34:11 =20 > 2010 (r213167) > @@ -124,8 +124,8 @@ geli detach ${md}a.eli > # 1g to 20m, 2g to 30m and keyfile to tmp.key, and adding -B none > # to geli init. > -gpart create -s GPT md0 || echo -n "not " > -echo ok $i - "Installed an MBR on md0" > +gpart create -s GPT $md || echo -n "not " > +echo ok $i - "Installed an GPT on md0" > i=3D$((i + 1)) > gpart add -s 20m -t freebsd-ufs -i 1 $md || echo -n "not " > echo ok $i - "Added a 20m partition in slot 1" Hi, You still use md0 in the message in stead of $md. Ronald. From owner-svn-src-all@FreeBSD.ORG Sat Sep 25 11:36:33 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1DDAA106564A; Sat, 25 Sep 2010 11:36:33 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from smtp.fgznet.ch (mail.fgznet.ch [81.92.96.47]) by mx1.freebsd.org (Postfix) with ESMTP id AAD098FC1A; Sat, 25 Sep 2010 11:36:32 +0000 (UTC) Received: from deuterium.andreas.nets (dhclient-91-190-8-131.flashcable.ch [91.190.8.131]) by smtp.fgznet.ch (8.13.8/8.13.8/Submit_SMTPAUTH) with ESMTP id o8PBOk2T050621; Sat, 25 Sep 2010 13:24:47 +0200 (CEST) (envelope-from andreast@FreeBSD.org) Message-ID: <4C9DDBFE.8070606@FreeBSD.org> Date: Sat, 25 Sep 2010 13:24:46 +0200 From: Andreas Tobler User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.9) Gecko/20100825 Lightning/1.0b2 Thunderbird/3.1.3 MIME-Version: 1.0 To: David Xu References: <201009240904.o8O94GVM095803@svn.freebsd.org> In-Reply-To: <201009240904.o8O94GVM095803@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.64 on 81.92.96.47 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r213098 - in head/sys: amd64/conf i386/conf pc98/conf powerpc/conf sparc64/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 11:36:33 -0000 Hi! On 24.09.10 11:04, David Xu wrote: > Author: davidxu > Date: Fri Sep 24 09:04:16 2010 > New Revision: 213098 > URL: http://svn.freebsd.org/changeset/base/213098 > > Log: > Now userland POSIX semaphore is based on umtx. The kernel module > is only used to support binary compatible, if want to run old > binary, you need to kldload the module. I guess this is also valid for powerpc/GENERIC64, right? Or do we need some work here? Thanks, Andreas > Modified: > head/sys/amd64/conf/GENERIC > head/sys/i386/conf/GENERIC > head/sys/pc98/conf/GENERIC > head/sys/powerpc/conf/GENERIC Index: sys/powerpc/conf/GENERIC64 =================================================================== --- sys/powerpc/conf/GENERIC64 (revision 213168) +++ sys/powerpc/conf/GENERIC64 (working copy) @@ -59,7 +59,6 @@ options SYSVSHM #SYSV-style shared memory options SYSVMSG #SYSV-style message queues options SYSVSEM #SYSV-style semaphores -options P1003_1B_SEMAPHORES # POSIX-style semaphores options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4) options AUDIT # Security event auditing From owner-svn-src-all@FreeBSD.ORG Sat Sep 25 11:48:13 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from alona.my.domain (localhost [127.0.0.1]) by hub.freebsd.org (Postfix) with ESMTP id 419B81065670; Sat, 25 Sep 2010 11:48:04 +0000 (UTC) (envelope-from davidxu@freebsd.org) Message-ID: <4C9DE168.4010200@freebsd.org> Date: Sat, 25 Sep 2010 19:47:52 +0800 From: David Xu User-Agent: Thunderbird 2.0.0.21 (X11/20090522) MIME-Version: 1.0 To: Andreas Tobler References: <201009240904.o8O94GVM095803@svn.freebsd.org> <4C9DDBFE.8070606@FreeBSD.org> In-Reply-To: <4C9DDBFE.8070606@FreeBSD.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r213098 - in head/sys: amd64/conf i386/conf pc98/conf powerpc/conf sparc64/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 11:48:13 -0000 Andreas Tobler wrote: > Hi! > > On 24.09.10 11:04, David Xu wrote: >> Author: davidxu >> Date: Fri Sep 24 09:04:16 2010 >> New Revision: 213098 >> URL: http://svn.freebsd.org/changeset/base/213098 >> >> Log: >> Now userland POSIX semaphore is based on umtx. The kernel module >> is only used to support binary compatible, if want to run old >> binary, you need to kldload the module. > > I guess this is also valid for powerpc/GENERIC64, right? Or do we need > some work here? > > Thanks, > Andreas You can remove it without extra work. Regards, David Xu From owner-svn-src-all@FreeBSD.ORG Sat Sep 25 13:32:12 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 36A941065670; Sat, 25 Sep 2010 13:32:12 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from mail.icecube.wisc.edu (trout.icecube.wisc.edu [128.104.255.119]) by mx1.freebsd.org (Postfix) with ESMTP id 0A4358FC14; Sat, 25 Sep 2010 13:32:11 +0000 (UTC) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.icecube.wisc.edu (Postfix) with ESMTP id 53D41582C4; Sat, 25 Sep 2010 08:00:44 -0500 (CDT) X-Virus-Scanned: amavisd-new at icecube.wisc.edu Received: from mail.icecube.wisc.edu ([127.0.0.1]) by localhost (trout.icecube.wisc.edu [127.0.0.1]) (amavisd-new, port 10030) with ESMTP id 4fvunHzP7yEs; Sat, 25 Sep 2010 08:00:44 -0500 (CDT) Received: from wanderer.tachypleus.net (unknown [76.210.68.10]) by mail.icecube.wisc.edu (Postfix) with ESMTP id E37D2582C3; Sat, 25 Sep 2010 08:00:43 -0500 (CDT) Message-ID: <4C9DF27C.7020800@freebsd.org> Date: Sat, 25 Sep 2010 15:00:44 +0200 From: Nathan Whitehorn User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.1.12) Gecko/20100914 Thunderbird/3.0.7 MIME-Version: 1.0 To: David Xu References: <201009240904.o8O94GVM095803@svn.freebsd.org> In-Reply-To: <201009240904.o8O94GVM095803@svn.freebsd.org> X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r213098 - in head/sys: amd64/conf i386/conf pc98/conf powerpc/conf sparc64/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 13:32:12 -0000 On 09/24/10 11:04, David Xu wrote: > Author: davidxu > Date: Fri Sep 24 09:04:16 2010 > New Revision: 213098 > URL: http://svn.freebsd.org/changeset/base/213098 > > Log: > Now userland POSIX semaphore is based on umtx. The kernel module > is only used to support binary compatible, if want to run old > binary, you need to kldload the module. > > Modified: > head/sys/amd64/conf/GENERIC > head/sys/i386/conf/GENERIC > head/sys/pc98/conf/GENERIC > head/sys/powerpc/conf/GENERIC > head/sys/sparc64/conf/GENERIC > You missed the powerpc64 GENERIC, which is named /sys/powerpc/conf/GENERIC64. It looks like you skipped sun4v too. -Nathan From owner-svn-src-all@FreeBSD.ORG Sat Sep 25 14:33:36 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 328D71065670; Sat, 25 Sep 2010 14:33:36 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 073C38FC08; Sat, 25 Sep 2010 14:33:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8PEXZTd065048; Sat, 25 Sep 2010 14:33:35 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8PEXZr0065046; Sat, 25 Sep 2010 14:33:35 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201009251433.o8PEXZr0065046@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sat, 25 Sep 2010 14:33:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213169 - head/tools/regression/acltools X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 14:33:36 -0000 Author: trasz Date: Sat Sep 25 14:33:35 2010 New Revision: 213169 URL: http://svn.freebsd.org/changeset/base/213169 Log: Add a shell script to generate a test script for trivial ACLs. Added: head/tools/regression/acltools/mktrivial.sh (contents, props changed) Added: head/tools/regression/acltools/mktrivial.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/acltools/mktrivial.sh Sat Sep 25 14:33:35 2010 (r213169) @@ -0,0 +1,53 @@ +#!/bin/sh +# +# Copyright (c) 2010 Edward Tomasz NapieraƂa +# 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$ +# + +# This shell script generates an input file for the "run" script, used +# to verify generation of trivial ACLs. + +echo "$ touch f" +touch f + +for s in `jot 7 0 7`; do + for u in `jot 7 0 7`; do + for g in `jot 7 0 7`; do + for o in `jot 7 0 7`; do + echo "$ chmod 0$s$u$g$o f" + chmod "0$s$u$g$o" f + echo "$ ls -l f | cut -d' ' -f1" + ls -l f | cut -d' ' -f1 | sed 's/^/> /' + echo "$ getfacl -q f" + getfacl -q f | sed 's/^/> /' + done + done + done +done + +echo "$ rm f" +rm f + From owner-svn-src-all@FreeBSD.ORG Sat Sep 25 14:54:31 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5C39D1065673; Sat, 25 Sep 2010 14:54:31 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4BB268FC23; Sat, 25 Sep 2010 14:54:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8PEsVlW065501; Sat, 25 Sep 2010 14:54:31 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8PEsVLw065499; Sat, 25 Sep 2010 14:54:31 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201009251454.o8PEsVLw065499@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sat, 25 Sep 2010 14:54:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213170 - head/tools/regression/acltools X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 14:54:31 -0000 Author: trasz Date: Sat Sep 25 14:54:31 2010 New Revision: 213170 URL: http://svn.freebsd.org/changeset/base/213170 Log: Don't leave zombies behind. Modified: head/tools/regression/acltools/run Modified: head/tools/regression/acltools/run ============================================================================== --- head/tools/regression/acltools/run Sat Sep 25 14:33:35 2010 (r213169) +++ head/tools/regression/acltools/run Sat Sep 25 14:54:31 2010 (r213170) @@ -271,6 +271,8 @@ sub exec_test($$) { *STDOUT->autoflush(); *OUT->autoflush(); + $SIG{CHLD} = 'IGNORE'; + if (fork()) { # Server if (*IN_DUP) { From owner-svn-src-all@FreeBSD.ORG Sat Sep 25 15:37:41 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 56EA5106564A; Sat, 25 Sep 2010 15:37:41 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 466E88FC1D; Sat, 25 Sep 2010 15:37:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8PFbfN9066394; Sat, 25 Sep 2010 15:37:41 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8PFbfvS066392; Sat, 25 Sep 2010 15:37:41 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009251537.o8PFbfvS066392@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sat, 25 Sep 2010 15:37:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213171 - head/tools/regression/geom_eli X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 15:37:41 -0000 Author: pjd Date: Sat Sep 25 15:37:41 2010 New Revision: 213171 URL: http://svn.freebsd.org/changeset/base/213171 Log: Don't hardcode md0 in message, use $md instead. Reported by: Ronald Klop Modified: head/tools/regression/geom_eli/resize.t Modified: head/tools/regression/geom_eli/resize.t ============================================================================== --- head/tools/regression/geom_eli/resize.t Sat Sep 25 14:54:31 2010 (r213170) +++ head/tools/regression/geom_eli/resize.t Sat Sep 25 15:37:41 2010 (r213171) @@ -125,7 +125,7 @@ geli detach ${md}a.eli # to geli init. gpart create -s GPT $md || echo -n "not " -echo ok $i - "Installed an GPT on md0" +echo ok $i - "Installed an GPT on ${md}" i=$((i + 1)) gpart add -s 20m -t freebsd-ufs -i 1 $md || echo -n "not " echo ok $i - "Added a 20m partition in slot 1" From owner-svn-src-all@FreeBSD.ORG Sat Sep 25 15:38:02 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 800981065742; Sat, 25 Sep 2010 15:38:01 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 24E638FC16; Sat, 25 Sep 2010 15:38:00 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 4934D45CA0; Sat, 25 Sep 2010 17:37:59 +0200 (CEST) Received: from localhost (chello089077043238.chello.pl [89.77.43.238]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id F055B456B1; Sat, 25 Sep 2010 17:37:51 +0200 (CEST) Date: Sat, 25 Sep 2010 17:37:32 +0200 From: Pawel Jakub Dawidek To: Ronald Klop Message-ID: <20100925153732.GB47356@garage.freebsd.pl> References: <201009251034.o8PAYBCI060138@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ghzN8eJ9Qlbqn3iT" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 9.0-CURRENT amd64 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-0.6 required=4.5 tests=BAYES_00,RCVD_IN_SORBS_DUL autolearn=no version=3.0.4 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r213167 - head/tools/regression/geom_eli X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 15:38:02 -0000 --ghzN8eJ9Qlbqn3iT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Sep 25, 2010 at 01:19:11PM +0200, Ronald Klop wrote: > On Sat, 25 Sep 2010 12:34:11 +0200, Pawel Jakub Dawidek = =20 > wrote: >=20 > >Author: pjd > >Date: Sat Sep 25 10:34:11 2010 > >New Revision: 213167 > >URL: http://svn.freebsd.org/changeset/base/213167 > > > >Log: > > - Use $md instead of md0, which fixes tests when md(4) device is =20 > >already > > present. > > - Correct message - we create GPT, not MBR. > > MFC after: 2 weeks > > > >Modified: > > head/tools/regression/geom_eli/resize.t > > > >Modified: head/tools/regression/geom_eli/resize.t > >=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=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/tools/regression/geom_eli/resize.t Sat Sep 25 10:32:52 =20 > >2010 (r213166) > >+++ head/tools/regression/geom_eli/resize.t Sat Sep 25 10:34:11 =20 > >2010 (r213167) > >@@ -124,8 +124,8 @@ geli detach ${md}a.eli > > # 1g to 20m, 2g to 30m and keyfile to tmp.key, and adding -B none > > # to geli init. > >-gpart create -s GPT md0 || echo -n "not " > >-echo ok $i - "Installed an MBR on md0" > >+gpart create -s GPT $md || echo -n "not " > >+echo ok $i - "Installed an GPT on md0" > > i=3D$((i + 1)) > > gpart add -s 20m -t freebsd-ufs -i 1 $md || echo -n "not " > > echo ok $i - "Added a 20m partition in slot 1" >=20 > Hi, >=20 > You still use md0 in the message in stead of $md. Fix committed, thanks. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --ghzN8eJ9Qlbqn3iT Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkyeFzwACgkQForvXbEpPzQvNwCgtAkZdeRphcgmBqxDtDvadsB+ 47MAoIHIUzb3BcsglwI6KBS5RXAt3JJr =df6/ -----END PGP SIGNATURE----- --ghzN8eJ9Qlbqn3iT-- From owner-svn-src-all@FreeBSD.ORG Sat Sep 25 17:38:57 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 72DF3106566B; Sat, 25 Sep 2010 17:38:57 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 60C1B8FC08; Sat, 25 Sep 2010 17:38:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8PHcvDC068836; Sat, 25 Sep 2010 17:38:57 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8PHcvta068833; Sat, 25 Sep 2010 17:38:57 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009251738.o8PHcvta068833@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sat, 25 Sep 2010 17:38:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213172 - head/sbin/geom/class/eli X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 17:38:57 -0000 Author: pjd Date: Sat Sep 25 17:38:57 2010 New Revision: 213172 URL: http://svn.freebsd.org/changeset/base/213172 Log: - Add support for loading passphrase from a file (-J and -j options). This is especially useful for things like installers, where regular geli prompt can't be used. - Add support for specifing multiple -K or -k options, so there is no need to cat all keyfiles and read them from standard input. Requested by: Kris Moore , thompsa MFC after: 2 weeks Modified: head/sbin/geom/class/eli/geli.8 head/sbin/geom/class/eli/geom_eli.c Modified: head/sbin/geom/class/eli/geli.8 ============================================================================== --- head/sbin/geom/class/eli/geli.8 Sat Sep 25 15:37:41 2010 (r213171) +++ head/sbin/geom/class/eli/geli.8 Sat Sep 25 17:38:57 2010 (r213172) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 23, 2010 +.Dd September 25, 2010 .Dt GELI 8 .Os .Sh NAME @@ -56,6 +56,7 @@ utility: .Op Fl B Ar backupfile .Op Fl e Ar ealgo .Op Fl i Ar iterations +.Op Fl J Ar newpassfile .Op Fl K Ar newkeyfile .Op Fl l Ar keylen .Op Fl s Ar sectorsize @@ -66,6 +67,7 @@ utility: .Nm .Cm attach .Op Fl dprv +.Op Fl j Ar passfile .Op Fl k Ar keyfile .Ar prov .Nm @@ -91,6 +93,8 @@ utility: .Cm setkey .Op Fl pPv .Op Fl i Ar iterations +.Op Fl j Ar passfile +.Op Fl J Ar newpassfile .Op Fl k Ar keyfile .Op Fl K Ar newkeyfile .Op Fl n Ar keyno @@ -223,7 +227,7 @@ The metadata can be recovered with the subcommand described below. .Pp Additional options include: -.Bl -tag -width ".Fl a Ar newkeyfile" +.Bl -tag -width ".Fl J Ar newpassfile" .It Fl a Ar aalgo Enable data integrity verification (authentication) using the given algorithm. This will reduce size of available storage and also reduce speed. @@ -272,15 +276,19 @@ If this option is not specified, .Nm will find the number of iterations which is equal to 2 seconds of crypto work. If 0 is given, PKCS#5v2 will not be used. +.It Fl J Ar newpassfile +Specifies a file which contains the passphrase or its part. +If +.Ar newpassfile +is given as -, standard input will be used. +Only the first line (excluding new-line character) is taken from the given file. +This argument can be specified multiple times. .It Fl K Ar newkeyfile Specifies a file which contains part of the key. If .Ar newkeyfile is given as -, standard input will be used. -Here is how more than one file with a key component can be used: -.Bd -literal -offset indent -# cat key1 key2 key3 | geli init -K - /dev/da0 -.Ed +This argument can be specified multiple times. .It Fl l Ar keylen Key length to use with the given cryptographic algorithm. If not given, the default key length for the given algorithm is used, which is: @@ -309,7 +317,7 @@ provider's name with an suffix. .Pp Additional options include: -.Bl -tag -width ".Fl a Ar keyfile" +.Bl -tag -width ".Fl j Ar passfile" .It Fl d If specified, a decrypted provider will be detached automatically on last close. This can help with short memory - user does not have to remember to detach the @@ -321,6 +329,13 @@ Probably a better choice is the option for the .Cm detach subcommand. +.It Fl j Ar passfile +Specifies a file which contains the passphrase or its part. +For more information see the description of the +.Fl J +option for the +.Cm init +subcommand. .It Fl k Ar keyfile Specifies a file which contains part of the key. For more information see the description of the @@ -409,13 +424,17 @@ When a provider is attached, the user do an old passphrase/keyfile. .Pp Additional options include: -.Bl -tag -width ".Fl a Ar iterations" +.Bl -tag -width ".Fl J Ar newpassfile" .It Fl i Ar iterations Number of iterations to use with PKCS#5v2. If 0 is given, PKCS#5v2 will not be used. To be able to use this option with .Cm setkey subcommand, only one key have to be defined and this key has to be changed. +.It Fl j Ar passfile +Specifies a file which contains the old passphrase or its part. +.It Fl J Ar newpassfile +Specifies a file which contains the new passphrase or its part. .It Fl k Ar keyfile Specifies a file which contains part of the old key. .It Fl K Ar newkeyfile @@ -638,7 +657,7 @@ keyfile: # dd if=/dev/random of=/boot/keys/da0.key0 bs=32k count=1 # dd if=/dev/random of=/boot/keys/da0.key1 bs=32k count=1 # dd if=/dev/random of=/boot/keys/da0.key2 bs=32k count=1 -# cat /boot/keys/da0.key0 /boot/keys/da0.key1 /boot/keys/da0.key2 | geli init -b -K - da0 +# geli init -b -K /boot/keys/da0.key0 -K /boot/keys/da0.key1 -K /boot/keys/da0.key2 da0 Enter new passphrase: Reenter new passphrase: # dd if=/dev/random of=/dev/da1s3a bs=1m @@ -711,6 +730,22 @@ update the metadata: # geli resize -s 1g ada0p1 # geli attach -k keyfile -p ada0p1 .Ed +.Pp +Initialize provider with passphrase split into two files. +The provider can be attached by giving those two files or by giving +.Dq foobar +passphrase on +.Nm +prompt: +.Bd -literal -offset indent +# echo foo > da0.pass0 +# echo bar > da0.pass1 +# geli init -J da0.pass0 -J da0.pass1 da0 +# geli attach -j da0.pass0 -j da0.pass1 da0 +# geli detach da0 +# geli attach da0 +Enter passphrase: foobar +.Ed .Sh ENCRYPTION MODES .Nm supports two encryption modes: Modified: head/sbin/geom/class/eli/geom_eli.c ============================================================================== --- head/sbin/geom/class/eli/geom_eli.c Sat Sep 25 15:37:41 2010 (r213171) +++ head/sbin/geom/class/eli/geom_eli.c Sat Sep 25 17:38:57 2010 (r213172) @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -79,14 +80,14 @@ static int eli_backup_create(struct gctl /* * Available commands: * - * init [-bhPv] [-a aalgo] [-B backupfile] [-e ealgo] [-i iterations] [-l keylen] [-K newkeyfile] prov + * init [-bhPv] [-a aalgo] [-B backupfile] [-e ealgo] [-i iterations] [-l keylen] [-J newpassfile] [-K newkeyfile] prov * label - alias for 'init' - * attach [-dprv] [-k keyfile] prov + * attach [-dprv] [-j passfile] [-k keyfile] prov * detach [-fl] prov ... * stop - alias for 'detach' * onetime [-d] [-a aalgo] [-e ealgo] [-l keylen] prov * configure [-bB] prov ... - * setkey [-pPv] [-n keyno] [-k keyfile] [-K newkeyfile] prov + * setkey [-pPv] [-n keyno] [-j passfile] [-J newpassfile] [-k keyfile] [-K newkeyfile] prov * delkey [-afv] [-n keyno] prov * kill [-av] [prov ...] * backup [-v] prov file @@ -103,13 +104,14 @@ struct g_command class_commands[] = { { 'B', "backupfile", "", G_TYPE_STRING }, { 'e', "ealgo", GELI_ENC_ALGO, G_TYPE_STRING }, { 'i', "iterations", "-1", G_TYPE_NUMBER }, - { 'K', "newkeyfile", "", G_TYPE_STRING }, + { 'J', "newpassfile", G_VAL_OPTIONAL, G_TYPE_STRING | G_TYPE_MULTI }, + { 'K', "newkeyfile", G_VAL_OPTIONAL, G_TYPE_STRING | G_TYPE_MULTI }, { 'l', "keylen", "0", G_TYPE_NUMBER }, { 'P', "nonewpassphrase", NULL, G_TYPE_BOOL }, { 's', "sectorsize", "0", G_TYPE_NUMBER }, G_OPT_SENTINEL }, - "[-bPv] [-a aalgo] [-B backupfile] [-e ealgo] [-i iterations] [-l keylen] [-K newkeyfile] [-s sectorsize] prov" + "[-bPv] [-a aalgo] [-B backupfile] [-e ealgo] [-i iterations] [-l keylen] [-J newpassfile] [-K newkeyfile] [-s sectorsize] prov" }, { "label", G_FLAG_VERBOSE, eli_main, { @@ -118,7 +120,8 @@ struct g_command class_commands[] = { { 'B', "backupfile", "", G_TYPE_STRING }, { 'e', "ealgo", GELI_ENC_ALGO, G_TYPE_STRING }, { 'i', "iterations", "-1", G_TYPE_NUMBER }, - { 'K', "newkeyfile", "", G_TYPE_STRING }, + { 'J', "newpassfile", G_VAL_OPTIONAL, G_TYPE_STRING | G_TYPE_MULTI }, + { 'K', "newkeyfile", G_VAL_OPTIONAL, G_TYPE_STRING | G_TYPE_MULTI }, { 'l', "keylen", "0", G_TYPE_NUMBER }, { 'P', "nonewpassphrase", NULL, G_TYPE_BOOL }, { 's', "sectorsize", "0", G_TYPE_NUMBER }, @@ -129,12 +132,13 @@ struct g_command class_commands[] = { { "attach", G_FLAG_VERBOSE | G_FLAG_LOADKLD, eli_main, { { 'd', "detach", NULL, G_TYPE_BOOL }, - { 'k', "keyfile", "", G_TYPE_STRING }, + { 'j', "passfile", G_VAL_OPTIONAL, G_TYPE_STRING | G_TYPE_MULTI }, + { 'k', "keyfile", G_VAL_OPTIONAL, G_TYPE_STRING | G_TYPE_MULTI }, { 'p', "nopassphrase", NULL, G_TYPE_BOOL }, { 'r', "readonly", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - "[-dprv] [-k keyfile] prov" + "[-dprv] [-j passfile] [-k keyfile] prov" }, { "detach", 0, NULL, { @@ -174,14 +178,16 @@ struct g_command class_commands[] = { { "setkey", G_FLAG_VERBOSE, eli_main, { { 'i', "iterations", "-1", G_TYPE_NUMBER }, - { 'k', "keyfile", "", G_TYPE_STRING }, - { 'K', "newkeyfile", "", G_TYPE_STRING }, + { 'j', "passfile", G_VAL_OPTIONAL, G_TYPE_STRING | G_TYPE_MULTI }, + { 'J', "newpassfile", G_VAL_OPTIONAL, G_TYPE_STRING | G_TYPE_MULTI }, + { 'k', "keyfile", G_VAL_OPTIONAL, G_TYPE_STRING | G_TYPE_MULTI }, + { 'K', "newkeyfile", G_VAL_OPTIONAL, G_TYPE_STRING | G_TYPE_MULTI }, { 'n', "keyno", "-1", G_TYPE_NUMBER }, { 'p', "nopassphrase", NULL, G_TYPE_BOOL }, { 'P', "nonewpassphrase", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - "[-pPv] [-n keyno] [-i iterations] [-k keyfile] [-K newkeyfile] prov" + "[-pPv] [-n keyno] [-i iterations] [-j passfile] [-J newpassfile] [-k keyfile] [-K newkeyfile] prov" }, { "delkey", G_FLAG_VERBOSE, eli_main, { @@ -249,7 +255,7 @@ eli_protect(struct gctl_req *req) } static void -eli_main(struct gctl_req *req, unsigned flags) +eli_main(struct gctl_req *req, unsigned int flags) { const char *name; @@ -295,7 +301,7 @@ arc4rand(unsigned char *buf, size_t size { uint32_t *buf4; size_t size4; - unsigned i; + unsigned int i; buf4 = (uint32_t *)buf; size4 = size / 4; @@ -324,123 +330,216 @@ eli_is_attached(const char *prov) return (0); } -static unsigned char * -eli_genkey(struct gctl_req *req, struct g_eli_metadata *md, unsigned char *key, - int new) +static int +eli_genkey_files(struct gctl_req *req, bool new, const char *type, + struct hmac_ctx *ctxp, char *passbuf, size_t passbufsize) { - struct hmac_ctx ctx; - const char *str; - int error, nopassphrase; + char *p, buf[MAXPHYS], argname[16]; + const char *file; + int error, fd, i; + ssize_t done; + + assert((strcmp(type, "keyfile") == 0 && ctxp != NULL && + passbuf == NULL && passbufsize == 0) || + (strcmp(type, "passfile") == 0 && ctxp == NULL && + passbuf != NULL && passbufsize > 0)); + assert(strcmp(type, "keyfile") == 0 || passbuf[0] == '\0'); + + for (i = 0; ; i++) { + snprintf(argname, sizeof(argname), "%s%s%d", + new ? "new" : "", type, i); + + /* No more {key,pass}files? */ + if (!gctl_has_param(req, argname)) + return (i); - nopassphrase = - gctl_get_int(req, new ? "nonewpassphrase" : "nopassphrase"); + file = gctl_get_ascii(req, argname); + assert(file != NULL); - g_eli_crypto_hmac_init(&ctx, NULL, 0); - - str = gctl_get_ascii(req, new ? "newkeyfile" : "keyfile"); - if (str[0] == '\0' && nopassphrase) { - gctl_error(req, "No key components given."); - return (NULL); - } else if (str[0] != '\0') { - char buf[MAXPHYS]; - ssize_t done; - int fd; - - if (strcmp(str, "-") == 0) + if (strcmp(file, "-") == 0) fd = STDIN_FILENO; else { - fd = open(str, O_RDONLY); + fd = open(file, O_RDONLY); if (fd == -1) { - gctl_error(req, "Cannot open keyfile %s: %s.", - str, strerror(errno)); - return (NULL); + gctl_error(req, "Cannot open %s %s: %s.", + type, file, strerror(errno)); + return (-1); + } + } + if (strcmp(type, "keyfile") == 0) { + while ((done = read(fd, buf, sizeof(buf))) > 0) + g_eli_crypto_hmac_update(ctxp, buf, done); + } else /* if (strcmp(type, "passfile") == 0) */ { + while ((done = read(fd, buf, sizeof(buf) - 1)) > 0) { + buf[done] = '\0'; + p = strchr(buf, '\n'); + if (p != NULL) { + *p = '\0'; + done = p - buf; + } + if (strlcat(passbuf, buf, passbufsize) >= + passbufsize) { + gctl_error(req, + "Passphrase in %s too long.", file); + bzero(buf, sizeof(buf)); + return (-1); + } + if (p != NULL) + break; } } - while ((done = read(fd, buf, sizeof(buf))) > 0) - g_eli_crypto_hmac_update(&ctx, buf, done); error = errno; - if (strcmp(str, "-") != 0) + if (strcmp(file, "-") != 0) close(fd); bzero(buf, sizeof(buf)); if (done == -1) { - gctl_error(req, "Cannot read keyfile %s: %s.", str, - strerror(error)); - return (NULL); + gctl_error(req, "Cannot read %s %s: %s.", + type, file, strerror(error)); + return (-1); } } + /* NOTREACHED */ +} - if (!nopassphrase) { - char buf1[BUFSIZ], buf2[BUFSIZ], *p; +static int +eli_genkey_passphrase_prompt(struct gctl_req *req, bool new, char *passbuf, + size_t passbufsize) +{ + char *p; - if (!new && md->md_iterations == -1) { - gctl_error(req, "Missing -p flag."); - return (NULL); + for (;;) { + p = readpassphrase( + new ? "Enter new passphrase:" : "Enter passphrase:", + passbuf, passbufsize, RPP_ECHO_OFF | RPP_REQUIRE_TTY); + if (p == NULL) { + bzero(passbuf, passbufsize); + gctl_error(req, "Cannot read passphrase: %s.", + strerror(errno)); + return (-1); } - for (;;) { - p = readpassphrase( - new ? "Enter new passphrase:" : "Enter passphrase:", - buf1, sizeof(buf1), RPP_ECHO_OFF | RPP_REQUIRE_TTY); + + if (new) { + char tmpbuf[BUFSIZ]; + + p = readpassphrase("Reenter new passphrase: ", + tmpbuf, sizeof(tmpbuf), + RPP_ECHO_OFF | RPP_REQUIRE_TTY); if (p == NULL) { - bzero(buf1, sizeof(buf1)); - gctl_error(req, "Cannot read passphrase: %s.", + bzero(passbuf, passbufsize); + gctl_error(req, + "Cannot read passphrase: %s.", strerror(errno)); - return (NULL); + return (-1); } - - if (new) { - p = readpassphrase("Reenter new passphrase: ", - buf2, sizeof(buf2), - RPP_ECHO_OFF | RPP_REQUIRE_TTY); - if (p == NULL) { - bzero(buf1, sizeof(buf1)); - gctl_error(req, - "Cannot read passphrase: %s.", - strerror(errno)); - return (NULL); - } - - if (strcmp(buf1, buf2) != 0) { - bzero(buf2, sizeof(buf2)); - fprintf(stderr, "They didn't match.\n"); - continue; - } - bzero(buf2, sizeof(buf2)); + + if (strcmp(passbuf, tmpbuf) != 0) { + bzero(passbuf, passbufsize); + fprintf(stderr, "They didn't match.\n"); + continue; } - break; + bzero(tmpbuf, sizeof(tmpbuf)); } - /* - * Field md_iterations equal to -1 means "choose some sane - * value for me". - */ - if (md->md_iterations == -1) { - assert(new); - if (verbose) - printf("Calculating number of iterations...\n"); - md->md_iterations = pkcs5v2_calculate(2000000); - assert(md->md_iterations > 0); - if (verbose) { - printf("Done, using %d iterations.\n", - md->md_iterations); - } + return (0); + } + /* NOTREACHED */ +} + +static int +eli_genkey_passphrase(struct gctl_req *req, struct g_eli_metadata *md, bool new, + struct hmac_ctx *ctxp) +{ + char passbuf[MAXPHYS]; + bool nopassphrase; + int nfiles; + + nopassphrase = + gctl_get_int(req, new ? "nonewpassphrase" : "nopassphrase"); + if (nopassphrase) { + if (gctl_has_param(req, new ? "newpassfile0" : "passfile0")) { + gctl_error(req, + "Options -%c and -%c are mutually exclusive.", + new ? 'J' : 'j', new ? 'P' : 'p'); + return (-1); } - /* - * If md_iterations is equal to 0, user don't want PKCS#5v2. - */ - if (md->md_iterations == 0) { - g_eli_crypto_hmac_update(&ctx, md->md_salt, - sizeof(md->md_salt)); - g_eli_crypto_hmac_update(&ctx, buf1, strlen(buf1)); - } else /* if (md->md_iterations > 0) */ { - unsigned char dkey[G_ELI_USERKEYLEN]; - - pkcs5v2_genkey(dkey, sizeof(dkey), md->md_salt, - sizeof(md->md_salt), buf1, md->md_iterations); - g_eli_crypto_hmac_update(&ctx, dkey, sizeof(dkey)); - bzero(dkey, sizeof(dkey)); + return (0); + } + + if (!new && md->md_iterations == -1) { + gctl_error(req, "Missing -p flag."); + return (-1); + } + passbuf[0] = '\0'; + nfiles = eli_genkey_files(req, new, "passfile", NULL, passbuf, + sizeof(passbuf)); + if (nfiles == -1) + return (-1); + else if (nfiles == 0) { + if (eli_genkey_passphrase_prompt(req, new, passbuf, + sizeof(passbuf)) == -1) { + return (-1); } - bzero(buf1, sizeof(buf1)); } + /* + * Field md_iterations equal to -1 means "choose some sane + * value for me". + */ + if (md->md_iterations == -1) { + assert(new); + if (verbose) + printf("Calculating number of iterations...\n"); + md->md_iterations = pkcs5v2_calculate(2000000); + assert(md->md_iterations > 0); + if (verbose) { + printf("Done, using %d iterations.\n", + md->md_iterations); + } + } + /* + * If md_iterations is equal to 0, user doesn't want PKCS#5v2. + */ + if (md->md_iterations == 0) { + g_eli_crypto_hmac_update(ctxp, md->md_salt, + sizeof(md->md_salt)); + g_eli_crypto_hmac_update(ctxp, passbuf, strlen(passbuf)); + } else /* if (md->md_iterations > 0) */ { + unsigned char dkey[G_ELI_USERKEYLEN]; + + pkcs5v2_genkey(dkey, sizeof(dkey), md->md_salt, + sizeof(md->md_salt), passbuf, md->md_iterations); + g_eli_crypto_hmac_update(ctxp, dkey, sizeof(dkey)); + bzero(dkey, sizeof(dkey)); + } + bzero(passbuf, sizeof(passbuf)); + + return (0); +} + +static unsigned char * +eli_genkey(struct gctl_req *req, struct g_eli_metadata *md, unsigned char *key, + bool new) +{ + struct hmac_ctx ctx; + bool nopassphrase; + int nfiles; + + nopassphrase = + gctl_get_int(req, new ? "nonewpassphrase" : "nopassphrase"); + + g_eli_crypto_hmac_init(&ctx, NULL, 0); + + nfiles = eli_genkey_files(req, new, "keyfile", &ctx, NULL, 0); + if (nfiles == -1) + return (NULL); + else if (nfiles == 0 && nopassphrase) { + gctl_error(req, "No key components given."); + return (NULL); + } + + if (eli_genkey_passphrase(req, md, new, &ctx) == -1) + return (NULL); + g_eli_crypto_hmac_final(&ctx, key, 0); + return (key); } @@ -640,7 +739,7 @@ eli_init(struct gctl_req *req) arc4rand(md.md_mkeys, sizeof(md.md_mkeys)); /* Generate user key. */ - if (eli_genkey(req, &md, key, 1) == NULL) { + if (eli_genkey(req, &md, key, true) == NULL) { bzero(key, sizeof(key)); bzero(&md, sizeof(md)); return; @@ -720,7 +819,7 @@ eli_attach(struct gctl_req *req) return; } - if (eli_genkey(req, &md, key, 0) == NULL) { + if (eli_genkey(req, &md, key, false) == NULL) { bzero(key, sizeof(key)); return; } @@ -734,7 +833,7 @@ eli_attach(struct gctl_req *req) } static void -eli_configure_detached(struct gctl_req *req, const char *prov, int boot) +eli_configure_detached(struct gctl_req *req, const char *prov, bool boot) { struct g_eli_metadata md; @@ -761,7 +860,8 @@ static void eli_configure(struct gctl_req *req) { const char *prov; - int i, nargs, boot, noboot; + bool boot, noboot; + int i, nargs; nargs = gctl_get_int(req, "nargs"); if (nargs == 0) { @@ -806,7 +906,7 @@ eli_setkey_attached(struct gctl_req *req old = md->md_iterations; /* Generate key for Master Key encryption. */ - if (eli_genkey(req, md, key, 1) == NULL) { + if (eli_genkey(req, md, key, true) == NULL) { bzero(key, sizeof(key)); return; } @@ -831,8 +931,8 @@ eli_setkey_detached(struct gctl_req *req { unsigned char key[G_ELI_USERKEYLEN], mkey[G_ELI_DATAIVKEYLEN]; unsigned char *mkeydst; + unsigned int nkey; intmax_t val; - unsigned nkey; int error; if (md->md_keys == 0) { @@ -841,7 +941,7 @@ eli_setkey_detached(struct gctl_req *req } /* Generate key for Master Key decryption. */ - if (eli_genkey(req, md, key, 0) == NULL) { + if (eli_genkey(req, md, key, false) == NULL) { bzero(key, sizeof(key)); return; } @@ -897,7 +997,7 @@ eli_setkey_detached(struct gctl_req *req bzero(mkey, sizeof(mkey)); /* Generate key for Master Key encryption. */ - if (eli_genkey(req, md, key, 1) == NULL) { + if (eli_genkey(req, md, key, true) == NULL) { bzero(key, sizeof(key)); bzero(md, sizeof(*md)); return; @@ -959,9 +1059,9 @@ eli_delkey_detached(struct gctl_req *req { struct g_eli_metadata md; unsigned char *mkeydst; + unsigned int nkey; intmax_t val; - unsigned nkey; - int all, force; + bool all, force; if (eli_metadata_read(req, prov, &md) == -1) return; From owner-svn-src-all@FreeBSD.ORG Sat Sep 25 17:41:02 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9DFA6106566B; Sat, 25 Sep 2010 17:41:02 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8D3AC8FC14; Sat, 25 Sep 2010 17:41:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8PHf2VW068932; Sat, 25 Sep 2010 17:41:02 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8PHf2cb068930; Sat, 25 Sep 2010 17:41:02 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009251741.o8PHf2cb068930@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sat, 25 Sep 2010 17:41:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213173 - head/tools/regression/geom_eli X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 17:41:02 -0000 Author: pjd Date: Sat Sep 25 17:41:02 2010 New Revision: 213173 URL: http://svn.freebsd.org/changeset/base/213173 Log: Add some regression tests for newly added -J and -j options. MFC after: 2 weeks Added: head/tools/regression/geom_eli/init-J.t (contents, props changed) Added: head/tools/regression/geom_eli/init-J.t ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/geom_eli/init-J.t Sat Sep 25 17:41:02 2010 (r213173) @@ -0,0 +1,126 @@ +#!/bin/sh +# $FreeBSD$ + +base=`basename $0` +no=45 +sectors=100 +keyfile0=`mktemp /tmp/$base.XXXXXX` || exit 1 +keyfile1=`mktemp /tmp/$base.XXXXXX` || exit 1 +passfile0=`mktemp /tmp/$base.XXXXXX` || exit 1 +passfile1=`mktemp /tmp/$base.XXXXXX` || exit 1 +mdconfig -a -t malloc -s `expr $sectors + 1` -u $no || exit 1 + +echo "1..150" + +dd if=/dev/random of=${keyfile0} bs=512 count=16 >/dev/null 2>&1 +dd if=/dev/random of=${keyfile1} bs=512 count=16 >/dev/null 2>&1 +dd if=/dev/random bs=512 count=16 2>/dev/null | sha1 > ${passfile0} +dd if=/dev/random bs=512 count=16 2>/dev/null | sha1 > ${passfile1} + +i=1 +for iter in -1 0 64; do + geli init -i ${iter} -B none -J ${passfile0} -P md${no} 2>/dev/null && echo -n "not " + echo "ok ${i}"; i=$((i+1)) + geli init -i ${iter} -B none -J ${passfile0} -P -K ${keyfile0} md${no} 2>/dev/null && echo -n "not " + echo "ok ${i}"; i=$((i+1)) + geli init -i ${iter} -B none -J ${passfile0} -K ${keyfile0} md${no} 2>/dev/null || echo -n "not " + echo "ok ${i}"; i=$((i+1)) + geli attach -k ${keyfile0} -p md${no} 2>/dev/null && echo -n "not " + echo "ok ${i}"; i=$((i+1)) + geli attach -j ${passfile0} md${no} 2>/dev/null && echo -n "not " + echo "ok ${i}"; i=$((i+1)) + geli attach -j ${keyfile0} md${no} 2>/dev/null && echo -n "not " + echo "ok ${i}"; i=$((i+1)) + geli attach -k ${passfile0} -p md${no} 2>/dev/null && echo -n "not " + echo "ok ${i}"; i=$((i+1)) + geli attach -j ${keyfile0} -k ${passfile0} md${no} 2>/dev/null && echo -n "not " + echo "ok ${i}"; i=$((i+1)) + geli attach -j ${keyfile0} -k ${keyfile0} md${no} 2>/dev/null && echo -n "not " + echo "ok ${i}"; i=$((i+1)) + geli attach -j ${passfile0} -k ${passfile0} md${no} 2>/dev/null && echo -n "not " + echo "ok ${i}"; i=$((i+1)) + geli attach -j ${passfile0} -k ${keyfile0} md${no} 2>/dev/null || echo -n "not " + echo "ok ${i}"; i=$((i+1)) + geli detach md${no} || echo -n "not " + echo "ok ${i}"; i=$((i+1)) + cat ${keyfile0} | geli attach -j ${passfile0} -k - md${no} 2>/dev/null || echo -n "not " + echo "ok ${i}"; i=$((i+1)) + geli detach md${no} || echo -n "not " + echo "ok ${i}"; i=$((i+1)) + cat ${passfile0} | geli attach -j - -k ${keyfile0} md${no} 2>/dev/null || echo -n "not " + echo "ok ${i}"; i=$((i+1)) + geli detach md${no} || echo -n "not " + echo "ok ${i}"; i=$((i+1)) + + geli init -i ${iter} -B none -J ${passfile0} -J ${passfile1} -P md${no} 2>/dev/null && echo -n "not " + echo "ok ${i}"; i=$((i+1)) + geli init -i ${iter} -B none -J ${passfile0} -J ${passfile1} -P -K ${keyfile0} -K ${keyfile1} md${no} 2>/dev/null && echo -n "not " + echo "ok ${i}"; i=$((i+1)) + geli init -i ${iter} -B none -J ${passfile0} -J ${passfile1} -K ${keyfile0} -K ${keyfile1} md${no} 2>/dev/null || echo -n "not " + echo "ok ${i}"; i=$((i+1)) + geli attach -k ${keyfile0} -p md${no} 2>/dev/null && echo -n "not " + echo "ok ${i}"; i=$((i+1)) + geli attach -k ${keyfile1} -p md${no} 2>/dev/null && echo -n "not " + echo "ok ${i}"; i=$((i+1)) + geli attach -j ${passfile0} md${no} 2>/dev/null && echo -n "not " + echo "ok ${i}"; i=$((i+1)) + geli attach -j ${passfile1} md${no} 2>/dev/null && echo -n "not " + echo "ok ${i}"; i=$((i+1)) + geli attach -k ${keyfile0} -k ${keyfile1} -p md${no} 2>/dev/null && echo -n "not " + echo "ok ${i}"; i=$((i+1)) + geli attach -j ${passfile0} -j ${passfile1} md${no} 2>/dev/null && echo -n "not " + echo "ok ${i}"; i=$((i+1)) + geli attach -k ${keyfile0} -j ${passfile0} md${no} 2>/dev/null && echo -n "not " + echo "ok ${i}"; i=$((i+1)) + geli attach -k ${keyfile0} -j ${passfile1} md${no} 2>/dev/null && echo -n "not " + echo "ok ${i}"; i=$((i+1)) + geli attach -k ${keyfile1} -j ${passfile0} md${no} 2>/dev/null && echo -n "not " + echo "ok ${i}"; i=$((i+1)) + geli attach -k ${keyfile1} -j ${passfile1} md${no} 2>/dev/null && echo -n "not " + echo "ok ${i}"; i=$((i+1)) + geli attach -k ${keyfile0} -j ${passfile0} -j ${passfile1} md${no} 2>/dev/null && echo -n "not " + echo "ok ${i}"; i=$((i+1)) + geli attach -k ${keyfile1} -j ${passfile0} -j ${passfile1} md${no} 2>/dev/null && echo -n "not " + echo "ok ${i}"; i=$((i+1)) + geli attach -k ${keyfile0} -k ${keyfile1} -j ${passfile0} md${no} 2>/dev/null && echo -n "not " + echo "ok ${i}"; i=$((i+1)) + geli attach -k ${keyfile0} -k ${keyfile1} -j ${passfile1} md${no} 2>/dev/null && echo -n "not " + echo "ok ${i}"; i=$((i+1)) + geli attach -k ${keyfile1} -k ${keyfile0} -j ${passfile0} -j ${passfile1} md${no} 2>/dev/null && echo -n "not " + echo "ok ${i}"; i=$((i+1)) + geli attach -k ${keyfile0} -k ${keyfile1} -j ${passfile1} -j ${passfile0} md${no} 2>/dev/null && echo -n "not " + echo "ok ${i}"; i=$((i+1)) + geli attach -k ${keyfile1} -k ${keyfile0} -j ${passfile1} -j ${passfile0} md${no} 2>/dev/null && echo -n "not " + echo "ok ${i}"; i=$((i+1)) + geli attach -j ${passfile0} -j ${passfile1} -k ${keyfile0} -k ${keyfile1} md${no} 2>/dev/null || echo -n "not " + echo "ok ${i}"; i=$((i+1)) + geli detach md${no} || echo -n "not " + echo "ok ${i}"; i=$((i+1)) + cat ${passfile0} | geli attach -j - -j ${passfile1} -k ${keyfile0} -k ${keyfile1} md${no} 2>/dev/null || echo -n "not " + echo "ok ${i}"; i=$((i+1)) + geli detach md${no} || echo -n "not " + echo "ok ${i}"; i=$((i+1)) + cat ${passfile1} | geli attach -j ${passfile0} -j - -k ${keyfile0} -k ${keyfile1} md${no} 2>/dev/null || echo -n "not " + echo "ok ${i}"; i=$((i+1)) + geli detach md${no} || echo -n "not " + echo "ok ${i}"; i=$((i+1)) + cat ${keyfile0} | geli attach -j ${passfile0} -j ${passfile1} -k - -k ${keyfile1} md${no} 2>/dev/null || echo -n "not " + echo "ok ${i}"; i=$((i+1)) + geli detach md${no} || echo -n "not " + echo "ok ${i}"; i=$((i+1)) + cat ${keyfile1} | geli attach -j ${passfile0} -j ${passfile1} -k ${keyfile0} -k - md${no} 2>/dev/null || echo -n "not " + echo "ok ${i}"; i=$((i+1)) + geli detach md${no} || echo -n "not " + echo "ok ${i}"; i=$((i+1)) + cat ${keyfile0} ${keyfile1} | geli attach -j ${passfile0} -j ${passfile1} -k - md${no} 2>/dev/null || echo -n "not " + echo "ok ${i}"; i=$((i+1)) + geli detach md${no} || echo -n "not " + echo "ok ${i}"; i=$((i+1)) + cat ${passfile0} ${passfile1} | awk '{printf "%s", $0}' | geli attach -j - -k ${keyfile0} -k ${keyfile1} md${no} 2>/dev/null || echo -n "not " + echo "ok ${i}"; i=$((i+1)) + geli detach md${no} || echo -n "not " + echo "ok ${i}"; i=$((i+1)) +done + +mdconfig -d -u $no +rm -f ${keyfile0} ${keyfile1} ${passfile0} ${passfile1} From owner-svn-src-all@FreeBSD.ORG Sat Sep 25 18:27:29 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C6921106564A; Sat, 25 Sep 2010 18:27:29 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B18828FC12; Sat, 25 Sep 2010 18:27:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8PIRT9W069996; Sat, 25 Sep 2010 18:27:29 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8PIRTPN069992; Sat, 25 Sep 2010 18:27:29 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201009251827.o8PIRTPN069992@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Sat, 25 Sep 2010 18:27:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213174 - head/sys/geom/part X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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 Sep 2010 18:27:29 -0000 Author: ae Date: Sat Sep 25 18:27:29 2010 New Revision: 213174 URL: http://svn.freebsd.org/changeset/base/213174 Log: Some schemes can allocate memory for internal purposes but when GEOM does withering this memory doesn't freed. Add G_PART_DESTROY call to g_part_wither. Also add missed g_free() call to G_PART_READ method for MBR and PC98 schemes. Submitted by: jh (previous version) Reviewed by: pjd Approved by: kib (mentor) Modified: head/sys/geom/part/g_part.c head/sys/geom/part/g_part_mbr.c head/sys/geom/part/g_part_pc98.c Modified: head/sys/geom/part/g_part.c ============================================================================== --- head/sys/geom/part/g_part.c Sat Sep 25 17:41:02 2010 (r213173) +++ head/sys/geom/part/g_part.c Sat Sep 25 18:27:29 2010 (r213174) @@ -1273,6 +1273,7 @@ g_part_wither(struct g_geom *gp, int err table = gp->softc; if (table != NULL) { + G_PART_DESTROY(table, NULL); while ((entry = LIST_FIRST(&table->gpt_entry)) != NULL) { LIST_REMOVE(entry, gpe_entry); g_free(entry); Modified: head/sys/geom/part/g_part_mbr.c ============================================================================== --- head/sys/geom/part/g_part_mbr.c Sat Sep 25 17:41:02 2010 (r213173) +++ head/sys/geom/part/g_part_mbr.c Sat Sep 25 18:27:29 2010 (r213174) @@ -465,6 +465,7 @@ g_part_mbr_read(struct g_part_table *bas basetable->gpt_first = basetable->gpt_sectors; basetable->gpt_last = msize - (msize % basetable->gpt_sectors) - 1; + g_free(buf); return (0); } Modified: head/sys/geom/part/g_part_pc98.c ============================================================================== --- head/sys/geom/part/g_part_pc98.c Sat Sep 25 17:41:02 2010 (r213173) +++ head/sys/geom/part/g_part_pc98.c Sat Sep 25 18:27:29 2010 (r213174) @@ -458,6 +458,7 @@ g_part_pc98_read(struct g_part_table *ba basetable->gpt_first = cyl; basetable->gpt_last = msize - (msize % cyl) - 1; + g_free(buf); return (0); }