Re: svn commit: r239356 - head/sbin/dhclient

2012-08-21 Thread Andrey Chernov
On Tue, Aug 21, 2012 at 03:58:12PM +0900, Hajimu UMEMOTO wrote:
> ache> I am network admin, but what router advertise is out my easy control 
> ache> (fixing configs in the Linux router's FS or even rebuilding router 
> ache> components is needed, I don't want to touch this hardware).
> 
> You may want to try -u option of rtsol(8) to determine which router
> advertises it.  It saves link-local address of the advertising router
> in interface name.  You can see it by `resolvconf -l'.

I have only one router, so I know who does it :) But router runs Linix and 
what it advertise to client is not configurable via its web interface, so 
require Linux configs or/and demons patching I don't want to.

> ache> I want override because router runs dnsmasq with caching (on both its 
> IPv4 
> ache> and IPv6 adresses), and NS it advertise goes through tunnel each time 
> ache> without caching in the router.

-- 
http://ache.vniz.net/
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


jemalloc and clang (was: Re: svn commit: r239462 - in head)

2012-08-21 Thread Dimitry Andric

On 2012-08-21 02:17, Jan Beich wrote:
...

Time to revert r228540?

Index: contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h
===
--- contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h(revision 
239467)
+++ contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h(working copy)
@@ -56,10 +56,6 @@
  #ifndef JEMALLOC_TLS_MODEL
  #  define JEMALLOC_TLS_MODEL  /* Default. */
  #endif
-#ifdef __clang__
-#  undef JEMALLOC_TLS_MODEL
-#  define JEMALLOC_TLS_MODEL   /* clang does not support tls_model yet. */
-#endif

  #define   STATIC_PAGE_SHIFT   PAGE_SHIFT
  #define   LG_SIZEOF_INT   2


Well, if Jason would like to support upstream jemalloc for different
versions of clang, it is probably better to to use __has_feature()
instead.

Jason, what do you think of the attached patch?  Or could we just remove
the whole #ifdef __clang__ part?
Index: contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h
===
--- contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h	(revision 239463)
+++ contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h	(working copy)
@@ -56,9 +56,9 @@
 #ifndef JEMALLOC_TLS_MODEL
 #  define JEMALLOC_TLS_MODEL	/* Default. */
 #endif
-#ifdef __clang__
+#if defined(__clang__) && !__has_feature(tls_model)
 #  undef JEMALLOC_TLS_MODEL
-#  define JEMALLOC_TLS_MODEL	/* clang does not support tls_model yet. */
+#  define JEMALLOC_TLS_MODEL	/* This clang does not support tls_model. */
 #endif
 
 #define	STATIC_PAGE_SHIFT	PAGE_SHIFT
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

svn commit: r239485 - head/lib/libc/gen

2012-08-21 Thread David Xu
Author: davidxu
Date: Tue Aug 21 09:17:13 2012
New Revision: 239485
URL: http://svn.freebsd.org/changeset/base/239485

Log:
  Fix prototype. Also the function should return error code instead of
  -1 on error.

Modified:
  head/lib/libc/gen/clock_getcpuclockid.c

Modified: head/lib/libc/gen/clock_getcpuclockid.c
==
--- head/lib/libc/gen/clock_getcpuclockid.c Tue Aug 21 09:14:34 2012
(r239484)
+++ head/lib/libc/gen/clock_getcpuclockid.c Tue Aug 21 09:17:13 2012
(r239485)
@@ -32,8 +32,10 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-clockid_t
+int
 clock_getcpuclockid(pid_t pid, clockid_t *clock_id)
 {
-   return clock_getcpuclockid2(pid, CPUCLOCK_WHICH_PID, clock_id);
+   if (clock_getcpuclockid2(pid, CPUCLOCK_WHICH_PID, clock_id))
+   return (errno);
+   return (0);
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r239486 - in head: lib/libc/gen share/man/man3

2012-08-21 Thread David Xu
Author: davidxu
Date: Tue Aug 21 09:18:28 2012
New Revision: 239486
URL: http://svn.freebsd.org/changeset/base/239486

Log:
  Add manual pages for clock_getcpuclockid and pthread_getcpuclockid.

Added:
  head/lib/libc/gen/clock_getcpuclockid.3   (contents, props changed)
  head/share/man/man3/pthread_getcpuclockid.3   (contents, props changed)
Modified:
  head/lib/libc/gen/Makefile.inc
  head/share/man/man3/Makefile

Modified: head/lib/libc/gen/Makefile.inc
==
--- head/lib/libc/gen/Makefile.inc  Tue Aug 21 09:17:13 2012
(r239485)
+++ head/lib/libc/gen/Makefile.inc  Tue Aug 21 09:18:28 2012
(r239486)
@@ -52,7 +52,7 @@ SYM_MAPS+=${.CURDIR}/gen/Symbol.map
 .sinclude "${.CURDIR}/${LIBC_ARCH}/gen/Makefile.inc"
 
 MAN+=  alarm.3 arc4random.3 \
-   basename.3 check_utility_compat.3 clock.3 \
+   basename.3 check_utility_compat.3 clock.3 clock_getcpuclockid.3 \
confstr.3 ctermid.3 daemon.3 devname.3 directory.3 dirname.3 \
dl_iterate_phdr.3 dladdr.3 dlinfo.3 dllockinit.3 dlopen.3 \
err.3 exec.3 \

Added: head/lib/libc/gen/clock_getcpuclockid.3
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libc/gen/clock_getcpuclockid.3 Tue Aug 21 09:18:28 2012
(r239486)
@@ -0,0 +1,95 @@
+.\" Copyright (c) 2012 David Xu 
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"notice, this list of conditions and the following disclaimer in the
+.\"documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" Portions of this text are reprinted and reproduced in electronic form
+.\" from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology --
+.\" Portable Operating System Interface (POSIX), The Open Group Base
+.\" Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of
+.\" Electrical and Electronics Engineers, Inc and The Open Group.  In the
+.\" event of any discrepancy between this version and the original IEEE and
+.\" The Open Group Standard, the original IEEE and The Open Group Standard is
+.\" the referee document.  The original Standard can be obtained online at
+.\"http://www.opengroup.org/unix/online.html.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 21, 2012 
+.Dt CLOCK_GETCPUCLOCKID 3
+.Os
+.Sh NAME
+.Nm clock_getcpuclockid
+.Nd access a process CPU-time clock
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In time.h
+.Ft int
+.Fn clock_getcpuclockid "pid_t pid" "clockid_t *clock_id"
+.Sh DESCRIPTION
+The
+.Fn clock_getcpuclockid
+returns the clock ID of the CPU-time clock of the process specified by
+.Fa pid .
+If the process described by
+.Fa pid
+exists and the calling process has permission, the clock ID of this
+clock will be returned in
+.Fa clock_id .
+.Pp
+If
+.Fa pid
+is zero, the
+.Fn clock_getcpuclockid
+function returns the clock ID of the CPU-time clock of the process
+making the call, in
+.Fa clock_id .
+.Sh RETURN VALUES
+Upon successful completion,
+.Fn clock_getcpuclockid
+returns zero; otherwise, an error number is returned to indicate the
+error.
+.Sh ERRORS
+The clock_getcpuclockid() function will fail if:
+.Bl -tag -width Er
+.It Bq Er EPERM
+The requesting process does not have permission to access the CPU-time
+clock for the process.
+.It Bq Er ESRCH
+No process can be found corresponding to the process specified by
+.Fa pid .
+.El
+.Sh SEE ALSO
+.Xr clock_gettime 2
+.Sh STANDARDS
+The
+.Fn clock_getcpuclockid
+function conform to
+.St -p1003.1-2001 .
+.Sh HISTORY
+The
+.Fn clock_getcpuclockid
+function first appeared in
+.Fx 10.0 .
+.Sh AUTHORS
+.An David Xu Aq davi...@freebsd.org

Modified: head/share/man/man3/Makefile
==

svn commit: r239487 - in head/sys: boot/fdt/dts mips/nlm

2012-08-21 Thread Jayachandran C.
Author: jchandra
Date: Tue Aug 21 09:37:23 2012
New Revision: 239487
URL: http://svn.freebsd.org/changeset/base/239487

Log:
  Add correct range parameter in XLP DTS
  
  r239274 added support for ranges. Update XLP DTS to provide the correct
  range parameter for the XLP SoC bus.  Also fix bus_space_map method
  for XLP bus space.
  
  Submitted by: Sreekanth M. 

Modified:
  head/sys/boot/fdt/dts/xlp-basic.dts
  head/sys/mips/nlm/bus_space_rmi.c

Modified: head/sys/boot/fdt/dts/xlp-basic.dts
==
--- head/sys/boot/fdt/dts/xlp-basic.dts Tue Aug 21 09:18:28 2012
(r239486)
+++ head/sys/boot/fdt/dts/xlp-basic.dts Tue Aug 21 09:37:23 2012
(r239487)
@@ -44,7 +44,7 @@
#address-cells = <1>;
#size-cells = <1>;
compatible = "simple-bus";
-   ranges = <0x0>;
+   ranges = <0x0 0x1800 0x0400>;
bus-frequency = <0>;
 
serial0: serial@30100 {

Modified: head/sys/mips/nlm/bus_space_rmi.c
==
--- head/sys/mips/nlm/bus_space_rmi.c   Tue Aug 21 09:18:28 2012
(r239486)
+++ head/sys/mips/nlm/bus_space_rmi.c   Tue Aug 21 09:37:23 2012
(r239487)
@@ -366,7 +366,7 @@ rmi_bus_space_map(void *t __unused, bus_
 bus_space_handle_t *bshp)
 {
 
-   *bshp = addr;
+   *bshp = MIPS_PHYS_TO_DIRECT_UNCACHED(addr);
return (0);
 }
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r239497 - head/share/misc

2012-08-21 Thread Andrey Zonov
Author: zont
Date: Tue Aug 21 12:39:38 2012
New Revision: 239497
URL: http://svn.freebsd.org/changeset/base/239497

Log:
  - Add myself as a new src committer.
  
  Approved by:kib (mentor)

Modified:
  head/share/misc/committers-src.dot

Modified: head/share/misc/committers-src.dot
==
--- head/share/misc/committers-src.dot  Tue Aug 21 12:37:37 2012
(r239496)
+++ head/share/misc/committers-src.dot  Tue Aug 21 12:39:38 2012
(r239497)
@@ -272,6 +272,7 @@ yongari [label="Pyun YongHyeon\nyongari@
 zack [label="Zack Kirsch\nz...@freebsd.org\n2010/11/05"]
 zec [label="Marko Zec\n...@freebsd.org\n2008/06/22"]
 zml [label="Zachary Loafman\n...@freebsd.org\n2009/05/27"]
+zont [label="Andrey Zonov\nz...@freebsd.org\n2012/08/21"]
 
 # Pseudo target representing rev 1.1 of commit.allow
 day1 [label="Birth of FreeBSD"]
@@ -480,6 +481,7 @@ kib -> rmh
 kib -> stas
 kib -> tijl
 kib -> trociny
+kib -> zont
 
 kmacy -> lstewart
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r239498 - head/usr.bin/calendar/calendars

2012-08-21 Thread Andrey Zonov
Author: zont
Date: Tue Aug 21 12:47:34 2012
New Revision: 239498
URL: http://svn.freebsd.org/changeset/base/239498

Log:
  - Add myself to the calendar.
  
  Approved by:  kib (mentor)

Modified:
  head/usr.bin/calendar/calendars/calendar.freebsd

Modified: head/usr.bin/calendar/calendars/calendar.freebsd
==
--- head/usr.bin/calendar/calendars/calendar.freebsdTue Aug 21 12:39:38 
2012(r239497)
+++ head/usr.bin/calendar/calendars/calendar.freebsdTue Aug 21 12:47:34 
2012(r239498)
@@ -230,6 +230,7 @@
 07/22  Jens Schweikhardt  born in Waiblingen, 
Baden-Wuerttemberg, Germany, 1967
 07/22  Lukas Ertl  born in Weissenbach/Enns, Steiermark, 
Austria, 1976
 07/23  Sergey A. Osokin  born in Krasnogorsky, Stepnogorsk, 
Akmolinskaya region, Kazakhstan, 1972
+07/23  Andrey Zonov  born in Kirov, Russian Federation, 1985
 07/24  Alexander Nedotsukov  born in Ulyanovsk, Russian 
Federation, 1974
 07/24  Alberto Villa  born in Vercelli, Italy, 1987
 07/27  Andriy Gapon  born in Kyrykivka, Sumy region, 
Ukraine, 1976
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r239499 - head/lib/libc/gen

2012-08-21 Thread Joel Dahl
Author: joel (doc committer)
Date: Tue Aug 21 13:33:48 2012
New Revision: 239499
URL: http://svn.freebsd.org/changeset/base/239499

Log:
  Remove trailing whitespace.

Modified:
  head/lib/libc/gen/clock_getcpuclockid.3

Modified: head/lib/libc/gen/clock_getcpuclockid.3
==
--- head/lib/libc/gen/clock_getcpuclockid.3 Tue Aug 21 12:47:34 2012
(r239498)
+++ head/lib/libc/gen/clock_getcpuclockid.3 Tue Aug 21 13:33:48 2012
(r239499)
@@ -34,7 +34,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 21, 2012 
+.Dd August 21, 2012
 .Dt CLOCK_GETCPUCLOCKID 3
 .Os
 .Sh NAME
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r239500 - head/usr.sbin/bsdinstall

2012-08-21 Thread Devin Teske
Author: dteske
Date: Tue Aug 21 13:46:46 2012
New Revision: 239500
URL: http://svn.freebsd.org/changeset/base/239500

Log:
  Fix "unexpected operator" error when passed multi-word first-argument
  containing whitespace. Also make other changes to support multi-word
  arguments.
  
  PR:   bin/170759
  Submitted by: dteske
  Reviewed by:  emaste (mentor)
  Approved by:  emaste (mentor)
  MFC after:3 days

Modified:
  head/usr.sbin/bsdinstall/bsdinstall

Modified: head/usr.sbin/bsdinstall/bsdinstall
==
--- head/usr.sbin/bsdinstall/bsdinstall Tue Aug 21 13:33:48 2012
(r239499)
+++ head/usr.sbin/bsdinstall/bsdinstall Tue Aug 21 13:46:46 2012
(r239500)
@@ -34,11 +34,10 @@
 
 VERB=$1; shift
 
-if [ -z $VERB ]; then
+if [ -z "$VERB" ]; then
VERB=auto
 fi
 
 test -d "$BSDINSTALL_TMPETC" || mkdir "$BSDINSTALL_TMPETC"
-echo Running installation step: $VERB $@ >> "$BSDINSTALL_LOG"
-exec /usr/libexec/bsdinstall/$VERB $@ 2>>"$BSDINSTALL_LOG"
-
+echo "Running installation step: $VERB $@" >> "$BSDINSTALL_LOG"
+exec "/usr/libexec/bsdinstall/$VERB" "$@" 2>>"$BSDINSTALL_LOG"
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r239501 - head/usr.bin/truss

2012-08-21 Thread Andrey Zonov
Author: zont
Date: Tue Aug 21 14:58:51 2012
New Revision: 239501
URL: http://svn.freebsd.org/changeset/base/239501

Log:
  - Use pid_t type instead of just int.
  
  Approved by:  kib (mentor)

Modified:
  head/usr.bin/truss/extern.h
  head/usr.bin/truss/setup.c
  head/usr.bin/truss/syscalls.c
  head/usr.bin/truss/truss.h

Modified: head/usr.bin/truss/extern.h
==
--- head/usr.bin/truss/extern.h Tue Aug 21 13:46:46 2012(r239500)
+++ head/usr.bin/truss/extern.h Tue Aug 21 14:58:51 2012(r239501)
@@ -32,7 +32,7 @@
  */
 
 extern int setup_and_wait(char **);
-extern int start_tracing(int);
+extern int start_tracing(pid_t);
 extern void restore_proc(int);
 extern void waitevent(struct trussinfo *);
 extern const char *ioctlname(unsigned long val);

Modified: head/usr.bin/truss/setup.c
==
--- head/usr.bin/truss/setup.c  Tue Aug 21 13:46:46 2012(r239500)
+++ head/usr.bin/truss/setup.c  Tue Aug 21 14:58:51 2012(r239501)
@@ -57,7 +57,7 @@ __FBSDID("$FreeBSD$");
 #include "truss.h"
 #include "extern.h"
 
-static int child_pid;
+static pid_t child_pid;
 
 /*
  * setup_and_wait() is called to start a process.  All it really does
@@ -69,7 +69,7 @@ static int child_pid;
 int
 setup_and_wait(char *command[])
 {
-   int pid;
+   pid_t pid;
int waitval;
 
pid = vfork();
@@ -100,7 +100,7 @@ setup_and_wait(char *command[])
  */
 
 int
-start_tracing(int pid)
+start_tracing(pid_t pid)
 {
int waitval;
int ret;

Modified: head/usr.bin/truss/syscalls.c
==
--- head/usr.bin/truss/syscalls.c   Tue Aug 21 13:46:46 2012
(r239500)
+++ head/usr.bin/truss/syscalls.c   Tue Aug 21 14:58:51 2012
(r239501)
@@ -464,7 +464,7 @@ get_syscall(const char *name)
  */
 
 static int
-get_struct(int pid, void *offset, void *buf, int len)
+get_struct(pid_t pid, void *offset, void *buf, int len)
 {
struct ptrace_io_desc iorequest;
 
@@ -539,7 +539,7 @@ char *
 print_arg(struct syscall_args *sc, unsigned long *args, long retval, struct 
trussinfo *trussinfo)
 {
char *tmp = NULL;
-   int pid = trussinfo->pid;
+   pid_t pid = trussinfo->pid;
 
switch (sc->type & ARG_MASK) {
case Hex:

Modified: head/usr.bin/truss/truss.h
==
--- head/usr.bin/truss/truss.h  Tue Aug 21 13:46:46 2012(r239500)
+++ head/usr.bin/truss/truss.h  Tue Aug 21 14:58:51 2012(r239501)
@@ -45,7 +45,7 @@ struct threadinfo
 
 struct trussinfo
 {
-   int pid;
+   pid_t pid;
int flags;
int pr_why;
int pr_data;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r239502 - head/sys/dev/isp

2012-08-21 Thread Matt Jacob
Author: mjacob
Date: Tue Aug 21 16:18:11 2012
New Revision: 239502
URL: http://svn.freebsd.org/changeset/base/239502

Log:
  Remove dependence on MAXPHYS.
  
  MFC after:1 month

Modified:
  head/sys/dev/isp/isp_freebsd.h
  head/sys/dev/isp/isp_pci.c
  head/sys/dev/isp/isp_sbus.c

Modified: head/sys/dev/isp/isp_freebsd.h
==
--- head/sys/dev/isp/isp_freebsd.h  Tue Aug 21 14:58:51 2012
(r239501)
+++ head/sys/dev/isp/isp_freebsd.h  Tue Aug 21 16:18:11 2012
(r239502)
@@ -726,9 +726,6 @@ int isp_fcp_next_crn(ispsoftc_t *, uint8
 #defineisp_sim_alloc(a, b, c, d, e, f, g, h)   \
cam_sim_alloc(a, b, c, d, e, &(d)->isp_osinfo.lock, f, g, h)
 
-/* Should be BUS_SPACE_MAXSIZE, but MAXPHYS is larger than BUS_SPACE_MAXSIZE */
-#define ISP_NSEGS ((MAXPHYS / PAGE_SIZE) + 1)  
-
 #defineISP_PATH_PRT(i, l, p, ...)  
\
if ((l) == ISP_LOGALL || ((l)& (i)->isp_dblev) != 0) {  \
 xpt_print(p, __VA_ARGS__); \

Modified: head/sys/dev/isp/isp_pci.c
==
--- head/sys/dev/isp/isp_pci.c  Tue Aug 21 14:58:51 2012(r239501)
+++ head/sys/dev/isp/isp_pci.c  Tue Aug 21 16:18:11 2012(r239502)
@@ -1525,7 +1525,7 @@ static int
 isp_pci_mbxdma(ispsoftc_t *isp)
 {
caddr_t base;
-   uint32_t len;
+   uint32_t len, nsegs;
int i, error, ns, cmap = 0;
bus_size_t slim;/* segment size */
bus_addr_t llim;/* low limit of unavailable dma */
@@ -1567,6 +1567,11 @@ isp_pci_mbxdma(ispsoftc_t *isp)
return (1);
}
 
+   if (isp->isp_osinfo.sixtyfourbit) {
+   nsegs = ISP_NSEG64_MAX;
+   } else {
+   nsegs = ISP_NSEG_MAX;
+   }
 #ifdef ISP_TARGET_MODE
/*
 * XXX: We don't really support 64 bit target mode for parallel scsi yet
@@ -1579,7 +1584,7 @@ isp_pci_mbxdma(ispsoftc_t *isp)
}
 #endif
 
-   if (isp_dma_tag_create(BUS_DMA_ROOTARG(ISP_PCD(isp)), 1, slim, llim, 
hlim, NULL, NULL, BUS_SPACE_MAXSIZE, ISP_NSEGS, slim, 0, 
&isp->isp_osinfo.dmat)) {
+   if (isp_dma_tag_create(BUS_DMA_ROOTARG(ISP_PCD(isp)), 1, slim, llim, 
hlim, NULL, NULL, BUS_SPACE_MAXSIZE, nsegs, slim, 0, &isp->isp_osinfo.dmat)) {
free(isp->isp_osinfo.pcmd_pool, M_DEVBUF);
ISP_LOCK(isp);
isp_prt(isp, ISP_LOGERR, "could not create master dma tag");

Modified: head/sys/dev/isp/isp_sbus.c
==
--- head/sys/dev/isp/isp_sbus.c Tue Aug 21 14:58:51 2012(r239501)
+++ head/sys/dev/isp/isp_sbus.c Tue Aug 21 16:18:11 2012(r239502)
@@ -497,7 +497,7 @@ isp_sbus_mbxdma(ispsoftc_t *isp)
if (isp_dma_tag_create(BUS_DMA_ROOTARG(ISP_SBD(isp)), 1,
BUS_SPACE_MAXADDR_24BIT+1, BUS_SPACE_MAXADDR_32BIT,
BUS_SPACE_MAXADDR_32BIT, NULL, NULL, BUS_SPACE_MAXSIZE_32BIT,
-   ISP_NSEGS, BUS_SPACE_MAXADDR_24BIT, 0, &isp->isp_osinfo.dmat)) {
+   ISP_NSEG_MAX, BUS_SPACE_MAXADDR_24BIT, 0, &isp->isp_osinfo.dmat)) {
isp_prt(isp, ISP_LOGERR, "could not create master dma tag");
free(isp->isp_osinfo.pcmd_pool, M_DEVBUF);
free(isp->isp_xflist, M_DEVBUF);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r239503 - head/lib/libc/sys

2012-08-21 Thread Niclas Zeising
Author: zeising (ports committer)
Date: Tue Aug 21 16:35:14 2012
New Revision: 239503
URL: http://svn.freebsd.org/changeset/base/239503

Log:
  Add missing .Pp macro.
  
  PR:   docs/170380
  Submitted by: Garrett Cooper 
  Approved by:  joel (mentor)

Modified:
  head/lib/libc/sys/dup.2

Modified: head/lib/libc/sys/dup.2
==
--- head/lib/libc/sys/dup.2 Tue Aug 21 16:18:11 2012(r239502)
+++ head/lib/libc/sys/dup.2 Tue Aug 21 16:35:14 2012(r239503)
@@ -138,6 +138,7 @@ is not a valid active descriptor
 .It Bq Er EMFILE
 Too many descriptors are active.
 .El
+.Pp
 The
 .Fn dup2
 system call fails if:
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r239504 - head/sys/dev/ath

2012-08-21 Thread Adrian Chadd
Author: adrian
Date: Tue Aug 21 16:44:25 2012
New Revision: 239504
URL: http://svn.freebsd.org/changeset/base/239504

Log:
  Initialise an uninitialised variable.
  
  GCC on -9 didn't pick this up; clang did.
  
  Submitted by: David Wolfskill

Modified:
  head/sys/dev/ath/if_ath_tx_edma.c

Modified: head/sys/dev/ath/if_ath_tx_edma.c
==
--- head/sys/dev/ath/if_ath_tx_edma.c   Tue Aug 21 16:35:14 2012
(r239503)
+++ head/sys/dev/ath/if_ath_tx_edma.c   Tue Aug 21 16:44:25 2012
(r239504)
@@ -427,7 +427,7 @@ ath_edma_tx_proc(void *arg, int npending
struct ath_txq *txq;
struct ath_buf *bf;
struct ieee80211_node *ni;
-   int nacked;
+   int nacked = 0;
 
DPRINTF(sc, ATH_DEBUG_TX_PROC, "%s: called, npending=%d\n",
__func__, npending);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r239505 - head/sys/sys

2012-08-21 Thread David E. O'Brien
Author: obrien
Date: Tue Aug 21 17:05:10 2012
New Revision: 239505
URL: http://svn.freebsd.org/changeset/base/239505

Log:
  Restore the style of r195843 to that of pre-r194498
  to reduce gratuitous diffs to older sources.

Modified:
  head/sys/sys/user.h

Modified: head/sys/sys/user.h
==
--- head/sys/sys/user.h Tue Aug 21 16:44:25 2012(r239504)
+++ head/sys/sys/user.h Tue Aug 21 17:05:10 2012(r239505)
@@ -98,7 +98,7 @@
 #defineTDNAMLEN16  /* size of returned thread name 
*/
 #defineCOMMLEN 19  /* size of returned ki_comm 
name */
 #defineKI_EMULNAMELEN  16  /* size of returned ki_emul */
-#define KI_NGROUPS 16  /* number of groups in ki_groups */
+#defineKI_NGROUPS  16  /* number of groups in 
ki_groups */
 #defineLOGNAMELEN  17  /* size of returned ki_login */
 #defineLOGINCLASSLEN   17  /* size of returned 
ki_loginclass */
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r239506 - head/sys/sys

2012-08-21 Thread David E. O'Brien
Author: obrien
Date: Tue Aug 21 17:06:36 2012
New Revision: 239506
URL: http://svn.freebsd.org/changeset/base/239506

Log:
  Missing one in r239505.

Modified:
  head/sys/sys/user.h

Modified: head/sys/sys/user.h
==
--- head/sys/sys/user.h Tue Aug 21 17:05:10 2012(r239505)
+++ head/sys/sys/user.h Tue Aug 21 17:06:36 2012(r239506)
@@ -146,7 +146,7 @@ struct kinfo_proc {
gid_t   ki_svgid;   /* Saved effective group id */
short   ki_ngroups; /* number of groups */
short   ki_spare_short2;/* unused (just here for alignment) */
-   gid_t   ki_groups[KI_NGROUPS];  /* groups */
+   gid_t   ki_groups[KI_NGROUPS];  /* groups */
vm_size_t ki_size;  /* virtual size */
segsz_t ki_rssize;  /* current resident set size in pages */
segsz_t ki_swrss;   /* resident set size before last swap */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r239507 - in head/sys: conf dev/iicbus

2012-08-21 Thread Hiroki Sato
Author: hrs
Date: Tue Aug 21 17:31:10 2012
New Revision: 239507
URL: http://svn.freebsd.org/changeset/base/239507

Log:
  Add s35390a_rtc(4) driver for Seiko Instruments S-35390A RTC.
  
  Submitted by: Yusuke Tanaka

Added:
  head/sys/dev/iicbus/s35390a.c   (contents, props changed)
Modified:
  head/sys/conf/NOTES
  head/sys/conf/files

Modified: head/sys/conf/NOTES
==
--- head/sys/conf/NOTES Tue Aug 21 17:06:36 2012(r239506)
+++ head/sys/conf/NOTES Tue Aug 21 17:31:10 2012(r239507)
@@ -2555,10 +2555,12 @@ device  iicoc   # OpenCores I2C 
controlle
 # ds133x   Dallas Semiconductor DS1337, DS1338 and DS1339 RTC
 # ds1374   Dallas Semiconductor DS1374 RTC
 # ds1672   Dallas Semiconductor DS1672 RTC
+# s35390a  Seiko Instruments S-35390A RTC
 #
 device ds133x
 device ds1374
 device ds1672
+device s35390a
 
 # Parallel-Port Bus
 #

Modified: head/sys/conf/files
==
--- head/sys/conf/files Tue Aug 21 17:06:36 2012(r239506)
+++ head/sys/conf/files Tue Aug 21 17:31:10 2012(r239507)
@@ -1315,6 +1315,7 @@ dev/iicbus/iicsmb.c   optional iicsmb 

dependency  "iicbus_if.h"
 dev/iicbus/iicoc.c optional iicoc
 dev/iicbus/pcf8563.c   optional pcf8563
+dev/iicbus/s35390a.c   optional s35390a
 dev/iir/iir.c  optional iir
 dev/iir/iir_ctrl.c optional iir
 dev/iir/iir_pci.c  optional iir pci

Added: head/sys/dev/iicbus/s35390a.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/iicbus/s35390a.c   Tue Aug 21 17:31:10 2012
(r239507)
@@ -0,0 +1,333 @@
+/*-
+ * Copyright (c) 2012 Yusuke Tanaka
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*-
+ * Copyright (c) 2011 Frank Wille.
+ * All rights reserved.
+ *
+ * Written by Frank Wille for The NetBSD Project.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+/*
+ * Driver for Seiko Instruments S-35390A Real-time Clock
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include "clock_if.h"
+#include "iicbus_if.h"
+
+#

svn commit: r239508 - head/sys/arm/mv

2012-08-21 Thread Hiroki Sato
Author: hrs
Date: Tue Aug 21 17:49:20 2012
New Revision: 239508
URL: http://svn.freebsd.org/changeset/base/239508

Log:
  - Calculate the I2C baud rate to keep them <100 kHz under different TCLK
frequencies.  The maximum freqency is 100 kHz according to the datasheet.
  
  - Add child device probing support based on the device tree.  It now tries to
find i2c-address property in the tree and attach the device with given slave
address to iicbus.

Modified:
  head/sys/arm/mv/twsi.c

Modified: head/sys/arm/mv/twsi.c
==
--- head/sys/arm/mv/twsi.c  Tue Aug 21 17:31:10 2012(r239507)
+++ head/sys/arm/mv/twsi.c  Tue Aug 21 17:49:20 2012(r239508)
@@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
 #include 
 #include 
 
@@ -57,12 +58,17 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 
+#include 
+#include 
+
 #include "iicbus_if.h"
 
 #define MV_TWSI_NAME   "twsi"
+#defineIICBUS_DEVNAME  "iicbus"
 
 #define TWSI_SLAVE_ADDR0x00
 #define TWSI_EXT_SLAVE_ADDR0x10
@@ -86,10 +92,10 @@ __FBSDID("$FreeBSD$");
 #define TWSI_STATUS_DATA_RD_NOACK  0x58
 
 #define TWSI_BAUD_RATE 0x0c
-#define TWSI_BAUD_RATE_94DOT3  0x53 /* N=3, M=10 */
-#define TWSI_BAUD_RATE_74DOT1  0x6b /* N=3, M=13 */
-#define TWSI_BAUD_RATE_51DOT8  0x4c /* N=4, M=9  */
-#define TWSI_BAUD_RATE_99DOT7  0x66 /* N=6, M=12 */
+#defineTWSI_BAUD_RATE_PARAM(M,N)   M) << 3) | ((N) & 0x7)) & 
0x7f)
+#defineTWSI_BAUD_RATE_RAW(C,M,N)   ((C)/((10*(M+1))<<(N+1)))
+#defineTWSI_BAUD_RATE_SLOW 5   /* 50kHz */
+#defineTWSI_BAUD_RATE_FAST 10  /* 100kHz */
 
 #define TWSI_SOFT_RESET0x1c
 
@@ -109,6 +115,13 @@ struct mv_twsi_softc {
device_tiicbus;
 };
 
+static struct mv_twsi_baud_rate {
+   uint32_traw;
+   int param;
+   int m;
+   int n;
+} baud_rate[IIC_FASTEST + 1];
+
 static int mv_twsi_probe(device_t);
 static int mv_twsi_attach(device_t);
 static int mv_twsi_detach(device_t);
@@ -299,13 +312,49 @@ mv_twsi_probe(device_t dev)
return (BUS_PROBE_DEFAULT);
 }
 
+#defineABSSUB(a,b) (((a) > (b)) ? (a) - (b) : (b) - (a))
+static void
+mv_twsi_cal_baud_rate(const uint32_t target, struct mv_twsi_baud_rate *rate)
+{
+   uint32_t clk, cur, diff, diff0;
+   int m, n, m0, n0;
+
+   /* Calculate baud rate. */
+   m0 = n0 = 4;/* Default values on reset */
+   diff0 = 0x;
+   clk = get_tclk();
+
+   for (n = 0; n < 8; n++) {
+   for (m = 0; m < 16; m++) {
+   cur = TWSI_BAUD_RATE_RAW(clk,m,n);
+   diff = ABSSUB(target, cur);
+   if (diff < diff0) {
+   m0 = m;
+   n0 = n;
+   diff0 = diff;
+   }
+   }
+   }
+   rate->raw = TWSI_BAUD_RATE_RAW(clk, m0, n0);
+   rate->param = TWSI_BAUD_RATE_PARAM(m0, n0);
+   rate->m = m0;
+   rate->n = n0;
+}
+
 static int
 mv_twsi_attach(device_t dev)
 {
struct mv_twsi_softc *sc;
+   phandle_t child, iicbusnode;
+   device_t childdev;
+   struct iicbus_ivar *devi;
+   char dname[32]; /* 32 is taken from struct u_device */
+   uint32_t paddr;
+   int len, error;
 
sc = device_get_softc(dev);
sc->dev = dev;
+   bzero(baud_rate, sizeof(baud_rate));
 
mtx_init(&sc->mutex, device_get_nameunit(dev), MV_TWSI_NAME, MTX_DEF);
 
@@ -316,14 +365,76 @@ mv_twsi_attach(device_t dev)
return (ENXIO);
}
 
-   sc->iicbus = device_add_child(dev, "iicbus", -1);
+   mv_twsi_cal_baud_rate(TWSI_BAUD_RATE_SLOW, &baud_rate[IIC_SLOW]);
+   mv_twsi_cal_baud_rate(TWSI_BAUD_RATE_FAST, &baud_rate[IIC_FAST]);
+   if (bootverbose)
+   device_printf(dev, "calculated baud rates are:\n"
+   " %" PRIu32 " kHz (M=%d, N=%d) for slow,\n"
+   " %" PRIu32 " kHz (M=%d, N=%d) for fast.\n",
+   baud_rate[IIC_SLOW].raw / 1000,
+   baud_rate[IIC_SLOW].m,
+   baud_rate[IIC_SLOW].n,
+   baud_rate[IIC_FAST].raw / 1000,
+   baud_rate[IIC_FAST].m,
+   baud_rate[IIC_FAST].n);
+
+   sc->iicbus = device_add_child(dev, IICBUS_DEVNAME, -1);
if (sc->iicbus == NULL) {
device_printf(dev, "could not add iicbus child\n");
mv_twsi_detach(dev);
return (ENXIO);
}
-
+   /* Attach iicbus. */
bus_generic_attach(dev);
+
+   iicbusnode = 0;
+   /* Find iicbus as the child devices in the device tree. */
+   for (child = OF_child(ofw_bus_get_no

svn commit: r239509 - head/usr.bin/clang/clang

2012-08-21 Thread Dimitry Andric
Author: dim
Date: Tue Aug 21 17:58:30 2012
New Revision: 239509
URL: http://svn.freebsd.org/changeset/base/239509

Log:
  Support the WITH_SHARED_TOOLCHAIN setting that was introduced in r234782
  for the clang executable.  Build it statically by default, like the gcc
  executables, which should improve performance a little bit.
  
  MFC after:1 week

Modified:
  head/usr.bin/clang/clang/Makefile

Modified: head/usr.bin/clang/clang/Makefile
==
--- head/usr.bin/clang/clang/Makefile   Tue Aug 21 17:49:20 2012
(r239508)
+++ head/usr.bin/clang/clang/Makefile   Tue Aug 21 17:58:30 2012
(r239509)
@@ -9,6 +9,10 @@ SRCS=  cc1_main.cpp \
cc1as_main.cpp \
driver.cpp
 
+.if ${MK_SHARED_TOOLCHAIN} == "no"
+NO_SHARED?= yes
+.endif
+
 LINKS= ${BINDIR}/clang ${BINDIR}/clang++ \
${BINDIR}/clang ${BINDIR}/clang-cpp
 MLINKS=clang.1 clang++.1 \
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2012-08-21 Thread John Baldwin
Author: jhb
Date: Tue Aug 21 17:58:39 2012
New Revision: 239510
URL: http://svn.freebsd.org/changeset/base/239510

Log:
  Document DRIVER_MODULE_ORDERED, EARLY_DRIVER_MODULE, and
  EARLY_DRIVER_MODULE_ORDERED.

Modified:
  head/share/man/man9/DRIVER_MODULE.9
  head/share/man/man9/Makefile

Modified: head/share/man/man9/DRIVER_MODULE.9
==
--- head/share/man/man9/DRIVER_MODULE.9 Tue Aug 21 17:58:30 2012
(r239509)
+++ head/share/man/man9/DRIVER_MODULE.9 Tue Aug 21 17:58:39 2012
(r239510)
@@ -28,11 +28,14 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 27, 2011
+.Dd August 21, 2012
 .Dt DRIVER_MODULE 9
 .Os
 .Sh NAME
-.Nm DRIVER_MODULE
+.Nm DRIVER_MODULE ,
+.Nm DRIVER_MODULE_ORDERED ,
+.Nm EARLY_DRIVER_MODULE ,
+.Nm EARLY_DRIVER_MODULE_ORDERED
 .Nd kernel driver declaration macro
 .Sh SYNOPSIS
 .In sys/param.h
@@ -40,6 +43,9 @@
 .In sys/bus.h
 .In sys/module.h
 .Fn DRIVER_MODULE name busname "driver_t driver" "devclass_t devclass" 
"modeventhand_t evh" "void *arg"
+.Fn DRIVER_MODULE_ORDERED name busname "driver_t driver" "devclass_t devclass" 
"modeventhand_t evh" "void *arg" "int order"
+.Fn EARLY_DRIVER_MODULE name busname "driver_t driver" "devclass_t devclass" 
"modeventhand_t evh" "void *arg" "enum sysinit_elem_order order" "int pass"
+.Fn EARLY_DRIVER_MODULE_ORDERED name busname "driver_t driver" "devclass_t 
devclass" "modeventhand_t evh" "void *arg" "enum sysinit_elem_order order" "int 
pass"
 .Sh DESCRIPTION
 The
 .Fn DRIVER_MODULE
@@ -95,10 +101,50 @@ The
 is unused at this time and should be a
 .Dv NULL
 pointer.
+.Pp
+The
+.Fn DRIVER_MODULE_ORDERED
+macro allows a driver to be registered in a specific order.
+This can be useful if a single kernel module contains multiple drivers
+that are inter-dependent.
+The
+.Fa order
+argument should be one of the
+.Xr SYSINIT 9
+initialization ordering constants
+.Pq Dv SI_ORDER_* .
+The default order for a driver module is
+.Dv SI_ORDER_MIDDLE .
+Typically a module will specify an order of
+.Dv SI_ORDER_ANY
+for a single driver to ensure it is registered last.
+.Pp
+The
+.Fn EARLY_DRIVER_MODULE
+macro allows a driver to be registered for a specific pass level.
+The boot time probe and attach process makes multiple passes over the
+device tree.
+Certain critical drivers that provide basic services needed by other
+devices are attach during earlier passes.
+Most drivers are attached in a final general pass.
+A driver that attaches during an early pass must register for a specific
+pass level
+.Pq BUS_PASS_*
+via the
+.Fa pass
+argument.
+Once a driver is registered it is available to attach to devices for
+all subsequent passes.
+.Pp
+The
+.Fn EARLY_DRIVER_MODULE_ORDERED
+macro allows a driver to be registered both in a specific order and
+for a specific pass level.
 .Sh SEE ALSO
 .Xr device 9 ,
 .Xr driver 9 ,
-.Xr module 9
+.Xr module 9 ,
+.Xr SYSINIT 9
 .Sh AUTHORS
 This manual page was written by
 .An Alexander Langer Aq a...@freebsd.org .

Modified: head/share/man/man9/Makefile
==
--- head/share/man/man9/MakefileTue Aug 21 17:58:30 2012
(r239509)
+++ head/share/man/man9/MakefileTue Aug 21 17:58:39 2012
(r239510)
@@ -628,6 +628,9 @@ MLINKS+=drbr.9 drbr_free.9 \
drbr.9 drbr_empty.9 \
drbr.9 drbr_inuse.9 \
drbr.9 drbr_stats_update.9
+MLINKS+=DRIVER_MODULE.9 DRIVER_MODULE_ORDERED.9 \
+   DRIVER_MODULE.9 EARLY_DRIVER_MODULE.9 \
+   DRIVER_MODULE.9 EARLY_DRIVER_MODULE_ORDERED.9
 MLINKS+=EVENTHANDLER.9 EVENTHANDLER_DECLARE.9 \
EVENTHANDLER.9 EVENTHANDLER_DEREGISTER.9 \
EVENTHANDLER.9 eventhandler_deregister.9 \
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r239511 - in head/sys: dev/cxgb/ulp/tom dev/cxgbe/tom netinet

2012-08-21 Thread Navdeep Parhar
Author: np
Date: Tue Aug 21 18:09:33 2012
New Revision: 239511
URL: http://svn.freebsd.org/changeset/base/239511

Log:
  Correctly handle the case where an inp has already been dropped by the time
  the TOE driver reports that an active open failed.  toe_connect_failed is
  supposed to handle this but it should be provided the inpcb instead of the
  tcpcb which may no longer be around.

Modified:
  head/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c
  head/sys/dev/cxgbe/tom/t4_connect.c
  head/sys/netinet/toecore.c
  head/sys/netinet/toecore.h

Modified: head/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c
==
--- head/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c Tue Aug 21 17:58:39 2012
(r239510)
+++ head/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c Tue Aug 21 18:09:33 2012
(r239511)
@@ -880,10 +880,10 @@ act_open_rpl_status_to_errno(int status)
case CPL_ERR_CONN_TIMEDOUT:
return (ETIMEDOUT);
case CPL_ERR_TCAM_FULL:
-   return (ENOMEM);
+   return (EAGAIN);
case CPL_ERR_CONN_EXIST:
log(LOG_ERR, "ACTIVE_OPEN_RPL: 4-tuple in use\n");
-   return (EADDRINUSE);
+   return (EAGAIN);
default:
return (EIO);
}
@@ -912,8 +912,7 @@ do_act_open_rpl(struct sge_qset *qs, str
unsigned int atid = G_TID(ntohl(rpl->atid));
struct toepcb *toep = lookup_atid(&td->tid_maps, atid);
struct inpcb *inp = toep->tp_inp;
-   struct tcpcb *tp = intotcpcb(inp);
-   int s = rpl->status;
+   int s = rpl->status, rc;
 
CTR3(KTR_CXGB, "%s: atid %u, status %u ", __func__, atid, s);
 
@@ -923,17 +922,14 @@ do_act_open_rpl(struct sge_qset *qs, str
if (act_open_has_tid(s))
queue_tid_release(tod, GET_TID(rpl));
 
-   if (s == CPL_ERR_TCAM_FULL || s == CPL_ERR_CONN_EXIST) {
-   INP_WLOCK(inp);
-   toe_connect_failed(tod, tp, EAGAIN);
-   toepcb_release(toep);   /* unlocks inp */
-   } else {
+   rc = act_open_rpl_status_to_errno(s);
+   if (rc != EAGAIN)
INP_INFO_WLOCK(&V_tcbinfo);
-   INP_WLOCK(inp);
-   toe_connect_failed(tod, tp, act_open_rpl_status_to_errno(s));
-   toepcb_release(toep);   /* unlocks inp */
+   INP_WLOCK(inp);
+   toe_connect_failed(tod, inp, rc);
+   toepcb_release(toep);   /* unlocks inp */
+   if (rc != EAGAIN)
INP_INFO_WUNLOCK(&V_tcbinfo);
-   }
 
m_freem(m);
return (0);

Modified: head/sys/dev/cxgbe/tom/t4_connect.c
==
--- head/sys/dev/cxgbe/tom/t4_connect.c Tue Aug 21 17:58:39 2012
(r239510)
+++ head/sys/dev/cxgbe/tom/t4_connect.c Tue Aug 21 18:09:33 2012
(r239511)
@@ -167,10 +167,10 @@ act_open_rpl_status_to_errno(int status)
case CPL_ERR_CONN_TIMEDOUT:
return (ETIMEDOUT);
case CPL_ERR_TCAM_FULL:
-   return (ENOMEM);
+   return (EAGAIN);
case CPL_ERR_CONN_EXIST:
log(LOG_ERR, "ACTIVE_OPEN_RPL: 4-tuple in use\n");
-   return (EADDRINUSE);
+   return (EAGAIN);
default:
return (EIO);
}
@@ -186,8 +186,8 @@ do_act_open_rpl(struct sge_iq *iq, const
unsigned int status = G_AOPEN_STATUS(be32toh(cpl->atid_status));
struct toepcb *toep = lookup_atid(sc, atid);
struct inpcb *inp = toep->inp;
-   struct tcpcb *tp = intotcpcb(inp);
struct toedev *tod = &toep->td->tod;
+   int rc;
 
KASSERT(m == NULL, ("%s: wasn't expecting payload", __func__));
KASSERT(toep->tid == atid, ("%s: toep tid/atid mismatch", __func__));
@@ -204,17 +204,14 @@ do_act_open_rpl(struct sge_iq *iq, const
if (status && act_open_has_tid(status))
release_tid(sc, GET_TID(cpl), toep->ctrlq);
 
-   if (status == CPL_ERR_TCAM_FULL) {
-   INP_WLOCK(inp);
-   toe_connect_failed(tod, tp, EAGAIN);
-   final_cpl_received(toep);   /* unlocks inp */
-   } else {
+   rc = act_open_rpl_status_to_errno(status);
+   if (rc != EAGAIN)
INP_INFO_WLOCK(&V_tcbinfo);
-   INP_WLOCK(inp);
-   toe_connect_failed(tod, tp, 
act_open_rpl_status_to_errno(status));
-   final_cpl_received(toep);   /* unlocks inp */
+   INP_WLOCK(inp);
+   toe_connect_failed(tod, inp, rc);
+   final_cpl_received(toep);   /* unlocks inp */
+   if (rc != EAGAIN)
INP_INFO_WUNLOCK(&V_tcbinfo);
-   }
 
return (0);
 }

Modified: head/sys/netinet/toecore.c
==
--- head/sys/netinet/toecore.c  Tue Aug 21 17:58:39 2012(r239510)
+++ head/sys/netinet/toecore.c  Tue Aug 21 18:

svn commit: r239512 - in head: share/man/man9 sys/kern

2012-08-21 Thread John Baldwin
Author: jhb
Date: Tue Aug 21 18:13:09 2012
New Revision: 239512
URL: http://svn.freebsd.org/changeset/base/239512

Log:
  Add a BUS_CHILD_DELETED() method that a bus can hook to allow it to cleanup
  any bus-specific state (such as ivars) when a child device is deleted.
  
  Requested by: kan
  MFC after:1 month

Added:
  head/share/man/man9/BUS_CHILD_DELETED.9   (contents, props changed)
Modified:
  head/share/man/man9/Makefile
  head/sys/kern/bus_if.m
  head/sys/kern/subr_bus.c

Added: head/share/man/man9/BUS_CHILD_DELETED.9
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/man/man9/BUS_CHILD_DELETED.9 Tue Aug 21 18:13:09 2012
(r239512)
@@ -0,0 +1,55 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2012 Advanced Computing Technologies LLC
+.\" Written by: John H. Baldwin 
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"notice, this list of conditions and the following disclaimer in the
+.\"documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 21, 2012
+.Dt BUS_CHILD_DELETED 9
+.Os
+.Sh NAME
+.Nm BUS_CHILD_DELETED
+.Nd "notify a bus device that a child is being deleted"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft void
+.Fn BUS_CHILD_DELETED "device_t dev" "device_t child"
+.Sh DESCRIPTION
+The
+.Fn BUS_CHILD_DELETED
+method is invoked by the new-bus framework when a device is deleted.
+A bus driver can provide an implementation of this method to
+release bus-specific resources associated with a device such as
+instance variables.
+.Sh SEE ALSO
+.Xr BUS_ADD_CHILD 9 ,
+.Xr device 9
+.Sh HISTORY
+The
+.Fn BUS_CHILD_DELETED
+method first appeared in
+.Fx 10.0 .

Modified: head/share/man/man9/Makefile
==
--- head/share/man/man9/MakefileTue Aug 21 18:09:33 2012
(r239511)
+++ head/share/man/man9/MakefileTue Aug 21 18:13:09 2012
(r239512)
@@ -26,6 +26,7 @@ MAN=  accept_filter.9 \
bus_alloc_resource.9 \
BUS_BIND_INTR.9 \
bus_child_present.9 \
+   BUS_CHILD_DELETED.9 \
BUS_CONFIG_INTR.9 \
BUS_DESCRIBE_INTR.9 \
bus_dma.9 \

Modified: head/sys/kern/bus_if.m
==
--- head/sys/kern/bus_if.m  Tue Aug 21 18:09:33 2012(r239511)
+++ head/sys/kern/bus_if.m  Tue Aug 21 18:13:09 2012(r239512)
@@ -160,6 +160,20 @@ METHOD int write_ivar {
 };
 
 /**
+ * @brief Notify a bus that a child was deleted
+ *
+ * Called at the beginning of device_delete_child() to allow the parent
+ * to teardown any bus-specific state for the child.
+ * 
+ * @param _dev the device whose child is being deleted
+ * @param _child   the child device which is being deleted
+ */
+METHOD void child_deleted {
+   device_t _dev;
+   device_t _child;
+};
+
+/**
  * @brief Notify a bus that a child was detached
  *
  * Called after the child's DEVICE_DETACH() method to allow the parent

Modified: head/sys/kern/subr_bus.c
==
--- head/sys/kern/subr_bus.cTue Aug 21 18:09:33 2012(r239511)
+++ head/sys/kern/subr_bus.cTue Aug 21 18:13:09 2012(r239512)
@@ -1873,6 +1873,8 @@ device_delete_child(device_t dev, device
return (error);
if (child->devclass)
devclass_delete_device(child->devclass, child);
+   if (child->parent)
+   BUS_CHILD_DELETED(dev, child);
TAILQ_REMOVE(&dev->children, child, link);
TAILQ_REMOVE(&bus_data_devices, child, devlink);
kobj_delete((kobj_t) child, M_BUS);
___

svn commit: r239513 - head/usr.bin/clang

2012-08-21 Thread Dimitry Andric
Author: dim
Date: Tue Aug 21 18:24:11 2012
New Revision: 239513
URL: http://svn.freebsd.org/changeset/base/239513

Log:
  When WITH_CLANG_EXTRAS is enabled, avoid needlessly building the llvm
  and clang extras in the cross-tools stage.
  
  MFC after:1 week

Modified:
  head/usr.bin/clang/Makefile

Modified: head/usr.bin/clang/Makefile
==
--- head/usr.bin/clang/Makefile Tue Aug 21 18:13:09 2012(r239512)
+++ head/usr.bin/clang/Makefile Tue Aug 21 18:24:11 2012(r239513)
@@ -4,7 +4,7 @@
 
 SUBDIR=clang clang-tblgen tblgen
 
-.if ${MK_CLANG_EXTRAS} != "no"
+.if ${MK_CLANG_EXTRAS} != "no" && !defined(TOOLS_PREFIX)
 SUBDIR+=bugpoint \
llc \
lli \
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r239514 - head/sys/dev/cxgbe/tom

2012-08-21 Thread Navdeep Parhar
Author: np
Date: Tue Aug 21 18:30:16 2012
New Revision: 239514
URL: http://svn.freebsd.org/changeset/base/239514

Log:
  Minor cleanup: use bitwise ops instead of pointless wrappers around
  setbit/clrbit.

Modified:
  head/sys/dev/cxgbe/tom/t4_connect.c
  head/sys/dev/cxgbe/tom/t4_cpl_io.c
  head/sys/dev/cxgbe/tom/t4_ddp.c
  head/sys/dev/cxgbe/tom/t4_listen.c
  head/sys/dev/cxgbe/tom/t4_tom.c
  head/sys/dev/cxgbe/tom/t4_tom.h

Modified: head/sys/dev/cxgbe/tom/t4_connect.c
==
--- head/sys/dev/cxgbe/tom/t4_connect.c Tue Aug 21 18:24:11 2012
(r239513)
+++ head/sys/dev/cxgbe/tom/t4_connect.c Tue Aug 21 18:30:16 2012
(r239514)
@@ -358,7 +358,7 @@ t4_connect(struct toedev *tod, struct so
 
rc = t4_l2t_send(sc, wr, e);
if (rc == 0) {
-   toepcb_set_flag(toep, TPF_CPL_PENDING);
+   toep->flags |= TPF_CPL_PENDING;
return (0);
}
 

Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c
==
--- head/sys/dev/cxgbe/tom/t4_cpl_io.c  Tue Aug 21 18:24:11 2012
(r239513)
+++ head/sys/dev/cxgbe/tom/t4_cpl_io.c  Tue Aug 21 18:30:16 2012
(r239514)
@@ -81,7 +81,7 @@ send_flowc_wr(struct toepcb *toep, struc
unsigned int pfvf = G_FW_VIID_PFN(pi->viid) << S_FW_VIID_PFN;
struct ofld_tx_sdesc *txsd = &toep->txsd[toep->txsd_pidx];
 
-   KASSERT(!toepcb_flag(toep, TPF_FLOWC_WR_SENT),
+   KASSERT(!(toep->flags & TPF_FLOWC_WR_SENT),
("%s: flowc for tid %u sent already", __func__, toep->tid));
 
CTR2(KTR_CXGBE, "%s: tid %u", __func__, toep->tid);
@@ -131,7 +131,7 @@ send_flowc_wr(struct toepcb *toep, struc
toep->txsd_pidx = 0;
toep->txsd_avail--;
 
-   toepcb_set_flag(toep, TPF_FLOWC_WR_SENT);
+   toep->flags |= TPF_FLOWC_WR_SENT;
 t4_wrq_tx(sc, wr);
 }
 
@@ -151,15 +151,15 @@ send_reset(struct adapter *sc, struct to
inp->inp_flags & INP_DROPPED ? "inp dropped" :
tcpstates[tp->t_state],
toep->flags, inp->inp_flags,
-   toepcb_flag(toep, TPF_ABORT_SHUTDOWN) ?
+   toep->flags & TPF_ABORT_SHUTDOWN ?
" (abort already in progress)" : "");
 
-   if (toepcb_flag(toep, TPF_ABORT_SHUTDOWN))
+   if (toep->flags & TPF_ABORT_SHUTDOWN)
return; /* abort already in progress */
 
-   toepcb_set_flag(toep, TPF_ABORT_SHUTDOWN);
+   toep->flags |= TPF_ABORT_SHUTDOWN;
 
-   KASSERT(toepcb_flag(toep, TPF_FLOWC_WR_SENT),
+   KASSERT(toep->flags & TPF_FLOWC_WR_SENT,
("%s: flowc_wr not sent for tid %d.", __func__, tid));
 
wr = alloc_wrqe(sizeof(*req), toep->ofld_txq);
@@ -174,7 +174,7 @@ send_reset(struct adapter *sc, struct to
req->rsvd0 = htobe32(snd_nxt);
else
req->rsvd0 = htobe32(tp->snd_nxt);
-   req->rsvd1 = !toepcb_flag(toep, TPF_TX_DATA_SENT);
+   req->rsvd1 = !(toep->flags & TPF_TX_DATA_SENT);
req->cmd = CPL_ABORT_SEND_RST;
 
/*
@@ -364,12 +364,12 @@ close_conn(struct adapter *sc, struct to
unsigned int tid = toep->tid;
 
CTR3(KTR_CXGBE, "%s: tid %u%s", __func__, toep->tid,
-   toepcb_flag(toep, TPF_FIN_SENT) ? ", IGNORED" : "");
+   toep->flags & TPF_FIN_SENT ? ", IGNORED" : "");
 
-   if (toepcb_flag(toep, TPF_FIN_SENT))
+   if (toep->flags & TPF_FIN_SENT)
return (0);
 
-   KASSERT(toepcb_flag(toep, TPF_FLOWC_WR_SENT),
+   KASSERT(toep->flags & TPF_FLOWC_WR_SENT,
("%s: flowc_wr not sent for tid %u.", __func__, tid));
 
wr = alloc_wrqe(sizeof(*req), toep->ofld_txq);
@@ -387,8 +387,8 @@ close_conn(struct adapter *sc, struct to
 OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_CLOSE_CON_REQ, tid));
req->rsvd = 0;
 
-   toepcb_set_flag(toep, TPF_FIN_SENT);
-   toepcb_clr_flag(toep, TPF_SEND_FIN);
+   toep->flags |= TPF_FIN_SENT;
+   toep->flags &= ~TPF_SEND_FIN;
t4_l2t_send(sc, wr, toep->l2te);
 
return (0);
@@ -540,7 +540,7 @@ t4_push_frames(struct adapter *sc, struc
struct ofld_tx_sdesc *txsd = &toep->txsd[toep->txsd_pidx];
 
INP_WLOCK_ASSERT(inp);
-   KASSERT(toepcb_flag(toep, TPF_FLOWC_WR_SENT),
+   KASSERT(toep->flags & TPF_FLOWC_WR_SENT,
("%s: flowc_wr not sent for tid %u.", __func__, toep->tid));
 
if (__predict_false(toep->ulp_mode != ULP_MODE_NONE &&
@@ -551,7 +551,7 @@ t4_push_frames(struct adapter *sc, struc
 * This function doesn't resume by itself.  Someone else must clear the
 * flag and call this function.
 */
-   if (__predict_false(toepcb_flag(toep, TPF_TX_SUSPENDED)))
+   if (__predict_false(toep->flags & TPF_TX_SUSPENDED))
return;
 
do {
@@ -577,7 +577,7 @@ t4_push_frames(struct adapter *sc, struc

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

2012-08-21 Thread John Baldwin
Author: jhb
Date: Tue Aug 21 18:41:38 2012
New Revision: 239515
URL: http://svn.freebsd.org/changeset/base/239515

Log:
  Add a manpage for BUS_CHILD_DETACHED().

Added:
  head/share/man/man9/BUS_CHILD_DETACHED.9   (contents, props changed)
Modified:
  head/share/man/man9/Makefile

Added: head/share/man/man9/BUS_CHILD_DETACHED.9
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/man/man9/BUS_CHILD_DETACHED.9Tue Aug 21 18:41:38 2012
(r239515)
@@ -0,0 +1,52 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2012 Advanced Computing Technologies LLC
+.\" Written by: John H. Baldwin 
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"notice, this list of conditions and the following disclaimer in the
+.\"documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 21, 2012
+.Dt BUS_CHILD_DETACHED 9
+.Os
+.Sh NAME
+.Nm BUS_CHILD_DETACHED
+.Nd "notify a bus device that a child was detached"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft void
+.Fn BUS_CHILD_DETACHED "device_t dev" "device_t child"
+.Sh DESCRIPTION
+The
+.Fn BUS_CHILD_DETACHED
+method is invoked by the new-bus framework after a device is detached.
+A bus driver can provide an implementation of this method to
+reclaim any resources allocated on behalf of the child or
+to cleanup state not properly released by a
+.Xr DEVICE_DETACH 9
+method.
+.Sh SEE ALSO
+.Xr device 9 ,
+.Xr DEVICE_DETACH 9

Modified: head/share/man/man9/Makefile
==
--- head/share/man/man9/MakefileTue Aug 21 18:30:16 2012
(r239514)
+++ head/share/man/man9/MakefileTue Aug 21 18:41:38 2012
(r239515)
@@ -27,6 +27,7 @@ MAN=  accept_filter.9 \
BUS_BIND_INTR.9 \
bus_child_present.9 \
BUS_CHILD_DELETED.9 \
+   BUS_CHILD_DETACHED.9 \
BUS_CONFIG_INTR.9 \
BUS_DESCRIBE_INTR.9 \
bus_dma.9 \
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r238990 - in head/sys: net netinet netinet6

2012-08-21 Thread Kenneth D. Merry
On Thu, Aug 02, 2012 at 13:57:50 +, Gleb Smirnoff wrote:
> Author: glebius
> Date: Thu Aug  2 13:57:49 2012
> New Revision: 238990
> URL: http://svn.freebsd.org/changeset/base/238990
> 
> Log:
>   Fix races between in_lltable_prefix_free(), lla_lookup(),
>   llentry_free() and arptimer():
>   
>   o Use callout_init_rw() for lle timeout, this allows us safely
> disestablish them.
> - This allows us to simplify the arptimer() and make it
>   race safe.
>   o Consistently use ifp->if_afdata_lock to lock access to
> linked lists in the lle hashes.
>   o Introduce new lle flag LLE_LINKED, which marks an entry that
> is attached to the hash.
> - Use LLE_LINKED to avoid double unlinking via consequent
>   calls to llentry_free().
> - Mark lle with LLE_DELETED via |= operation istead of =,
>   so that other flags won't be lost.
>   o Make LLE_ADDREF(), LLE_REMREF() and LLE_FREE_LOCKED() more
> consistent and provide more informative KASSERTs.
>   
>   The patch is a collaborative work of all submitters and myself.
>   
>   PR: kern/165863
>   Submitted by:   Andrey Zonov 
>   Submitted by:   Ryan Stone 
>   Submitted by:   Eric van Gyzen 

I'm running into this on stable/9, any plan on when this will get MFCed?

Fatal trap 12: page fault while in kernel mode
cpuid = 0; apic id = 00
fault virtual address   = 0x360
fault code  = supervisor read data, page not present
instruction pointer = 0x20:0x808c74c2
stack pointer   = 0x28:0xff83e3f5d140
frame pointer   = 0x28:0xff83e3f5d1a0
code segment= base 0x0, limit 0xf, type 0x1b
= DPL 0, pres 1, long 1, def32 0, gran 1
processor eflags= interrupt enabled, resume, IOPL = 0
current process = 12 (irq265: igb0:que 0)
[ thread pid 12 tid 100047 ]
Stopped at  0x808c74c2 = _rw_rlock+0xf2:movl0x360(%rcx),%edi
db> bt
Tracing pid 12 tid 100047 td 0xfe000d57c8e0
_rw_rlock() at 0x808c74c2 = _rw_rlock+0xf2
in_lltable_lookup() at 0x809e716c = in_lltable_lookup+0x4ac
arpresolve() at 0x809dfe66 = arpresolve+0x116
ether_output() at 0x8098905f = ether_output+0x25f
ip_output() at 0x809f73a9 = ip_output+0xc79
tcp_output() at 0x80a651dd = tcp_output+0xb0d
tcp_do_segment() at 0x80a60213 = tcp_do_segment+0xb63
tcp_input() at 0x80a63148 = tcp_input+0xaf8
ip_input() at 0x809f447c = ip_input+0xac
netisr_dispatch_src() at 0x8099346b = netisr_dispatch_src+0x20b
ether_demux() at 0x8098890d = ether_demux+0x14d
ether_nh_input() at 0x80988be4 = ether_nh_input+0x1f4
netisr_dispatch_src() at 0x8099346b = netisr_dispatch_src+0x20b
igb_rxeof() at 0x8179d034 = igb_rxeof+0x394
igb_msix_que() at 0x8179d3ca = igb_msix_que+0xaa
intr_event_execute_handlers() at 0x8089bdd4 = 
intr_event_execute_handlers+0x104
ithread_loop() at 0x8089d594 = ithread_loop+0xa4
fork_exit() at 0x8089847f = fork_exit+0x11f
fork_trampoline() at 0x80bb970e = fork_trampoline+0xe
--- trap 0, rip = 0, rsp = 0xff83e3f5dbb0, rbp = 0 ---

Thanks,

Ken
-- 
Kenneth Merry
k...@freebsd.org
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r239519 - head/sys/net

2012-08-21 Thread John Baldwin
Author: jhb
Date: Tue Aug 21 19:07:28 2012
New Revision: 239519
URL: http://svn.freebsd.org/changeset/base/239519

Log:
  Fix a silly grammar bogon.
  
  Submitted by: Stephen McKay

Modified:
  head/sys/net/if_vlan.c

Modified: head/sys/net/if_vlan.c
==
--- head/sys/net/if_vlan.c  Tue Aug 21 19:03:04 2012(r239518)
+++ head/sys/net/if_vlan.c  Tue Aug 21 19:07:28 2012(r239519)
@@ -1339,7 +1339,7 @@ vlan_unconfig_locked(struct ifnet *ifp, 
while ((mc = SLIST_FIRST(&ifv->vlan_mc_listhead)) != NULL) {
/*
 * If the parent interface is being detached,
-* all it's multicast addresses have already
+* all its multicast addresses have already
 * been removed.  Warn about errors if
 * if_delmulti() does fail, but don't abort as
 * all callers expect vlan destruction to
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r239527 - head/sys/dev/cxgbe/tom

2012-08-21 Thread Navdeep Parhar
Author: np
Date: Tue Aug 21 19:39:09 2012
New Revision: 239527
URL: http://svn.freebsd.org/changeset/base/239527

Log:
  Cannot hold a mutex around vm_fault_quick_hold_pages, so don't.  Tweak
  some comments while here.

Modified:
  head/sys/dev/cxgbe/tom/t4_ddp.c

Modified: head/sys/dev/cxgbe/tom/t4_ddp.c
==
--- head/sys/dev/cxgbe/tom/t4_ddp.c Tue Aug 21 19:32:55 2012
(r239526)
+++ head/sys/dev/cxgbe/tom/t4_ddp.c Tue Aug 21 19:39:09 2012
(r239527)
@@ -769,7 +769,9 @@ write_page_pods(struct adapter *sc, stru
 }
 
 /*
- * Reuse, or allocate (and program the page pods for) a new DDP buffer.
+ * Reuse, or allocate (and program the page pods for) a new DDP buffer.  The
+ * "pages" array is handed over to this function and should not be used in any
+ * way by the caller after that.
  */
 static int
 select_ddp_buffer(struct adapter *sc, struct toepcb *toep, vm_page_t *pages,
@@ -843,13 +845,6 @@ unwire_ddp_buffer(struct ddp_buffer *db)
}
 }
 
-static inline void
-unhold_ddp_buffer(struct ddp_buffer *db)
-{
-
-   vm_page_unhold_pages(db->pages, db->npages);
-}
-
 static int
 handle_ddp(struct socket *so, struct uio *uio, int flags, int error)
 {
@@ -883,15 +878,24 @@ handle_ddp(struct socket *so, struct uio
 * Fault in and then hold the pages of the uio buffers.  We'll wire them
 * a bit later if everything else works out.
 */
-   if (hold_uio(uio, &pages, &npages) != 0)
+   SOCKBUF_UNLOCK(sb);
+   if (hold_uio(uio, &pages, &npages) != 0) {
+   SOCKBUF_LOCK(sb);
goto no_ddp;
+   }
+   SOCKBUF_LOCK(sb);
+   if (__predict_false(so->so_error || sb->sb_state & SBS_CANTRCVMORE)) {
+   vm_page_unhold_pages(pages, npages);
+   free(pages, M_CXGBE);
+   goto no_ddp;
+   }
 
/*
 * Figure out which one of the two DDP buffers to use this time.
 */
db_idx = select_ddp_buffer(sc, toep, pages, npages,
(uintptr_t)uio->uio_iov->iov_base & PAGE_MASK, uio->uio_resid);
-   pages = NULL;   /* pages either in use elsewhere or unheld + freed */
+   pages = NULL;   /* handed off to select_ddp_buffer */
if (db_idx < 0)
goto no_ddp;
db = toep->db[db_idx];
@@ -904,11 +908,17 @@ handle_ddp(struct socket *so, struct uio
ddp_flags = select_ddp_flags(so, flags, db_idx);
wr = mk_update_tcb_for_ddp(sc, toep, db_idx, sb->sb_cc, ddp_flags);
if (wr == NULL) {
-   unhold_ddp_buffer(db);
+   /*
+* Just unhold the pages.  The DDP buffer's software state is
+* left as-is in the toep.  The page pods were written
+* successfully and we may have an opportunity to use it in the
+* future.
+*/
+   vm_page_unhold_pages(db->pages, db->npages);
goto no_ddp;
}
 
-   /* Wire the pages and give the chip the go-ahead. */
+   /* Wire (and then unhold) the pages, and give the chip the go-ahead. */
wire_ddp_buffer(db);
t4_wrq_tx(sc, wr);
sb->sb_flags &= ~SB_DDP_INDICATE;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r239528 - head/sys/dev/cxgbe/tom

2012-08-21 Thread Navdeep Parhar
Author: np
Date: Tue Aug 21 19:45:19 2012
New Revision: 239528
URL: http://svn.freebsd.org/changeset/base/239528

Log:
  Avoid a NULL pointer dereference.

Modified:
  head/sys/dev/cxgbe/tom/t4_cpl_io.c

Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c
==
--- head/sys/dev/cxgbe/tom/t4_cpl_io.c  Tue Aug 21 19:39:09 2012
(r239527)
+++ head/sys/dev/cxgbe/tom/t4_cpl_io.c  Tue Aug 21 19:45:19 2012
(r239528)
@@ -1007,8 +1007,8 @@ do_abort_req(struct sge_iq *iq, const st
 
CTR6(KTR_CXGBE,
"%s: tid %d (%s), toep_flags 0x%x, inp_flags 0x%x, status %d",
-   __func__, tid, tcpstates[tp->t_state], toep->flags, inp->inp_flags,
-   cpl->status);
+   __func__, tid, tp ? tcpstates[tp->t_state] : "no tp", toep->flags,
+   inp->inp_flags, cpl->status);
 
/*
 * If we'd initiated an abort earlier the reply to it is responsible for
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r239530 - head/sys/arm/at91

2012-08-21 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Aug 21 19:55:24 2012
New Revision: 239530
URL: http://svn.freebsd.org/changeset/base/239530

Log:
  Make some at91_pcm_xxx() functions NULL safe.

Modified:
  head/sys/arm/at91/at91_pmc.c

Modified: head/sys/arm/at91/at91_pmc.c
==
--- head/sys/arm/at91/at91_pmc.cTue Aug 21 19:45:48 2012
(r239529)
+++ head/sys/arm/at91/at91_pmc.cTue Aug 21 19:55:24 2012
(r239530)
@@ -369,12 +369,15 @@ at91_pmc_clock_ref(const char *name)
 void
 at91_pmc_clock_deref(struct at91_pmc_clock *clk)
 {
-
+   if (clk == NULL)
+   return;
 }
 
 void
 at91_pmc_clock_enable(struct at91_pmc_clock *clk)
 {
+   if (clk == NULL)
+   return;
 
/* XXX LOCKING? XXX */
if (clk->parent)
@@ -386,6 +389,8 @@ at91_pmc_clock_enable(struct at91_pmc_cl
 void
 at91_pmc_clock_disable(struct at91_pmc_clock *clk)
 {
+   if (clk == NULL)
+   return;
 
/* XXX LOCKING? XXX */
if (--clk->refcnt == 0 && clk->set_mode)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r239531 - head/sys/dev/usb/controller

2012-08-21 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Aug 21 20:10:59 2012
New Revision: 239531
URL: http://svn.freebsd.org/changeset/base/239531

Log:
  Fix USB drivers for KB920X target.
  Add missing clock settings.
  VBUS GPIO IRQ is still missing (TODO).

Modified:
  head/sys/dev/usb/controller/at91dci_atmelarm.c
  head/sys/dev/usb/controller/ohci_atmelarm.c

Modified: head/sys/dev/usb/controller/at91dci_atmelarm.c
==
--- head/sys/dev/usb/controller/at91dci_atmelarm.c  Tue Aug 21 19:55:24 
2012(r239530)
+++ head/sys/dev/usb/controller/at91dci_atmelarm.c  Tue Aug 21 20:10:59 
2012(r239531)
@@ -80,6 +80,7 @@ static device_detach_t at91_udp_detach;
 
 struct at91_udp_softc {
struct at91dci_softc sc_dci;/* must be first */
+   struct at91_pmc_clock *sc_mclk;
struct at91_pmc_clock *sc_iclk;
struct at91_pmc_clock *sc_fclk;
struct resource *sc_vbus_irq_res;
@@ -107,6 +108,7 @@ at91_udp_clocks_on(void *arg)
 {
struct at91_udp_softc *sc = arg;
 
+   at91_pmc_clock_enable(sc->sc_mclk);
at91_pmc_clock_enable(sc->sc_iclk);
at91_pmc_clock_enable(sc->sc_fclk);
 }
@@ -118,6 +120,7 @@ at91_udp_clocks_off(void *arg)
 
at91_pmc_clock_disable(sc->sc_fclk);
at91_pmc_clock_disable(sc->sc_iclk);
+   at91_pmc_clock_disable(sc->sc_mclk);
 }
 
 static void
@@ -185,6 +188,7 @@ at91_udp_attach(device_t dev)
/* wait 10ms for pulldown to stabilise */
usb_pause_mtx(NULL, hz / 100);
 
+   sc->sc_mclk = at91_pmc_clock_ref("mck");
sc->sc_iclk = at91_pmc_clock_ref("udc_clk");
sc->sc_fclk = at91_pmc_clock_ref("udpck");
 
@@ -209,8 +213,9 @@ at91_udp_attach(device_t dev)
rid = 1;
sc->sc_vbus_irq_res =
bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE);
-   if (!(sc->sc_vbus_irq_res)) {
-   goto error;
+   if (sc->sc_vbus_irq_res == NULL) {
+   at91_pio_gpio_set_interrupt(VBUS_BASE, VBUS_MASK, 0);
+   device_printf(dev, "No VBUS IRQ!");
}
sc->sc_dci.sc_bus.bdev = device_add_child(dev, "usbus", -1);
if (!(sc->sc_dci.sc_bus.bdev)) {
@@ -230,11 +235,19 @@ at91_udp_attach(device_t dev)
goto error;
}
 #if (__FreeBSD_version >= 700031)
-   err = bus_setup_intr(dev, sc->sc_vbus_irq_res, INTR_TYPE_BIO | 
INTR_MPSAFE,
-   NULL, (driver_intr_t *)at91_vbus_poll, sc, &sc->sc_vbus_intr_hdl);
+   if (sc->sc_vbus_irq_res != NULL) {
+   err = bus_setup_intr(dev, sc->sc_vbus_irq_res,
+   INTR_TYPE_BIO | INTR_MPSAFE,
+   NULL, (driver_intr_t *)at91_vbus_poll, sc,
+   &sc->sc_vbus_intr_hdl);
+   }
 #else
-   err = bus_setup_intr(dev, sc->sc_vbus_irq_res, INTR_TYPE_BIO | 
INTR_MPSAFE,
-   (driver_intr_t *)at91_vbus_poll, sc, &sc->sc_vbus_intr_hdl);
+   if (sc->sc_vbus_irq_res != NULL) {
+   err = bus_setup_intr(dev, sc->sc_vbus_irq_res,
+   INTR_TYPE_BIO | INTR_MPSAFE,
+   (driver_intr_t *)at91_vbus_poll, sc,
+   &sc->sc_vbus_intr_hdl);
+   }
 #endif
if (err) {
sc->sc_vbus_intr_hdl = NULL;
@@ -317,8 +330,10 @@ at91_udp_detach(device_t dev)
/* disable clocks */
at91_pmc_clock_disable(sc->sc_iclk);
at91_pmc_clock_disable(sc->sc_fclk);
+   at91_pmc_clock_disable(sc->sc_mclk);
at91_pmc_clock_deref(sc->sc_fclk);
at91_pmc_clock_deref(sc->sc_iclk);
+   at91_pmc_clock_deref(sc->sc_mclk);
 
return (0);
 }

Modified: head/sys/dev/usb/controller/ohci_atmelarm.c
==
--- head/sys/dev/usb/controller/ohci_atmelarm.c Tue Aug 21 19:55:24 2012
(r239530)
+++ head/sys/dev/usb/controller/ohci_atmelarm.c Tue Aug 21 20:10:59 2012
(r239531)
@@ -69,6 +69,7 @@ static device_detach_t ohci_atmelarm_det
 
 struct at91_ohci_softc {
struct ohci_softc sc_ohci;  /* must be first */
+   struct at91_pmc_clock *mclk;
struct at91_pmc_clock *iclk;
struct at91_pmc_clock *fclk;
 };
@@ -98,6 +99,7 @@ ohci_atmelarm_attach(device_t dev)
USB_GET_DMA_TAG(dev), &ohci_iterate_hw_softc)) {
return (ENOMEM);
}
+   sc->mclk = at91_pmc_clock_ref("mck");
sc->iclk = at91_pmc_clock_ref("ohci_clk");
sc->fclk = at91_pmc_clock_ref("uhpck");
 
@@ -143,6 +145,7 @@ ohci_atmelarm_attach(device_t dev)
/*
 * turn on the clocks from the AT91's point of view.  Keep the unit in 
reset.
 */
+   at91_pmc_clock_enable(sc->mclk);
at91_pmc_clock_enable(sc->iclk);
at91_pmc_clock_enable(sc->fclk);
bus_space_write_4(sc->sc_ohci.sc_io_tag, sc->sc_ohci.sc_io_hdl,
@@ -191,8 +194,10 @@ ohci_atmelarm_detach(device_t dev)
 
at91_pmc_clock_disable(sc

svn commit: r239532 - head/sys/dev/usb/controller

2012-08-21 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Aug 21 20:18:01 2012
New Revision: 239532
URL: http://svn.freebsd.org/changeset/base/239532

Log:
  Style.

Modified:
  head/sys/dev/usb/controller/at91dci_atmelarm.c

Modified: head/sys/dev/usb/controller/at91dci_atmelarm.c
==
--- head/sys/dev/usb/controller/at91dci_atmelarm.c  Tue Aug 21 20:10:59 
2012(r239531)
+++ head/sys/dev/usb/controller/at91dci_atmelarm.c  Tue Aug 21 20:18:01 
2012(r239532)
@@ -215,7 +215,7 @@ at91_udp_attach(device_t dev)
bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE);
if (sc->sc_vbus_irq_res == NULL) {
at91_pio_gpio_set_interrupt(VBUS_BASE, VBUS_MASK, 0);
-   device_printf(dev, "No VBUS IRQ!");
+   device_printf(dev, "No VBUS IRQ!\n");
}
sc->sc_dci.sc_bus.bdev = device_add_child(dev, "usbus", -1);
if (!(sc->sc_dci.sc_bus.bdev)) {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r239533 - head/share/man/man3

2012-08-21 Thread Joel Dahl
Author: joel (doc committer)
Date: Tue Aug 21 20:40:12 2012
New Revision: 239533
URL: http://svn.freebsd.org/changeset/base/239533

Log:
  Remove trailing whitespace.

Modified:
  head/share/man/man3/pthread_getcpuclockid.3

Modified: head/share/man/man3/pthread_getcpuclockid.3
==
--- head/share/man/man3/pthread_getcpuclockid.3 Tue Aug 21 20:18:01 2012
(r239532)
+++ head/share/man/man3/pthread_getcpuclockid.3 Tue Aug 21 20:40:12 2012
(r239533)
@@ -34,7 +34,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 21, 2012 
+.Dd August 21, 2012
 .Dt PTHREAD_GETCPUCLOCKID 3
 .Os
 .Sh NAME
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r239544 - in head/sys/dev: cxgb/ulp/tom cxgbe/tom

2012-08-21 Thread Navdeep Parhar
Author: np
Date: Tue Aug 21 22:23:17 2012
New Revision: 239544
URL: http://svn.freebsd.org/changeset/base/239544

Log:
  Deal with the case where a syncache entry added by the TOE driver is
  evicted from the syncache but a later syncache_expand succeeds because
  of syncookies.  The TOE driver has to resort to more direct means to
  install its hooks in the socket in this case.

Modified:
  head/sys/dev/cxgb/ulp/tom/cxgb_listen.c
  head/sys/dev/cxgb/ulp/tom/cxgb_toepcb.h
  head/sys/dev/cxgbe/tom/t4_listen.c
  head/sys/dev/cxgbe/tom/t4_tom.h

Modified: head/sys/dev/cxgb/ulp/tom/cxgb_listen.c
==
--- head/sys/dev/cxgb/ulp/tom/cxgb_listen.c Tue Aug 21 21:46:44 2012
(r239543)
+++ head/sys/dev/cxgb/ulp/tom/cxgb_listen.c Tue Aug 21 22:23:17 2012
(r239544)
@@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #define TCPSTATES
 #include 
@@ -759,6 +760,15 @@ reset:
goto reset;
}
 
+   if (__predict_false(!(synqe->flags & TP_SYNQE_EXPANDED))) {
+   struct inpcb *new_inp = sotoinpcb(so);
+
+   INP_WLOCK(new_inp);
+   tcp_timer_activate(intotcpcb(new_inp), TT_KEEP, 0);
+   t3_offload_socket(tod, synqe, so);
+   INP_WUNLOCK(new_inp);
+   }
+
/* Remove the synq entry and release its reference on the lctx */
TAILQ_REMOVE(&lctx->synq, synqe, link);
inp = release_lctx(td, lctx);
@@ -1136,5 +1146,6 @@ t3_offload_socket(struct toedev *tod, vo
offload_socket(so, toep);
make_established(so, cpl->snd_isn, cpl->rcv_isn, cpl->tcp_opt);
update_tid(td, toep, synqe->tid);
+   synqe->flags |= TP_SYNQE_EXPANDED;
 }
 #endif

Modified: head/sys/dev/cxgb/ulp/tom/cxgb_toepcb.h
==
--- head/sys/dev/cxgb/ulp/tom/cxgb_toepcb.h Tue Aug 21 21:46:44 2012
(r239543)
+++ head/sys/dev/cxgb/ulp/tom/cxgb_toepcb.h Tue Aug 21 22:23:17 2012
(r239544)
@@ -44,6 +44,7 @@
 #define TP_IS_A_SYNQ_ENTRY (1 << 9)
 #define TP_ABORT_RPL_SENT  (1 << 10)
 #define TP_SEND_FIN(1 << 11)
+#define TP_SYNQE_EXPANDED  (1 << 12)
 
 struct toepcb {
TAILQ_ENTRY(toepcb) link; /* toep_list */

Modified: head/sys/dev/cxgbe/tom/t4_listen.c
==
--- head/sys/dev/cxgbe/tom/t4_listen.c  Tue Aug 21 21:46:44 2012
(r239543)
+++ head/sys/dev/cxgbe/tom/t4_listen.c  Tue Aug 21 22:23:17 2012
(r239544)
@@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #define TCPSTATES
 #include 
@@ -805,6 +806,7 @@ t4_offload_socket(struct toedev *tod, vo
make_established(toep, cpl->snd_isn, cpl->rcv_isn, cpl->tcp_opt);
toep->flags |= TPF_CPL_PENDING;
update_tid(sc, synqe->tid, toep);
+   synqe->flags |= TPF_SYNQE_EXPANDED;
 }
 
 static inline void
@@ -1349,6 +1351,24 @@ reset:
goto reset;
}
 
+   /*
+* This is for the unlikely case where the syncache entry that we added
+* has been evicted from the syncache, but the syncache_expand above
+* works because of syncookies.
+*
+* XXX: we've held the tcbinfo lock throughout so there's no risk of
+* anyone accept'ing a connection before we've installed our hooks, but
+* this somewhat defeats the purpose of having a tod_offload_socket :-(
+*/
+   if (__predict_false(!(synqe->flags & TPF_SYNQE_EXPANDED))) {
+   struct inpcb *new_inp = sotoinpcb(so);
+
+   INP_WLOCK(new_inp);
+   tcp_timer_activate(intotcpcb(new_inp), TT_KEEP, 0);
+   t4_offload_socket(TOEDEV(ifp), synqe, so);
+   INP_WUNLOCK(new_inp);
+   }
+
/* Done with the synqe */
TAILQ_REMOVE(&lctx->synq, synqe, link);
inp = release_lctx(sc, lctx);

Modified: head/sys/dev/cxgbe/tom/t4_tom.h
==
--- head/sys/dev/cxgbe/tom/t4_tom.h Tue Aug 21 21:46:44 2012
(r239543)
+++ head/sys/dev/cxgbe/tom/t4_tom.h Tue Aug 21 22:23:17 2012
(r239544)
@@ -66,6 +66,7 @@ enum {
TPF_SYNQE  = (1 << 8),  /* synq_entry, not really a toepcb */
TPF_SYNQE_NEEDFREE = (1 << 9),  /* synq_entry was malloc'd separately */
TPF_SYNQE_TCPDDP   = (1 << 10), /* ulp_mode TCPDDP in toepcb */
+   TPF_SYNQE_EXPANDED = (1 << 11), /* toepcb ready, tid context updated */
 };
 
 enum {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r239545 - in head/sys/dev/isci: . scil

2012-08-21 Thread Jim Harris
Author: jimharris
Date: Tue Aug 21 22:28:14 2012
New Revision: 239545
URL: http://svn.freebsd.org/changeset/base/239545

Log:
  Fix/add support for SCSI UNMAP to ATA DSM translation.
  
  This addresses kernel panic observed when sending SCSI UNMAP
  commands to SATA disks attached to isci(4).
  
  1) Flesh out callback routines to allocate/free buffers needed for
 translating SCSI UNMAP data to ATA DSM data.
  2) Add controller-level pool for storing buffers previously allocated
 for UNMAP translation, to lessen chance of no buffer available
 under memory pressure.
  3) Ensure driver properly handles case where buffer pool is empty
 and contigmalloc returns NULL.
  
  Sponsored by: Intel
  Reported by: Maksim Yevmenkin 
  Discussed with:  scottl
  MFC after: 3 days

Modified:
  head/sys/dev/isci/isci.c
  head/sys/dev/isci/isci.h
  head/sys/dev/isci/isci_controller.c
  head/sys/dev/isci/scil/sati_unmap.c
  head/sys/dev/isci/scil/scif_sas_sati_binding.h
  head/sys/dev/isci/scil/scif_sas_stp_io_request.c

Modified: head/sys/dev/isci/isci.c
==
--- head/sys/dev/isci/isci.cTue Aug 21 22:23:17 2012(r239544)
+++ head/sys/dev/isci/isci.cTue Aug 21 22:28:14 2012(r239545)
@@ -185,6 +185,7 @@ isci_detach(device_t device)
for (i = 0; i < isci->controller_count; i++) {
struct ISCI_CONTROLLER *controller = &isci->controllers[i];
SCI_STATUS status;
+   void *unmap_buffer;
 
if (controller->scif_controller_handle != NULL) {
scic_controller_disable_interrupts(
@@ -218,6 +219,13 @@ isci_detach(device_t device)
 
if (controller->remote_device_memory != NULL)
free(controller->remote_device_memory, M_ISCI);
+
+   while (1) {
+   sci_pool_get(controller->unmap_buffer_pool, 
unmap_buffer);
+   if (unmap_buffer == NULL)
+   break;
+   contigfree(unmap_buffer, PAGE_SIZE, M_ISCI);
+   }
}
 
/* The SCIF controllers have been stopped, so we can now

Modified: head/sys/dev/isci/isci.h
==
--- head/sys/dev/isci/isci.hTue Aug 21 22:23:17 2012(r239544)
+++ head/sys/dev/isci/isci.hTue Aug 21 22:28:14 2012(r239545)
@@ -175,6 +175,7 @@ struct ISCI_CONTROLLER
SCI_POOL_CREATE(remote_device_pool, struct ISCI_REMOTE_DEVICE *, 
SCI_MAX_REMOTE_DEVICES);
SCI_POOL_CREATE(request_pool, struct ISCI_REQUEST *, 
SCI_MAX_IO_REQUESTS);
SCI_POOL_CREATE(timer_pool, struct ISCI_TIMER *, SCI_MAX_TIMERS);
+   SCI_POOL_CREATE(unmap_buffer_pool, void *, SCI_MAX_REMOTE_DEVICES);
 };
 
 struct ISCI_REQUEST

Modified: head/sys/dev/isci/isci_controller.c
==
--- head/sys/dev/isci/isci_controller.c Tue Aug 21 22:23:17 2012
(r239544)
+++ head/sys/dev/isci/isci_controller.c Tue Aug 21 22:28:14 2012
(r239545)
@@ -145,6 +145,14 @@ void scif_cb_controller_stop_complete(SC
isci_controller->is_started = FALSE;
 }
 
+static void
+isci_single_map(void *arg, bus_dma_segment_t *seg, int nseg, int error)
+{
+   SCI_PHYSICAL_ADDRESS *phys_addr = arg;
+
+   *phys_addr = seg[0].ds_addr;
+}
+
 /**
  * @brief This method will be invoked to allocate memory dynamically.
  *
@@ -159,7 +167,29 @@ void scif_cb_controller_stop_complete(SC
 void scif_cb_controller_allocate_memory(SCI_CONTROLLER_HANDLE_T controller,
 SCI_PHYSICAL_MEMORY_DESCRIPTOR_T *mde)
 {
+   struct ISCI_CONTROLLER *isci_controller = (struct ISCI_CONTROLLER *)
+   sci_object_get_association(controller);
 
+   /*
+* Note this routine is only used for buffers needed to translate
+* SCSI UNMAP commands to ATA DSM commands for SATA disks.
+*
+* We first try to pull a buffer from the controller's pool, and only
+* call contigmalloc if one isn't there.
+*/
+   if (!sci_pool_empty(isci_controller->unmap_buffer_pool)) {
+   sci_pool_get(isci_controller->unmap_buffer_pool,
+   mde->virtual_address);
+   } else
+   mde->virtual_address = contigmalloc(PAGE_SIZE,
+   M_ISCI, M_NOWAIT, 0, BUS_SPACE_MAXADDR,
+   mde->constant_memory_alignment, 0);
+
+   if (mde->virtual_address != NULL)
+   bus_dmamap_load(isci_controller->buffer_dma_tag,
+   NULL, mde->virtual_address, PAGE_SIZE,
+   isci_single_map, &mde->physical_address,
+   BUS_DMA_NOWAIT);
 }
 
 /**
@@ -176,7 +206,16 @@ void scif_cb_controller_allocate_memory(
 void scif_cb_controller_free_memory(SCI_CONTROLLER_HANDLE_T controller,
 SCI_PHYSICAL_MEMORY_DESCRIPTOR_T * m

Re: svn commit: r238563 - head/gnu/usr.bin/groff/tmac

2012-08-21 Thread Jilles Tjoelker
On Mon, Aug 20, 2012 at 10:35:19PM -0700, Simon J. Gerraty wrote:
> Hi, sorry about the slow response.

> On Thu, 26 Jul 2012 12:49:03 +0400, Ruslan Ermilov writes:
> >On Wed, Jul 18, 2012 at 05:57:43AM +, David E. O'Brien wrote:
> >> Author: obrien
> >> Date: Wed Jul 18 05:57:42 2012
> >> New Revision: 238563
> >> URL: http://svn.freebsd.org/changeset/base/238563

> >> Log:
> >>   a ";" tells make we want the shell to be used

> >>   Submitted by:Simon Gerraty 

> >> Modified:
> >>   head/gnu/usr.bin/groff/tmac/Makefile

> >I don't quite understand what this change does, could you elaborate?

> Sure.  This is a consequence of bmake trying to be clever.

> >Without -jN (in backwards compatibility mode), the "cd" is a no-op
> >(whether it's terminated by `;' or not) because make will execute a
> >single shell per command, with cwd set to ${.OBJDIR}.

> Except on very weird systems, bmake is built in what NetBSD call
> "native" mode, and even in compat mode will attempt to avoid the
> overhead of all those shells.
> Thus, unless it spots a shell meta char, it will try and skip the shell.

> Shell builtins like 'cd' or 'chdir' cannot be directly invoked, but make
> doesn't know that.  Simply adding the ';' convinces it to use a shell.
> It is still a no-op.

On FreeBSD, the first two statements are partially false. All sh(1)
builtins that correspond to utilities specified by POSIX (but not
special builtins) have versions accessible to execve() (on 8.x and
older, hash, type and ulimit are missing). This includes cd but not
chdir, since chdir is not specified by POSIX. Also, FreeBSD make
includes a somewhat arbitrary list of shell builtins, including cd, that
cause it to invoke the shell even if there are no metacharacters.

This list of shell builtins should probably be replaced with the list of
POSIX special builtins, which are
  break continue eval exec exit export readonly return set shift times
  trap unset . :

There is a portability issue in that a few systems refuse to comply to
the part of POSIX (XCU 1.6 Built-In Utilities) that says that all
specified utilities (except special builtins) shall be accessible via
exec functions, env, find, nice, nohup, time, xargs. Working around this
requires knowing which utilities are "generally" only provided as
builtins.

> >With -jN, "cd" becomes necessary because all commands are executed as
> >a script by one shell (the reason it was added in the first place),
> >but adding `;' is a no-op because commands are on separate lines.

> A better way to construct targets like this is to put any excursion out
> of .OBJDIR inside ():

>   (cd ${.CURDIR} && \
>   ${INSTALL} -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \
>   koi8-r.tmac hyphen.ru ${DESTDIR}${TMACDIR})

> then the cd ${.OBJDIR} isn't needed at all.
> note use of && rather than ; which can be very dangerous

This method makes more sense and should hardly cost any performance.

-- 
Jilles Tjoelker
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r238563 - head/gnu/usr.bin/groff/tmac

2012-08-21 Thread Simon J. Gerraty

On Wed, 22 Aug 2012 00:29:44 +0200, Jilles Tjoelker writes:
>On FreeBSD, the first two statements are partially false. All sh(1)
>builtins that correspond to utilities specified by POSIX (but not
>special builtins) have versions accessible to execve() (on 8.x and

That's interesting, especially for 'cd', though is there any use case in
which it is actually useful? I'm drawing a blank.

>older, hash, type and ulimit are missing). This includes cd but not
>chdir, since chdir is not specified by POSIX. Also, FreeBSD make
>includes a somewhat arbitrary list of shell builtins, including cd, that
>cause it to invoke the shell even if there are no metacharacters.

Yes, I pondered whether something like that might be worthwhile,
but since a bare 'cd somewhere' all by itself is rather pointless, it
seemed a corner case.

>> A better way to construct targets like this is to put any excursion out
>> of .OBJDIR inside ():
>
>>  (cd ${.CURDIR} && \
>>  ${INSTALL} -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \
>>  koi8-r.tmac hyphen.ru ${DESTDIR}${TMACDIR})
>
>> then the cd ${.OBJDIR} isn't needed at all.
>> note use of && rather than ; which can be very dangerous
>
>This method makes more sense and should hardly cost any performance.

Agreed.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r239547 - head/sys/conf

2012-08-21 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Tue Aug 21 23:44:47 2012
New Revision: 239547
URL: http://svn.freebsd.org/changeset/base/239547

Log:
  Get rid of ARM_BIG_ENDIAN for good:
- remove leftovers in Makefile.arm
- Let ld use default output format instead of providing one in ldscript

Modified:
  head/sys/conf/Makefile.arm
  head/sys/conf/ldscript.arm

Modified: head/sys/conf/Makefile.arm
==
--- head/sys/conf/Makefile.arm  Tue Aug 21 22:42:46 2012(r239546)
+++ head/sys/conf/Makefile.arm  Tue Aug 21 23:44:47 2012(r239547)
@@ -35,17 +35,6 @@ INCLUDES+= -I$S/contrib/libfdt
 SYSTEM_LD:= ${SYSTEM_LD:$S/conf/ldscript.$M=ldscript.$M}
 SYSTEM_DEP:= ${SYSTEM_DEP:$S/conf/ldscript.$M=ldscript.$M}
 
-.if defined(ARM_BIG_ENDIAN)
-CC += -mbig-endian
-SYSTEM_LD += -EB
-LD += -EB
-.else
-CC += -mlittle-endian
-SYSTEM_LD += -EL
-LD += -EL
-.endif
-
-
 .if !defined(DEBUG) && !defined(PROFLEVEL)
 STRIP_FLAGS = -S
 .endif

Modified: head/sys/conf/ldscript.arm
==
--- head/sys/conf/ldscript.arm  Tue Aug 21 22:42:46 2012(r239546)
+++ head/sys/conf/ldscript.arm  Tue Aug 21 23:44:47 2012(r239547)
@@ -1,5 +1,4 @@
 /* $FreeBSD$ */
-OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
 OUTPUT_ARCH(arm)
 ENTRY(_start)
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r239548 - head/sys/powerpc/powermac

2012-08-21 Thread Justin Hibbits
Author: jhibbits
Date: Tue Aug 21 23:55:29 2012
New Revision: 239548
URL: http://svn.freebsd.org/changeset/base/239548

Log:
  phandle_t is unsigned, and OF_finddevice() returns (phandle_t)(-1) on
  failure, so check for that instead of 0.
  
  While here, provide a better description for ATI backlight driver.
  
  Reported by:  jchandra@
  MFC after:3 days

Modified:
  head/sys/powerpc/powermac/atibl.c
  head/sys/powerpc/powermac/nvbl.c

Modified: head/sys/powerpc/powermac/atibl.c
==
--- head/sys/powerpc/powermac/atibl.c   Tue Aug 21 23:44:47 2012
(r239547)
+++ head/sys/powerpc/powermac/atibl.c   Tue Aug 21 23:55:29 2012
(r239548)
@@ -98,7 +98,7 @@ atibl_probe(device_t dev)
 
handle = OF_finddevice("mac-io/backlight");
 
-   if (handle <= 0)
+   if (handle == -1)
return (ENXIO);
 
if (OF_getprop(handle, "backlight-control", &control, sizeof(control)) 
< 0)
@@ -107,7 +107,7 @@ atibl_probe(device_t dev)
if (strcmp(control, "ati") != 0)
return (ENXIO);
 
-   device_set_desc(dev, "PowerBook backlight");
+   device_set_desc(dev, "PowerBook backlight for ATI graphics");
 
return (0);
 }

Modified: head/sys/powerpc/powermac/nvbl.c
==
--- head/sys/powerpc/powermac/nvbl.cTue Aug 21 23:44:47 2012
(r239547)
+++ head/sys/powerpc/powermac/nvbl.cTue Aug 21 23:55:29 2012
(r239548)
@@ -94,7 +94,7 @@ nvbl_probe(device_t dev)
 
handle = OF_finddevice("mac-io/backlight");
 
-   if (handle <= 0)
+   if (handle == -1)
return (ENXIO);
 
if (OF_getprop(handle, "backlight-control", &control, sizeof(control)) 
< 0)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r239356 - head/sbin/dhclient

2012-08-21 Thread Andrey Chernov
On Tue, Aug 21, 2012 at 03:58:12PM +0900, Hajimu UMEMOTO wrote:
> Okay, thanks.

I solve this riddle, thanks to your helpful tips.
Relevant part of my setup are at the end of this messae for anybody who 
may have the same problem.

BTW, I notice that link-local router address behavior is 
strange and inconsistant for both 'host -6' and 'dig -6' commands.
host -6 example.com fe80::
dig -6 @fe80:: example.com
both hangs, but in the same time
host -6 example.com fe80::%
dig -6 @fe80::% example.com
works!
host -6 example.com fe80::%1
dig -6 #fe80::%1 example.com
works too. Not understanding addresses without % or %1 looks like 
routing problems, but I don't know where to fix it.
So, I try to use 
nameserver fe80::% (or with %1 suffix)
in my resolv.conf, as result
host -6 example.com
dig -6 example.com
(without NS specified) both hangs despite they working when exact the same 
NS address is given in their command lines.
So, I finally decide to use my router addres from IPv6 /64 subnet
(given by my tunnel). It not goes through the whole tunnel, but directly
to the router.
host -6 example.com
dig -6 example.com
both works when it exists in /etc/reslov.conf.
What I don't understand why all that bad things happens with link-local 
router address. To be sure I test it under Win7 and it works normally.

Finally, what is working:

/etc/resolvconf.conf:
name_servers_append=

/etc/rc.conf:
rtsol_flags="-R /etc/eat.sh"

/etc/eat.sh:
#!/bin/sh
/bin/cat > /dev/null

-- 
http://ache.vniz.net/
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r239553 - head/sys/arm/ti

2012-08-21 Thread Tim Kientzle
Author: kientzle
Date: Wed Aug 22 05:14:59 2012
New Revision: 239553
URL: http://svn.freebsd.org/changeset/base/239553

Log:
  After r239366, fix the ti_edma3.c driver to use the
  exact name as used in the FDT.

Modified:
  head/sys/arm/ti/ti_edma3.c

Modified: head/sys/arm/ti/ti_edma3.c
==
--- head/sys/arm/ti/ti_edma3.c  Wed Aug 22 03:00:57 2012(r239552)
+++ head/sys/arm/ti/ti_edma3.c  Wed Aug 22 05:14:59 2012(r239553)
@@ -142,7 +142,7 @@ static struct {
 static int
 ti_edma3_probe(device_t dev)
 {
-   if (!ofw_bus_is_compatible(dev, "ti,edma"))
+   if (!ofw_bus_is_compatible(dev, "ti,edma3"))
return (ENXIO);
 
device_set_desc(dev, "TI EDMA Controller");
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r239562 - head/usr.sbin/makefs

2012-08-21 Thread Hiroki Sato
Author: hrs
Date: Wed Aug 22 06:37:30 2012
New Revision: 239562
URL: http://svn.freebsd.org/changeset/base/239562

Log:
  Add -p flag to create the image as a sparse file.
  
  Submitted by: Shesha Sreenivasamurthy
  PR:   bin/167779

Modified:
  head/usr.sbin/makefs/ffs.c
  head/usr.sbin/makefs/makefs.8
  head/usr.sbin/makefs/makefs.c
  head/usr.sbin/makefs/makefs.h

Modified: head/usr.sbin/makefs/ffs.c
==
--- head/usr.sbin/makefs/ffs.c  Wed Aug 22 05:38:06 2012(r239561)
+++ head/usr.sbin/makefs/ffs.c  Wed Aug 22 06:37:30 2012(r239562)
@@ -493,13 +493,25 @@ ffs_create_image(const char *image, fsin
bufsize = sfs.f_iosize;
 #endif
bufrem = fsopts->size;
-   if (debug & DEBUG_FS_CREATE_IMAGE)
-   printf(
-   "zero-ing image `%s', %lld sectors, using %d byte chunks\n",
-   image, (long long)bufrem, bufsize);
-   if ((buf = calloc(1, bufsize)) == NULL) {
-   warn("Can't create buffer for sector");
-   return (-1);
+   if (fsopts->sparse) {
+   if (ftruncate(fsopts->fd, bufrem) == -1) {
+   warn("sparse option disabled.\n");
+   fsopts->sparse = 0;
+   }
+   }
+   if (fsopts->sparse) {
+   /* File truncated at bufrem. Remaining is 0 */
+   bufrem = 0;
+   buf = NULL;
+   } else {
+   if (debug & DEBUG_FS_CREATE_IMAGE)
+   printf("zero-ing image `%s', %lld sectors, "
+   "using %d byte chunks\n", image, (long long)bufrem,
+   bufsize);
+   if ((buf = calloc(1, bufsize)) == NULL) {
+   warn("Can't create buffer for sector");
+   return (-1);
+   }
}
while (bufrem > 0) {
i = write(fsopts->fd, buf, MIN(bufsize, bufrem));
@@ -511,7 +523,8 @@ ffs_create_image(const char *image, fsin
}
bufrem -= i;
}
-   free(buf);
+   if (buf)
+   free(buf);
 
/* make the file system */
if (debug & DEBUG_FS_CREATE_IMAGE)

Modified: head/usr.sbin/makefs/makefs.8
==
--- head/usr.sbin/makefs/makefs.8   Wed Aug 22 05:38:06 2012
(r239561)
+++ head/usr.sbin/makefs/makefs.8   Wed Aug 22 06:37:30 2012
(r239562)
@@ -35,7 +35,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 30, 2012
+.Dd August 22, 2012
 .Dt MAKEFS 8
 .Os
 .Sh NAME
@@ -43,6 +43,7 @@
 .Nd create a file system image from a directory tree or a mtree manifest
 .Sh SYNOPSIS
 .Nm
+.Op Fl p
 .Op Fl x
 .Op Fl B Ar byte-order
 .Op Fl b Ar free-blocks
@@ -188,6 +189,8 @@ Set file system specific options.
 .Ar fs-options
 is a comma separated list of options.
 Valid file system specific options are detailed below.
+.It Fl p 
+Create the image as a sparse file.
 .It Fl S Ar sector-size
 Set the file system sector size to
 .Ar sector-size .

Modified: head/usr.sbin/makefs/makefs.c
==
--- head/usr.sbin/makefs/makefs.c   Wed Aug 22 05:38:06 2012
(r239561)
+++ head/usr.sbin/makefs/makefs.c   Wed Aug 22 06:37:30 2012
(r239562)
@@ -112,7 +112,7 @@ main(int argc, char *argv[])
start_time.tv_sec = start.tv_sec;
start_time.tv_nsec = start.tv_usec * 1000;
 
-   while ((ch = getopt(argc, argv, "B:b:d:f:F:M:m:N:o:s:S:t:x")) != -1) {
+   while ((ch = getopt(argc, argv, "B:b:d:f:F:M:m:N:o:ps:S:t:x")) != -1) {
switch (ch) {
 
case 'B':
@@ -199,6 +199,9 @@ main(int argc, char *argv[])
}
break;
}
+   case 'p':
+   fsoptions.sparse = 1;
+   break;
 
case 's':
fsoptions.minsize = fsoptions.maxsize =
@@ -346,7 +349,7 @@ usage(void)
fprintf(stderr,
 "usage: %s [-t fs-type] [-o fs-options] [-d debug-mask] [-B endian]\n"
 "\t[-S sector-size] [-M minimum-size] [-m maximum-size] [-s image-size]\n"
-"\t[-b free-blocks] [-f free-files] [-F mtree-specfile] [-x]\n"
+"\t[-b free-blocks] [-f free-files] [-F mtree-specfile] [-x] [-p]\n"
 "\t[-N userdb-dir] image-file directory | manifest [extra-directory ...]\n",
prog);
exit(1);

Modified: head/usr.sbin/makefs/makefs.h
==
--- head/usr.sbin/makefs/makefs.h   Wed Aug 22 05:38:06 2012
(r239561)
+++ head/usr.sbin/makefs/makefs.h   Wed Aug 22 06:37:30 2012
(r239562)
@@ -129,6 +129,7 @@ typedef struct {
int freeblockpc;/* free block % */
int needswap;   /*