svn commit: r232249 - head

2012-02-28 Thread Sergey Kandaurov
Author: pluknet
Date: Tue Feb 28 11:06:52 2012
New Revision: 232249
URL: http://svn.freebsd.org/changeset/base/232249

Log:
  Add lib32 part after libarchive 3.0.3 update.

Modified:
  head/ObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Tue Feb 28 08:36:38 2012(r232248)
+++ head/ObsoleteFiles.inc  Tue Feb 28 11:06:52 2012(r232249)
@@ -56,6 +56,9 @@ OLD_FILES+=man/man3/archive_read_data_in
man/man3/archive_write_set_compression_none.3.gz \
man/man3/archive_write_set_compression_program.3.gz
 OLD_LIBS+=usr/lib/libarchive.so.5
+.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
+OLD_LIBS+=usr/lib32/libarchive.so.5
+.endif
 # 20120113: removal of wtmpcvt(1)
 OLD_FILES+=usr/bin/wtmpcvt
 OLD_FILES+=usr/share/man/man1/wtmpcvt.1.gz
___
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: r232250 - in head: sbin/ifconfig sbin/ipfw share/man/man4 sys/conf sys/dev/ath sys/dev/siba sys/ia64/ia64 sys/mips/rt305x

2012-02-28 Thread Gavin Atkinson
Author: gavin
Date: Tue Feb 28 13:19:34 2012
New Revision: 232250
URL: http://svn.freebsd.org/changeset/base/232250

Log:
  Correct capitalization of "Hz" in user-visible text (manpages, printf(),
  etc).
  
  MFC after:3 days

Modified:
  head/sbin/ifconfig/ifconfig.8
  head/sbin/ipfw/ipfw.8
  head/share/man/man4/ath.4
  head/share/man/man4/net80211.4
  head/sys/conf/NOTES
  head/sys/dev/ath/if_ath_sysctl.c
  head/sys/dev/siba/siba_core.c
  head/sys/ia64/ia64/machdep.c
  head/sys/mips/rt305x/rt305x_sysctl.c

Modified: head/sbin/ifconfig/ifconfig.8
==
--- head/sbin/ifconfig/ifconfig.8   Tue Feb 28 11:06:52 2012
(r232249)
+++ head/sbin/ifconfig/ifconfig.8   Tue Feb 28 13:19:34 2012
(r232250)
@@ -1036,7 +1036,7 @@ Enable Dynamic Frequency Selection (DFS)
 DFS embodies several facilities including detection of overlapping
 radar signals, dynamic transmit power control, and channel selection
 according to a least-congested criteria.
-DFS support is mandatory for some 5Ghz frequencies in certain
+DFS support is mandatory for some 5GHz frequencies in certain
 locales (e.g. ETSI).
 By default DFS is enabled according to the regulatory definitions
 specified in /etc/regdomain.xml and the current country code, regdomain,
@@ -1091,7 +1091,7 @@ By default DTIM is 1 (i.e., DTIM occurs 
 .It Cm quiet
 Enable the use of quiet IE.  Hostap will use this to silent other
 stations to reduce interference for radar detection when
-operating on 5Ghz frequency and doth support is enabled.
+operating on 5GHz frequency and doth support is enabled.
 Use
 .Fl quiet
 to disable this functionality.

Modified: head/sbin/ipfw/ipfw.8
==
--- head/sbin/ipfw/ipfw.8   Tue Feb 28 11:06:52 2012(r232249)
+++ head/sbin/ipfw/ipfw.8   Tue Feb 28 13:19:34 2012(r232250)
@@ -2235,7 +2235,7 @@ specifies the scheduling algorithm to us
 is just a FIFO scheduler (which means that all packets
 are stored in the same queue as they arrive to the scheduler).
 FIFO has O(1) per-packet time complexity, with very low
-constants (estimate 60-80ns on a 2Ghz desktop machine)
+constants (estimate 60-80ns on a 2GHz desktop machine)
 but gives no service guarantees.
 .It Cm wf2qp
 implements the WF2Q+ algorithm, which is a Weighted Fair Queueing

Modified: head/share/man/man4/ath.4
==
--- head/share/man/man4/ath.4   Tue Feb 28 11:06:52 2012(r232249)
+++ head/share/man/man4/ath.4   Tue Feb 28 13:19:34 2012(r232250)
@@ -95,8 +95,8 @@ with transmit speeds appropriate to each
 AR5416-class devices are capable of 802.11n operation
 but are supported only in legacy modes (802.11a, 11b, 11g).
 Most chips also support an Atheros Turbo Mode (TM) that operates in
-the 5Ghz frequency range with 2x the transmit speeds.
-Some chips also support Turbo mode in the 2.4Ghz range with 802.11g
+the 5GHz frequency range with 2x the transmit speeds.
+Some chips also support Turbo mode in the 2.4GHz range with 802.11g
 though this support is not presently available due to regulatory requirements.
 (Note that Turbo modes are, however,
 only interoperable with other Atheros-based devices.)

Modified: head/share/man/man4/net80211.4
==
--- head/share/man/man4/net80211.4  Tue Feb 28 11:06:52 2012
(r232249)
+++ head/share/man/man4/net80211.4  Tue Feb 28 13:19:34 2012
(r232250)
@@ -280,7 +280,7 @@ Return whether or not Dynamic Frequency 
 DFS embodies several facilities including detection of overlapping
 radar signals, dynamic transmit power control, and channel selection
 according to a least-congested criteria.
-DFS support is mandatory for some 5Ghz frequencies in certain
+DFS support is mandatory for some 5GHz frequencies in certain
 locales (e.g. ETSI).
 By default DFS is enabled according to the regulatory definitions
 and the current country code, regdomain, and channel.

Modified: head/sys/conf/NOTES
==
--- head/sys/conf/NOTES Tue Feb 28 11:06:52 2012(r232249)
+++ head/sys/conf/NOTES Tue Feb 28 13:19:34 2012(r232250)
@@ -2417,11 +2417,11 @@ device  cmx
 # or
 # options  BROOKTREE_SYSTEM_DEFAULT=BROOKTREE_NTSC
 # Specifies the default video capture mode.
-# This is required for Dual Crystal (28&35Mhz) boards where PAL is used
+# This is required for Dual Crystal (28&35MHz) boards where PAL is used
 # to prevent hangs during initialization, e.g. VideoLogic Captivator PCI.
 #
 # options  BKTR_USE_PLL
-# This is required for PAL or SECAM boards with a 28Mhz crystal and no 35Mhz
+# This is required for PAL or SECAM boards with a 28MHz crystal and no 35MHz
 # crystal, e.g. some new Bt878 cards.
 #

svn commit: r232253 - head

2012-02-28 Thread Sergey Kandaurov
Author: pluknet
Date: Tue Feb 28 14:35:36 2012
New Revision: 232253
URL: http://svn.freebsd.org/changeset/base/232253

Log:
  Correct pathname for manpages after libarchive 3.0.3 update.

Modified:
  head/ObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Tue Feb 28 14:22:54 2012(r232252)
+++ head/ObsoleteFiles.inc  Tue Feb 28 14:35:36 2012(r232253)
@@ -39,22 +39,22 @@
 # done
 
 # 20120225: libarchive 3.0.3
-OLD_FILES+=man/man3/archive_read_data_into_buffer.3.gz \
-   man/man3/archive_read_support_compression_all.3.gz \
-   man/man3/archive_read_support_compression_bzip2.3.gz \
-   man/man3/archive_read_support_compression_compress.3.gz \
-   man/man3/archive_read_support_compression_gzip.3.gz \
-   man/man3/archive_read_support_compression_lzma.3.gz \
-   man/man3/archive_read_support_compression_none.3.gz \
-   man/man3/archive_read_support_compression_program.3.gz \
-   man/man3/archive_read_support_compression_program_signature.3.gz \
-   man/man3/archive_read_support_compression_xz.3.gz \
-   man/man3/archive_write_set_callbacks.3.gz \
-   man/man3/archive_write_set_compression_bzip2.3.gz \
-   man/man3/archive_write_set_compression_compress.3.gz \
-   man/man3/archive_write_set_compression_gzip.3.gz \
-   man/man3/archive_write_set_compression_none.3.gz \
-   man/man3/archive_write_set_compression_program.3.gz
+OLD_FILES+=usr/share/man/man3/archive_read_data_into_buffer.3.gz \
+   usr/share/man/man3/archive_read_support_compression_all.3.gz \
+   usr/share/man/man3/archive_read_support_compression_bzip2.3.gz \
+   usr/share/man/man3/archive_read_support_compression_compress.3.gz \
+   usr/share/man/man3/archive_read_support_compression_gzip.3.gz \
+   usr/share/man/man3/archive_read_support_compression_lzma.3.gz \
+   usr/share/man/man3/archive_read_support_compression_none.3.gz \
+   usr/share/man/man3/archive_read_support_compression_program.3.gz \
+   
usr/share/man/man3/archive_read_support_compression_program_signature.3.gz \
+   usr/share/man/man3/archive_read_support_compression_xz.3.gz \
+   usr/share/man/man3/archive_write_set_callbacks.3.gz \
+   usr/share/man/man3/archive_write_set_compression_bzip2.3.gz \
+   usr/share/man/man3/archive_write_set_compression_compress.3.gz \
+   usr/share/man/man3/archive_write_set_compression_gzip.3.gz \
+   usr/share/man/man3/archive_write_set_compression_none.3.gz \
+   usr/share/man/man3/archive_write_set_compression_program.3.gz
 OLD_LIBS+=usr/lib/libarchive.so.5
 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
 OLD_LIBS+=usr/lib32/libarchive.so.5
___
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: r232254 - in head: share/man/man5 share/man/man9 sys/netatalk

2012-02-28 Thread Kevin Lo
Author: kevlo
Date: Tue Feb 28 15:07:05 2012
New Revision: 232254
URL: http://svn.freebsd.org/changeset/base/232254

Log:
  Fix typos

Modified:
  head/share/man/man5/passwd.5
  head/share/man/man9/byteorder.9
  head/sys/netatalk/aarp.c

Modified: head/share/man/man5/passwd.5
==
--- head/share/man/man5/passwd.5Tue Feb 28 14:35:36 2012
(r232253)
+++ head/share/man/man5/passwd.5Tue Feb 28 15:07:05 2012
(r232254)
@@ -232,7 +232,7 @@ user's home phone number
 .Pp
 The full
 .Ar name
-may contain a ampersand
+may contain an ampersand
 .Pq Ql &
 which will be replaced by
 the capitalized login

Modified: head/share/man/man9/byteorder.9
==
--- head/share/man/man9/byteorder.9 Tue Feb 28 14:35:36 2012
(r232253)
+++ head/share/man/man9/byteorder.9 Tue Feb 28 15:07:05 2012
(r232254)
@@ -123,7 +123,7 @@ The
 .Fn htobe32 ,
 and
 .Fn htobe64
-functions return a integer in the system's native
+functions return an integer in the system's native
 byte order converted to big endian byte order.
 The return value will be the same as the argument on big endian systems.
 .Pp

Modified: head/sys/netatalk/aarp.c
==
--- head/sys/netatalk/aarp.cTue Feb 28 14:35:36 2012(r232253)
+++ head/sys/netatalk/aarp.cTue Feb 28 15:07:05 2012(r232254)
@@ -467,7 +467,7 @@ at_aarpinput(struct ifnet *ifp, struct m
if (aat != NULL) {
if (op == AARPOP_PROBE) {
/*
-* Someone's probing for spa, dealocate the one we've
+* Someone's probing for spa, deallocate the one we've
 * got, so that if the prober keeps the address,
 * we'll be able to arp for him.
 */
___
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: r232255 - head/sys/dev/amr

2012-02-28 Thread Kevin Lo
Author: kevlo
Date: Tue Feb 28 15:09:56 2012
New Revision: 232255
URL: http://svn.freebsd.org/changeset/base/232255

Log:
  Fix checks for error return from amr_sglist_map() and amr_ccb_map()

Modified:
  head/sys/dev/amr/amr_pci.c

Modified: head/sys/dev/amr/amr_pci.c
==
--- head/sys/dev/amr/amr_pci.c  Tue Feb 28 15:07:05 2012(r232254)
+++ head/sys/dev/amr/amr_pci.c  Tue Feb 28 15:09:56 2012(r232255)
@@ -339,11 +339,11 @@ amr_pci_attach(device_t dev)
 /*
  * Build the scatter/gather buffers.
  */
-if (amr_sglist_map(sc))
+if ((error = amr_sglist_map(sc)) != 0)
goto out;
 debug(2, "s/g list mapped");
 
-if (amr_ccb_map(sc))
+if ((error = amr_ccb_map(sc)) != 0)
goto out;
 debug(2, "ccb mapped");
 
___
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: r232256 - head/sys/dev/acpi_support

2012-02-28 Thread Kevin Lo
Author: kevlo
Date: Tue Feb 28 15:12:26 2012
New Revision: 232256
URL: http://svn.freebsd.org/changeset/base/232256

Log:
  Add missing MODULE_DEPEND() so that acpi.ko and aibs.ko can be
  loaded dynamically.

Modified:
  head/sys/dev/acpi_support/atk0110.c

Modified: head/sys/dev/acpi_support/atk0110.c
==
--- head/sys/dev/acpi_support/atk0110.c Tue Feb 28 15:09:56 2012
(r232255)
+++ head/sys/dev/acpi_support/atk0110.c Tue Feb 28 15:12:26 2012
(r232256)
@@ -97,7 +97,7 @@ static driver_t aibs_driver = {
 static devclass_t aibs_devclass;
 
 DRIVER_MODULE(aibs, acpi, aibs_driver, aibs_devclass, NULL, NULL);
-
+MODULE_DEPEND(aibs, acpi, 1, 1, 1);
 
 static char* aibs_hids[] = {
"ATK0110",
___
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: r232181 - in head/sys: kern sys

2012-02-28 Thread John Baldwin
On Tuesday, February 28, 2012 1:34:25 am Julian Elischer wrote:
> On 2/27/12 1:29 AM, Konstantin Belousov wrote:
> > On Mon, Feb 27, 2012 at 10:49:59AM +0200, Mikolaj Golub wrote:
> >> On Mon, 27 Feb 2012 09:28:11 +0100 Pawel Jakub Dawidek wrote:
> >>
> >>   PJD>  On Sun, Feb 26, 2012 at 02:25:48PM +, Mikolaj Golub wrote:
> >>   >>  Author: trociny
> >>   >>  Date: Sun Feb 26 14:25:48 2012
> >>   >>  New Revision: 232181
> >>   >>  URL: http://svn.freebsd.org/changeset/base/232181
> >>   >>
> >>   >>  Log:
> >>   >>Add sysctl to retrieve or set umask of another process.
> >>
> >>   PJD>  "set umask of another process"? This seems... weird. What's the 
> >> purpose
> >>   PJD>  of this change?
> >>
> >> When we were discussing this with Kostik and Robert, and I asked if it 
> >> could
> >> be useful to have the sysctl rw, Kostik described a real situation when he 
> >> had
> >> had to change umask of another process: umask had not been set properly on 
> >> an
> >> aplication start but it could not be restarted until the end of the day.
> >> Kostik was able to fix it using gdb but having an easier way looked useful.
> > kgdb, not gdb.
> >
> > It is indeed possible to write a ptrace-based utility that inject a code
> > payload that would change umask. Since this is very risky but indeed 
> > possible,
> > having the straighforward kernel facility is justified.
> Why not have a sysctl to change a process'  uid, cwd, memory limits, 
> etc. etc.

uid and cwd would be rediculous to change.  However, we recently added sysctls
to allow a sysadmin to read and write the limits of other processes (and that
is a very useful feature indeed since it is not unusual for a long-running
process to require more resources than it was initially allocated, as is the
ability to easily query the limits that a given process is subject to).

> I don't think this belongs in the kernel by default. It's not exactl a 
> call for backout but It's teh next thing short of that. a call for "do 
> you REALLY think we need this particular specific case catered for?"

That said, the umask bit does strike me as a bit more odd than the limits
case.  I would have more need of a tool to let me adjust the listen queue
length of a socket than to adjust umask (I've had to do that multiple times
via kgdb).

-- 
John Baldwin
___
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: r232257 - in head: share/man/man4 sys/dev/usb sys/dev/usb/net

2012-02-28 Thread Kevin Lo
Author: kevlo
Date: Tue Feb 28 15:45:42 2012
New Revision: 232257
URL: http://svn.freebsd.org/changeset/base/232257

Log:
  Add support for the MCS7832
  
  Obtained from:OpenBSD

Modified:
  head/share/man/man4/mos.4
  head/sys/dev/usb/net/if_mos.c
  head/sys/dev/usb/net/if_mosreg.h
  head/sys/dev/usb/usbdevs

Modified: head/share/man/man4/mos.4
==
--- head/share/man/man4/mos.4   Tue Feb 28 15:12:26 2012(r232256)
+++ head/share/man/man4/mos.4   Tue Feb 28 15:45:42 2012(r232257)
@@ -20,7 +20,7 @@
 .Os
 .Sh NAME
 .Nm mos
-.Nd Moschip MCS7730/MCS7840 USB Ethernet driver
+.Nd Moschip MCS7730/MCS7830/MCS7832 USB Ethernet driver
 .Sh SYNOPSIS
 To compile this driver into the kernel,
 place the following lines in your
@@ -44,9 +44,9 @@ if_mos_load="YES"
 The
 .Nm
 driver provides support for USB Ethernet adapters based on the 
-Moschip MCS7730/MCS7830 chipset.
+Moschip MCS7730/MCS7830/MCS7832 chipset.
 .Pp
-The adapters that contain the Moschip MCS7730/MCS7830 chipset
+The adapters that contain the Moschip MCS7730/MCS7830/MCS7832 chipset
 will operate at 100Base-TX and full-duplex.
 .Pp
 The Moschip contains a 10/100

Modified: head/sys/dev/usb/net/if_mos.c
==
--- head/sys/dev/usb/net/if_mos.c   Tue Feb 28 15:12:26 2012
(r232256)
+++ head/sys/dev/usb/net/if_mos.c   Tue Feb 28 15:45:42 2012
(r232257)
@@ -82,7 +82,7 @@
 __FBSDID("$FreeBSD$");
 
 /*
- * Moschip MCS7730/MCS7830 USB to Ethernet controller
+ * Moschip MCS7730/MCS7830/MCS7832 USB to Ethernet controller
  * The datasheet is available at the following URL:
  * http://www.moschip.com/data/products/MCS7830/Data%20Sheet_7830.pdf
  */
@@ -149,6 +149,7 @@ SYSCTL_INT(_hw_usb_mos, OID_AUTO, debug,
 static const STRUCT_USB_HOST_ID mos_devs[] = {
{USB_VPI(USB_VENDOR_MOSCHIP, USB_PRODUCT_MOSCHIP_MCS7730, MCS7730)},
{USB_VPI(USB_VENDOR_MOSCHIP, USB_PRODUCT_MOSCHIP_MCS7830, MCS7830)},
+   {USB_VPI(USB_VENDOR_MOSCHIP, USB_PRODUCT_MOSCHIP_MCS7832, MCS7832)},
{USB_VPI(USB_VENDOR_SITECOMEU, USB_PRODUCT_SITECOMEU_LN030, MCS7830)},
 };
 
@@ -715,6 +716,8 @@ mos_attach(device_t dev)
MOS_DPRINTFN("model: MCS7730");
} else if (sc->mos_flags & MCS7830) {
MOS_DPRINTFN("model: MCS7830");
+   } else if (sc->mos_flags & MCS7832) {
+   MOS_DPRINTFN("model: MCS7832");
}
error = uether_ifattach(ue);
if (error) {

Modified: head/sys/dev/usb/net/if_mosreg.h
==
--- head/sys/dev/usb/net/if_mosreg.hTue Feb 28 15:12:26 2012
(r232256)
+++ head/sys/dev/usb/net/if_mosreg.hTue Feb 28 15:45:42 2012
(r232257)
@@ -152,6 +152,7 @@
 
 #defineMCS7730 0x0001
 #defineMCS7830 0x0002
+#defineMCS7832 0x0004
 
 #defineMOS_INC(x, y)   (x) = (x + 1) % y
 

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsTue Feb 28 15:12:26 2012(r232256)
+++ head/sys/dev/usb/usbdevsTue Feb 28 15:45:42 2012(r232257)
@@ -2306,6 +2306,7 @@ product MOSCHIP MCS7703   0x7703  MCS7703 
 product MOSCHIP MCS77300x7730  MCS7730 Ethernet
 product MOSCHIP MCS78200x7820  MCS7820 Serial Port Adapter
 product MOSCHIP MCS78300x7830  MCS7830 Ethernet
+product MOSCHIP MCS78320x7832  MCS7832 Ethernet
 product MOSCHIP MCS78400x7840  MCS7840 Serial Port Adapter
 
 /* Motorola products */
___
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: r232258 - head/share/man/man4

2012-02-28 Thread Kevin Lo
Author: kevlo
Date: Tue Feb 28 15:47:39 2012
New Revision: 232258
URL: http://svn.freebsd.org/changeset/base/232258

Log:
  Mention mos(4)

Modified:
  head/share/man/man4/usb.4

Modified: head/share/man/man4/usb.4
==
--- head/share/man/man4/usb.4   Tue Feb 28 15:45:42 2012(r232257)
+++ head/share/man/man4/usb.4   Tue Feb 28 15:47:39 2012(r232258)
@@ -150,6 +150,7 @@ specifications can be found at:
 .Xr cue 4 ,
 .Xr ehci 4 ,
 .Xr kue 4 ,
+.Xr mos 4 ,
 .Xr ohci 4 ,
 .Xr pci 4 ,
 .Xr rue 4 ,
___
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: r232260 - head/sys/dev/aac

2012-02-28 Thread Ed Maste
Author: emaste
Date: Tue Feb 28 17:29:31 2012
New Revision: 232260
URL: http://svn.freebsd.org/changeset/base/232260

Log:
  Avoid transfers crossing a 4GB boundary, which can lead to data
  corruption.  Thanks to scottl@ for the suggestion.
  
  This change will likely be revised after consideration of a general
  method to address this type of issue for other drivers.
  
  Sponsored by:   Sandvine Incorporated
  MFC after:  3 days

Modified:
  head/sys/dev/aac/aac_pci.c

Modified: head/sys/dev/aac/aac_pci.c
==
--- head/sys/dev/aac/aac_pci.c  Tue Feb 28 15:52:01 2012(r232259)
+++ head/sys/dev/aac/aac_pci.c  Tue Feb 28 17:29:31 2012(r232260)
@@ -403,7 +403,8 @@ aac_pci_attach(device_t dev)
 * Note that some of these controllers are 64-bit capable.
 */
if (bus_dma_tag_create(NULL,/* parent */
-  PAGE_SIZE, 0,/* algnmnt, boundary */
+  PAGE_SIZE,   /* alignment */
+  ((bus_size_t)((uint64_t)1 << 32)), /* boundary*/
   BUS_SPACE_MAXADDR,   /* lowaddr */
   BUS_SPACE_MAXADDR,   /* highaddr */
   NULL, NULL,  /* filter, filterarg */
___
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: r232261 - in head/sys: amd64/include i386/include pc98/include x86/include

2012-02-28 Thread Tijl Coosemans
Author: tijl
Date: Tue Feb 28 18:15:28 2012
New Revision: 232261
URL: http://svn.freebsd.org/changeset/base/232261

Log:
  Copy amd64 _types.h to x86 and merge with i386 _types.h. Replace existing
  amd64/i386/pc98 _types.h with stubs.

Added:
  head/sys/x86/include/_types.h
 - copied, changed from r232259, head/sys/amd64/include/_types.h
Modified:
  head/sys/amd64/include/_types.h
  head/sys/i386/include/_types.h
  head/sys/pc98/include/_types.h

Modified: head/sys/amd64/include/_types.h
==
--- head/sys/amd64/include/_types.h Tue Feb 28 17:29:31 2012
(r232260)
+++ head/sys/amd64/include/_types.h Tue Feb 28 18:15:28 2012
(r232261)
@@ -1,116 +1,6 @@
 /*-
- * Copyright (c) 2002 Mike Barcroft 
- * Copyright (c) 1990, 1993
- * The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *notice, this list of conditions and the following disclaimer in the
- *documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- *may be used to endorse or promote products derived from this software
- *without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * From: @(#)ansi.h8.2 (Berkeley) 1/4/94
- * From: @(#)types.h   8.3 (Berkeley) 1/5/94
- * $FreeBSD$
+ * This file is in the public domain.
  */
+/* $FreeBSD$ */
 
-#ifndef _MACHINE__TYPES_H_
-#define_MACHINE__TYPES_H_
-
-#ifndef _SYS_CDEFS_H_
-#error this file needs sys/cdefs.h as a prerequisite
-#endif
-
-#define __NO_STRICT_ALIGNMENT
-
-/*
- * Basic types upon which most other types are built.
- */
-typedefsigned char __int8_t;
-typedefunsigned char   __uint8_t;
-typedefshort   __int16_t;
-typedefunsigned short  __uint16_t;
-typedefint __int32_t;
-typedefunsigned int__uint32_t;
-typedeflong__int64_t;
-typedefunsigned long   __uint64_t;
-
-/*
- * Standard type definitions.
- */
-typedef__int32_t   __clock_t;  /* clock()... */
-typedef__int64_t   __critical_t;
-typedefdouble  __double_t;
-typedeffloat   __float_t;
-typedef__int64_t   __intfptr_t;
-typedef__int64_t   __intmax_t;
-typedef__int64_t   __intptr_t;
-typedef__int32_t   __int_fast8_t;
-typedef__int32_t   __int_fast16_t;
-typedef__int32_t   __int_fast32_t;
-typedef__int64_t   __int_fast64_t;
-typedef__int8_t__int_least8_t;
-typedef__int16_t   __int_least16_t;
-typedef__int32_t   __int_least32_t;
-typedef__int64_t   __int_least64_t;
-typedef__int64_t   __ptrdiff_t;/* ptr1 - ptr2 */
-typedef__int64_t   __register_t;
-typedef__int64_t   __segsz_t;  /* segment size (in 
pages) */
-typedef__uint64_t  __size_t;   /* sizeof() */
-typedef__int64_t   __ssize_t;  /* byte count or error 
*/
-typedef__int64_t   __time_t;   /* time()... */
-typedef__uint64_t  __uintfptr_t;
-typedef__uint64_t  __uintmax_t;
-typedef__uint64_t  __uintptr_t;
-typedef__uint32_t  __uint_fast8_t;
-typedef__uint32_t  __uint_fast16_t;
-typedef__uint32_t  __uint_fast32_t;

svn commit: r232262 - in head/sys: amd64/include i386/include pc98/include x86/include

2012-02-28 Thread Tijl Coosemans
Author: tijl
Date: Tue Feb 28 18:24:28 2012
New Revision: 232262
URL: http://svn.freebsd.org/changeset/base/232262

Log:
  Copy amd64 _limits.h to x86 and merge with i386 _limits.h. Replace
  amd64/i386/pc98 _limits.h with stubs.

Added:
  head/sys/x86/include/_limits.h
 - copied, changed from r232259, head/sys/amd64/include/_limits.h
Modified:
  head/sys/amd64/include/_limits.h
  head/sys/i386/include/_limits.h
  head/sys/pc98/include/_limits.h

Modified: head/sys/amd64/include/_limits.h
==
--- head/sys/amd64/include/_limits.hTue Feb 28 18:15:28 2012
(r232261)
+++ head/sys/amd64/include/_limits.hTue Feb 28 18:24:28 2012
(r232262)
@@ -1,87 +1,6 @@
 /*-
- * Copyright (c) 1988, 1993
- * The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *notice, this list of conditions and the following disclaimer in the
- *documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *may be used to endorse or promote products derived from this software
- *without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)limits.h8.3 (Berkeley) 1/4/94
- * $FreeBSD$
+ * This file is in the public domain.
  */
+/* $FreeBSD$ */
 
-#ifndef_MACHINE__LIMITS_H_
-#define_MACHINE__LIMITS_H_
-
-/*
- * According to ANSI (section 2.2.4.2), the values below must be usable by
- * #if preprocessing directives.  Additionally, the expression must have the
- * same type as would an expression that is an object of the corresponding
- * type converted according to the integral promotions.  The subtraction for
- * INT_MIN, etc., is so the value is not unsigned; e.g., 0x8000 is an
- * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2).
- */
-
-#define__CHAR_BIT  8   /* number of bits in a char */
-
-#define__SCHAR_MAX 0x7f/* max value for a signed char 
*/
-#define__SCHAR_MIN (-0x7f - 1) /* min value for a signed char 
*/
-
-#define__UCHAR_MAX 0xff/* max value for an unsigned 
char */
-
-#define__USHRT_MAX 0x  /* max value for an unsigned 
short */
-#define__SHRT_MAX  0x7fff  /* max value for a short */
-#define__SHRT_MIN  (-0x7fff - 1)   /* min value for a short */
-
-#define__UINT_MAX  0x  /* max value for an unsigned 
int */
-#define__INT_MAX   0x7fff  /* max value for an int */
-#define__INT_MIN   (-0x7fff - 1)   /* min value for an int 
*/
-
-#define__ULONG_MAX 0x  /* max for an unsigned 
long */
-#define__LONG_MAX  0x7fff  /* max for a long */
-#define__LONG_MIN  (-0x7fff - 1) /* min for a long */
-
-   /* max value for an unsigned long long */
-#define__ULLONG_MAX0xULL
-#define__LLONG_MAX 0x7fffLL/* max value for a long 
long */
-#define__LLONG_MIN (-0x7fffLL - 1)  /* min for a long 
long */
-
-#define__SSIZE_MAX __LONG_MAX  /* max value for a ssize_t */
-
-#define__SIZE_T_MAX__ULONG_MAX /* max value for a size_t */
-
-#define__OFF_MAX   __LONG_MAX  /* max value for an off_t */
-#define__OFF_MIN   __LONG_MIN  /* min value for an off_t */
-
-/* Quads and longs are the same on the amd64.  Ensure they stay in sync. */
-#define__UQUAD_MAX __ULONG_MAX /* max value for a uquad_t */
-#define__QUAD_MAX  __LONG_MAX  /* max value for a quad_t */
-#define__QUAD_MIN 

svn commit: r232263 - in head: lib/libsm lib/libthread_db lib/libz libexec/mail.local libexec/smrsh sbin/fsdb share/mk sys/boot/i386/boot0 sys/boot/i386/boot2 sys/boot/i386/btx/btx sys/boot/i386/bt...

2012-02-28 Thread Dimitry Andric
Author: dim
Date: Tue Feb 28 18:30:18 2012
New Revision: 232263
URL: http://svn.freebsd.org/changeset/base/232263

Log:
  Define several extra macros in bsd.sys.mk and sys/conf/kern.pre.mk, to
  get rid of testing explicitly for clang (using ${CC:T:Mclang}) in
  individual Makefiles.
  
  Instead, use the following extra macros, for use with clang:
  - NO_WERROR.clang   (disables -Werror)
  - NO_WCAST_ALIGN.clang  (disables -Wcast-align)
  - NO_WFORMAT.clang(disables -Wformat and friends)
  - CLANG_NO_IAS(disables integrated assembler)
  - CLANG_OPT_SMALL (adds flags for extra small size optimizations)
  
  As a side effect, this enables setting CC/CXX/CPP in src.conf instead of
  make.conf!  For clang, use the following:
  
  CC=clang
  CXX=clang++
  CPP=clang-cpp
  
  MFC after:2 weeks

Modified:
  head/lib/libsm/Makefile
  head/lib/libthread_db/Makefile
  head/lib/libz/Makefile
  head/libexec/mail.local/Makefile
  head/libexec/smrsh/Makefile
  head/sbin/fsdb/Makefile
  head/share/mk/bsd.sys.mk
  head/sys/boot/i386/boot0/Makefile
  head/sys/boot/i386/boot2/Makefile
  head/sys/boot/i386/btx/btx/Makefile
  head/sys/boot/i386/btx/btxldr/Makefile
  head/sys/boot/i386/gptboot/Makefile
  head/sys/boot/i386/gptzfsboot/Makefile
  head/sys/boot/i386/libi386/Makefile
  head/sys/boot/i386/pxeldr/Makefile
  head/sys/boot/i386/zfsboot/Makefile
  head/sys/boot/pc98/btx/btx/Makefile
  head/sys/boot/pc98/btx/btxldr/Makefile
  head/sys/conf/Makefile.amd64
  head/sys/conf/Makefile.i386
  head/sys/conf/kern.pre.mk
  head/sys/modules/bios/smapi/Makefile
  head/sys/modules/linux/Makefile
  head/usr.bin/netstat/Makefile
  head/usr.bin/vacation/Makefile
  head/usr.sbin/sendmail/Makefile

Modified: head/lib/libsm/Makefile
==
--- head/lib/libsm/Makefile Tue Feb 28 18:24:28 2012(r232262)
+++ head/lib/libsm/Makefile Tue Feb 28 18:30:18 2012(r232263)
@@ -18,12 +18,10 @@ CFLAGS+=${SENDMAIL_CFLAGS}
 
 WARNS?=2
 
-.if ${CC:T:Mclang} == "clang"
 # Unfortunately, clang gives warnings about sendmail code that cannot
 # be turned off yet.  Since this is contrib code, and we don't really
 # care about the warnings, just make them non-fatal for now.
-NO_WERROR=
-.endif
+NO_WERROR.clang=
 
 LIB=   sm
 

Modified: head/lib/libthread_db/Makefile
==
--- head/lib/libthread_db/Makefile  Tue Feb 28 18:24:28 2012
(r232262)
+++ head/lib/libthread_db/Makefile  Tue Feb 28 18:30:18 2012
(r232263)
@@ -16,10 +16,8 @@ SYM_MAPS+=${.CURDIR}/Symbol.map
 SYMBOL_MAPS=${SYM_MAPS}
 VERSION_DEF=${.CURDIR}/../libc/Versions.def
 
-.if ${CC:T:Mclang} == "clang"
 # Unfortunately, clang gives an incorrect warning about alignment in
 # arch/i386/libpthread_md.c, so turn that off for now.
-NO_WCAST_ALIGN=
-.endif
+NO_WCAST_ALIGN.clang=
 
 .include 

Modified: head/lib/libz/Makefile
==
--- head/lib/libz/Makefile  Tue Feb 28 18:24:28 2012(r232262)
+++ head/lib/libz/Makefile  Tue Feb 28 18:30:18 2012(r232263)
@@ -47,10 +47,6 @@ ACFLAGS+=-Wa,--noexecstack
 #SRCS+=gvmat64.S
 #CFLAGS+=  -DASMV -DNO_UNDERLINE
 #ACFLAGS+= -Wa,--noexecstack
-#.if ${CC:T:Mclang} == "clang"
-## XXX: clang integrated-as doesn't grok .intel_syntax directives yet
-#ACFLAGS+= ${.IMPSRC:T:Mgvmat64.S:C/^.+$/-no-integrated-as/}
-#.endif
 #.endif
 
 VERSION_DEF=   ${.CURDIR}/Versions.def
@@ -71,3 +67,7 @@ test: example minigzip
echo hello world | ./minigzip | ./minigzip -d )
 
 .include 
+
+## XXX: clang integrated-as doesn't grok .intel_syntax directives yet
+#ACFLAGS.gvmat64.S=${CLANG_NO_IAS}
+#ACFLAGS+= ${ACFLAGS.${.IMPSRC:T}}

Modified: head/libexec/mail.local/Makefile
==
--- head/libexec/mail.local/MakefileTue Feb 28 18:24:28 2012
(r232262)
+++ head/libexec/mail.local/MakefileTue Feb 28 18:30:18 2012
(r232263)
@@ -12,12 +12,10 @@ CFLAGS+=-I${SENDMAIL_DIR}/include -I.
 WARNS?=2
 WFORMAT=0
 
-.if ${CC:T:Mclang} == "clang"
 # Unfortunately, clang gives warnings about sendmail code that cannot
 # be turned off yet.  Since this is contrib code, and we don't really
 # care about the warnings, just make them non-fatal for now.
-NO_WERROR=
-.endif
+NO_WERROR.clang=
 
 LIBSMDIR=  ${.OBJDIR}/../../lib/libsm
 LIBSM= ${LIBSMDIR}/libsm.a

Modified: head/libexec/smrsh/Makefile
==
--- head/libexec/smrsh/Makefile Tue Feb 28 18:24:28 2012(r232262)
+++ head/libexec/smrsh/Makefile Tue Feb 28 18:30:18 2012(r232263)
@@ -17,12 +17,10 @@ LDADD=  ${LIBSM}
 
 WARNS?=2
 
-.if ${CC:T:Mclang} == "clang"
 # Unfor

svn commit: r232264 - in head/sys: amd64/include i386/include pc98/include x86/include

2012-02-28 Thread Tijl Coosemans
Author: tijl
Date: Tue Feb 28 18:38:33 2012
New Revision: 232264
URL: http://svn.freebsd.org/changeset/base/232264

Log:
  Copy amd64 _stdint.h to x86 and merge with i386 _stdint.h. Replace
  amd64/i386/pc98 _stdint.h with stubs.

Added:
  head/sys/x86/include/_stdint.h
 - copied, changed from r232259, head/sys/amd64/include/_stdint.h
Modified:
  head/sys/amd64/include/_stdint.h
  head/sys/i386/include/_stdint.h
  head/sys/pc98/include/_stdint.h

Modified: head/sys/amd64/include/_stdint.h
==
--- head/sys/amd64/include/_stdint.hTue Feb 28 18:30:18 2012
(r232263)
+++ head/sys/amd64/include/_stdint.hTue Feb 28 18:38:33 2012
(r232264)
@@ -1,171 +1,6 @@
 /*-
- * Copyright (c) 2001, 2002 Mike Barcroft 
- * Copyright (c) 2001 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Klaus Klein.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *notice, this list of conditions and the following disclaimer in the
- *documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *must display the following acknowledgement:
- *This product includes software developed by the NetBSD
- *Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- *contributors may be used to endorse or promote products derived
- *from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * 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.
- *
- * $FreeBSD$
+ * This file is in the public domain.
  */
+/* $FreeBSD$ */
 
-#ifndef _MACHINE__STDINT_H_
-#define_MACHINE__STDINT_H_
-
-#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
-
-#defineINT8_C(c)   (c)
-#defineINT16_C(c)  (c)
-#defineINT32_C(c)  (c)
-#defineINT64_C(c)  (c ## L)
-
-#defineUINT8_C(c)  (c)
-#defineUINT16_C(c) (c)
-#defineUINT32_C(c) (c ## U)
-#defineUINT64_C(c) (c ## UL)
-
-#defineINTMAX_C(c) INT64_C(c)
-#defineUINTMAX_C(c)UINT64_C(c)
-
-#endif /* !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) */
-
-#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
-
-/*
- * ISO/IEC 9899:1999
- * 7.18.2.1 Limits of exact-width integer types
- */
-/* Minimum values of exact-width signed integer types. */
-#defineINT8_MIN(-0x7f-1)
-#defineINT16_MIN   (-0x7fff-1)
-#defineINT32_MIN   (-0x7fff-1)
-#defineINT64_MIN   (-0x7fffL-1)
-
-/* Maximum values of exact-width signed integer types. */
-#defineINT8_MAX0x7f
-#defineINT16_MAX   0x7fff
-#defineINT32_MAX   0x7fff
-#defineINT64_MAX   0x7fffL
-
-/* Maximum values of exact-width unsigned integer types. */
-#defineUINT8_MAX   0xff
-#defineUINT16_MAX  0x
-#defineUINT32_MAX  0xU
-#defineUINT64_MAX  0xUL
-
-/*
- * ISO/IEC 9899:1999
- * 7.18.2.2  Limits of minimum-width integer types
- */
-/* Minimum values of minimum-width signed integer types. */
-#defineINT_LEAST8_MIN  INT8_MIN
-#defineINT_LEAST16_MIN INT16_MIN
-#defineINT_LEAST32_MIN INT32_MIN
-#defineINT_LEAST64_MIN INT64_MIN
-
-/* Maximum values of minimum-width signed integer types. */
-#defineINT_LEAST8_MAX  INT8_MAX
-#defineINT_LEAST16_MAX INT16_MAX
-#defineINT_LEAST32_MAX INT32_MAX
-#defineINT_LEAST64_MAX INT64_MAX
-
-/* Maximum values of minimum-width unsigned integer types. */
-

svn commit: r232265 - head/sys/kern

2012-02-28 Thread John Baldwin
Author: jhb
Date: Tue Feb 28 19:16:02 2012
New Revision: 232265
URL: http://svn.freebsd.org/changeset/base/232265

Log:
  Properly clear a device's devclass if DEVICE_ATTACH() fails if the device
  does not have a fixed devclass.
  
  Reviewed by:  imp
  MFC after:2 weeks

Modified:
  head/sys/kern/subr_bus.c

Modified: head/sys/kern/subr_bus.c
==
--- head/sys/kern/subr_bus.cTue Feb 28 18:38:33 2012(r232264)
+++ head/sys/kern/subr_bus.cTue Feb 28 19:16:02 2012(r232265)
@@ -2732,9 +2732,8 @@ device_attach(device_t dev)
if ((error = DEVICE_ATTACH(dev)) != 0) {
printf("device_attach: %s%d attach returned %d\n",
dev->driver->name, dev->unit, error);
-   /* Unset the class; set in device_probe_child */
-   if (dev->devclass == NULL)
-   (void)device_set_devclass(dev, NULL);
+   if (!(dev->flags & DF_FIXEDCLASS))
+   devclass_delete_device(dev->devclass, dev);
(void)device_set_driver(dev, NULL);
device_sysctl_fini(dev);
dev->state = DS_NOTPRESENT;
___
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: r232266 - in head/sys: amd64/include i386/include pc98/include x86/include

2012-02-28 Thread Tijl Coosemans
Author: tijl
Date: Tue Feb 28 19:39:54 2012
New Revision: 232266
URL: http://svn.freebsd.org/changeset/base/232266

Log:
  Copy amd64 endian.h to x86 and merge with i386 endian.h. Replace
  amd64/i386/pc98 endian.h with stubs.
  
  In __bswap64_const(x) the conflict between 0xffUL and 0xffULL has been
  resolved by reimplementing the macro in terms of __bswap32(x). As a side
  effect __bswap64_var(x) is now implemented using two bswap instructions on
  i386 and should be much faster. __bswap32_const(x) has been reimplemented
  in terms of __bswap16(x) for consistency.

Added:
  head/sys/x86/include/endian.h
 - copied, changed from r232259, head/sys/amd64/include/endian.h
Modified:
  head/sys/amd64/include/endian.h
  head/sys/i386/include/endian.h
  head/sys/pc98/include/endian.h

Modified: head/sys/amd64/include/endian.h
==
--- head/sys/amd64/include/endian.h Tue Feb 28 19:16:02 2012
(r232265)
+++ head/sys/amd64/include/endian.h Tue Feb 28 19:39:54 2012
(r232266)
@@ -1,145 +1,6 @@
 /*-
- * Copyright (c) 1987, 1991 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *notice, this list of conditions and the following disclaimer in the
- *documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *may be used to endorse or promote products derived from this software
- *without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)endian.h7.8 (Berkeley) 4/3/91
- * $FreeBSD$
+ * This file is in the public domain.
  */
+/* $FreeBSD$ */
 
-#ifndef _MACHINE_ENDIAN_H_
-#define_MACHINE_ENDIAN_H_
-
-#include 
-#include 
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Define the order of 32-bit words in 64-bit words.
- */
-#define_QUAD_HIGHWORD 1
-#define_QUAD_LOWWORD 0
-
-/*
- * Definitions for byte order, according to byte significance from low
- * address to high.
- */
-#define_LITTLE_ENDIAN  1234/* LSB first: i386, vax */
-#define_BIG_ENDIAN 4321/* MSB first: 68000, ibm, net */
-#define_PDP_ENDIAN 3412/* LSB first in word, MSW first in long 
*/
-
-#define_BYTE_ORDER _LITTLE_ENDIAN
-
-/*
- * Deprecated variants that don't have enough underscores to be useful in more
- * strict namespaces.
- */
-#if __BSD_VISIBLE
-#defineLITTLE_ENDIAN   _LITTLE_ENDIAN
-#defineBIG_ENDIAN  _BIG_ENDIAN
-#definePDP_ENDIAN  _PDP_ENDIAN
-#defineBYTE_ORDER  _BYTE_ORDER
-#endif
-
-#if defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE_BUILTIN_CONSTANT_P)
-
-#define__bswap64_const(_x) \
-   (((_x) >> 56) | \
-   (((_x) >> 40) & (0xffUL << 8)) |\
-   (((_x) >> 24) & (0xffUL << 16)) |   \
-   (((_x) >> 8) & (0xffUL << 24)) |\
-   (((_x) << 8) & (0xffUL << 32)) |\
-   (((_x) << 24) & (0xffUL << 40)) |   \
-   (((_x) << 40) & (0xffUL << 48)) |   \
-   ((_x) << 56))
-
-#define__bswap32_const(_x) \
-   (((_x) >> 24) | \
-   (((_x) & (0xff << 16)) >> 8) |  \
-   (((_x) & (0xff << 8)) << 8) |   \
-   ((_x) << 24))
-
-#define __bswap16_const(_x)(__uint16_t)((_x) << 8 | (_x) >> 8)
-
-static __inline __uint64_t
-__bswap64_var(__uint64_t _x)
-{
-
-   __asm ("bswap %0" : "+r" (_x));
-   return (_x);
-}
-
-static __inline __uint32_t
-__bswap32_var(__uint32_t _x)
-{
-
-   __asm ("bswap %0" : "+r" (_x));
-   return (_x);
-}
-
-static __inline __uint16_t
-__bswap16_var(__uint16_t _x)
-{
-
-   return (__bswap16_const(_x));
-}
-
-#define__bswap64(_x

svn commit: r232267 - head/sys/x86/x86

2012-02-28 Thread Ed Maste
Author: emaste
Date: Tue Feb 28 19:42:40 2012
New Revision: 232267
URL: http://svn.freebsd.org/changeset/base/232267

Log:
  Workaround for PCIe 4GB boundary issue
  
  Enforce a boundary of no more than 4GB - transfers crossing a 4GB
  boundary can lead to data corruption due to PCIe limitations.  This
  change is a less-intrusive workaround that can be quickly merged back
  to older branches; a cleaner implementation will arrive in HEAD later
  but may require KPI changes.
  
  This change is based on a suggestion by jhb@.
  
  Reviewed by:scottl, jhb
  Sponsored by:   Sandvine Incorporated
  MFC after:  3 days

Modified:
  head/sys/x86/x86/busdma_machdep.c

Modified: head/sys/x86/x86/busdma_machdep.c
==
--- head/sys/x86/x86/busdma_machdep.c   Tue Feb 28 19:39:54 2012
(r232266)
+++ head/sys/x86/x86/busdma_machdep.c   Tue Feb 28 19:42:40 2012
(r232267)
@@ -227,6 +227,14 @@ bus_dma_tag_create(bus_dma_tag_t parent,
bus_dma_tag_t newtag;
int error = 0;
 
+   /* Always enforce at least a 4GB (2GB for PAE) boundary. */
+#if defined(__amd64__)
+   if (boundary == 0 || boundary > ((bus_addr_t)1 << 32))
+   boundary = (bus_size_t)1 << 32;
+#elif defined(PAE)
+   if (boundary == 0 || boundary > ((bus_addr_t)1 << 31))
+   boundary = (bus_size_t)1 << 31;
+#endif
/* Basic sanity checking */
if (boundary != 0 && boundary < maxsegsz)
maxsegsz = boundary;
___
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: r232183 - head/sys/kern

2012-02-28 Thread Alexander Best
On Sun Feb 26 12, Jilles Tjoelker wrote:
> Author: jilles
> Date: Sun Feb 26 15:14:29 2012
> New Revision: 232183
> URL: http://svn.freebsd.org/changeset/base/232183
> 
> Log:
>   Fix fchmod() and fchown() on fifos.
>   
>   The new fifo implementation in r232055 broke fchmod() and fchown() on fifos.
>   Postfix needs this.

clang seems to have a problem with this commit:

usr/subversion-src/sys/kern/sys_pipe.c:1556:10: error: promoted type 'int' of 
K&R function parameter is not compatible with the parameter type 'mode_t' (aka 
'unsigned short') declared in a previous prototype [-Werror]
mode_t mode;
   ^
/usr/subversion-src/sys/kern/sys_pipe.c:155:19: note: previous declaration is 
here
static fo_chmod_t   pipe_chmod;
^
1 error generated.
*** Error code 1

cheers.
alex

>   
>   Submitted by:   gianni
>   Reported by:dougb
> 
> Modified:
>   head/sys/kern/sys_pipe.c
> 
> Modified: head/sys/kern/sys_pipe.c
> ==
> --- head/sys/kern/sys_pipe.c  Sun Feb 26 14:27:34 2012(r232182)
> +++ head/sys/kern/sys_pipe.c  Sun Feb 26 15:14:29 2012(r232183)
> @@ -152,6 +152,8 @@ static fo_poll_t  pipe_poll;
>  static fo_kqfilter_t pipe_kqfilter;
>  static fo_stat_t pipe_stat;
>  static fo_close_tpipe_close;
> +static fo_chmod_tpipe_chmod;
> +static fo_chown_tpipe_chown;
>  
>  struct fileops pipeops = {
>   .fo_read = pipe_read,
> @@ -162,8 +164,8 @@ struct fileops pipeops = {
>   .fo_kqfilter = pipe_kqfilter,
>   .fo_stat = pipe_stat,
>   .fo_close = pipe_close,
> - .fo_chmod = invfo_chmod,
> - .fo_chown = invfo_chown,
> + .fo_chmod = pipe_chmod,
> + .fo_chown = pipe_chown,
>   .fo_flags = DFLAG_PASSABLE
>  };
>  
> @@ -1548,6 +1550,43 @@ pipe_close(fp, td)
>   return (0);
>  }
>  
> +static int
> +pipe_chmod(fp, mode, active_cred, td)
> + struct file *fp;
> + mode_t mode;
> + struct ucred *active_cred;
> + struct thread *td;
> +{
> + struct pipe *cpipe;
> + int error;
> +
> + cpipe = fp->f_data;
> + if (cpipe->pipe_state & PIPE_NAMED)
> + error = vn_chmod(fp, mode, active_cred, td);
> + else
> + error = invfo_chmod(fp, mode, active_cred, td);
> + return (error);
> +}
> +
> +static int
> +pipe_chown(fp, uid, gid, active_cred, td)
> + struct file *fp;
> + uid_t uid;
> + gid_t gid;
> + struct ucred *active_cred;
> + struct thread *td;
> +{
> + struct pipe *cpipe;
> + int error;
> +
> + cpipe = fp->f_data;
> + if (cpipe->pipe_state & PIPE_NAMED)
> + error = vn_chown(fp, uid, gid, active_cred, td);
> + else
> + error = invfo_chown(fp, uid, gid, active_cred, td);
> + return (error);
> +}
> +
>  static void
>  pipe_free_kmem(cpipe)
>   struct pipe *cpipe;
___
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: r232268 - head/sys/dev/aac

2012-02-28 Thread Ed Maste
Author: emaste
Date: Tue Feb 28 19:50:14 2012
New Revision: 232268
URL: http://svn.freebsd.org/changeset/base/232268

Log:
  Revert r232260.
  
  The problem is now fixed by a general workaround in r232267.

Modified:
  head/sys/dev/aac/aac_pci.c

Modified: head/sys/dev/aac/aac_pci.c
==
--- head/sys/dev/aac/aac_pci.c  Tue Feb 28 19:42:40 2012(r232267)
+++ head/sys/dev/aac/aac_pci.c  Tue Feb 28 19:50:14 2012(r232268)
@@ -403,8 +403,7 @@ aac_pci_attach(device_t dev)
 * Note that some of these controllers are 64-bit capable.
 */
if (bus_dma_tag_create(NULL,/* parent */
-  PAGE_SIZE,   /* alignment */
-  ((bus_size_t)((uint64_t)1 << 32)), /* boundary*/
+  PAGE_SIZE, 0,/* algnmnt, boundary */
   BUS_SPACE_MAXADDR,   /* lowaddr */
   BUS_SPACE_MAXADDR,   /* highaddr */
   NULL, NULL,  /* filter, filterarg */
___
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: r232266 - in head/sys: amd64/include i386/include pc98/include x86/include

2012-02-28 Thread Dimitry Andric
On 2012-02-28 20:39, Tijl Coosemans wrote:
> Author: tijl
> Date: Tue Feb 28 19:39:54 2012
> New Revision: 232266
> URL: http://svn.freebsd.org/changeset/base/232266
> 
> Log:
>   Copy amd64 endian.h to x86 and merge with i386 endian.h. Replace
>   amd64/i386/pc98 endian.h with stubs.
>   
>   In __bswap64_const(x) the conflict between 0xffUL and 0xffULL has been
>   resolved by reimplementing the macro in terms of __bswap32(x). As a side
>   effect __bswap64_var(x) is now implemented using two bswap instructions on
>   i386 and should be much faster. __bswap32_const(x) has been reimplemented
>   in terms of __bswap16(x) for consistency.
...
> +#define  __bswap32_const(_x) \
> + (((__uint32_t)__bswap16(_x) << 16) | __bswap16((_x) >> 16))
> +
> +#define  __bswap32(_x)   \
> + (__builtin_constant_p(_x) ? \
> + __bswap32_const((__uint32_t)(_x)) : __bswap32_var(_x))
> +
> +#define  __bswap64_const(_x) \
> + (((__uint64_t)__bswap32(_x) << 32) | __bswap32((_x) >> 32))

Hmm, shouldn't __bswap32_const() be implemented in terms of
__bswap16_const(), and similarly for __bswap64_const(), which should be
implemented in terms of __bswap32_const()?

The whole reason for the difficult dance with __builtin_constant_p is to
allow for compile-time resolving of bswap'd constants.  Invoking the
regular __bswap() macros doesn't gain you anything here.
___
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: r232238 - in head: share/man/man4 sys/dev/e1000 sys/dev/ixgbe sys/dev/netmap sys/dev/re sys/net tools/tools/netmap

2012-02-28 Thread Slawa Olhovchenkov
On Tue, Feb 28, 2012 at 08:31:22AM +0100, Luigi Rizzo wrote:

> On Mon, Feb 27, 2012 at 07:05:45PM -0500, Ben Kaduk wrote:
> ...
> > > ?1. add support for devices with different number of rx and tx queues;
> > >
> > > ?2. add better support for zero-copy operation, adding an extra field
> > > ? ? to the netmap ring to indicate how many buffers we have already 
> > > processed
> > > ? ? but not yet released (with help from Eddie Kohler);
> > >
> > > ?3. The two changes above unfortunately require an API change, so while
> > > ? ? at it add a version field and some spares to the ioctl() argument
> > > ? ? to help detect mismatches.
> > 
> > Is it worth bumping __FreeBSD_version?
> 
> I don't think it is necessary.
> There is basically no code that uses the netmap API except for
> the examples in tools/tools/netmap, and i now have a NETMAP_API macro

no code in *FreeBSD base system*, yes?
because I am write tools uses the netmap API now.

> that defines the version without the need for using __FreeBSD_version
___
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: r232266 - in head/sys: amd64/include i386/include pc98/include x86/include

2012-02-28 Thread Tijl Coosemans
On Tuesday 28 February 2012 21:55:57 Dimitry Andric wrote:
> On 2012-02-28 20:39, Tijl Coosemans wrote:
>> Author: tijl
>> Date: Tue Feb 28 19:39:54 2012
>> New Revision: 232266
>> URL: http://svn.freebsd.org/changeset/base/232266
>> 
>> Log:
>>   Copy amd64 endian.h to x86 and merge with i386 endian.h. Replace
>>   amd64/i386/pc98 endian.h with stubs.
>>   
>>   In __bswap64_const(x) the conflict between 0xffUL and 0xffULL has been
>>   resolved by reimplementing the macro in terms of __bswap32(x). As a side
>>   effect __bswap64_var(x) is now implemented using two bswap instructions on
>>   i386 and should be much faster. __bswap32_const(x) has been reimplemented
>>   in terms of __bswap16(x) for consistency.
> ...
>> +#define __bswap32_const(_x) \
>> +(((__uint32_t)__bswap16(_x) << 16) | __bswap16((_x) >> 16))
>> +
>> +#define __bswap32(_x)   \
>> +(__builtin_constant_p(_x) ? \
>> +__bswap32_const((__uint32_t)(_x)) : __bswap32_var(_x))
>> +
>> +#define __bswap64_const(_x) \
>> +(((__uint64_t)__bswap32(_x) << 32) | __bswap32((_x) >> 32))
> 
> Hmm, shouldn't __bswap32_const() be implemented in terms of
> __bswap16_const(), and similarly for __bswap64_const(), which should be
> implemented in terms of __bswap32_const()?
> 
> The whole reason for the difficult dance with __builtin_constant_p is to
> allow for compile-time resolving of bswap'd constants.  Invoking the
> regular __bswap() macros doesn't gain you anything here.

__bswap64_const is also used in __bswap64_var, so its argument isn't
always a compile time constant and then __bswap32 becomes __bswap32_var.
If it is a constant __bswap32 becomes __bswap32_const (even at -O0).


signature.asc
Description: This is a digitally signed message part.


Re: svn commit: r232238 - in head: share/man/man4 sys/dev/e1000 sys/dev/ixgbe sys/dev/netmap sys/dev/re sys/net tools/tools/netmap

2012-02-28 Thread Luigi Rizzo
On Wed, Feb 29, 2012 at 12:35:23AM +0400, Slawa Olhovchenkov wrote:
...
> > > > ?3. The two changes above unfortunately require an API change, so while
> > > > ? ? at it add a version field and some spares to the ioctl() argument
> > > > ? ? to help detect mismatches.
> > > 
> > > Is it worth bumping __FreeBSD_version?
> > 
> > I don't think it is necessary.
> > There is basically no code that uses the netmap API except for
> > the examples in tools/tools/netmap, and i now have a NETMAP_API macro
> 
> no code in *FreeBSD base system*, yes?
> because I am write tools uses the netmap API now.

i am glad to hear that, and the NETMAP_API will serve you well
because you can use the same also on the Linux version of netmap

cheers
luigi

___
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: r232269 - head/sys/net80211

2012-02-28 Thread Adrian Chadd
Author: adrian
Date: Tue Feb 28 21:41:47 2012
New Revision: 232269
URL: http://svn.freebsd.org/changeset/base/232269

Log:
  Print out the bogus beacon interval.

Modified:
  head/sys/net80211/ieee80211_input.c

Modified: head/sys/net80211/ieee80211_input.c
==
--- head/sys/net80211/ieee80211_input.c Tue Feb 28 19:50:14 2012
(r232268)
+++ head/sys/net80211/ieee80211_input.c Tue Feb 28 21:41:47 2012
(r232269)
@@ -652,7 +652,8 @@ ieee80211_parse_beacon(struct ieee80211_
  scan->bintval <= IEEE80211_BINTVAL_MAX)) {
IEEE80211_DISCARD(vap,
IEEE80211_MSG_ELEMID | IEEE80211_MSG_INPUT,
-   wh, NULL, "bogus beacon interval", scan->bintval);
+   wh, NULL, "bogus beacon interval (%d TU)",
+   (int) scan->bintval);
vap->iv_stats.is_rx_badbintval++;
scan->status |= IEEE80211_BPARSE_BINTVAL_INVALID;
}
___
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: r232270 - head/sys/net80211

2012-02-28 Thread Adrian Chadd
Author: adrian
Date: Tue Feb 28 21:43:29 2012
New Revision: 232270
URL: http://svn.freebsd.org/changeset/base/232270

Log:
  Only increment is_beacon_bad if we're not scanning.
  
  Otherwise things such as off-channel probe responses and beacons are also
  silently discarded and logged against this error counter.

Modified:
  head/sys/net80211/ieee80211_sta.c

Modified: head/sys/net80211/ieee80211_sta.c
==
--- head/sys/net80211/ieee80211_sta.c   Tue Feb 28 21:41:47 2012
(r232269)
+++ head/sys/net80211/ieee80211_sta.c   Tue Feb 28 21:43:29 2012
(r232270)
@@ -1306,7 +1306,8 @@ sta_recv_mgmt(struct ieee80211_node *ni,
}
/* XXX probe response in sta mode when !scanning? */
if (ieee80211_parse_beacon(ni, m0, &scan) != 0) {
-   vap->iv_stats.is_beacon_bad++;
+   if (! (ic->ic_flags & IEEE80211_F_SCAN))
+   vap->iv_stats.is_beacon_bad++;
return;
}
/*
___
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: r232271 - head/sys/kern

2012-02-28 Thread Dimitry Andric
Author: dim
Date: Tue Feb 28 21:45:21 2012
New Revision: 232271
URL: http://svn.freebsd.org/changeset/base/232271

Log:
  Change definition of pipe_chmod() from K&R to C99, to avoid the
  following clang warning:
  
  sys/kern/sys_pipe.c:1556:10: error: promoted type 'int' of K&R function 
parameter is not compatible with the parameter type 'mode_t'
(aka 'unsigned short') declared in a previous prototype [-Werror]
  mode_t mode;
 ^
  sys/kern/sys_pipe.c:155:19: note: previous declaration is here
  static fo_chmod_t   pipe_chmod;
  ^

Modified:
  head/sys/kern/sys_pipe.c

Modified: head/sys/kern/sys_pipe.c
==
--- head/sys/kern/sys_pipe.cTue Feb 28 21:43:29 2012(r232270)
+++ head/sys/kern/sys_pipe.cTue Feb 28 21:45:21 2012(r232271)
@@ -1551,11 +1551,7 @@ pipe_close(fp, td)
 }
 
 static int
-pipe_chmod(fp, mode, active_cred, td)
-   struct file *fp;
-   mode_t mode;
-   struct ucred *active_cred;
-   struct thread *td;
+pipe_chmod(struct file *fp, mode_t mode, struct ucred *active_cred, struct 
thread *td)
 {
struct pipe *cpipe;
int error;
___
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: r232272 - head/sys/netinet/ipfw

2012-02-28 Thread Oleg Bulyzhin
Author: oleg
Date: Tue Feb 28 21:53:39 2012
New Revision: 232272
URL: http://svn.freebsd.org/changeset/base/232272

Log:
  lookup_dyn_rule_locked(): style(9) cleanup
  
  MFC after:1 month

Modified:
  head/sys/netinet/ipfw/ip_fw_dynamic.c

Modified: head/sys/netinet/ipfw/ip_fw_dynamic.c
==
--- head/sys/netinet/ipfw/ip_fw_dynamic.c   Tue Feb 28 21:45:21 2012
(r232271)
+++ head/sys/netinet/ipfw/ip_fw_dynamic.c   Tue Feb 28 21:53:39 2012
(r232272)
@@ -390,72 +390,68 @@ ipfw_remove_dyn_children(struct ip_fw *r
IPFW_DYN_UNLOCK();
 }
 
-/**
- * lookup a dynamic rule, locked version
+/*
+ * Lookup a dynamic rule, locked version.
  */
 static ipfw_dyn_rule *
 lookup_dyn_rule_locked(struct ipfw_flow_id *pkt, int *match_direction,
 struct tcphdr *tcp)
 {
/*
-* stateful ipfw extensions.
-* Lookup into dynamic session queue
+* Stateful ipfw extensions.
+* Lookup into dynamic session queue.
 */
 #define MATCH_REVERSE  0
 #define MATCH_FORWARD  1
 #define MATCH_NONE 2
 #define MATCH_UNKNOWN  3
int i, dir = MATCH_NONE;
-   ipfw_dyn_rule *prev, *q=NULL;
+   ipfw_dyn_rule *prev, *q = NULL;
 
IPFW_DYN_LOCK_ASSERT();
 
if (V_ipfw_dyn_v == NULL)
-   goto done;  /* not found */
-   i = hash_packet( pkt );
-   for (prev=NULL, q = V_ipfw_dyn_v[i] ; q != NULL ; ) {
+   goto done;  /* not found */
+   i = hash_packet(pkt);
+   for (prev = NULL, q = V_ipfw_dyn_v[i]; q != NULL;) {
if (q->dyn_type == O_LIMIT_PARENT && q->count)
goto next;
-   if (TIME_LEQ( q->expire, time_uptime)) { /* expire entry */
+   if (TIME_LEQ(q->expire, time_uptime)) { /* expire entry */
UNLINK_DYN_RULE(prev, V_ipfw_dyn_v[i], q);
continue;
}
-   if (pkt->proto == q->id.proto &&
-   q->dyn_type != O_LIMIT_PARENT) {
-   if (IS_IP6_FLOW_ID(pkt)) {
-   if (IN6_ARE_ADDR_EQUAL(&(pkt->src_ip6),
-   &(q->id.src_ip6)) &&
-   IN6_ARE_ADDR_EQUAL(&(pkt->dst_ip6),
-   &(q->id.dst_ip6)) &&
+   if (pkt->proto != q->id.proto || q->dyn_type == O_LIMIT_PARENT)
+   goto next;
+
+   if (IS_IP6_FLOW_ID(pkt)) {
+   if (IN6_ARE_ADDR_EQUAL(&pkt->src_ip6, &q->id.src_ip6) &&
+   IN6_ARE_ADDR_EQUAL(&pkt->dst_ip6, &q->id.dst_ip6) &&
pkt->src_port == q->id.src_port &&
-   pkt->dst_port == q->id.dst_port ) {
+   pkt->dst_port == q->id.dst_port) {
dir = MATCH_FORWARD;
break;
-   }
-   if (IN6_ARE_ADDR_EQUAL(&(pkt->src_ip6),
-   &(q->id.dst_ip6)) &&
-   IN6_ARE_ADDR_EQUAL(&(pkt->dst_ip6),
-   &(q->id.src_ip6)) &&
-   pkt->src_port == q->id.dst_port &&
-   pkt->dst_port == q->id.src_port ) {
-   dir = MATCH_REVERSE;
-   break;
-   }
-   } else {
-   if (pkt->src_ip == q->id.src_ip &&
-   pkt->dst_ip == q->id.dst_ip &&
-   pkt->src_port == q->id.src_port &&
-   pkt->dst_port == q->id.dst_port ) {
-   dir = MATCH_FORWARD;
-   break;
-   }
-   if (pkt->src_ip == q->id.dst_ip &&
-   pkt->dst_ip == q->id.src_ip &&
-   pkt->src_port == q->id.dst_port &&
-   pkt->dst_port == q->id.src_port ) {
-   dir = MATCH_REVERSE;
-   break;
-   }
+   }
+   if (IN6_ARE_ADDR_EQUAL(&pkt->src_ip6, &q->id.dst_ip6) &&
+   IN6_ARE_ADDR_EQUAL(&pkt->dst_ip6, &q->id.src_ip6) &&
+   pkt->src_port == q->id.dst_port &&
+   pkt->dst_port == q->id.src_port) {
+   dir = MATCH_REVERSE;
+   break;
+   }
+   } else {
+   if (pkt->src_ip == q->id.src_ip &&
+   pkt->dst_ip == q->id.dst_ip &&
+   pkt->src_port == q->id.

svn commit: r232273 - head/sys/netinet/ipfw

2012-02-28 Thread Oleg Bulyzhin
Author: oleg
Date: Tue Feb 28 22:00:41 2012
New Revision: 232273
URL: http://svn.freebsd.org/changeset/base/232273

Log:
  - Refresh dynamic tcp rule only if both sides answered keepalive packets.
  - Remove some useless assignments.
  
  MFC after:1 month

Modified:
  head/sys/netinet/ipfw/ip_fw_dynamic.c

Modified: head/sys/netinet/ipfw/ip_fw_dynamic.c
==
--- head/sys/netinet/ipfw/ip_fw_dynamic.c   Tue Feb 28 21:53:39 2012
(r232272)
+++ head/sys/netinet/ipfw/ip_fw_dynamic.c   Tue Feb 28 22:00:41 2012
(r232273)
@@ -472,8 +472,12 @@ next:
 
 #define BOTH_SYN   (TH_SYN | (TH_SYN << 8))
 #define BOTH_FIN   (TH_FIN | (TH_FIN << 8))
+#defineTCP_FLAGS   (TH_FLAGS | (TH_FLAGS << 8))
+#defineACK_FWD 0x1 /* fwd ack seen */
+#defineACK_REV 0x2 /* rev ack seen */
+
q->state |= (dir == MATCH_FORWARD) ? flags : (flags << 8);
-   switch (q->state) {
+   switch (q->state & TCP_FLAGS) {
case TH_SYN:/* opening */
q->expire = time_uptime + V_dyn_syn_lifetime;
break;
@@ -482,24 +486,28 @@ next:
case BOTH_SYN | TH_FIN: /* one side tries to close */
case BOTH_SYN | (TH_FIN << 8):
 #define _SEQ_GE(a,b) ((int)(a) - (int)(b) >= 0)
-   if (tcp == NULL) {
-   q->expire = time_uptime + V_dyn_ack_lifetime;
+   if (tcp == NULL)
break;
-   }
 
ack = ntohl(tcp->th_ack);
if (dir == MATCH_FORWARD) {
-   if (q->ack_fwd == 0 || _SEQ_GE(ack, q->ack_fwd))
+   if (q->ack_fwd == 0 ||
+   _SEQ_GE(ack, q->ack_fwd)) {
q->ack_fwd = ack;
-   else/* ignore out-of-sequence */
-   break;
+   q->state |= ACK_FWD;
+   }
} else {
-   if (q->ack_rev == 0 || _SEQ_GE(ack, q->ack_rev))
+   if (q->ack_rev == 0 ||
+   _SEQ_GE(ack, q->ack_rev)) {
q->ack_rev = ack;
-   else/* ignore out-of-sequence */
-   break;
+   q->state |= ACK_REV;
+   }
+   }
+   if ((q->state & (ACK_FWD | ACK_REV)) ==
+   (ACK_FWD | ACK_REV)) {
+   q->expire = time_uptime + V_dyn_ack_lifetime;
+   q->state &= ~(ACK_FWD | ACK_REV);
}
-   q->expire = time_uptime + V_dyn_ack_lifetime;
break;
 
case BOTH_SYN | BOTH_FIN:   /* both sides closed */
@@ -1074,10 +1082,12 @@ ipfw_tick(void * vnetx) 
if (TIME_LEQ(q->expire, time_uptime))
continue;   /* too late, rule expired */
 
-   m = ipfw_send_pkt(NULL, &(q->id), q->ack_rev - 1,
-   q->ack_fwd, TH_SYN);
-   mnext = ipfw_send_pkt(NULL, &(q->id), q->ack_fwd - 1,
-   q->ack_rev, 0);
+   m = (q->state & ACK_REV) ? NULL :
+   ipfw_send_pkt(NULL, &(q->id), q->ack_rev - 1,
+   q->ack_fwd, TH_SYN);
+   mnext = (q->state & ACK_FWD) ? NULL :
+   ipfw_send_pkt(NULL, &(q->id), q->ack_fwd - 1,
+   q->ack_rev, 0);
 
switch (q->id.addr_type) {
case 4:
@@ -1103,18 +1113,16 @@ ipfw_tick(void * vnetx) 
break;
 #endif
}
-
-   m = mnext = NULL;
}
}
IPFW_DYN_UNLOCK();
-   for (m = mnext = m0; m != NULL; m = mnext) {
+   for (m = m0; m != NULL; m = mnext) {
mnext = m->m_nextpkt;
m->m_nextpkt = NULL;
ip_output(m, NULL, NULL, 0, NULL, NULL);
}
 #ifdef INET6
-   for (m = mnext = m6; m != NULL; m = mnext) {
+   for (m = m6; m != NULL; m = mnext) {
mnext = m->m_nextpkt;
m->m_nextpkt = NULL;
ip6_output(m, NULL, NULL, 0, NULL, NULL, NULL);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listi

Re: svn commit: r232272 - head/sys/netinet/ipfw

2012-02-28 Thread Luigi Rizzo
On Tue, Feb 28, 2012 at 09:53:39PM +, Oleg Bulyzhin wrote:
> Author: oleg
> Date: Tue Feb 28 21:53:39 2012
> New Revision: 232272
> URL: http://svn.freebsd.org/changeset/base/232272
> 
> Log:
>   lookup_dyn_rule_locked(): style(9) cleanup
>   
>   MFC after:  1 month

is there a reason for delaying the MFC, such as this is
preparatory work for further changes ?
Otherwise i'd suggest that whitespace changes like this
are quickly pushed to the stable branch so that the code
versions do not diverge.

cheers
luigi


> Modified:
>   head/sys/netinet/ipfw/ip_fw_dynamic.c
> 
> Modified: head/sys/netinet/ipfw/ip_fw_dynamic.c
> ==
> --- head/sys/netinet/ipfw/ip_fw_dynamic.c Tue Feb 28 21:45:21 2012
> (r232271)
> +++ head/sys/netinet/ipfw/ip_fw_dynamic.c Tue Feb 28 21:53:39 2012
> (r232272)
> @@ -390,72 +390,68 @@ ipfw_remove_dyn_children(struct ip_fw *r
>   IPFW_DYN_UNLOCK();
>  }
>  
> -/**
> - * lookup a dynamic rule, locked version
> +/*
> + * Lookup a dynamic rule, locked version.
>   */
>  static ipfw_dyn_rule *
>  lookup_dyn_rule_locked(struct ipfw_flow_id *pkt, int *match_direction,
>  struct tcphdr *tcp)
>  {
>   /*
> -  * stateful ipfw extensions.
> -  * Lookup into dynamic session queue
> +  * Stateful ipfw extensions.
> +  * Lookup into dynamic session queue.
>*/
>  #define MATCH_REVERSE0
>  #define MATCH_FORWARD1
>  #define MATCH_NONE   2
>  #define MATCH_UNKNOWN3
>   int i, dir = MATCH_NONE;
> - ipfw_dyn_rule *prev, *q=NULL;
> + ipfw_dyn_rule *prev, *q = NULL;
>  
>   IPFW_DYN_LOCK_ASSERT();
>  
>   if (V_ipfw_dyn_v == NULL)
> - goto done;  /* not found */
> - i = hash_packet( pkt );
> - for (prev=NULL, q = V_ipfw_dyn_v[i] ; q != NULL ; ) {
> + goto done;  /* not found */
> + i = hash_packet(pkt);
> + for (prev = NULL, q = V_ipfw_dyn_v[i]; q != NULL;) {
>   if (q->dyn_type == O_LIMIT_PARENT && q->count)
>   goto next;
> - if (TIME_LEQ( q->expire, time_uptime)) { /* expire entry */
> + if (TIME_LEQ(q->expire, time_uptime)) { /* expire entry */
>   UNLINK_DYN_RULE(prev, V_ipfw_dyn_v[i], q);
>   continue;
>   }
> - if (pkt->proto == q->id.proto &&
> - q->dyn_type != O_LIMIT_PARENT) {
> - if (IS_IP6_FLOW_ID(pkt)) {
> - if (IN6_ARE_ADDR_EQUAL(&(pkt->src_ip6),
> - &(q->id.src_ip6)) &&
> - IN6_ARE_ADDR_EQUAL(&(pkt->dst_ip6),
> - &(q->id.dst_ip6)) &&
> + if (pkt->proto != q->id.proto || q->dyn_type == O_LIMIT_PARENT)
> + goto next;
> +
> + if (IS_IP6_FLOW_ID(pkt)) {
> + if (IN6_ARE_ADDR_EQUAL(&pkt->src_ip6, &q->id.src_ip6) &&
> + IN6_ARE_ADDR_EQUAL(&pkt->dst_ip6, &q->id.dst_ip6) &&
>   pkt->src_port == q->id.src_port &&
> - pkt->dst_port == q->id.dst_port ) {
> + pkt->dst_port == q->id.dst_port) {
>   dir = MATCH_FORWARD;
>   break;
> - }
> - if (IN6_ARE_ADDR_EQUAL(&(pkt->src_ip6),
> - &(q->id.dst_ip6)) &&
> - IN6_ARE_ADDR_EQUAL(&(pkt->dst_ip6),
> - &(q->id.src_ip6)) &&
> - pkt->src_port == q->id.dst_port &&
> - pkt->dst_port == q->id.src_port ) {
> - dir = MATCH_REVERSE;
> - break;
> - }
> - } else {
> - if (pkt->src_ip == q->id.src_ip &&
> - pkt->dst_ip == q->id.dst_ip &&
> - pkt->src_port == q->id.src_port &&
> - pkt->dst_port == q->id.dst_port ) {
> - dir = MATCH_FORWARD;
> - break;
> - }
> - if (pkt->src_ip == q->id.dst_ip &&
> - pkt->dst_ip == q->id.src_ip &&
> - pkt->src_port == q->id.dst_port &&
> - pkt->dst_port == q->id.src_port ) {
> - dir = MATCH_REVERSE;
> - break;
> - }
> + }
> + if (IN6_ARE_ADDR_EQUAL(&pkt->src_ip6, &q->id.dst_ip6) &&
> + IN6_ARE_ADDR_EQUAL(&pkt->dst_ip6, &q->id.src_ip6) &&
> + pkt->src_port 

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

2012-02-28 Thread Giovanni Trematerra
On Tue, Feb 28, 2012 at 10:45 PM, Dimitry Andric  wrote:
> Author: dim
> Date: Tue Feb 28 21:45:21 2012
> New Revision: 232271
> URL: http://svn.freebsd.org/changeset/base/232271
>
> Log:
>  Change definition of pipe_chmod() from K&R to C99, to avoid the
>  following clang warning:
>
>  sys/kern/sys_pipe.c:1556:10: error: promoted type 'int' of K&R function 
> parameter is not compatible with the parameter type 'mode_t'
>        (aka 'unsigned short') declared in a previous prototype [-Werror]
>          mode_t mode;
>                 ^
>  sys/kern/sys_pipe.c:155:19: note: previous declaration is here
>  static fo_chmod_t       pipe_chmod;
>                          ^
>
> Modified:
>  head/sys/kern/sys_pipe.c
>
> Modified: head/sys/kern/sys_pipe.c
> ==
> --- head/sys/kern/sys_pipe.c    Tue Feb 28 21:43:29 2012        (r232270)
> +++ head/sys/kern/sys_pipe.c    Tue Feb 28 21:45:21 2012        (r232271)
> @@ -1551,11 +1551,7 @@ pipe_close(fp, td)
>  }
>
>  static int
> -pipe_chmod(fp, mode, active_cred, td)
> -       struct file *fp;
> -       mode_t mode;
> -       struct ucred *active_cred;
> -       struct thread *td;
> +pipe_chmod(struct file *fp, mode_t mode, struct ucred *active_cred, struct 
> thread *td)
>  {
>        struct pipe *cpipe;
>        int error;

Thank you.
It introduces a style(9) violation, though.
I think it should be in this way

pipe_chmod(struct file *fp, mode_t mode, struct ucred *active_cred,
struct thread *td)

Anyway that's not a problem I can take care of this and other style violations
during next weeks.

--
Gianni
___
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: r232274 - head/usr.bin/fetch

2012-02-28 Thread David E. O'Brien
Author: obrien
Date: Tue Feb 28 22:15:46 2012
New Revision: 232274
URL: http://svn.freebsd.org/changeset/base/232274

Log:
  Document the 'URL' argument.

Modified:
  head/usr.bin/fetch/fetch.1

Modified: head/usr.bin/fetch/fetch.1
==
--- head/usr.bin/fetch/fetch.1  Tue Feb 28 22:00:41 2012(r232273)
+++ head/usr.bin/fetch/fetch.1  Tue Feb 28 22:15:46 2012(r232274)
@@ -1,5 +1,5 @@
 .\"-
-.\" Copyright (c) 2000-2011 Dag-Erling Smørgrav
+.\" Copyright (c) 2000-2012 Dag-Erling Smørgrav
 .\" All rights reserved.
 .\" Portions Copyright (c) 1999 Massachusetts Institute of Technology; used
 .\" by permission.
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 27, 2011
+.Dd February 28, 2012
 .Dt FETCH 1
 .Os
 .Sh NAME
@@ -214,6 +214,11 @@ When the
 flag is specified, wait this many seconds between successive retries.
 .El
 .Pp
+.Ar URL
+.Bd -literal
+:(//((:)?@)?(:)?)?/()?
+.Ed
+.Pp
 If
 .Nm
 receives a
___
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: r232275 - in head/sys: amd64/include i386/include pc98/include x86/include

2012-02-28 Thread Tijl Coosemans
Author: tijl
Date: Tue Feb 28 22:17:52 2012
New Revision: 232275
URL: http://svn.freebsd.org/changeset/base/232275

Log:
  Copy amd64 setjmp.h to x86 and replace amd64/i386/pc98 setjmp.h with stubs.

Added:
  head/sys/x86/include/setjmp.h
 - copied unchanged from r232268, head/sys/amd64/include/setjmp.h
Modified:
  head/sys/amd64/include/setjmp.h
  head/sys/i386/include/setjmp.h
  head/sys/pc98/include/setjmp.h

Modified: head/sys/amd64/include/setjmp.h
==
--- head/sys/amd64/include/setjmp.h Tue Feb 28 22:15:46 2012
(r232274)
+++ head/sys/amd64/include/setjmp.h Tue Feb 28 22:17:52 2012
(r232275)
@@ -1,50 +1,6 @@
 /*-
- * Copyright (c) 1998 John Birrell .
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *notice, this list of conditions and the following disclaimer in the
- *documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the author nor the names of any co-contributors
- *may be used to endorse or promote products derived from this software
- *without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
+ * This file is in the public domain.
  */
+/* $FreeBSD$ */
 
-#ifndef _MACHINE_SETJMP_H_
-#define_MACHINE_SETJMP_H_
-
-#include 
-
-#define_JBLEN  12  /* Size of the jmp_buf on AMD64. */
-
-/*
- * jmp_buf and sigjmp_buf are encapsulated in different structs to force
- * compile-time diagnostics for mismatches.  The structs are the same
- * internally to avoid some run-time errors for mismatches.
- */
-#if __BSD_VISIBLE || __POSIX_VISIBLE || __XSI_VISIBLE
-typedefstruct _sigjmp_buf { long _sjb[_JBLEN]; } sigjmp_buf[1];
-#endif
-
-typedefstruct _jmp_buf { long _jb[_JBLEN]; } jmp_buf[1];
-
-#endif /* !_MACHINE_SETJMP_H_ */
+#include 

Modified: head/sys/i386/include/setjmp.h
==
--- head/sys/i386/include/setjmp.h  Tue Feb 28 22:15:46 2012
(r232274)
+++ head/sys/i386/include/setjmp.h  Tue Feb 28 22:17:52 2012
(r232275)
@@ -1,50 +1,6 @@
 /*-
- * Copyright (c) 1998 John Birrell .
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *notice, this list of conditions and the following disclaimer in the
- *documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the author nor the names of any co-contributors
- *may be used to endorse or promote products derived from this software
- *without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
+ * This file is in the public domain.
  */
+/* $FreeBSD$ */
 
-#ifndef _MACHINE_SETJMP_

svn commit: r232276 - in head/sys: amd64/include i386/include pc98/include x86/include

2012-02-28 Thread Tijl Coosemans
Author: tijl
Date: Tue Feb 28 22:30:58 2012
New Revision: 232276
URL: http://svn.freebsd.org/changeset/base/232276

Log:
  Copy amd64 stdarg.h to x86 and replace amd64/i386/pc98 stdarg.h with stubs.

Added:
  head/sys/x86/include/stdarg.h
 - copied unchanged from r232268, head/sys/amd64/include/stdarg.h
Modified:
  head/sys/amd64/include/stdarg.h
  head/sys/i386/include/stdarg.h
  head/sys/pc98/include/stdarg.h

Modified: head/sys/amd64/include/stdarg.h
==
--- head/sys/amd64/include/stdarg.h Tue Feb 28 22:17:52 2012
(r232275)
+++ head/sys/amd64/include/stdarg.h Tue Feb 28 22:30:58 2012
(r232276)
@@ -1,75 +1,6 @@
 /*-
- * Copyright (c) 2002 David E. O'Brien.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *notice, this list of conditions and the following disclaimer in the
- *documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- *may be used to endorse or promote products derived from this software
- *without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
+ * This file is in the public domain.
  */
+/* $FreeBSD$ */
 
-#ifndef _MACHINE_STDARG_H_
-#define_MACHINE_STDARG_H_
-
-#include 
-#include 
-
-#ifndef _VA_LIST_DECLARED
-#define_VA_LIST_DECLARED
-typedef__va_list   va_list;
-#endif
-
-#ifdef __GNUCLIKE_BUILTIN_STDARG
-
-#defineva_start(ap, last) \
-   __builtin_va_start((ap), (last))
-
-#defineva_arg(ap, type) \
-   __builtin_va_arg((ap), type)
-
-#define__va_copy(dest, src) \
-   __builtin_va_copy((dest), (src))
-
-#if __ISO_C_VISIBLE >= 1999
-#defineva_copy(dest, src) \
-   __va_copy(dest, src)
-#endif
-
-#defineva_end(ap) \
-   __builtin_va_end(ap)
-
-#elif defined(lint)
-/* Provide a fake implementation for lint's benefit */
-#define__va_size(type) \
-   (((sizeof(type) + sizeof(long) - 1) / sizeof(long)) * sizeof(long))
-#defineva_start(ap, last) \
-   ((ap) = (va_list)&(last) + __va_size(last))
-#defineva_arg(ap, type) \
-   (*(type *)((ap) += __va_size(type), (ap) - __va_size(type)))
-#defineva_end(ap)
-
-#else
-#error this file needs to be ported to your compiler
-#endif
-
-#endif /* !_MACHINE_STDARG_H_ */
+#include 

Modified: head/sys/i386/include/stdarg.h
==
--- head/sys/i386/include/stdarg.h  Tue Feb 28 22:17:52 2012
(r232275)
+++ head/sys/i386/include/stdarg.h  Tue Feb 28 22:30:58 2012
(r232276)
@@ -1,90 +1,6 @@
 /*-
- * Copyright (c) 2002 David E. O'Brien.  All rights reserved.
- * Copyright (c) 1991, 1993
- * The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *notice, this list of conditions and the following disclaimer in the
- *documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- *may be used to endorse or promote products derived from this software
- *without specific prior written permission.
- 

Re: svn commit: r232272 - head/sys/netinet/ipfw

2012-02-28 Thread Luigi Rizzo
On Wed, Feb 29, 2012 at 02:39:37AM +0400, Oleg Bulyzhin wrote:
> On Tue, Feb 28, 2012 at 11:22:52PM +0100, Luigi Rizzo wrote:
> > On Tue, Feb 28, 2012 at 09:53:39PM +, Oleg Bulyzhin wrote:
> > > Author: oleg
> > > Date: Tue Feb 28 21:53:39 2012
> > > New Revision: 232272
> > > URL: http://svn.freebsd.org/changeset/base/232272
> > > 
> > > Log:
> > >   lookup_dyn_rule_locked(): style(9) cleanup
> > >   
> > >   MFC after:  1 month
> > 
> > is there a reason for delaying the MFC, such as this is
> > preparatory work for further changes ?
> > Otherwise i'd suggest that whitespace changes like this
> > are quickly pushed to the stable branch so that the code
> > versions do not diverge.
> > 
> > cheers
> > luigi
> 
> Actual commit is r232273, this one used for reduce diff
> of meaningful commit.

ok, thanks
luigi
___
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: r232272 - head/sys/netinet/ipfw

2012-02-28 Thread Oleg Bulyzhin
On Tue, Feb 28, 2012 at 11:22:52PM +0100, Luigi Rizzo wrote:
> On Tue, Feb 28, 2012 at 09:53:39PM +, Oleg Bulyzhin wrote:
> > Author: oleg
> > Date: Tue Feb 28 21:53:39 2012
> > New Revision: 232272
> > URL: http://svn.freebsd.org/changeset/base/232272
> > 
> > Log:
> >   lookup_dyn_rule_locked(): style(9) cleanup
> >   
> >   MFC after:1 month
> 
> is there a reason for delaying the MFC, such as this is
> preparatory work for further changes ?
> Otherwise i'd suggest that whitespace changes like this
> are quickly pushed to the stable branch so that the code
> versions do not diverge.
> 
> cheers
> luigi

Actual commit is r232273, this one used for reduce diff
of meaningful commit.

-- 
Oleg.


=== Oleg Bulyzhin -- OBUL-RIPN -- OBUL-RIPE -- o...@rinet.ru ===


___
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: r232261 - in head/sys: amd64/include i386/include pc98/include x86/include

2012-02-28 Thread Bruce Evans

On Tue, 28 Feb 2012, Tijl Coosemans wrote:


Log:
 Copy amd64 _types.h to x86 and merge with i386 _types.h. Replace existing
 amd64/i386/pc98 _types.h with stubs.


I don't like this much.  It gives 2 layers of convolutions for readers
(humans and compilers) to slowly untangle.  There is another layer of
include files for compatibility (but both layers are still used by
default), and lots of ifdefs.  The whole point of 1 file per arch was
to avoid such ifdefs.  This might be OK if arches were actually identical
for the APIs in these files, but for types there are lots of differences
between 32-bit and 64-bit machines.
  The differences can be reduced by spelling 32/64-bit types as
  [unsigned] long and by always using the basic type instead of a
  derived type.  Old code (e.g., FreeBSD-3) did this, but now almost
  everything is declared using the derived fixed-width types
  int32_t/int64_t etc., so there is always a spelling difference for
  32/64-bit types.  The only exceptions are floating point types, and
  the broken __clock_t type.
clock_t is unsigned long on i386, but is int32_t on amd64.  This
is backwards at best.  I think this brokenness came from NetBSD.
_BSD_CLOCK_T_ was correct (unsigned long) for all arches in 4.4BSD,
and i386 just didn't break this.  But now __clock_t is broken for
all arches except i386: it is __uint32_t on arm and powerpc, which
is just a different spelling for the 32-bit case and is at least
ABI-compatible for the 64-bit case, but for all other arches
including all 64-bit ones, it broken to __int32_t.  Perhaps the
difference is explained by "long" being bad for ABI compatibility.
Old code like 4.4BSD-Lite1 used long excessively (since technically,
int might be only 16 bits).  Even pid_t was long in 4.4BSD-Lite1.
NetBSD changed many of these longs to ints or int32_t's for ABI
compatibility and/or because 64 bit longs are just too wide, and
FreeBSD eventually picked up these changes (mostly via 4.4BSD-Lite2
for general typedefs and directly from NetBSD for 64-bit arches).
So pid_t is now int32_t and clock_t is mostly broken.  clock_t
really needs all 64 bits if they are readily available, but has
been reduced to 31, especially when 64 are readily available.
OTOH, if you just want ABI and API compatibility for clock_t,
then it should have been changed to uint32_t for all arches and
not defined in any MD types file.  There is now a minor API
compatibility for printing clock_t's -- %lu format must be used
on i386, %u on others, and %d on most.  Except for the gratuitous
loss of unsignedness, this is just a special case of printing
a typedefed types.  clock_t may also be a floating point type,
so the only good way to print it is to convert it to [long] double
and then worry about the correct floating point format (how much
precision should it have?...).


Copied and modified: head/sys/x86/include/_types.h (from r232259, 
head/sys/amd64/include/_types.h)
==
--- head/sys/amd64/include/_types.h Tue Feb 28 15:52:01 2012
(r232259, copy source)
+++ head/sys/x86/include/_types.h   Tue Feb 28 18:15:28 2012
(r232261)
@@ -54,19 +54,41 @@ typedef short   __int16_t;
typedef unsigned short  __uint16_t;
typedef int __int32_t;
typedef unsigned int__uint32_t;
+#ifdef _LP64
typedef long__int64_t;
typedef unsigned long   __uint64_t;


This is about the only ifdef that is really needed.


+#else
+#ifndef lint
+__extension__


An old bug -- work around broken lints.  Although messy, this is not
messy enough to be correct -- __extension__ is a hard-coded gccism.
Elsewhere, in much less important code than this, there are messy
ifdefs to avoid hard-coded gccisms.


+#endif
+/* LONGLONG */


long long has only been standard for 13 years now, so broken lints
still need this messy markup.


+typedeflong long   __int64_t;
+#ifndef lint
+__extension__
+#endif
+/* LONGLONG */
+typedefunsigned long long  __uint64_t;
+#endif


I ifdefed all this correctly 15+ years ago so that it compiled (but
didn't run if *int64_t was used) for a non-gcc K&R compiler.  The
long long abomination was not used, and __attribute__(()) was used
to declare *int64_t, but only under a gcc ifdef.  This wasn't broken
until 8 Jan 2011 by, erm, us.  We also added the __extensions__.
The justification was that long long is now standard.  But there
are still the old messes for lint, and new breakage for non-gcc to
support C90.



/*
 * Standard type definitions.
 */
+#ifdef _LP64
typedef __int32_t   __clock_t;  /* clock()... */
typedef __int64_t   __critical_t;
typedef double  __double_t;
typedef float   __float_t;
typedef __int64_t   __intfptr_t;
-typedef__int64

Re: svn commit: r232181 - in head/sys: kern sys

2012-02-28 Thread Julian Elischer

On 2/27/12 11:29 PM, Mikolaj Golub wrote:

On Mon, 27 Feb 2012 22:34:25 -0800 Julian Elischer wrote:

  JE>  I don't think this belongs in the kernel by default. It's not exactl a
  JE>  call for backout but It's teh next thing short of that. a call for "do
  JE>  you REALLY think we need this particular specific case catered for?"

The main goal of the patch was to provide ability to get another process
umask. It looks like usefulness of this is not questioned here.


well that's exactly what I AM questioning..  how often will this be used?
one person using this once in all of history isn't a real requirement 
for inclusion.

It seems to me that someone is more likely to figure out a sneaky way
to use this in a bad way than to want to use it in the way you expect.



___
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: r232278 - in head: sys/compat/linprocfs sys/compat/linsysfs sys/fs/procfs sys/fs/pseudofs sys/kern sys/sys usr.sbin/jail

2012-02-28 Thread Martin Matuska
Author: mm
Date: Wed Feb 29 00:30:18 2012
New Revision: 232278
URL: http://svn.freebsd.org/changeset/base/232278

Log:
  Add procfs to jail-mountable filesystems.
  
  Reviewed by:  jamie
  MFC after:1 week

Modified:
  head/sys/compat/linprocfs/linprocfs.c
  head/sys/compat/linsysfs/linsysfs.c
  head/sys/fs/procfs/procfs.c
  head/sys/fs/pseudofs/pseudofs.h
  head/sys/kern/kern_jail.c
  head/sys/sys/jail.h
  head/usr.sbin/jail/jail.8

Modified: head/sys/compat/linprocfs/linprocfs.c
==
--- head/sys/compat/linprocfs/linprocfs.c   Tue Feb 28 23:30:19 2012
(r232277)
+++ head/sys/compat/linprocfs/linprocfs.c   Wed Feb 29 00:30:18 2012
(r232278)
@@ -1460,7 +1460,7 @@ linprocfs_uninit(PFS_INIT_ARGS)
return (0);
 }
 
-PSEUDOFS(linprocfs, 1);
+PSEUDOFS(linprocfs, 1, 0);
 MODULE_DEPEND(linprocfs, linux, 1, 1, 1);
 MODULE_DEPEND(linprocfs, procfs, 1, 1, 1);
 MODULE_DEPEND(linprocfs, sysvmsg, 1, 1, 1);

Modified: head/sys/compat/linsysfs/linsysfs.c
==
--- head/sys/compat/linsysfs/linsysfs.c Tue Feb 28 23:30:19 2012
(r232277)
+++ head/sys/compat/linsysfs/linsysfs.c Wed Feb 29 00:30:18 2012
(r232278)
@@ -280,5 +280,5 @@ linsysfs_uninit(PFS_INIT_ARGS)
return (0);
 }
 
-PSEUDOFS(linsysfs, 1);
+PSEUDOFS(linsysfs, 1, 0);
 MODULE_DEPEND(linsysfs, linux, 1, 1, 1);

Modified: head/sys/fs/procfs/procfs.c
==
--- head/sys/fs/procfs/procfs.c Tue Feb 28 23:30:19 2012(r232277)
+++ head/sys/fs/procfs/procfs.c Wed Feb 29 00:30:18 2012(r232278)
@@ -209,4 +209,4 @@ procfs_uninit(PFS_INIT_ARGS)
return (0);
 }
 
-PSEUDOFS(procfs, 1);
+PSEUDOFS(procfs, 1, PR_ALLOW_MOUNT_PROCFS);

Modified: head/sys/fs/pseudofs/pseudofs.h
==
--- head/sys/fs/pseudofs/pseudofs.h Tue Feb 28 23:30:19 2012
(r232277)
+++ head/sys/fs/pseudofs/pseudofs.h Wed Feb 29 00:30:18 2012
(r232278)
@@ -31,6 +31,8 @@
 #ifndef _PSEUDOFS_H_INCLUDED
 #define _PSEUDOFS_H_INCLUDED
 
+#include 
+
 /*
  * Opaque structures
  */
@@ -271,7 +273,7 @@ int  pfs_destroy(struct pfs_node *pn);
 /*
  * Now for some initialization magic...
  */
-#define PSEUDOFS(name, version)
\
+#define PSEUDOFS(name, version, jflag) \
\
 static struct pfs_info name##_info = { \
#name,  \
@@ -281,6 +283,8 @@ static struct pfs_info name##_info = {  
\
 static int \
 _##name##_mount(struct mount *mp) {\
+if (jflag && !prison_allow(curthread->td_ucred, jflag))
\
+return (EPERM);
\
return pfs_mount(&name##_info, mp); \
 }  \
\
@@ -303,7 +307,7 @@ static struct vfsops name##_vfsops = {  
.vfs_uninit =   _##name##_uninit,   \
.vfs_unmount =  pfs_unmount,\
 }; \
-VFS_SET(name##_vfsops, name, VFCF_SYNTHETIC);  \
+VFS_SET(name##_vfsops, name, VFCF_SYNTHETIC | (jflag ? VFCF_JAIL : 0));
\
 MODULE_VERSION(name, version); \
 MODULE_DEPEND(name, pseudofs, 1, 1, 1);
 

Modified: head/sys/kern/kern_jail.c
==
--- head/sys/kern/kern_jail.c   Tue Feb 28 23:30:19 2012(r232277)
+++ head/sys/kern/kern_jail.c   Wed Feb 29 00:30:18 2012(r232278)
@@ -204,6 +204,7 @@ static char *pr_allow_names[] = {
"allow.mount.devfs",
"allow.mount.nullfs",
"allow.mount.zfs",
+   "allow.mount.procfs",
 };
 const size_t pr_allow_names_size = sizeof(pr_allow_names);
 
@@ -218,6 +219,7 @@ static char *pr_allow_nonames[] = {
"allow.mount.nodevfs",
"allow.mount.nonullfs",
"allow.mount.nozfs",
+   "allow.mount.noprocfs",
 };
 const size_t pr_allow_nonames_size = sizeof(pr_allow_nonames);
 
@@ -4206,6 +4208,10 @@ SYSCTL_PROC(_security_jail, OID_AUTO, mo
 CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE,
 NULL, PR_ALLOW_MOUNT_NULLFS, sysctl_jail_default_allow, "I",
 "Processes in jail

Re: svn commit: r232278 - in head: sys/compat/linprocfs sys/compat/linsysfs sys/fs/procfs sys/fs/pseudofs sys/kern sys/sys usr.sbin/jail

2012-02-28 Thread Bjoern A. Zeeb

On 29. Feb 2012, at 00:30 , Martin Matuska wrote:

> Author: mm
> Date: Wed Feb 29 00:30:18 2012
> New Revision: 232278
> URL: http://svn.freebsd.org/changeset/base/232278
> 
> Log:
>  Add procfs to jail-mountable filesystems.
> 

The man page lacks a .Dd update?

I also think this one should come with a very big red warning in the man page
that you can easily compromise your host security I fear unless things changed
in "proc" land.



>  Reviewed by: jamie
>  MFC after:   1 week
> 
> Modified:
>  head/sys/compat/linprocfs/linprocfs.c
>  head/sys/compat/linsysfs/linsysfs.c
>  head/sys/fs/procfs/procfs.c
>  head/sys/fs/pseudofs/pseudofs.h
>  head/sys/kern/kern_jail.c
>  head/sys/sys/jail.h
>  head/usr.sbin/jail/jail.8

..

> Modified: head/usr.sbin/jail/jail.8
> ==
> --- head/usr.sbin/jail/jail.8 Tue Feb 28 23:30:19 2012(r232277)
> +++ head/usr.sbin/jail/jail.8 Wed Feb 29 00:30:18 2012(r232278)
> @@ -428,6 +428,14 @@ This permission is effective only togeth
> and if
> .Va enforce_statfs
> is set to a value lower than 2.
> +.It Va allow.mount.procfs
> +privileged users inside the jail will be able to mount and unmount the
> +procfs file system.
> +This permission is effective only together with
> +.Va allow.mount
> +and if
> +.Va enforce_statfs
> +is set to a value lower than 2.
> .It Va allow.mount.zfs
> privileged users inside the jail will be able to mount and unmount the
> ZFS file system.

-- 
Bjoern A. Zeeb You have to have visions!
   It does not matter how good you are. It matters what good you do!

___
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: r232266 - in head/sys: amd64/include i386/include pc98/include x86/include

2012-02-28 Thread Bruce Evans

On Tue, 28 Feb 2012, Tijl Coosemans wrote:


Log:
 Copy amd64 endian.h to x86 and merge with i386 endian.h. Replace
 amd64/i386/pc98 endian.h with stubs.

 In __bswap64_const(x) the conflict between 0xffUL and 0xffULL has been
 resolved by reimplementing the macro in terms of __bswap32(x). As a side
 effect __bswap64_var(x) is now implemented using two bswap instructions on
 i386 and should be much faster. __bswap32_const(x) has been reimplemented
 in terms of __bswap16(x) for consistency.


The files now have enough in common for me to be happy with centralizing
them.  The trip through  would have to be avoided to complete
the cleanup.  I don't know how to do that.  Maybe install can produce
a direct symlink.  We should try harder to not install both x86/foo.h
and machine/foo.h, so pathnames  and  don't start being
used in applications and then having to be supported for compatibility.

The patch is unreadable due to significant reimplementations, even without
the move.  So I looked at the resulting x86/endian.h:

% ...
% #ifdef __cplusplus
% extern "C" {
% #endif

This ifdef is old style bug:
- it is a hard-coded spelling of __BEGIN_DECLS
- it is placed around the whole file.  Most of the file consists of macro
  definitions.  __BEGIN_DECLS would obviously make no sense around macro
  definitions.
- the rest of the file consists of inline function declarations.  Since
  these aren't extern, 'extern "C"' makes no sense for them, though it
  isn't so clear that __BEGIN_DECLS makes no sense for them.
- the log message for the commit that added it is not good, but at least
  says that C++ support is added.

% #if defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE_BUILTIN_CONSTANT_P)

This ifdef is still misplaced.  Defining the 'const' versions doesn't
require the gcc builtin, and it is further from requiring gcc asm.

% 
% #define	__bswap64_const(_x)			\

%   (((_x) >> 56) |   \
%   (((_x) >> 40) & (0xffULL << 8)) |   \
%   (((_x) >> 24) & (0xffULL << 16)) |  \
%   (((_x) >> 8) & (0xffULL << 24)) |   \
%   (((_x) << 8) & (0xffULL << 32)) |   \
%   (((_x) << 24) & (0xffULL << 40)) |  \
%   (((_x) << 40) & (0xffULL << 48)) |  \
%   ((_x) << 56))

I think this can be simplified in the same way as the `var' case should
have been simplified, by building it up out of 2 __bswap32_const()s...

% 
% #define	__bswap32_const(_x)			\

%   (((_x) >> 24) |   \
%   (((_x) & (0xff << 16)) >> 8) |  \
%   (((_x) & (0xff << 8)) << 8) |   \
%   ((_x) << 24))

... and this can be built out of 2 __bswap16_const()s', though it is
short enough already.  Building up would be essential for __bswap_2^N
and good for N > 64.

% 
% #define __bswap16_const(_x)	(__uint16_t)((_x) << 8 | (_x) >> 8)
% 
% static __inline __uint64_t

% __bswap64_var(__uint64_t __x)
% {
% 
% 	return __bswap64_const(__x);

% }

This seems to be a pessimization for amd64, and doesn't match your
claim that it now uses 2 bswap instructions on i386.  It is the old
i386 version.  amd64 used to use a single 64-bit bswap in asm here.
Last time I looked (only on i386), gcc was incapable of turning either
__bswap64_const() or __bswap32_const() into 2 or 1 bswap instructions,
but generated pessimial code using shifts and masks.  Only clang
generated the 2 or 1 bswaps.

There is a PR about bswap64 being pessimal on i386.  The following seems
to be optimal for gcc on i386.  It uses the building-up method.  See the
PR for other details.

@ #define   _KERNEL
@ #define   I486_CPU
@ 
@ #include 

@ #include 
@ 
@ uint64_t x, y;
@ 
@ int

@ main(void)
@ {
@   /*
@* Follow is a better __bswap64().  It doesn't even need const and
@* var subcases.
@*/
@   y = __bswap32(x) | (uint64_t)__bswap32(x >> 32) << 32;
@   return (0);
@ }

Expanding on its comment, we probably don't even need the const subcase
for consts, but can just use the above expression for consts too.
However, this only works right for i386.   For amd64, there are the
following cases:
- const case, compiler either gcc or clang: the above expression should
  work
- variable case, gcc: needs the inline with a 64-bit bswap, unless gcc
  has become smarter
- variable case, clang: the above expression won't work if __bswap32()
  uses an inline asm with a 32-bit bswap like it does now, since clang
  will be forced to generate 2 32-bit bswaps.  To recover to single
  64-bit bswap, either write it in inline asm for clang too, or maybe
  use the general 64-bit 'const' expression (written like it is now,
  not as in my version above).  I think clang translates the big const
  expression into a single 64-bit bswap, not 2 32-bit ones like it does
  on i386.

% 
%


Extra blank line (old style bug duplicated).

% ... 
% #define	__bswap64(_x)	\

%   (__builtin_constant_p(_x) ? \
%   __bswap64_const((__uint64_t)(_x)) : __bsw

Re: svn commit: r232266 - in head/sys: amd64/include i386/include pc98/include x86/include

2012-02-28 Thread Bruce Evans

On Wed, 29 Feb 2012, Bruce Evans wrote:


On Tue, 28 Feb 2012, Tijl Coosemans wrote:

The patch is unreadable due to significant reimplementations, even without
the move.  So I looked at the resulting x86/endian.h:


Oops.  I somehow looked at the old i386 version.  The committed version
is mostly OK, and fixes or avoids most of the bugs that I pointed out:

% #ifdef __cplusplus
% extern "C" {
% #endif

Still have this.

% #define   __bswap16_const(_x) (__uint16_t)((_x) << 8 | (_x) >> 8)
% 
% #define	__bswap16(_x)			\

%   (__builtin_constant_p(_x) ? \
%   __bswap16_const((__uint16_t)(_x)) : __bswap16_var(_x))

There seems to be no need for the const and var cases for 16 bits (use
the expression for the const case unconditionally, with more casts in
it).

We haven't remove the bogus underscores in macro parameter names yet.

% 
% #define	__bswap32_const(_x)		\

%   (((__uint32_t)__bswap16(_x) << 16) | __bswap16((_x) >> 16))

Now uses "building-up".

% 
% #define	__bswap32(_x)			\

%   (__builtin_constant_p(_x) ? \
%   __bswap32_const((__uint32_t)(_x)) : __bswap32_var(_x))

The technical considerations described in my previous mail prevent
killing the separate cases and using pure building up from 16 bits to
32 and 64 bits.

This is quite confusing.  __bswap32_const() is perfectly general since
it uses the general __bswap16() macros, but it is spelled with a `const'.
OTOH, __bswap32() is perfectly general by name and functionality, but is
only useful for the `var' case.

% ...
% static __inline __uint16_t
% __bswap16_var(__uint16_t _x)
% {
% 
% 	return (__bswap16_const(_x));

% }

Not needed, since we killed the asm for the 16-bit case.

% 
% static __inline __uint32_t

% __bswap32_var(__uint32_t _x)
% {
% 
% 	__asm ("bswap %0" : "+r" (_x));

%   return (_x);
% }
% 
% static __inline __uint64_t

% __bswap64_var(__uint64_t _x)
% {
% #ifdef_LP64

Tab instead of space after ifdef.

I think it is gcc and not _LP64 that needs this help.

%   __asm ("bswap %0" : "+r" (_x));
%   return (_x);
% #else
%   return (__bswap64_const(_x));

The use of `const' here confused me into thinking that this still uses
the old slow `const' code.

% #endif
% }
% ...
% #ifdef __cplusplus
% }
% #endif

Still have this.

The best cleanups seem to be:
- use general building up with no asms and no inline functions for the
  default case (put this in a MI header)
- use asms for gcc.  I think the following works for minimizing the
  ifdefs for this:
  - start with bswap32(), etc., defined directly to the default using
building up (I'm trying to avoid having the __bswap32() layer too)
  - to override this, just #undef it and redefine it with a gcc asm in
it (it seems best to use a statement expression and not an inline)
  or:
  - start with __bswap32() defined to the default using building up
  - normally define bswap32 to __bswap32.  Otherwise, define bswap32
to our special asm or C implementation.
  or:
  - some combination of the above.  We can use __bswap32 in an inline
function with the same name, and then #undef the macro:

% #define   __bswap32(x)(...)
% 
% int

% (__bswap32)(int _x)
% {
% #ifdef asm_case
%   {( asm(...
% #else
%   return (__bswap32(_x));
% #endif
% }
% 
% #undef __bswap32


This technique permits the default macros to use the best names and
not require adorning them with _const or _var or maybe even __ and
then needing more layers to #define them back to the best names.

I don't know how to do this without turning the macro into an inline
function.  There is related magic for macros that I forget.

Bruce
___
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: r232286 - head/sys/kern

2012-02-28 Thread David Xu
Author: davidxu
Date: Wed Feb 29 02:01:48 2012
New Revision: 232286
URL: http://svn.freebsd.org/changeset/base/232286

Log:
  initialize clock ID and flags only when copying timespec, a _umtx_time
  copy already contains these fields.

Modified:
  head/sys/kern/kern_umtx.c

Modified: head/sys/kern/kern_umtx.c
==
--- head/sys/kern/kern_umtx.c   Wed Feb 29 01:39:39 2012(r232285)
+++ head/sys/kern/kern_umtx.c   Wed Feb 29 02:01:48 2012(r232286)
@@ -2937,11 +2937,11 @@ umtx_copyin_umtx_time(const void *addr, 
 {
int error;

-   tp->_clockid = CLOCK_REALTIME;
-   tp->_flags   = 0;
-   if (size <= sizeof(struct timespec))
+   if (size <= sizeof(struct timespec)) {
+   tp->_clockid = CLOCK_REALTIME;
+   tp->_flags = 0;
error = copyin(addr, &tp->_timeout, sizeof(struct timespec));
-   else 
+   } else 
error = copyin(addr, tp, sizeof(struct _umtx_time));
if (error != 0)
return (error);
___
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: r232183 - head/sys/kern

2012-02-28 Thread Bruce Evans

On Tue, 28 Feb 2012, Alexander Best wrote:


On Sun Feb 26 12, Jilles Tjoelker wrote:

Log:
  Fix fchmod() and fchown() on fifos.

  The new fifo implementation in r232055 broke fchmod() and fchown() on fifos.
  Postfix needs this.


clang seems to have a problem with this commit:

usr/subversion-src/sys/kern/sys_pipe.c:1556:10: error: promoted type 'int' of 
K&R function parameter is not compatible with the parameter type 'mode_t' (aka 
'unsigned short') declared in a previous prototype [-Werror]
   mode_t mode;
  ^
/usr/subversion-src/sys/kern/sys_pipe.c:155:19: note: previous declaration is 
here
static fo_chmod_t   pipe_chmod;
   ^
1 error generated.
*** Error code 1


Indeed, sys_pipe.c still uses mostly K&R-style function definitions, and
the recent change was compatible with this to a fault.

It is an old bug in gcc that it accepts function definitions that don't
match their prototype.  The most common error is the one here -- the
function definition is K&R and has a type smaller than its promotion;
the prototype must give the promoted type to match, but this breaks it
for use with function definitions that are not K&R and use the narrow
type.

It is an old design error to have APIs that pass narrowed types.
Passing narrowed types is normally just a pessimization.  The ABI
normally requires passing a widened value.  The widened value may have
garbage in the extra bits, but for safety and to support missing
prototypes, in practice callers must sign-extend or zero-extend the
narrow value.  The for safety and to support missing prototypes, in
practice callees can't trust callers to have done this, so they force
to a narrow value.  Then to actually use the value, they often have
to widen it again.  The result is often a couple of extra instructions
after optimizing away only half of the logical extra conversions for
this.  So the supposed optimization of passing narrow types is usually
a pessimization.  Maybe this is a good pessimization for private
APIs, but it shouldn't be required for external ones.

Narrow types in syscalls are especially bad.  Now the C API doesn't
really extend across the syscall boundary, so both sides have to
force the above conversions or depend on the compiler doing them
because it fears missing prototypes.  In practice, FreeBSD depends
on the compiler doing them for most or all arches.

The narrow mode_t for open(2) is worst.  It is the only narrow type
in in a core syscall, and has further problems.  The prototype for
open() is "int open(const char *path, int flags, ...);", with the only
option for "..." being a mode_t.  open() is thus variadic, but variadic
functions really can't be passed a narrowed type like mode_t, and
syscalls can't really pass this either.  FreeBSD used to depend on
various type puns near here, and still has my XXX comments in
syscalls.master about them, but some of them have been fixed.  The
largest one is that the kernel assumes that the mode_t arg is always
there.  It copies stack garbage if it is not there, and only later
checks the flags and avoids using the stack garbage when there is no
arg there.  This is not too bad if done intentionally.  It must be
arranged that the stack garbage is in accessible memory, but it always
is in practice.  The kernel is carefully to access the arg as an int
and not as a mode_t, and to pass it down through too many layers as
an int.

Bruce
___
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: r232275 - in head/sys: amd64/include i386/include pc98/include x86/include

2012-02-28 Thread Bruce Evans

On Tue, 28 Feb 2012, Tijl Coosemans wrote:


Log:
 Copy amd64 setjmp.h to x86 and replace amd64/i386/pc98 setjmp.h with stubs.


This may be correct (except for comment), but it is confusing.


Added:
 head/sys/x86/include/setjmp.h
- copied unchanged from r232268, head/sys/amd64/include/setjmp.h
Modified:
 head/sys/amd64/include/setjmp.h
 head/sys/i386/include/setjmp.h
 head/sys/pc98/include/setjmp.h

Modified: head/sys/amd64/include/setjmp.h
==
--- head/sys/amd64/include/setjmp.h Tue Feb 28 22:15:46 2012
(r232274)
+++ head/sys/amd64/include/setjmp.h Tue Feb 28 22:17:52 2012
(r232275)
@@ -1,50 +1,6 @@
...
-#define_JBLEN  12  /* Size of the jmp_buf on AMD64. */
-
-/*
- * jmp_buf and sigjmp_buf are encapsulated in different structs to force
- * compile-time diagnostics for mismatches.  The structs are the same
- * internally to avoid some run-time errors for mismatches.
- */
-#if __BSD_VISIBLE || __POSIX_VISIBLE || __XSI_VISIBLE
-typedefstruct _sigjmp_buf { long _sjb[_JBLEN]; } sigjmp_buf[1];
-#endif
-
-typedefstruct _jmp_buf { long _jb[_JBLEN]; } jmp_buf[1];


On amd64, the comment was specific to amd64 (but with amd64 misspelled
as AMD64), and actually matched the code.


Modified: head/sys/i386/include/setjmp.h
==
--- head/sys/i386/include/setjmp.h  Tue Feb 28 22:15:46 2012
(r232274)
+++ head/sys/i386/include/setjmp.h  Tue Feb 28 22:17:52 2012
(r232275)
@@ -1,50 +1,6 @@
-#define_JBLEN  11  /* Size of the jmp_buf on x86. */
-
-/*
- * jmp_buf and sigjmp_buf are encapsulated in different structs to force
- * compile-time diagnostics for mismatches.  The structs are the same
- * internally to avoid some run-time errors for mismatches.
- */
-#if __BSD_VISIBLE || __POSIX_VISIBLE || __XSI_VISIBLE
-typedefstruct _sigjmp_buf { int _sjb[_JBLEN + 1]; } sigjmp_buf[1];
-#endif
-
-typedefstruct _jmp_buf { int _jb[_JBLEN + 1]; } jmp_buf[1];


On i386, the comment had a differently wrong name for the old code, and
mismatched the old code, but is correct for the new code.

_JBLEN was apparently 1 less than what it was claimed to be on i386.
I forget what the extra 1 is for.


Copied: head/sys/x86/include/setjmp.h (from r232268, 
head/sys/amd64/include/setjmp.h)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/x86/include/setjmp.h   Tue Feb 28 22:17:52 2012
(r232275, copy of r232268, head/sys/amd64/include/setjmp.h)
@@ -0,0 +1,50 @@
...
+#define_JBLEN  12  /* Size of the jmp_buf on AMD64. */


This code looks wrong, since _JBLEN was only 11 for i386, but binary
compatibility of the jmp_buf is preserved by the extra 1 in it.

This comment is wrong, since the code is no longer just for AMD64 (sic),
and the comment makes it look more like the code has an off-by-1 error
for !AMD64.


+
+/*
+ * jmp_buf and sigjmp_buf are encapsulated in different structs to force
+ * compile-time diagnostics for mismatches.  The structs are the same
+ * internally to avoid some run-time errors for mismatches.
+ */
+#if __BSD_VISIBLE || __POSIX_VISIBLE || __XSI_VISIBLE
+typedefstruct _sigjmp_buf { long _sjb[_JBLEN]; } sigjmp_buf[1];
+#endif
+
+typedefstruct _jmp_buf { long _jb[_JBLEN]; } jmp_buf[1];


No extra 1 for either now.

The extra 1 was apparently a placeholder for the signal mask and became
obsolete 15-20 years ago.  4.4BSD-Lite2 claims not to support the signal
mask, and doesn't have space for it in the plain jmp_buf.  setjmp.h
was in src/include and was moved to MD files to clean up its ifdefs.
Now we're barely escaping putting the ifdefs back in the x86 version,
sigh.  Ifdefs are really needed, since the i386 version is too small
to have space for mxcsr, and mxcsr is only hacked into the amd64 version
by packing it using the doubled space given by long entries.


From the 4.4BSD-Lite2 version:

% #if defined(hp300) || defined(__hp300__) || defined(luna68k) || 
defined(__luna68k__)
% #define _JBLEN17
% #endif
% 
% #if defined(i386) || defined(__i386__)

% #define _JBLEN10
% #endif
% 
% #if defined(mips) || defined(__mips__)

% #define _JBLEN83
% #endif
% 
% #if defined(sparc) || defined(__sparc__)

% #define _JBLEN10
% #endif
% 
% #if defined(tahoe) || defined(__tahoe__)

% #define _JBLEN10
% #endif
% 
% #if defined(vax) || defined(__vax__)

% #define _JBLEN10
% #endif
% 
% #ifndef _ANSI_SOURCE

% /*
%  * WARNING: sigsetjmp() isn't supported yet, this is a placeholder.
%  */
% typedef int sigjmp_buf[_JBLEN + 1];
% #endif /* not ANSI */
% 
% typedef int jmp_buf[_JBLEN];


The extra 1 seems to have been nonsense there too.  BSD has always (?)
saved the signal m

Re: svn commit: r232266 - in head/sys: amd64/include i386/include pc98/include x86/include

2012-02-28 Thread Bruce Evans

On Tue, 28 Feb 2012, Tijl Coosemans wrote:


On Tuesday 28 February 2012 21:55:57 Dimitry Andric wrote:

On 2012-02-28 20:39, Tijl Coosemans wrote:

Log:
  Copy amd64 endian.h to x86 and merge with i386 endian.h. Replace
  amd64/i386/pc98 endian.h with stubs.

  In __bswap64_const(x) the conflict between 0xffUL and 0xffULL has been
  resolved by reimplementing the macro in terms of __bswap32(x). As a side
  effect __bswap64_var(x) is now implemented using two bswap instructions on
  i386 and should be much faster. __bswap32_const(x) has been reimplemented
  in terms of __bswap16(x) for consistency.

...

+#define__bswap32_const(_x) \
+   (((__uint32_t)__bswap16(_x) << 16) | __bswap16((_x) >> 16))
+
+#define__bswap32(_x)   \
+   (__builtin_constant_p(_x) ? \
+   __bswap32_const((__uint32_t)(_x)) : __bswap32_var(_x))
+
+#define__bswap64_const(_x) \
+   (((__uint64_t)__bswap32(_x) << 32) | __bswap32((_x) >> 32))


Hmm, shouldn't __bswap32_const() be implemented in terms of
__bswap16_const(), and similarly for __bswap64_const(), which should be
implemented in terms of __bswap32_const()?

The whole reason for the difficult dance with __builtin_constant_p is to
allow for compile-time resolving of bswap'd constants.  Invoking the
regular __bswap() macros doesn't gain you anything here.


__bswap64_const is also used in __bswap64_var, so its argument isn't
always a compile time constant and then __bswap32 becomes __bswap32_var.
If it is a constant __bswap32 becomes __bswap32_const (even at -O0).


I cleaned this up a bit according to ideas in my previous mails, and
added a comment about the confusing use of __bswap64_const() (now
named __bswap64_gen()) in __bswap64_var():

% Index: endian.h
% ===
% RCS file: /home/ncvs/src/sys/x86/include/endian.h,v
% retrieving revision 1.1
% diff -u -2 -r1.1 endian.h
% --- endian.h  28 Feb 2012 19:39:54 -  1.1
% +++ endian.h  29 Feb 2012 03:10:33 -
% @@ -37,8 +37,4 @@
%  #include 
% 
% -#ifdef __cplusplus

% -extern "C" {
% -#endif
% -
%  /*
%   * Define the order of 32-bit words in 64-bit words.
% @@ -68,32 +64,24 @@
%  #endif
% 
% -#if defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE_BUILTIN_CONSTANT_P)

% -
% -#define  __bswap16_const(_x) (__uint16_t)((_x) << 8 | (_x) >> 8)
% -
% -#define  __bswap16(_x)   \
% - (__builtin_constant_p(_x) ? \
% - __bswap16_const((__uint16_t)(_x)) : __bswap16_var(_x))
% -
% -#define  __bswap32_const(_x) \
% - (((__uint32_t)__bswap16(_x) << 16) | __bswap16((_x) >> 16))
% -
% -#define  __bswap32(_x)   \
% - (__builtin_constant_p(_x) ? \
% - __bswap32_const((__uint32_t)(_x)) : __bswap32_var(_x))
% +#define  ___bswap16(x)   (__uint16_t)((x) << 8 | (x) >> 8)
% +#define  __bswap16(x)(___bswap16((__uint16_t)(x)))
% +#define  __bswap32_gen(x)\
% + (((__uint32_t)__bswap16(x) << 16) | __bswap16((x) >> 16))
% +#define  __bswap64_gen(x)\
% + (((__uint64_t)__bswap32(x) << 32) | __bswap32((x) >> 32))
% 
% -#define	__bswap64_const(_x)		\

% - (((__uint64_t)__bswap32(_x) << 32) | __bswap32((_x) >> 32))
% -
% -#define  __bswap64(_x)   \
% - (__builtin_constant_p(_x) ? \
% - __bswap64_const((__uint64_t)(_x)) : __bswap64_var(_x))
% +#if defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE_BUILTIN_CONSTANT_P)
% 
% -static __inline __uint16_t

% -__bswap16_var(__uint16_t _x)
% -{
% +/*
% + * The following messes are old optimizations for gcc.  The messes have
% + * been reduced significantly, but I don't know how to implement the
% + * preferred way of defining defaults above and overriding them cleanly
% + * here.  Even clang needs help for the 64-bit case, so to keep the
% + * ifdefs sane we use this for the 32-bit case with clang too.
% + */
% 
% -	return (__bswap16_const(_x));

% -}
% +#define  __bswap32(x)\
% + (__builtin_constant_p(x) ?  \
% + __bswap32_gen((__uint32_t)(x)) : __bswap32_var(x))
% 
%  static __inline __uint32_t

% @@ -105,34 +93,35 @@
%  }
% 
% +#define	__bswap64(x)			\

% + (__builtin_constant_p(x) ?  \
% + __bswap64_gen((__uint64_t)(x)) : __bswap64_var(x))
% +
%  static __inline __uint64_t
%  __bswap64_var(__uint64_t _x)
%  {
% -#ifdef   _LP64
% +
% +#ifdef _LP64
%   __asm ("bswap %0" : "+r" (_x));
%   return (_x);
%  #else
% - return (__bswap64_const(_x));
% + /*
% +  * It is important for the optimizations that the following is not
% +  * really generic, but expands to 2 __bswap32_var()'s.
% +  */
% + return (__bswap64_gen(_x));
%  #endif
%  }
% 
% -#define	__htonl(x)	__bswap32(x)

% -#define  __htons(x)  __bswap16(x)
% -#define  __ntohl(x)  __bswap32(x)
% -#define  __ntohs(x)  _

svn commit: r232288 - head/sys/vm

2012-02-28 Thread Alan Cox
Author: alc
Date: Wed Feb 29 05:41:29 2012
New Revision: 232288
URL: http://svn.freebsd.org/changeset/base/232288

Log:
  Simplify kmem_alloc() by eliminating code that existed on account of
  external pagers in Mach.  FreeBSD doesn't implement external pagers.
  Moreover, it don't pageout the kernel object.  So, the reasons for
  having code don't hold.
  
  Reviewed by:  kib
  MFC after:6 weeks

Modified:
  head/sys/vm/vm_kern.c

Modified: head/sys/vm/vm_kern.c
==
--- head/sys/vm/vm_kern.c   Wed Feb 29 02:04:41 2012(r232287)
+++ head/sys/vm/vm_kern.c   Wed Feb 29 05:41:29 2012(r232288)
@@ -161,7 +161,6 @@ kmem_alloc(map, size)
 {
vm_offset_t addr;
vm_offset_t offset;
-   vm_offset_t i;
 
size = round_page(size);
 
@@ -187,35 +186,6 @@ kmem_alloc(map, size)
vm_map_unlock(map);
 
/*
-* Guarantee that there are pages already in this object before
-* calling vm_map_wire.  This is to prevent the following
-* scenario:
-*
-* 1) Threads have swapped out, so that there is a pager for the
-* kernel_object. 2) The kmsg zone is empty, and so we are
-* kmem_allocing a new page for it. 3) vm_map_wire calls vm_fault;
-* there is no page, but there is a pager, so we call
-* pager_data_request.  But the kmsg zone is empty, so we must
-* kmem_alloc. 4) goto 1 5) Even if the kmsg zone is not empty: when
-* we get the data back from the pager, it will be (very stale)
-* non-zero data.  kmem_alloc is defined to return zero-filled memory.
-*
-* We're intentionally not activating the pages we allocate to prevent a
-* race with page-out.  vm_map_wire will wire the pages.
-*/
-   VM_OBJECT_LOCK(kernel_object);
-   for (i = 0; i < size; i += PAGE_SIZE) {
-   vm_page_t mem;
-
-   mem = vm_page_grab(kernel_object, OFF_TO_IDX(offset + i),
-   VM_ALLOC_NOBUSY | VM_ALLOC_ZERO | VM_ALLOC_RETRY);
-   mem->valid = VM_PAGE_BITS_ALL;
-   KASSERT((mem->oflags & VPO_UNMANAGED) != 0,
-   ("kmem_alloc: page %p is managed", mem));
-   }
-   VM_OBJECT_UNLOCK(kernel_object);
-
-   /*
 * And finally, mark the data as non-pageable.
 */
(void) vm_map_wire(map, addr, addr + size,
___
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: r232289 - in head/sys/mips/cavium: . octe

2012-02-28 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Wed Feb 29 05:48:29 2012
New Revision: 232289
URL: http://svn.freebsd.org/changeset/base/232289

Log:
  Revert part of old logic of assigning MAC addressess:
  
  - Reserver respective number of addresses for managment port
  - octm uses base address directly
  - other drivers get MACs on "first come first served" basis
  
  Reviewed by:  juli

Modified:
  head/sys/mips/cavium/files.octeon1
  head/sys/mips/cavium/if_octm.c
  head/sys/mips/cavium/octe/ethernet-common.c

Modified: head/sys/mips/cavium/files.octeon1
==
--- head/sys/mips/cavium/files.octeon1  Wed Feb 29 05:41:29 2012
(r232288)
+++ head/sys/mips/cavium/files.octeon1  Wed Feb 29 05:48:29 2012
(r232289)
@@ -24,7 +24,6 @@ mips/cavium/cryptocteon/cryptocteon.c o
 mips/mips/octeon_cop2_swtch.S  standard
 mips/mips/octeon_cop2.cstandard
 
-# octm must be first, so management ports get the first MAC addresses
 mips/cavium/if_octm.c  optional octm
 contrib/octeon-sdk/cvmx-mgmt-port.coptional octm
 

Modified: head/sys/mips/cavium/if_octm.c
==
--- head/sys/mips/cavium/if_octm.c  Wed Feb 29 05:41:29 2012
(r232288)
+++ head/sys/mips/cavium/if_octm.c  Wed Feb 29 05:48:29 2012
(r232289)
@@ -63,7 +63,6 @@
 #include 
 #include 
 #include 
-#include "octe/ethernet-common.h"
 
 struct octm_softc {
struct ifnet *sc_ifp;
@@ -177,10 +176,10 @@ octm_attach(device_t dev)
/*
 * Set MAC address for this management port.
 */
-   if (cvm_assign_mac_address(&mac, NULL) != 0) {
-   device_printf(dev, "unable to allocate MAC address.\n");
-   return (ENXIO);
-   }
+   mac = 0;
+   memcpy((u_int8_t *)&mac + 2, cvmx_sysinfo_get()->mac_addr_base, 6);
+   mac += sc->sc_port;
+
cvmx_mgmt_port_set_mac(sc->sc_port, mac);
 
/* No watermark for input ring.  */

Modified: head/sys/mips/cavium/octe/ethernet-common.c
==
--- head/sys/mips/cavium/octe/ethernet-common.c Wed Feb 29 05:41:29 2012
(r232288)
+++ head/sys/mips/cavium/octe/ethernet-common.c Wed Feb 29 05:48:29 2012
(r232289)
@@ -46,8 +46,8 @@ __FBSDID("$FreeBSD$");
 
 extern int octeon_is_simulation(void);
 
-static uint64_t mac_addr = 0;
-static uint32_t mac_offset = 0;
+static uint64_t cvm_oct_mac_addr = 0;
+static uint32_t cvm_oct_mac_addr_offset = 0;
 
 /**
  * Set the multicast list. Currently unimplemented.
@@ -102,22 +102,42 @@ void cvm_oct_common_set_multicast_list(s
 int cvm_assign_mac_address(uint64_t *macp, uint8_t *octets)
 {
/* Initialize from global MAC address base; fail if not set */
-   if (mac_addr == 0) {
-   memcpy((uint8_t *)&mac_addr + 2, 
cvmx_sysinfo_get()->mac_addr_base, 6);
-   if (mac_addr == 0)
+   if (cvm_oct_mac_addr == 0) {
+   memcpy((uint8_t *)&cvm_oct_mac_addr + 2,
+   cvmx_sysinfo_get()->mac_addr_base, 6);
+
+   if (cvm_oct_mac_addr == 0)
return ENXIO;
+
+   /*
+* The offset from mac_addr_base that should be used for the 
next port
+* that is configured.  By convention, if any mgmt ports exist 
on the
+* chip, they get the first mac addresses.  The ports 
controlled by
+* driver that use this function are numbered sequencially 
following 
+* any mgmt addresses that may exist.
+*
+* XXX Would be nice if __cvmx_mgmt_port_num_ports() were
+* not static to cvmx-mgmt-port.c.
+*/
+   if (OCTEON_IS_MODEL(OCTEON_CN56XX))
+   cvm_oct_mac_addr_offset = 1;
+   else if (OCTEON_IS_MODEL(OCTEON_CN52XX) || 
OCTEON_IS_MODEL(OCTEON_CN63XX))
+   cvm_oct_mac_addr_offset = 2;
+   else
+   cvm_oct_mac_addr_offset = 0;
+   cvm_oct_mac_addr += cvm_oct_mac_addr_offset;
}
 
-   if (mac_offset >= cvmx_sysinfo_get()->mac_addr_count)
+   if (cvm_oct_mac_addr_offset >= cvmx_sysinfo_get()->mac_addr_count)
return ENXIO;   /* Out of addresses to assign */

if (macp)
-   *macp = mac_addr;
+   *macp = cvm_oct_mac_addr;
if (octets)
-   memcpy(octets, (u_int8_t *)&mac_addr + 2, 6);
+   memcpy(octets, (u_int8_t *)&cvm_oct_mac_addr + 2, 6);
 
-   mac_addr++;
-   mac_offset++;
+   cvm_oct_mac_addr++;
+   cvm_oct_mac_addr_offset++;
 
return 0;
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mai

svn commit: r232291 - head/usr.sbin/jail

2012-02-28 Thread Martin Matuska
Author: mm
Date: Wed Feb 29 07:33:07 2012
New Revision: 232291
URL: http://svn.freebsd.org/changeset/base/232291

Log:
  Bump .Dd to reflect latest update
  
  Reported by:  bz
  MFC after:1 week

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

Modified: head/usr.sbin/jail/jail.8
==
--- head/usr.sbin/jail/jail.8   Wed Feb 29 06:19:00 2012(r232290)
+++ head/usr.sbin/jail/jail.8   Wed Feb 29 07:33:07 2012(r232291)
@@ -34,7 +34,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 26, 2012
+.Dd February 29, 2012
 .Dt JAIL 8
 .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"


Re: svn commit: r232266 - in head/sys: amd64/include i386/include pc98/include x86/include

2012-02-28 Thread Bruce Evans

On Wed, 29 Feb 2012, Bruce Evans wrote:


I cleaned this up a bit according to ideas in my previous mails, and
added a comment about the confusing use of __bswap64_const() (now
named __bswap64_gen()) in __bswap64_var():


A minor problem with only having a macro version for __bswap64() turned
up:


% -#define  __bswap16_const(_x) (__uint16_t)((_x) << 8 | (_x) >> 8)
% -
% -#define  __bswap16(_x)   \
% - (__builtin_constant_p(_x) ? \
% - __bswap16_const((__uint16_t)(_x)) : __bswap16_var(_x))
...
% +#define  ___bswap16(x)   (__uint16_t)((x) << 8 | (x) >> 8)
% +#define  __bswap16(x)(___bswap16((__uint16_t)(x)))


When x a non-volatile variable, gcc and clang produce the good code
"rolw $8,x" for "x = __bswap16(x);" on short x.  But when x a a volatile
variable, gcc and clang produce fairly horrible code, with 2 loads of
x corresponding to the 2 accesses to x.  This is probably required by
volatile semantics, and is a problem for all unsafe macros, especially
when their name says that they are safe (oops).  When __bswap16 is
implemented as an inline function for the var case like it used to be,
it only loads x once and there are no problems with volatile variables.
Optimizing to "rolw $8,x" might still be possible iff x is not volatile,
but load-modify-store is probably better anyway.

So any macro version must use gcc features to be safe.  The following
seems to work:

#define __bswap16(x)__extension__ ({ __uint16_t __x = x;
(__uint16_t)(__x << 8 | __x >> 8); })

clang now produces "rolw $8,x" when x is volatile.  This seems to
violate volatile semantics.  gcc produces load-rolw-store then.  Both
produce "rolw $8,x" when x is not volatile.

Bruce
___
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: r232271 - head/sys/kern

2012-02-28 Thread Dimitry Andric
On 2012-02-28 23:11, Giovanni Trematerra wrote:
> On Tue, Feb 28, 2012 at 10:45 PM, Dimitry Andric  wrote:
>> Author: dim
>> Date: Tue Feb 28 21:45:21 2012
>> New Revision: 232271
>> URL: http://svn.freebsd.org/changeset/base/232271
...
> It introduces a style(9) violation, though.
> I think it should be in this way
> 
> pipe_chmod(struct file *fp, mode_t mode, struct ucred *active_cred,
> struct thread *td)
> 
> Anyway that's not a problem I can take care of this and other style violations
> during next weeks.

Is there any interest in changing the other K&R definitions in this file
to C99?  Or does that cause too much churn?  I tried to make this change
as minimal as possible to make it compile.

Btw, style(9) doesn't say anything about a maximum line width, maybe
that should be added explicitly...:)
___
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: r232181 - in head/sys: kern sys

2012-02-28 Thread Mikolaj Golub

On Tue, 28 Feb 2012 16:00:36 -0800 Julian Elischer wrote:

 JE> On 2/27/12 11:29 PM, Mikolaj Golub wrote:
 >> On Mon, 27 Feb 2012 22:34:25 -0800 Julian Elischer wrote:
 >>
 >>   JE>  I don't think this belongs in the kernel by default. It's not exactl 
 >> a
 >>   JE>  call for backout but It's teh next thing short of that. a call for 
 >> "do
 >>   JE>  you REALLY think we need this particular specific case catered for?"
 >>
 >> The main goal of the patch was to provide ability to get another process
 >> umask. It looks like usefulness of this is not questioned here.

 JE> well that's exactly what I AM questioning..  how often will this be used?
 JE> one person using this once in all of history isn't a real requirement
 JE> for inclusion.

This information may be very useful when troubleshooting unexpected behavior
of the application.

Dmitry Banschikov, who was asking for this functionality and eventually
provided the patch, said that it needed this investigating an issue with an
application which created files with unexpected permissions. It turned out the
issue was with wrong usage of su(1), which may interpret '-c' option as a
login class or as a command to run, so the umask specified in the login class
was not applied. Then it wrote an utility to read a process umask via kvm to
troubleshoot this.

I don't think this situation is in the class "one person using this once in
all of history".

In my practice I have not face a situation when I need to know umask of
another process and it will be good if I never need this. But if I need it
eventually I would like to have a quick and easy way to do this.

Also for me after applying the patch 'procstat -sa' output on my hosts was
rather educational.
 
 JE> It seems to me that someone is more likely to figure out a sneaky way
 JE> to use this in a bad way than to want to use it in the way you expect.

Being this someone I would use much easier sneaky ways to make a mess for
processes running with my uid.

-- 
Mikolaj Golub
___
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"