From kensmith at FreeBSD.org Mon Dec 1 09:26:29 2008 From: kensmith at FreeBSD.org (Ken Smith) Date: Mon Dec 1 09:26:50 2008 Subject: svn commit: r185523 - stable/7/release/scripts Message-ID: <200812011726.mB1HQS7J031900@svn.freebsd.org> Author: kensmith Date: Mon Dec 1 17:26:28 2008 New Revision: 185523 URL: http://svn.freebsd.org/changeset/base/185523 Log: Make adjustments to the package set for 7.1-RELEASE. Approved by: re (kib) Modified: stable/7/release/scripts/package-split.py Modified: stable/7/release/scripts/package-split.py ============================================================================== --- stable/7/release/scripts/package-split.py Mon Dec 1 16:53:01 2008 (r185522) +++ stable/7/release/scripts/package-split.py Mon Dec 1 17:26:28 2008 (r185523) @@ -47,11 +47,18 @@ def disc2_packages(): 'x11/kde-lite'] else: pkgs = ['x11/gnome2', - 'x11/kde3'] + 'x11/kdebase3', + 'x11/kdelibs3', + 'games/kdegames3', + 'graphics/kdegraphics3', + 'misc/kdeutils3', + 'multimedia/kdemultimedia3', + 'net/kdenetwork3'] return pkgs def disc3_packages(): - pkgs = ['x11-wm/afterstep', + pkgs = ['x11/kde3', + 'x11-wm/afterstep', 'x11-wm/windowmaker', 'x11-wm/fvwm2', # "Nice to have" @@ -66,10 +73,10 @@ def disc3_packages(): 'graphics/xv', 'irc/xchat', 'lang/php5', + 'mail/alpine', 'mail/exim', 'mail/fetchmail', 'mail/mutt', - 'mail/pine4', 'mail/popd', 'mail/xfmail', 'mail/postfix', @@ -83,7 +90,7 @@ def disc3_packages(): 'ports-mgmt/portupgrade', 'print/a2ps-letter', 'print/apsfilter', - 'print/ghostscript-gnu-nox11', + 'print/ghostscript7-nox11', 'print/gv', 'print/psutils-letter', 'print/teTeX', @@ -100,9 +107,10 @@ def disc3_packages(): 'x11/rxvt', # Formerly on disc3 'ports-mgmt/portaudit'] + if arch == 'amd64' or arch == 'i386': + pkgs.extend(['www/opera']) if arch == 'i386': - pkgs.extend(['www/opera', - 'misc/compat4x']) + pkgs.extend(['misc/compat4x']) return pkgs # The list of desired packages From marcel at FreeBSD.org Mon Dec 1 09:40:58 2008 From: marcel at FreeBSD.org (Marcel Moolenaar) Date: Mon Dec 1 09:41:14 2008 Subject: svn commit: r185526 - in stable/7/sys: . ia64/include Message-ID: <200812011740.mB1Hev1f032334@svn.freebsd.org> Author: marcel Date: Mon Dec 1 17:40:57 2008 New Revision: 185526 URL: http://svn.freebsd.org/changeset/base/185526 Log: MFC rev 179382: Work-around a compiler optimization bug, that broke libthr. Massive inlining resulted in constant propagation to the extend that cmpval was known to the compiler to be URWLOCK_WRITE_OWNER (= 0x80000000U). Unfortunately, instead of zero-extending the unsigned constant, it was sign-extended. As such, the cmpxchg instruction was comparing 0x0000000080000000LU to 0xffffffff80000000LU and obviously didn't perform the exchange. But, since the value returned by cmpxhg equalled cmpval (when zero- extended), the _thr_rtld_lock_release() function thought the exchange did happen and as such returned as if having released the lock. This was not the case. Subsequent locking requests found rw_state non-zero and the thread in question entered the kernel and block indefinitely. The work-around is to zero-extend by casting to uint64_t. Approved by: re (kensmith) Modified: stable/7/sys/ (props changed) stable/7/sys/ia64/include/atomic.h Modified: stable/7/sys/ia64/include/atomic.h ============================================================================== --- stable/7/sys/ia64/include/atomic.h Mon Dec 1 17:39:34 2008 (r185525) +++ stable/7/sys/ia64/include/atomic.h Mon Dec 1 17:40:57 2008 (r185526) @@ -42,7 +42,7 @@ "mov ar.ccv=%2;;\n\t" \ "cmpxchg" #sz "." #sem " %0=%4,%3,ar.ccv\n\t" \ : "=r" (ret), "=m" (*p) \ - : "r" (cmpval), "r" (newval), "m" (*p) \ + : "r" ((uint64_t)cmpval), "r" (newval), "m" (*p) \ : "memory") /* From wb at freebie.xs4all.nl Mon Dec 1 14:03:05 2008 From: wb at freebie.xs4all.nl (Wilko Bulte) Date: Mon Dec 1 14:03:16 2008 Subject: svn commit: r185526 - in stable/7/sys: . ia64/include In-Reply-To: <200812011740.mB1Hev1f032334@svn.freebsd.org> References: <200812011740.mB1Hev1f032334@svn.freebsd.org> Message-ID: <20081201213948.GI15094@freebie.xs4all.nl> Quoting Marcel Moolenaar, who wrote on Mon, Dec 01, 2008 at 05:40:57PM +0000 .. > Author: marcel > Date: Mon Dec 1 17:40:57 2008 > New Revision: 185526 > URL: http://svn.freebsd.org/changeset/base/185526 > > Log: > MFC rev 179382: > Work-around a compiler optimization bug, that broke libthr. Massive > inlining resulted in constant propagation to the extend that cmpval > was known to the compiler to be URWLOCK_WRITE_OWNER (= 0x80000000U). > Unfortunately, instead of zero-extending the unsigned constant, it > was sign-extended. As such, the cmpxchg instruction was comparing > 0x0000000080000000LU to 0xffffffff80000000LU and obviously didn't > perform the exchange. > But, since the value returned by cmpxhg equalled cmpval (when zero- > extended), the _thr_rtld_lock_release() function thought the exchange > did happen and as such returned as if having released the lock. This > was not the case. Subsequent locking requests found rw_state non-zero > and the thread in question entered the kernel and block indefinitely. > *WOW*... Wilko From kib at FreeBSD.org Tue Dec 2 05:29:36 2008 From: kib at FreeBSD.org (Konstantin Belousov) Date: Tue Dec 2 05:29:53 2008 Subject: svn commit: r185559 - in stable/7/sys: . dev/fb Message-ID: <200812021329.mB2DTaNB061413@svn.freebsd.org> Author: kib Date: Tue Dec 2 13:29:35 2008 New Revision: 185559 URL: http://svn.freebsd.org/changeset/base/185559 Log: MFC r185451: Third argument to the vi_mmap_t function is vm_paddr_t *. Approved by: re (kensmith) Modified: stable/7/sys/ (props changed) stable/7/sys/dev/fb/s3_pci.c Modified: stable/7/sys/dev/fb/s3_pci.c ============================================================================== --- stable/7/sys/dev/fb/s3_pci.c Tue Dec 2 11:58:31 2008 (r185558) +++ stable/7/sys/dev/fb/s3_pci.c Tue Dec 2 13:29:35 2008 (r185559) @@ -389,7 +389,7 @@ s3lfb_blank_display(video_adapter_t *adp } static int -s3lfb_mmap(video_adapter_t *adp, vm_offset_t offset, vm_offset_t *paddr, +s3lfb_mmap(video_adapter_t *adp, vm_offset_t offset, vm_paddr_t *paddr, int prot) { return (*prevvidsw->mmap)(adp, offset, paddr, prot); From kib at FreeBSD.org Wed Dec 3 07:07:17 2008 From: kib at FreeBSD.org (Konstantin Belousov) Date: Wed Dec 3 07:07:29 2008 Subject: svn commit: r185580 - stable/7/share/man/man9 Message-ID: <200812031507.mB3F7H14094004@svn.freebsd.org> Author: kib Date: Wed Dec 3 15:07:17 2008 New Revision: 185580 URL: http://svn.freebsd.org/changeset/base/185580 Log: MFC r185474: Clarify the reason to not use the volatile string as an argument to CTR macros. Note the logging of file and line. Approved by: re (hrs) Modified: stable/7/share/man/man9/ (props changed) stable/7/share/man/man9/ktr.9 Modified: stable/7/share/man/man9/ktr.9 ============================================================================== --- stable/7/share/man/man9/ktr.9 Wed Dec 3 14:53:59 2008 (r185579) +++ stable/7/share/man/man9/ktr.9 Wed Dec 3 15:07:17 2008 (r185580) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 27, 2005 +.Dd November 30, 2008 .Dt KTR 9 .Os .Sh NAME @@ -84,9 +84,16 @@ Following the .Fa format string are zero to five arguments referenced by .Fa format . +Each event is logged with a file name and source line number of the +originating CTR call, and a timestamp in addition to the log message. +.Pp +The event is stored in the circular buffer with supplied arguments as is, +and formatting is done at the dump time. +Do not use pointers to the objects with limited lifetime, for instance, +strings, because the pointer may become invalid when buffer is printed. +.Pp Note that the different macros differ only in the number of arguments each one takes, as indicated by its name. -Each event is logged with a timestamp in addition to the log message. .Pp The .Va ktr_entries @@ -121,13 +128,11 @@ mi_switch() * Pick a new current process and record its start time. */ ... - CTR3(KTR_PROC, "mi_switch: old proc %p (pid %d, %s)", p, p->p_pid, - p->p_comm); + CTR3(KTR_PROC, "mi_switch: old proc %p (pid %d)", p, p->p_pid); ... cpu_switch(); ... - CTR3(KTR_PROC, "mi_switch: new proc %p (pid %d, %s)", p, p->p_pid, - p->p_comm); + CTR3(KTR_PROC, "mi_switch: new proc %p (pid %d)", p, p->p_pid); ... } .Ed From danger at FreeBSD.org Thu Dec 4 04:22:12 2008 From: danger at FreeBSD.org (Daniel Gerzo) Date: Thu Dec 4 04:22:29 2008 Subject: svn commit: r185607 - stable/7/share/man/man5 Message-ID: <200812041222.mB4CMCgC020841@svn.freebsd.org> Author: danger (doc committer) Date: Thu Dec 4 12:22:11 2008 New Revision: 185607 URL: http://svn.freebsd.org/changeset/base/185607 Log: - MFC the nullfs(5) manual page Approved by: re@ (blackend) Added: stable/7/share/man/man5/nullfs.5 - copied unchanged from r183631, head/share/man/man5/nullfs.5 Modified: stable/7/share/man/man5/ (props changed) stable/7/share/man/man5/Makefile Modified: stable/7/share/man/man5/Makefile ============================================================================== --- stable/7/share/man/man5/Makefile Thu Dec 4 08:17:34 2008 (r185606) +++ stable/7/share/man/man5/Makefile Thu Dec 4 12:22:11 2008 (r185607) @@ -46,6 +46,7 @@ MAN= acct.5 \ networks.5 \ nsmb.conf.5 \ nsswitch.conf.5 \ + nullfs.5 \ passwd.5 \ pbm.5 \ periodic.conf.5 \ Copied: stable/7/share/man/man5/nullfs.5 (from r183631, head/share/man/man5/nullfs.5) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/share/man/man5/nullfs.5 Thu Dec 4 12:22:11 2008 (r185607, copy of r183631, head/share/man/man5/nullfs.5) @@ -0,0 +1,75 @@ +.\" +.\" Copyright (c) 2008 Daniel Gerzo +.\" 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 DOCUMENTATION IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd October 5, 2008 +.Dt NULLFS 5 +.Os +.Sh NAME +.Nm nullfs +.Nd "null file system" +.Sh SYNOPSIS +To enable support for +.Nm , +place the following line in the kernel configuration file: +.Bd -ragged -offset indent +.Cd "options NULLFS" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +nullfs_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver will permit the +.Fx +kernel to mount a loopback file system sub-tree. +.Sh EXAMPLES +To mount a +.Nm +file system: +.Pp +.Dl "mount_nullfs /usr/ports /home/devel/ports" +.Sh SEE ALSO +.Xr fstab 5 , +.Xr mount_nullfs 8 +.Sh HISTORY +The +.Nm +layer first appeared in +.Bx 4.4 . +.Sh AUTHORS +.An -nosplit +The +.Nm +kernel implementation was written by +.An John Heideman . +.Pp +This manual page was written by +.An Daniel Gerzo Aq danger@FreeBSD.org . From kostikbel at gmail.com Thu Dec 4 04:31:04 2008 From: kostikbel at gmail.com (Kostik Belousov) Date: Thu Dec 4 04:31:16 2008 Subject: svn commit: r185607 - stable/7/share/man/man5 In-Reply-To: <200812041222.mB4CMCgC020841@svn.freebsd.org> References: <200812041222.mB4CMCgC020841@svn.freebsd.org> Message-ID: <20081204123058.GD2038@deviant.kiev.zoral.com.ua> On Thu, Dec 04, 2008 at 12:22:12PM +0000, Daniel Gerzo wrote: > Author: danger (doc committer) > Date: Thu Dec 4 12:22:11 2008 > New Revision: 185607 > URL: http://svn.freebsd.org/changeset/base/185607 > > Log: > - MFC the nullfs(5) manual page > > Approved by: re@ (blackend) > > Added: > stable/7/share/man/man5/nullfs.5 > - copied unchanged from r183631, head/share/man/man5/nullfs.5 > Modified: > stable/7/share/man/man5/ (props changed) > stable/7/share/man/man5/Makefile > > Modified: stable/7/share/man/man5/Makefile > ============================================================================== > --- stable/7/share/man/man5/Makefile Thu Dec 4 08:17:34 2008 (r185606) > +++ stable/7/share/man/man5/Makefile Thu Dec 4 12:22:11 2008 (r185607) > @@ -46,6 +46,7 @@ MAN= acct.5 \ > networks.5 \ > nsmb.conf.5 \ > nsswitch.conf.5 \ > + nullfs.5 \ > passwd.5 \ > pbm.5 \ > periodic.conf.5 \ > > Copied: stable/7/share/man/man5/nullfs.5 (from r183631, head/share/man/man5/nullfs.5) > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ stable/7/share/man/man5/nullfs.5 Thu Dec 4 12:22:11 2008 (r185607, copy of r183631, head/share/man/man5/nullfs.5) > @@ -0,0 +1,75 @@ > +.\" > +.\" Copyright (c) 2008 Daniel Gerzo > +.\" 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 DOCUMENTATION IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR > +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES > +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. > +.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, > +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT > +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, > +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY > +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT > +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF > +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > +.\" > +.\" $FreeBSD$ > +.\" > +.Dd October 5, 2008 > +.Dt NULLFS 5 > +.Os > +.Sh NAME > +.Nm nullfs > +.Nd "null file system" > +.Sh SYNOPSIS > +To enable support for > +.Nm , > +place the following line in the kernel configuration file: > +.Bd -ragged -offset indent > +.Cd "options NULLFS" > +.Ed > +.Pp > +Alternatively, to load the driver as a > +module at boot time, place the following line in > +.Xr loader.conf 5 : > +.Bd -literal -offset indent > +nullfs_load="YES" > +.Ed > +.Sh DESCRIPTION > +The > +.Nm > +driver will permit the > +.Fx > +kernel to mount a loopback file system sub-tree. > +.Sh EXAMPLES > +To mount a > +.Nm > +file system: > +.Pp > +.Dl "mount_nullfs /usr/ports /home/devel/ports" > +.Sh SEE ALSO > +.Xr fstab 5 , > +.Xr mount_nullfs 8 > +.Sh HISTORY > +The > +.Nm > +layer first appeared in > +.Bx 4.4 . > +.Sh AUTHORS > +.An -nosplit > +The > +.Nm > +kernel implementation was written by > +.An John Heideman . > +.Pp > +This manual page was written by > +.An Daniel Gerzo Aq danger@FreeBSD.org . I think there were objections against HEAD commit. The manpage is mostly content-free, and our usual practice of documenting specific filesystem quirks in mount_(8) served us good enough for long time. What is the reason to have this man page at all ? -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 195 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-stable-7/attachments/20081204/a56be18f/attachment.pgp From kostikbel at gmail.com Thu Dec 4 05:18:34 2008 From: kostikbel at gmail.com (Kostik Belousov) Date: Thu Dec 4 05:18:41 2008 Subject: svn commit: r185607 - stable/7/share/man/man5 In-Reply-To: <1596632487.20081204140149@rulez.sk> References: <200812041222.mB4CMCgC020841@svn.freebsd.org> <20081204123058.GD2038@deviant.kiev.zoral.com.ua> <1596632487.20081204140149@rulez.sk> Message-ID: <20081204131828.GF2038@deviant.kiev.zoral.com.ua> On Thu, Dec 04, 2008 at 02:01:49PM +0100, Daniel Gerzo wrote: > Hello Kostik, > > Thursday, December 4, 2008, 1:30:58 PM, you wrote: > > > On Thu, Dec 04, 2008 at 12:22:12PM +0000, Daniel Gerzo wrote: > >> Author: danger (doc committer) > >> Date: Thu Dec 4 12:22:11 2008 > >> New Revision: 185607 > >> URL: http://svn.freebsd.org/changeset/base/185607 > >> > >> Log: > >> - MFC the nullfs(5) manual page > >> > > > I think there were objections against HEAD commit. The manpage is mostly > > content-free, and our usual practice of documenting specific filesystem > > quirks in mount_(8) served us good enough for long time. > > Could you please point me at the thread which provides more information > about these objections? I don't remember hearing anything and > http://lists.freebsd.org/pipermail/cvs-all/2008-October/thread.html > doesn't contain anything too. Yes, sorry. I am unable to find a trail too. > > > What is the reason to have this man page at all ? > > The main reason is that mount_nullfs(8) doesn't inform about how to > get a nullfs support in the kernel. That is not the right place where Filesystem is either compiled into the kernel, or module is loaded automatically on the first mount attempt. This is a difference against the drivers, that usually need explicit module load or be compiled into the kernel to attach to device. > to document it. Also when I type on a system man nullfs, I would > really like to get some information. As I noted, this is only an > initial version of manual page and I would really like to see it > someone to expand it a bit. > > We are also missing other *fs manual pages that might be worth to add. > This has been actually raised on #bsddocs a while ago and that was the > main reason I have added nullfs(5). > > However if the general consensus here is that nullfs(5) is useless I > don't have problems to back-out my commits... I do not think it is worth a hassle to back out it, but man page ought to contain some useful information. In fact, there is information about nullfs implementation in the mount_nullfs(5) that probably better be updated and moved to nullfs(5), now that we have this page. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 195 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-stable-7/attachments/20081204/3ba690a9/attachment.pgp From danger at FreeBSD.org Thu Dec 4 05:19:19 2008 From: danger at FreeBSD.org (Daniel Gerzo) Date: Thu Dec 4 05:19:36 2008 Subject: svn commit: r185607 - stable/7/share/man/man5 In-Reply-To: <20081204123058.GD2038@deviant.kiev.zoral.com.ua> References: <200812041222.mB4CMCgC020841@svn.freebsd.org> <20081204123058.GD2038@deviant.kiev.zoral.com.ua> Message-ID: <1596632487.20081204140149@rulez.sk> Hello Kostik, Thursday, December 4, 2008, 1:30:58 PM, you wrote: > On Thu, Dec 04, 2008 at 12:22:12PM +0000, Daniel Gerzo wrote: >> Author: danger (doc committer) >> Date: Thu Dec 4 12:22:11 2008 >> New Revision: 185607 >> URL: http://svn.freebsd.org/changeset/base/185607 >> >> Log: >> - MFC the nullfs(5) manual page >> > I think there were objections against HEAD commit. The manpage is mostly > content-free, and our usual practice of documenting specific filesystem > quirks in mount_(8) served us good enough for long time. Could you please point me at the thread which provides more information about these objections? I don't remember hearing anything and http://lists.freebsd.org/pipermail/cvs-all/2008-October/thread.html doesn't contain anything too. > What is the reason to have this man page at all ? The main reason is that mount_nullfs(8) doesn't inform about how to get a nullfs support in the kernel. That is not the right place where to document it. Also when I type on a system man nullfs, I would really like to get some information. As I noted, this is only an initial version of manual page and I would really like to see it someone to expand it a bit. We are also missing other *fs manual pages that might be worth to add. This has been actually raised on #bsddocs a while ago and that was the main reason I have added nullfs(5). However if the general consensus here is that nullfs(5) is useless I don't have problems to back-out my commits... -- Best regards, Daniel mailto:danger@FreeBSD.org From kensmith at FreeBSD.org Thu Dec 4 05:31:39 2008 From: kensmith at FreeBSD.org (Ken Smith) Date: Thu Dec 4 05:31:55 2008 Subject: svn commit: r185609 - in stable/7/sys: . amd64 Message-ID: <200812041331.mB4DVcdT022283@svn.freebsd.org> Author: kensmith Date: Thu Dec 4 13:31:38 2008 New Revision: 185609 URL: http://svn.freebsd.org/changeset/base/185609 Log: MFC r185515: > Adjustments to make a tags file a bit more suitable to amd64. Reviewed by: peter Approved by: re (kib) Modified: stable/7/sys/ (props changed) stable/7/sys/amd64/Makefile Modified: stable/7/sys/amd64/Makefile ============================================================================== --- stable/7/sys/amd64/Makefile Thu Dec 4 12:23:52 2008 (r185608) +++ stable/7/sys/amd64/Makefile Thu Dec 4 13:31:38 2008 (r185609) @@ -1,39 +1,38 @@ # $FreeBSD$ # @(#)Makefile 8.1 (Berkeley) 6/11/93 -# Makefile for i386 links, tags file +# Makefile for amd64 links, tags file # SYS is normally set in Make.tags.inc -# SYS=/sys -SYS=/nsys +SYS=/sys -TAGDIR= i386 +TAGDIR= amd64 .include "../kern/Make.tags.inc" all: @echo "make links or tags only" -# Directories in which to place i386 tags links -DI386= apm i386 ibcs2 include isa linux +# Directories in which to place amd64 tags links +DAMD64= acpica amd64 ia32 include isa linux32 pci links:: -for i in ${COMMDIR1}; do \ (cd $$i && { rm -f tags; ln -s ../${TAGDIR}/tags tags; }) done -for i in ${COMMDIR2}; do \ (cd $$i && { rm -f tags; ln -s ../../${TAGDIR}/tags tags; }) done - -for i in ${DI386}; do \ + -for i in ${DAMD64}; do \ (cd $$i && { rm -f tags; ln -s ../tags tags; }) done -SI386= ${SYS}/i386/apm/*.[ch] \ - ${SYS}/i386/i386/*.[ch] ${SYS}/i386/ibcs2/*.[ch] \ - ${SYS}/i386/include/*.[ch] ${SYS}/i386/isa/*.[ch] \ - ${SYS}/i386/linux/*.[ch] -AI386= ${SYS}/i386/i386/*.s +SAMD64= ${SYS}/amd64/acpica/*.[ch] \ + ${SYS}/amd64/amd64/*.[ch] ${SYS}/amd64/ia32/*.[ch] \ + ${SYS}/amd64/include/*.[ch] ${SYS}/amd64/isa/*.[ch] \ + ${SYS}/amd64/linux32/*.[ch] ${SYS}/amd64/pci/*.[ch] +AAMD64= ${SYS}/amd64/amd64/*.S tags:: - -ctags -wdt ${COMM} ${SI386} - egrep "^ENTRY(.*)|^ALTENTRY(.*)" ${AI386} | \ + -ctags -wdt ${COMM} ${SAMD64} + egrep "^ENTRY(.*)|^ALTENTRY(.*)" ${AAMD64} | \ sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/;" \ >> tags sort -o tags tags From kensmith at FreeBSD.org Thu Dec 4 05:37:18 2008 From: kensmith at FreeBSD.org (Ken Smith) Date: Thu Dec 4 05:37:29 2008 Subject: svn commit: r185611 - in stable/7/sys: . kern Message-ID: <200812041337.mB4DbIF3022514@svn.freebsd.org> Author: kensmith Date: Thu Dec 4 13:37:18 2008 New Revision: 185611 URL: http://svn.freebsd.org/changeset/base/185611 Log: MFC r185517: > Catch up with the disappearance of sys/dev/hfa. Approved by: re (kib) Modified: stable/7/sys/ (props changed) stable/7/sys/kern/Make.tags.inc Modified: stable/7/sys/kern/Make.tags.inc ============================================================================== --- stable/7/sys/kern/Make.tags.inc Thu Dec 4 13:32:25 2008 (r185610) +++ stable/7/sys/kern/Make.tags.inc Thu Dec 4 13:37:18 2008 (r185611) @@ -16,7 +16,6 @@ COMM= ${SYS}/dev/advansys/*.[ch] \ ${SYS}/dev/buslogic/*.[ch] \ ${SYS}/dev/dpt/*.[ch] \ ${SYS}/dev/en/*.[ch] \ - ${SYS}/dev/hfa/*.[ch] \ ${SYS}/dev/iicbus/*.[ch] \ ${SYS}/dev/isp/*.[ch] \ ${SYS}/dev/pdq/*.[ch] \ From danfe at FreeBSD.org Thu Dec 4 05:43:23 2008 From: danfe at FreeBSD.org (Alexey Dokuchaev) Date: Thu Dec 4 05:45:09 2008 Subject: svn commit: r185458 - stable/7/sys/boot/i386/boot0 In-Reply-To: <200811300000.mAU002At065992@svn.freebsd.org> References: <200811300000.mAU002At065992@svn.freebsd.org> Message-ID: <20081204134321.GA22052@FreeBSD.org> On Sun, Nov 30, 2008 at 12:00:02AM +0000, Luigi Rizzo wrote: > Author: luigi > Date: Sun Nov 30 00:00:02 2008 > New Revision: 185458 > URL: http://svn.freebsd.org/changeset/base/185458 > > Log: > MFC: pass the correct value in %si to the next stage boot I vaguely recall I needed to patch our boot loader to be able to host Mac OS X alongside with FreeBSD in the same way (well, I just dropped the puts). ./danfe From delphij at FreeBSD.org Fri Dec 5 13:30:14 2008 From: delphij at FreeBSD.org (Xin LI) Date: Fri Dec 5 13:30:30 2008 Subject: svn commit: r185653 - in stable/7/sys: . dev/bce Message-ID: <200812052130.mB5LUDgZ073753@svn.freebsd.org> Author: delphij Date: Fri Dec 5 21:30:13 2008 New Revision: 185653 URL: http://svn.freebsd.org/changeset/base/185653 Log: MFC r185593: Don't attempt to clear status updates if we did not do a link state change. As a side effect, this makes the excessive interrupts to disappear which has been observed as a regression in recent stable/7. Reported by: many (on -stable@) Reviewed by: davidch Approved by: re (kensmith, kib) Modified: stable/7/sys/ (props changed) stable/7/sys/dev/bce/if_bce.c Modified: stable/7/sys/dev/bce/if_bce.c ============================================================================== --- stable/7/sys/dev/bce/if_bce.c Fri Dec 5 21:19:24 2008 (r185652) +++ stable/7/sys/dev/bce/if_bce.c Fri Dec 5 21:30:13 2008 (r185653) @@ -7030,13 +7030,14 @@ bce_intr(void *xsc) /* Was it a link change interrupt? */ if ((status_attn_bits & STATUS_ATTN_BITS_LINK_STATE) != - (sc->status_block->status_attn_bits_ack & STATUS_ATTN_BITS_LINK_STATE)) + (sc->status_block->status_attn_bits_ack & STATUS_ATTN_BITS_LINK_STATE)) { bce_phy_intr(sc); - /* Clear any transient status updates during link state change. */ - REG_WR(sc, BCE_HC_COMMAND, - sc->hc_command | BCE_HC_COMMAND_COAL_NOW_WO_INT); - REG_RD(sc, BCE_HC_COMMAND); + /* Clear any transient status updates during link state change. */ + REG_WR(sc, BCE_HC_COMMAND, + sc->hc_command | BCE_HC_COMMAND_COAL_NOW_WO_INT); + REG_RD(sc, BCE_HC_COMMAND); + } /* If any other attention is asserted then the chip is toast. */ if (((status_attn_bits & ~STATUS_ATTN_BITS_LINK_STATE) != From delphij at FreeBSD.org Fri Dec 5 14:35:45 2008 From: delphij at FreeBSD.org (Xin LI) Date: Fri Dec 5 14:35:51 2008 Subject: svn commit: r185657 - stable/7/share/man/man4 Message-ID: <200812052235.mB5MZiVm075388@svn.freebsd.org> Author: delphij Date: Fri Dec 5 22:35:44 2008 New Revision: 185657 URL: http://svn.freebsd.org/changeset/base/185657 Log: MFC revisions 183648 and 185574: 183648 (simon): Document that the bce(4) driver works with Dell PowerEdge 1950/2950 NIC's. 185574 (delphij): Update bce(4)'s hardware list to reflect the recent update to driver. Approved by: re (kib) Modified: stable/7/share/man/man4/ (props changed) stable/7/share/man/man4/bce.4 Modified: stable/7/share/man/man4/bce.4 ============================================================================== --- stable/7/share/man/man4/bce.4 Fri Dec 5 22:04:52 2008 (r185656) +++ stable/7/share/man/man4/bce.4 Fri Dec 5 22:35:44 2008 (r185657) @@ -28,12 +28,12 @@ .\" .\" $FreeBSD$ .\" -.Dd June 24, 2007 +.Dd December 2, 2008 .Dt BCE 4 .Os .Sh NAME .Nm bce -.Nd "Broadcom NetXtreme II (BCM5706/BCM5708) PCI/PCIe Gigabit Ethernet adapter driver" +.Nd "Broadcom NetXtreme II (BCM5706/5708/5709/5716) PCI/PCIe Gigabit Ethernet adapter driver" .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your @@ -53,12 +53,13 @@ if_bce_load="YES" The .Nm driver supports Broadcom's NetXtreme II product family, including the -BCM5706 and BCM5708 Ethernet controllers. +BCM5706, BCM5708, BCM5709 and BCM5716 Ethernet controllers. .Pp The NetXtreme II product family is composed of various Converged NIC (or CNIC) Ethernet controllers which support a TCP Offload Engine (TOE), Remote DMA (RDMA), and iSCSI acceleration, in addition to standard L2 Ethernet traffic, all on the same controller. +.Pp The following features are supported in the .Nm driver under @@ -136,6 +137,26 @@ following: .Pp .Bl -bullet -compact .It +Broadcom NetXtreme II BCM5706 1000Base-SX +.It +Broadcom NetXtreme II BCM5706 1000Base-T +.It +Broadcom NetXtreme II BCM5708 1000Base-SX +.It +Broadcom NetXtreme II BCM5708 1000Base-T +.It +Broadcom NetXtreme II BCM5709 1000Base-SX +.It +Broadcom NetXtreme II BCM5709 1000Base-T +.It +Broadcom NetXtreme II BCM5716 1000Base-T +.It +Dell PowerEdge 1950 integrated BCM5708 NIC +.It +Dell PowerEdge 2950 integrated BCM5708 NIC +.It +HP NC370F Multifunction Gigabit Server Adapter +.It HP NC370T Multifunction Gigabit Server Adapter .It HP NC370i Multifunction Gigabit Server Adapter From yongari at FreeBSD.org Fri Dec 5 17:01:18 2008 From: yongari at FreeBSD.org (Pyun YongHyeon) Date: Fri Dec 5 17:01:24 2008 Subject: svn commit: r185659 - in stable/7/sys: . dev/ale Message-ID: <200812060101.mB611HqV078189@svn.freebsd.org> Author: yongari Date: Sat Dec 6 01:01:17 2008 New Revision: 185659 URL: http://svn.freebsd.org/changeset/base/185659 Log: MFC r185576: Add some PHY magic to enable PHY hibernation and 1000baseT/10baseT power adjustment. This change is required to guarantee correct operation on certain switches. MFC r185577: AR8113 also need to set DMA read burst value. This should fix occasional DMA read error seen on AR8113. Approved by: re (kensmith) Modified: stable/7/sys/ (props changed) stable/7/sys/dev/ale/if_ale.c Modified: stable/7/sys/dev/ale/if_ale.c ============================================================================== --- stable/7/sys/dev/ale/if_ale.c Fri Dec 5 22:36:49 2008 (r185658) +++ stable/7/sys/dev/ale/if_ale.c Sat Dec 6 01:01:17 2008 (r185659) @@ -385,6 +385,39 @@ ale_phy_reset(struct ale_softc *sc) GPHY_CTRL_EXT_RESET | GPHY_CTRL_HIB_EN | GPHY_CTRL_HIB_PULSE | GPHY_CTRL_SEL_ANA_RESET | GPHY_CTRL_PHY_PLL_ON); DELAY(1000); + +#define ATPHY_DBG_ADDR 0x1D +#define ATPHY_DBG_DATA 0x1E + + /* Enable hibernation mode. */ + ale_miibus_writereg(sc->ale_dev, sc->ale_phyaddr, + ATPHY_DBG_ADDR, 0x0B); + ale_miibus_writereg(sc->ale_dev, sc->ale_phyaddr, + ATPHY_DBG_DATA, 0xBC00); + /* Set Class A/B for all modes. */ + ale_miibus_writereg(sc->ale_dev, sc->ale_phyaddr, + ATPHY_DBG_ADDR, 0x00); + ale_miibus_writereg(sc->ale_dev, sc->ale_phyaddr, + ATPHY_DBG_DATA, 0x02EF); + /* Enable 10BT power saving. */ + ale_miibus_writereg(sc->ale_dev, sc->ale_phyaddr, + ATPHY_DBG_ADDR, 0x12); + ale_miibus_writereg(sc->ale_dev, sc->ale_phyaddr, + ATPHY_DBG_DATA, 0x4C04); + /* Adjust 1000T power. */ + ale_miibus_writereg(sc->ale_dev, sc->ale_phyaddr, + ATPHY_DBG_ADDR, 0x04); + ale_miibus_writereg(sc->ale_dev, sc->ale_phyaddr, + ATPHY_DBG_ADDR, 0x8BBB); + /* 10BT center tap voltage. */ + ale_miibus_writereg(sc->ale_dev, sc->ale_phyaddr, + ATPHY_DBG_ADDR, 0x05); + ale_miibus_writereg(sc->ale_dev, sc->ale_phyaddr, + ATPHY_DBG_ADDR, 0x2C46); + +#undef ATPHY_DBG_ADDR +#undef ATPHY_DBG_DATA + DELAY(1000); } static int @@ -2753,10 +2786,8 @@ ale_init_locked(struct ale_softc *sc) TX_JUMBO_THRESH_UNIT_SHIFT); } /* Configure TxQ. */ - reg = 0; - if ((sc->ale_flags & ALE_FLAG_JUMBO) != 0) - reg = (128 << (sc->ale_dma_rd_burst >> DMA_CFG_RD_BURST_SHIFT)) - << TXQ_CFG_TX_FIFO_BURST_SHIFT; + reg = (128 << (sc->ale_dma_rd_burst >> DMA_CFG_RD_BURST_SHIFT)) + << TXQ_CFG_TX_FIFO_BURST_SHIFT; reg |= (TXQ_CFG_TPD_BURST_DEFAULT << TXQ_CFG_TPD_BURST_SHIFT) & TXQ_CFG_TPD_BURST_MASK; CSR_WRITE_4(sc, ALE_TXQ_CFG, reg | TXQ_CFG_ENHANCED_MODE | TXQ_CFG_ENB); From keramida at FreeBSD.org Sat Dec 6 05:32:52 2008 From: keramida at FreeBSD.org (Giorgos Keramidas) Date: Sat Dec 6 05:33:09 2008 Subject: svn commit: r185696 - stable/7/usr.bin/xargs Message-ID: <200812061332.mB6DWpm9095256@svn.freebsd.org> Author: keramida (doc committer) Date: Sat Dec 6 13:32:51 2008 New Revision: 185696 URL: http://svn.freebsd.org/changeset/base/185696 Log: MFC: r175680, r175728. Document the no-op -r option of BSD xargs(1). PR: docs/106416 Submitted by: Pete Slagle, freebsd-stable at voidcaptain.com Approved by: re (kib) Modified: stable/7/usr.bin/xargs/ (props changed) stable/7/usr.bin/xargs/xargs.1 Modified: stable/7/usr.bin/xargs/xargs.1 ============================================================================== --- stable/7/usr.bin/xargs/xargs.1 Sat Dec 6 13:23:53 2008 (r185695) +++ stable/7/usr.bin/xargs/xargs.1 Sat Dec 6 13:32:51 2008 (r185696) @@ -37,7 +37,7 @@ .\" $FreeBSD$ .\" $xMach: xargs.1,v 1.2 2002/02/23 05:23:37 tim Exp $ .\" -.Dd December 30, 2005 +.Dd January 26, 2008 .Dt XARGS 1 .Os .Sh NAME @@ -45,7 +45,7 @@ .Nd "construct argument list(s) and execute utility" .Sh SYNOPSIS .Nm -.Op Fl 0opt +.Op Fl 0oprt .Op Fl E Ar eofstr .Oo .Fl I Ar replstr @@ -221,6 +221,34 @@ in the POSIX locale, causes the command to be executed, any other response causes it to be skipped. No commands are executed if the process is not attached to a terminal. +.It Fl r +Compatibility with GNU +.Nm . +The GNU version of +.Nm +runs the +.Ar utility +argument at least once, even if +.Nm +input is empty, and it supports a +.Fl r +option to inhibit this behavior. +The +.Fx +version of +.Nm +does not run the +.Ar utility +argument on empty input, but it supports the +.Fl r +option for command-line compatibility with GNU +.Nm , +but the +.Fl r +option does nothing in the +.Fx +version of +.Nm . .It Fl R Ar replacements Specify the maximum number of arguments that .Fl I From keramida at FreeBSD.org Sat Dec 6 05:38:53 2008 From: keramida at FreeBSD.org (Giorgos Keramidas) Date: Sat Dec 6 05:38:59 2008 Subject: svn commit: r185698 - in stable/7/sys: . boot/forth Message-ID: <200812061338.mB6DcrCY095466@svn.freebsd.org> Author: keramida (doc committer) Date: Sat Dec 6 13:38:53 2008 New Revision: 185698 URL: http://svn.freebsd.org/changeset/base/185698 Log: MFC: r175379, r175380 Document that loader(8) stops reading `loader.conf' when it encounters a syntax error, and add a tip about adding first the `vital' options and then experimental ones. PR: docs/119658 Submitted by: Julian Stacey, jhs at berklix.org Approved by: re (kib) Modified: stable/7/sys/ (props changed) stable/7/sys/boot/forth/loader.conf.5 Modified: stable/7/sys/boot/forth/loader.conf.5 ============================================================================== --- stable/7/sys/boot/forth/loader.conf.5 Sat Dec 6 13:37:15 2008 (r185697) +++ stable/7/sys/boot/forth/loader.conf.5 Sat Dec 6 13:38:53 2008 (r185698) @@ -23,7 +23,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd November 15, 2005 +.Dd January 16, 2008 .Dt LOADER.CONF 5 .Os .Sh NAME @@ -238,6 +238,16 @@ contains the instructions to automatical .Xr boot 8 , .Xr loader 8 , .Xr loader.4th 8 +.Sh BUGS +The +.Xr loader 8 +stops reading +.Nm +when it encounters a syntax error, so any options which are vital for +booting a particular system (i.e.\& +.Dq Va hw.ata.ata_dma Ns "=0" ) +should precede any experimental additions to +.Nm . .Sh HISTORY The file .Nm From keramida at FreeBSD.org Sat Dec 6 05:41:05 2008 From: keramida at FreeBSD.org (Giorgos Keramidas) Date: Sat Dec 6 05:41:16 2008 Subject: svn commit: r185700 - stable/7/usr.sbin/mtree Message-ID: <200812061341.mB6Df4ck095588@svn.freebsd.org> Author: keramida (doc committer) Date: Sat Dec 6 13:41:04 2008 New Revision: 185700 URL: http://svn.freebsd.org/changeset/base/185700 Log: MFC: r173282 Use getcwd() instead of getwd(). The former includes buffer length checks, so it's probably "safer" to use in mtree. Approved by: re (kib) Modified: stable/7/usr.sbin/mtree/ (props changed) stable/7/usr.sbin/mtree/mtree.c Modified: stable/7/usr.sbin/mtree/mtree.c ============================================================================== --- stable/7/usr.sbin/mtree/mtree.c Sat Dec 6 13:40:17 2008 (r185699) +++ stable/7/usr.sbin/mtree/mtree.c Sat Dec 6 13:41:04 2008 (r185700) @@ -164,7 +164,7 @@ main(int argc, char *argv[]) if (dir && chdir(dir)) err(1, "%s", dir); - if ((cflag || sflag) && !getwd(fullpath)) + if ((cflag || sflag) && !getcwd(fullpath, sizeof(fullpath))) errx(1, "%s", fullpath); if (cflag) { From keramida at FreeBSD.org Sat Dec 6 05:45:38 2008 From: keramida at FreeBSD.org (Giorgos Keramidas) Date: Sat Dec 6 05:45:54 2008 Subject: svn commit: r185702 - stable/7/share/man/man5 Message-ID: <200812061345.mB6Djb5H095774@svn.freebsd.org> Author: keramida (doc committer) Date: Sat Dec 6 13:45:37 2008 New Revision: 185702 URL: http://svn.freebsd.org/changeset/base/185702 Log: MFC: r172623, r175681, r176182, r176184, and r185217 * Document quotachecks use of the passno field. * Explain how the passno field in /etc/fstab works with fsck and quotacheck in some more detail. * Explain in more detail how the pass number field works. * Remove information about block devices; we don't have this sort of separation between character and block devices anymore. * Enhance the explanation of using filesystem-specific mount options, and add a mount_msdosfs example. Approved by: re (kib) Modified: stable/7/share/man/man5/ (props changed) stable/7/share/man/man5/fstab.5 Modified: stable/7/share/man/man5/fstab.5 ============================================================================== --- stable/7/share/man/man5/fstab.5 Sat Dec 6 13:44:09 2008 (r185701) +++ stable/7/share/man/man5/fstab.5 Sat Dec 6 13:45:37 2008 (r185702) @@ -32,7 +32,7 @@ .\" @(#)fstab.5 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd June 5, 1993 +.Dd November 23, 2008 .Dt FSTAB 5 .Os .Sh NAME @@ -64,15 +64,8 @@ doing their thing. .Pp The first field, .Pq Fa fs_spec , -describes the block special device or +describes the special device or remote file system to be mounted. -For file systems of type -.Em ufs , -the special file name is the block special file name, -and not the character special file name. -If a program needs the character special file name, -the program must create it by appending a ``r'' after the -last ``/'' in the special file name. .Pp The second field, .Pq Fa fs_file , @@ -98,8 +91,7 @@ describes the mount options associated w It is formatted as a comma separated list of options. It contains at least the type of mount (see .Fa fs_type -below) plus any additional options -appropriate to the file system type. +below) plus any additional options appropriate to the file system type. See the options flag .Pq Fl o in the @@ -107,6 +99,32 @@ in the page and the file system specific page, such as .Xr mount_nfs 8 , for additional options that may be specified. +All options that can be given to the file system specific mount commands +can be used in +.Nm +as well. +They just need to be formatted a bit differently. +The arguments of the +.Fl o +option can be used without the preceding +.Fl o +flag. +Other options need both the file system specific flag and its argument, +separated by an equal sign. +For example, mounting an +.Xr msdosfs 5 +filesystem, the options +.Bd -literal -offset indent +-o sync -o noatime -m 644 -M 755 -u foo -g bar +.Ed +.Pp +should be written as +.Bd -literal -offset indent +sync,noatime,-m=644,-M=755,-u=foo,-g=bar +.Ed +.Pp +in the option field of +.Nm . .Pp If the options ``userquota'' and/or ``groupquota'' are specified, the file system is automatically processed by the @@ -186,20 +204,72 @@ The sixth field, .Pq Fa fs_passno , is used by the .Xr fsck 8 -program to determine the order in which file system checks are done -at reboot time. +and +.Xr quotacheck 8 +programs to determine the order in which file system and quota +checks are done at reboot time. +The +.Fa fs_passno +field can be any value between 0 and +.Ql INT_MAX Ns -1 . +.Pp The root file system should be specified with a .Fa fs_passno of 1, and other file systems should have a .Fa fs_passno -of 2. -File systems within a drive will be checked sequentially, +of 2 or greater. +A file system with a +.Fa fs_passno +value of 1 is always checked sequentially and be completed before +another file system is processed, and it will be processed before +all file systems with a larger +.Fa fs_passno . +.Pp +For any given value of +.Fa fs_passno , +file systems within a drive will be checked sequentially, but file systems on different drives will be checked at the same time to utilize parallelism available in the hardware. +Once all file system checks are complete for the current +.Fa fs_passno , +the same process will start over for the next +.Fa fs_passno . +.Pp If the sixth field is not present or is zero, a value of zero is returned and .Xr fsck 8 +and +.Xr quotacheck 8 will assume that the file system does not need to be checked. +.Pp +The +.Fa fs_passno +field can be used to implement finer control when +the system utilities may determine that the file system resides +on a different physical device, when it actually does not, as with a +.Xr ccd 4 +device. +All file systems with a lower +.Fa fs_passno +value will be completed before starting on file systems with a +higher +.Fa fs_passno +value. +E.g. all file systems with a +.Fa fs_passno +of 2 will be completed before any file systems with a +.Fa fs_passno +of 3 or greater are started. +Gaps are allowed between the different +.Fa fs_passno +values. +E.g. file systems listed in +.Pa /etc/fstab +may have +.Fa fs_passno +values such as 0, 1, 2, 15, 100, 200, 300, and may appear in any order +within +.Pa /etc/fstab . .Bd -literal #define FSTAB_RW "rw" /* read/write device */ #define FSTAB_RQ "rq" /* read/write with quotas */ @@ -237,6 +307,7 @@ resides in .Sh SEE ALSO .Xr getfsent 3 , .Xr getvfsbyname 3 , +.Xr ccd 4 , .Xr dump 8 , .Xr fsck 8 , .Xr mount 8 , From keramida at FreeBSD.org Sat Dec 6 05:48:11 2008 From: keramida at FreeBSD.org (Giorgos Keramidas) Date: Sat Dec 6 05:48:17 2008 Subject: svn commit: r185704 - in stable/7/lib/libc: . gen string Message-ID: <200812061348.mB6DmB5B095900@svn.freebsd.org> Author: keramida (doc committer) Date: Sat Dec 6 13:48:11 2008 New Revision: 185704 URL: http://svn.freebsd.org/changeset/base/185704 Log: MFC: r185519 The times(3) function returns the number of CLK_TCKs since the startup time of FreeBSD, not since the UNIX Epoch. PR: docs/122359 Submitted by: Viktor Štujber Approved by: re (kib) Modified: stable/7/lib/libc/ (props changed) stable/7/lib/libc/gen/times.3 stable/7/lib/libc/string/ffsll.c (props changed) stable/7/lib/libc/string/flsll.c (props changed) Modified: stable/7/lib/libc/gen/times.3 ============================================================================== --- stable/7/lib/libc/gen/times.3 Sat Dec 6 13:47:04 2008 (r185703) +++ stable/7/lib/libc/gen/times.3 Sat Dec 6 13:48:11 2008 (r185704) @@ -28,7 +28,7 @@ .\" @(#)times.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd December 1, 2008 .Dt TIMES 3 .Os .Sh NAME @@ -52,9 +52,13 @@ The .Fn times function returns the value of time in .Dv CLK_TCK Ns 's -of a second since -0 hours, 0 minutes, 0 seconds, January 1, 1970, Coordinated Universal -Time. +of a second since the system startup time. +The current value of +.Dv CLK_TCK , +the frequency of the statistics clock in ticks per second, may be +obtained through the +.Xr sysconf 3 +interface. .Pp It also fills in the structure pointed to by .Fa tp @@ -131,6 +135,7 @@ and .Xr getrusage 2 , .Xr gettimeofday 2 , .Xr wait 2 , +.Xr sysconf 3 , .Xr clocks 7 .Sh STANDARDS The From peter at FreeBSD.org Sat Dec 6 11:54:52 2008 From: peter at FreeBSD.org (Peter Wemm) Date: Sat Dec 6 11:55:06 2008 Subject: svn commit: r185716 - in stable/7: lib/libutil sys sys/contrib/pf sys/kern sys/sys usr.bin/procstat Message-ID: <200812061954.mB6Jso4c003599@svn.freebsd.org> Author: peter Date: Sat Dec 6 19:54:50 2008 New Revision: 185716 URL: http://svn.freebsd.org/changeset/base/185716 Log: MFC: 185548 and followups. Add new KERN_PROC_* handlers with 32/64 bit stable interfaces. Pack records from sysctl to reduce copyout size. Add helper to unpack and provide a more stable interface. Approved by: re (kensmith) Added: stable/7/lib/libutil/kinfo_getfile.c - copied, changed from r185548, head/lib/libutil/kinfo_getfile.c stable/7/lib/libutil/kinfo_getvmmap.c - copied, changed from r185548, head/lib/libutil/kinfo_getvmmap.c Modified: stable/7/lib/libutil/ (props changed) stable/7/lib/libutil/Makefile stable/7/lib/libutil/libutil.h stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/kern/kern_descrip.c stable/7/sys/kern/kern_proc.c stable/7/sys/sys/sysctl.h stable/7/sys/sys/user.h stable/7/usr.bin/procstat/ (props changed) stable/7/usr.bin/procstat/Makefile stable/7/usr.bin/procstat/procstat_files.c stable/7/usr.bin/procstat/procstat_vm.c Modified: stable/7/lib/libutil/Makefile ============================================================================== --- stable/7/lib/libutil/Makefile Sat Dec 6 19:37:52 2008 (r185715) +++ stable/7/lib/libutil/Makefile Sat Dec 6 19:54:50 2008 (r185716) @@ -9,7 +9,8 @@ LIB= util SHLIB_MAJOR= 7 SRCS= _secure_path.c auth.c gr_util.c expand_number.c flopen.c fparseln.c \ - humanize_number.c kld.c login.c login_auth.c login_cap.c login_class.c \ + humanize_number.c kinfo_getfile.c kinfo_getvmmap.c kld.c \ + login.c login_auth.c login_cap.c login_class.c \ login_crypt.c login_ok.c login_times.c login_tty.c logout.c \ logwtmp.c pidfile.c property.c pty.c pw_util.c realhostname.c \ stub.c trimdomain.c uucplock.c Copied and modified: stable/7/lib/libutil/kinfo_getfile.c (from r185548, head/lib/libutil/kinfo_getfile.c) ============================================================================== --- head/lib/libutil/kinfo_getfile.c Tue Dec 2 06:50:26 2008 (r185548, copy source) +++ stable/7/lib/libutil/kinfo_getfile.c Sat Dec 6 19:54:50 2008 (r185716) @@ -42,7 +42,7 @@ kinfo_getfile(pid_t pid, int *cntp) bp = buf; eb = buf + len; while (bp < eb) { - kf = (struct kinfo_file *)bp; + kf = (struct kinfo_file *)(uintptr_t)bp; bp += kf->kf_structsize; cnt++; } @@ -57,7 +57,7 @@ kinfo_getfile(pid_t pid, int *cntp) kp = kif; /* Pass 2: unpack */ while (bp < eb) { - kf = (struct kinfo_file *)bp; + kf = (struct kinfo_file *)(uintptr_t)bp; /* Copy/expand into pre-zeroed buffer */ memcpy(kp, kf, kf->kf_structsize); /* Advance to next packed record */ Copied and modified: stable/7/lib/libutil/kinfo_getvmmap.c (from r185548, head/lib/libutil/kinfo_getvmmap.c) ============================================================================== --- head/lib/libutil/kinfo_getvmmap.c Tue Dec 2 06:50:26 2008 (r185548, copy source) +++ stable/7/lib/libutil/kinfo_getvmmap.c Sat Dec 6 19:54:50 2008 (r185716) @@ -42,7 +42,7 @@ kinfo_getvmmap(pid_t pid, int *cntp) bp = buf; eb = buf + len; while (bp < eb) { - kv = (struct kinfo_vmentry *)bp; + kv = (struct kinfo_vmentry *)(uintptr_t)bp; bp += kv->kve_structsize; cnt++; } @@ -57,7 +57,7 @@ kinfo_getvmmap(pid_t pid, int *cntp) kp = kiv; /* Pass 2: unpack */ while (bp < eb) { - kv = (struct kinfo_vmentry *)bp; + kv = (struct kinfo_vmentry *)(uintptr_t)bp; /* Copy/expand into pre-zeroed buffer */ memcpy(kp, kv, kv->kve_structsize); /* Advance to next packed record */ Modified: stable/7/lib/libutil/libutil.h ============================================================================== --- stable/7/lib/libutil/libutil.h Sat Dec 6 19:37:52 2008 (r185715) +++ stable/7/lib/libutil/libutil.h Sat Dec 6 19:54:50 2008 (r185716) @@ -64,6 +64,8 @@ struct termios; struct winsize; struct utmp; struct in_addr; +struct kinfo_file; +struct kinfo_vmentry; __BEGIN_DECLS void clean_environment(const char * const *_white, @@ -99,6 +101,10 @@ int realhostname_sa(char *host, size_t h int kld_isloaded(const char *name); int kld_load(const char *name); +struct kinfo_file * + kinfo_getfile(pid_t _pid, int *_cntp); +struct kinfo_vmentry * + kinfo_getvmmap(pid_t _pid, int *_cntp); #ifdef _STDIO_H_ /* avoid adding new includes */ char *fparseln(FILE *, size_t *, size_t *, const char[3], int); Modified: stable/7/sys/kern/kern_descrip.c ============================================================================== --- stable/7/sys/kern/kern_descrip.c Sat Dec 6 19:37:52 2008 (r185715) +++ stable/7/sys/kern/kern_descrip.c Sat Dec 6 19:54:50 2008 (r185716) @@ -2570,6 +2570,243 @@ sysctl_kern_file(SYSCTL_HANDLER_ARGS) SYSCTL_PROC(_kern, KERN_FILE, file, CTLTYPE_OPAQUE|CTLFLAG_RD, 0, 0, sysctl_kern_file, "S,xfile", "Entire file table"); +#ifdef KINFO_OFILE_SIZE +CTASSERT(sizeof(struct kinfo_ofile) == KINFO_OFILE_SIZE); +#endif + +/* Compatability with early 7-stable */ +static int +export_vnode_for_osysctl(struct vnode *vp, int type, + struct kinfo_ofile *kif, struct filedesc *fdp, struct sysctl_req *req) +{ + int error; + char *fullpath, *freepath; + int vfslocked; + + bzero(kif, sizeof(*kif)); + kif->kf_structsize = sizeof(*kif); + + vref(vp); + kif->kf_fd = type; + kif->kf_type = KF_TYPE_VNODE; + /* This function only handles directories. */ + KASSERT(vp->v_type == VDIR, ("export_vnode_for_osysctl: vnode not directory")); + kif->kf_vnode_type = KF_VTYPE_VDIR; + + /* + * This is not a true file descriptor, so we set a bogus refcount + * and offset to indicate these fields should be ignored. + */ + kif->kf_ref_count = -1; + kif->kf_offset = -1; + + freepath = NULL; + fullpath = "-"; + FILEDESC_SUNLOCK(fdp); + vfslocked = VFS_LOCK_GIANT(vp->v_mount); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, curthread); + vn_fullpath(curthread, vp, &fullpath, &freepath); + vput(vp); + VFS_UNLOCK_GIANT(vfslocked); + strlcpy(kif->kf_path, fullpath, sizeof(kif->kf_path)); + if (freepath != NULL) + free(freepath, M_TEMP); + error = SYSCTL_OUT(req, kif, sizeof(*kif)); + FILEDESC_SLOCK(fdp); + return (error); +} + +/* + * Get per-process file descriptors for use by procstat(1), et al. + */ +static int +sysctl_kern_proc_ofiledesc(SYSCTL_HANDLER_ARGS) +{ + char *fullpath, *freepath; + struct kinfo_ofile *kif; + struct filedesc *fdp; + int error, i, *name; + struct socket *so; + struct vnode *vp; + struct file *fp; + struct proc *p; + int vfslocked; + + name = (int *)arg1; + if ((p = pfind((pid_t)name[0])) == NULL) + return (ESRCH); + if ((error = p_candebug(curthread, p))) { + PROC_UNLOCK(p); + return (error); + } + fdp = fdhold(p); + PROC_UNLOCK(p); + if (fdp == NULL) + return (ENOENT); + kif = malloc(sizeof(*kif), M_TEMP, M_WAITOK); + FILEDESC_SLOCK(fdp); + if (fdp->fd_cdir != NULL) + export_vnode_for_osysctl(fdp->fd_cdir, KF_FD_TYPE_CWD, kif, + fdp, req); + if (fdp->fd_rdir != NULL) + export_vnode_for_osysctl(fdp->fd_rdir, KF_FD_TYPE_ROOT, kif, + fdp, req); + if (fdp->fd_jdir != NULL) + export_vnode_for_osysctl(fdp->fd_jdir, KF_FD_TYPE_JAIL, kif, + fdp, req); + for (i = 0; i < fdp->fd_nfiles; i++) { + if ((fp = fdp->fd_ofiles[i]) == NULL) + continue; + bzero(kif, sizeof(*kif)); + kif->kf_structsize = sizeof(*kif); + FILE_LOCK(fp); + vp = NULL; + so = NULL; + kif->kf_fd = i; + switch (fp->f_type) { + case DTYPE_VNODE: + kif->kf_type = KF_TYPE_VNODE; + vp = fp->f_vnode; + vref(vp); + break; + + case DTYPE_SOCKET: + kif->kf_type = KF_TYPE_SOCKET; + so = fp->f_data; + break; + + case DTYPE_PIPE: + kif->kf_type = KF_TYPE_PIPE; + break; + + case DTYPE_FIFO: + kif->kf_type = KF_TYPE_FIFO; + vp = fp->f_vnode; + vref(vp); + break; + + case DTYPE_KQUEUE: + kif->kf_type = KF_TYPE_KQUEUE; + break; + + case DTYPE_CRYPTO: + kif->kf_type = KF_TYPE_CRYPTO; + break; + + case DTYPE_MQUEUE: + kif->kf_type = KF_TYPE_MQUEUE; + break; + + default: + kif->kf_type = KF_TYPE_UNKNOWN; + break; + } + kif->kf_ref_count = fp->f_count; + if (fp->f_flag & FREAD) + kif->kf_flags |= KF_FLAG_READ; + if (fp->f_flag & FWRITE) + kif->kf_flags |= KF_FLAG_WRITE; + if (fp->f_flag & FAPPEND) + kif->kf_flags |= KF_FLAG_APPEND; + if (fp->f_flag & FASYNC) + kif->kf_flags |= KF_FLAG_ASYNC; + if (fp->f_flag & FFSYNC) + kif->kf_flags |= KF_FLAG_FSYNC; + if (fp->f_flag & FNONBLOCK) + kif->kf_flags |= KF_FLAG_NONBLOCK; + if (fp->f_flag & O_DIRECT) + kif->kf_flags |= KF_FLAG_DIRECT; + if (fp->f_flag & FHASLOCK) + kif->kf_flags |= KF_FLAG_HASLOCK; + kif->kf_offset = fp->f_offset; + FILE_UNLOCK(fp); + if (vp != NULL) { + switch (vp->v_type) { + case VNON: + kif->kf_vnode_type = KF_VTYPE_VNON; + break; + case VREG: + kif->kf_vnode_type = KF_VTYPE_VREG; + break; + case VDIR: + kif->kf_vnode_type = KF_VTYPE_VDIR; + break; + case VBLK: + kif->kf_vnode_type = KF_VTYPE_VBLK; + break; + case VCHR: + kif->kf_vnode_type = KF_VTYPE_VCHR; + break; + case VLNK: + kif->kf_vnode_type = KF_VTYPE_VLNK; + break; + case VSOCK: + kif->kf_vnode_type = KF_VTYPE_VSOCK; + break; + case VFIFO: + kif->kf_vnode_type = KF_VTYPE_VFIFO; + break; + case VBAD: + kif->kf_vnode_type = KF_VTYPE_VBAD; + break; + default: + kif->kf_vnode_type = KF_VTYPE_UNKNOWN; + break; + } + /* + * It is OK to drop the filedesc lock here as we will + * re-validate and re-evaluate its properties when + * the loop continues. + */ + freepath = NULL; + fullpath = "-"; + FILEDESC_SUNLOCK(fdp); + vfslocked = VFS_LOCK_GIANT(vp->v_mount); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, curthread); + vn_fullpath(curthread, vp, &fullpath, &freepath); + vput(vp); + VFS_UNLOCK_GIANT(vfslocked); + strlcpy(kif->kf_path, fullpath, + sizeof(kif->kf_path)); + if (freepath != NULL) + free(freepath, M_TEMP); + FILEDESC_SLOCK(fdp); + } + if (so != NULL) { + struct sockaddr *sa; + + if (so->so_proto->pr_usrreqs->pru_sockaddr(so, &sa) + == 0 && sa->sa_len <= sizeof(kif->kf_sa_local)) { + bcopy(sa, &kif->kf_sa_local, sa->sa_len); + free(sa, M_SONAME); + } + if (so->so_proto->pr_usrreqs->pru_peeraddr(so, &sa) + == 00 && sa->sa_len <= sizeof(kif->kf_sa_peer)) { + bcopy(sa, &kif->kf_sa_peer, sa->sa_len); + free(sa, M_SONAME); + } + kif->kf_sock_domain = + so->so_proto->pr_domain->dom_family; + kif->kf_sock_type = so->so_type; + kif->kf_sock_protocol = so->so_proto->pr_protocol; + } + error = SYSCTL_OUT(req, kif, sizeof(*kif)); + if (error) + break; + } + FILEDESC_SUNLOCK(fdp); + fddrop(fdp); + free(kif, M_TEMP); + return (0); +} + +static SYSCTL_NODE(_kern_proc, KERN_PROC_OFILEDESC, ofiledesc, CTLFLAG_RD, + sysctl_kern_proc_ofiledesc, "Process ofiledesc entries"); + +#ifdef KINFO_FILE_SIZE +CTASSERT(sizeof(struct kinfo_file) == KINFO_FILE_SIZE); +#endif + static int export_vnode_for_sysctl(struct vnode *vp, int type, struct kinfo_file *kif, struct filedesc *fdp, struct sysctl_req *req) @@ -2579,7 +2816,6 @@ export_vnode_for_sysctl(struct vnode *vp int vfslocked; bzero(kif, sizeof(*kif)); - kif->kf_structsize = sizeof(*kif); vref(vp); kif->kf_fd = type; @@ -2606,7 +2842,11 @@ export_vnode_for_sysctl(struct vnode *vp strlcpy(kif->kf_path, fullpath, sizeof(kif->kf_path)); if (freepath != NULL) free(freepath, M_TEMP); - error = SYSCTL_OUT(req, kif, sizeof(*kif)); + /* Pack record size down */ + kif->kf_structsize = offsetof(struct kinfo_file, kf_path) + + strlen(kif->kf_path) + 1; + kif->kf_structsize = roundup(kif->kf_structsize, sizeof(uint64_t)); + error = SYSCTL_OUT(req, kif, kif->kf_structsize); FILEDESC_SLOCK(fdp); return (error); } @@ -2653,7 +2893,6 @@ sysctl_kern_proc_filedesc(SYSCTL_HANDLER if ((fp = fdp->fd_ofiles[i]) == NULL) continue; bzero(kif, sizeof(*kif)); - kif->kf_structsize = sizeof(*kif); FILE_LOCK(fp); vp = NULL; so = NULL; @@ -2785,7 +3024,12 @@ sysctl_kern_proc_filedesc(SYSCTL_HANDLER kif->kf_sock_type = so->so_type; kif->kf_sock_protocol = so->so_proto->pr_protocol; } - error = SYSCTL_OUT(req, kif, sizeof(*kif)); + /* Pack record size down */ + kif->kf_structsize = offsetof(struct kinfo_file, kf_path) + + strlen(kif->kf_path) + 1; + kif->kf_structsize = roundup(kif->kf_structsize, + sizeof(uint64_t)); + error = SYSCTL_OUT(req, kif, kif->kf_structsize); if (error) break; } Modified: stable/7/sys/kern/kern_proc.c ============================================================================== --- stable/7/sys/kern/kern_proc.c Sat Dec 6 19:37:52 2008 (r185715) +++ stable/7/sys/kern/kern_proc.c Sat Dec 6 19:54:50 2008 (r185716) @@ -32,6 +32,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_compat.h" #include "opt_ddb.h" #include "opt_kdtrace.h" #include "opt_ktrace.h" @@ -1339,13 +1340,18 @@ sysctl_kern_proc_sv_name(SYSCTL_HANDLER_ return (sysctl_handle_string(oidp, sv_name, 0, req)); } +#ifdef KINFO_OVMENTRY_SIZE +CTASSERT(sizeof(struct kinfo_ovmentry) == KINFO_OVMENTRY_SIZE); +#endif + +/* Compatability with early 7-stable */ static int -sysctl_kern_proc_vmmap(SYSCTL_HANDLER_ARGS) +sysctl_kern_proc_ovmmap(SYSCTL_HANDLER_ARGS) { vm_map_entry_t entry, tmp_entry; unsigned int last_timestamp; char *fullpath, *freepath; - struct kinfo_vmentry *kve; + struct kinfo_ovmentry *kve; struct vattr va; struct ucred *cred; int error, *name; @@ -1501,6 +1507,176 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_AR return (error); } +#ifdef KINFO_VMENTRY_SIZE +CTASSERT(sizeof(struct kinfo_vmentry) == KINFO_VMENTRY_SIZE); +#endif + +static int +sysctl_kern_proc_vmmap(SYSCTL_HANDLER_ARGS) +{ + vm_map_entry_t entry, tmp_entry; + unsigned int last_timestamp; + char *fullpath, *freepath; + struct kinfo_vmentry *kve; + struct vattr va; + struct ucred *cred; + int error, *name; + struct vnode *vp; + struct proc *p; + vm_map_t map; + + name = (int *)arg1; + if ((p = pfind((pid_t)name[0])) == NULL) + return (ESRCH); + if (p->p_flag & P_WEXIT) { + PROC_UNLOCK(p); + return (ESRCH); + } + if ((error = p_candebug(curthread, p))) { + PROC_UNLOCK(p); + return (error); + } + _PHOLD(p); + PROC_UNLOCK(p); + + kve = malloc(sizeof(*kve), M_TEMP, M_WAITOK); + + map = &p->p_vmspace->vm_map; /* XXXRW: More locking required? */ + vm_map_lock_read(map); + for (entry = map->header.next; entry != &map->header; + entry = entry->next) { + vm_object_t obj, tobj, lobj; + vm_offset_t addr; + int vfslocked; + + if (entry->eflags & MAP_ENTRY_IS_SUB_MAP) + continue; + + bzero(kve, sizeof(*kve)); + + kve->kve_private_resident = 0; + obj = entry->object.vm_object; + if (obj != NULL) { + VM_OBJECT_LOCK(obj); + if (obj->shadow_count == 1) + kve->kve_private_resident = + obj->resident_page_count; + } + kve->kve_resident = 0; + addr = entry->start; + while (addr < entry->end) { + if (pmap_extract(map->pmap, addr)) + kve->kve_resident++; + addr += PAGE_SIZE; + } + + for (lobj = tobj = obj; tobj; tobj = tobj->backing_object) { + if (tobj != obj) + VM_OBJECT_LOCK(tobj); + if (lobj != obj) + VM_OBJECT_UNLOCK(lobj); + lobj = tobj; + } + + kve->kve_fileid = 0; + kve->kve_fsid = 0; + freepath = NULL; + fullpath = ""; + if (lobj) { + vp = NULL; + switch(lobj->type) { + case OBJT_DEFAULT: + kve->kve_type = KVME_TYPE_DEFAULT; + break; + case OBJT_VNODE: + kve->kve_type = KVME_TYPE_VNODE; + vp = lobj->handle; + vref(vp); + break; + case OBJT_SWAP: + kve->kve_type = KVME_TYPE_SWAP; + break; + case OBJT_DEVICE: + kve->kve_type = KVME_TYPE_DEVICE; + break; + case OBJT_PHYS: + kve->kve_type = KVME_TYPE_PHYS; + break; + case OBJT_DEAD: + kve->kve_type = KVME_TYPE_DEAD; + break; + default: + kve->kve_type = KVME_TYPE_UNKNOWN; + break; + } + if (lobj != obj) + VM_OBJECT_UNLOCK(lobj); + + kve->kve_ref_count = obj->ref_count; + kve->kve_shadow_count = obj->shadow_count; + VM_OBJECT_UNLOCK(obj); + if (vp != NULL) { + vfslocked = VFS_LOCK_GIANT(vp->v_mount); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, + curthread); + vn_fullpath(curthread, vp, &fullpath, + &freepath); + cred = curthread->td_ucred; + if (VOP_GETATTR(vp, &va, cred, curthread) == 0) { + kve->kve_fileid = va.va_fileid; + kve->kve_fsid = va.va_fsid; + } + vput(vp); + VFS_UNLOCK_GIANT(vfslocked); + } + } else { + kve->kve_type = KVME_TYPE_NONE; + kve->kve_ref_count = 0; + kve->kve_shadow_count = 0; + } + + kve->kve_start = entry->start; + kve->kve_end = entry->end; + kve->kve_offset = entry->offset; + + if (entry->protection & VM_PROT_READ) + kve->kve_protection |= KVME_PROT_READ; + if (entry->protection & VM_PROT_WRITE) + kve->kve_protection |= KVME_PROT_WRITE; + if (entry->protection & VM_PROT_EXECUTE) + kve->kve_protection |= KVME_PROT_EXEC; + + if (entry->eflags & MAP_ENTRY_COW) + kve->kve_flags |= KVME_FLAG_COW; + if (entry->eflags & MAP_ENTRY_NEEDS_COPY) + kve->kve_flags |= KVME_FLAG_NEEDS_COPY; + + strlcpy(kve->kve_path, fullpath, sizeof(kve->kve_path)); + if (freepath != NULL) + free(freepath, M_TEMP); + + last_timestamp = map->timestamp; + vm_map_unlock_read(map); + /* Pack record size down */ + kve->kve_structsize = offsetof(struct kinfo_vmentry, kve_path) + + strlen(kve->kve_path) + 1; + kve->kve_structsize = roundup(kve->kve_structsize, + sizeof(uint64_t)); + error = SYSCTL_OUT(req, kve, kve->kve_structsize); + vm_map_lock_read(map); + if (error) + break; + if (last_timestamp + 1 != map->timestamp) { + vm_map_lookup_entry(map, addr - 1, &tmp_entry); + entry = tmp_entry; + } + } + vm_map_unlock_read(map); + PRELE(p); + free(kve, M_TEMP); + return (error); +} + #if defined(STACK) || defined(DDB) static int sysctl_kern_proc_kstack(SYSCTL_HANDLER_ARGS) @@ -1674,6 +1850,9 @@ static SYSCTL_NODE(_kern_proc, (KERN_PRO static SYSCTL_NODE(_kern_proc, (KERN_PROC_PROC | KERN_PROC_INC_THREAD), proc_td, CTLFLAG_RD, sysctl_kern_proc, "Return process table, no threads"); +static SYSCTL_NODE(_kern_proc, KERN_PROC_OVMMAP, ovmmap, CTLFLAG_RD, + sysctl_kern_proc_ovmmap, "Old Process vm map entries"); + static SYSCTL_NODE(_kern_proc, KERN_PROC_VMMAP, vmmap, CTLFLAG_RD, sysctl_kern_proc_vmmap, "Process vm map entries"); Modified: stable/7/sys/sys/sysctl.h ============================================================================== --- stable/7/sys/sys/sysctl.h Sat Dec 6 19:37:52 2008 (r185715) +++ stable/7/sys/sys/sysctl.h Sat Dec 6 19:54:50 2008 (r185716) @@ -463,13 +463,16 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e #define KERN_PROC_RGID 10 /* by real group id */ #define KERN_PROC_GID 11 /* by effective group id */ #define KERN_PROC_PATHNAME 12 /* path to executable */ -#define KERN_PROC_VMMAP 13 /* VM map entries for process */ -#define KERN_PROC_FILEDESC 14 /* File descriptors for process */ +#define KERN_PROC_OVMMAP 13 /* Old VM map entries for process */ +#define KERN_PROC_OFILEDESC 14 /* Old file descriptors for process */ #define KERN_PROC_KSTACK 15 /* Kernel stacks for process */ #define KERN_PROC_INC_THREAD 0x10 /* * modifier for pid, pgrp, tty, * uid, ruid, gid, rgid and proc + * This effectively uses 16-31 */ +#define KERN_PROC_VMMAP 32 /* VM map entries for process */ +#define KERN_PROC_FILEDESC 33 /* File descriptors for process */ /* * KERN_IPC identifiers Modified: stable/7/sys/sys/user.h ============================================================================== --- stable/7/sys/sys/user.h Sat Dec 6 19:37:52 2008 (r185715) +++ stable/7/sys/sys/user.h Sat Dec 6 19:54:50 2008 (r185716) @@ -271,20 +271,55 @@ struct user { #define KF_FLAG_DIRECT 0x00000040 #define KF_FLAG_HASLOCK 0x00000080 -struct kinfo_file { +/* + * Old format. Has variable hidden padding due to alignment. + * This is a compatability hack for pre-build 7.1 packages. + */ +#if defined(__amd64__) +#define KINFO_OFILE_SIZE 1328 +#endif +#if defined(__i386__) +#define KINFO_OFILE_SIZE 1324 +#endif + +struct kinfo_ofile { int kf_structsize; /* Size of kinfo_file. */ int kf_type; /* Descriptor type. */ int kf_fd; /* Array index. */ int kf_ref_count; /* Reference count. */ int kf_flags; /* Flags. */ + /* XXX Hidden alignment padding here on amd64 */ off_t kf_offset; /* Seek location. */ int kf_vnode_type; /* Vnode type. */ int kf_sock_domain; /* Socket domain. */ int kf_sock_type; /* Socket type. */ int kf_sock_protocol; /* Socket protocol. */ - char kf_path[PATH_MAX]; /* Path to file, if any. */ + char kf_path[PATH_MAX]; /* Path to file, if any. */ + struct sockaddr_storage kf_sa_local; /* Socket address. */ + struct sockaddr_storage kf_sa_peer; /* Peer address. */ +}; + +#if defined(__amd64__) || defined(__i386__) +#define KINFO_FILE_SIZE 1392 +#endif + +struct kinfo_file { + int kf_structsize; /* Variable size of record. */ + int kf_type; /* Descriptor type. */ + int kf_fd; /* Array index. */ + int kf_ref_count; /* Reference count. */ + int kf_flags; /* Flags. */ + int _kf_pad0; /* Round to 64 bit alignment */ + int64_t kf_offset; /* Seek location. */ + int kf_vnode_type; /* Vnode type. */ + int kf_sock_domain; /* Socket domain. */ + int kf_sock_type; /* Socket type. */ + int kf_sock_protocol; /* Socket protocol. */ struct sockaddr_storage kf_sa_local; /* Socket address. */ struct sockaddr_storage kf_sa_peer; /* Peer address. */ + int _kf_ispare[16]; /* Space for more stuff. */ + /* Truncated before copyout in sysctl */ + char kf_path[PATH_MAX]; /* Path to file, if any. */ }; /* @@ -307,11 +342,18 @@ struct kinfo_file { #define KVME_FLAG_COW 0x00000001 #define KVME_FLAG_NEEDS_COPY 0x00000002 -struct kinfo_vmentry { +#if defined(__amd64__) +#define KINFO_OVMENTRY_SIZE 1168 +#endif +#if defined(__i386__) +#define KINFO_OVMENTRY_SIZE 1128 +#endif + +struct kinfo_ovmentry { int kve_structsize; /* Size of kinfo_vmmapentry. */ int kve_type; /* Type of map entry. */ - void *kve_start; /* Starting pointer. */ - void *kve_end; /* Finishing pointer. */ + void *kve_start; /* Starting address. */ + void *kve_end; /* Finishing address. */ int kve_flags; /* Flags on map entry. */ int kve_resident; /* Number of resident pages. */ int kve_private_resident; /* Number of private pages. */ @@ -321,11 +363,35 @@ struct kinfo_vmentry { char kve_path[PATH_MAX]; /* Path to VM obj, if any. */ void *_kve_pspare[8]; /* Space for more stuff. */ off_t kve_offset; /* Mapping offset in object */ - uint64_t kve_fileid; /* inode number of vnode */ + uint64_t kve_fileid; /* inode number if vnode */ dev_t kve_fsid; /* dev_t of vnode location */ int _kve_ispare[3]; /* Space for more stuff. */ }; +#if defined(__amd64__) || defined(__i386__) +#define KINFO_VMENTRY_SIZE 1160 +#endif + +struct kinfo_vmentry { + int kve_structsize; /* Variable size of record. */ + int kve_type; /* Type of map entry. */ + uint64_t kve_start; /* Starting address. */ + uint64_t kve_end; /* Finishing address. */ + uint64_t kve_offset; /* Mapping offset in object */ + uint64_t kve_fileid; /* inode number if vnode */ + uint32_t kve_fsid; /* dev_t of vnode location */ + int kve_flags; /* Flags on map entry. */ + int kve_resident; /* Number of resident pages. */ + int kve_private_resident; /* Number of private pages. */ + int kve_protection; /* Protection bitmask. */ + int kve_ref_count; /* VM obj ref count. */ + int kve_shadow_count; /* VM obj shadow count. */ + int _kve_pad0; /* 64bit align next field */ + int _kve_ispare[16]; /* Space for more stuff. */ + /* Truncated before copyout in sysctl */ + char kve_path[PATH_MAX]; /* Path to VM obj, if any. */ +}; + /* * The KERN_PROC_KSTACK sysctl allows a process to dump the kernel stacks of * another process as a series of entries. Each stack is represented by a @@ -337,12 +403,15 @@ struct kinfo_vmentry { #define KKST_STATE_SWAPPED 1 /* Stack swapped out. */ #define KKST_STATE_RUNNING 2 /* Stack ephemeral. */ +#if defined(__amd64__) || defined(__i386__) +#define KINFO_KSTACK_SIZE 1096 +#endif + struct kinfo_kstack { lwpid_t kkst_tid; /* ID of thread. */ int kkst_state; /* Validity of stack. */ char kkst_trace[KKST_MAXLEN]; /* String representing stack. */ - void *_kkst_pspare[8]; /* Space for more stuff. */ - int _kkst_ispare[8]; /* Space for more stuff. */ + int _kkst_ispare[16]; /* Space for more stuff. */ }; #endif Modified: stable/7/usr.bin/procstat/Makefile ============================================================================== --- stable/7/usr.bin/procstat/Makefile Sat Dec 6 19:37:52 2008 (r185715) +++ stable/7/usr.bin/procstat/Makefile Sat Dec 6 19:54:50 2008 (r185716) @@ -12,4 +12,7 @@ SRCS= procstat.c \ procstat_threads.c \ procstat_vm.c +LDADD+= -lutil +DPADD+= ${LIBUTIL} + .include Modified: stable/7/usr.bin/procstat/procstat_files.c ============================================================================== --- stable/7/usr.bin/procstat/procstat_files.c Sat Dec 6 19:37:52 2008 (r185715) +++ stable/7/usr.bin/procstat/procstat_files.c Sat Dec 6 19:54:50 2008 (r185716) @@ -41,6 +41,7 @@ #include #include #include +#include #include "procstat.h" @@ -134,42 +135,18 @@ void procstat_files(pid_t pid, struct kinfo_proc *kipp) { struct kinfo_file *freep, *kif; - int error, name[4]; - unsigned int i; + int i, cnt; const char *str; - size_t len; if (!hflag) printf("%5s %-16s %4s %1s %1s %-8s %3s %7s %-3s %-12s\n", "PID", "COMM", "FD", "T", "V", "FLAGS", "REF", "OFFSET", "PRO", "NAME"); - name[0] = CTL_KERN; - name[1] = KERN_PROC; - name[2] = KERN_PROC_FILEDESC; - name[3] = pid; - - error = sysctl(name, 4, NULL, &len, NULL, 0); - if (error < 0 && errno != ESRCH && errno != EPERM) { - warn("sysctl: kern.proc.filedesc: %d", pid); - return; - } - if (error < 0) - return; - - freep = kif = malloc(len); - if (kif == NULL) - err(-1, "malloc"); - - if (sysctl(name, 4, kif, &len, NULL, 0) < 0) { - warn("sysctl: kern.proc.filedesc %d", pid); - free(freep); - return; - } - - for (i = 0; i < len / sizeof(*kif); i++, kif++) { - if (kif->kf_structsize != sizeof(*kif)) - errx(-1, "kinfo_file mismatch"); + freep = kinfo_getfile(pid, &cnt); + for (i = 0; i < cnt; i++) { + kif = &freep[i]; + printf("%5d ", pid); printf("%-16s ", kipp->ki_comm); switch (kif->kf_fd) { Modified: stable/7/usr.bin/procstat/procstat_vm.c ============================================================================== --- stable/7/usr.bin/procstat/procstat_vm.c Sat Dec 6 19:37:52 2008 (r185715) +++ stable/7/usr.bin/procstat/procstat_vm.c Sat Dec 6 19:54:50 2008 (r185716) @@ -34,6 +34,8 @@ #include #include #include +#include +#include #include "procstat.h" @@ -41,10 +43,9 @@ void procstat_vm(pid_t pid, struct kinfo_proc *kipp __unused) { struct kinfo_vmentry *freep, *kve; - int error, name[4], ptrwidth; - unsigned int i; + int ptrwidth; + int i, cnt; const char *str; - size_t len; ptrwidth = 2*sizeof(void *) + 2; if (!hflag) @@ -52,41 +53,12 @@ procstat_vm(pid_t pid, struct kinfo_proc "PID", ptrwidth, "START", ptrwidth, "END", "PRT", "RES", "PRES", "REF", "SHD", "FL", "TP", "PATH"); - name[0] = CTL_KERN; - name[1] = KERN_PROC; - name[2] = KERN_PROC_VMMAP; - name[3] = pid; - - len = 0; - error = sysctl(name, 4, NULL, &len, NULL, 0); - if (error < 0 && errno != ESRCH && errno != EPERM) { - warn("sysctl: kern.proc.vmmap: %d", pid); - return; - } - if (error < 0) - return; - - /* - * Especially if running procstat -sv, we may need room for more - * mappings when printing than were present when we queried, so pad - * out the allocation a bit. - */ - len += sizeof(*kve) * 3; - freep = kve = malloc(len); - if (kve == NULL) - err(-1, "malloc"); - if (sysctl(name, 4, kve, &len, NULL, 0) < 0) { - warn("sysctl: kern.proc.vmmap: %d", pid); - free(freep); - return; - } - - for (i = 0; i < (len / sizeof(*kve)); i++, kve++) { - if (kve->kve_structsize != sizeof(*kve)) - errx(-1, "kinfo_vmentry structure mismatch"); + freep = kinfo_getvmmap(pid, &cnt); + for (i = 0; i < cnt; i++) { + kve = &freep[i]; printf("%5d ", pid); - printf("%*p ", ptrwidth, kve->kve_start); - printf("%*p ", ptrwidth, kve->kve_end); + printf("%#*jx ", ptrwidth, (uintmax_t)kve->kve_start); + printf("%#*jx ", ptrwidth, (uintmax_t)kve->kve_end); printf("%s", kve->kve_protection & KVME_PROT_READ ? "r" : "-"); printf("%s", kve->kve_protection & KVME_PROT_WRITE ? "w" : "-"); printf("%s ", kve->kve_protection & KVME_PROT_EXEC ? "x" : "-"); From peter at FreeBSD.org Sat Dec 6 15:55:29 2008 From: peter at FreeBSD.org (Peter Wemm) Date: Sat Dec 6 15:55:41 2008 Subject: svn commit: r185725 - in stable/7/lib/libc: . i386/sys string Message-ID: <200812062355.mB6NtTZW008428@svn.freebsd.org> Author: peter Date: Sat Dec 6 23:55:29 2008 New Revision: 185725 URL: http://svn.freebsd.org/changeset/base/185725 Log: MFC: 184996: use the correct syscall names in END() for three asm stubs. Approved by: re (kib) Modified: stable/7/lib/libc/ (props changed) stable/7/lib/libc/i386/sys/pipe.S stable/7/lib/libc/i386/sys/reboot.S stable/7/lib/libc/i386/sys/setlogin.S stable/7/lib/libc/string/ffsll.c (props changed) stable/7/lib/libc/string/flsll.c (props changed) Modified: stable/7/lib/libc/i386/sys/pipe.S ============================================================================== --- stable/7/lib/libc/i386/sys/pipe.S Sat Dec 6 23:26:02 2008 (r185724) +++ stable/7/lib/libc/i386/sys/pipe.S Sat Dec 6 23:55:29 2008 (r185725) @@ -44,4 +44,4 @@ SYSCALL(pipe) movl %edx,4(%ecx) movl $0,%eax ret -END(pipe) +END(__sys_pipe) Modified: stable/7/lib/libc/i386/sys/reboot.S ============================================================================== --- stable/7/lib/libc/i386/sys/reboot.S Sat Dec 6 23:26:02 2008 (r185724) +++ stable/7/lib/libc/i386/sys/reboot.S Sat Dec 6 23:55:29 2008 (r185725) @@ -40,4 +40,4 @@ __FBSDID("$FreeBSD$"); SYSCALL(reboot) iret -END(reboot) +END(__sys_reboot) Modified: stable/7/lib/libc/i386/sys/setlogin.S ============================================================================== --- stable/7/lib/libc/i386/sys/setlogin.S Sat Dec 6 23:26:02 2008 (r185724) +++ stable/7/lib/libc/i386/sys/setlogin.S Sat Dec 6 23:55:29 2008 (r185725) @@ -52,4 +52,4 @@ SYSCALL(setlogin) movl $0,CNAME(_logname_valid) #endif ret /* setlogin(name) */ -END(setlogin) +END(__sys_setlogin) From kientzle at FreeBSD.org Mon Dec 8 09:18:37 2008 From: kientzle at FreeBSD.org (Tim Kientzle) Date: Mon Dec 8 09:18:50 2008 Subject: svn commit: r185770 - stable/7/lib/libarchive Message-ID: <200812081718.mB8HIbwf066044@svn.freebsd.org> Author: kientzle Date: Mon Dec 8 17:18:37 2008 New Revision: 185770 URL: http://svn.freebsd.org/changeset/base/185770 Log: MFC r185667,r185680,r185681: Overhaul the Rockridge option parsing and beef up the ISO9660 bidder. This makes the ISO reader a lot more robust when reading malformed input. Approved by: re Modified: stable/7/lib/libarchive/ (props changed) stable/7/lib/libarchive/archive_read_support_format_iso9660.c stable/7/lib/libarchive/archive_string.c stable/7/lib/libarchive/archive_string.h Modified: stable/7/lib/libarchive/archive_read_support_format_iso9660.c ============================================================================== --- stable/7/lib/libarchive/archive_read_support_format_iso9660.c Mon Dec 8 17:12:40 2008 (r185769) +++ stable/7/lib/libarchive/archive_read_support_format_iso9660.c Mon Dec 8 17:18:37 2008 (r185770) @@ -138,6 +138,15 @@ __FBSDID("$FreeBSD$"); #define PVD_reserved4_size 1 #define PVD_application_data_offset (PVD_reserved4_offset + PVD_reserved4_size) #define PVD_application_data_size 512 +#define PVD_reserved5_offset (PVD_application_data_offset + PVD_application_data_size) +#define PVD_reserved5_size (2048 - PVD_reserved5_offset) + +/* TODO: It would make future maintenance easier to just hardcode the + * above values. In particular, ECMA119 states the offsets as part of + * the standard. That would eliminate the need for the following check.*/ +#if PVD_reserved5_offset != 1395 +#error PVD offset and size definitions are wrong. +#endif /* Structure of an on-disk directory record. */ /* Note: ISO9660 stores each multi-byte integer twice, once in @@ -178,17 +187,20 @@ struct file_info { uint64_t size; /* File size in bytes. */ uint64_t ce_offset; /* Offset of CE */ uint64_t ce_size; /* Size of CE */ + time_t birthtime; /* File created time. */ time_t mtime; /* File last modified time. */ time_t atime; /* File last accessed time. */ - time_t ctime; /* File creation time. */ + time_t ctime; /* File attribute change time. */ uint64_t rdev; /* Device number */ mode_t mode; uid_t uid; gid_t gid; ino_t inode; int nlinks; - char *name; /* Null-terminated filename. */ + struct archive_string name; /* Pathname */ + char name_continues; /* Non-zero if name continues */ struct archive_string symlink; + char symlink_continues; /* Non-zero if link continues */ }; @@ -210,6 +222,7 @@ struct iso9660 { uint64_t current_position; ssize_t logical_block_size; + uint64_t volume_size; /* Total size of volume in bytes. */ off_t entry_sparse_offset; int64_t entry_bytes_remaining; @@ -224,7 +237,9 @@ static int archive_read_format_iso9660_r static int archive_read_format_iso9660_read_header(struct archive_read *, struct archive_entry *); static const char *build_pathname(struct archive_string *, struct file_info *); +#if DEBUG static void dump_isodirrec(FILE *, const unsigned char *isodirrec); +#endif static time_t time_from_tm(struct tm *); static time_t isodate17(const unsigned char *); static time_t isodate7(const unsigned char *); @@ -238,6 +253,12 @@ static struct file_info * static void parse_rockridge(struct iso9660 *iso9660, struct file_info *file, const unsigned char *start, const unsigned char *end); +static void parse_rockridge_NM1(struct file_info *, + const unsigned char *, int); +static void parse_rockridge_SL1(struct file_info *, + const unsigned char *, int); +static void parse_rockridge_TF1(struct file_info *, + const unsigned char *, int); static void release_file(struct iso9660 *, struct file_info *); static unsigned toi(const void *p, int n); @@ -314,13 +335,61 @@ static int isPVD(struct iso9660 *iso9660, const unsigned char *h) { struct file_info *file; + int i; - if (h[0] != 1) + /* Type of the Primary Volume Descriptor must be 1. */ + if (h[PVD_type_offset] != 1) return (0); - if (memcmp(h+1, "CD001", 5) != 0) + + /* ID must be "CD001" */ + if (memcmp(h + PVD_id_offset, "CD001", 5) != 0) + return (0); + + /* PVD version must be 1. */ + if (h[PVD_version_offset] != 1) return (0); + /* Reserved field must be 0. */ + if (h[PVD_reserved1_offset] != 0) + return (0); + + /* Reserved field must be 0. */ + for (i = 0; i < PVD_reserved2_size; ++i) + if (h[PVD_reserved2_offset + i] != 0) + return (0); + + /* Reserved field must be 0. */ + for (i = 0; i < PVD_reserved3_size; ++i) + if (h[PVD_reserved3_offset + i] != 0) + return (0); + + /* Logical block size must be > 0. */ + /* I've looked at Ecma 119 and can't find any stronger + * restriction on this field. */ iso9660->logical_block_size = toi(h + PVD_logical_block_size_offset, 2); + if (iso9660->logical_block_size <= 0) + return (0); + + iso9660->volume_size = iso9660->logical_block_size + * (uint64_t)toi(h + PVD_volume_space_size_offset, 4); + + /* File structure version must be 1 for ISO9660/ECMA119. */ + if (h[PVD_file_structure_version_offset] != 1) + return (0); + + + /* Reserved field must be 0. */ + for (i = 0; i < PVD_reserved4_size; ++i) + if (h[PVD_reserved4_offset + i] != 0) + return (0); + + /* Reserved field must be 0. */ + for (i = 0; i < PVD_reserved5_size; ++i) + if (h[PVD_reserved5_offset + i] != 0) + return (0); + + /* XXX TODO: Check other values for sanity; reject more + * malformed PVDs. XXX */ /* Store the root directory in the pending list. */ file = parse_file_info(iso9660, NULL, h + PVD_root_directory_record_offset); @@ -352,12 +421,22 @@ archive_read_format_iso9660_read_header( iso9660->entry_bytes_remaining = file->size; iso9660->entry_sparse_offset = 0; /* Offset for sparse-file-aware clients. */ + if (file->offset + file->size > iso9660->volume_size) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "File is beyond end-of-media: %s", file->name); + iso9660->entry_bytes_remaining = 0; + iso9660->entry_sparse_offset = 0; + release_file(iso9660, file); + return (ARCHIVE_WARN); + } + /* Set up the entry structure with information about this entry. */ archive_entry_set_mode(entry, file->mode); archive_entry_set_uid(entry, file->uid); archive_entry_set_gid(entry, file->gid); archive_entry_set_nlink(entry, file->nlinks); archive_entry_set_ino(entry, file->inode); + /* archive_entry_set_birthtime(entry, file->birthtime, 0); */ archive_entry_set_mtime(entry, file->mtime, 0); archive_entry_set_ctime(entry, file->ctime, 0); archive_entry_set_atime(entry, file->atime, 0); @@ -535,13 +614,7 @@ parse_file_info(struct iso9660 *iso9660, file->mtime = isodate7(isodirrec + DR_date_offset); file->ctime = file->atime = file->mtime; name_len = (size_t)*(const unsigned char *)(isodirrec + DR_name_len_offset); - file->name = (char *)malloc(name_len + 1); - if (file->name == NULL) { - free(file); - return (NULL); - } - memcpy(file->name, isodirrec + DR_name_offset, name_len); - file->name[name_len] = '\0'; + archive_strncpy(&file->name, isodirrec + DR_name_offset, name_len); flags = *(isodirrec + DR_flags_offset); if (flags & 0x02) file->mode = AE_IFDIR | 0700; @@ -561,6 +634,7 @@ parse_file_info(struct iso9660 *iso9660, parse_rockridge(iso9660, file, rr_start, rr_end); } +#if DEBUG /* DEBUGGING: Warn about attributes I don't yet fully support. */ if ((flags & ~0x02) != 0) { fprintf(stderr, "\n ** Unrecognized flag: "); @@ -583,7 +657,7 @@ parse_file_info(struct iso9660 *iso9660, dump_isodirrec(stderr, isodirrec); fprintf(stderr, "\n"); } - +#endif return (file); } @@ -623,6 +697,7 @@ parse_rockridge(struct iso9660 *iso9660, while (p + 4 < end /* Enough space for another entry. */ && p[0] >= 'A' && p[0] <= 'Z' /* Sanity-check 1st char of name. */ && p[1] >= 'A' && p[1] <= 'Z' /* Sanity-check 2nd char of name. */ + && p[2] >= 4 /* Sanity-check length. */ && p + p[2] <= end) { /* Sanity-check length. */ const unsigned char *data = p + 4; int data_length = p[2] - 4; @@ -635,61 +710,54 @@ parse_rockridge(struct iso9660 *iso9660, */ switch(p[0]) { case 'C': - if (p[0] == 'C' && p[1] == 'E' && version == 1) { - /* - * CE extension comprises: - * 8 byte sector containing extension - * 8 byte offset w/in above sector - * 8 byte length of continuation - */ - file->ce_offset = toi(data, 4) - * iso9660->logical_block_size - + toi(data + 8, 4); - file->ce_size = toi(data + 16, 4); + if (p[0] == 'C' && p[1] == 'E') { + if (version == 1 && data_length == 24) { + /* + * CE extension comprises: + * 8 byte sector containing extension + * 8 byte offset w/in above sector + * 8 byte length of continuation + */ + file->ce_offset = (uint64_t)toi(data, 4) + * iso9660->logical_block_size + + toi(data + 8, 4); + file->ce_size = toi(data + 16, 4); + /* If the result is rediculous, + * ignore it. */ + if (file->ce_offset + file->ce_size + > iso9660->volume_size) { + file->ce_offset = 0; + file->ce_size = 0; + } + } break; } /* FALLTHROUGH */ case 'N': - if (p[0] == 'N' && p[1] == 'M' && version == 1 - && *data == 0) { - /* NM extension with flag byte == 0 */ - /* - * NM extension comprises: - * one byte flag - * rest is long name - */ - /* TODO: Obey flags. */ - char *old_name = file->name; - - data++; /* Skip flag byte. */ - data_length--; - file->name = (char *)malloc(data_length + 1); - if (file->name != NULL) { - free(old_name); - memcpy(file->name, data, data_length); - file->name[data_length] = '\0'; - } else - file->name = old_name; + if (p[0] == 'N' && p[1] == 'M') { + if (version == 1) + parse_rockridge_NM1(file, + data, data_length); break; } /* FALLTHROUGH */ case 'P': - if (p[0] == 'P' && p[1] == 'D' && version == 1) { + if (p[0] == 'P' && p[1] == 'D') { /* * PD extension is padding; * contents are always ignored. */ break; } - if (p[0] == 'P' && p[1] == 'N' && version == 1) { - if (data_length == 16) { + if (p[0] == 'P' && p[1] == 'N') { + if (version == 1 && data_length == 16) { file->rdev = toi(data,4); file->rdev <<= 32; file->rdev |= toi(data + 8, 4); } break; } - if (p[0] == 'P' && p[1] == 'X' && version == 1) { + if (p[0] == 'P' && p[1] == 'X') { /* * PX extension comprises: * 8 bytes for mode, @@ -698,12 +766,22 @@ parse_rockridge(struct iso9660 *iso9660, * 8 bytes for gid, * 8 bytes for inode. */ - if (data_length == 32) { - file->mode = toi(data, 4); - file->nlinks = toi(data + 8, 4); - file->uid = toi(data + 16, 4); - file->gid = toi(data + 24, 4); - file->inode = toi(data + 32, 4); + if (version == 1) { + if (data_length >= 8) + file->mode + = toi(data, 4); + if (data_length >= 16) + file->nlinks + = toi(data + 8, 4); + if (data_length >= 24) + file->uid + = toi(data + 16, 4); + if (data_length >= 32) + file->gid + = toi(data + 24, 4); + if (data_length >= 40) + file->inode + = toi(data + 32, 4); } break; } @@ -720,56 +798,14 @@ parse_rockridge(struct iso9660 *iso9660, } /* FALLTHROUGH */ case 'S': - if (p[0] == 'S' && p[1] == 'L' && version == 1 - && *data == 0) { - int cont = 1; - /* SL extension with flags == 0 */ - /* TODO: handle non-zero flag values. */ - data++; /* Skip flag byte. */ - data_length--; - while (data_length > 0) { - unsigned char flag = *data++; - unsigned char nlen = *data++; - data_length -= 2; - - if (cont == 0) - archive_strcat(&file->symlink, "/"); - cont = 0; - - switch(flag) { - case 0x01: /* Continue */ - archive_strncat(&file->symlink, - (const char *)data, nlen); - cont = 1; - break; - case 0x02: /* Current */ - archive_strcat(&file->symlink, "."); - break; - case 0x04: /* Parent */ - archive_strcat(&file->symlink, ".."); - break; - case 0x08: /* Root */ - case 0x10: /* Volume root */ - archive_string_empty(&file->symlink); - break; - case 0x20: /* Hostname */ - archive_strcat(&file->symlink, "hostname"); - break; - case 0: - archive_strncat(&file->symlink, - (const char *)data, nlen); - break; - default: - /* TODO: issue a warning ? */ - break; - } - data += nlen; - data_length -= nlen; - } + if (p[0] == 'S' && p[1] == 'L') { + if (version == 1) + parse_rockridge_SL1(file, + data, data_length); break; } if (p[0] == 'S' && p[1] == 'P' - && version == 1 && data_length == 7 + && version == 1 && data_length == 3 && data[0] == (unsigned char)'\xbe' && data[1] == (unsigned char)'\xef') { /* @@ -805,66 +841,27 @@ parse_rockridge(struct iso9660 *iso9660, return; } case 'T': - if (p[0] == 'T' && p[1] == 'F' && version == 1) { - char flag = data[0]; - /* - * TF extension comprises: - * one byte flag - * create time (optional) - * modify time (optional) - * access time (optional) - * attribute time (optional) - * Time format and presence of fields - * is controlled by flag bits. - */ - data++; - if (flag & 0x80) { - /* Use 17-byte time format. */ - if (flag & 1) /* Create time. */ - data += 17; - if (flag & 2) { /* Modify time. */ - file->mtime = isodate17(data); - data += 17; - } - if (flag & 4) { /* Access time. */ - file->atime = isodate17(data); - data += 17; - } - if (flag & 8) { /* Attribute time. */ - file->ctime = isodate17(data); - data += 17; - } - } else { - /* Use 7-byte time format. */ - if (flag & 1) /* Create time. */ - data += 7; - if (flag & 2) { /* Modify time. */ - file->mtime = isodate7(data); - data += 7; - } - if (flag & 4) { /* Access time. */ - file->atime = isodate7(data); - data += 7; - } - if (flag & 8) { /* Attribute time. */ - file->ctime = isodate7(data); - data += 7; - } - } + if (p[0] == 'T' && p[1] == 'F') { + if (version == 1) + parse_rockridge_TF1(file, + data, data_length); break; } /* FALLTHROUGH */ default: /* The FALLTHROUGHs above leave us here for * any unsupported extension. */ +#if DEBUG { const unsigned char *t; - fprintf(stderr, "\nUnsupported RRIP extension for %s\n", file->name); + fprintf(stderr, "\nUnsupported RRIP extension for %s\n", file->name.s); fprintf(stderr, " %c%c(%d):", p[0], p[1], data_length); for (t = data; t < data + data_length && t < data + 16; t++) fprintf(stderr, " %02x", *t); fprintf(stderr, "\n"); } +#endif + break; } @@ -874,14 +871,222 @@ parse_rockridge(struct iso9660 *iso9660, } static void +parse_rockridge_NM1(struct file_info *file, const unsigned char *data, + int data_length) +{ + if (!file->name_continues) + archive_string_empty(&file->name); + file->name_continues = 0; + if (data_length < 1) + return; + /* + * NM version 1 extension comprises: + * 1 byte flag, value is one of: + * = 0: remainder is name + * = 1: remainder is name, next NM entry continues name + * = 2: "." + * = 4: ".." + * = 32: Implementation specific + * All other values are reserved. + */ + switch(data[0]) { + case 0: + if (data_length < 2) + return; + archive_strncat(&file->name, data + 1, data_length - 1); + break; + case 1: + if (data_length < 2) + return; + archive_strncat(&file->name, data + 1, data_length - 1); + file->name_continues = 1; + break; + case 2: + archive_strcat(&file->name, "."); + break; + case 4: + archive_strcat(&file->name, ".."); + break; + default: + return; + } + +} + +static void +parse_rockridge_TF1(struct file_info *file, const unsigned char *data, + int data_length) +{ + char flag; + /* + * TF extension comprises: + * one byte flag + * create time (optional) + * modify time (optional) + * access time (optional) + * attribute time (optional) + * Time format and presence of fields + * is controlled by flag bits. + */ + if (data_length < 1) + return; + flag = data[0]; + ++data; + --data_length; + if (flag & 0x80) { + /* Use 17-byte time format. */ + if ((flag & 1) && data_length >= 17) { + /* Create time. */ + file->birthtime = isodate17(data); + data += 17; + data_length -= 17; + } + if ((flag & 2) && data_length >= 17) { + /* Modify time. */ + file->mtime = isodate17(data); + data += 17; + data_length -= 17; + } + if ((flag & 4) && data_length >= 17) { + /* Access time. */ + file->atime = isodate17(data); + data += 17; + data_length -= 17; + } + if ((flag & 8) && data_length >= 17) { + /* Attribute change time. */ + file->ctime = isodate17(data); + data += 17; + data_length -= 17; + } + } else { + /* Use 7-byte time format. */ + if ((flag & 1) && data_length >= 7) { + /* Create time. */ + file->birthtime = isodate17(data); + data += 7; + data_length -= 7; + } + if ((flag & 2) && data_length >= 7) { + /* Modify time. */ + file->mtime = isodate7(data); + data += 7; + data_length -= 7; + } + if ((flag & 4) && data_length >= 7) { + /* Access time. */ + file->atime = isodate7(data); + data += 7; + data_length -= 7; + } + if ((flag & 8) && data_length >= 7) { + /* Attribute change time. */ + file->ctime = isodate7(data); + data += 7; + data_length -= 7; + } + } +} + +static void +parse_rockridge_SL1(struct file_info *file, const unsigned char *data, + int data_length) +{ + int component_continues = 1; + + if (!file->symlink_continues) + archive_string_empty(&file->symlink); + else + archive_strcat(&file->symlink, "/"); + file->symlink_continues = 0; + + /* + * Defined flag values: + * 0: This is the last SL record for this symbolic link + * 1: this symbolic link field continues in next SL entry + * All other values are reserved. + */ + if (data_length < 1) + return; + switch(*data) { + case 0: + break; + case 1: + file->symlink_continues = 1; + break; + default: + return; + } + ++data; /* Skip flag byte. */ + --data_length; + + /* + * SL extension body stores "components". + * Basically, this is a complicated way of storing + * a POSIX path. It also interferes with using + * symlinks for storing non-path data. + * + * Each component is 2 bytes (flag and length) + * possibly followed by name data. + */ + while (data_length >= 2) { + unsigned char flag = *data++; + unsigned char nlen = *data++; + data_length -= 2; + + if (!component_continues) + archive_strcat(&file->symlink, "/"); + component_continues = 0; + + switch(flag) { + case 0: /* Usual case, this is text. */ + if (data_length < nlen) + return; + archive_strncat(&file->symlink, + (const char *)data, nlen); + break; + case 0x01: /* Text continues in next component. */ + if (data_length < nlen) + return; + archive_strncat(&file->symlink, + (const char *)data, nlen); + component_continues = 1; + break; + case 0x02: /* Current dir. */ + archive_strcat(&file->symlink, "."); + break; + case 0x04: /* Parent dir. */ + archive_strcat(&file->symlink, ".."); + break; + case 0x08: /* Root of filesystem. */ + archive_string_empty(&file->symlink); + archive_strcat(&file->symlink, "/"); + break; + case 0x10: /* Undefined (historically "volume root" */ + archive_string_empty(&file->symlink); + archive_strcat(&file->symlink, "ROOT"); + break; + case 0x20: /* Undefined (historically "hostname") */ + archive_strcat(&file->symlink, "hostname"); + break; + default: + /* TODO: issue a warning ? */ + return; + } + data += nlen; + data_length -= nlen; + } +} + + +static void release_file(struct iso9660 *iso9660, struct file_info *file) { struct file_info *parent; if (file->refcount == 0) { parent = file->parent; - if (file->name) - free(file->name); + archive_string_free(&file->name); archive_string_free(&file->symlink); free(file); if (parent != NULL) { @@ -906,7 +1111,9 @@ next_entry_seek(struct archive_read *a, /* CE area precedes actual file data? Ignore it. */ if (file->ce_offset > file->offset) { -fprintf(stderr, " *** Discarding CE data.\n"); +#if DEBUG + fprintf(stderr, " *** Discarding CE data.\n"); +#endif file->ce_offset = 0; file->ce_size = 0; } @@ -1071,17 +1278,18 @@ time_from_tm(struct tm *t) static const char * build_pathname(struct archive_string *as, struct file_info *file) { - if (file->parent != NULL && file->parent->name[0] != '\0') { + if (file->parent != NULL && archive_strlen(&file->parent->name) > 0) { build_pathname(as, file->parent); archive_strcat(as, "/"); } - if (file->name[0] == '\0') + if (archive_strlen(&file->name) == 0) archive_strcat(as, "."); else - archive_strcat(as, file->name); + archive_string_concat(as, &file->name); return (as->s); } +#if DEBUG static void dump_isodirrec(FILE *out, const unsigned char *isodirrec) { @@ -1106,3 +1314,4 @@ dump_isodirrec(FILE *out, const unsigned fprintf(out, " `%.*s'", toi(isodirrec + DR_name_len_offset, DR_name_len_size), isodirrec + DR_name_offset); } +#endif Modified: stable/7/lib/libarchive/archive_string.c ============================================================================== --- stable/7/lib/libarchive/archive_string.c Mon Dec 8 17:12:40 2008 (r185769) +++ stable/7/lib/libarchive/archive_string.c Mon Dec 8 17:18:37 2008 (r185770) @@ -70,6 +70,18 @@ __archive_string_copy(struct archive_str } void +__archive_string_concat(struct archive_string *dest, struct archive_string *src) +{ + if (src->length > 0) { + if (__archive_string_ensure(dest, dest->length + src->length + 1) == NULL) + __archive_errx(1, "Out of memory"); + memcpy(dest->s + dest->length, src->s, src->length); + dest->length += src->length; + dest->s[dest->length] = 0; + } +} + +void __archive_string_free(struct archive_string *as) { as->length = 0; Modified: stable/7/lib/libarchive/archive_string.h ============================================================================== --- stable/7/lib/libarchive/archive_string.h Mon Dec 8 17:12:40 2008 (r185769) +++ stable/7/lib/libarchive/archive_string.h Mon Dec 8 17:18:37 2008 (r185770) @@ -92,6 +92,12 @@ __archive_string_copy(struct archive_str #define archive_string_copy(dest, src) \ __archive_string_copy(dest, src) +/* Concatenate one archive_string to another */ +void +__archive_string_concat(struct archive_string *dest, struct archive_string *src); +#define archive_string_concat(dest, src) \ + __archive_string_concat(dest, src) + /* Ensure that the underlying buffer is at least as large as the request. */ struct archive_string * __archive_string_ensure(struct archive_string *, size_t); From yongari at FreeBSD.org Tue Dec 9 03:01:18 2008 From: yongari at FreeBSD.org (Pyun YongHyeon) Date: Tue Dec 9 03:01:34 2008 Subject: svn commit: r185792 - in stable/7/sys: . contrib/pf dev/re pci Message-ID: <200812091101.mB9B1Htr089077@svn.freebsd.org> Author: yongari Date: Tue Dec 9 11:01:17 2008 New Revision: 185792 URL: http://svn.freebsd.org/changeset/base/185792 Log: MFC r185542: Add 8168D support. Submitted by: Andrew < andrewwtulloch <> gmail DOT com > Approved by: re (kib) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/re/if_re.c stable/7/sys/pci/if_rlreg.h Modified: stable/7/sys/dev/re/if_re.c ============================================================================== --- stable/7/sys/dev/re/if_re.c Tue Dec 9 10:21:38 2008 (r185791) +++ stable/7/sys/dev/re/if_re.c Tue Dec 9 11:01:17 2008 (r185792) @@ -172,7 +172,7 @@ static struct rl_type re_devs[] = { { RT_VENDORID, RT_DEVICEID_8101E, 0, "RealTek 8101E/8102E/8102EL PCIe 10/100baseTX" }, { RT_VENDORID, RT_DEVICEID_8168, 0, - "RealTek 8168/8168B/8168C/8168CP/8111B/8111C/8111CP PCIe " + "RealTek 8168/8168B/8168C/8168CP/8168D/8111B/8111C/8111CP PCIe " "Gigabit Ethernet" }, { RT_VENDORID, RT_DEVICEID_8169, 0, "RealTek 8169/8169S/8169SB(L)/8110S/8110SB(L) Gigabit Ethernet" }, @@ -213,6 +213,7 @@ static struct rl_hwrev re_hwrevs[] = { { RL_HWREV_8168C, RL_8169, "8168C/8111C"}, { RL_HWREV_8168C_SPIN2, RL_8169, "8168C/8111C"}, { RL_HWREV_8168CP, RL_8169, "8168CP/8111CP"}, + { RL_HWREV_8168D, RL_8169, "8168D"}, { 0, 0, NULL } }; @@ -1225,6 +1226,7 @@ re_attach(device_t dev) case RL_HWREV_8168C: case RL_HWREV_8168C_SPIN2: case RL_HWREV_8168CP: + case RL_HWREV_8168D: sc->rl_flags |= RL_FLAG_INVMAR | RL_FLAG_PHYWAKE | RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT; /* Modified: stable/7/sys/pci/if_rlreg.h ============================================================================== --- stable/7/sys/pci/if_rlreg.h Tue Dec 9 10:21:38 2008 (r185791) +++ stable/7/sys/pci/if_rlreg.h Tue Dec 9 11:01:17 2008 (r185792) @@ -157,6 +157,7 @@ #define RL_HWREV_8169_8110SB 0x10000000 #define RL_HWREV_8169_8110SC 0x18000000 #define RL_HWREV_8102EL 0x24800000 +#define RL_HWREV_8168D 0x28000000 #define RL_HWREV_8168_SPIN1 0x30000000 #define RL_HWREV_8100E 0x30800000 #define RL_HWREV_8101E 0x34000000 From kib at FreeBSD.org Tue Dec 9 08:20:59 2008 From: kib at FreeBSD.org (Konstantin Belousov) Date: Tue Dec 9 08:21:05 2008 Subject: svn commit: r185796 - in stable/7/sys: . contrib/pf kern Message-ID: <200812091620.mB9GKwCS095496@svn.freebsd.org> Author: kib Date: Tue Dec 9 16:20:58 2008 New Revision: 185796 URL: http://svn.freebsd.org/changeset/base/185796 Log: MFC r185557: Prevent creation of the duplicated negative namecache entries. Approved by: re (kensmith) Requested by: jhb Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/kern/vfs_cache.c Modified: stable/7/sys/kern/vfs_cache.c ============================================================================== --- stable/7/sys/kern/vfs_cache.c Tue Dec 9 15:49:02 2008 (r185795) +++ stable/7/sys/kern/vfs_cache.c Tue Dec 9 16:20:58 2008 (r185796) @@ -460,7 +460,7 @@ cache_enter(dvp, vp, cnp) struct vnode *vp; struct componentname *cnp; { - struct namecache *ncp; + struct namecache *ncp, *n2; struct nchashhead *ncpp; u_int32_t hash; int hold; @@ -516,8 +516,6 @@ cache_enter(dvp, vp, cnp) * name. */ if (vp) { - struct namecache *n2; - TAILQ_FOREACH(n2, &vp->v_cache_dst, nc_dst) { if (n2->nc_dvp == dvp && n2->nc_nlen == cnp->cn_namelen && @@ -527,7 +525,16 @@ cache_enter(dvp, vp, cnp) return; } } - } + } else { + TAILQ_FOREACH(n2, &ncneg, nc_dst) { + if (n2->nc_nlen == cnp->cn_namelen && + !bcmp(n2->nc_name, cnp->cn_nameptr, n2->nc_nlen)) { + CACHE_UNLOCK(); + cache_free(ncp); + return; + } + } + } numcache++; if (!vp) { From kib at FreeBSD.org Tue Dec 9 08:30:42 2008 From: kib at FreeBSD.org (Konstantin Belousov) Date: Tue Dec 9 08:30:58 2008 Subject: svn commit: r185798 - in stable/7/sys: . contrib/pf ufs/ufs Message-ID: <200812091630.mB9GUf7L095811@svn.freebsd.org> Author: kib Date: Tue Dec 9 16:30:41 2008 New Revision: 185798 URL: http://svn.freebsd.org/changeset/base/185798 Log: MFC r185761: Recheck the DQ_MOD after the dqh lock is relocked. Repeat dqsync() if the dq is dirty. This ensures that up to date dq is written in the quota file and fixes assertion in dqget(). Approved by: re (kensmith) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/ufs/ufs/ufs_quota.c Modified: stable/7/sys/ufs/ufs/ufs_quota.c ============================================================================== --- stable/7/sys/ufs/ufs/ufs_quota.c Tue Dec 9 16:25:46 2008 (r185797) +++ stable/7/sys/ufs/ufs/ufs_quota.c Tue Dec 9 16:30:41 2008 (r185798) @@ -1321,7 +1321,7 @@ dqrele(vp, dq) return; } DQH_UNLOCK(); - +sync: (void) dqsync(vp, dq); DQH_LOCK(); @@ -1330,6 +1330,18 @@ dqrele(vp, dq) DQH_UNLOCK(); return; } + + /* + * The dq may become dirty after it is synced but before it is + * put to the free list. Checking the DQ_MOD there without + * locking dq should be safe since no other references to the + * dq exist. + */ + if ((dq->dq_flags & DQ_MOD) != 0) { + dq->dq_cnt++; + DQH_UNLOCK(); + goto sync; + } TAILQ_INSERT_TAIL(&dqfreelist, dq, dq_freelist); DQH_UNLOCK(); } From gnn at FreeBSD.org Tue Dec 9 11:36:05 2008 From: gnn at FreeBSD.org (George V. Neville-Neil) Date: Tue Dec 9 11:36:20 2008 Subject: svn commit: r185805 - in stable/7/sys/dev/cxgb: . common Message-ID: <200812091936.mB9Ja4ar099659@svn.freebsd.org> Author: gnn Date: Tue Dec 9 19:36:04 2008 New Revision: 185805 URL: http://svn.freebsd.org/changeset/base/185805 Log: MFC of 3 separate commits. Bug fix from Chelsio which addresses the issue of the device resetting when it sees only received packets. In some cases where a device only recieves data it mistakenly thinks that its transmitting side is broken and resets the device. Fix a bug with the ael1006 PHY. The bug shows up as persistent but incomplete packet loss, of between 10-30%. The fix is to put the PHY into and take it out of local loopback mode when resetting the interface. Bug fix to support N310 version of Chelsio cards (board ID 1088). Obtained from: Chelsio Inc. Approved by: re@ Modified: stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/dev/cxgb/common/cxgb_ael1002.c stable/7/sys/dev/cxgb/common/cxgb_t3_hw.c stable/7/sys/dev/cxgb/common/cxgb_xgmac.c stable/7/sys/dev/cxgb/cxgb_main.c Modified: stable/7/sys/dev/cxgb/common/cxgb_ael1002.c ============================================================================== --- stable/7/sys/dev/cxgb/common/cxgb_ael1002.c Tue Dec 9 18:27:04 2008 (r185804) +++ stable/7/sys/dev/cxgb/common/cxgb_ael1002.c Tue Dec 9 19:36:04 2008 (r185805) @@ -209,6 +209,16 @@ static int ael1006_reset(struct cphy *ph t3_write_reg(phy->adapter, A_T3DBG_GPIO_EN, gpio_out); msleep(125); t3_phy_reset(phy, MDIO_DEV_PMA_PMD, wait); + + /* Phy loopback work around for ael1006 */ + /* Soft reset phy by toggling loopback */ + msleep(125); + /* Put phy into local loopback */ + t3_mdio_change_bits(phy, MDIO_DEV_PMA_PMD, MII_BMCR, 0, 1); + msleep(125); + /* Take phy out of local loopback */ + t3_mdio_change_bits(phy, MDIO_DEV_PMA_PMD, MII_BMCR, 1, 0); + return 0; } Modified: stable/7/sys/dev/cxgb/common/cxgb_t3_hw.c ============================================================================== --- stable/7/sys/dev/cxgb/common/cxgb_t3_hw.c Tue Dec 9 18:27:04 2008 (r185804) +++ stable/7/sys/dev/cxgb/common/cxgb_t3_hw.c Tue Dec 9 19:36:04 2008 (r185805) @@ -512,6 +512,12 @@ static struct adapter_info t3_adap_info[ F_GPIO6_OUT_VAL | F_GPIO7_OUT_VAL, { S_GPIO1, S_GPIO2, S_GPIO3, S_GPIO4 }, SUPPORTED_AUI, &mi1_mdio_ops, "Chelsio T304" }, + { 0 }, + { 1, 0, 0, 0, 0, + F_GPIO1_OEN | F_GPIO2_OEN | F_GPIO4_OEN | F_GPIO6_OEN | F_GPIO7_OEN | + F_GPIO10_OEN | F_GPIO1_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL, + { S_GPIO9 }, SUPPORTED_10000baseT_Full | SUPPORTED_AUI, + &mi1_mdio_ext_ops, "Chelsio N310" } }; /* Modified: stable/7/sys/dev/cxgb/common/cxgb_xgmac.c ============================================================================== --- stable/7/sys/dev/cxgb/common/cxgb_xgmac.c Tue Dec 9 18:27:04 2008 (r185804) +++ stable/7/sys/dev/cxgb/common/cxgb_xgmac.c Tue Dec 9 19:36:04 2008 (r185805) @@ -637,20 +637,15 @@ int t3b2_mac_watchdog_task(struct cmac * adapter_t *adap = mac->adapter; struct mac_stats *s = &mac->stats; unsigned int tx_mcnt = (unsigned int)s->tx_frames; - unsigned int rx_mcnt = (unsigned int)s->rx_frames; - unsigned int rx_xcnt; if (mac->multiport) { tx_mcnt = t3_read_reg(adap, A_XGM_STAT_TX_FRAME_LOW); - rx_mcnt = t3_read_reg(adap, A_XGM_STAT_RX_FRAMES_LOW); } else { tx_mcnt = (unsigned int)s->tx_frames; - rx_mcnt = (unsigned int)s->rx_frames; } status = 0; tx_xcnt = 1; /* By default tx_xcnt is making progress*/ tx_tcnt = mac->tx_tcnt; /* If tx_mcnt is progressing ignore tx_tcnt*/ - rx_xcnt = 1; /* By default rx_xcnt is making progress*/ if (tx_mcnt == mac->tx_mcnt && mac->rx_pause == s->rx_pause) { tx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap, A_XGM_TX_SPI4_SOP_EOP_CNT + @@ -661,11 +656,11 @@ int t3b2_mac_watchdog_task(struct cmac * tx_tcnt = (G_TXDROPCNTCH0RCVD(t3_read_reg(adap, A_TP_PIO_DATA))); } else { - goto rxcheck; + goto out; } } else { mac->toggle_cnt = 0; - goto rxcheck; + goto out; } if ((tx_tcnt != mac->tx_tcnt) && (mac->tx_xcnt == 0)) { @@ -678,22 +673,6 @@ int t3b2_mac_watchdog_task(struct cmac * } } else { mac->toggle_cnt = 0; - goto rxcheck; - } - -rxcheck: - if (rx_mcnt != mac->rx_mcnt) { - rx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap, - A_XGM_RX_SPI4_SOP_EOP_CNT + - mac->offset))) + - (s->rx_fifo_ovfl - mac->rx_ocnt); - mac->rx_ocnt = s->rx_fifo_ovfl; - } else - goto out; - - if (mac->rx_mcnt != s->rx_frames && rx_xcnt == 0 && mac->rx_xcnt == 0) { - if (!mac->multiport) - status = 2; goto out; } @@ -701,8 +680,6 @@ out: mac->tx_tcnt = tx_tcnt; mac->tx_xcnt = tx_xcnt; mac->tx_mcnt = s->tx_frames; - mac->rx_xcnt = rx_xcnt; - mac->rx_mcnt = s->rx_frames; mac->rx_pause = s->rx_pause; if (status == 1) { t3_write_reg(adap, A_XGM_TX_CTRL + mac->offset, 0); Modified: stable/7/sys/dev/cxgb/cxgb_main.c ============================================================================== --- stable/7/sys/dev/cxgb/cxgb_main.c Tue Dec 9 18:27:04 2008 (r185804) +++ stable/7/sys/dev/cxgb/cxgb_main.c Tue Dec 9 19:36:04 2008 (r185805) @@ -298,6 +298,7 @@ struct cxgb_ident { {PCI_VENDOR_ID_CHELSIO, 0x0031, 3, "T3B20"}, {PCI_VENDOR_ID_CHELSIO, 0x0032, 1, "T3B02"}, {PCI_VENDOR_ID_CHELSIO, 0x0033, 4, "T3B04"}, + {PCI_VENDOR_ID_CHELSIO, 0x0035, 6, "N310E"}, {0, 0, 0, NULL} }; @@ -486,12 +487,14 @@ cxgb_controller_attach(device_t dev) return (ENXIO); } sc->udbs_rid = PCIR_BAR(2); - if ((sc->udbs_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, - &sc->udbs_rid, RF_ACTIVE)) == NULL) { + sc->udbs_res = NULL; + if (is_offload(sc) && + ((sc->udbs_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, + &sc->udbs_rid, RF_ACTIVE)) == NULL)) { device_printf(dev, "Cannot allocate BAR region 1\n"); error = ENXIO; goto out; - } + } snprintf(sc->lockbuf, ADAPTER_LOCK_NAME_LEN, "cxgb controller lock %d", device_get_unit(dev)); From rwatson at FreeBSD.org Tue Dec 9 16:08:25 2008 From: rwatson at FreeBSD.org (Robert Watson) Date: Tue Dec 9 16:08:31 2008 Subject: svn commit: r185814 - in stable/7/sys: . contrib/pf netinet Message-ID: <200812100008.mBA08PwQ005203@svn.freebsd.org> Author: rwatson Date: Wed Dec 10 00:08:25 2008 New Revision: 185814 URL: http://svn.freebsd.org/changeset/base/185814 Log: Merge r185791 from head to stable/7: Move macros defining flags and shortcuts to nested structure fields in inpcbinfo below the structure definition in order to make inpcbinfo fit on a single printed page; related style tweaks. Approved by: re (kib) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/netinet/in_pcb.h Modified: stable/7/sys/netinet/in_pcb.h ============================================================================== --- stable/7/sys/netinet/in_pcb.h Tue Dec 9 23:57:09 2008 (r185813) +++ stable/7/sys/netinet/in_pcb.h Wed Dec 10 00:08:25 2008 (r185814) @@ -1,6 +1,7 @@ /*- * Copyright (c) 1982, 1986, 1990, 1993 - * The Regents of the University of California. All rights reserved. + * The Regents of the University of California. + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -88,11 +89,11 @@ struct in_endpoints { struct in_addr_4in6 ie46_local; struct in6_addr ie6_local; } ie_dependladdr; +}; #define ie_faddr ie_dependfaddr.ie46_foreign.ia46_addr4 #define ie_laddr ie_dependladdr.ie46_local.ia46_addr4 #define ie6_faddr ie_dependfaddr.ie6_foreign #define ie6_laddr ie_dependladdr.ie6_local -}; /* * XXX The defines for inc_* are hacks and should be changed to direct @@ -152,19 +153,10 @@ struct inpcb { LIST_ENTRY(inpcb) inp_list; /* (i/p) list for all PCBs for proto */ void *inp_ppcb; /* (i) pointer to per-protocol pcb */ struct inpcbinfo *inp_pcbinfo; /* (c) PCB list info */ - struct socket *inp_socket; /* (i) back pointer to socket */ - - u_int32_t inp_flow; /* (i) IPv6 flow information */ + struct socket *inp_socket; /* (i) back pointer to socket */ + u_int32_t inp_flow; /* (i) IPv6 flow information */ int inp_flags; /* (i) generic IP/datagram flags */ - u_char inp_vflag; /* (i) IP version flag (v4/v6) */ -#define INP_IPV4 0x1 -#define INP_IPV6 0x2 -#define INP_IPV6PROTO 0x4 /* opened under IPv6 protocol */ -#define INP_TIMEWAIT 0x8 /* .. probably doesn't go here */ -#define INP_ONESBCAST 0x10 /* send all-ones broadcast */ -#define INP_DROPPED 0x20 /* protocol drop flag */ -#define INP_SOCKREF 0x40 /* strong socket reference */ u_char inp_ip_ttl; /* (i) time to live proto */ u_char inp_ip_p; /* (c) protocol proto */ u_char inp_ip_minttl; /* (i) minimum TTL or drop */ @@ -173,9 +165,9 @@ struct inpcb { struct ucred *inp_cred; /* (c) cache of socket cred */ /* Local and foreign ports, local and foreign addr. */ - struct in_conninfo inp_inc; + struct in_conninfo inp_inc; /* (i/p) list for PCB's local port */ - /* (i/p) list for PCB's local port */ + /* MAC and IPSEC policy information. */ struct label *inp_label; /* (i) MAC label */ struct inpcbpolicy *inp_sp; /* (s) for IPSEC */ @@ -183,15 +175,8 @@ struct inpcb { struct { u_char inp4_ip_tos; /* (i) type of service proto */ struct mbuf *inp4_options; /* (i) IP options */ - struct ip_moptions *inp4_moptions; /* (i) IP multicast options */ + struct ip_moptions *inp4_moptions; /* (i) IP mcast options */ } inp_depend4; -#define inp_fport inp_inc.inc_fport -#define inp_lport inp_inc.inc_lport -#define inp_faddr inp_inc.inc_faddr -#define inp_laddr inp_inc.inc_laddr -#define inp_ip_tos inp_depend4.inp4_ip_tos -#define inp_options inp_depend4.inp4_options -#define inp_moptions inp_depend4.inp4_moptions struct { /* (i) IP options */ struct mbuf *inp6_options; @@ -208,8 +193,16 @@ struct inpcb { LIST_ENTRY(inpcb) inp_portlist; /* (i/p) */ struct inpcbport *inp_phd; /* (i/p) head of this list */ #define inp_zero_size offsetof(struct inpcb, inp_gencnt) - inp_gen_t inp_gencnt; /* (c) generation count of this instance */ + inp_gen_t inp_gencnt; /* (c) generation count */ struct rwlock inp_lock; +}; +#define inp_fport inp_inc.inc_fport +#define inp_lport inp_inc.inc_lport +#define inp_faddr inp_inc.inc_faddr +#define inp_laddr inp_inc.inc_laddr +#define inp_ip_tos inp_depend4.inp4_ip_tos +#define inp_options inp_depend4.inp4_options +#define inp_moptions inp_depend4.inp4_moptions #define in6p_faddr inp_inc.inc6_faddr #define in6p_laddr inp_inc.inc6_laddr @@ -227,7 +220,7 @@ struct inpcb { #define in6p_lport inp_lport /* for KAME src sync over BSD*'s */ #define in6p_fport inp_fport /* for KAME src sync over BSD*'s */ #define in6p_ppcb inp_ppcb /* for KAME src sync over BSD*'s */ -}; + /* * The range of the generation count, as used in this implementation, is 9e19. * We would have to create 300 billion connections per second for this number @@ -409,7 +402,22 @@ void inp_4tuple_get(struct inpcb *inp, #define INP_PCBPORTHASH(lport, mask) \ (ntohs((lport)) & (mask)) -/* flags in inp_flags: */ +/* + * Flags for inp_vflags -- historically version flags only, but now quite a + * bit more due to an overflow of inp_flag, leading to some locking ambiguity + * as some bits are stable from initial allocation, and others may change. + */ +#define INP_IPV4 0x1 +#define INP_IPV6 0x2 +#define INP_IPV6PROTO 0x4 /* opened under IPv6 protocol */ +#define INP_TIMEWAIT 0x8 /* .. probably doesn't go here */ +#define INP_ONESBCAST 0x10 /* send all-ones broadcast */ +#define INP_DROPPED 0x20 /* protocol drop flag */ +#define INP_SOCKREF 0x40 /* strong socket reference */ + +/* + * Flags for inp_flag. + */ #define INP_RECVOPTS 0x01 /* receive incoming IP options */ #define INP_RECVRETOPTS 0x02 /* receive IP options for reply */ #define INP_RECVDSTADDR 0x04 /* receive IP dst address */ From kib at FreeBSD.org Wed Dec 10 09:00:14 2008 From: kib at FreeBSD.org (Konstantin Belousov) Date: Wed Dec 10 09:00:25 2008 Subject: svn commit: r185866 - in stable/7/sys: . contrib/pf dev/cxgb fs/nullfs Message-ID: <200812101700.mBAH0Ehq036977@svn.freebsd.org> Author: kib Date: Wed Dec 10 17:00:14 2008 New Revision: 185866 URL: http://svn.freebsd.org/changeset/base/185866 Log: MFC r185335: In null_lookup(), do the needed cleanup instead of panicing saying the cleanup is needed. Approved by: re (kensmith) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/fs/nullfs/null_vnops.c Modified: stable/7/sys/fs/nullfs/null_vnops.c ============================================================================== --- stable/7/sys/fs/nullfs/null_vnops.c Wed Dec 10 16:20:49 2008 (r185865) +++ stable/7/sys/fs/nullfs/null_vnops.c Wed Dec 10 17:00:14 2008 (r185866) @@ -365,11 +365,10 @@ null_lookup(struct vop_lookup_args *ap) vrele(lvp); } else { error = null_nodeget(dvp->v_mount, lvp, &vp); - if (error) { - /* XXX Cleanup needed... */ - panic("null_nodeget failed"); - } - *ap->a_vpp = vp; + if (error) + vput(lvp); + else + *ap->a_vpp = vp; } } return (error); From kib at FreeBSD.org Wed Dec 10 09:07:14 2008 From: kib at FreeBSD.org (Konstantin Belousov) Date: Wed Dec 10 09:07:20 2008 Subject: svn commit: r185867 - in stable/7/sys: . contrib/pf dev/cxgb ufs/ufs Message-ID: <200812101707.mBAH7Dcf037147@svn.freebsd.org> Author: kib Date: Wed Dec 10 17:07:13 2008 New Revision: 185867 URL: http://svn.freebsd.org/changeset/base/185867 Log: MFC r185739: Improve usefulness of the panic by printing the pointer to the problematic dquot. Approved by: re (kensmith) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/ufs/ufs/ufs_quota.c Modified: stable/7/sys/ufs/ufs/ufs_quota.c ============================================================================== --- stable/7/sys/ufs/ufs/ufs_quota.c Wed Dec 10 17:00:14 2008 (r185866) +++ stable/7/sys/ufs/ufs/ufs_quota.c Wed Dec 10 17:07:13 2008 (r185867) @@ -1207,7 +1207,7 @@ hfound: DQI_LOCK(dq); return (EUSERS); } if (dq->dq_cnt || (dq->dq_flags & DQ_MOD)) - panic("dqget: free dquot isn't"); + panic("dqget: free dquot isn't %p", dq); TAILQ_REMOVE(&dqfreelist, dq, dq_freelist); if (dq->dq_ump != NULL) LIST_REMOVE(dq, dq_hash); From kientzle at FreeBSD.org Wed Dec 10 21:56:48 2008 From: kientzle at FreeBSD.org (Tim Kientzle) Date: Wed Dec 10 21:57:00 2008 Subject: svn commit: r185909 - in stable/7/usr.bin/tar: . test Message-ID: <200812110556.mBB5ulMx055764@svn.freebsd.org> Author: kientzle Date: Thu Dec 11 05:56:47 2008 New Revision: 185909 URL: http://svn.freebsd.org/changeset/base/185909 Log: MFC r183009, r184807, r184808: Fix --strip-components, plus a handful of test suite improvements. PR: bin/128562 Submitted by: Jaakko Heinonen Approved by: re Added: stable/7/usr.bin/tar/test/test_strip_components.c - copied, changed from r184807, head/usr.bin/tar/test/test_strip_components.c stable/7/usr.bin/tar/test/test_symlink_dir.c - copied unchanged from r183009, head/usr.bin/tar/test/test_symlink_dir.c Modified: stable/7/usr.bin/tar/ (props changed) stable/7/usr.bin/tar/test/Makefile stable/7/usr.bin/tar/util.c Modified: stable/7/usr.bin/tar/test/Makefile ============================================================================== --- stable/7/usr.bin/tar/test/Makefile Thu Dec 11 05:56:25 2008 (r185908) +++ stable/7/usr.bin/tar/test/Makefile Thu Dec 11 05:56:47 2008 (r185909) @@ -18,6 +18,8 @@ TESTS= \ test_option_q.c \ test_patterns.c \ test_stdio.c \ + test_strip_components.c \ + test_symlink_dir.c \ test_version.c # Build the test program Copied and modified: stable/7/usr.bin/tar/test/test_strip_components.c (from r184807, head/usr.bin/tar/test/test_strip_components.c) ============================================================================== --- head/usr.bin/tar/test/test_strip_components.c Mon Nov 10 05:04:55 2008 (r184807, copy source) +++ stable/7/usr.bin/tar/test/test_strip_components.c Thu Dec 11 05:56:47 2008 (r185909) @@ -63,15 +63,44 @@ DEFINE_TEST(test_strip_components) assertEqualInt(-1, lstat("target/d0", &st)); failure("d0/d1/ is too short and should not get restored"); assertEqualInt(-1, lstat("target/d1", &st)); - failure("d0/l1 is too short and should not get restored"); - assertEqualInt(-1, lstat("target/l1", &st)); - failure("d0/d1/l2 is a hardlink to file whose name was too short"); - assertEqualInt(-1, lstat("target/l2", &st)); - assertEqualInt(0, lstat("target/s2", &st)); failure("d0/d1/s2 is a symlink to something that won't be extracted"); assertEqualInt(-1, stat("target/s2", &st)); + assertEqualInt(0, lstat("target/s2", &st)); failure("d0/d1/d2 should be extracted"); assertEqualInt(0, lstat("target/d2", &st)); + + /* + * This next is a complicated case. d0/l1, d0/d1/l2, and + * d0/d1/d2/f1 are all hardlinks to the same file; d0/l1 can't + * be extracted with --strip-components=2 and the other two + * can. Remember that tar normally stores the first file with + * a body and the other as hardlink entries to the first + * appearance. So the final result depends on the order in + * which these three names get archived. If d0/l1 is first, + * none of the three can be restored. If either of the longer + * names are first, then the two longer ones can both be + * restored. + * + * The tree-walking code used by bsdtar always visits files + * before subdirectories, so bsdtar's behavior is fortunately + * deterministic: d0/l1 will always get stored first and the + * other two will be stored as hardlinks to d0/l1. Since + * d0/l1 can't be extracted, none of these three will be + * extracted. + * + * It may be worth extending this test to force a particular + * archiving order so as to exercise both of the cases described + * above. + * + * Of course, this is all totally different for cpio and newc + * formats because the hardlink management is different. + * TODO: Rename this to test_strip_components_tar and create + * parallel tests for cpio and newc formats. + */ + failure("d0/l1 is too short and should not get restored"); + assertEqualInt(-1, lstat("target/l1", &st)); + failure("d0/d1/l2 is a hardlink to file whose name was too short"); + assertEqualInt(-1, lstat("target/l2", &st)); failure("d0/d1/d2/f1 is a hardlink to file whose name was too short"); assertEqualInt(-1, lstat("target/d2/f1", &st)); } Copied: stable/7/usr.bin/tar/test/test_symlink_dir.c (from r183009, head/usr.bin/tar/test/test_symlink_dir.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/usr.bin/tar/test/test_symlink_dir.c Thu Dec 11 05:56:47 2008 (r185909, copy of r183009, head/usr.bin/tar/test/test_symlink_dir.c) @@ -0,0 +1,172 @@ +/*- + * Copyright (c) 2003-2007 Tim Kientzle + * 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(S) ``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(S) 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 "test.h" +__FBSDID("$FreeBSD$"); + +/* + * tar -x -P should follow existing symlinks for dirs, but not other + * content. Plain tar -x should remove symlinks when they're in the + * way of a dir extraction. + */ + +static int +mkfile(const char *name, int mode, const char *contents, ssize_t size) +{ + int fd = open(name, O_CREAT | O_WRONLY, mode); + if (fd < 0) + return (-1); + if (size != write(fd, contents, size)) { + close(fd); + return (-1); + } + close(fd); + return (0); +} + +DEFINE_TEST(test_symlink_dir) +{ + struct stat st, st2; + int oldumask; + + oldumask = umask(0); + + assertEqualInt(0, mkdir("source", 0755)); + assertEqualInt(0, mkfile("source/file", 0755, "a", 1)); + assertEqualInt(0, mkfile("source/file2", 0755, "ab", 2)); + assertEqualInt(0, mkdir("source/dir", 0755)); + assertEqualInt(0, mkdir("source/dir/d", 0755)); + assertEqualInt(0, mkfile("source/dir/f", 0755, "abc", 3)); + assertEqualInt(0, mkdir("source/dir2", 0755)); + assertEqualInt(0, mkdir("source/dir2/d2", 0755)); + assertEqualInt(0, mkfile("source/dir2/f2", 0755, "abcd", 4)); + assertEqualInt(0, mkdir("source/dir3", 0755)); + assertEqualInt(0, mkdir("source/dir3/d3", 0755)); + assertEqualInt(0, mkfile("source/dir3/f3", 0755, "abcde", 5)); + + assertEqualInt(0, + systemf("%s -cf test.tar -C source dir dir2 dir3 file file2", + testprog)); + + /* + * Extract with -x and without -P. + */ + assertEqualInt(0, mkdir("dest1", 0755)); + /* "dir" is a symlink to an existing "real_dir" */ + assertEqualInt(0, mkdir("dest1/real_dir", 0755)); + assertEqualInt(0, symlink("real_dir", "dest1/dir")); + /* "dir2" is a symlink to a non-existing "real_dir2" */ + assertEqualInt(0, symlink("real_dir2", "dest1/dir2")); + /* "dir3" is a symlink to an existing "non_dir3" */ + assertEqualInt(0, mkfile("dest1/non_dir3", 0755, "abcdef", 6)); + assertEqualInt(0, symlink("non_dir3", "dest1/dir3")); + /* "file" is a symlink to existing "real_file" */ + assertEqualInt(0, mkfile("dest1/real_file", 0755, "abcdefg", 7)); + assertEqualInt(0, symlink("real_file", "dest1/file")); + /* "file2" is a symlink to non-existing "real_file2" */ + assertEqualInt(0, symlink("real_file2", "dest1/file2")); + + assertEqualInt(0, systemf("%s -xf test.tar -C dest1", testprog)); + + /* dest1/dir symlink should be removed */ + assertEqualInt(0, lstat("dest1/dir", &st)); + failure("symlink to dir was followed when it shouldn't be"); + assert(S_ISDIR(st.st_mode)); + /* dest1/dir2 symlink should be removed */ + assertEqualInt(0, lstat("dest1/dir2", &st)); + failure("Broken symlink wasn't replaced with dir"); + assert(S_ISDIR(st.st_mode)); + /* dest1/dir3 symlink should be removed */ + assertEqualInt(0, lstat("dest1/dir3", &st)); + failure("Symlink to non-dir wasn't replaced with dir"); + assert(S_ISDIR(st.st_mode)); + /* dest1/file symlink should be removed */ + assertEqualInt(0, lstat("dest1/file", &st)); + failure("Symlink to existing file should be removed"); + assert(S_ISREG(st.st_mode)); + /* dest1/file2 symlink should be removed */ + assertEqualInt(0, lstat("dest1/file2", &st)); + failure("Symlink to non-existing file should be removed"); + assert(S_ISREG(st.st_mode)); + + /* + * Extract with both -x and -P + */ + assertEqualInt(0, mkdir("dest2", 0755)); + /* "dir" is a symlink to existing "real_dir" */ + assertEqualInt(0, mkdir("dest2/real_dir", 0755)); + assertEqualInt(0, symlink("real_dir", "dest2/dir")); + /* "dir2" is a symlink to a non-existing "real_dir2" */ + assertEqualInt(0, symlink("real_dir2", "dest2/dir2")); + /* "dir3" is a symlink to an existing "non_dir3" */ + assertEqualInt(0, mkfile("dest2/non_dir3", 0755, "abcdefgh", 8)); + assertEqualInt(0, symlink("non_dir3", "dest2/dir3")); + /* "file" is a symlink to existing "real_file" */ + assertEqualInt(0, mkfile("dest2/real_file", 0755, "abcdefghi", 9)); + assertEqualInt(0, symlink("real_file", "dest2/file")); + /* "file2" is a symlink to non-existing "real_file2" */ + assertEqualInt(0, symlink("real_file2", "dest2/file2")); + + assertEqualInt(0, systemf("%s -xPf test.tar -C dest2", testprog)); + + /* dest2/dir symlink should be followed */ + assertEqualInt(0, lstat("dest2/dir", &st)); + failure("tar -xP removed symlink instead of following it"); + if (assert(S_ISLNK(st.st_mode))) { + /* Only verify what the symlink points to if it + * really is a symlink. */ + failure("The symlink should point to a directory"); + assertEqualInt(0, stat("dest2/dir", &st)); + assert(S_ISDIR(st.st_mode)); + failure("The pre-existing directory should still be there"); + assertEqualInt(0, lstat("dest2/real_dir", &st2)); + assert(S_ISDIR(st2.st_mode)); + assertEqualInt(st.st_dev, st2.st_dev); + failure("symlink should still point to the existing directory"); + assertEqualInt(st.st_ino, st2.st_ino); + } + /* Contents of 'dir' should be restored */ + assertEqualInt(0, lstat("dest2/dir/d", &st)); + assert(S_ISDIR(st.st_mode)); + assertEqualInt(0, lstat("dest2/dir/f", &st)); + assert(S_ISREG(st.st_mode)); + assertEqualInt(3, st.st_size); + /* dest2/dir2 symlink should be removed */ + assertEqualInt(0, lstat("dest2/dir2", &st)); + failure("Broken symlink wasn't replaced with dir"); + assert(S_ISDIR(st.st_mode)); + /* dest2/dir3 symlink should be removed */ + assertEqualInt(0, lstat("dest2/dir3", &st)); + failure("Symlink to non-dir wasn't replaced with dir"); + assert(S_ISDIR(st.st_mode)); + /* dest2/file symlink should be removed; + * even -P shouldn't follow symlinks for files */ + assertEqualInt(0, lstat("dest2/file", &st)); + failure("Symlink to existing file should be removed"); + assert(S_ISREG(st.st_mode)); + /* dest2/file2 symlink should be removed */ + assertEqualInt(0, lstat("dest2/file2", &st)); + failure("Symlink to non-existing file should be removed"); + assert(S_ISREG(st.st_mode)); +} Modified: stable/7/usr.bin/tar/util.c ============================================================================== --- stable/7/usr.bin/tar/util.c Thu Dec 11 05:56:25 2008 (r185908) +++ stable/7/usr.bin/tar/util.c Thu Dec 11 05:56:47 2008 (r185909) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); static void bsdtar_vwarnc(struct bsdtar *, int code, const char *fmt, va_list ap); +static const char *strip_components(const char *path, int elements); /* * Print a string, taking care with any non-printable characters. @@ -346,6 +347,31 @@ do_chdir(struct bsdtar *bsdtar) bsdtar->pending_chdir = NULL; } +const char * +strip_components(const char *path, int elements) +{ + const char *p = path; + + while (elements > 0) { + switch (*p++) { + case '/': + elements--; + path = p; + break; + case '\0': + /* Path is too short, skip it. */ + return (NULL); + } + } + + while (*path == '/') + ++path; + if (*path == '\0') + return (NULL); + + return (path); +} + /* * Handle --strip-components and any future path-rewriting options. * Returns non-zero if the pathname should not be extracted. @@ -402,24 +428,20 @@ edit_pathname(struct bsdtar *bsdtar, str #endif /* Strip leading dir names as per --strip-components option. */ - if ((r = bsdtar->strip_components) > 0) { - const char *p = name; + if (bsdtar->strip_components > 0) { + const char *linkname = archive_entry_hardlink(entry); + + name = strip_components(name, bsdtar->strip_components); + if (name == NULL) + return (1); - while (r > 0) { - switch (*p++) { - case '/': - r--; - name = p; - break; - case '\0': - /* Path is too short, skip it. */ + if (linkname != NULL) { + linkname = strip_components(linkname, + bsdtar->strip_components); + if (linkname == NULL) return (1); - } + archive_entry_copy_hardlink(entry, linkname); } - while (*name == '/') - ++name; - if (*name == '\0') - return (1); } /* Strip redundant leading '/' characters. */ From rwatson at FreeBSD.org Thu Dec 11 04:44:29 2008 From: rwatson at FreeBSD.org (Robert Watson) Date: Thu Dec 11 04:44:41 2008 Subject: svn commit: r185929 - in stable/7/sys: . contrib/pf dev/cxgb netinet Message-ID: <200812111244.mBBCiSlj065462@svn.freebsd.org> Author: rwatson Date: Thu Dec 11 12:44:28 2008 New Revision: 185929 URL: http://svn.freebsd.org/changeset/base/185929 Log: Merge r185813 from head to stable/7: Update comment on INP_TIMEWAIT to say what it's about, as we caution regarding the misplacement of flags in inp_vflag in an earlier comment. Approved by: re (gnn) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/netinet/in_pcb.h Modified: stable/7/sys/netinet/in_pcb.h ============================================================================== --- stable/7/sys/netinet/in_pcb.h Thu Dec 11 10:29:35 2008 (r185928) +++ stable/7/sys/netinet/in_pcb.h Thu Dec 11 12:44:28 2008 (r185929) @@ -410,7 +410,7 @@ void inp_4tuple_get(struct inpcb *inp, #define INP_IPV4 0x1 #define INP_IPV6 0x2 #define INP_IPV6PROTO 0x4 /* opened under IPv6 protocol */ -#define INP_TIMEWAIT 0x8 /* .. probably doesn't go here */ +#define INP_TIMEWAIT 0x8 /* inpcb in TIMEWAIT, ppcb is tcptw */ #define INP_ONESBCAST 0x10 /* send all-ones broadcast */ #define INP_DROPPED 0x20 /* protocol drop flag */ #define INP_SOCKREF 0x40 /* strong socket reference */ From rwatson at FreeBSD.org Thu Dec 11 05:30:30 2008 From: rwatson at FreeBSD.org (Robert Watson) Date: Thu Dec 11 05:30:47 2008 Subject: svn commit: r185930 - in stable/7/sys: . contrib/pf dev/cxgb netinet Message-ID: <200812111330.mBBDUUGe066321@svn.freebsd.org> Author: rwatson Date: Thu Dec 11 13:30:29 2008 New Revision: 185930 URL: http://svn.freebsd.org/changeset/base/185930 Log: Merge r185855 from head to stable/7: Move flag definitions for t_flags and t_oobflags below the definition of struct tcpcb so that the structure definition is a bit more vertically compact. Can't yet fit it on one printed page, though. Approved by: re (gnn) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/netinet/tcp_var.h Modified: stable/7/sys/netinet/tcp_var.h ============================================================================== --- stable/7/sys/netinet/tcp_var.h Thu Dec 11 12:44:28 2008 (r185929) +++ stable/7/sys/netinet/tcp_var.h Thu Dec 11 13:30:29 2008 (r185930) @@ -101,29 +101,6 @@ struct tcpcb { struct inpcb *t_inpcb; /* back pointer to internet pcb */ int t_state; /* state of this connection */ u_int t_flags; -#define TF_ACKNOW 0x000001 /* ack peer immediately */ -#define TF_DELACK 0x000002 /* ack, but try to delay it */ -#define TF_NODELAY 0x000004 /* don't delay packets to coalesce */ -#define TF_NOOPT 0x000008 /* don't use tcp options */ -#define TF_SENTFIN 0x000010 /* have sent FIN */ -#define TF_REQ_SCALE 0x000020 /* have/will request window scaling */ -#define TF_RCVD_SCALE 0x000040 /* other side has requested scaling */ -#define TF_REQ_TSTMP 0x000080 /* have/will request timestamps */ -#define TF_RCVD_TSTMP 0x000100 /* a timestamp was received in SYN */ -#define TF_SACK_PERMIT 0x000200 /* other side said I could SACK */ -#define TF_NEEDSYN 0x000400 /* send SYN (implicit state) */ -#define TF_NEEDFIN 0x000800 /* send FIN (implicit state) */ -#define TF_NOPUSH 0x001000 /* don't push */ -#define TF_MORETOCOME 0x010000 /* More data to be appended to sock */ -#define TF_LQ_OVERFLOW 0x020000 /* listen queue overflow */ -#define TF_LASTIDLE 0x040000 /* connection was previously idle */ -#define TF_RXWIN0SENT 0x080000 /* sent a receiver win 0 in response */ -#define TF_FASTRECOVERY 0x100000 /* in NewReno Fast Recovery */ -#define TF_WASFRECOVERY 0x200000 /* was in NewReno Fast Recovery */ -#define TF_SIGNATURE 0x400000 /* require MD5 digests (RFC2385) */ -#define TF_FORCEDATA 0x800000 /* force out a byte */ -#define TF_TSO 0x1000000 /* TSO enabled on this connection */ -#define TF_TOE 0x2000000 /* this connection is offloaded */ tcp_seq snd_una; /* send unacknowledged */ tcp_seq snd_max; /* highest sequence number sent; @@ -177,8 +154,6 @@ struct tcpcb { /* out-of-band data */ char t_oobflags; /* have some */ char t_iobc; /* input character */ -#define TCPOOB_HAVEDATA 0x01 -#define TCPOOB_HADDATA 0x02 /* RFC 1323 variables */ u_char snd_scale; /* window scaling for send window */ u_char rcv_scale; /* window scaling for recv window */ @@ -212,10 +187,43 @@ struct tcpcb { void *t_toe; /* TOE pcb pointer */ }; +/* + * Flags and utility macros for the t_flags field. + */ +#define TF_ACKNOW 0x000001 /* ack peer immediately */ +#define TF_DELACK 0x000002 /* ack, but try to delay it */ +#define TF_NODELAY 0x000004 /* don't delay packets to coalesce */ +#define TF_NOOPT 0x000008 /* don't use tcp options */ +#define TF_SENTFIN 0x000010 /* have sent FIN */ +#define TF_REQ_SCALE 0x000020 /* have/will request window scaling */ +#define TF_RCVD_SCALE 0x000040 /* other side has requested scaling */ +#define TF_REQ_TSTMP 0x000080 /* have/will request timestamps */ +#define TF_RCVD_TSTMP 0x000100 /* a timestamp was received in SYN */ +#define TF_SACK_PERMIT 0x000200 /* other side said I could SACK */ +#define TF_NEEDSYN 0x000400 /* send SYN (implicit state) */ +#define TF_NEEDFIN 0x000800 /* send FIN (implicit state) */ +#define TF_NOPUSH 0x001000 /* don't push */ +#define TF_MORETOCOME 0x010000 /* More data to be appended to sock */ +#define TF_LQ_OVERFLOW 0x020000 /* listen queue overflow */ +#define TF_LASTIDLE 0x040000 /* connection was previously idle */ +#define TF_RXWIN0SENT 0x080000 /* sent a receiver win 0 in response */ +#define TF_FASTRECOVERY 0x100000 /* in NewReno Fast Recovery */ +#define TF_WASFRECOVERY 0x200000 /* was in NewReno Fast Recovery */ +#define TF_SIGNATURE 0x400000 /* require MD5 digests (RFC2385) */ +#define TF_FORCEDATA 0x800000 /* force out a byte */ +#define TF_TSO 0x1000000 /* TSO enabled on this connection */ +#define TF_TOE 0x2000000 /* this connection is offloaded */ + #define IN_FASTRECOVERY(tp) (tp->t_flags & TF_FASTRECOVERY) #define ENTER_FASTRECOVERY(tp) tp->t_flags |= TF_FASTRECOVERY #define EXIT_FASTRECOVERY(tp) tp->t_flags &= ~TF_FASTRECOVERY +/* + * Flags for the t_oobflags field. + */ +#define TCPOOB_HAVEDATA 0x01 +#define TCPOOB_HADDATA 0x02 + #ifdef TCP_SIGNATURE /* * Defines which are needed by the xform_tcp module and tcp_[in|out]put From rwatson at FreeBSD.org Thu Dec 11 14:28:29 2008 From: rwatson at FreeBSD.org (Robert Watson) Date: Thu Dec 11 14:28:35 2008 Subject: svn commit: r185944 - in stable/7/sys: . contrib/pf dev/cxgb netinet Message-ID: <200812112228.mBBMST21078321@svn.freebsd.org> Author: rwatson Date: Thu Dec 11 22:28:29 2008 New Revision: 185944 URL: http://svn.freebsd.org/changeset/base/185944 Log: Merge r185857 from head to stable/7: Move syncache flag definitions below data structure, compress some vertical whitespace. Approved by: re (gnn) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/netinet/tcp_syncache.c Modified: stable/7/sys/netinet/tcp_syncache.c ============================================================================== --- stable/7/sys/netinet/tcp_syncache.c Thu Dec 11 22:20:36 2008 (r185943) +++ stable/7/sys/netinet/tcp_syncache.c Thu Dec 11 22:28:29 2008 (r185944) @@ -115,7 +115,6 @@ struct syncache { struct in_conninfo sc_inc; /* addresses */ int sc_rxttime; /* retransmit time */ u_int16_t sc_rxmits; /* retransmit counter */ - u_int32_t sc_tsreflect; /* timestamp to reflect */ u_int32_t sc_ts; /* our timestamp to send */ u_int32_t sc_tsoff; /* ts offset w/ syncookies */ @@ -123,7 +122,6 @@ struct syncache { tcp_seq sc_irs; /* seq from peer */ tcp_seq sc_iss; /* our ISS */ struct mbuf *sc_ipopts; /* source route */ - u_int16_t sc_peer_mss; /* peer's MSS */ u_int16_t sc_wnd; /* advertised window */ u_int8_t sc_ip_ttl; /* IPv4 TTL */ @@ -131,13 +129,6 @@ struct syncache { u_int8_t sc_requested_s_scale:4, sc_requested_r_scale:4; u_int8_t sc_flags; -#define SCF_NOOPT 0x01 /* no TCP options */ -#define SCF_WINSCALE 0x02 /* negotiated window scaling */ -#define SCF_TIMESTAMP 0x04 /* negotiated timestamps */ - /* MSS is implicit */ -#define SCF_UNREACH 0x10 /* icmp unreachable received */ -#define SCF_SIGNATURE 0x20 /* send MD5 digests */ -#define SCF_SACK 0x80 /* send SACK option */ #ifndef TCP_OFFLOAD_DISABLE struct toe_usrreqs *sc_tu; /* TOE operations */ void *sc_toepcb; /* TOE protocol block */ @@ -148,6 +139,17 @@ struct syncache { struct ucred *sc_cred; /* cred cache for jail checks */ }; +/* + * Flags for the sc_flags field. + */ +#define SCF_NOOPT 0x01 /* no TCP options */ +#define SCF_WINSCALE 0x02 /* negotiated window scaling */ +#define SCF_TIMESTAMP 0x04 /* negotiated timestamps */ + /* MSS is implicit */ +#define SCF_UNREACH 0x10 /* icmp unreachable received */ +#define SCF_SIGNATURE 0x20 /* send MD5 digests */ +#define SCF_SACK 0x80 /* send SACK option */ + #ifdef TCP_OFFLOAD_DISABLE #define TOEPCB_ISSET(sc) (0) #else From kib at FreeBSD.org Fri Dec 12 05:09:52 2008 From: kib at FreeBSD.org (Konstantin Belousov) Date: Fri Dec 12 05:10:11 2008 Subject: svn commit: r185985 - in stable/7/sys: . amd64/amd64 contrib/pf dev/cxgb Message-ID: <200812121309.mBCD9qWW098320@svn.freebsd.org> Author: kib Date: Fri Dec 12 13:09:52 2008 New Revision: 185985 URL: http://svn.freebsd.org/changeset/base/185985 Log: MFC r185634: Improve db_backtrace() for compat ia32 on amd64. 32bit image enters the kernel via Xint0x80_syscall(). Approved by: re (kensmith) Modified: stable/7/sys/ (props changed) stable/7/sys/amd64/amd64/db_trace.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/amd64/amd64/db_trace.c ============================================================================== --- stable/7/sys/amd64/amd64/db_trace.c Fri Dec 12 12:12:36 2008 (r185984) +++ stable/7/sys/amd64/amd64/db_trace.c Fri Dec 12 13:09:52 2008 (r185985) @@ -27,6 +27,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_compat.h" + #include #include #include @@ -318,6 +320,10 @@ db_nextframe(struct amd64_frame **fp, db frame_type = INTERRUPT; else if (strcmp(name, "Xfast_syscall") == 0) frame_type = SYSCALL; +#ifdef COMPAT_IA32 + else if (strcmp(name, "Xint0x80_syscall") == 0) + frame_type = SYSCALL; +#endif /* XXX: These are interrupts with trap frames. */ else if (strcmp(name, "Xtimerint") == 0 || strcmp(name, "Xcpustop") == 0 || From ru at FreeBSD.org Sat Dec 13 08:53:36 2008 From: ru at FreeBSD.org (Ruslan Ermilov) Date: Sat Dec 13 08:54:02 2008 Subject: svn commit: r186042 - releng/7.1/lib/libc releng/7.1/lib/libc/stdio stable/7/lib/libc stable/7/lib/libc/stdio Message-ID: <200812131653.mBDGrZkM034552@svn.freebsd.org> Author: ru Date: Sat Dec 13 16:53:35 2008 New Revision: 186042 URL: http://svn.freebsd.org/changeset/base/186042 Log: MFC: Fix fread() to return a correct value on platforms where sizeof(int) != sizeof(size_t), i.e. on all 64-bit platforms. Approved by: re (kib) Modified: stable/7/lib/libc/ (props changed) stable/7/lib/libc/stdio/fread.c Changes in other areas also in this revision: Modified: releng/7.1/lib/libc/ (props changed) releng/7.1/lib/libc/stdio/fread.c Modified: stable/7/lib/libc/stdio/fread.c ============================================================================== --- stable/7/lib/libc/stdio/fread.c Sat Dec 13 16:13:37 2008 (r186041) +++ stable/7/lib/libc/stdio/fread.c Sat Dec 13 16:53:35 2008 (r186042) @@ -50,7 +50,7 @@ __FBSDID("$FreeBSD$"); size_t fread(void * __restrict buf, size_t size, size_t count, FILE * __restrict fp) { - int ret; + size_t ret; FLOCKFILE(fp); ret = __fread(buf, size, count, fp); From kensmith at FreeBSD.org Sat Dec 13 10:29:49 2008 From: kensmith at FreeBSD.org (Ken Smith) Date: Sat Dec 13 10:30:01 2008 Subject: svn commit: r186044 - stable/7/gnu/usr.bin/groff/tmac Message-ID: <200812131829.mBDITnGp036329@svn.freebsd.org> Author: kensmith Date: Sat Dec 13 18:29:48 2008 New Revision: 186044 URL: http://svn.freebsd.org/changeset/base/186044 Log: Due to a mis-understanding on my part with Ruslan I haven't been updating this like I should have been. Mis-understanding is cleared up I think. Change default operating system for upcoming release. Add release names not in contrib/groff/tmac/doc-common yet. Submitted by: ru Approved by: re (implicit) Modified: stable/7/gnu/usr.bin/groff/tmac/mdoc.local Modified: stable/7/gnu/usr.bin/groff/tmac/mdoc.local ============================================================================== --- stable/7/gnu/usr.bin/groff/tmac/mdoc.local Sat Dec 13 17:48:06 2008 (r186043) +++ stable/7/gnu/usr.bin/groff/tmac/mdoc.local Sat Dec 13 18:29:48 2008 (r186044) @@ -64,10 +64,12 @@ .ds doc-volume-as-arm arm . .\" Default .Os value -.ds doc-default-operating-system FreeBSD\~7.0 +.ds doc-default-operating-system FreeBSD\~7.1 . .\" FreeBSD releases not found in doc-common .ds doc-operating-system-FreeBSD-6.3 6.3 +.ds doc-operating-system-FreeBSD-6.4 6.4 +.ds doc-operating-system-FreeBSD-7.1 7.1 .ds doc-operating-system-FreeBSD-8.0 8.0 . .ec From daichi at FreeBSD.org Sun Dec 14 19:56:56 2008 From: daichi at FreeBSD.org (Daichi GOTO) Date: Sun Dec 14 19:57:02 2008 Subject: svn commit: r186110 - stable/7/sys/fs/unionfs Message-ID: <200812150356.mBF3usVA083427@svn.freebsd.org> Author: daichi Date: Mon Dec 15 03:56:54 2008 New Revision: 186110 URL: http://svn.freebsd.org/changeset/base/186110 Log: MFC r185284, r185283 PR: 118346 Submitted by: Masanori OZAWA , trasz Discussed at: devsummit Strassburg, EuroBSDCon2008 Discussed with: rwatson, gnn, hrs Approved by: re (gnn) Modified: stable/7/sys/fs/unionfs/union.h stable/7/sys/fs/unionfs/union_subr.c stable/7/sys/fs/unionfs/union_vfsops.c stable/7/sys/fs/unionfs/union_vnops.c Modified: stable/7/sys/fs/unionfs/union.h ============================================================================== --- stable/7/sys/fs/unionfs/union.h Mon Dec 15 02:06:02 2008 (r186109) +++ stable/7/sys/fs/unionfs/union.h Mon Dec 15 03:56:54 2008 (r186110) @@ -117,6 +117,7 @@ void unionfs_create_uppervattr_core(stru int unionfs_create_uppervattr(struct unionfs_mount *ump, struct vnode *lvp, struct vattr *uva, struct ucred *cred, struct thread *td); int unionfs_mkshadowdir(struct unionfs_mount *ump, struct vnode *duvp, struct unionfs_node *unp, struct componentname *cnp, struct thread *td); int unionfs_mkwhiteout(struct vnode *dvp, struct componentname *cnp, struct thread *td, char *path); +int unionfs_relookup(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp, struct componentname *cn, struct thread *td, char *path, int pathlen, u_long nameiop); int unionfs_relookup_for_create(struct vnode *dvp, struct componentname *cnp, struct thread *td); int unionfs_relookup_for_delete(struct vnode *dvp, struct componentname *cnp, struct thread *td); int unionfs_relookup_for_rename(struct vnode *dvp, struct componentname *cnp, struct thread *td); Modified: stable/7/sys/fs/unionfs/union_subr.c ============================================================================== --- stable/7/sys/fs/unionfs/union_subr.c Mon Dec 15 02:06:02 2008 (r186109) +++ stable/7/sys/fs/unionfs/union_subr.c Mon Dec 15 03:56:54 2008 (r186110) @@ -103,10 +103,10 @@ unionfs_get_hashhead(struct vnode *dvp, } /* - * Get the cached vnode. (only VDIR) + * Get the cached vnode. */ static struct vnode * -unionfs_get_cached_vdir(struct vnode *uvp, struct vnode *lvp, +unionfs_get_cached_vnode(struct vnode *uvp, struct vnode *lvp, struct vnode *dvp, char *path) { struct unionfs_node_hashhead *hd; @@ -114,9 +114,9 @@ unionfs_get_cached_vdir(struct vnode *uv struct vnode *vp; KASSERT((uvp == NULLVP || uvp->v_type == VDIR), - ("unionfs_get_cached_vdir: v_type != VDIR")); + ("unionfs_get_cached_vnode: v_type != VDIR")); KASSERT((lvp == NULLVP || lvp->v_type == VDIR), - ("unionfs_get_cached_vdir: v_type != VDIR")); + ("unionfs_get_cached_vnode: v_type != VDIR")); VI_LOCK(dvp); hd = unionfs_get_hashhead(dvp, path); @@ -140,10 +140,10 @@ unionfs_get_cached_vdir(struct vnode *uv } /* - * Add the new vnode into cache. (only VDIR) + * Add the new vnode into cache. */ static struct vnode * -unionfs_ins_cached_vdir(struct unionfs_node *uncp, +unionfs_ins_cached_vnode(struct unionfs_node *uncp, struct vnode *dvp, char *path) { struct unionfs_node_hashhead *hd; @@ -151,9 +151,9 @@ unionfs_ins_cached_vdir(struct unionfs_n struct vnode *vp; KASSERT((uncp->un_uppervp==NULLVP || uncp->un_uppervp->v_type==VDIR), - ("unionfs_ins_cached_vdir: v_type != VDIR")); + ("unionfs_ins_cached_vnode: v_type != VDIR")); KASSERT((uncp->un_lowervp==NULLVP || uncp->un_lowervp->v_type==VDIR), - ("unionfs_ins_cached_vdir: v_type != VDIR")); + ("unionfs_ins_cached_vnode: v_type != VDIR")); VI_LOCK(dvp); hd = unionfs_get_hashhead(dvp, path); @@ -180,16 +180,16 @@ unionfs_ins_cached_vdir(struct unionfs_n } /* - * Remove the vnode. (only VDIR) + * Remove the vnode. */ static void -unionfs_rem_cached_vdir(struct unionfs_node *unp, struct vnode *dvp) +unionfs_rem_cached_vnode(struct unionfs_node *unp, struct vnode *dvp) { - KASSERT((unp != NULL), ("unionfs_rem_cached_vdir: null node")); + KASSERT((unp != NULL), ("unionfs_rem_cached_vnode: null node")); KASSERT((dvp != NULLVP), - ("unionfs_rem_cached_vdir: null parent vnode")); + ("unionfs_rem_cached_vnode: null parent vnode")); KASSERT((unp->un_hash.le_prev != NULL), - ("unionfs_rem_cached_vdir: null hash")); + ("unionfs_rem_cached_vnode: null hash")); VI_LOCK(dvp); LIST_REMOVE(unp, un_hash); @@ -233,9 +233,9 @@ unionfs_nodeget(struct mount *mp, struct if (cnp && !(cnp->cn_flags & ISLASTCN)) path = NULL; - /* check the vdir cache */ + /* check the cache */ if (path != NULL && dvp != NULLVP && vt == VDIR) { - vp = unionfs_get_cached_vdir(uppervp, lowervp, dvp, path); + vp = unionfs_get_cached_vnode(uppervp, lowervp, dvp, path); if (vp != NULLVP) { vref(vp); *vpp = vp; @@ -255,17 +255,17 @@ unionfs_nodeget(struct mount *mp, struct * might cause a bogus v_data pointer to get dereferenced elsewhere * if MALLOC should block. */ - MALLOC(unp, struct unionfs_node *, sizeof(struct unionfs_node), + unp = malloc(sizeof(struct unionfs_node), M_UNIONFSNODE, M_WAITOK | M_ZERO); error = getnewvnode("unionfs", mp, &unionfs_vnodeops, &vp); if (error != 0) { - FREE(unp, M_UNIONFSNODE); + free(unp, M_UNIONFSNODE); return (error); } error = insmntque(vp, mp); /* XXX: Too early for mpsafe fs */ if (error != 0) { - FREE(unp, M_UNIONFSNODE); + free(unp, M_UNIONFSNODE); return (error); } if (dvp != NULLVP) @@ -302,7 +302,7 @@ unionfs_nodeget(struct mount *mp, struct vp->v_vflag |= VV_ROOT; if (path != NULL && dvp != NULLVP && vt == VDIR) - *vpp = unionfs_ins_cached_vdir(unp, dvp, path); + *vpp = unionfs_ins_cached_vnode(unp, dvp, path); if ((*vpp) != NULLVP) { if (dvp != NULLVP) vrele(dvp); @@ -363,7 +363,7 @@ unionfs_noderem(struct vnode *vp, struct vp->v_object = NULL; if (dvp != NULLVP && unp->un_hash.le_prev != NULL) - unionfs_rem_cached_vdir(unp, dvp); + unionfs_rem_cached_vnode(unp, dvp); if (lvp != NULLVP) { vfslocked = VFS_LOCK_GIANT(lvp->v_mount); @@ -402,7 +402,7 @@ unionfs_noderem(struct vnode *vp, struct LIST_REMOVE(unsp, uns_list); free(unsp, M_TEMP); } - FREE(unp, M_UNIONFSNODE); + free(unp, M_UNIONFSNODE); } /* @@ -427,8 +427,8 @@ unionfs_get_node_status(struct unionfs_n } /* create a new unionfs node status */ - MALLOC(unsp, struct unionfs_node_status *, - sizeof(struct unionfs_node_status), M_TEMP, M_WAITOK | M_ZERO); + unsp = malloc(sizeof(struct unionfs_node_status), + M_TEMP, M_WAITOK | M_ZERO); unsp->uns_pid = pid; LIST_INSERT_HEAD(&(unp->un_unshead), unsp, uns_list); @@ -527,7 +527,7 @@ unionfs_create_uppervattr(struct unionfs * locked, referenced vnode. If *vpp == dvp then remember that only one * LK_EXCLUSIVE lock is held. */ -static int +int unionfs_relookup(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp, struct componentname *cn, struct thread *td, char *path, int pathlen, u_long nameiop) @@ -718,6 +718,7 @@ unionfs_node_update(struct unionfs_node vp = UNIONFSTOV(unp); lvp = unp->un_lowervp; + ASSERT_VOP_ELOCKED(lvp, "unionfs_node_update"); dvp = unp->un_dvp; /* Modified: stable/7/sys/fs/unionfs/union_vfsops.c ============================================================================== --- stable/7/sys/fs/unionfs/union_vfsops.c Mon Dec 15 02:06:02 2008 (r186109) +++ stable/7/sys/fs/unionfs/union_vfsops.c Mon Dec 15 03:56:54 2008 (r186110) @@ -66,43 +66,6 @@ static vfs_extattrctl_t unionfs_extattrc static struct vfsops unionfs_vfsops; /* - * Exchange from userland file mode to vmode. - */ -static u_short -mode2vmode(mode_t mode) -{ - u_short ret; - - ret = 0; - - /* other */ - if (mode & S_IXOTH) - ret |= VEXEC >> 6; - if (mode & S_IWOTH) - ret |= VWRITE >> 6; - if (mode & S_IROTH) - ret |= VREAD >> 6; - - /* group */ - if (mode & S_IXGRP) - ret |= VEXEC >> 3; - if (mode & S_IWGRP) - ret |= VWRITE >> 3; - if (mode & S_IRGRP) - ret |= VREAD >> 3; - - /* owner */ - if (mode & S_IXUSR) - ret |= VEXEC; - if (mode & S_IWUSR) - ret |= VWRITE; - if (mode & S_IRUSR) - ret |= VREAD; - - return (ret); -} - -/* * Mount unionfs layer. */ static int @@ -173,7 +136,7 @@ unionfs_domount(struct mount *mp, struct vfs_mount_error(mp, "Invalid udir"); return (EINVAL); } - udir = mode2vmode(udir); + udir &= S_IRWXU | S_IRWXG | S_IRWXO; } if (vfs_getopt(mp->mnt_optnew, "ufile", (void **)&tmp, NULL) == 0) { if (tmp != NULL) @@ -182,7 +145,7 @@ unionfs_domount(struct mount *mp, struct vfs_mount_error(mp, "Invalid ufile"); return (EINVAL); } - ufile = mode2vmode(ufile); + ufile &= S_IRWXU | S_IRWXG | S_IRWXO; } /* check umask, uid and gid */ if (udir == 0 && ufile != 0) @@ -267,7 +230,7 @@ unionfs_domount(struct mount *mp, struct /* * Find upper node */ - NDINIT(ndp, LOOKUP, FOLLOW | WANTPARENT | LOCKLEAF, UIO_SYSSPACE, target, td); + NDINIT(ndp, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, target, td); if ((error = namei(ndp))) return (error); @@ -277,9 +240,6 @@ unionfs_domount(struct mount *mp, struct lowerrootvp = mp->mnt_vnodecovered; upperrootvp = ndp->ni_vp; - vrele(ndp->ni_dvp); - ndp->ni_dvp = NULLVP; - /* create unionfs_mount */ ump = (struct unionfs_mount *)malloc(sizeof(struct unionfs_mount), M_UNIONFSMNT, M_WAITOK | M_ZERO); @@ -309,7 +269,7 @@ unionfs_domount(struct mount *mp, struct (upperrootvp->v_mount->mnt_kern_flag & MNTK_MPSAFE)) mp->mnt_kern_flag |= MNTK_MPSAFE; MNT_IUNLOCK(mp); - mp->mnt_data = (qaddr_t)ump; + mp->mnt_data = ump; /* * Copy upper layer's RDONLY flag. Modified: stable/7/sys/fs/unionfs/union_vnops.c ============================================================================== --- stable/7/sys/fs/unionfs/union_vnops.c Mon Dec 15 02:06:02 2008 (r186109) +++ stable/7/sys/fs/unionfs/union_vnops.c Mon Dec 15 03:56:54 2008 (r186110) @@ -71,6 +71,10 @@ #define UNIONFS_INTERNAL_DEBUG(msg, args...) #endif +#define KASSERT_UNIONFS_VNODE(vp) \ + KASSERT(((vp)->v_op == &unionfs_vnodeops), \ + ("unionfs: it is not unionfs-vnode")) + /* lockmgr lock <-> reverse table */ struct lk_lr_table { int lock; @@ -307,8 +311,27 @@ unionfs_lookup(struct vop_cachedlookup_a error = lerror; if (error != 0) goto unionfs_lookup_out; - error = unionfs_nodeget(dvp->v_mount, uvp, lvp, dvp, &vp, - cnp, td); + /* + * get socket vnode. + */ + if (uvp != NULLVP && uvp->v_type == VSOCK) { + vp = uvp; + vref(vp); + if (cnp->cn_lkflags & LK_TYPE_MASK) + vn_lock(vp, cnp->cn_lkflags | LK_RETRY, td); + } + else if (lvp != NULLVP && lvp->v_type == VSOCK) { + vp = lvp; + vref(vp); + if (cnp->cn_lkflags & LK_TYPE_MASK) + vn_lock(vp, cnp->cn_lkflags | LK_RETRY, td); + } + /* + * get unionfs vnode. + */ + else + error = unionfs_nodeget(dvp->v_mount, uvp, lvp, + dvp, &vp, cnp, td); if (error != 0) { UNIONFSDEBUG("unionfs_lookup: Unable to create unionfs vnode."); goto unionfs_lookup_out; @@ -320,7 +343,7 @@ unionfs_lookup(struct vop_cachedlookup_a *(ap->a_vpp) = vp; - if (cnflags & MAKEENTRY) + if ((cnflags & MAKEENTRY) && vp->v_type != VSOCK) cache_enter(dvp, vp, cnp); unionfs_lookup_out: @@ -349,6 +372,8 @@ unionfs_create(struct vop_create_args *a UNIONFS_INTERNAL_DEBUG("unionfs_create: enter\n"); + KASSERT_UNIONFS_VNODE(ap->a_dvp); + dunp = VTOUNIONFS(ap->a_dvp); cnp = ap->a_cnp; td = curthread; @@ -356,7 +381,13 @@ unionfs_create(struct vop_create_args *a error = EROFS; if (udvp != NULLVP) { - if ((error = VOP_CREATE(udvp, &vp, cnp, ap->a_vap)) == 0) { + error = VOP_CREATE(udvp, &vp, cnp, ap->a_vap); + if (error != 0) + goto unionfs_create_abort; + + if (vp->v_type == VSOCK) + *(ap->a_vpp) = vp; + else { VOP_UNLOCK(vp, 0, td); error = unionfs_nodeget(ap->a_dvp->v_mount, vp, NULLVP, ap->a_dvp, ap->a_vpp, cnp, td); @@ -364,6 +395,7 @@ unionfs_create(struct vop_create_args *a } } +unionfs_create_abort: UNIONFS_INTERNAL_DEBUG("unionfs_create: leave (%d)\n", error); return (error); @@ -379,6 +411,8 @@ unionfs_whiteout(struct vop_whiteout_arg UNIONFS_INTERNAL_DEBUG("unionfs_whiteout: enter\n"); + KASSERT_UNIONFS_VNODE(ap->a_dvp); + dunp = VTOUNIONFS(ap->a_dvp); cnp = ap->a_cnp; udvp = dunp->un_uppervp; @@ -414,6 +448,8 @@ unionfs_mknod(struct vop_mknod_args *ap) UNIONFS_INTERNAL_DEBUG("unionfs_mknod: enter\n"); + KASSERT_UNIONFS_VNODE(ap->a_dvp); + dunp = VTOUNIONFS(ap->a_dvp); cnp = ap->a_cnp; td = curthread; @@ -421,7 +457,13 @@ unionfs_mknod(struct vop_mknod_args *ap) error = EROFS; if (udvp != NULLVP) { - if ((error = VOP_MKNOD(udvp, &vp, cnp, ap->a_vap)) == 0) { + error = VOP_MKNOD(udvp, &vp, cnp, ap->a_vap); + if (error != 0) + goto unionfs_mknod_abort; + + if (vp->v_type == VSOCK) + *(ap->a_vpp) = vp; + else { VOP_UNLOCK(vp, 0, td); error = unionfs_nodeget(ap->a_dvp->v_mount, vp, NULLVP, ap->a_dvp, ap->a_vpp, cnp, td); @@ -429,6 +471,7 @@ unionfs_mknod(struct vop_mknod_args *ap) } } +unionfs_mknod_abort: UNIONFS_INTERNAL_DEBUG("unionfs_mknod: leave (%d)\n", error); return (error); @@ -448,6 +491,8 @@ unionfs_open(struct vop_open_args *ap) UNIONFS_INTERNAL_DEBUG("unionfs_open: enter\n"); + KASSERT_UNIONFS_VNODE(ap->a_vp); + error = 0; unp = VTOUNIONFS(ap->a_vp); uvp = unp->un_uppervp; @@ -527,6 +572,8 @@ unionfs_close(struct vop_close_args *ap) UNIONFS_INTERNAL_DEBUG("unionfs_close: enter\n"); + KASSERT_UNIONFS_VNODE(ap->a_vp); + locked = 0; unp = VTOUNIONFS(ap->a_vp); cred = ap->a_cred; @@ -654,6 +701,8 @@ unionfs_access(struct vop_access_args *a UNIONFS_INTERNAL_DEBUG("unionfs_access: enter\n"); + KASSERT_UNIONFS_VNODE(ap->a_vp); + ump = MOUNTTOUNIONFSMOUNT(ap->a_vp->v_mount); unp = VTOUNIONFS(ap->a_vp); uvp = unp->un_uppervp; @@ -731,6 +780,8 @@ unionfs_getattr(struct vop_getattr_args UNIONFS_INTERNAL_DEBUG("unionfs_getattr: enter\n"); + KASSERT_UNIONFS_VNODE(ap->a_vp); + unp = VTOUNIONFS(ap->a_vp); ump = MOUNTTOUNIONFSMOUNT(ap->a_vp->v_mount); uvp = unp->un_uppervp; @@ -781,6 +832,8 @@ unionfs_setattr(struct vop_setattr_args UNIONFS_INTERNAL_DEBUG("unionfs_setattr: enter\n"); + KASSERT_UNIONFS_VNODE(ap->a_vp); + error = EROFS; unp = VTOUNIONFS(ap->a_vp); uvp = unp->un_uppervp; @@ -819,6 +872,8 @@ unionfs_read(struct vop_read_args *ap) /* UNIONFS_INTERNAL_DEBUG("unionfs_read: enter\n"); */ + KASSERT_UNIONFS_VNODE(ap->a_vp); + unp = VTOUNIONFS(ap->a_vp); tvp = (unp->un_uppervp != NULLVP ? unp->un_uppervp : unp->un_lowervp); @@ -838,6 +893,8 @@ unionfs_write(struct vop_write_args *ap) /* UNIONFS_INTERNAL_DEBUG("unionfs_write: enter\n"); */ + KASSERT_UNIONFS_VNODE(ap->a_vp); + unp = VTOUNIONFS(ap->a_vp); tvp = (unp->un_uppervp != NULLVP ? unp->un_uppervp : unp->un_lowervp); @@ -857,6 +914,8 @@ unionfs_lease(struct vop_lease_args *ap) UNIONFS_INTERNAL_DEBUG("unionfs_lease: enter\n"); + KASSERT_UNIONFS_VNODE(ap->a_vp); + unp = VTOUNIONFS(ap->a_vp); vp = (unp->un_uppervp != NULLVP ? unp->un_uppervp : unp->un_lowervp); @@ -877,6 +936,8 @@ unionfs_ioctl(struct vop_ioctl_args *ap) UNIONFS_INTERNAL_DEBUG("unionfs_ioctl: enter\n"); + KASSERT_UNIONFS_VNODE(ap->a_vp); + vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY, ap->a_td); unp = VTOUNIONFS(ap->a_vp); unionfs_get_node_status(unp, ap->a_td, &unsp); @@ -902,6 +963,8 @@ unionfs_poll(struct vop_poll_args *ap) struct unionfs_node_status *unsp; struct vnode *ovp; + KASSERT_UNIONFS_VNODE(ap->a_vp); + vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY, ap->a_td); unp = VTOUNIONFS(ap->a_vp); unionfs_get_node_status(unp, ap->a_td, &unsp); @@ -922,6 +985,8 @@ unionfs_fsync(struct vop_fsync_args *ap) struct unionfs_node_status *unsp; struct vnode *ovp; + KASSERT_UNIONFS_VNODE(ap->a_vp); + unp = VTOUNIONFS(ap->a_vp); unionfs_get_node_status(unp, ap->a_td, &unsp); ovp = (unsp->uns_upper_opencnt ? unp->un_uppervp : unp->un_lowervp); @@ -937,36 +1002,81 @@ static int unionfs_remove(struct vop_remove_args *ap) { int error; + char *path; struct unionfs_node *dunp; struct unionfs_node *unp; struct unionfs_mount *ump; struct vnode *udvp; struct vnode *uvp; struct vnode *lvp; + struct vnode *vp; struct componentname *cnp; + struct componentname cn; struct thread *td; UNIONFS_INTERNAL_DEBUG("unionfs_remove: enter\n"); + KASSERT_UNIONFS_VNODE(ap->a_dvp); + error = 0; dunp = VTOUNIONFS(ap->a_dvp); - unp = VTOUNIONFS(ap->a_vp); udvp = dunp->un_uppervp; - uvp = unp->un_uppervp; - lvp = unp->un_lowervp; cnp = ap->a_cnp; td = curthread; + if (ap->a_vp->v_op != &unionfs_vnodeops) { + if (ap->a_vp->v_type != VSOCK) + return (EINVAL); + ump = NULL; + vp = uvp = lvp = NULLVP; + /* search vnode */ + VOP_UNLOCK(ap->a_vp, 0, td); + error = unionfs_relookup(udvp, &vp, cnp, &cn, td, + cnp->cn_nameptr, strlen(cnp->cn_nameptr), DELETE); + if (error != 0 && error != ENOENT) { + vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY, td); + return (error); + } + + if (error == 0 && vp == ap->a_vp) { + /* target vnode in upper */ + uvp = vp; + vrele(vp); + path = NULL; + } else { + /* target vnode in lower */ + if (vp != NULLVP) { + if (udvp == vp) + vrele(vp); + else + vput(vp); + } + vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY, td); + lvp = ap->a_vp; + path = ap->a_cnp->cn_nameptr; + } + } else { + ump = MOUNTTOUNIONFSMOUNT(ap->a_vp->v_mount); + unp = VTOUNIONFS(ap->a_vp); + uvp = unp->un_uppervp; + lvp = unp->un_lowervp; + path = unp->un_path; + } + if (udvp == NULLVP) return (EROFS); if (uvp != NULLVP) { - ump = MOUNTTOUNIONFSMOUNT(ap->a_vp->v_mount); - if (ump->um_whitemode == UNIONFS_WHITE_ALWAYS || lvp != NULLVP) + /* + * XXX: if the vnode type is VSOCK, it will create whiteout + * after remove. + */ + if (ump == NULL || ump->um_whitemode == UNIONFS_WHITE_ALWAYS || + lvp != NULLVP) cnp->cn_flags |= DOWHITEOUT; error = VOP_REMOVE(udvp, uvp, cnp); } else if (lvp != NULLVP) - error = unionfs_mkwhiteout(udvp, cnp, td, unp->un_path); + error = unionfs_mkwhiteout(udvp, cnp, td, path); UNIONFS_INTERNAL_DEBUG("unionfs_remove: leave (%d)\n", error); @@ -987,6 +1097,9 @@ unionfs_link(struct vop_link_args *ap) UNIONFS_INTERNAL_DEBUG("unionfs_link: enter\n"); + KASSERT_UNIONFS_VNODE(ap->a_tdvp); + KASSERT_UNIONFS_VNODE(ap->a_vp); + error = 0; needrelookup = 0; dunp = VTOUNIONFS(ap->a_tdvp); @@ -1077,7 +1190,10 @@ unionfs_rename(struct vop_rename_args *a /* check for cross device rename */ if (fvp->v_mount != tdvp->v_mount || (tvp != NULLVP && fvp->v_mount != tvp->v_mount)) { - error = EXDEV; + if (fvp->v_op != &unionfs_vnodeops) + error = ENODEV; + else + error = EXDEV; goto unionfs_rename_abort; } @@ -1089,6 +1205,12 @@ unionfs_rename(struct vop_rename_args *a * from/to vnode is unionfs node. */ + KASSERT_UNIONFS_VNODE(fdvp); + KASSERT_UNIONFS_VNODE(fvp); + KASSERT_UNIONFS_VNODE(tdvp); + if (tvp != NULLVP) + KASSERT_UNIONFS_VNODE(tvp); + unp = VTOUNIONFS(fdvp); #ifdef UNIONFS_IDBG_RENAME UNIONFS_INTERNAL_DEBUG("fdvp=%p, ufdvp=%p, lfdvp=%p\n", fdvp, unp->un_uppervp, unp->un_lowervp); @@ -1258,6 +1380,8 @@ unionfs_mkdir(struct vop_mkdir_args *ap) UNIONFS_INTERNAL_DEBUG("unionfs_mkdir: enter\n"); + KASSERT_UNIONFS_VNODE(ap->a_dvp); + error = EROFS; dunp = VTOUNIONFS(ap->a_dvp); cnp = ap->a_cnp; @@ -1305,6 +1429,9 @@ unionfs_rmdir(struct vop_rmdir_args *ap) UNIONFS_INTERNAL_DEBUG("unionfs_rmdir: enter\n"); + KASSERT_UNIONFS_VNODE(ap->a_dvp); + KASSERT_UNIONFS_VNODE(ap->a_vp); + error = 0; dunp = VTOUNIONFS(ap->a_dvp); unp = VTOUNIONFS(ap->a_vp); @@ -1357,6 +1484,8 @@ unionfs_symlink(struct vop_symlink_args UNIONFS_INTERNAL_DEBUG("unionfs_symlink: enter\n"); + KASSERT_UNIONFS_VNODE(ap->a_dvp); + error = EROFS; dunp = VTOUNIONFS(ap->a_dvp); cnp = ap->a_cnp; @@ -1400,6 +1529,8 @@ unionfs_readdir(struct vop_readdir_args UNIONFS_INTERNAL_DEBUG("unionfs_readdir: enter\n"); + KASSERT_UNIONFS_VNODE(ap->a_vp); + error = 0; eofflag = 0; locked = 0; @@ -1547,6 +1678,8 @@ unionfs_readlink(struct vop_readlink_arg UNIONFS_INTERNAL_DEBUG("unionfs_readlink: enter\n"); + KASSERT_UNIONFS_VNODE(ap->a_vp); + unp = VTOUNIONFS(ap->a_vp); vp = (unp->un_uppervp != NULLVP ? unp->un_uppervp : unp->un_lowervp); @@ -1572,6 +1705,8 @@ unionfs_getwritemount(struct vop_getwrit if (vp == NULLVP || (vp->v_mount->mnt_flag & MNT_RDONLY)) return (EACCES); + KASSERT_UNIONFS_VNODE(vp); + uvp = UNIONFSVPTOUPPERVP(vp); if (uvp == NULLVP && VREG == vp->v_type) uvp = UNIONFSVPTOUPPERVP(VTOUNIONFS(vp)->un_dvp); @@ -1666,6 +1801,8 @@ unionfs_lock(struct vop_lock1_args *ap) struct vnode *lvp; struct thread *td; + KASSERT_UNIONFS_VNODE(ap->a_vp); + error = 0; uhold = 0; flags = ap->a_flags; @@ -1787,6 +1924,8 @@ unionfs_unlock(struct vop_unlock_args *a struct vnode *uvp; struct unionfs_node *unp; + KASSERT_UNIONFS_VNODE(ap->a_vp); + error = 0; mtxlkflag = 0; uhold = 0; @@ -1855,6 +1994,8 @@ unionfs_pathconf(struct vop_pathconf_arg struct unionfs_node *unp; struct vnode *vp; + KASSERT_UNIONFS_VNODE(ap->a_vp); + unp = VTOUNIONFS(ap->a_vp); vp = (unp->un_uppervp != NULLVP ? unp->un_uppervp : unp->un_lowervp); @@ -1873,6 +2014,8 @@ unionfs_advlock(struct vop_advlock_args UNIONFS_INTERNAL_DEBUG("unionfs_advlock: enter\n"); + KASSERT_UNIONFS_VNODE(ap->a_vp); + vp = ap->a_vp; td = curthread; @@ -1923,6 +2066,8 @@ unionfs_strategy(struct vop_strategy_arg struct unionfs_node *unp; struct vnode *vp; + KASSERT_UNIONFS_VNODE(ap->a_vp); + unp = VTOUNIONFS(ap->a_vp); vp = (unp->un_uppervp != NULLVP ? unp->un_uppervp : unp->un_lowervp); @@ -1944,6 +2089,8 @@ unionfs_getacl(struct vop_getacl_args *a struct unionfs_node *unp; struct vnode *vp; + KASSERT_UNIONFS_VNODE(ap->a_vp); + unp = VTOUNIONFS(ap->a_vp); vp = (unp->un_uppervp != NULLVP ? unp->un_uppervp : unp->un_lowervp); @@ -1967,6 +2114,8 @@ unionfs_setacl(struct vop_setacl_args *a UNIONFS_INTERNAL_DEBUG("unionfs_setacl: enter\n"); + KASSERT_UNIONFS_VNODE(ap->a_vp); + error = EROFS; unp = VTOUNIONFS(ap->a_vp); uvp = unp->un_uppervp; @@ -1999,6 +2148,8 @@ unionfs_aclcheck(struct vop_aclcheck_arg UNIONFS_INTERNAL_DEBUG("unionfs_aclcheck: enter\n"); + KASSERT_UNIONFS_VNODE(ap->a_vp); + unp = VTOUNIONFS(ap->a_vp); vp = (unp->un_uppervp != NULLVP ? unp->un_uppervp : unp->un_lowervp); @@ -2017,6 +2168,8 @@ unionfs_openextattr(struct vop_openextat struct vnode *vp; struct vnode *tvp; + KASSERT_UNIONFS_VNODE(ap->a_vp); + vp = ap->a_vp; unp = VTOUNIONFS(vp); tvp = (unp->un_uppervp != NULLVP ? unp->un_uppervp : unp->un_lowervp); @@ -2047,6 +2200,8 @@ unionfs_closeextattr(struct vop_closeext struct vnode *vp; struct vnode *tvp; + KASSERT_UNIONFS_VNODE(ap->a_vp); + vp = ap->a_vp; unp = VTOUNIONFS(vp); tvp = NULLVP; @@ -2079,6 +2234,8 @@ unionfs_getextattr(struct vop_getextattr struct unionfs_node *unp; struct vnode *vp; + KASSERT_UNIONFS_VNODE(ap->a_vp); + unp = VTOUNIONFS(ap->a_vp); vp = NULLVP; @@ -2105,6 +2262,8 @@ unionfs_setextattr(struct vop_setextattr struct ucred *cred; struct thread *td; + KASSERT_UNIONFS_VNODE(ap->a_vp); + error = EROFS; unp = VTOUNIONFS(ap->a_vp); uvp = unp->un_uppervp; @@ -2164,6 +2323,8 @@ unionfs_listextattr(struct vop_listextat struct unionfs_node *unp; struct vnode *vp; + KASSERT_UNIONFS_VNODE(ap->a_vp); + unp = VTOUNIONFS(ap->a_vp); vp = NULLVP; @@ -2190,6 +2351,8 @@ unionfs_deleteextattr(struct vop_deletee struct ucred *cred; struct thread *td; + KASSERT_UNIONFS_VNODE(ap->a_vp); + error = EROFS; unp = VTOUNIONFS(ap->a_vp); uvp = unp->un_uppervp; @@ -2254,6 +2417,8 @@ unionfs_setlabel(struct vop_setlabel_arg UNIONFS_INTERNAL_DEBUG("unionfs_setlabel: enter\n"); + KASSERT_UNIONFS_VNODE(ap->a_vp); + error = EROFS; unp = VTOUNIONFS(ap->a_vp); uvp = unp->un_uppervp; From yongari at FreeBSD.org Sun Dec 14 21:54:28 2008 From: yongari at FreeBSD.org (Pyun YongHyeon) Date: Sun Dec 14 21:54:34 2008 Subject: svn commit: r186116 - in stable/7/sys: . contrib/pf dev/cxgb dev/vr Message-ID: <200812150554.mBF5sSQZ085875@svn.freebsd.org> Author: yongari Date: Mon Dec 15 05:54:27 2008 New Revision: 186116 URL: http://svn.freebsd.org/changeset/base/186116 Log: MFC r185962: It seems there are still issues on multicast perfect filtering. Disable it until I find spare time to analyze the issue. Approved by: re (kensmith) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/dev/vr/if_vr.c Modified: stable/7/sys/dev/vr/if_vr.c ============================================================================== --- stable/7/sys/dev/vr/if_vr.c Mon Dec 15 04:20:42 2008 (r186115) +++ stable/7/sys/dev/vr/if_vr.c Mon Dec 15 05:54:27 2008 (r186116) @@ -133,7 +133,7 @@ static struct vr_type { 0, "VIA VT6105 Rhine III 10/100BaseTX" }, { VIA_VENDORID, VIA_DEVICEID_RHINE_III_M, - VR_Q_CSUM | VR_Q_CAM, + VR_Q_CSUM, "VIA VT6105M Rhine III 10/100BaseTX" }, { DELTA_VENDORID, DELTA_DEVICEID_RHINE_II, VR_Q_NEEDALIGN, From marius at FreeBSD.org Mon Dec 15 12:32:16 2008 From: marius at FreeBSD.org (Marius Strobl) Date: Mon Dec 15 12:32:34 2008 Subject: svn commit: r186134 - in stable/7/sys: . dev/bge Message-ID: <200812152032.mBFKWGhv015971@svn.freebsd.org> Author: marius Date: Mon Dec 15 20:32:16 2008 New Revision: 186134 URL: http://svn.freebsd.org/changeset/base/186134 Log: - Limit BCM5701 B5 to 32-bit mode as a workaround for a bug which causes data corruption in combination with certain bridges. Information about this problem was kindly provided by davidch. [1] - As BGE_FLAG_PCIX is meant to indicate that the controller is in PCI-X mode, revert to the pre __FreeBSD_version 602101 method of reading the bus mode register rather than checking the mere existence of a PCI-X capability, which is also there when the NIC f.e. is put into a 32-bit slot causing it not to be in PCI-X mode. Setting BGE_FLAG_PCIX inappropriately could cause the NIC to be tuned incorrectly. PR: 128833 [1] Reviewed by: jhb Approved by: re (kib) Modified: stable/7/sys/ (props changed) stable/7/sys/dev/bge/if_bge.c Modified: stable/7/sys/dev/bge/if_bge.c ============================================================================== --- stable/7/sys/dev/bge/if_bge.c Mon Dec 15 18:20:59 2008 (r186133) +++ stable/7/sys/dev/bge/if_bge.c Mon Dec 15 20:32:16 2008 (r186134) @@ -1370,6 +1370,16 @@ bge_chipinit(struct bge_softc *sc) BGE_MODECTL_TX_NO_PHDR_CSUM); /* + * BCM5701 B5 have a bug causing data corruption when using + * 64-bit DMA reads, which can be terminated early and then + * completed later as 32-bit accesses, in combination with + * certain bridges. + */ + if (sc->bge_asicrev == BGE_ASICREV_BCM5701 && + sc->bge_chipid == BGE_CHIPID_BCM5701_B5) + BGE_SETBIT(sc, BGE_MODE_CTL, BGE_MODECTL_FORCE_PCI32); + + /* * Tell the firmware the driver is running */ if (sc->bge_asf_mode & ASF_STACKUP) @@ -2465,26 +2475,21 @@ bge_attach(device_t dev) */ if (reg != 0) sc->bge_flags |= BGE_FLAG_PCIE; - } else if (pci_find_extcap(dev, PCIY_PCIX, ®) == 0) { - if (reg != 0) - sc->bge_flags |= BGE_FLAG_PCIX; - } - #else if (BGE_IS_5705_PLUS(sc)) { reg = pci_read_config(dev, BGE_PCIE_CAPID_REG, 4); if ((reg & 0xFF) == BGE_PCIE_CAPID) sc->bge_flags |= BGE_FLAG_PCIE; +#endif } else { /* * Check if the device is in PCI-X Mode. * (This bit is not valid on PCI Express controllers.) */ - if ((pci_read_config(sc->bge_dev, BGE_PCI_PCISTATE, 4) & + if ((pci_read_config(dev, BGE_PCI_PCISTATE, 4) & BGE_PCISTATE_PCI_BUSMODE) == 0) sc->bge_flags |= BGE_FLAG_PCIX; } -#endif #if __FreeBSD_version > 602105 { From marius at FreeBSD.org Mon Dec 15 13:36:15 2008 From: marius at FreeBSD.org (Marius Strobl) Date: Mon Dec 15 13:36:27 2008 Subject: svn commit: r186137 - in stable/7/sys: . contrib/pf dev/cxgb dev/dc Message-ID: <200812152136.mBFLaEOA017351@svn.freebsd.org> Author: marius Date: Mon Dec 15 21:36:14 2008 New Revision: 186137 URL: http://svn.freebsd.org/changeset/base/186137 Log: MFC: 185750 - According to the corresponding Linux, NetBSD and OpenSolaris drivers, there should be a 1us delay after every write when bit-banging the MII. Also insert barriers in order to ensure the intended ordering. These changes hopefully will solve the bus wedging occasionally experienced with DM9102A since r182461. - Deobfuscate dc_mii_readreg() a bit. Approved by: re (kib) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/dev/dc/if_dc.c stable/7/sys/dev/dc/if_dcreg.h Modified: stable/7/sys/dev/dc/if_dc.c ============================================================================== --- stable/7/sys/dev/dc/if_dc.c Mon Dec 15 20:40:06 2008 (r186136) +++ stable/7/sys/dev/dc/if_dc.c Mon Dec 15 21:36:14 2008 (r186137) @@ -607,15 +607,22 @@ dc_read_eeprom(struct dc_softc *sc, cadd static void dc_mii_writebit(struct dc_softc *sc, int bit) { + uint32_t reg; - if (bit) - CSR_WRITE_4(sc, DC_SIO, - DC_SIO_ROMCTL_WRITE | DC_SIO_MII_DATAOUT); - else - CSR_WRITE_4(sc, DC_SIO, DC_SIO_ROMCTL_WRITE); - - DC_SETBIT(sc, DC_SIO, DC_SIO_MII_CLK); - DC_CLRBIT(sc, DC_SIO, DC_SIO_MII_CLK); + reg = DC_SIO_ROMCTL_WRITE | (bit != 0 ? DC_SIO_MII_DATAOUT : 0); + CSR_WRITE_4(sc, DC_SIO, reg); + CSR_BARRIER_4(sc, DC_SIO, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + DELAY(1); + + CSR_WRITE_4(sc, DC_SIO, reg | DC_SIO_MII_CLK); + CSR_BARRIER_4(sc, DC_SIO, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + DELAY(1); + CSR_WRITE_4(sc, DC_SIO, reg); + CSR_BARRIER_4(sc, DC_SIO, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + DELAY(1); } /* @@ -624,11 +631,22 @@ dc_mii_writebit(struct dc_softc *sc, int static int dc_mii_readbit(struct dc_softc *sc) { + uint32_t reg; - CSR_WRITE_4(sc, DC_SIO, DC_SIO_ROMCTL_READ | DC_SIO_MII_DIR); - CSR_READ_4(sc, DC_SIO); - DC_SETBIT(sc, DC_SIO, DC_SIO_MII_CLK); - DC_CLRBIT(sc, DC_SIO, DC_SIO_MII_CLK); + reg = DC_SIO_ROMCTL_READ | DC_SIO_MII_DIR; + CSR_WRITE_4(sc, DC_SIO, reg); + CSR_BARRIER_4(sc, DC_SIO, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + DELAY(1); + (void)CSR_READ_4(sc, DC_SIO); + CSR_WRITE_4(sc, DC_SIO, reg | DC_SIO_MII_CLK); + CSR_BARRIER_4(sc, DC_SIO, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + DELAY(1); + CSR_WRITE_4(sc, DC_SIO, reg); + CSR_BARRIER_4(sc, DC_SIO, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + DELAY(1); if (CSR_READ_4(sc, DC_SIO) & DC_SIO_MII_DATAIN) return (1); @@ -644,6 +662,9 @@ dc_mii_sync(struct dc_softc *sc) int i; CSR_WRITE_4(sc, DC_SIO, DC_SIO_ROMCTL_WRITE); + CSR_BARRIER_4(sc, DC_SIO, + BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); + DELAY(1); for (i = 0; i < 32; i++) dc_mii_writebit(sc, 1); @@ -667,15 +688,13 @@ dc_mii_send(struct dc_softc *sc, u_int32 static int dc_mii_readreg(struct dc_softc *sc, struct dc_mii_frame *frame) { - int i, ack; + int i; /* * Set up frame for RX. */ frame->mii_stdelim = DC_MII_STARTDELIM; frame->mii_opcode = DC_MII_READOP; - frame->mii_turnaround = 0; - frame->mii_data = 0; /* * Sync the PHYs. @@ -690,38 +709,28 @@ dc_mii_readreg(struct dc_softc *sc, stru dc_mii_send(sc, frame->mii_phyaddr, 5); dc_mii_send(sc, frame->mii_regaddr, 5); -#ifdef notdef - /* Idle bit */ - dc_mii_writebit(sc, 1); - dc_mii_writebit(sc, 0); -#endif - - /* Check for ack. */ - ack = dc_mii_readbit(sc); - /* - * Now try reading data bits. If the ack failed, we still + * Now try reading data bits. If the turnaround failed, we still * need to clock through 16 cycles to keep the PHY(s) in sync. */ - if (ack) { + frame->mii_turnaround = dc_mii_readbit(sc); + if (frame->mii_turnaround != 0) { for (i = 0; i < 16; i++) dc_mii_readbit(sc); goto fail; } - for (i = 0x8000; i; i >>= 1) { - if (!ack) { - if (dc_mii_readbit(sc)) - frame->mii_data |= i; - } + if (dc_mii_readbit(sc)) + frame->mii_data |= i; } fail: + /* Clock the idle bits. */ dc_mii_writebit(sc, 0); dc_mii_writebit(sc, 0); - if (ack) + if (frame->mii_turnaround != 0) return (1); return (0); } @@ -736,7 +745,6 @@ dc_mii_writereg(struct dc_softc *sc, str /* * Set up frame for TX. */ - frame->mii_stdelim = DC_MII_STARTDELIM; frame->mii_opcode = DC_MII_WRITEOP; frame->mii_turnaround = DC_MII_TURNAROUND; @@ -753,7 +761,7 @@ dc_mii_writereg(struct dc_softc *sc, str dc_mii_send(sc, frame->mii_turnaround, 2); dc_mii_send(sc, frame->mii_data, 16); - /* Idle bit. */ + /* Clock the idle bits. */ dc_mii_writebit(sc, 0); dc_mii_writebit(sc, 0); Modified: stable/7/sys/dev/dc/if_dcreg.h ============================================================================== --- stable/7/sys/dev/dc/if_dcreg.h Mon Dec 15 20:40:06 2008 (r186136) +++ stable/7/sys/dev/dc/if_dcreg.h Mon Dec 15 21:36:14 2008 (r186137) @@ -791,6 +791,9 @@ struct dc_softc { #define CSR_READ_4(sc, reg) \ bus_space_read_4(sc->dc_btag, sc->dc_bhandle, reg) +#define CSR_BARRIER_4(sc, reg, flags) \ + bus_space_barrier(sc->dc_btag, sc->dc_bhandle, reg, 4, flags) + #define DC_TIMEOUT 1000 #define ETHER_ALIGN 2 From ru at FreeBSD.org Tue Dec 16 12:48:38 2008 From: ru at FreeBSD.org (Ruslan Ermilov) Date: Tue Dec 16 12:48:55 2008 Subject: svn commit: r186192 - releng/7.1/usr.bin/ipcs stable/7/usr.bin/ipcs Message-ID: <200812162048.mBGKmcaS047317@svn.freebsd.org> Author: ru Date: Tue Dec 16 20:48:38 2008 New Revision: 186192 URL: http://svn.freebsd.org/changeset/base/186192 Log: MFC: Fix printing of shared memory limits. Approved by: re (kib) Modified: stable/7/usr.bin/ipcs/ (props changed) stable/7/usr.bin/ipcs/ipcs.c Changes in other areas also in this revision: Modified: releng/7.1/usr.bin/ipcs/ (props changed) releng/7.1/usr.bin/ipcs/ipcs.c Modified: stable/7/usr.bin/ipcs/ipcs.c ============================================================================== --- stable/7/usr.bin/ipcs/ipcs.c Tue Dec 16 20:07:47 2008 (r186191) +++ stable/7/usr.bin/ipcs/ipcs.c Tue Dec 16 20:48:38 2008 (r186192) @@ -394,15 +394,15 @@ print_kshmtotal(struct shminfo shminfo) { printf("shminfo:\n"); - printf("\tshmmax: %12d\t(max shared memory segment size)\n", + printf("\tshmmax: %12lu\t(max shared memory segment size)\n", shminfo.shmmax); - printf("\tshmmin: %12d\t(min shared memory segment size)\n", + printf("\tshmmin: %12lu\t(min shared memory segment size)\n", shminfo.shmmin); - printf("\tshmmni: %12d\t(max number of shared memory identifiers)\n", + printf("\tshmmni: %12lu\t(max number of shared memory identifiers)\n", shminfo.shmmni); - printf("\tshmseg: %12d\t(max shared memory segments per process)\n", + printf("\tshmseg: %12lu\t(max shared memory segments per process)\n", shminfo.shmseg); - printf("\tshmall: %12d\t(max amount of shared memory in pages)\n\n", + printf("\tshmall: %12lu\t(max amount of shared memory in pages)\n\n", shminfo.shmall); } From murray at FreeBSD.org Tue Dec 16 19:48:35 2008 From: murray at FreeBSD.org (Murray Stokely) Date: Tue Dec 16 19:48:47 2008 Subject: svn commit: r186205 - stable/7/release/doc/en_US.ISO8859-1/hardware Message-ID: <200812170348.mBH3mZ6m056498@svn.freebsd.org> Author: murray Date: Wed Dec 17 03:48:35 2008 New Revision: 186205 URL: http://svn.freebsd.org/changeset/base/186205 Log: MFC: r186204 Update the list of Intel chips with EM64T for FreeBSD/amd64 and increase the known maximum memory configuration from 8gb to 32gb. Approved by: re (hrs) Modified: stable/7/release/doc/en_US.ISO8859-1/hardware/article.sgml Modified: stable/7/release/doc/en_US.ISO8859-1/hardware/article.sgml ============================================================================== --- stable/7/release/doc/en_US.ISO8859-1/hardware/article.sgml Wed Dec 17 03:24:55 2008 (r186204) +++ stable/7/release/doc/en_US.ISO8859-1/hardware/article.sgml Wed Dec 17 03:48:35 2008 (r186205) @@ -92,21 +92,40 @@ - &intel; 64-bit &xeon; (Nocona). - This processor is fabricated on 90nm process technology, and operates - with 2.80 to 3.60 GHz (FSB 800MHz) and &intel; E7520/E7525/E7320 chipsets. + All multi-core &intel; &xeon; processors except + Sossaman have EM64T support. - &intel; &pentium; 4 Processor supporting &intel; EM64T - (Prescott). - This is fabricated on 90nm process technology, - uses FC-LGA775 package, and operates with 3.20F/3.40F/3.60F GHz - and &intel; 925X Express chipsets. - The corresponding S-Spec numbers are SL7L9, SL7L8, SL7LA, SL7NZ, SL7PZ, - and SL7PX. Note that processors marked as 5xx numbers do not support - EM64T. + The single-core &intel; &xeon; + processors Nocona, Irwindale, + Potomac, and Cranford have + EM64T support. + + + All &intel; Core 2 (not Core Duo) and later + processors + + + + All &intel; &pentium; D processors + + + + &intel; &pentium; 4s and Celeron Ds using + the Cedar Mill core have EM64T + support. + + + + Some &intel; &pentium; 4s and Celeron Ds using + the Prescott core have EM64T support. See + the Intel + Processor Spec Finder for the definitive answer about + EM64T support in Intel processors. + + &intel; EM64T is an extended version of IA-32 (x86) and @@ -115,7 +134,7 @@ 64-bit extension technology or IA-32e. The largest tested - memory configuration to date is 8GB. SMP support has been + memory configuration to date is 32GB. SMP support has been recently completed and is reasonably robust. In many respects, &os;/&arch.amd64; is similar to &os;/&arch.i386;, in From ume at FreeBSD.org Wed Dec 17 04:31:04 2008 From: ume at FreeBSD.org (Hajimu UMEMOTO) Date: Wed Dec 17 04:31:11 2008 Subject: svn commit: r186220 - in stable/7: include include/arpa lib/libc lib/libc/include/isc lib/libc/inet lib/libc/resolv Message-ID: <200812171231.mBHCV4bL003905@svn.freebsd.org> Author: ume Date: Wed Dec 17 12:31:04 2008 New Revision: 186220 URL: http://svn.freebsd.org/changeset/base/186220 Log: MFC 186090 Update our resolver to BIND 9.4.3. Merge the resolver part of BIND 9.4.3 into HEAD. It includes the following fix: 2426. [bug] libbind: inet_net_pton() can sometimes return the wrong value if excessively large netmasks are supplied. [RT #18512] Reported by: Maksymilian Arciemowicz Approved by: re (kib) Added: stable/7/lib/libc/include/isc/platform.h - copied unchanged from r186090, head/lib/libc/include/isc/platform.h Modified: stable/7/include/ (props changed) stable/7/include/arpa/nameser.h stable/7/include/resolv.h stable/7/lib/libc/ (props changed) stable/7/lib/libc/include/isc/eventlib.h (contents, props changed) stable/7/lib/libc/inet/inet_net_pton.c stable/7/lib/libc/resolv/res_debug.c stable/7/lib/libc/resolv/res_mkquery.c stable/7/lib/libc/resolv/res_query.c stable/7/lib/libc/resolv/res_send.c Modified: stable/7/include/arpa/nameser.h ============================================================================== --- stable/7/include/arpa/nameser.h Wed Dec 17 10:49:03 2008 (r186219) +++ stable/7/include/arpa/nameser.h Wed Dec 17 12:31:04 2008 (r186220) @@ -49,7 +49,7 @@ */ /* - * $Id: nameser.h,v 1.7.18.1 2005/04/27 05:00:50 sra Exp $ + * $Id: nameser.h,v 1.7.18.2 2008/04/03 23:15:15 marka Exp $ * $FreeBSD$ */ @@ -424,9 +424,10 @@ typedef enum __ns_cert_types { #define NS_NXT_MAX 127 /*% - * EDNS0 extended flags, host order. + * EDNS0 extended flags and option codes, host order. */ #define NS_OPT_DNSSEC_OK 0x8000U +#define NS_OPT_NSID 3 /*% * Inline versions of get/put short/long. Pointer is advanced. Modified: stable/7/include/resolv.h ============================================================================== --- stable/7/include/resolv.h Wed Dec 17 10:49:03 2008 (r186219) +++ stable/7/include/resolv.h Wed Dec 17 12:31:04 2008 (r186220) @@ -50,7 +50,7 @@ /*% * @(#)resolv.h 8.1 (Berkeley) 6/2/93 - * $Id: resolv.h,v 1.19.18.3 2005/08/25 04:43:51 marka Exp $ + * $Id: resolv.h,v 1.19.18.4 2008/04/03 23:15:15 marka Exp $ * $FreeBSD$ */ @@ -245,6 +245,7 @@ union res_sockaddr_union { #define RES_NOCHECKNAME 0x00008000 /*%< do not check names for sanity. */ #define RES_KEEPTSIG 0x00010000 /*%< do not strip TSIG records */ #define RES_BLAST 0x00020000 /*%< blast all recursive servers */ +#define RES_NSID 0x00040000 /*%< request name server ID */ #define RES_NOTLDQUERY 0x00100000 /*%< don't unqualified name as a tld */ #define RES_USE_DNSSEC 0x00200000 /*%< use DNSSEC using OK bit in OPT */ /* #define RES_DEBUG2 0x00400000 */ /* nslookup internal */ @@ -386,6 +387,7 @@ extern const struct res_sym __p_rcode_sy #define sym_ntos __sym_ntos #define sym_ston __sym_ston #define res_nopt __res_nopt +#define res_nopt_rdata __res_nopt_rdata #define res_ndestroy __res_ndestroy #define res_nametoclass __res_nametoclass #define res_nametotype __res_nametotype @@ -474,6 +476,8 @@ int res_findzonecut2(res_state, const c union res_sockaddr_union *, int); void res_nclose(res_state); int res_nopt(res_state, int, u_char *, int, int); +int res_nopt_rdata(res_state, int, u_char *, int, u_char *, + u_short, u_short, u_char *); void res_send_setqhook(res_send_qhook); void res_send_setrhook(res_send_rhook); int __res_vinit(res_state, int); Modified: stable/7/lib/libc/include/isc/eventlib.h ============================================================================== --- stable/7/lib/libc/include/isc/eventlib.h Wed Dec 17 10:49:03 2008 (r186219) +++ stable/7/lib/libc/include/isc/eventlib.h Wed Dec 17 12:31:04 2008 (r186220) @@ -18,7 +18,7 @@ /* eventlib.h - exported interfaces for eventlib * vix 09sep95 [initial] * - * $Id: eventlib.h,v 1.3.18.2 2005/07/28 07:38:07 marka Exp $ + * $Id: eventlib.h,v 1.3.18.3 2008/01/23 02:12:01 marka Exp $ */ #ifndef _EVENTLIB_H @@ -29,6 +29,8 @@ #include #include +#include + #ifndef __P # define __EVENTLIB_P_DEFINED # ifdef __STDC__ Copied: stable/7/lib/libc/include/isc/platform.h (from r186090, head/lib/libc/include/isc/platform.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/lib/libc/include/isc/platform.h Wed Dec 17 12:31:04 2008 (r186220, copy of r186090, head/lib/libc/include/isc/platform.h) @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2008 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +/* $Id: platform.h.in,v 1.2.6.2 2008/01/23 02:15:02 tbox Exp $ */ +/* $FreeBSD$ */ + +/*! \file */ + +#ifndef ISC_PLATFORM_H +#define ISC_PLATFORM_H + +/* + * Define if the OS does not define struct timespec. + */ +#undef ISC_PLATFORM_NEEDTIMESPEC +#ifdef ISC_PLATFORM_NEEDTIMESPEC +#include /* For time_t */ +struct timespec { + time_t tv_sec; /* seconds */ + long tv_nsec; /* nanoseconds */ +}; +#endif + +#endif Modified: stable/7/lib/libc/inet/inet_net_pton.c ============================================================================== --- stable/7/lib/libc/inet/inet_net_pton.c Wed Dec 17 10:49:03 2008 (r186219) +++ stable/7/lib/libc/inet/inet_net_pton.c Wed Dec 17 12:31:04 2008 (r186220) @@ -16,7 +16,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static const char rcsid[] = "$Id: inet_net_pton.c,v 1.7.18.1 2005/04/27 05:00:53 sra Exp $"; +static const char rcsid[] = "$Id: inet_net_pton.c,v 1.7.18.2 2008/08/26 04:42:43 marka Exp $"; #endif #include __FBSDID("$FreeBSD$"); @@ -135,11 +135,11 @@ inet_net_pton_ipv4(const char *src, u_ch assert(n >= 0 && n <= 9); bits *= 10; bits += n; + if (bits > 32) + goto enoent; } while ((ch = *src++) != '\0' && isascii(ch) && isdigit(ch)); if (ch != '\0') goto enoent; - if (bits > 32) - goto emsgsize; } /* Firey death and destruction unless we prefetched EOS. */ Modified: stable/7/lib/libc/resolv/res_debug.c ============================================================================== --- stable/7/lib/libc/resolv/res_debug.c Wed Dec 17 10:49:03 2008 (r186219) +++ stable/7/lib/libc/resolv/res_debug.c Wed Dec 17 12:31:04 2008 (r186220) @@ -91,7 +91,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static const char sccsid[] = "@(#)res_debug.c 8.1 (Berkeley) 6/4/93"; -static const char rcsid[] = "$Id: res_debug.c,v 1.10.18.5 2005/07/28 07:38:11 marka Exp $"; +static const char rcsid[] = "$Id: res_debug.c,v 1.10.18.6 2008/04/03 23:15:15 marka Exp $"; #endif /* LIBC_SCCS and not lint */ #include __FBSDID("$FreeBSD$"); @@ -187,10 +187,56 @@ do_section(const res_state statp, p_type(ns_rr_type(rr)), p_class(ns_rr_class(rr))); else if (section == ns_s_ar && ns_rr_type(rr) == ns_t_opt) { + u_int16_t optcode, optlen, rdatalen = ns_rr_rdlen(rr); u_int32_t ttl = ns_rr_ttl(rr); + fprintf(file, "; EDNS: version: %u, udp=%u, flags=%04x\n", (ttl>>16)&0xff, ns_rr_class(rr), ttl&0xffff); + + while (rdatalen >= 4) { + const u_char *cp = ns_rr_rdata(rr); + int i; + + GETSHORT(optcode, cp); + GETSHORT(optlen, cp); + + if (optcode == NS_OPT_NSID) { + fputs("; NSID: ", file); + if (optlen == 0) { + fputs("; NSID\n", file); + } else { + fputs("; NSID: ", file); + for (i = 0; i < optlen; i++) + fprintf(file, "%02x ", + cp[i]); + fputs(" (",file); + for (i = 0; i < optlen; i++) + fprintf(file, "%c", + isprint(cp[i])? + cp[i] : '.'); + fputs(")\n", file); + } + } else { + if (optlen == 0) { + fprintf(file, "; OPT=%u\n", + optcode); + } else { + fprintf(file, "; OPT=%u: ", + optcode); + for (i = 0; i < optlen; i++) + fprintf(file, "%02x ", + cp[i]); + fputs(" (",file); + for (i = 0; i < optlen; i++) + fprintf(file, "%c", + isprint(cp[i]) ? + cp[i] : '.'); + fputs(")\n", file); + } + } + rdatalen -= 4 + optlen; + } } else { n = ns_sprintrr(handle, &rr, NULL, NULL, buf, buflen); @@ -202,7 +248,7 @@ do_section(const res_state statp, buf = malloc(buflen += 1024); if (buf == NULL) { fprintf(file, - ";; memory allocation failure\n"); + ";; memory allocation failure\n"); return; } continue; @@ -379,7 +425,7 @@ static const struct res_sym __p_default_ {ns_s_an, "ANSWER", (char *)0}, {ns_s_ns, "AUTHORITY", (char *)0}, {ns_s_ar, "ADDITIONAL", (char *)0}, - {0, (char *)0, (char *)0} + {0, (char *)0, (char *)0} }; static const struct res_sym __p_update_section_syms[] = { @@ -387,7 +433,7 @@ static const struct res_sym __p_update_s {S_PREREQ, "PREREQUISITE", (char *)0}, {S_UPDATE, "UPDATE", (char *)0}, {S_ADDT, "ADDITIONAL", (char *)0}, - {0, (char *)0, (char *)0} + {0, (char *)0, (char *)0} }; const struct res_sym __p_key_syms[] = { @@ -615,6 +661,7 @@ p_option(u_long option) { case RES_USE_INET6: return "inet6"; #ifdef RES_USE_EDNS0 /*%< KAME extension */ case RES_USE_EDNS0: return "edns0"; + case RES_NSID: return "nsid"; #endif #ifdef RES_USE_DNAME case RES_USE_DNAME: return "dname"; Modified: stable/7/lib/libc/resolv/res_mkquery.c ============================================================================== --- stable/7/lib/libc/resolv/res_mkquery.c Wed Dec 17 10:49:03 2008 (r186219) +++ stable/7/lib/libc/resolv/res_mkquery.c Wed Dec 17 12:31:04 2008 (r186220) @@ -66,7 +66,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static const char sccsid[] = "@(#)res_mkquery.c 8.1 (Berkeley) 6/4/93"; -static const char rcsid[] = "$Id: res_mkquery.c,v 1.5.18.1 2005/04/27 05:01:11 sra Exp $"; +static const char rcsid[] = "$Id: res_mkquery.c,v 1.5.18.2 2008/04/03 23:15:15 marka Exp $"; #endif /* LIBC_SCCS and not lint */ #include __FBSDID("$FreeBSD$"); @@ -201,9 +201,6 @@ res_nmkquery(res_state statp, #ifdef RES_USE_EDNS0 /* attach OPT pseudo-RR, as documented in RFC2671 (EDNS0). */ -#ifndef T_OPT -#define T_OPT 41 -#endif int res_nopt(res_state statp, @@ -228,15 +225,16 @@ res_nopt(res_state statp, if ((ep - cp) < 1 + RRFIXEDSZ) return (-1); - *cp++ = 0; /*%< "." */ - ns_put16(T_OPT, cp); /*%< TYPE */ + *cp++ = 0; /*%< "." */ + ns_put16(ns_t_opt, cp); /*%< TYPE */ cp += INT16SZ; if (anslen > 0xffff) anslen = 0xffff; /* limit to 16bit value */ - ns_put16(anslen & 0xffff, cp); /*%< CLASS = UDP payload size */ + ns_put16(anslen & 0xffff, cp); /*%< CLASS = UDP payload size */ cp += INT16SZ; - *cp++ = NOERROR; /*%< extended RCODE */ - *cp++ = 0; /*%< EDNS version */ + *cp++ = NOERROR; /*%< extended RCODE */ + *cp++ = 0; /*%< EDNS version */ + if (statp->options & RES_USE_DNSSEC) { #ifdef DEBUG if (statp->options & RES_DEBUG) @@ -246,12 +244,60 @@ res_nopt(res_state statp, } ns_put16(flags, cp); cp += INT16SZ; - ns_put16(0, cp); /*%< RDLEN */ + + ns_put16(0U, cp); /*%< RDLEN */ cp += INT16SZ; + hp->arcount = htons(ntohs(hp->arcount) + 1); return (cp - buf); } + +/* + * Construct variable data (RDATA) block for OPT psuedo-RR, append it + * to the buffer, then update the RDLEN field (previously set to zero by + * res_nopt()) with the new RDATA length. + */ +int +res_nopt_rdata(res_state statp, + int n0, /*%< current offset in buffer */ + u_char *buf, /*%< buffer to put query */ + int buflen, /*%< size of buffer */ + u_char *rdata, /*%< ptr to start of opt rdata */ + u_short code, /*%< OPTION-CODE */ + u_short len, /*%< OPTION-LENGTH */ + u_char *data) /*%< OPTION_DATA */ +{ + register u_char *cp, *ep; + +#ifdef DEBUG + if ((statp->options & RES_DEBUG) != 0U) + printf(";; res_nopt_rdata()\n"); +#endif + + cp = buf + n0; + ep = buf + buflen; + + if ((ep - cp) < (4 + len)) + return (-1); + + if (rdata < (buf + 2) || rdata >= ep) + return (-1); + + ns_put16(code, cp); + cp += INT16SZ; + + ns_put16(len, cp); + cp += INT16SZ; + + memcpy(cp, data, len); + cp += len; + + len = cp - rdata; + ns_put16(len, rdata - 2); /* Update RDLEN field */ + + return (cp - buf); +} #endif /*! \file */ Modified: stable/7/lib/libc/resolv/res_query.c ============================================================================== --- stable/7/lib/libc/resolv/res_query.c Wed Dec 17 10:49:03 2008 (r186219) +++ stable/7/lib/libc/resolv/res_query.c Wed Dec 17 12:31:04 2008 (r186220) @@ -66,7 +66,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static const char sccsid[] = "@(#)res_query.c 8.1 (Berkeley) 6/4/93"; -static const char rcsid[] = "$Id: res_query.c,v 1.7.18.1 2005/04/27 05:01:11 sra Exp $"; +static const char rcsid[] = "$Id: res_query.c,v 1.7.18.2 2008/04/03 23:15:15 marka Exp $"; #endif /* LIBC_SCCS and not lint */ #include __FBSDID("$FreeBSD$"); @@ -115,8 +115,9 @@ res_nquery(res_state statp, { u_char buf[MAXPACKET]; HEADER *hp = (HEADER *) answer; - int n; u_int oflags; + u_char *rdata; + int n; oflags = statp->_flags; @@ -131,8 +132,14 @@ again: buf, sizeof(buf)); #ifdef RES_USE_EDNS0 if (n > 0 && (statp->_flags & RES_F_EDNS0ERR) == 0 && - (statp->options & (RES_USE_EDNS0|RES_USE_DNSSEC)) != 0U) + (statp->options & (RES_USE_EDNS0|RES_USE_DNSSEC|RES_NSID))) { n = res_nopt(statp, n, buf, sizeof(buf), anslen); + rdata = &buf[n]; + if (n > 0 && (statp->options & RES_NSID) != 0U) { + n = res_nopt_rdata(statp, n, buf, sizeof(buf), rdata, + NS_OPT_NSID, 0, NULL); + } + } #endif if (n <= 0) { #ifdef DEBUG @@ -142,6 +149,7 @@ again: RES_SET_H_ERRNO(statp, NO_RECOVERY); return (n); } + n = res_nsend(statp, buf, n, answer, anslen); if (n < 0) { #ifdef RES_USE_EDNS0 Modified: stable/7/lib/libc/resolv/res_send.c ============================================================================== --- stable/7/lib/libc/resolv/res_send.c Wed Dec 17 10:49:03 2008 (r186219) +++ stable/7/lib/libc/resolv/res_send.c Wed Dec 17 12:31:04 2008 (r186220) @@ -66,7 +66,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static const char sccsid[] = "@(#)res_send.c 8.1 (Berkeley) 6/4/93"; -static const char rcsid[] = "$Id: res_send.c,v 1.9.18.8 2006/10/16 23:00:58 marka Exp $"; +static const char rcsid[] = "$Id: res_send.c,v 1.9.18.10 2008/01/27 02:06:26 marka Exp $"; #endif /* LIBC_SCCS and not lint */ #include __FBSDID("$FreeBSD$"); @@ -302,7 +302,7 @@ int res_nsend(res_state statp, const u_char *buf, int buflen, u_char *ans, int anssiz) { - int gotsomewhere, terrno, try, v_circuit, resplen, ns, n; + int gotsomewhere, terrno, tries, v_circuit, resplen, ns, n; #ifdef USE_KQUEUE int kq; #endif @@ -420,7 +420,7 @@ res_nsend(res_state statp, /* * Send request, RETRY times, or until successful. */ - for (try = 0; try < statp->retry; try++) { + for (tries = 0; tries < statp->retry; tries++) { for (ns = 0; ns < statp->nscount; ns++) { struct sockaddr *nsap; int nsaplen; @@ -471,7 +471,7 @@ res_nsend(res_state statp, if (v_circuit) { /* Use VC; at most one attempt per server. */ - try = statp->retry; + tries = statp->retry; n = send_vc(statp, buf, buflen, ans, anssiz, &terrno, ns); if (n < 0) @@ -486,7 +486,7 @@ res_nsend(res_state statp, kq, #endif buf, buflen, ans, anssiz, &terrno, - ns, try, &v_circuit, &gotsomewhere); + ns, tries, &v_circuit, &gotsomewhere); if (n < 0) goto fail; if (n == 0) @@ -632,6 +632,9 @@ send_vc(res_state statp, u_short len; u_char *cp; void *tmp; +#ifdef SO_NOSIGPIPE + int on = 1; +#endif nsap = get_nsaddr(statp, ns); nsaplen = get_salen(nsap); @@ -679,6 +682,17 @@ send_vc(res_state statp, return (-1); } } +#ifdef SO_NOSIGPIPE + /* + * Disable generation of SIGPIPE when writing to a closed + * socket. Write should return -1 and set errno to EPIPE + * instead. + * + * Push on even if setsockopt(SO_NOSIGPIPE) fails. + */ + (void)_setsockopt(statp->_vcsock, SOL_SOCKET, SO_NOSIGPIPE, &on, + sizeof(on)); +#endif errno = 0; if (_connect(statp->_vcsock, nsap, nsaplen) < 0) { *terrno = errno; @@ -811,7 +825,7 @@ send_dg(res_state statp, int kq, #endif const u_char *buf, int buflen, u_char *ans, - int anssiz, int *terrno, int ns, int try, int *v_circuit, + int anssiz, int *terrno, int ns, int tries, int *v_circuit, int *gotsomewhere) { const HEADER *hp = (const HEADER *) buf; @@ -915,7 +929,7 @@ send_dg(res_state statp, /* * Wait for reply. */ - seconds = (statp->retrans << try); + seconds = (statp->retrans << tries); if (ns > 0) seconds /= statp->nscount; if (seconds <= 0) From ambrisko at FreeBSD.org Wed Dec 17 09:37:54 2008 From: ambrisko at FreeBSD.org (Doug Ambrisko) Date: Wed Dec 17 09:38:11 2008 Subject: svn commit: r186238 - in stable/7/sys: . dev/mfi Message-ID: <200812171737.mBHHbsjs010394@svn.freebsd.org> Author: ambrisko Date: Wed Dec 17 17:37:54 2008 New Revision: 186238 URL: http://svn.freebsd.org/changeset/base/186238 Log: MFC: r185584,185994,185999,186132 which updates the strings that identifies the new supported HW and bump the driver version number. Submitted by: LSI Approved by: re (kib) Modified: stable/7/sys/ (props changed) stable/7/sys/dev/mfi/mfi.c stable/7/sys/dev/mfi/mfi_pci.c Modified: stable/7/sys/dev/mfi/mfi.c ============================================================================== --- stable/7/sys/dev/mfi/mfi.c Wed Dec 17 17:35:14 2008 (r186237) +++ stable/7/sys/dev/mfi/mfi.c Wed Dec 17 17:37:54 2008 (r186238) @@ -296,7 +296,8 @@ mfi_attach(struct mfi_softc *sc) uint32_t status; int error, commsz, framessz, sensesz; int frames, unit, max_fw_sge; - device_printf(sc->mfi_dev, "Megaraid SAS driver Ver 2.00 \n"); + + device_printf(sc->mfi_dev, "Megaraid SAS driver Ver 3.00 \n"); mtx_init(&sc->mfi_io_lock, "MFI I/O lock", NULL, MTX_DEF); sx_init(&sc->mfi_config_lock, "MFI config"); Modified: stable/7/sys/dev/mfi/mfi_pci.c ============================================================================== --- stable/7/sys/dev/mfi/mfi_pci.c Wed Dec 17 17:35:14 2008 (r186237) +++ stable/7/sys/dev/mfi/mfi_pci.c Wed Dec 17 17:37:54 2008 (r186238) @@ -114,18 +114,21 @@ struct mfi_ident { int flags; const char *desc; } mfi_identifiers[] = { - {0x1000, 0x0411, 0xffff, 0xffff, MFI_FLAGS_1064R, "LSI MegaSAS 1064R"}, /* Brocton IOP */ - {0x1000, 0x0413, 0xffff, 0xffff, MFI_FLAGS_1064R, "LSI MegaSAS 1064R"}, /* Verde ZCR */ - {0x1028, 0x0015, 0xffff, 0xffff, MFI_FLAGS_1064R, "Dell PERC 5/i"}, {0x1000, 0x0060, 0x1028, 0xffff, MFI_FLAGS_1078, "Dell PERC 6"}, - {0x1000, 0x0060, 0xffff, 0xffff, MFI_FLAGS_1078, "LSI MegaSAS 1078"}, - {0x1000, 0x0079, 0x1028, 0x1f15, MFI_FLAGS_GEN2, "Dell PERC 607E Adapter"}, - {0x1000, 0x0079, 0x1028, 0x1f16, MFI_FLAGS_GEN2, "Dell PERC 607I Adapter"}, - {0x1000, 0x0079, 0x1028, 0x1f17, MFI_FLAGS_GEN2, "Dell PERC 607I Integrated"}, - {0x1000, 0x0079, 0x1028, 0x1f18, MFI_FLAGS_GEN2, "Dell PERC 607I Modular"}, + {0x1000, 0x0060, 0xffff, 0xffff, MFI_FLAGS_1078, "LSI MegaSAS 1078"}, {0x1000, 0x0078, 0xffff, 0xffff, MFI_FLAGS_GEN2, "LSI MegaSAS Gen2"}, + {0x1000, 0x0079, 0x1028, 0x1f15, MFI_FLAGS_GEN2, "Dell PERC H800 Adapter"}, + {0x1000, 0x0079, 0x1028, 0x1f16, MFI_FLAGS_GEN2, "Dell PERC H700 Adapter"}, + {0x1000, 0x0079, 0x1028, 0x1f17, MFI_FLAGS_GEN2, "Dell PERC H700 Integrated"}, + {0x1000, 0x0079, 0x1028, 0x1f18, MFI_FLAGS_GEN2, "Dell PERC H700 Modular"}, + {0x1000, 0x0079, 0x1028, 0x1f19, MFI_FLAGS_GEN2, "Dell PERC H700"}, + {0x1000, 0x0079, 0x1028, 0x1f1b, MFI_FLAGS_GEN2, "Dell PERC H800"}, + {0x1000, 0x0079, 0x1028, 0xffff, MFI_FLAGS_GEN2, "Dell PERC Gen2"}, {0x1000, 0x0079, 0xffff, 0xffff, MFI_FLAGS_GEN2, "LSI MegaSAS Gen2"}, {0x1000, 0x007c, 0xffff, 0xffff, MFI_FLAGS_1078, "LSI MegaSAS 1078"}, + {0x1000, 0x0411, 0xffff, 0xffff, MFI_FLAGS_1064R, "LSI MegaSAS 1064R"}, /* Brocton IOP */ + {0x1000, 0x0413, 0xffff, 0xffff, MFI_FLAGS_1064R, "LSI MegaSAS 1064R"}, /* Verde ZCR */ + {0x1028, 0x0015, 0xffff, 0xffff, MFI_FLAGS_1064R, "Dell PERC 5/i"}, {0, 0, 0, 0, 0, NULL} }; From delphij at FreeBSD.org Thu Dec 18 16:14:45 2008 From: delphij at FreeBSD.org (Xin LI) Date: Thu Dec 18 16:15:03 2008 Subject: svn commit: r186303 - in stable/7/sys: . contrib/pf dev/bce dev/cxgb Message-ID: <200812190014.mBJ0EjGU056009@svn.freebsd.org> Author: delphij Date: Fri Dec 19 00:14:45 2008 New Revision: 186303 URL: http://svn.freebsd.org/changeset/base/186303 Log: MFC r186168: Test whether sc->tx_mbuf_map[i], not whether sc->tx_mbuf_map is NULL before doing bus_dmamap_sync() since it operates on the former, not the latter. Approved by: re (kensmith) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/bce/if_bce.c stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/dev/bce/if_bce.c ============================================================================== --- stable/7/sys/dev/bce/if_bce.c Thu Dec 18 23:00:09 2008 (r186302) +++ stable/7/sys/dev/bce/if_bce.c Fri Dec 19 00:14:45 2008 (r186303) @@ -5114,7 +5114,7 @@ bce_free_tx_chain(struct bce_softc *sc) /* Unmap, unload, and free any mbufs still in the TX mbuf chain. */ for (i = 0; i < TOTAL_TX_BD; i++) { if (sc->tx_mbuf_ptr[i] != NULL) { - if (sc->tx_mbuf_map != NULL) + if (sc->tx_mbuf_map[i] != NULL) bus_dmamap_sync(sc->tx_mbuf_tag, sc->tx_mbuf_map[i], BUS_DMASYNC_POSTWRITE); m_freem(sc->tx_mbuf_ptr[i]); From delphij at FreeBSD.org Thu Dec 18 16:17:09 2008 From: delphij at FreeBSD.org (Xin LI) Date: Thu Dec 18 16:17:26 2008 Subject: svn commit: r186304 - in stable/7/sys: . contrib/pf dev/bce dev/cxgb Message-ID: <200812190017.mBJ0H9j1056110@svn.freebsd.org> Author: delphij Date: Fri Dec 19 00:17:09 2008 New Revision: 186304 URL: http://svn.freebsd.org/changeset/base/186304 Log: MFC r186169: Don't count InFramesL2FilterDiscards into Ierr. This value does not represent a real packet error but simply indicate that an unexpected unicast or multicast error was received by the NIC, which was not counted in the past as well. Reported by: many (on -stable@) Reviewed by: davidch Approved by: re (kensmith) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/bce/if_bce.c stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/dev/bce/if_bce.c ============================================================================== --- stable/7/sys/dev/bce/if_bce.c Fri Dec 19 00:14:45 2008 (r186303) +++ stable/7/sys/dev/bce/if_bce.c Fri Dec 19 00:17:09 2008 (r186304) @@ -7408,7 +7408,6 @@ bce_stats_update(struct bce_softc *sc) (u_long) sc->stat_IfInMBUFDiscards + (u_long) sc->stat_Dot3StatsAlignmentErrors + (u_long) sc->stat_Dot3StatsFCSErrors + - (u_long) sc->stat_IfInFramesL2FilterDiscards + (u_long) sc->stat_IfInRuleCheckerDiscards + (u_long) sc->stat_IfInFTQDiscards + (u_long) sc->com_no_buffers; From kensmith at FreeBSD.org Thu Dec 18 19:59:22 2008 From: kensmith at FreeBSD.org (Ken Smith) Date: Thu Dec 18 19:59:33 2008 Subject: svn commit: r186309 - in stable/7/sys: . contrib/pf dev/cxgb nfsserver Message-ID: <200812190359.mBJ3xLov060881@svn.freebsd.org> Author: kensmith Date: Fri Dec 19 03:59:20 2008 New Revision: 186309 URL: http://svn.freebsd.org/changeset/base/186309 Log: MFC r186165: > Handle VFS_VGET() failing with an error other than EOPNOTSUPP in addition > to failing with that error. > > PR: 125149 > Submitted by: Jaakko Heinonen (jh saunalahti fi) > Reviewed by: mohans, kan Approved by: re (kib) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/nfsserver/nfs_serv.c Modified: stable/7/sys/nfsserver/nfs_serv.c ============================================================================== --- stable/7/sys/nfsserver/nfs_serv.c Fri Dec 19 01:37:20 2008 (r186308) +++ stable/7/sys/nfsserver/nfs_serv.c Fri Dec 19 03:59:20 2008 (r186309) @@ -3600,9 +3600,12 @@ again: * Probe one of the directory entries to see if the filesystem * supports VGET. */ - if (VFS_VGET(vp->v_mount, dp->d_fileno, LK_EXCLUSIVE, &nvp) == - EOPNOTSUPP) { - error = NFSERR_NOTSUPP; + error = VFS_VGET(vp->v_mount, dp->d_fileno, LK_EXCLUSIVE, &nvp); + if (error) { + if (error == EOPNOTSUPP) + error = NFSERR_NOTSUPP; + else + error = NFSERR_SERVERFAULT; vrele(vp); vp = NULL; free((caddr_t)cookies, M_TEMP); From kmacy at FreeBSD.org Thu Dec 18 22:33:18 2008 From: kmacy at FreeBSD.org (Kip Macy) Date: Thu Dec 18 22:33:25 2008 Subject: svn commit: r186312 - stable/7/share/man/man4 Message-ID: <200812190633.mBJ6XIqq063914@svn.freebsd.org> Author: kmacy Date: Fri Dec 19 06:33:18 2008 New Revision: 186312 URL: http://svn.freebsd.org/changeset/base/186312 Log: MFC 185970 fix support and capabilities Approved by: re Modified: stable/7/share/man/man4/cxgb.4 Modified: stable/7/share/man/man4/cxgb.4 ============================================================================== --- stable/7/share/man/man4/cxgb.4 Fri Dec 19 05:05:35 2008 (r186311) +++ stable/7/share/man/man4/cxgb.4 Fri Dec 19 06:33:18 2008 (r186312) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2007, Chelsio Inc +.\" Copyright (c) 2007-2008, Chelsio Inc .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -56,7 +56,8 @@ if_cxgb_load="YES" The .Nm driver supports Transmit/Receive checksum offload, -Jumbo Frames as well as TCP segmentation offload (TSO). +Jumbo Frames, TCP segmentation offload (TSO), Large Receive Offload (LRO), +VLAN hardware insertion / extraction, and VLAN checksum offload. For further hardware information, see .Pa http://www.chelsio.com/ . .Pp @@ -76,7 +77,7 @@ For more information on configuring this .Sh HARDWARE The .Nm -driver supports 10 Gigabit Ethernet adapters based on the T3 and T3B chipset: +driver supports 10 Gigabit and 1 Gigabit Ethernet adapters based on the T3 and T3B chipset: .Pp .Bl -bullet -compact .It @@ -111,7 +112,7 @@ go to the Chelsio support website at: If an issue is identified with the released source code on the supported kernel with a supported adapter, email the specific information related to the issue to -.Aq help@chelsio.com . +.Aq support@chelsio.com . .Sh SEE ALSO .Xr altq 4 , .Xr arp 4 , From kib at FreeBSD.org Fri Dec 19 06:47:39 2008 From: kib at FreeBSD.org (Konstantin Belousov) Date: Fri Dec 19 06:47:50 2008 Subject: svn commit: r186321 - in stable/7/sys: . contrib/pf dev/cxgb kern Message-ID: <200812191447.mBJElcEI074631@svn.freebsd.org> Author: kib Date: Fri Dec 19 14:47:38 2008 New Revision: 186321 URL: http://svn.freebsd.org/changeset/base/186321 Log: MFC r185764: Do drop vm map lock earlier in the sysctl_kern_proc_vmmap(), to avoid locking a vnode while having vm map locked. Approved by: re (kensmith) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/kern/kern_proc.c Modified: stable/7/sys/kern/kern_proc.c ============================================================================== --- stable/7/sys/kern/kern_proc.c Fri Dec 19 14:33:29 2008 (r186320) +++ stable/7/sys/kern/kern_proc.c Fri Dec 19 14:47:38 2008 (r186321) @@ -1413,13 +1413,32 @@ sysctl_kern_proc_ovmmap(SYSCTL_HANDLER_A lobj = tobj; } + kve->kve_start = (void*)entry->start; + kve->kve_end = (void*)entry->end; + kve->kve_offset = (off_t)entry->offset; + + if (entry->protection & VM_PROT_READ) + kve->kve_protection |= KVME_PROT_READ; + if (entry->protection & VM_PROT_WRITE) + kve->kve_protection |= KVME_PROT_WRITE; + if (entry->protection & VM_PROT_EXECUTE) + kve->kve_protection |= KVME_PROT_EXEC; + + if (entry->eflags & MAP_ENTRY_COW) + kve->kve_flags |= KVME_FLAG_COW; + if (entry->eflags & MAP_ENTRY_NEEDS_COPY) + kve->kve_flags |= KVME_FLAG_NEEDS_COPY; + + last_timestamp = map->timestamp; + vm_map_unlock_read(map); + kve->kve_fileid = 0; kve->kve_fsid = 0; freepath = NULL; fullpath = ""; if (lobj) { vp = NULL; - switch(lobj->type) { + switch (lobj->type) { case OBJT_DEFAULT: kve->kve_type = KVME_TYPE_DEFAULT; break; @@ -1470,28 +1489,10 @@ sysctl_kern_proc_ovmmap(SYSCTL_HANDLER_A kve->kve_shadow_count = 0; } - kve->kve_start = (void*)entry->start; - kve->kve_end = (void*)entry->end; - kve->kve_offset = (off_t)entry->offset; - - if (entry->protection & VM_PROT_READ) - kve->kve_protection |= KVME_PROT_READ; - if (entry->protection & VM_PROT_WRITE) - kve->kve_protection |= KVME_PROT_WRITE; - if (entry->protection & VM_PROT_EXECUTE) - kve->kve_protection |= KVME_PROT_EXEC; - - if (entry->eflags & MAP_ENTRY_COW) - kve->kve_flags |= KVME_FLAG_COW; - if (entry->eflags & MAP_ENTRY_NEEDS_COPY) - kve->kve_flags |= KVME_FLAG_NEEDS_COPY; - strlcpy(kve->kve_path, fullpath, sizeof(kve->kve_path)); if (freepath != NULL) free(freepath, M_TEMP); - last_timestamp = map->timestamp; - vm_map_unlock_read(map); error = SYSCTL_OUT(req, kve, sizeof(*kve)); vm_map_lock_read(map); if (error) @@ -1578,13 +1579,32 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_AR lobj = tobj; } + kve->kve_start = entry->start; + kve->kve_end = entry->end; + kve->kve_offset = entry->offset; + + if (entry->protection & VM_PROT_READ) + kve->kve_protection |= KVME_PROT_READ; + if (entry->protection & VM_PROT_WRITE) + kve->kve_protection |= KVME_PROT_WRITE; + if (entry->protection & VM_PROT_EXECUTE) + kve->kve_protection |= KVME_PROT_EXEC; + + if (entry->eflags & MAP_ENTRY_COW) + kve->kve_flags |= KVME_FLAG_COW; + if (entry->eflags & MAP_ENTRY_NEEDS_COPY) + kve->kve_flags |= KVME_FLAG_NEEDS_COPY; + + last_timestamp = map->timestamp; + vm_map_unlock_read(map); + kve->kve_fileid = 0; kve->kve_fsid = 0; freepath = NULL; fullpath = ""; if (lobj) { vp = NULL; - switch(lobj->type) { + switch (lobj->type) { case OBJT_DEFAULT: kve->kve_type = KVME_TYPE_DEFAULT; break; @@ -1635,28 +1655,10 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_AR kve->kve_shadow_count = 0; } - kve->kve_start = entry->start; - kve->kve_end = entry->end; - kve->kve_offset = entry->offset; - - if (entry->protection & VM_PROT_READ) - kve->kve_protection |= KVME_PROT_READ; - if (entry->protection & VM_PROT_WRITE) - kve->kve_protection |= KVME_PROT_WRITE; - if (entry->protection & VM_PROT_EXECUTE) - kve->kve_protection |= KVME_PROT_EXEC; - - if (entry->eflags & MAP_ENTRY_COW) - kve->kve_flags |= KVME_FLAG_COW; - if (entry->eflags & MAP_ENTRY_NEEDS_COPY) - kve->kve_flags |= KVME_FLAG_NEEDS_COPY; - strlcpy(kve->kve_path, fullpath, sizeof(kve->kve_path)); if (freepath != NULL) free(freepath, M_TEMP); - last_timestamp = map->timestamp; - vm_map_unlock_read(map); /* Pack record size down */ kve->kve_structsize = offsetof(struct kinfo_vmentry, kve_path) + strlen(kve->kve_path) + 1; From kib at FreeBSD.org Fri Dec 19 07:04:27 2008 From: kib at FreeBSD.org (Konstantin Belousov) Date: Fri Dec 19 07:04:38 2008 Subject: svn commit: r186323 - in stable/7/sys: . compat/linprocfs contrib/pf dev/cxgb fs/procfs Message-ID: <200812191504.mBJF4Rje075062@svn.freebsd.org> Author: kib Date: Fri Dec 19 15:04:26 2008 New Revision: 186323 URL: http://svn.freebsd.org/changeset/base/186323 Log: MFC r185765, r185766: Make two style changes to create new commit and document proper commit message for r185765. Commit message for r185765 should be: In procfs map handler, and in linprocfs maps handler, do not call vn_fullpath() while having vm map locked. This is done in anticipation of the vop_vptocnp commit, that would make vn_fullpath sometime acquire vnode lock. Also, in linprocfs, maps handler already acquires vnode lock. MFC r185864: Relock user map earlier, to have the lock held when break leaves the loop earlier due to sbuf error. Approved by: re (kensmith) Modified: stable/7/sys/ (props changed) stable/7/sys/compat/linprocfs/linprocfs.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/fs/procfs/procfs_map.c Modified: stable/7/sys/compat/linprocfs/linprocfs.c ============================================================================== --- stable/7/sys/compat/linprocfs/linprocfs.c Fri Dec 19 14:49:14 2008 (r186322) +++ stable/7/sys/compat/linprocfs/linprocfs.c Fri Dec 19 15:04:26 2008 (r186323) @@ -269,8 +269,7 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) /* XXX per-cpu vendor / class / model / id? */ } - sbuf_cat(sb, - "flags\t\t:"); + sbuf_cat(sb, "flags\t\t:"); if (!strcmp(cpu_vendor, "AuthenticAMD") && (class < 6)) { flags[16] = "fcmov"; @@ -870,10 +869,12 @@ static int linprocfs_doprocmaps(PFS_FILL_ARGS) { vm_map_t map = &p->p_vmspace->vm_map; - vm_map_entry_t entry; + vm_map_entry_t entry, tmp_entry; vm_object_t obj, tobj, lobj; - vm_offset_t saved_end; + vm_offset_t e_start, e_end; vm_ooffset_t off = 0; + vm_prot_t e_prot; + unsigned int last_timestamp; char *name = "", *freename = NULL; ino_t ino; int ref_count, shadow_count, flags; @@ -899,7 +900,9 @@ linprocfs_doprocmaps(PFS_FILL_ARGS) freename = NULL; if (entry->eflags & MAP_ENTRY_IS_SUB_MAP) continue; - saved_end = entry->end; + e_prot = entry->protection; + e_start = entry->start; + e_end = entry->end; obj = entry->object.vm_object; for (lobj = tobj = obj; tobj; tobj = tobj->backing_object) { VM_OBJECT_LOCK(tobj); @@ -907,6 +910,8 @@ linprocfs_doprocmaps(PFS_FILL_ARGS) VM_OBJECT_UNLOCK(lobj); lobj = tobj; } + last_timestamp = map->timestamp; + vm_map_unlock_read(map); ino = 0; if (lobj) { off = IDX_TO_OFF(lobj->size); @@ -944,10 +949,10 @@ linprocfs_doprocmaps(PFS_FILL_ARGS) */ error = sbuf_printf(sb, "%08lx-%08lx %s%s%s%s %08lx %02x:%02x %lu%s%s\n", - (u_long)entry->start, (u_long)entry->end, - (entry->protection & VM_PROT_READ)?"r":"-", - (entry->protection & VM_PROT_WRITE)?"w":"-", - (entry->protection & VM_PROT_EXECUTE)?"x":"-", + (u_long)e_start, (u_long)e_end, + (e_prot & VM_PROT_READ)?"r":"-", + (e_prot & VM_PROT_WRITE)?"w":"-", + (e_prot & VM_PROT_EXECUTE)?"x":"-", "p", (u_long)off, 0, @@ -958,10 +963,20 @@ linprocfs_doprocmaps(PFS_FILL_ARGS) ); if (freename) free(freename, M_TEMP); + vm_map_lock_read(map); if (error == -1) { error = 0; break; } + if (last_timestamp + 1 != map->timestamp) { + /* + * Look again for the entry because the map was + * modified while it was unlocked. Specifically, + * the entry may have been clipped, merged, or deleted. + */ + vm_map_lookup_entry(map, e_end - 1, &tmp_entry); + entry = tmp_entry; + } } vm_map_unlock_read(map); Modified: stable/7/sys/fs/procfs/procfs_map.c ============================================================================== --- stable/7/sys/fs/procfs/procfs_map.c Fri Dec 19 14:49:14 2008 (r186322) +++ stable/7/sys/fs/procfs/procfs_map.c Fri Dec 19 15:04:26 2008 (r186323) @@ -82,11 +82,12 @@ extern struct sysentvec ia32_freebsd_sys int procfs_doprocmap(PFS_FILL_ARGS) { - int error, vfslocked; vm_map_t map = &p->p_vmspace->vm_map; - vm_map_entry_t entry; + vm_map_entry_t entry, tmp_entry; struct vnode *vp; char *fullpath, *freepath; + int error, vfslocked; + unsigned int last_timestamp; #ifdef COMPAT_IA32 int wrap32 = 0; #endif @@ -113,13 +114,19 @@ procfs_doprocmap(PFS_FILL_ARGS) entry = entry->next) { vm_object_t obj, tobj, lobj; int ref_count, shadow_count, flags; - vm_offset_t addr; + vm_offset_t e_start, e_end, addr; int resident, privateresident; char *type; + vm_eflags_t e_eflags; + vm_prot_t e_prot; if (entry->eflags & MAP_ENTRY_IS_SUB_MAP) continue; + e_eflags = entry->eflags; + e_prot = entry->protection; + e_start = entry->start; + e_end = entry->end; privateresident = 0; obj = entry->object.vm_object; if (obj != NULL) { @@ -143,11 +150,13 @@ procfs_doprocmap(PFS_FILL_ARGS) VM_OBJECT_UNLOCK(lobj); lobj = tobj; } + last_timestamp = map->timestamp; + vm_map_unlock_read(map); freepath = NULL; fullpath = "-"; if (lobj) { - switch(lobj->type) { + switch (lobj->type) { default: case OBJT_DEFAULT: type = "default"; @@ -194,28 +203,37 @@ procfs_doprocmap(PFS_FILL_ARGS) */ error = sbuf_printf(sb, "0x%lx 0x%lx %d %d %p %s%s%s %d %d 0x%x %s %s %s %s\n", - (u_long)entry->start, (u_long)entry->end, + (u_long)e_start, (u_long)e_end, resident, privateresident, #ifdef COMPAT_IA32 wrap32 ? NULL : obj, /* Hide 64 bit value */ #else obj, #endif - (entry->protection & VM_PROT_READ)?"r":"-", - (entry->protection & VM_PROT_WRITE)?"w":"-", - (entry->protection & VM_PROT_EXECUTE)?"x":"-", + (e_prot & VM_PROT_READ)?"r":"-", + (e_prot & VM_PROT_WRITE)?"w":"-", + (e_prot & VM_PROT_EXECUTE)?"x":"-", ref_count, shadow_count, flags, - (entry->eflags & MAP_ENTRY_COW)?"COW":"NCOW", - (entry->eflags & MAP_ENTRY_NEEDS_COPY)?"NC":"NNC", + (e_eflags & MAP_ENTRY_COW)?"COW":"NCOW", + (e_eflags & MAP_ENTRY_NEEDS_COPY)?"NC":"NNC", type, fullpath); if (freepath != NULL) free(freepath, M_TEMP); - + vm_map_lock_read(map); if (error == -1) { error = 0; break; } + if (last_timestamp + 1 != map->timestamp) { + /* + * Look again for the entry because the map was + * modified while it was unlocked. Specifically, + * the entry may have been clipped, merged, or deleted. + */ + vm_map_lookup_entry(map, e_end - 1, &tmp_entry); + entry = tmp_entry; + } } vm_map_unlock_read(map); return (error); From kib at FreeBSD.org Fri Dec 19 07:24:19 2008 From: kib at FreeBSD.org (Konstantin Belousov) Date: Fri Dec 19 07:24:30 2008 Subject: svn commit: r186324 - in stable/7/sys: . contrib/pf dev/cxgb kern Message-ID: <200812191524.mBJFOIMj075547@svn.freebsd.org> Author: kib Date: Fri Dec 19 15:24:18 2008 New Revision: 186324 URL: http://svn.freebsd.org/changeset/base/186324 Log: MFC r185983: The userland_sysctl() function retries sysctl_root() until returned error is not EAGAIN. Several sysctls that inspect another process use p_candebug() for checking access right for the curproc. p_candebug() returns EAGAIN for some reasons, in particular, for the process doing exec() now. If execing process tries to lock Giant, we get a livelock, because sysctl handlers are covered by Giant, and often do not sleep. Break the livelock by dropping Giant and allowing other threads to execute in the EAGAIN loop. This commit does not merge the following change, as was discussed with jhb: [Also, do not return EAGAIN from p_candebug() when process is executing, use more appropriate EBUSY error.] MFC r185987: Uio_yield() already does DROP_GIANT/PICKUP_GIANT, no need to repeat this around the call. Approved by: re (kensmith) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/kern/kern_sysctl.c Modified: stable/7/sys/kern/kern_sysctl.c ============================================================================== --- stable/7/sys/kern/kern_sysctl.c Fri Dec 19 15:04:26 2008 (r186323) +++ stable/7/sys/kern/kern_sysctl.c Fri Dec 19 15:24:18 2008 (r186324) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -1395,11 +1396,14 @@ userland_sysctl(struct thread *td, int * SYSCTL_LOCK(); - do { + for (;;) { req.oldidx = 0; req.newidx = 0; error = sysctl_root(0, name, namelen, &req); - } while (error == EAGAIN); + if (error != EAGAIN) + break; + uio_yield(); + } if (req.lock == REQ_WIRED && req.validlen > 0) vsunlock(req.oldptr, req.validlen); From kib at FreeBSD.org Fri Dec 19 07:32:49 2008 From: kib at FreeBSD.org (Konstantin Belousov) Date: Fri Dec 19 07:33:05 2008 Subject: svn commit: r186325 - in stable/7/sys: . compat/linprocfs contrib/pf dev/cxgb fs/procfs kern Message-ID: <200812191532.mBJFWmFr075735@svn.freebsd.org> Author: kib Date: Fri Dec 19 15:32:48 2008 New Revision: 186325 URL: http://svn.freebsd.org/changeset/base/186325 Log: MFC r185984: Reference the vmspace of the process being inspected by procfs, linprocfs and sysctl kern_proc_vmmap handlers. Approved by: re (kensmith) Modified: stable/7/sys/ (props changed) stable/7/sys/compat/linprocfs/linprocfs.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/fs/procfs/procfs_map.c stable/7/sys/kern/kern_proc.c Modified: stable/7/sys/compat/linprocfs/linprocfs.c ============================================================================== --- stable/7/sys/compat/linprocfs/linprocfs.c Fri Dec 19 15:24:18 2008 (r186324) +++ stable/7/sys/compat/linprocfs/linprocfs.c Fri Dec 19 15:32:48 2008 (r186325) @@ -74,6 +74,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -868,7 +869,8 @@ linprocfs_doprocenviron(PFS_FILL_ARGS) static int linprocfs_doprocmaps(PFS_FILL_ARGS) { - vm_map_t map = &p->p_vmspace->vm_map; + struct vmspace *vm; + vm_map_t map; vm_map_entry_t entry, tmp_entry; vm_object_t obj, tobj, lobj; vm_offset_t e_start, e_end; @@ -893,6 +895,10 @@ linprocfs_doprocmaps(PFS_FILL_ARGS) return (EOPNOTSUPP); error = 0; + vm = vmspace_acquire_ref(p); + if (vm == NULL) + return (ESRCH); + map = &vm->vm_map; vm_map_lock_read(map); for (entry = map->header.next; entry != &map->header; entry = entry->next) { @@ -979,6 +985,7 @@ linprocfs_doprocmaps(PFS_FILL_ARGS) } } vm_map_unlock_read(map); + vmspace_free(vm); return (error); } Modified: stable/7/sys/fs/procfs/procfs_map.c ============================================================================== --- stable/7/sys/fs/procfs/procfs_map.c Fri Dec 19 15:24:18 2008 (r186324) +++ stable/7/sys/fs/procfs/procfs_map.c Fri Dec 19 15:32:48 2008 (r186325) @@ -53,6 +53,7 @@ #include #include +#include #include #include #include @@ -82,7 +83,8 @@ extern struct sysentvec ia32_freebsd_sys int procfs_doprocmap(PFS_FILL_ARGS) { - vm_map_t map = &p->p_vmspace->vm_map; + struct vmspace *vm; + vm_map_t map; vm_map_entry_t entry, tmp_entry; struct vnode *vp; char *fullpath, *freepath; @@ -109,6 +111,10 @@ procfs_doprocmap(PFS_FILL_ARGS) } #endif + vm = vmspace_acquire_ref(p); + if (vm == NULL) + return (ESRCH); + map = &vm->vm_map; vm_map_lock_read(map); for (entry = map->header.next; entry != &map->header; entry = entry->next) { @@ -236,5 +242,6 @@ procfs_doprocmap(PFS_FILL_ARGS) } } vm_map_unlock_read(map); + vmspace_free(vm); return (error); } Modified: stable/7/sys/kern/kern_proc.c ============================================================================== --- stable/7/sys/kern/kern_proc.c Fri Dec 19 15:24:18 2008 (r186324) +++ stable/7/sys/kern/kern_proc.c Fri Dec 19 15:32:48 2008 (r186325) @@ -1358,6 +1358,7 @@ sysctl_kern_proc_ovmmap(SYSCTL_HANDLER_A struct vnode *vp; struct proc *p; vm_map_t map; + struct vmspace *vm; name = (int *)arg1; if ((p = pfind((pid_t)name[0])) == NULL) @@ -1372,7 +1373,11 @@ sysctl_kern_proc_ovmmap(SYSCTL_HANDLER_A } _PHOLD(p); PROC_UNLOCK(p); - + vm = vmspace_acquire_ref(p); + if (vm == NULL) { + PRELE(p); + return (ESRCH); + } kve = malloc(sizeof(*kve), M_TEMP, M_WAITOK); map = &p->p_vmspace->vm_map; /* XXXRW: More locking required? */ @@ -1503,6 +1508,7 @@ sysctl_kern_proc_ovmmap(SYSCTL_HANDLER_A } } vm_map_unlock_read(map); + vmspace_free(vm); PRELE(p); free(kve, M_TEMP); return (error); @@ -1524,6 +1530,7 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_AR int error, *name; struct vnode *vp; struct proc *p; + struct vmspace *vm; vm_map_t map; name = (int *)arg1; @@ -1539,10 +1546,14 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_AR } _PHOLD(p); PROC_UNLOCK(p); - + vm = vmspace_acquire_ref(p); + if (vm == NULL) { + PRELE(p); + return (ESRCH); + } kve = malloc(sizeof(*kve), M_TEMP, M_WAITOK); - map = &p->p_vmspace->vm_map; /* XXXRW: More locking required? */ + map = &vm->vm_map; /* XXXRW: More locking required? */ vm_map_lock_read(map); for (entry = map->header.next; entry != &map->header; entry = entry->next) { @@ -1674,6 +1685,7 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_AR } } vm_map_unlock_read(map); + vmspace_free(vm); PRELE(p); free(kve, M_TEMP); return (error); From marcus at FreeBSD.org Fri Dec 19 12:19:59 2008 From: marcus at FreeBSD.org (Joe Marcus Clarke) Date: Fri Dec 19 12:20:11 2008 Subject: svn commit: r186336 - stable/7/lib/libutil Message-ID: <200812192019.mBJKJx5I081742@svn.freebsd.org> Author: marcus (doc,ports committer) Date: Fri Dec 19 20:19:59 2008 New Revision: 186336 URL: http://svn.freebsd.org/changeset/base/186336 Log: MFC r186314: Initialize the cntp pointer to 0 prior to doing any work so that callers don't try to iterate through garbage or NULL memory. Additionally, return NULL instead of 0 on error. Approved by: re (kib) Modified: stable/7/lib/libutil/kinfo_getfile.c stable/7/lib/libutil/kinfo_getvmmap.c Modified: stable/7/lib/libutil/kinfo_getfile.c ============================================================================== --- stable/7/lib/libutil/kinfo_getfile.c Fri Dec 19 18:47:46 2008 (r186335) +++ stable/7/lib/libutil/kinfo_getfile.c Fri Dec 19 20:19:59 2008 (r186336) @@ -19,6 +19,7 @@ kinfo_getfile(pid_t pid, int *cntp) char *buf, *bp, *eb; struct kinfo_file *kif, *kp, *kf; + *cntp = 0; len = 0; mib[0] = CTL_KERN; mib[1] = KERN_PROC; @@ -27,15 +28,15 @@ kinfo_getfile(pid_t pid, int *cntp) error = sysctl(mib, 4, NULL, &len, NULL, 0); if (error) - return (0); + return (NULL); len = len * 4 / 3; buf = malloc(len); if (buf == NULL) - return (0); + return (NULL); error = sysctl(mib, 4, buf, &len, NULL, 0); if (error) { free(buf); - return (0); + return (NULL); } /* Pass 1: count items */ cnt = 0; @@ -50,7 +51,7 @@ kinfo_getfile(pid_t pid, int *cntp) kif = calloc(cnt, sizeof(*kif)); if (kif == NULL) { free(buf); - return (0); + return (NULL); } bp = buf; eb = buf + len; Modified: stable/7/lib/libutil/kinfo_getvmmap.c ============================================================================== --- stable/7/lib/libutil/kinfo_getvmmap.c Fri Dec 19 18:47:46 2008 (r186335) +++ stable/7/lib/libutil/kinfo_getvmmap.c Fri Dec 19 20:19:59 2008 (r186336) @@ -19,6 +19,7 @@ kinfo_getvmmap(pid_t pid, int *cntp) char *buf, *bp, *eb; struct kinfo_vmentry *kiv, *kp, *kv; + *cntp = 0; len = 0; mib[0] = CTL_KERN; mib[1] = KERN_PROC; @@ -27,15 +28,15 @@ kinfo_getvmmap(pid_t pid, int *cntp) error = sysctl(mib, 4, NULL, &len, NULL, 0); if (error) - return (0); + return (NULL); len = len * 4 / 3; buf = malloc(len); if (buf == NULL) - return (0); + return (NULL); error = sysctl(mib, 4, buf, &len, NULL, 0); if (error) { free(buf); - return (0); + return (NULL); } /* Pass 1: count items */ cnt = 0; @@ -50,7 +51,7 @@ kinfo_getvmmap(pid_t pid, int *cntp) kiv = calloc(cnt, sizeof(*kiv)); if (kiv == NULL) { free(buf); - return (0); + return (NULL); } bp = buf; eb = buf + len; From marcus at FreeBSD.org Fri Dec 19 12:20:50 2008 From: marcus at FreeBSD.org (Joe Marcus Clarke) Date: Fri Dec 19 12:21:06 2008 Subject: svn commit: r186338 - stable/7/usr.bin/procstat Message-ID: <200812192020.mBJKKo6P081837@svn.freebsd.org> Author: marcus (doc,ports committer) Date: Fri Dec 19 20:20:50 2008 New Revision: 186338 URL: http://svn.freebsd.org/changeset/base/186338 Log: MFC r186315: Do not segfault when procstat -f or procstat -v is called on a process not owned by the current user. If kinfo_getfile() or kinfo_getvmmap() return NULL, simply exit, and do not try and derefernce the memory. Approved by: re (kib) Modified: stable/7/usr.bin/procstat/procstat_files.c stable/7/usr.bin/procstat/procstat_vm.c Modified: stable/7/usr.bin/procstat/procstat_files.c ============================================================================== --- stable/7/usr.bin/procstat/procstat_files.c Fri Dec 19 20:20:14 2008 (r186337) +++ stable/7/usr.bin/procstat/procstat_files.c Fri Dec 19 20:20:50 2008 (r186338) @@ -144,6 +144,8 @@ procstat_files(pid_t pid, struct kinfo_p "PRO", "NAME"); freep = kinfo_getfile(pid, &cnt); + if (freep == NULL) + return; for (i = 0; i < cnt; i++) { kif = &freep[i]; Modified: stable/7/usr.bin/procstat/procstat_vm.c ============================================================================== --- stable/7/usr.bin/procstat/procstat_vm.c Fri Dec 19 20:20:14 2008 (r186337) +++ stable/7/usr.bin/procstat/procstat_vm.c Fri Dec 19 20:20:50 2008 (r186338) @@ -54,6 +54,8 @@ procstat_vm(pid_t pid, struct kinfo_proc "PRES", "REF", "SHD", "FL", "TP", "PATH"); freep = kinfo_getvmmap(pid, &cnt); + if (freep == NULL) + return; for (i = 0; i < cnt; i++) { kve = &freep[i]; printf("%5d ", pid); From csjp at FreeBSD.org Sat Dec 20 11:39:10 2008 From: csjp at FreeBSD.org (Christian S.J. Peron) Date: Sat Dec 20 11:39:22 2008 Subject: svn commit: r186363 - in stable/7/sys: . contrib/pf dev/cxgb netinet Message-ID: <200812201939.mBKJdA8F012457@svn.freebsd.org> Author: csjp Date: Sat Dec 20 19:39:09 2008 New Revision: 186363 URL: http://svn.freebsd.org/changeset/base/186363 Log: MFC revision 185713 from head. Make sure we are maintaining the reference count on the route eliminating another: rtfree: 0xc841ee88 has 1 refs Reviewed by: bz Approved by: re@ (gnn) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/netinet/if_ether.c Modified: stable/7/sys/netinet/if_ether.c ============================================================================== --- stable/7/sys/netinet/if_ether.c Sat Dec 20 17:55:37 2008 (r186362) +++ stable/7/sys/netinet/if_ether.c Sat Dec 20 19:39:09 2008 (r186363) @@ -909,12 +909,12 @@ reply: * over who claims what Ether address. */ if (rt->rt_ifp == ifp) { - rtfree(rt); + RTFREE_LOCKED(rt); goto drop; } (void)memcpy(ar_tha(ah), ar_sha(ah), ah->ar_hln); (void)memcpy(ar_sha(ah), enaddr, ah->ar_hln); - rtfree(rt); + RTFREE_LOCKED(rt); /* * Also check that the node which sent the ARP packet @@ -933,10 +933,10 @@ reply: " from %s via %s, expecting %s\n", inet_ntoa(isaddr), ifp->if_xname, rt->rt_ifp->if_xname); - rtfree(rt); + RTFREE_LOCKED(rt); goto drop; } - rtfree(rt); + RTFREE_LOCKED(rt); #ifdef DEBUG_PROXY printf("arp: proxying for %s\n", From peter at FreeBSD.org Sat Dec 20 20:32:57 2008 From: peter at FreeBSD.org (Peter Wemm) Date: Sat Dec 20 20:33:14 2008 Subject: svn commit: r186368 - in stable/7/lib/libthr: . thread Message-ID: <200812210432.mBL4WvG0023460@svn.freebsd.org> Author: peter Date: Sun Dec 21 04:32:57 2008 New Revision: 186368 URL: http://svn.freebsd.org/changeset/base/186368 Log: MFC: 185728: initialize 'dummy' argument to _umtx_op(2) syscall Approved by: re (kib) Modified: stable/7/lib/libthr/ (props changed) stable/7/lib/libthr/thread/thr_rtld.c Modified: stable/7/lib/libthr/thread/thr_rtld.c ============================================================================== --- stable/7/lib/libthr/thread/thr_rtld.c Sun Dec 21 04:27:52 2008 (r186367) +++ stable/7/lib/libthr/thread/thr_rtld.c Sun Dec 21 04:32:57 2008 (r186368) @@ -214,7 +214,7 @@ _thr_rtld_init(void) { struct RtldLockInfo li; struct pthread *curthread; - long dummy; + long dummy = -1; curthread = _get_curthread(); From vanhu at FreeBSD.org Sun Dec 21 11:13:31 2008 From: vanhu at FreeBSD.org (VANHULLEBUS Yvan) Date: Sun Dec 21 11:13:48 2008 Subject: svn commit: r186375 - in stable/7/sys: . contrib/pf dev/cxgb net Message-ID: <200812211913.mBLJDVTB040016@svn.freebsd.org> Author: vanhu Date: Sun Dec 21 19:13:30 2008 New Revision: 186375 URL: http://svn.freebsd.org/changeset/base/186375 Log: Fix to bug kern/126850. Only dispatch event hander if the interface had a parent... PR: kern/126850 Reviewed by: EvilSam Approved by: re Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/net/if.h stable/7/sys/net/if_vlan.c Modified: stable/7/sys/net/if.h ============================================================================== --- stable/7/sys/net/if.h Sun Dec 21 16:56:13 2008 (r186374) +++ stable/7/sys/net/if.h Sun Dec 21 19:13:30 2008 (r186375) @@ -199,22 +199,23 @@ struct if_data { * more detailed or differenciated than IFCAP_*. * Hwassist features are defined CSUM_* in sys/mbuf.h */ -#define IFCAP_RXCSUM 0x0001 /* can offload checksum on RX */ -#define IFCAP_TXCSUM 0x0002 /* can offload checksum on TX */ -#define IFCAP_NETCONS 0x0004 /* can be a network console */ -#define IFCAP_VLAN_MTU 0x0008 /* VLAN-compatible MTU */ -#define IFCAP_VLAN_HWTAGGING 0x0010 /* hardware VLAN tag support */ -#define IFCAP_JUMBO_MTU 0x0020 /* 9000 byte MTU supported */ -#define IFCAP_POLLING 0x0040 /* driver supports polling */ -#define IFCAP_VLAN_HWCSUM 0x0080 /* can do IFCAP_HWCSUM on VLANs */ -#define IFCAP_TSO4 0x0100 /* can do TCP Segmentation Offload */ -#define IFCAP_TSO6 0x0200 /* can do TCP6 Segmentation Offload */ -#define IFCAP_LRO 0x0400 /* can do Large Receive Offload */ -#define IFCAP_WOL_UCAST 0x0800 /* wake on any unicast frame */ -#define IFCAP_WOL_MCAST 0x1000 /* wake on any multicast frame */ -#define IFCAP_WOL_MAGIC 0x2000 /* wake on any Magic Packet */ -#define IFCAP_TOE4 0x4000 /* interface can offload TCP */ -#define IFCAP_TOE6 0x8000 /* interface can offload TCP6 */ +#define IFCAP_RXCSUM 0x00001 /* can offload checksum on RX */ +#define IFCAP_TXCSUM 0x00002 /* can offload checksum on TX */ +#define IFCAP_NETCONS 0x00004 /* can be a network console */ +#define IFCAP_VLAN_MTU 0x00008 /* VLAN-compatible MTU */ +#define IFCAP_VLAN_HWTAGGING 0x00010 /* hardware VLAN tag support */ +#define IFCAP_JUMBO_MTU 0x00020 /* 9000 byte MTU supported */ +#define IFCAP_POLLING 0x00040 /* driver supports polling */ +#define IFCAP_VLAN_HWCSUM 0x00080 /* can do IFCAP_HWCSUM on VLANs */ +#define IFCAP_TSO4 0x00100 /* can do TCP Segmentation Offload */ +#define IFCAP_TSO6 0x00200 /* can do TCP6 Segmentation Offload */ +#define IFCAP_LRO 0x00400 /* can do Large Receive Offload */ +#define IFCAP_WOL_UCAST 0x00800 /* wake on any unicast frame */ +#define IFCAP_WOL_MCAST 0x01000 /* wake on any multicast frame */ +#define IFCAP_WOL_MAGIC 0x02000 /* wake on any Magic Packet */ +#define IFCAP_TOE4 0x04000 /* interface can offload TCP */ +#define IFCAP_TOE6 0x08000 /* interface can offload TCP6 */ +#define IFCAP_VLAN_HWFILTER 0x10000 /* interface hw can filter vlan tag */ #define IFCAP_HWCSUM (IFCAP_RXCSUM | IFCAP_TXCSUM) #define IFCAP_TSO (IFCAP_TSO4 | IFCAP_TSO6) Modified: stable/7/sys/net/if_vlan.c ============================================================================== --- stable/7/sys/net/if_vlan.c Sun Dec 21 16:56:13 2008 (r186374) +++ stable/7/sys/net/if_vlan.c Sun Dec 21 19:13:30 2008 (r186375) @@ -1093,13 +1093,13 @@ vlan_unconfig_locked(struct ifnet *ifp) ifv = ifp->if_softc; trunk = ifv->ifv_trunk; - parent = PARENT(ifv); + parent = NULL; - if (trunk) { + if (trunk != NULL) { struct sockaddr_dl sdl; - struct ifnet *p = trunk->parent; TRUNK_LOCK(trunk); + parent = trunk->parent; /* * Since the interface is being unconfigured, we need to @@ -1109,14 +1109,14 @@ vlan_unconfig_locked(struct ifnet *ifp) bzero((char *)&sdl, sizeof(sdl)); sdl.sdl_len = sizeof(sdl); sdl.sdl_family = AF_LINK; - sdl.sdl_index = p->if_index; + sdl.sdl_index = parent->if_index; sdl.sdl_type = IFT_ETHER; sdl.sdl_alen = ETHER_ADDR_LEN; while ((mc = SLIST_FIRST(&ifv->vlan_mc_listhead)) != NULL) { bcopy((char *)&mc->mc_addr, LLADDR(&sdl), ETHER_ADDR_LEN); - error = if_delmulti(p, (struct sockaddr *)&sdl); + error = if_delmulti(parent, (struct sockaddr *)&sdl); if (error) return (error); SLIST_REMOVE_HEAD(&ifv->vlan_mc_listhead, mc_entries); @@ -1157,7 +1157,13 @@ vlan_unconfig_locked(struct ifnet *ifp) ifp->if_link_state = LINK_STATE_UNKNOWN; ifp->if_drv_flags &= ~IFF_DRV_RUNNING; - EVENTHANDLER_INVOKE(vlan_unconfig, parent, ifv->ifv_tag); + /* + * Only dispatch an event if vlan was + * attached, otherwise there is nothing + * to cleanup anyway. + */ + if (parent != NULL) + EVENTHANDLER_INVOKE(vlan_unconfig, parent, ifv->ifv_tag); return (0); } From sbruno at FreeBSD.org Sun Dec 21 16:38:53 2008 From: sbruno at FreeBSD.org (Sean Bruno) Date: Sun Dec 21 16:39:13 2008 Subject: svn commit: r186387 - stable/7/usr.sbin/fwcontrol Message-ID: <200812220038.mBM0crD7046357@svn.freebsd.org> Author: sbruno Date: Mon Dec 22 00:38:52 2008 New Revision: 186387 URL: http://svn.freebsd.org/changeset/base/186387 Log: MFC 182911,182948,185996 from HEAD to syncronize fwcontrol between all branches of FreeBSD. These changes provide the following features: Allow users of more than one Firewire board to execute commands Allow users to pass more than one command line argument at a time Provide NetBSD code support Cleanup Mergeinfo and mark the branch in sync Reviewed by: slong (scottl@samsco.org) Mentor Approved by: re Ken (kensmith@cse.buffalo.edu) Modified: stable/7/usr.sbin/fwcontrol/ (props changed) stable/7/usr.sbin/fwcontrol/fwcontrol.8 stable/7/usr.sbin/fwcontrol/fwcontrol.c stable/7/usr.sbin/fwcontrol/fwmpegts.c Modified: stable/7/usr.sbin/fwcontrol/fwcontrol.8 ============================================================================== --- stable/7/usr.sbin/fwcontrol/fwcontrol.8 Sun Dec 21 22:32:01 2008 (r186386) +++ stable/7/usr.sbin/fwcontrol/fwcontrol.8 Mon Dec 22 00:38:52 2008 (r186387) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 24, 2006 +.Dd September 12, 2008 .Dt FWCONTROL 8 .Os .Sh NAME @@ -60,6 +60,7 @@ The following options are available: .Bl -tag -width indent .It Fl u Ar bus_num Specify the FireWire bus number to be operated on. +The default is bus 0. .It Fl r Initiate bus reset. .It Fl t @@ -81,11 +82,14 @@ Load hex dump file of the configuration .It Fl f Ar node Force specified .Ar node -to be the root node on the next bus reset. +to be the root node on the next bus reset by sending a PHY config packet. +Valid values are 0 - 63. .It Fl g Ar gap_count -Broadcast +Broadcast new .Ar gap_count -by phy_config packet. +by sending a PHY_config packet. +By default this value is 63 on all nodes. +Valid values are 0 - 63. .It Fl i Ar pri_req Set the .Dv PRIORITY_BUDGET @@ -98,13 +102,18 @@ or mode for the incoming stream. Only meaningful in case of and must precede the .Fl R -option. If not specified, the program will try to guess. If you get -an error complaining about "format 0x20", try to force the "mpeg" mode. +option. +If not specified, the program will try to guess. +In case of +.Dq format 0x20 +error, try to force the +.Dq mpeg +mode. .It Fl R Ar filename Receive DV or MPEG TS stream and dump it to a file. -Use Ctrl-C to stop the receiving. +Use ^C to stop the receiving. Some DV cameras seem not to send the stream if a bus manager exists. -If you cannot get the stream, try the following commands: +If it is impossible to get the stream, try the following commands: .Bd -literal -offset indent sysctl hw.firewire.try_bmr=0 fwcontrol -r @@ -116,14 +125,17 @@ It can be handled by .Nm libdv in the .Fx -Ports Collection. Resulting MPEG TS stream can be played and sent over a +Ports Collection. +Resulting MPEG TS stream can be played and sent over a network using the VideoLAN .Nm vlc -tool in the +tool in the .Fx -Ports Collection. The stream can be piped directly to +Ports Collection. +The stream can be piped directly to .Nm vlc, -see EXAMPLES. +see +.Sx EXAMPLES . .It Fl S Ar filename Send a DV file as isochronous stream. .It Fl m Ar EUI64 | hostname @@ -161,39 +173,38 @@ with .Pp .Dl "fwcontrol -R file.m2t .Pp -Receive an MPEG TS stream from a camera producing MPEG transport stream. This -has been tested with SONY HDR-FX1E camera that produces HD MPEG-2 stream at -25 Mbps bandwidth. +Receive an MPEG TS stream from a camera producing MPEG transport stream. +This has been tested with SONY HDR-FX1E camera that produces HD MPEG-2 +stream at 25 Mbps bandwidth. .Pp -To send the stream from the camera over the network using TCP (which supprisingly works better with vlc), you can use +To send the stream from the camera over the network using TCP (which +supprisingly works better with vlc), you can use .Dl "fwcontrol -R - | nc 192.168.10.11 9000 with .Nm netcat from ports and to receive the stream, use .Dl nc -l -p 9000 | vlc - .Pp -To netcast via UDP, you need to use -.Nm buffer +To netcast via UDP, you need to use +.Nm buffer program from ports, since vlc is not fast enough to read UDP packets from -buffers and thus it experiences dropouts when run directly. The sending side -can use +buffers and thus it experiences dropouts when run directly. +The sending side can use .Dl "fwcontrol -R - | nc 192.168.10.11 9000 and to receive the stream, use .Dl nc -l -u -p 9000 | buffer -s 10k -b 1000 -m 20m -p 5 | vlc - .Pp - -.Pp For more information on how to work with .Nm vlc see its docs. .Sh SEE ALSO +.Xr mplayer 1 , +.Xr vlc 1 , .Xr firewire 4 , .Xr fwe 4 , .Xr fwip 4 , .Xr fwohci 4 , -.Xr sbp 4 , -.Xr mplayer 1 , -.Xr vlc 1 +.Xr sbp 4 .Sh HISTORY The .Nm Modified: stable/7/usr.sbin/fwcontrol/fwcontrol.c ============================================================================== --- stable/7/usr.sbin/fwcontrol/fwcontrol.c Sun Dec 21 22:32:01 2008 (r186386) +++ stable/7/usr.sbin/fwcontrol/fwcontrol.c Mon Dec 22 00:38:52 2008 (r186387) @@ -32,8 +32,10 @@ * SUCH DAMAGE. */ +#if defined(__FreeBSD__) #include __FBSDID("$FreeBSD$"); +#endif #include #include @@ -42,11 +44,22 @@ __FBSDID("$FreeBSD$"); #include #include #include +#if defined(__FreeBSD__) #include #include #include #include #include +#elif defined(__NetBSD__) +#include "eui64.h" +#include +#include +#include +#include +#else +#warning "You need to add support for your OS" +#endif + #include #include @@ -56,6 +69,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include "fwmethods.h" static void sysctl_set_int(const char *, int); @@ -64,25 +79,27 @@ static void usage(void) { fprintf(stderr, - "fwcontrol [-u bus_num] [-rt] [-f node] [-g gap_count] " - "[-o node] " - "[-b pri_req] [-c node] [-d node] [-l file] " - "[-R file] [-S file] [-m target]\n" + "%s [-u bus_num] [-prt] [-c node] [-d node] [-o node] [-s node]\n" + "\t [-l file] [-g gap_count] [-f force_root ] [-b pri_req]\n" + "\t [-M mode] [-R filename] [-S filename] [-m EUI64 | hostname]\n" "\t-u: specify bus number\n" - "\t-f: broadcast force_root by phy_config packet\n" - "\t-g: broadcast gap_count by phy_config packet\n" - "\t-o: send link-on packet to the node\n" - "\t-s: write RESET_START register on the node\n" - "\t-b: set PRIORITY_BUDGET register on all supported nodes\n" - "\t-c: read configuration ROM\n" + "\t-p: Display current PHY register settings\n" "\t-r: bus reset\n" "\t-t: read topology map\n" + "\t-c: read configuration ROM\n" "\t-d: hex dump of configuration ROM\n" + "\t-o: send link-on packet to the node\n" + "\t-s: write RESET_START register on the node\n" "\t-l: load and parse hex dump file of configuration ROM\n" + "\t-g: set gap count\n" + "\t-f: force root node\n" + "\t-b: set PRIORITY_BUDGET register on all supported nodes\n" + "\t-M: specify dv or mpeg\n" "\t-R: Receive DV or MPEG TS stream\n" "\t-S: Send DV stream\n" - "\t-m: set fwmem target\n"); - exit(EX_USAGE); + "\t-m: set fwmem target\n" + , getprogname() ); + fprintf(stderr, "\n"); } static void @@ -92,18 +109,14 @@ fweui2eui64(const struct fw_eui64 *fweui *(u_int32_t*)&(eui->octet[4]) = htonl(fweui->lo); } -static struct fw_devlstreq * -get_dev(int fd) +static void +get_dev(int fd, struct fw_devlstreq *data) { - struct fw_devlstreq *data; - - data = (struct fw_devlstreq *)malloc(sizeof(struct fw_devlstreq)); if (data == NULL) - err(1, "malloc"); + err(EX_SOFTWARE, "%s: data malloc", __func__); if( ioctl(fd, FW_GDEVLST, data) < 0) { - err(1, "ioctl"); + err(EX_IOERR, "%s: ioctl", __func__); } - return data; } static int @@ -130,17 +143,25 @@ str2node(int fd, const char *nodestr) if (eui64_hostton(nodestr, &eui) != 0 && eui64_aton(nodestr, &eui) != 0) return (-1); - data = get_dev(fd); + data = (struct fw_devlstreq *)malloc(sizeof(struct fw_devlstreq)); + if (data == NULL) + err(EX_SOFTWARE, "%s: data malloc", __func__); + get_dev(fd,data); for (i = 0; i < data->info_len; i++) { fweui2eui64(&data->dev[i].eui, &tmpeui); if (memcmp(&eui, &tmpeui, sizeof(struct eui64)) == 0) { node = data->dev[i].dst; + if (data != NULL) + free(data); goto gotnode; } } - if (i >= data->info_len) + if (i >= data->info_len) { + if (data != NULL) + free(data); return (-1); + } gotnode: if (node < 0 || node > 63) @@ -158,7 +179,10 @@ list_dev(int fd) char addr[EUI64_SIZ], hostname[40]; int i; - data = get_dev(fd); + data = (struct fw_devlstreq *)malloc(sizeof(struct fw_devlstreq)); + if (data == NULL) + err(EX_SOFTWARE, "%s:data malloc", __func__); + get_dev(fd, data); printf("%d devices (info_len=%d)\n", data->n, data->info_len); printf("node EUI64 status hostname\n"); for (i = 0; i < data->info_len; i++) { @@ -184,6 +208,8 @@ read_write_quad(int fd, struct fw_eui64 u_int32_t *qld, res; asyreq = (struct fw_asyreq *)malloc(sizeof(struct fw_asyreq_t) + 16); + if (asyreq == NULL) + err(EX_SOFTWARE, "%s:asyreq malloc", __func__); asyreq->req.len = 16; #if 0 asyreq->req.type = FWASREQNODE; @@ -206,7 +232,7 @@ read_write_quad(int fd, struct fw_eui64 asyreq->pkt.mode.wreqq.data = htonl(data); if (ioctl(fd, FW_ASYREQ, asyreq) < 0) { - err(1, "ioctl"); + err(EX_IOERR, "%s: ioctl", __func__); } res = qld[3]; free(asyreq); @@ -216,37 +242,56 @@ read_write_quad(int fd, struct fw_eui64 return 0; } +/* + * Send a PHY Config Packet + * ieee 1394a-2005 4.3.4.3 + * + * Message ID Root ID R T Gap Count + * 00(2 bits) (6 bits) 1 1 (6 bits) + * + * if "R" is set, then Root ID will be the next + * root node upon the next bus reset. + * if "T" is set, then Gap Count will be the + * value that all nodes use for their Gap Count + * if "R" and "T" are not set, then this message + * is either ignored or interpreted as an extended + * PHY config Packet as per 1394a-2005 4.3.4.4 + */ static void send_phy_config(int fd, int root_node, int gap_count) { struct fw_asyreq *asyreq; asyreq = (struct fw_asyreq *)malloc(sizeof(struct fw_asyreq_t) + 12); + if (asyreq == NULL) + err(EX_SOFTWARE, "%s:asyreq malloc", __func__); asyreq->req.len = 12; asyreq->req.type = FWASREQNODE; asyreq->pkt.mode.ld[0] = 0; asyreq->pkt.mode.ld[1] = 0; asyreq->pkt.mode.common.tcode = FWTCODE_PHY; if (root_node >= 0) - asyreq->pkt.mode.ld[1] |= (root_node & 0x3f) << 24 | 1 << 23; + asyreq->pkt.mode.ld[1] |= ((root_node << 24) | (1 << 23)); if (gap_count >= 0) - asyreq->pkt.mode.ld[1] |= 1 << 22 | (gap_count & 0x3f) << 16; + asyreq->pkt.mode.ld[1] |= ((1 << 22) | (gap_count << 16)); asyreq->pkt.mode.ld[2] = ~asyreq->pkt.mode.ld[1]; printf("send phy_config root_node=%d gap_count=%d\n", root_node, gap_count); if (ioctl(fd, FW_ASYREQ, asyreq) < 0) - err(1, "ioctl"); + err(EX_IOERR, "%s: ioctl", __func__); free(asyreq); } static void -send_link_on(int fd, int node) +link_on(int fd, int node) { struct fw_asyreq *asyreq; asyreq = (struct fw_asyreq *)malloc(sizeof(struct fw_asyreq_t) + 12); + if (asyreq == NULL) + err(EX_SOFTWARE, "%s:asyreq malloc", __func__); asyreq->req.len = 12; asyreq->req.type = FWASREQNODE; asyreq->pkt.mode.common.tcode = FWTCODE_PHY; @@ -254,7 +299,7 @@ send_link_on(int fd, int node) asyreq->pkt.mode.ld[2] = ~asyreq->pkt.mode.ld[1]; if (ioctl(fd, FW_ASYREQ, asyreq) < 0) - err(1, "ioctl"); + err(EX_IOERR, "%s: ioctl", __func__); free(asyreq); } @@ -264,6 +309,8 @@ reset_start(int fd, int node) struct fw_asyreq *asyreq; asyreq = (struct fw_asyreq *)malloc(sizeof(struct fw_asyreq_t) + 16); + if (asyreq == NULL) + err(EX_SOFTWARE, "%s:asyreq malloc", __func__); asyreq->req.len = 16; asyreq->req.type = FWASREQNODE; asyreq->pkt.mode.wreqq.dst = FWLOCALBUS | (node & 0x3f); @@ -276,7 +323,7 @@ reset_start(int fd, int node) asyreq->pkt.mode.wreqq.data = htonl(0x1); if (ioctl(fd, FW_ASYREQ, asyreq) < 0) - err(1, "ioctl"); + err(EX_IOERR, "%s: ioctl", __func__); free(asyreq); } @@ -290,7 +337,10 @@ set_pri_req(int fd, u_int32_t pri_req) u_int32_t max, reg, old; int i; - data = get_dev(fd); + data = (struct fw_devlstreq *)malloc(sizeof(struct fw_devlstreq)); + if (data == NULL) + err(EX_SOFTWARE, "%s:data malloc", __func__); + get_dev(fd, data); #define BUGET_REG 0xf0000218 for (i = 0; i < data->info_len; i++) { devinfo = &data->dev[i]; @@ -344,7 +394,10 @@ get_crom(int fd, int node, void *crom_bu int i, error; struct fw_devlstreq *data; - data = get_dev(fd); + data = (struct fw_devlstreq *)malloc(sizeof(struct fw_devlstreq)); + if (data == NULL) + err(EX_SOFTWARE, "%s:data malloc", __func__); + get_dev(fd, data); for (i = 0; i < data->info_len; i++) { if (data->dev[i].dst == node && data->dev[i].eui.lo != 0) @@ -360,7 +413,7 @@ get_crom(int fd, int node, void *crom_bu buf.ptr = crom_buf; bzero(crom_buf, len); if ((error = ioctl(fd, FW_GCROM, &buf)) < 0) { - err(1, "ioctl"); + err(EX_IOERR, "%s: ioctl", __func__); } return error; @@ -449,7 +502,7 @@ load_crom(char *filename, u_int32_t *p) int len=1024, i; if ((file = fopen(filename, "r")) == NULL) - err(1, "load_crom"); + err(1, "load_crom %s", filename); for (i = 0; i < len/(4*8); i ++) { fscanf(file, DUMP_FORMAT, p, p+1, p+2, p+3, p+4, p+5, p+6, p+7); @@ -469,9 +522,9 @@ show_topology_map(int fd) static const char *speed[] = {"S100", "S200", "S400", "S800"}; tmap = malloc(sizeof(struct fw_topology_map)); if (tmap == NULL) - return; + err(EX_SOFTWARE, "%s:tmap malloc", __func__); if (ioctl(fd, FW_GTPMAP, tmap) < 0) { - err(1, "ioctl"); + err(EX_IOERR, "%s: ioctl", __func__); } printf("crc_len: %d generation:%d node_count:%d sid_count:%d\n", tmap->crc_len, tmap->generation, @@ -512,7 +565,7 @@ read_phy_registers(int fd, u_int8_t *buf for (i = 0; i < len; i++) { reg.addr = offset + i; if (ioctl(fd, FWOHCI_RDPHYREG, ®) < 0) - err(1, "ioctl"); + err(EX_IOERR, "%s: ioctl", __func__); buf[i] = (u_int8_t) reg.data; printf("0x%02x ", reg.data); } @@ -527,7 +580,7 @@ read_phy_page(int fd, u_int8_t *buf, int reg.addr = 0x7; reg.data = ((page & 7) << 5) | (port & 0xf); if (ioctl(fd, FWOHCI_WRPHYREG, ®) < 0) - err(1, "ioctl"); + err(EX_IOERR, "%s: ioctl", __func__); read_phy_registers(fd, buf, 8, 8); } @@ -590,22 +643,16 @@ dump_phy_registers(int fd) ); } -static void -open_dev(int *fd, char *devbase) +static int +open_dev(int *fd, char *devname) { - char name[256]; - int i; - if (*fd < 0) { - for (i = 0; i < 4; i++) { - snprintf(name, sizeof(name), "%s.%d", devbase, i); - if ((*fd = open(name, O_RDWR)) >= 0) - break; - } + *fd = open(devname, O_RDWR); if (*fd < 0) - err(1, "open"); + return(-1); } + return(0); } static void @@ -625,25 +672,40 @@ detect_recv_fn(int fd, char ich) u_int32_t *ptr; struct ciphdr *ciph; fwmethod *retfn; +#define RECV_NUM_PACKET 16 +#define RECV_PACKET_SZ 1024 bufreq.rx.nchunk = 8; - bufreq.rx.npacket = 16; - bufreq.rx.psize = 1024; + bufreq.rx.npacket = RECV_NUM_PACKET; + bufreq.rx.psize = RECV_PACKET_SZ; bufreq.tx.nchunk = 0; bufreq.tx.npacket = 0; bufreq.tx.psize = 0; if (ioctl(fd, FW_SSTBUF, &bufreq) < 0) - err(1, "ioctl FW_SSTBUF"); + err(EX_IOERR, "%s: ioctl FW_SSTBUF", __func__); isoreq.ch = ich & 0x3f; isoreq.tag = (ich >> 6) & 3; if (ioctl(fd, FW_SRSTREAM, &isoreq) < 0) - err(1, "ioctl FW_SRSTREAM"); + err(EX_IOERR, "%s: ioctl FW_SRSTREAM", __func__); - buf = (char *)malloc(1024*16); - len = read(fd, buf, 1024*16); + buf = (char *)malloc(RECV_NUM_PACKET * RECV_PACKET_SZ); + if (buf == NULL) + err(EX_SOFTWARE, "%s:buf malloc", __func__); + /* + * fwdev.c seems to return EIO on error and + * the return value of the last uiomove + * on success. For now, checking that the + * return is not less than zero should be + * sufficient. fwdev.c::fw_read() should + * return the total length read, not the value + * of the last uiomove(). + */ + len = read(fd, buf, RECV_NUM_PACKET * RECV_PACKET_SZ); + if (len < 0) + err(EX_IOERR, "%s: error reading from device", __func__); ptr = (u_int32_t *) buf; ciph = (struct ciphdr *)(ptr + 1); @@ -666,102 +728,170 @@ detect_recv_fn(int fd, char ich) int main(int argc, char **argv) { +#define MAX_BOARDS 10 u_int32_t crom_buf[1024/4]; - char devbase[1024] = "/dev/fw0"; - int fd, ch, len=1024; + u_int32_t crom_buf_hex[1024/4]; + char devbase[64]; + const char *device_string = "/dev/fw"; + int fd = -1, ch, len=1024; + int32_t current_board = 0; + /* + * If !command_set, then -u will display the nodes for the board. + * This emulates the previous behavior when -u is passed by itself + */ + bool command_set = false; + bool open_needed = false; long tmp; struct fw_eui64 eui; struct eui64 target; fwmethod *recvfn = NULL; - - fd = -1; +/* + * Holders for which functions + * to iterate through + */ + bool display_board_only = false; + bool display_crom = false; + bool send_bus_reset = false; + bool display_crom_hex = false; + bool load_crom_from_file = false; + bool set_fwmem_target = false; + bool dump_topology = false; + bool dump_phy_reg = false; + + int32_t priority_budget = -1; + int32_t set_root_node = -1; + int32_t set_gap_count = -1; + int32_t send_link_on = -1; + int32_t send_reset_start = -1; + + char *crom_string = NULL; + char *crom_string_hex = NULL; + char *recv_data = NULL; + char *send_data = NULL; if (argc < 2) { - open_dev(&fd, devbase); - list_dev(fd); + for (current_board = 0; current_board < MAX_BOARDS; current_board++) { + snprintf(devbase, sizeof(devbase), "%s%d.0", device_string, current_board); + if (open_dev(&fd, devbase) < 0) { + if (current_board == 0) { + usage(); + err(EX_IOERR, "%s: Error opening firewire controller #%d %s", + __func__, current_board, devbase); + } + return(EIO); + } + list_dev(fd); + close(fd); + fd = -1; + } } - - while ((ch = getopt(argc, argv, "M:f:g:m:o:s:b:prtc:d:l:u:R:S:")) != -1) + /* + * Parse all command line options, then execute requested operations. + */ + while ((ch = getopt(argc, argv, "M:f:g:m:o:s:b:prtc:d:l:u:R:S:")) != -1) { switch(ch) { case 'b': - tmp = strtol(optarg, NULL, 0); - if (tmp < 0 || tmp > (long)0xffffffff) - errx(EX_USAGE, "invalid number: %s", optarg); - open_dev(&fd, devbase); - set_pri_req(fd, tmp); + priority_budget = strtol(optarg, NULL, 0); + if (priority_budget < 0 || priority_budget > INT32_MAX) + errx(EX_USAGE, "%s: priority_budget out of range: %s", __func__, optarg); + command_set = true; + open_needed = true; + display_board_only = false; break; case 'c': - open_dev(&fd, devbase); - tmp = str2node(fd, optarg); - get_crom(fd, tmp, crom_buf, len); - show_crom(crom_buf); + crom_string = malloc(strlen(optarg)+1); + if (crom_string == NULL) + err(EX_SOFTWARE, "%s:crom_string malloc", __func__); + if ( (strtol(crom_string, NULL, 0) < 0) || strtol(crom_string, NULL, 0) > MAX_BOARDS) + errx(EX_USAGE, "%s:Invalid value for node", __func__); + strcpy(crom_string, optarg); + display_crom = 1; + open_needed = true; + command_set = true; + display_board_only = false; break; case 'd': - open_dev(&fd, devbase); - tmp = str2node(fd, optarg); - get_crom(fd, tmp, crom_buf, len); - dump_crom(crom_buf); + crom_string_hex = malloc(strlen(optarg)+1); + if (crom_string_hex == NULL) + err(EX_SOFTWARE, "%s:crom_string_hex malloc", __func__); + strcpy(crom_string_hex, optarg); + display_crom_hex = 1; + open_needed = true; + command_set = true; + display_board_only = false; break; case 'f': - tmp = strtol(optarg, NULL, 0); - open_dev(&fd, devbase); - send_phy_config(fd, tmp, -1); +#define MAX_PHY_CONFIG 0x3f + set_root_node = strtol(optarg, NULL, 0); + if ( (set_root_node < 0) || (set_root_node > MAX_PHY_CONFIG) ) + errx(EX_USAGE, "%s:set_root_node out of range", __func__); + open_needed = true; + command_set = true; + display_board_only = false; break; case 'g': - tmp = strtol(optarg, NULL, 0); - open_dev(&fd, devbase); - send_phy_config(fd, -1, tmp); + set_gap_count = strtol(optarg, NULL, 0); + if ( (set_gap_count < 0) || (set_gap_count > MAX_PHY_CONFIG) ) + errx(EX_USAGE, "%s:set_gap_count out of range", __func__); + open_needed = true; + command_set = true; + display_board_only = false; break; case 'l': + load_crom_from_file = 1; load_crom(optarg, crom_buf); - show_crom(crom_buf); + command_set = true; + display_board_only = false; break; case 'm': - if (eui64_hostton(optarg, &target) != 0 && - eui64_aton(optarg, &target) != 0) - errx(EX_USAGE, "invalid target: %s", optarg); - eui.hi = ntohl(*(u_int32_t*)&(target.octet[0])); - eui.lo = ntohl(*(u_int32_t*)&(target.octet[4])); - sysctl_set_int("hw.firewire.fwmem.eui64_hi", eui.hi); - sysctl_set_int("hw.firewire.fwmem.eui64_lo", eui.lo); + set_fwmem_target = 1; + open_needed = 0; + command_set = true; + display_board_only = false; + if (eui64_hostton(optarg, &target) != 0 && + eui64_aton(optarg, &target) != 0) + errx(EX_USAGE, "%s: invalid target: %s", __func__, optarg); break; case 'o': - open_dev(&fd, devbase); - tmp = str2node(fd, optarg); - send_link_on(fd, tmp); + send_link_on = str2node(fd, optarg); + if ( (send_link_on < 0) || (send_link_on > MAX_PHY_CONFIG) ) + errx(EX_USAGE, "%s: node out of range: %s\n",__func__, optarg); + open_needed = true; + command_set = true; + display_board_only = false; break; case 'p': - open_dev(&fd, devbase); - dump_phy_registers(fd); + dump_phy_reg = 1; + open_needed = true; + command_set = true; + display_board_only = false; break; case 'r': - open_dev(&fd, devbase); - if(ioctl(fd, FW_IBUSRST, &tmp) < 0) - err(1, "ioctl"); + send_bus_reset = 1; + open_needed = true; + command_set = true; + display_board_only = false; break; case 's': - open_dev(&fd, devbase); - tmp = str2node(fd, optarg); - reset_start(fd, tmp); + send_reset_start = str2node(fd, optarg); + if ( (send_reset_start < 0) || (send_reset_start > MAX_PHY_CONFIG) ) + errx(EX_USAGE, "%s: node out of range: %s\n", __func__, optarg); + open_needed = true; + command_set = true; + display_board_only = false; break; case 't': - open_dev(&fd, devbase); - show_topology_map(fd); + dump_topology = 1; + open_needed = true; + command_set = true; + display_board_only = false; break; case 'u': - tmp = strtol(optarg, NULL, 0); - snprintf(devbase, sizeof(devbase), "/dev/fw%ld", tmp); - if (fd > 0) { - close(fd); - fd = -1; - } - if (argc == optind) { - open_dev(&fd, devbase); - list_dev(fd); - } + if(!command_set) + display_board_only = true; + current_board = strtol(optarg, NULL, 0); + open_needed = true; break; -#define TAG (1<<6) -#define CHANNEL 63 case 'M': switch (optarg[0]) { case 'm': @@ -774,22 +904,186 @@ main(int argc, char **argv) errx(EX_USAGE, "unrecognized method: %s", optarg); } + command_set = true; + display_board_only = false; break; case 'R': - open_dev(&fd, devbase); - if (recvfn == NULL) /* guess... */ - recvfn = detect_recv_fn(fd, TAG | CHANNEL); - close(fd); - fd = -1; - open_dev(&fd, devbase); - (*recvfn)(fd, optarg, TAG | CHANNEL, -1); + recv_data = malloc(strlen(optarg)+1); + if (recv_data == NULL) + err(EX_SOFTWARE, "%s:recv_data malloc", __func__); + strcpy(recv_data, optarg); + open_needed = false; + command_set = true; + display_board_only = false; break; case 'S': - open_dev(&fd, devbase); - dvsend(fd, optarg, TAG | CHANNEL, -1); + send_data = malloc(strlen(optarg)+1); + if (send_data == NULL) + err(EX_SOFTWARE, "%s:send_data malloc", __func__); + strcpy(send_data, optarg); + open_needed = true; + command_set = true; + display_board_only = false; break; + case '?': default: usage(); + warnc(EINVAL, "%s: Unknown command line arguments", __func__); + return 0; + } + } /* end while */ + + /* + * Catch the error case when the user + * executes the command with non ''-'' + * delimited arguments. + * Generate the usage() display and exit. + */ + if (!command_set && !display_board_only) { + usage(); + warnc(EINVAL, "%s: Unknown command line arguments", __func__); + return 0; + } + + /* + * If -u is passed, execute + * command for that card only. + * + * If -u is not passed, execute + * command for card 0 only. + * + */ + if(open_needed){ + snprintf(devbase, sizeof(devbase), "%s%d.0", device_string, current_board); + if (open_dev(&fd, devbase) < 0) { + err(EX_IOERR, "%s: Error opening firewire controller #%d %s", __func__, current_board, devbase); + } + } + /* + * display the nodes on this board "-u" + * only + */ + if (display_board_only) + list_dev(fd); + + /* + * dump_phy_reg "-p" + */ + if (dump_phy_reg) + dump_phy_registers(fd); + + /* + * send a BUS_RESET Event "-r" + */ + if (send_bus_reset) { + if(ioctl(fd, FW_IBUSRST, &tmp) < 0) + err(EX_IOERR, "%s: Ioctl of bus reset failed for %s", __func__, devbase); + } + /* + * Print out the CROM for this node "-c" + */ + if (display_crom) { + tmp = str2node(fd, crom_string); + get_crom(fd, tmp, crom_buf, len); + show_crom(crom_buf); + free(crom_string); + } + /* + * Hex Dump the CROM for this node "-d" + */ + if (display_crom_hex) { + tmp = str2node(fd, crom_string_hex); + get_crom(fd, tmp, crom_buf_hex, len); + dump_crom(crom_buf_hex); + free(crom_string_hex); + } + /* + * Set Priority Budget to value for this node "-b" + */ + if (priority_budget >= 0) + set_pri_req(fd, priority_budget); + + /* + * Explicitly set the root node of this bus to value "-f" + */ + if (set_root_node >= 0) + send_phy_config(fd, set_root_node, -1); + + /* + * Set the gap count for this card/bus "-g" + */ + if (set_gap_count >= 0) + send_phy_config(fd, -1, set_gap_count); + + /* + * Load a CROM from a file "-l" + */ + if (load_crom_from_file) + show_crom(crom_buf); + /* + * Set the fwmem target for a node to argument "-m" + */ + if (set_fwmem_target) { + eui.hi = ntohl(*(u_int32_t*)&(target.octet[0])); + eui.lo = ntohl(*(u_int32_t*)&(target.octet[4])); +#if defined(__FreeBSD__) + sysctl_set_int("hw.firewire.fwmem.eui64_hi", eui.hi); + sysctl_set_int("hw.firewire.fwmem.eui64_lo", eui.lo); +#elif defined(__NetBSD__) + sysctl_set_int("hw.fwmem.eui64_hi", eui.hi); + sysctl_set_int("hw.fwmem.eui64_lo", eui.lo); +#else +#warning "You need to add support for your OS" +#endif + + } + + /* + * Send a link on to this board/bus "-o" + */ + if (send_link_on >= 0) + link_on(fd, send_link_on); + + /* + * Send a reset start to this board/bus "-s" + */ + if (send_reset_start >= 0) + reset_start(fd, send_reset_start); + + /* + * Dump the node topology for this board/bus "-t" + */ + if (dump_topology) + show_topology_map(fd); + + /* + * Recieve data file from node "-R" + */ +#define TAG (1<<6) +#define CHANNEL 63 + if (recv_data != NULL){ + if (recvfn == NULL) { /* guess... */ + recvfn = detect_recv_fn(fd, TAG | CHANNEL); + close(fd); } + snprintf(devbase, sizeof(devbase), "%s%d.0", device_string, current_board); + if (open_dev(&fd, devbase) < 0) + err(EX_IOERR, "%s: Error opening firewire controller #%d %s in recv_data\n", __func__, current_board, devbase); + (*recvfn)(fd, recv_data, TAG | CHANNEL, -1); + free(recv_data); + } + + /* + * Send data file to node "-S" + */ + if (send_data != NULL){ + dvsend(fd, send_data, TAG | CHANNEL, -1); + free(send_data); + } + + if (fd > 0) { + close(fd); + fd = -1; + } return 0; } Modified: stable/7/usr.sbin/fwcontrol/fwmpegts.c ============================================================================== --- stable/7/usr.sbin/fwcontrol/fwmpegts.c Sun Dec 21 22:32:01 2008 (r186386) +++ stable/7/usr.sbin/fwcontrol/fwmpegts.c Mon Dec 22 00:38:52 2008 (r186387) @@ -52,8 +52,16 @@ #include #include +#if defined(__FreeBSD__) #include #include +#elif defined(__NetBSD__) +#include +#include +#else +#warning "You need to add support for your OS" +#endif + #include "fwmethods.h" From bms at incunabulum.net Sun Dec 21 17:45:45 2008 From: bms at incunabulum.net (Bruce Simpson) Date: Sun Dec 21 17:46:02 2008 Subject: svn commit: r186387 - stable/7/usr.sbin/fwcontrol In-Reply-To: <200812220038.mBM0crD7046357@svn.freebsd.org> References: <200812220038.mBM0crD7046357@svn.freebsd.org> Message-ID: <494EECF9.3040702@incunabulum.net> Sean Bruno wrote: > Log: > MFC 182911,182948,185996 from HEAD to syncronize fwcontrol between all branches > of FreeBSD. > > These changes provide the following features: > Allow users of more than one Firewire board to execute commands > Allow users to pass more than one command line argument at a time > Provide NetBSD code support > Cleanup Mergeinfo and mark the branch in sync > > Reviewed by: slong (scottl@samsco.org) Mentor > Approved by: re Ken (kensmith@cse.buffalo.edu) > I have a Firewire IIDC camera which isn't supported, do you fancy playing with it? Let me know off-list and I can arrange shipping. Hidetoshi-san said it had something to do with isoc transfers, however I haven't been able to test as I don't have a firewire hub, or a device with more than one physical port. cheers BMS From cperciva at FreeBSD.org Mon Dec 22 17:23:10 2008 From: cperciva at FreeBSD.org (Colin Percival) Date: Mon Dec 22 17:23:30 2008 Subject: svn commit: r186405 - head/libexec/ftpd head/sys/kern releng/6.3 releng/6.3/libexec/ftpd releng/6.3/sys/conf releng/6.3/sys/kern releng/6.4 releng/6.4/libexec/ftpd releng/6.4/sys/conf releng/6.4/sy... Message-ID: <200812230123.mBN1N95N076600@svn.freebsd.org> Author: cperciva Date: Tue Dec 23 01:23:09 2008 New Revision: 186405 URL: http://svn.freebsd.org/changeset/base/186405 Log: Prevent cross-site forgery attacks on ftpd(8) due to splitting long commands into multiple requests. [08:12] Avoid calling uninitialized function pointers in protocol switch code. [08:13] Merry Christmas everybody... Approved by: so (cperciva) Approved by: re (kensmith) Security: FreeBSD-SA-08:12.ftpd, FreeBSD-SA-08:13.protosw Modified: stable/7/libexec/ftpd/extern.h stable/7/libexec/ftpd/ftpcmd.y stable/7/libexec/ftpd/ftpd.c stable/7/sys/kern/uipc_domain.c Changes in other areas also in this revision: Modified: head/libexec/ftpd/extern.h head/libexec/ftpd/ftpcmd.y head/libexec/ftpd/ftpd.c head/sys/kern/uipc_domain.c releng/6.3/UPDATING releng/6.3/libexec/ftpd/extern.h releng/6.3/libexec/ftpd/ftpcmd.y releng/6.3/libexec/ftpd/ftpd.c releng/6.3/sys/conf/newvers.sh releng/6.3/sys/kern/uipc_domain.c releng/6.4/UPDATING releng/6.4/libexec/ftpd/extern.h releng/6.4/libexec/ftpd/ftpcmd.y releng/6.4/libexec/ftpd/ftpd.c releng/6.4/sys/conf/newvers.sh releng/6.4/sys/kern/uipc_domain.c releng/7.0/UPDATING releng/7.0/libexec/ftpd/extern.h releng/7.0/libexec/ftpd/ftpcmd.y releng/7.0/libexec/ftpd/ftpd.c releng/7.0/sys/conf/newvers.sh releng/7.0/sys/kern/uipc_domain.c releng/7.1/UPDATING releng/7.1/libexec/ftpd/extern.h releng/7.1/libexec/ftpd/ftpcmd.y releng/7.1/libexec/ftpd/ftpd.c releng/7.1/sys/kern/uipc_domain.c stable/6/libexec/ftpd/extern.h stable/6/libexec/ftpd/ftpcmd.y stable/6/libexec/ftpd/ftpd.c stable/6/sys/kern/uipc_domain.c Modified: stable/7/libexec/ftpd/extern.h ============================================================================== --- stable/7/libexec/ftpd/extern.h Tue Dec 23 01:22:57 2008 (r186404) +++ stable/7/libexec/ftpd/extern.h Tue Dec 23 01:23:09 2008 (r186405) @@ -46,7 +46,7 @@ void fatalerror(char *); void ftpd_logwtmp(char *, char *, struct sockaddr *addr); int ftpd_pclose(FILE *); FILE *ftpd_popen(char *, char *); -char *getline(char *, int, FILE *); +int getline(char *, int, FILE *); void lreply(int, const char *, ...) __printflike(2, 3); void makedir(char *); void nack(char *); Modified: stable/7/libexec/ftpd/ftpcmd.y ============================================================================== --- stable/7/libexec/ftpd/ftpcmd.y Tue Dec 23 01:22:57 2008 (r186404) +++ stable/7/libexec/ftpd/ftpcmd.y Tue Dec 23 01:23:09 2008 (r186405) @@ -1191,7 +1191,7 @@ lookup(struct tab *p, char *cmd) /* * getline - a hacked up version of fgets to ignore TELNET escape codes. */ -char * +int getline(char *s, int n, FILE *iop) { int c; @@ -1207,7 +1207,7 @@ getline(char *s, int n, FILE *iop) if (ftpdebug) syslog(LOG_DEBUG, "command: %s", s); tmpline[0] = '\0'; - return(s); + return(0); } if (c == 0) tmpline[0] = '\0'; @@ -1244,13 +1244,24 @@ getline(char *s, int n, FILE *iop) } } *cs++ = c; - if (--n <= 0 || c == '\n') + if (--n <= 0) { + /* + * If command doesn't fit into buffer, discard the + * rest of the command and indicate truncation. + * This prevents the command to be split up into + * multiple commands. + */ + while (c != '\n' && (c = getc(iop)) != EOF) + ; + return (-2); + } + if (c == '\n') break; } got_eof: sigprocmask(SIG_SETMASK, &osset, NULL); if (c == EOF && cs == s) - return (NULL); + return (-1); *cs++ = '\0'; if (ftpdebug) { if (!guest && strncasecmp("pass ", s, 5) == 0) { @@ -1270,7 +1281,7 @@ got_eof: syslog(LOG_DEBUG, "command: %.*s", len, s); } } - return (s); + return (0); } static void @@ -1300,9 +1311,14 @@ yylex(void) case CMD: (void) signal(SIGALRM, toolong); (void) alarm(timeout); - if (getline(cbuf, sizeof(cbuf)-1, stdin) == NULL) { + n = getline(cbuf, sizeof(cbuf)-1, stdin); + if (n == -1) { reply(221, "You could at least say goodbye."); dologout(0); + } else if (n == -2) { + reply(500, "Command too long."); + (void) alarm(0); + continue; } (void) alarm(0); #ifdef SETPROCTITLE Modified: stable/7/libexec/ftpd/ftpd.c ============================================================================== --- stable/7/libexec/ftpd/ftpd.c Tue Dec 23 01:22:57 2008 (r186404) +++ stable/7/libexec/ftpd/ftpd.c Tue Dec 23 01:23:09 2008 (r186405) @@ -2794,15 +2794,20 @@ static int myoob(void) { char *cp; + int ret; if (!transflag) { syslog(LOG_ERR, "Internal: myoob() while no transfer"); return (0); } cp = tmpline; - if (getline(cp, 7, stdin) == NULL) { + ret = getline(cp, 7, stdin); + if (ret == -1) { reply(221, "You could at least say goodbye."); dologout(0); + } else if (ret == -2) { + /* Ignore truncated command. */ + return (0); } upper(cp); if (strcmp(cp, "ABOR\r\n") == 0) { Modified: stable/7/sys/kern/uipc_domain.c ============================================================================== --- stable/7/sys/kern/uipc_domain.c Tue Dec 23 01:22:57 2008 (r186404) +++ stable/7/sys/kern/uipc_domain.c Tue Dec 23 01:23:09 2008 (r186405) @@ -112,13 +112,18 @@ protosw_init(struct protosw *pr) #define DEFAULT(foo, bar) if ((foo) == NULL) (foo) = (bar) DEFAULT(pu->pru_accept, pru_accept_notsupp); + DEFAULT(pu->pru_bind, pru_bind_notsupp); DEFAULT(pu->pru_connect, pru_connect_notsupp); DEFAULT(pu->pru_connect2, pru_connect2_notsupp); DEFAULT(pu->pru_control, pru_control_notsupp); + DEFAULT(pu->pru_disconnect, pru_disconnect_notsupp); DEFAULT(pu->pru_listen, pru_listen_notsupp); + DEFAULT(pu->pru_peeraddr, pru_peeraddr_notsupp); DEFAULT(pu->pru_rcvd, pru_rcvd_notsupp); DEFAULT(pu->pru_rcvoob, pru_rcvoob_notsupp); DEFAULT(pu->pru_sense, pru_sense_null); + DEFAULT(pu->pru_shutdown, pru_shutdown_notsupp); + DEFAULT(pu->pru_sockaddr, pru_sockaddr_notsupp); DEFAULT(pu->pru_sosend, sosend_generic); DEFAULT(pu->pru_soreceive, soreceive_generic); DEFAULT(pu->pru_sopoll, sopoll_generic); From nyan at FreeBSD.org Mon Dec 22 18:14:43 2008 From: nyan at FreeBSD.org (Takahashi Yoshihiro) Date: Mon Dec 22 18:14:59 2008 Subject: svn commit: r186409 - stable/7/sys/pc98/conf Message-ID: <200812230214.mBN2EgF5077730@svn.freebsd.org> Author: nyan Date: Tue Dec 23 02:14:42 2008 New Revision: 186409 URL: http://svn.freebsd.org/changeset/base/186409 Log: MFH: part of 186372 Disable the pccard, parallel, GbE and wireless lan related devices to decrease a kernel size. Approved by: re (kensmith) Modified: stable/7/sys/pc98/conf/GENERIC Modified: stable/7/sys/pc98/conf/GENERIC ============================================================================== --- stable/7/sys/pc98/conf/GENERIC Tue Dec 23 02:05:56 2008 (r186408) +++ stable/7/sys/pc98/conf/GENERIC Tue Dec 23 02:14:42 2008 (r186409) @@ -95,9 +95,9 @@ device sym # NCR/Symbios Logic (newer device aic # PC-9801-100 device ct # host adapter using WD33C93[ABC] chip (C bus) -device ncv # NCR 53C500 -device nsp # Workbit Ninja SCSI-3 -device stg # TMC 18C30/18C50 +#device ncv # NCR 53C500 +#device nsp # Workbit Ninja SCSI-3 +#device stg # TMC 18C30/18C50 # SCSI peripherals device scbus # SCSI bus (required for SCSI) @@ -136,9 +136,9 @@ device sc # PCCARD (PCMCIA) support # PCMCIA and cardbus bridge support -device cbb # cardbus (yenta) bridge -device pccard # PC Card (16-bit) bus -device cardbus # CardBus (32-bit) bus +#device cbb # cardbus (yenta) bridge +#device pccard # PC Card (16-bit) bus +#device cardbus # CardBus (32-bit) bus # Serial (COM) ports options COM_MULTIPORT @@ -149,11 +149,11 @@ device mse #device joy # NEW Parallel port -device ppc -device ppbus # Parallel port bus (required) -device lpt # Printer -device plip # TCP/IP over parallel -device ppi # Parallel port interface device +#device ppc +#device ppbus # Parallel port bus (required) +#device lpt # Printer +#device plip # TCP/IP over parallel +#device ppi # Parallel port interface device #device vpo # Requires scbus and da # OLD Parallel port # Please stay olpt driver after ppc driver @@ -161,7 +161,7 @@ device ppi # Parallel port interface d # PCI Ethernet NICs. device de # DEC/Intel DC21x4x (``Tulip'') -device em # Intel PRO/1000 adapter Gigabit Ethernet Card +#device em # Intel PRO/1000 adapter Gigabit Ethernet Card device le # AMD Am7900 LANCE and Am79C9xx PCnet device txp # 3Com 3cR990 (``Typhoon'') device vx # 3Com 3c590, 3c595 (``Vortex'') @@ -170,22 +170,22 @@ device vx # 3Com 3c590, 3c595 (``Vorte # NOTE: Be sure to keep the 'device miibus' line in order to use these NICs! device miibus # MII bus support device bfe # Broadcom BCM440x 10/100 Ethernet -device bge # Broadcom BCM570xx Gigabit Ethernet +#device bge # Broadcom BCM570xx Gigabit Ethernet device dc # DEC/Intel 21143 and various workalikes device fxp # Intel EtherExpress PRO/100B (82557, 82558) -device lge # Level 1 LXT1001 gigabit Ethernet -device nge # NatSemi DP83820 gigabit Ethernet +#device lge # Level 1 LXT1001 gigabit Ethernet +#device nge # NatSemi DP83820 gigabit Ethernet device pcn # AMD Am79C97x PCI 10/100 (precedence over 'le') device re # RealTek 8139C+/8169/8169S/8110S device rl # RealTek 8129/8139 device sf # Adaptec AIC-6915 (``Starfire'') device sis # Silicon Integrated Systems SiS 900/SiS 7016 -device sk # SysKonnect SK-984x & SK-982x gigabit Ethernet +#device sk # SysKonnect SK-984x & SK-982x gigabit Ethernet device ste # Sundance ST201 (D-Link DFE-550TX) device ti # Alteon Networks Tigon I/II gigabit Ethernet device tl # Texas Instruments ThunderLAN device tx # SMC EtherPower II (83c170 ``EPIC'') -device vge # VIA VT612x gigabit Ethernet +#device vge # VIA VT612x gigabit Ethernet device vr # VIA Rhine, Rhine II device wb # Winbond W89C840F device xl # 3Com 3c90x (``Boomerang'', ``Cyclone'') @@ -200,20 +200,20 @@ device snc device xe # Xircom pccard Ethernet # Wireless NIC cards -device wlan # 802.11 support -device wlan_wep # 802.11 WEP support -device wlan_ccmp # 802.11 CCMP support -device wlan_tkip # 802.11 TKIP support -device wlan_amrr # AMRR transmit rate control algorithm -device wlan_scan_ap # 802.11 AP mode scanning -device wlan_scan_sta # 802.11 STA mode scanning -device an # Aironet 4500/4800 802.11 wireless NICs. -device ath # Atheros pci/cardbus NIC's -device ath_hal # Atheros HAL (Hardware Access Layer) -device ath_rate_sample # SampleRate tx rate control for ath -device awi # BayStack 660 and others -device ral # Ralink Technology RT2500 wireless NICs. -device wi # WaveLAN/Intersil/Symbol 802.11 wireless NICs. +#device wlan # 802.11 support +#device wlan_wep # 802.11 WEP support +#device wlan_ccmp # 802.11 CCMP support +#device wlan_tkip # 802.11 TKIP support +#device wlan_amrr # AMRR transmit rate control algorithm +#device wlan_scan_ap # 802.11 AP mode scanning +#device wlan_scan_sta # 802.11 STA mode scanning +#device an # Aironet 4500/4800 802.11 wireless NICs. +#device ath # Atheros pci/cardbus NIC's +#device ath_hal # Atheros HAL (Hardware Access Layer) +#device ath_rate_sample # SampleRate tx rate control for ath +#device awi # BayStack 660 and others +#device ral # Ralink Technology RT2500 wireless NICs. +#device wi # WaveLAN/Intersil/Symbol 802.11 wireless NICs. #device wl # Older non 802.11 Wavelan wireless NIC. # Pseudo devices. From hrs at FreeBSD.org Tue Dec 23 09:55:08 2008 From: hrs at FreeBSD.org (Hiroki Sato) Date: Tue Dec 23 09:55:20 2008 Subject: svn commit: r186442 - stable/7/release/doc/en_US.ISO8859-1/errata Message-ID: <200812231755.mBNHt7QA009129@svn.freebsd.org> Author: hrs Date: Tue Dec 23 17:55:07 2008 New Revision: 186442 URL: http://svn.freebsd.org/changeset/base/186442 Log: Document SA-08:07, 08, 09, 10, 11, 12, and 13. Approved by: re (implicit) Modified: stable/7/release/doc/en_US.ISO8859-1/errata/article.sgml Modified: stable/7/release/doc/en_US.ISO8859-1/errata/article.sgml ============================================================================== --- stable/7/release/doc/en_US.ISO8859-1/errata/article.sgml Tue Dec 23 17:40:02 2008 (r186441) +++ stable/7/release/doc/en_US.ISO8859-1/errata/article.sgml Tue Dec 23 17:55:07 2008 (r186442) @@ -160,6 +160,48 @@ 13 July 2008 DNS cache poisoning + + SA-08:07.amd64 + 3 September 2008 + amd64 swapgs local privilege escalation + + + SA-08:08.nmount + 3 September 2008 + &man.nmount.2; local arbitrary code execution + + + SA-08:09.icmp6 + 3 September 2008 + Remote kernel panics on IPv6 connections + + + SA-08:10.nd6 + 1 October 2008 + IPv6 Neighbor Discovery Protocol routing vulnerability + + + SA-08:11.arc4random + 24 November 2008 + &man.arc4random.9; predictable sequence vulnerability + + + SA-08:12.ftpd + 23 December 2008 + Cross-site request forgery in &man.ftpd.8; + + + SA-08:13.protosw + 23 December 2008 + netgraph / bluetooth privilege escalation + From danger at FreeBSD.org Sun Dec 28 15:47:33 2008 From: danger at FreeBSD.org (Daniel Gerzo) Date: Sun Dec 28 15:47:45 2008 Subject: svn commit: r186547 - in stable/7/sys: . boot/common contrib/pf dev/cxgb Message-ID: <200812282347.mBSNlWwY027667@svn.freebsd.org> Author: danger (doc committer) Date: Sun Dec 28 23:47:32 2008 New Revision: 186547 URL: http://svn.freebsd.org/changeset/base/186547 Log: MFC r185692: - correct variable name PR: docs/129448 Submitted by: Kenyon Ralph Approved by: re@ (kensmith) Modified: stable/7/sys/ (props changed) stable/7/sys/boot/common/loader.8 stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/boot/common/loader.8 ============================================================================== --- stable/7/sys/boot/common/loader.8 Sun Dec 28 22:52:07 2008 (r186546) +++ stable/7/sys/boot/common/loader.8 Sun Dec 28 23:47:32 2008 (r186547) @@ -454,7 +454,7 @@ if the script terminates with a non-zero or if a SIGTERM is delivered to the .Xr init 8 process (PID 1). -.It Va init_script +.It Va init_shell Defines the shell binary to be used for executing the various shell scripts. The default is .Dq Li /bin/sh . From imp at FreeBSD.org Tue Dec 30 05:04:07 2008 From: imp at FreeBSD.org (Warner Losh) Date: Tue Dec 30 05:04:19 2008 Subject: svn commit: r186589 - stable/7 Message-ID: <200812300504.mBU5475u076909@svn.freebsd.org> Author: imp Date: Tue Dec 30 05:04:06 2008 New Revision: 186589 URL: http://svn.freebsd.org/changeset/base/186589 Log: MFC: Merge copyright bump. Approved by: re@ (kensmith) Modified: stable/7/COPYRIGHT (contents, props changed) Modified: stable/7/COPYRIGHT ============================================================================== --- stable/7/COPYRIGHT Tue Dec 30 05:00:10 2008 (r186588) +++ stable/7/COPYRIGHT Tue Dec 30 05:04:06 2008 (r186589) @@ -4,7 +4,7 @@ The compilation of software known as FreeBSD is distributed under the following terms: -Copyright (C) 1992-2008 The FreeBSD Project. All rights reserved. +Copyright (c) 1992-2009 The FreeBSD Project. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions From imp at FreeBSD.org Tue Dec 30 05:08:06 2008 From: imp at FreeBSD.org (Warner Losh) Date: Tue Dec 30 05:08:18 2008 Subject: svn commit: r186590 - stable/7/sys/sys Message-ID: <200812300508.mBU585gV077032@svn.freebsd.org> Author: imp Date: Tue Dec 30 05:08:05 2008 New Revision: 186590 URL: http://svn.freebsd.org/changeset/base/186590 Log: Merge copyright bump. Approved by: re@ (kensmith) Modified: stable/7/sys/sys/copyright.h (contents, props changed) Modified: stable/7/sys/sys/copyright.h ============================================================================== --- stable/7/sys/sys/copyright.h Tue Dec 30 05:04:06 2008 (r186589) +++ stable/7/sys/sys/copyright.h Tue Dec 30 05:08:05 2008 (r186590) @@ -1,5 +1,5 @@ /*- - * Copyright (C) 1992-2008 The FreeBSD Project. All rights reserved. + * Copyright (C) 1992-2009 The FreeBSD Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,7 +30,7 @@ /* FreeBSD */ #define COPYRIGHT_FreeBSD \ - "Copyright (c) 1992-2008 The FreeBSD Project.\n" + "Copyright (c) 1992-2009 The FreeBSD Project.\n" /* Foundation */ #define TRADEMARK_Foundation \