svn commit: r191232 - head/usr.sbin/bluetooth/btpand

2009-04-18 Thread Maksim Yevmenkin
Author: emax
Date: Fri Apr 17 23:33:30 2009
New Revision: 191232
URL: http://svn.freebsd.org/changeset/base/191232

Log:
  Fix bug in event timeout handling
  
  Submitted by: mav
  MFC after:3 days

Modified:
  head/usr.sbin/bluetooth/btpand/event.c

Modified: head/usr.sbin/bluetooth/btpand/event.c
==
--- head/usr.sbin/bluetooth/btpand/event.c  Fri Apr 17 23:22:06 2009
(r191231)
+++ head/usr.sbin/bluetooth/btpand/event.c  Fri Apr 17 23:33:30 2009
(r191232)
@@ -110,12 +110,12 @@ __event_dispatch(void)
event_del(ev);
 
if (ev->flags & EV_HAS_TIMEOUT) {
-   t = now;
-
-   if (tv_cmp(&t, &ev->expire) <= 0)
+   if (tv_cmp(&now, &ev->expire) >= 0)
t.tv_sec = t.tv_usec = 0;
-   else
-   tv_sub(&t, &ev->expire);
+   else {
+   t = ev->expire;
+   tv_sub(&t, &now);
+   }
 
if (tv_cmp(&t, &timeout) < 0)
timeout = t;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r191233 - head/sys/dev/ed

2009-04-18 Thread Warner Losh
Author: imp
Date: Sat Apr 18 03:02:44 2009
New Revision: 191233
URL: http://svn.freebsd.org/changeset/base/191233

Log:
  Remove debug write accidentally left in.

Modified:
  head/sys/dev/ed/if_ed_pccard.c

Modified: head/sys/dev/ed/if_ed_pccard.c
==
--- head/sys/dev/ed/if_ed_pccard.c  Fri Apr 17 23:33:30 2009
(r191232)
+++ head/sys/dev/ed/if_ed_pccard.c  Sat Apr 18 03:02:44 2009
(r191233)
@@ -585,7 +585,6 @@ ed_pccard_attach(device_t dev)
sc->sc_media_ioctl = ed_pccard_media_ioctl;
ed_pccard_kick_phy(sc);
} else {
-   printf("Generic ifmedia\n");
ed_gen_ifmedia_init(sc);
}
if (sc->modem_rid != -1)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r191234 - head/sys/dev/ed

2009-04-18 Thread Warner Losh
Author: imp
Date: Sat Apr 18 03:10:28 2009
New Revision: 191234
URL: http://svn.freebsd.org/changeset/base/191234

Log:
  Establish the interrupt handler AFTER we successfully attach.  We need
  to do this in case we have a shared interrupt that fires during the
  attach process

Modified:
  head/sys/dev/ed/if_ed_cbus.c
  head/sys/dev/ed/if_ed_isa.c
  head/sys/dev/ed/if_ed_pccard.c
  head/sys/dev/ed/if_ed_pci.c

Modified: head/sys/dev/ed/if_ed_cbus.c
==
--- head/sys/dev/ed/if_ed_cbus.cSat Apr 18 03:02:44 2009
(r191233)
+++ head/sys/dev/ed/if_ed_cbus.cSat Apr 18 03:10:28 2009
(r191234)
@@ -242,15 +242,18 @@ ed_cbus_attach(dev)
 
ed_alloc_irq(dev, sc->irq_rid, 0);
 
-   error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET | INTR_MPSAFE,
-   NULL, edintr, sc, &sc->irq_handle);
+   if (sc->sc_media_ioctl == NULL)
+   ed_gen_ifmedia_init(sc);
+   error = ed_attach(dev);
if (error) {
ed_release_resources(dev);
return (error);
}
-   if (sc->sc_media_ioctl == NULL)
-   ed_gen_ifmedia_init(sc);
-   return ed_attach(dev);
+   error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET | INTR_MPSAFE,
+   NULL, edintr, sc, &sc->irq_handle);
+   if (error)
+   ed_release_resources(dev);
+   return (error);
 }
 
 /*

Modified: head/sys/dev/ed/if_ed_isa.c
==
--- head/sys/dev/ed/if_ed_isa.c Sat Apr 18 03:02:44 2009(r191233)
+++ head/sys/dev/ed/if_ed_isa.c Sat Apr 18 03:10:28 2009(r191234)
@@ -169,15 +169,18 @@ ed_isa_attach(device_t dev)
 
ed_alloc_irq(dev, sc->irq_rid, 0);
 
-   error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET | INTR_MPSAFE,
-   NULL, edintr, sc, &sc->irq_handle);
+   if (sc->sc_media_ioctl == NULL)
+   ed_gen_ifmedia_init(sc);
+   error = ed_attach(dev);
if (error) {
ed_release_resources(dev);
return (error);
}
-   if (sc->sc_media_ioctl == NULL)
-   ed_gen_ifmedia_init(sc);
-   return ed_attach(dev);
+   error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET | INTR_MPSAFE,
+   NULL, edintr, sc, &sc->irq_handle);
+   if (error)
+   ed_release_resources(dev);
+   return (error);
 }
 
 static device_method_t ed_isa_methods[] = {

Modified: head/sys/dev/ed/if_ed_pccard.c
==
--- head/sys/dev/ed/if_ed_pccard.c  Sat Apr 18 03:02:44 2009
(r191233)
+++ head/sys/dev/ed/if_ed_pccard.c  Sat Apr 18 03:10:28 2009
(r191234)
@@ -495,13 +495,6 @@ ed_pccard_attach(device_t dev)
if (error)
goto bad;
 
-   error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET | INTR_MPSAFE,
-   NULL, edintr, sc, &sc->irq_handle);
-   if (error) {
-   device_printf(dev, "setup intr failed %d \n", error);
-   goto bad;
-   } 
-
/*
 * There are several ways to get the MAC address for the card.
 * Some of the above probe routines can fill in the enaddr.  If
@@ -589,6 +582,14 @@ ed_pccard_attach(device_t dev)
}
if (sc->modem_rid != -1)
ed_pccard_add_modem(dev);
+
+   error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET | INTR_MPSAFE,
+   NULL, edintr, sc, &sc->irq_handle);
+   if (error) {
+   device_printf(dev, "setup intr failed %d \n", error);
+   goto bad;
+   } 
+
return (0);
 bad:
ed_detach(dev);

Modified: head/sys/dev/ed/if_ed_pci.c
==
--- head/sys/dev/ed/if_ed_pci.c Sat Apr 18 03:02:44 2009(r191233)
+++ head/sys/dev/ed/if_ed_pci.c Sat Apr 18 03:10:28 2009(r191234)
@@ -110,15 +110,15 @@ ed_pci_attach(device_t dev)
ed_release_resources(dev);
return (error);
}
-   error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET | INTR_MPSAFE,
-   NULL, edintr, sc, &sc->irq_handle);
+   if (sc->sc_media_ioctl == NULL)
+   ed_gen_ifmedia_init(sc);
+   error = ed_attach(dev);
if (error) {
ed_release_resources(dev);
return (error);
}
-   if (sc->sc_media_ioctl == NULL)
-   ed_gen_ifmedia_init(sc);
-   error = ed_attach(dev);
+   error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET | INTR_MPSAFE,
+   NULL, edintr, sc, &sc->irq_handle);
if (error)
ed_release_resources(dev);
return (error);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/

svn commit: r191235 - head/lib/libarchive

2009-04-18 Thread Tim Kientzle
Author: kientzle
Date: Sat Apr 18 03:47:29 2009
New Revision: 191235
URL: http://svn.freebsd.org/changeset/base/191235

Log:
  Correct and update the manpage to include
  more details about some of the formats and
  to briefly describe the mtree writing capability.

Modified:
  head/lib/libarchive/libarchive-formats.5

Modified: head/lib/libarchive/libarchive-formats.5
==
--- head/lib/libarchive/libarchive-formats.5Sat Apr 18 03:10:28 2009
(r191234)
+++ head/lib/libarchive/libarchive-formats.5Sat Apr 18 03:47:29 2009
(r191235)
@@ -24,8 +24,8 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 27, 2004
-.Dt libarchive-formats 3
+.Dd April 17, 2009
+.Dt libarchive-formats 5
 .Os
 .Sh NAME
 .Nm libarchive-formats
@@ -93,8 +93,9 @@ to define custom keys by preceding them 
 When writing pax archives, libarchive uses many of the SCHILY keys
 defined by Joerg Schilling's
 .Dq star
-archiver.
-The libarchive library can read most of the SCHILY keys.
+archiver and a few LIBARCHIVE keys.
+The libarchive library can read most of the SCHILY keys
+and most of the GNU keys introduced by GNU tar.
 It silently ignores any keywords that it does not understand.
 .It Cm restricted pax
 The libarchive library can also write pax archives in which it
@@ -156,7 +157,8 @@ and
 format archives.
 A cpio archive stores each entry as a fixed-size header followed
 by a variable-length filename and variable-length data.
-Unlike tar, cpio does only minimal padding of the header or file data.
+Unlike the tar format, the cpio format does only minimal padding
+of the header or file data.
 There are a variety of cpio formats, which differ primarily in
 how they store the initial header: some store the values as
 octal or hexadecimal numbers in ASCII, others as binary values of
@@ -169,7 +171,12 @@ This format used 32-bit binary values fo
 and 16-bit binary values for the other fields.
 .It Cm odc
 The libarchive library can both read and write this
-POSIX-standard format.
+POSIX-standard format, which is officially known as the
+.Dq cpio interchange format
+or the
+.Dq octet-oriented cpio archive format
+and sometimes unofficially referred to as the
+.Dq old character format .
 This format stores the header contents as octal values in ASCII.
 It is standard, portable, and immune from byte-order confusion.
 File sizes and mtime are limited to 33 bits (8GB file size),
@@ -237,16 +244,24 @@ shardump archives less portable than pla
 Libarchive can read and extract from files containing ISO9660-compliant
 CDROM images.
 It also has partial support for Rockridge extensions.
-In many cases, this can remove the need to burn a physical CDROM.
+In many cases, this can remove the need to burn a physical CDROM
+just in order to read the files contained in an ISO9660 image.
 It also avoids security and complexity issues that come with
 virtual mounts and loopback devices.
 .Ss Zip format
-Libarchive can extract from most zip format archives.
+Libarchive can extract from most zip format archives, including
+jar archives, archives that use Zip64 extensions and many
+self-extracting zip archives.
 It currently only supports uncompressed entries and entries
 compressed with the
 .Dq deflate
 algorithm.
 Older zip compression algorithms are not supported.
+Libarchive reads Zip archives as they are being streamed,
+which allows it to read archives of arbitrary size.
+It currently does not use the central directory; this
+limits libarchive's ability to support some self-extracting
+archives and ones that have been modified in certain ways.
 .Ss Archive (library) file format
 The Unix archive format (commonly created by the
 .Xr ar 1
@@ -260,13 +275,32 @@ the GNU format derived from SVR4,
 and the BSD format, which first appeared in 4.4BSD.
 Libarchive provides read and write support for both variants.
 .Ss mtree
-Libarchive can read files in
+Libarchive can read and write files in
 .Xr mtree 5
-format. This format is not a true archive format, but rather a description
-of a file hierarchy. When requested, libarchive obtains the contents of
-the files described by the
+format.
+This format is not a true archive format, but rather a textual description
+of a file hierarchy in which each line specifies the name of a file and
+provides specific metadata about that file.
+Libarchive can read all of the keywords supported by both
+the NetBSD and FreeBSD versions of
+.Xr mtree 1 ,
+although many of the keywords cannot currently be stored in an
+.Tn archive_entry
+object.
+When reading, libarchive supports an extension that allows it
+to obtain the contents of the files described by the
 .Xr mtree 5
-format from files on disk instead.
+description from files on disk.
+When writing, libarchive supports use of the
+.Xr archive_write_set_options 3
+interface to specify which keywords should be included in the
+output.
+This includes the ability to compute hash entries such
+as
+.Cm sha

svn commit: r191236 - head/share/man/man4

2009-04-18 Thread Warner Losh
Author: imp
Date: Sat Apr 18 04:21:04 2009
New Revision: 191236
URL: http://svn.freebsd.org/changeset/base/191236

Log:
  This turns out to be wrong...

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

Modified: head/share/man/man4/ed.4
==
--- head/share/man/man4/ed.4Sat Apr 18 03:47:29 2009(r191235)
+++ head/share/man/man4/ed.4Sat Apr 18 04:21:04 2009(r191236)
@@ -311,8 +311,6 @@ driver does not support the following Et
 .Bl -bullet -compact
 .It
 Mitsubishi LAN Adapter B8895
-.It
-D-Link DE-650
 .El
 .Sh DIAGNOSTICS
 .Bl -diag
@@ -395,13 +393,6 @@ The Mitsubishi B8895 PC Card uses a DP83
 undocumented.
 Neither the NE2000 nor the WD83x0 drivers work with this card.
 .Pp
-The D-LINK DE-650 has funky resources that differ from other cards and could
-likely be made to work.
-Its shared memory interface conflicts with other resources on many
-laptops and cannot be moved.
-The pccard(4) layer does not support activating a CFE that it fails to
-allocate all the resources for.
-.Pp
 .Sh SEE ALSO
 .Xr altq 4 ,
 .Xr arp 4 ,
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r191237 - head/sys/dev/ed

2009-04-18 Thread Warner Losh
Author: imp
Date: Sat Apr 18 04:37:53 2009
New Revision: 191237
URL: http://svn.freebsd.org/changeset/base/191237

Log:
  Add GVP NIC 2000P and New Media Livewire.  Also New Media LanSurfer
  doesn't have a function type of network, so add a quirk for that...

Modified:
  head/sys/dev/ed/if_ed_pccard.c

Modified: head/sys/dev/ed/if_ed_pccard.c
==
--- head/sys/dev/ed/if_ed_pccard.c  Sat Apr 18 04:21:04 2009
(r191236)
+++ head/sys/dev/ed/if_ed_pccard.c  Sat Apr 18 04:37:53 2009
(r191237)
@@ -176,6 +176,7 @@ static const struct ed_product {
{ PCMCIA_CARD(GREY_CELL, TDK3000), 0},
{ PCMCIA_CARD(GREY_CELL, DMF650TX),
NE2000DVF_ANYFUNC | NE2000DVF_DL100XX | NE2000DVF_MODEM},
+   { PCMCIA_CARD(GVC, NIC_2000P), 0},
{ PCMCIA_CARD(IBM, HOME_AND_AWAY), 0},
{ PCMCIA_CARD(IBM, INFOMOVER), 0},
{ PCMCIA_CARD(IODATA3, PCLAT), 0},
@@ -200,7 +201,8 @@ static const struct ed_product {
/* Same ID as DLINK DFE-670TXD.  670 has DL10022, fa411 has ax88790 */
{ PCMCIA_CARD(NETGEAR, FA411), NE2000DVF_AX88X90 | NE2000DVF_DL100XX},
{ PCMCIA_CARD(NEXTCOM, NEXTHAWK), 0},
-   { PCMCIA_CARD(NEWMEDIA, LANSURFER), 0},
+   { PCMCIA_CARD(NEWMEDIA, LANSURFER), NE2000DVF_ANYFUNC},
+   { PCMCIA_CARD(NEWMEDIA, LIVEWIRE), 0},
{ PCMCIA_CARD(OEM2, ETHERNET), 0},
{ PCMCIA_CARD(OEM2, FAST_ETHERNET), NE2000DVF_AX88X90 },
{ PCMCIA_CARD(OEM2, NE2000), 0},
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r191238 - head/sys/dev/ed

2009-04-18 Thread Warner Losh
Author: imp
Date: Sat Apr 18 04:45:02 2009
New Revision: 191238
URL: http://svn.freebsd.org/changeset/base/191238

Log:
  Make sure that the data in the ROM with a valid signature isn't all
  0's.  At least one PC Card ASIC does this...

Modified:
  head/sys/dev/ed/if_ed_pccard.c

Modified: head/sys/dev/ed/if_ed_pccard.c
==
--- head/sys/dev/ed/if_ed_pccard.c  Sat Apr 18 04:37:53 2009
(r191237)
+++ head/sys/dev/ed/if_ed_pccard.c  Sat Apr 18 04:45:02 2009
(r191238)
@@ -330,7 +330,7 @@ static int
 ed_pccard_rom_mac(device_t dev, uint8_t *enaddr)
 {
struct ed_softc *sc = device_get_softc(dev);
-   uint8_t romdata[32];
+   uint8_t romdata[32], sum;
int i;
 
/*
@@ -371,6 +371,10 @@ ed_pccard_rom_mac(device_t dev, uint8_t 
device_printf(dev, "ROM DATA: %32D\n", romdata, " ");
if (romdata[28] != 0x57 || romdata[30] != 0x57)
return (0);
+   for (i = 0, sum = 0; i < ETHER_ADDR_LEN; i++)
+   sum |= romdata[i * 2];
+   if (sum == 0)
+   return (0);
for (i = 0; i < ETHER_ADDR_LEN; i++)
enaddr[i] = romdata[i * 2];
return (1);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r191239 - head/rescue/rescue

2009-04-18 Thread Tim Kientzle
Author: kientzle
Date: Sat Apr 18 06:01:55 2009
New Revision: 191239
URL: http://svn.freebsd.org/changeset/base/191239

Log:
  Libarchive is sprouting dependencies on libmd and libcrypto.
  Because crunchgen drops any repeated library (keeping only the
  first), the -lcrypto reference must be moved to after -larchive,
  not merely duplicated.
  
  I'm considering changing crunchgen's handling of duplicate
  libraries, but that's a rather more delicate issue.

Modified:
  head/rescue/rescue/Makefile

Modified: head/rescue/rescue/Makefile
==
--- head/rescue/rescue/Makefile Sat Apr 18 04:45:02 2009(r191238)
+++ head/rescue/rescue/Makefile Sat Apr 18 06:01:55 2009(r191239)
@@ -73,9 +73,6 @@ CRUNCH_PROGS_bin= cat chflags chio chmod
 ed expr getfacl hostname kenv kill ln ls mkdir mv  \
 pkill ps pwd realpath rm rmdir setfacl sh stty sync test
 CRUNCH_LIBS+= -lcrypt -ledit -lkvm -ll -lm -ltermcap -lutil
-.if ${MK_OPENSSL} != "no"
-CRUNCH_LIBS+= -lcrypto
-.endif
 
 # Additional options for specific programs
 CRUNCH_ALIAS_test= [
@@ -201,7 +198,10 @@ CRUNCH_ALIAS_bzip2= bunzip2 bzcat
 CRUNCH_LIBS+= -lbz2
 
 CRUNCH_PROGS_usr.bin+= tar
-CRUNCH_LIBS+= -larchive
+CRUNCH_LIBS+= -larchive -lmd
+.if ${MK_OPENSSL} != "no"
+CRUNCH_LIBS+= -lcrypto
+.endif
 
 CRUNCH_PROGS_usr.bin+= vi
 CRUNCH_ALIAS_vi= ex
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r191240 - in head/usr.bin: cpio tar

2009-04-18 Thread Tim Kientzle
Author: kientzle
Date: Sat Apr 18 06:03:09 2009
New Revision: 191240
URL: http://svn.freebsd.org/changeset/base/191240

Log:
  Make -lcrypto usage dependent on whether or not we're building with OpenSSL.

Modified:
  head/usr.bin/cpio/Makefile
  head/usr.bin/tar/Makefile

Modified: head/usr.bin/cpio/Makefile
==
--- head/usr.bin/cpio/Makefile  Sat Apr 18 06:01:55 2009(r191239)
+++ head/usr.bin/cpio/Makefile  Sat Apr 18 06:03:09 2009(r191240)
@@ -9,7 +9,10 @@ WARNS?=6
 DPADD= ${LIBARCHIVE} ${LIBZ} ${LIBBZ2}
 CFLAGS+= -DBSDCPIO_VERSION_STRING=\"${BSDCPIO_VERSION_STRING}\"
 CFLAGS+= -DPLATFORM_CONFIG_H=\"config_freebsd.h\"
-LDADD+=-larchive -lz -lbz2 -lmd -lcrypto
+LDADD+=-larchive -lz -lbz2 -lmd
+.if ${MK_OPENSSL} != "no"
+LDADD+= -lcrypto
+.endif
 
 .if ${MK_GNU_CPIO} != "yes"
 SYMLINKS=bsdcpio ${BINDIR}/cpio

Modified: head/usr.bin/tar/Makefile
==
--- head/usr.bin/tar/Makefile   Sat Apr 18 06:01:55 2009(r191239)
+++ head/usr.bin/tar/Makefile   Sat Apr 18 06:03:09 2009(r191240)
@@ -1,11 +1,15 @@
 # $FreeBSD$
+.include 
 
 PROG=  bsdtar
 BSDTAR_VERSION_STRING=2.7.0
 SRCS=  bsdtar.c cmdline.c getdate.c matching.c read.c siginfo.c subst.c tree.c 
util.c write.c
 WARNS?=5
 DPADD= ${LIBARCHIVE} ${LIBBZ2} ${LIBZ}
-LDADD= -larchive -lbz2 -lz -lmd -lcrypto
+LDADD= -larchive -lbz2 -lz -lmd
+.if ${MK_OPENSSL} != "no"
+LDADD+= -lcrypto
+.endif
 CFLAGS+=   -DBSDTAR_VERSION_STRING=\"${BSDTAR_VERSION_STRING}\"
 CFLAGS+=   -DPLATFORM_CONFIG_H=\"config_freebsd.h\"
 CFLAGS+=   -I${.CURDIR}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r191241 - head/lib/libarchive

2009-04-18 Thread Tim Kientzle
Author: kientzle
Date: Sat Apr 18 06:06:47 2009
New Revision: 191241
URL: http://svn.freebsd.org/changeset/base/191241

Log:
  Rely on OpenSSL bits only if we're building a system with OpenSSL.
  Also, adjust the MD5 calls to rely on libmd instead of libcrypto,
  so we keep MD5 support even in the !OpenSSL case.

Modified:
  head/lib/libarchive/Makefile
  head/lib/libarchive/archive_write_set_format_mtree.c
  head/lib/libarchive/config_freebsd.h

Modified: head/lib/libarchive/Makefile
==
--- head/lib/libarchive/MakefileSat Apr 18 06:03:09 2009
(r191240)
+++ head/lib/libarchive/MakefileSat Apr 18 06:06:47 2009
(r191241)
@@ -1,4 +1,5 @@
 # $FreeBSD$
+.include 
 
 LIB=   archive
 DPADD= ${LIBBZ2} ${LIBZ}
@@ -11,6 +12,11 @@ SHLIB_MAJOR= 4
 CFLAGS+=   -DPLATFORM_CONFIG_H=\"config_freebsd.h\"
 CFLAGS+=   -I${.OBJDIR}
 
+.if ${MK_OPENSSL} != "no"
+CFLAGS+=   -DWITH_OPENSSL
+.endif
+
+
 WARNS?=6
 
 # Headers to be installed in /usr/include

Modified: head/lib/libarchive/archive_write_set_format_mtree.c
==
--- head/lib/libarchive/archive_write_set_format_mtree.cSat Apr 18 
06:03:09 2009(r191240)
+++ head/lib/libarchive/archive_write_set_format_mtree.cSat Apr 18 
06:06:47 2009(r191241)
@@ -33,13 +33,13 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#ifdef HAVE_OPENSSL_MD5_H
-#include 
-#else /* HAVE_OPENSSL_MD5_H */
 #ifdef HAVE_MD5_H
 #include 
-#endif
+#else
+#ifdef HAVE_OPENSSL_MD5_H
+#include 
 #endif /* HAVE_OPENSSL_MD5_H */
+#endif /* HAVE_MD5_H */
 #ifdef HAVE_OPENSSL_RIPEMD_H
 #include 
 #else /* HAVE_OPENSSL_RIPEMD_H */
@@ -618,7 +618,7 @@ archive_write_mtree_header(struct archiv
if ((mtree->keys & F_MD5) != 0 &&
archive_entry_filetype(entry) == AE_IFREG) {
mtree->compute_sum |= F_MD5;
-   MD5_Init(&mtree->md5ctx);
+   MD5Init(&mtree->md5ctx);
} else
mtree->compute_sum &= ~F_MD5;
 #endif
@@ -803,7 +803,7 @@ archive_write_mtree_finish_entry(struct 
if (mtree->compute_sum & F_MD5) {
unsigned char buf[16];
 
-   MD5_Final(buf, &mtree->md5ctx);
+   MD5Final(buf, &mtree->md5ctx);
archive_strcat(str, " md5digest=");
strappend_bin(str, buf, sizeof(buf));
}
@@ -901,7 +901,7 @@ archive_write_mtree_data(struct archive_
}
 #ifdef HAVE_MD5
if (mtree->compute_sum & F_MD5)
-   MD5_Update(&mtree->md5ctx, buff, n);
+   MD5Update(&mtree->md5ctx, buff, n);
 #endif
 #ifdef HAVE_RMD160
if (mtree->compute_sum & F_RMD160)

Modified: head/lib/libarchive/config_freebsd.h
==
--- head/lib/libarchive/config_freebsd.hSat Apr 18 06:03:09 2009
(r191240)
+++ head/lib/libarchive/config_freebsd.hSat Apr 18 06:06:47 2009
(r191241)
@@ -42,6 +42,14 @@
 #defineHAVE_SYS_EXTATTR_H 1
 #endif
 
+#ifdef WITH_OPENSSL
+#defineHAVE_OPENSSL_MD5_H 1
+#defineHAVE_OPENSSL_RIPEMD_H 1
+#defineHAVE_OPENSSL_SHA_H 1
+#defineHAVE_SHA384 1
+#defineHAVE_SHA512 1
+#endif
+
 #defineHAVE_BZLIB_H 1
 #defineHAVE_CHFLAGS 1
 #defineHAVE_CHOWN 1
@@ -75,38 +83,26 @@
 #defineHAVE_LIMITS_H 1
 #defineHAVE_LUTIMES 1
 #defineHAVE_MALLOC 1
-#if 0
 #defineHAVE_MD5 1
 #defineHAVE_MD5_H 1
-#endif
 #defineHAVE_MEMMOVE 1
 #defineHAVE_MEMSET 1
 #defineHAVE_MKDIR 1
 #defineHAVE_MKFIFO 1
 #defineHAVE_MKNOD 1
-#if 0
-#defineHAVE_OPENSSL_MD5_H 1
-#defineHAVE_OPENSSL_RIPEMD_H 1
-#defineHAVE_OPENSSL_SHA_H 1
-#endif
 #defineHAVE_PIPE 1
 #defineHAVE_POLL 1
 #defineHAVE_POLL_H 1
 #defineHAVE_PWD_H 1
 #defineHAVE_READLINK 1
-#if 0
+#defineHAVE_RIPEMD_H
 #defineHAVE_RMD160 1
-#endif
 #defineHAVE_SELECT 1
 #defineHAVE_SETENV 1
-#if 0
 #defineHAVE_SHA_H 1
 #defineHAVE_SHA1 1
 #defineHAVE_SHA256 1
 #defineHAVE_SHA256_H 1
-#defineHAVE_SHA384 1
-#defineHAVE_SHA512 1
-#endif
 #defineHAVE_SIGNAL_H 1
 #defineHAVE_STDINT_H 1
 #defineHAVE_STDLIB_H 1
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r191242 - in head/sys/dev: mlx mly

2009-04-18 Thread Ed Schouten
Author: ed
Date: Sat Apr 18 07:36:38 2009
New Revision: 191242
URL: http://svn.freebsd.org/changeset/base/191242

Log:
  Convert mlx(4) and mly(4) to si_drv1 instead of dev2unit().

Modified:
  head/sys/dev/mlx/mlx.c
  head/sys/dev/mly/mly.c

Modified: head/sys/dev/mlx/mlx.c
==
--- head/sys/dev/mlx/mlx.c  Sat Apr 18 06:06:47 2009(r191241)
+++ head/sys/dev/mlx/mlx.c  Sat Apr 18 07:36:38 2009(r191242)
@@ -474,8 +474,9 @@ mlx_attach(struct mlx_softc *sc)
 /*
  * Create the control device.
  */
-sc->mlx_dev_t = make_dev(&mlx_cdevsw, device_get_unit(sc->mlx_dev), 
UID_ROOT, GID_OPERATOR, 
+sc->mlx_dev_t = make_dev(&mlx_cdevsw, 0, UID_ROOT, GID_OPERATOR, 
 S_IRUSR | S_IWUSR, "mlx%d", 
device_get_unit(sc->mlx_dev));
+sc->mlx_dev_t->si_drv1 = sc;
 
 /*
  * Start the timeout routine.
@@ -711,8 +712,7 @@ mlx_submit_buf(struct mlx_softc *sc, mlx
 int
 mlx_open(struct cdev *dev, int flags, int fmt, struct thread *td)
 {
-intunit = dev2unit(dev);
-struct mlx_softc   *sc = devclass_get_softc(mlx_devclass, unit);
+struct mlx_softc   *sc = dev->si_drv1;
 
 sc->mlx_state |= MLX_STATE_OPEN;
 return(0);
@@ -724,8 +724,7 @@ mlx_open(struct cdev *dev, int flags, in
 int
 mlx_close(struct cdev *dev, int flags, int fmt, struct thread *td)
 {
-intunit = dev2unit(dev);
-struct mlx_softc   *sc = devclass_get_softc(mlx_devclass, unit);
+struct mlx_softc   *sc = dev->si_drv1;
 
 sc->mlx_state &= ~MLX_STATE_OPEN;
 return (0);
@@ -737,8 +736,7 @@ mlx_close(struct cdev *dev, int flags, i
 int
 mlx_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int32_t flag, struct 
thread *td)
 {
-intunit = dev2unit(dev);
-struct mlx_softc   *sc = devclass_get_softc(mlx_devclass, unit);
+struct mlx_softc   *sc = dev->si_drv1;
 struct mlx_rebuild_request *rb = (struct mlx_rebuild_request *)addr;
 struct mlx_rebuild_status  *rs = (struct mlx_rebuild_status *)addr;
 int*arg = (int *)addr;

Modified: head/sys/dev/mly/mly.c
==
--- head/sys/dev/mly/mly.c  Sat Apr 18 06:06:47 2009(r191241)
+++ head/sys/dev/mly/mly.c  Sat Apr 18 07:36:38 2009(r191242)
@@ -310,7 +310,7 @@ mly_attach(device_t dev)
 /*
  * Create the control device.
  */
-sc->mly_dev_t = make_dev(&mly_cdevsw, device_get_unit(sc->mly_dev), 
UID_ROOT, GID_OPERATOR,
+sc->mly_dev_t = make_dev(&mly_cdevsw, 0, UID_ROOT, GID_OPERATOR,
 S_IRUSR | S_IWUSR, "mly%d", 
device_get_unit(sc->mly_dev));
 sc->mly_dev_t->si_drv1 = sc;
 
@@ -2834,8 +2834,7 @@ mly_print_controller(int controller)
 static int
 mly_user_open(struct cdev *dev, int flags, int fmt, struct thread *td)
 {
-intunit = dev2unit(dev);
-struct mly_softc   *sc = devclass_get_softc(devclass_find("mly"), unit);
+struct mly_softc   *sc = dev->si_drv1;
 
 sc->mly_state |= MLY_STATE_OPEN;
 return(0);
@@ -2847,8 +2846,7 @@ mly_user_open(struct cdev *dev, int flag
 static int
 mly_user_close(struct cdev *dev, int flags, int fmt, struct thread *td)
 {
-intunit = dev2unit(dev);
-struct mly_softc   *sc = devclass_get_softc(devclass_find("mly"), unit);
+struct mly_softc   *sc = dev->si_drv1;
 
 sc->mly_state &= ~MLY_STATE_OPEN;
 return (0);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r191243 - head/sys/cam/scsi

2009-04-18 Thread Ed Schouten
Author: ed
Date: Sat Apr 18 07:39:11 2009
New Revision: 191243
URL: http://svn.freebsd.org/changeset/base/191243

Log:
  Remove unused SESUNIT() macro from ses(4).

Modified:
  head/sys/cam/scsi/scsi_ses.c

Modified: head/sys/cam/scsi/scsi_ses.c
==
--- head/sys/cam/scsi/scsi_ses.cSat Apr 18 07:36:38 2009
(r191242)
+++ head/sys/cam/scsi/scsi_ses.cSat Apr 18 07:39:11 2009
(r191243)
@@ -155,8 +155,6 @@ struct ses_softc {
 #defineSES_FLAG_OPEN   0x02
 #defineSES_FLAG_INITIALIZED0x04
 
-#define SESUNIT(x)   (dev2unit((x)))
-
 static d_open_tsesopen;
 static d_close_t   sesclose;
 static d_ioctl_t   sesioctl;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r191217 - head/sys/net

2009-04-18 Thread Niclas Zeising

John Baldwin wrote:

Author: jhb
Date: Fri Apr 17 17:40:47 2009
New Revision: 191217
URL: http://svn.freebsd.org/changeset/base/191217

Log:
  The vlan code has not required the miibus code since 6.0 when
  if_link_state_change() was added and the vlan link-state hook was moved
  out of miibus and into net/if.c.
  
  MFC after:	1 month


Modified:
  head/sys/net/if_vlan.c

Modified: head/sys/net/if_vlan.c
==
--- head/sys/net/if_vlan.c  Fri Apr 17 17:24:07 2009(r191216)
+++ head/sys/net/if_vlan.c  Fri Apr 17 17:40:47 2009(r191217)
@@ -574,7 +574,6 @@ static moduledata_t vlan_mod = {
 
 DECLARE_MODULE(if_vlan, vlan_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);

 MODULE_VERSION(if_vlan, 3);
-MODULE_DEPEND(if_vlan, miibus, 1, 1, 1);
 
 static struct ifnet *

 vlan_clone_match_ethertag(struct if_clone *ifc, const char *name, int *tag)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"



This should be changed in NOTES as well.
Regards!
//Niclas
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r191244 - stable/7/share/zoneinfo

2009-04-18 Thread Edwin Groothuis
Author: edwin
Date: Sat Apr 18 11:50:11 2009
New Revision: 191244
URL: http://svn.freebsd.org/changeset/base/191244

Log:
  MFC of tzdata2009f
  
  Correct DST information for Pakistan for 2009.
  
  Approved by:  re (kip)

Modified:
  stable/7/share/zoneinfo/   (props changed)
  stable/7/share/zoneinfo/asia

Modified: stable/7/share/zoneinfo/asia
==
--- stable/7/share/zoneinfo/asiaSat Apr 18 07:39:11 2009
(r191243)
+++ stable/7/share/zoneinfo/asiaSat Apr 18 11:50:11 2009
(r191244)
@@ -1,4 +1,4 @@
-# @(#)asia 8.29
+# @(#)asia 8.30
 # 
 
 # This data is by no means authoritative; if you think you know better,
@@ -1589,11 +1589,46 @@ ZoneAsia/Muscat 3:54:20 -   LMT 1920
 # http://dailymailnews.com/200808/28/news/dmbrn03.html
 # 
 
+# From Alexander Krivenyshev (2009-04-08):
+# Based on previous media reports that "... proposed plan to
+# advance clocks by one hour from May 1 will cause disturbance
+# to the working schedules rather than bringing discipline in
+# official working."
+# http://www.thenews.com.pk/daily_detail.asp?id=171280";>
+# http://www.thenews.com.pk/daily_detail.asp?id=171280
+# 
+#
+# recent news that instead of May 2009 - Pakistan plan to
+# introduce DST from April 15, 2009
+#
+# FYI: Associated Press Of Pakistan
+# April 08, 2009
+# Cabinet okays proposal to advance clocks by one hour from April 15
+# http://www.app.com.pk/en_/index.php?option=com_content&task=view&id=73043&Itemid=1";>
+# 
http://www.app.com.pk/en_/index.php?option=com_content&task=view&id=73043&Itemid=1
+# 
+#
+# or
+#
+# http://www.worldtimezone.com/dst_news/dst_news_pakistan05.html";>
+# http://www.worldtimezone.com/dst_news/dst_news_pakistan05.html
+# 
+#
+# 
+# The Federal Cabinet on Wednesday approved the proposal to
+# advance clocks in the country by one hour from April 15 to
+# conserve energy"
+
+# From Arthur David Olson (2009-04-10):
+# Assume for now that Pakistan will end DST in 2009 as it did in 2008.
+
 # Rule NAMEFROMTO  TYPEIN  ON  AT  SAVELETTER/S
 Rule Pakistan  2002only-   Apr Sun>=2  0:011:00S
 Rule Pakistan  2002only-   Oct Sun>=2  0:010   -
 Rule Pakistan  2008only-   Jun 1   0:001:00S
 Rule Pakistan  2008only-   Nov 1   0:000   -
+Rule Pakistan  2009only-   Apr 15  0:001:00S
+Rule Pakistan  2009only-   Nov 1   0:000   -
 # Zone NAMEGMTOFF  RULES   FORMAT  [UNTIL]
 Zone   Asia/Karachi4:28:12 -   LMT 1907
5:30-   IST 1942 Sep
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r191245 - releng/7.2/share/zoneinfo

2009-04-18 Thread Edwin Groothuis
Author: edwin
Date: Sat Apr 18 12:16:33 2009
New Revision: 191245
URL: http://svn.freebsd.org/changeset/base/191245

Log:
  MFC of tzdata2009f
  
  Correct DST information for Pakistan for 2009.
  
  Approved by:  re (kip)

Modified:
  releng/7.2/share/zoneinfo/   (props changed)
  releng/7.2/share/zoneinfo/asia

Modified: releng/7.2/share/zoneinfo/asia
==
--- releng/7.2/share/zoneinfo/asia  Sat Apr 18 11:50:11 2009
(r191244)
+++ releng/7.2/share/zoneinfo/asia  Sat Apr 18 12:16:33 2009
(r191245)
@@ -1,4 +1,4 @@
-# @(#)asia 8.29
+# @(#)asia 8.30
 # 
 
 # This data is by no means authoritative; if you think you know better,
@@ -1589,11 +1589,46 @@ ZoneAsia/Muscat 3:54:20 -   LMT 1920
 # http://dailymailnews.com/200808/28/news/dmbrn03.html
 # 
 
+# From Alexander Krivenyshev (2009-04-08):
+# Based on previous media reports that "... proposed plan to
+# advance clocks by one hour from May 1 will cause disturbance
+# to the working schedules rather than bringing discipline in
+# official working."
+# http://www.thenews.com.pk/daily_detail.asp?id=171280";>
+# http://www.thenews.com.pk/daily_detail.asp?id=171280
+# 
+#
+# recent news that instead of May 2009 - Pakistan plan to
+# introduce DST from April 15, 2009
+#
+# FYI: Associated Press Of Pakistan
+# April 08, 2009
+# Cabinet okays proposal to advance clocks by one hour from April 15
+# http://www.app.com.pk/en_/index.php?option=com_content&task=view&id=73043&Itemid=1";>
+# 
http://www.app.com.pk/en_/index.php?option=com_content&task=view&id=73043&Itemid=1
+# 
+#
+# or
+#
+# http://www.worldtimezone.com/dst_news/dst_news_pakistan05.html";>
+# http://www.worldtimezone.com/dst_news/dst_news_pakistan05.html
+# 
+#
+# 
+# The Federal Cabinet on Wednesday approved the proposal to
+# advance clocks in the country by one hour from April 15 to
+# conserve energy"
+
+# From Arthur David Olson (2009-04-10):
+# Assume for now that Pakistan will end DST in 2009 as it did in 2008.
+
 # Rule NAMEFROMTO  TYPEIN  ON  AT  SAVELETTER/S
 Rule Pakistan  2002only-   Apr Sun>=2  0:011:00S
 Rule Pakistan  2002only-   Oct Sun>=2  0:010   -
 Rule Pakistan  2008only-   Jun 1   0:001:00S
 Rule Pakistan  2008only-   Nov 1   0:000   -
+Rule Pakistan  2009only-   Apr 15  0:001:00S
+Rule Pakistan  2009only-   Nov 1   0:000   -
 # Zone NAMEGMTOFF  RULES   FORMAT  [UNTIL]
 Zone   Asia/Karachi4:28:12 -   LMT 1907
5:30-   IST 1942 Sep
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r191235 - head/lib/libarchive

2009-04-18 Thread Anonymous
Tim Kientzle  writes:

> Author: kientzle
> Date: Sat Apr 18 03:47:29 2009
> New Revision: 191235
> URL: http://svn.freebsd.org/changeset/base/191235
>
> Log:
>   Correct and update the manpage to include
>   more details about some of the formats and
>   to briefly describe the mtree writing capability.
>
> Modified:
>   head/lib/libarchive/libarchive-formats.5
>
> Modified: head/lib/libarchive/libarchive-formats.5
> ==
> --- head/lib/libarchive/libarchive-formats.5  Sat Apr 18 03:10:28 2009
> (r191234)
> +++ head/lib/libarchive/libarchive-formats.5  Sat Apr 18 03:47:29 2009
> (r191235)
[...]
> +Libarchive can read all of the keywords supported by both
> +the NetBSD and FreeBSD versions of
> +.Xr mtree 1 ,

Wrong section again, it's mtree(8), not mtree(1) for both FreeBSD and NetBSD.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r191246 - head/tools/tools/nanobsd/gateworks

2009-04-18 Thread Sam Leffler
Author: sam
Date: Sat Apr 18 15:59:09 2009
New Revision: 191246
URL: http://svn.freebsd.org/changeset/base/191246

Log:
  allow NANO_CFGDIR to be overridden

Modified:
  head/tools/tools/nanobsd/gateworks/common

Modified: head/tools/tools/nanobsd/gateworks/common
==
--- head/tools/tools/nanobsd/gateworks/common   Sat Apr 18 12:16:33 2009
(r191245)
+++ head/tools/tools/nanobsd/gateworks/common   Sat Apr 18 15:59:09 2009
(r191246)
@@ -1,6 +1,6 @@
 # $FreeBSD$
 
-NANO_CFGDIR=${NANO_SRC}/${NANO_TOOLS}/gateworks/cfg
+NANO_CFGDIR=${NANO_CFGDIR:-${NANO_SRC}/${NANO_TOOLS}/gateworks/cfg}
 test -d ${NANO_CFGDIR} || NANO_CFGDIR=/var/empty
 NANO_PMAKE="make"  # NB: disable -j 3
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r191247 - head/tools/tools/net80211/wlanwds

2009-04-18 Thread Sam Leffler
Author: sam
Date: Sat Apr 18 16:14:03 2009
New Revision: 191247
URL: http://svn.freebsd.org/changeset/base/191247

Log:
  Cleanups to prepare this code for wider use (likely merged into hostapd):
  o add (required) cmd line args to specify the set of ifnet's to monitor
for WDS discovery msgs; "any" is a wildcard
  o change the default script run on wds vap create to the "null script"
  o auto-daemonize; add -f option to force foreground operation
  o add -P option for integration with rc.d (implementation missing, tba)
  o use syslog; default to log up to LOG_INFO, -t (terse) gives you up to
LOG_ERR, and -v (verbose) gives you up to LOG_DEBUG
  o scan for existing vaps on startup to recover existing state
  o correct some types

Modified:
  head/tools/tools/net80211/wlanwds/wlanwds.c

Modified: head/tools/tools/net80211/wlanwds/wlanwds.c
==
--- head/tools/tools/net80211/wlanwds/wlanwds.c Sat Apr 18 15:59:09 2009
(r191246)
+++ head/tools/tools/net80211/wlanwds/wlanwds.c Sat Apr 18 16:14:03 2009
(r191247)
@@ -36,12 +36,6 @@
  *   and launch a script to handle adding the vap to the
  *   bridge, etc.
  * o destroy wds vap's when station leaves
- *
- * Note we query only internal state which means if we don't see
- * a vap created we won't handle leave/delete properly.  Also there
- * are several fixed pathnames/strings.
- *
- * Code liberaly swiped from wlanwatch; probably should nuke printfs.
  */
 #include 
 #include 
@@ -66,10 +60,12 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -83,11 +79,14 @@ struct wds {
 };
 static struct wds *wds;
 
-static const char *script = "/usr/local/bin/wdsup";
+static const char *script = NULL;
+static char **ifnets;
+static int nifnets = 0;
 static int verbose = 0;
 static int discover_on_join = 0;
 
-static void handle_rtmsg(struct rt_msghdr *rtm, int msglen);
+static void scanforvaps(int s);
+static void handle_rtmsg(struct rt_msghdr *rtm, ssize_t msglen);
 static void wds_discovery(const char *ifname,
const uint8_t bssid[IEEE80211_ADDR_LEN]);
 static void wds_destroy(const char *ifname);
@@ -95,42 +94,80 @@ static  void wds_leave(const uint8_t bssi
 static int wds_vap_create(const char *ifname, struct wds *);
 static int wds_vap_destroy(const char *ifname);
 
+static void
+usage(const char *progname)
+{
+   fprintf(stderr, "usage: %s [-fjtv] [-P pidfile] [-s ] 
[ifnet0 ... | any]\n",
+   progname);
+   exit(-1);
+}
+
 int
 main(int argc, char *argv[])
 {
-   int n, s, c;
+   const char *progname = argv[0];
+   const char *pidfile = NULL;
+   int s, c, logmask, bg = 1;
char msg[2048];
 
-   while ((c = getopt(argc, argv, "js:vn")) != -1)
+   logmask = LOG_UPTO(LOG_INFO);
+   while ((c = getopt(argc, argv, "fjP:s:tv")) != -1)
switch (c) {
+   case 'f':
+   bg = 0;
+   break;
case 'j':
discover_on_join = 1;
break;
+   case 'P':
+   pidfile = optarg;
+   break;
case 's':
script = optarg;
break;
+   case 't':
+   logmask = LOG_UPTO(LOG_ERR);
+   break;
case 'v':
-   verbose = 1;
+   logmask = LOG_UPTO(LOG_DEBUG);
break;
case '?':
-   errx(1, "usage: %s [-s ]\n"
-   " [-v (for verbose)]\n"
-   " [-j (act on join/rejoin events)]\n", argv[0]);
+   usage(progname);
/*NOTREACHED*/
}
+   argc -= optind, argv += optind;
+   if (argc == 0) {
+   fprintf(stderr, "%s: no ifnet's specified to monitor\n",
+   progname);
+   usage(progname);
+   }
+   ifnets = argv;
+   nifnets = argc;
 
s = socket(PF_ROUTE, SOCK_RAW, 0);
if (s < 0)
err(EX_OSERR, "socket");
-   for(;;) {
-   n = read(s, msg, 2048);
+   /*
+* Scan for inherited state.
+*/
+   scanforvaps(s);
+
+   /* XXX what directory to work in? */
+   if (bg && daemon(0, 0) < 0)
+   err(EX_OSERR, "daemon");
+
+   openlog("wlanwds", LOG_PID | LOG_CONS, LOG_DAEMON);
+   setlogmask(logmask);
+
+   for (;;) {
+   ssize_t n = read(s, msg, sizeof(msg));
handle_rtmsg((struct rt_msghdr *)msg, n);
}
return 0;
 }
 
 static const char *
-ether_sprintf(const uint8_t mac[6])
+ether_sprintf(const uint8_t mac[IEEE80211_ADDR_LEN])
 {
static char buf[32];
 
@@ -139,7

svn commit: r191248 - head/sys/geom/vinum

2009-04-18 Thread Ulf Lilleengen
Author: lulf
Date: Sat Apr 18 16:36:27 2009
New Revision: 191248
URL: http://svn.freebsd.org/changeset/base/191248

Log:
  - Remove assertion of topology lock remaining from 7.x gvinum. It is not 
needed,
as the renaming only changes internal gvinum names and will not alter the 
geom
topology.
  - The topology lock was not held when calling g_wither_geom after renaming.

Modified:
  head/sys/geom/vinum/geom_vinum.c
  head/sys/geom/vinum/geom_vinum_rename.c

Modified: head/sys/geom/vinum/geom_vinum.c
==
--- head/sys/geom/vinum/geom_vinum.cSat Apr 18 16:14:03 2009
(r191247)
+++ head/sys/geom/vinum/geom_vinum.cSat Apr 18 16:36:27 2009
(r191248)
@@ -897,7 +897,9 @@ gv_worker(void *arg)
v->name);
break;
}
+   g_topology_lock();
g_wither_provider(v->provider, ENOENT);
+   g_topology_unlock();
v->provider = NULL;
gv_post_event(sc, GV_EVENT_SETUP_OBJECTS, sc,
NULL, 0, 0);

Modified: head/sys/geom/vinum/geom_vinum_rename.c
==
--- head/sys/geom/vinum/geom_vinum_rename.c Sat Apr 18 16:14:03 2009
(r191247)
+++ head/sys/geom/vinum/geom_vinum_rename.c Sat Apr 18 16:36:27 2009
(r191248)
@@ -125,7 +125,6 @@ gv_rename_drive(struct gv_softc *sc, str
 {
struct gv_sd *s;
 
-   g_topology_assert();
KASSERT(d != NULL, ("gv_rename_drive: NULL d"));
 
if (gv_object_type(sc, newname) != GV_ERR_NOTFOUND) {
@@ -151,7 +150,6 @@ gv_rename_plex(struct gv_softc *sc, stru
char *ptr;
int err;
 
-   g_topology_assert();
KASSERT(p != NULL, ("gv_rename_plex: NULL p"));
 
if (gv_object_type(sc, newname) != GV_ERR_NOTFOUND) {
@@ -203,7 +201,6 @@ gv_rename_sd(struct gv_softc *sc, struct
 {
char *dot1, *dot2;
 
-   g_topology_assert();
KASSERT(s != NULL, ("gv_rename_sd: NULL s"));
 
if (gv_object_type(sc, newname) != GV_ERR_NOTFOUND) {
@@ -231,7 +228,6 @@ gv_rename_vol(struct gv_softc *sc, struc
char newplex[GV_MAXPLEXNAME], *ptr;
int err;
 
-   g_topology_assert();
KASSERT(v != NULL, ("gv_rename_vol: NULL v"));
pp = v->provider;
KASSERT(pp != NULL, ("gv_rename_vol: NULL pp"));
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r191249 - in head/sys: kern sys ufs/ufs

2009-04-18 Thread Edward Tomasz Napierala
Author: trasz
Date: Sat Apr 18 16:47:33 2009
New Revision: 191249
URL: http://svn.freebsd.org/changeset/base/191249

Log:
  Use acl_alloc() and acl_free() instead of using uma(9) directly.
  This will make switching to malloc(9) easier; also, it would be
  neccessary to add these routines if/when we implement variable-size
  ACLs.

Modified:
  head/sys/kern/vfs_acl.c
  head/sys/sys/acl.h
  head/sys/ufs/ufs/ufs_vnops.c

Modified: head/sys/kern/vfs_acl.c
==
--- head/sys/kern/vfs_acl.c Sat Apr 18 16:36:27 2009(r191248)
+++ head/sys/kern/vfs_acl.c Sat Apr 18 16:47:33 2009(r191249)
@@ -81,28 +81,31 @@ static int
 vacl_set_acl(struct thread *td, struct vnode *vp, acl_type_t type,
 struct acl *aclp)
 {
-   struct acl inkernacl;
+   struct acl *inkernelacl;
struct mount *mp;
int error;
 
-   error = copyin(aclp, &inkernacl, sizeof(struct acl));
+   inkernelacl = acl_alloc(M_WAITOK);
+   error = copyin(aclp, inkernelacl, sizeof(struct acl));
if (error)
-   return(error);
+   goto out;
error = vn_start_write(vp, &mp, V_WAIT | PCATCH);
if (error != 0)
-   return (error);
+   goto out;
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 #ifdef MAC
-   error = mac_vnode_check_setacl(td->td_ucred, vp, type, &inkernacl);
+   error = mac_vnode_check_setacl(td->td_ucred, vp, type, inkernelacl);
if (error != 0)
-   goto out;
+   goto out_unlock;
 #endif
-   error = VOP_SETACL(vp, type, &inkernacl, td->td_ucred, td);
+   error = VOP_SETACL(vp, type, inkernelacl, td->td_ucred, td);
 #ifdef MAC
-out:
+out_unlock:
 #endif
VOP_UNLOCK(vp, 0);
vn_finished_write(mp);
+out:
+   acl_free(inkernelacl);
return(error);
 }
 
@@ -113,22 +116,24 @@ static int
 vacl_get_acl(struct thread *td, struct vnode *vp, acl_type_t type,
 struct acl *aclp)
 {
-   struct acl inkernelacl;
+   struct acl *inkernelacl;
int error;
 
+   inkernelacl = acl_alloc(M_WAITOK);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 #ifdef MAC
error = mac_vnode_check_getacl(td->td_ucred, vp, type);
if (error != 0)
goto out;
 #endif
-   error = VOP_GETACL(vp, type, &inkernelacl, td->td_ucred, td);
+   error = VOP_GETACL(vp, type, inkernelacl, td->td_ucred, td);
 #ifdef MAC
 out:
 #endif
VOP_UNLOCK(vp, 0);
if (error == 0)
-   error = copyout(&inkernelacl, aclp, sizeof(struct acl));
+   error = copyout(inkernelacl, aclp, sizeof(struct acl));
+   acl_free(inkernelacl);
return (error);
 }
 
@@ -166,13 +171,16 @@ static int
 vacl_aclcheck(struct thread *td, struct vnode *vp, acl_type_t type,
 struct acl *aclp)
 {
-   struct acl inkernelacl;
+   struct acl *inkernelacl;
int error;
 
-   error = copyin(aclp, &inkernelacl, sizeof(struct acl));
+   inkernelacl = acl_alloc(M_WAITOK);
+   error = copyin(aclp, inkernelacl, sizeof(struct acl));
if (error)
-   return(error);
-   error = VOP_ACLCHECK(vp, type, &inkernelacl, td->td_ucred, td);
+   goto out;
+   error = VOP_ACLCHECK(vp, type, inkernelacl, td->td_ucred, td);
+out:
+   acl_free(inkernelacl);
return (error);
 }
 
@@ -417,6 +425,23 @@ __acl_aclcheck_fd(struct thread *td, str
return (error);
 }
 
+struct acl *
+acl_alloc(int flags)
+{
+   struct acl *aclp;
+
+   aclp = uma_zalloc(acl_zone, flags);
+
+   return (aclp);
+}
+
+void
+acl_free(struct acl *aclp)
+{
+
+   uma_zfree(acl_zone, aclp);
+}
+
 /* ARGUSED */
 
 static void

Modified: head/sys/sys/acl.h
==
--- head/sys/sys/acl.h  Sat Apr 18 16:36:27 2009(r191248)
+++ head/sys/sys/acl.h  Sat Apr 18 16:47:33 2009(r191249)
@@ -116,8 +116,6 @@ typedef struct acl_t_struct *acl_t;
 
 #ifdef _KERNEL
 
-extern uma_zone_t  acl_zone;
-
 /*
  * POSIX.1e ACLs are capable of expressing the read, write, and execute bits
  * of the POSIX mode field.  We provide two masks: one that defines the bits
@@ -141,6 +139,8 @@ mode_t  acl_posix1e_perms_to_mode(
 mode_t acl_posix1e_acl_to_mode(struct acl *acl);
 mode_t acl_posix1e_newfilemode(mode_t cmode,
struct acl *dacl);
+struct acl *acl_alloc(int flags);
+void   acl_free(struct acl *aclp);
 
 /*
  * File system independent syntax check for a POSIX.1e ACL.

Modified: head/sys/ufs/ufs/ufs_vnops.c
==
--- head/sys/ufs/ufs/ufs_vnops.cSat Apr 18 16:36:27 2009
(r191248)
+++ head/sys/ufs/ufs/ufs_vnops.cSat Apr 18 16:47:33 2009
(r191249)
@@ -374,7 +374

svn commit: r191250 - head

2009-04-18 Thread Antoine Brodin
Author: antoine
Date: Sat Apr 18 18:21:42 2009
New Revision: 191250
URL: http://svn.freebsd.org/changeset/base/191250

Log:
  Add more obsolete files, usb related.

Modified:
  head/ObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Sat Apr 18 16:47:33 2009(r191249)
+++ head/ObsoleteFiles.inc  Sat Apr 18 18:21:42 2009(r191250)
@@ -14,6 +14,21 @@
 # The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last.
 #
 
+# 20090417: removal of legacy versions of USB network interface drivers
+OLD_FILES+=usr/include/legacy/dev/usb/if_auereg.h
+OLD_FILES+=usr/include/legacy/dev/usb/if_axereg.h
+OLD_FILES+=usr/include/legacy/dev/usb/if_cdcereg.h
+OLD_FILES+=usr/include/legacy/dev/usb/if_cuereg.h
+OLD_FILES+=usr/include/legacy/dev/usb/if_kuereg.h
+OLD_FILES+=usr/include/legacy/dev/usb/if_ruereg.h
+OLD_FILES+=usr/include/legacy/dev/usb/if_rumreg.h
+OLD_FILES+=usr/include/legacy/dev/usb/if_rumvar.h
+OLD_FILES+=usr/include/legacy/dev/usb/if_udavreg.h
+OLD_FILES+=usr/include/legacy/dev/usb/if_uralreg.h
+OLD_FILES+=usr/include/legacy/dev/usb/if_uralvar.h
+OLD_FILES+=usr/include/legacy/dev/usb/if_zydfw.h
+OLD_FILES+=usr/include/legacy/dev/usb/if_zydreg.h
+OLD_FILES+=usr/include/legacy/dev/usb/kue_fw.h
 # 20090416: removal of ar(4), ray(4), sr(4), raycontrol(8)
 OLD_FILES+=usr/sbin/raycontrol
 OLD_FILES+=usr/share/man/man4/i386/ar.4.gz
@@ -22,6 +37,8 @@ OLD_FILES+=usr/share/man/man4/i386/sr.4.
 OLD_FILES+=usr/share/man/man8/raycontrol.8.gz
 # 20090410: VOP_LEASE.9 removed
 OLD_FILES+=usr/share/man/man9/VOP_LEASE.9.gz
+# 20090406: usb_sw_transfer.h removed
+OLD_FILES+=usr/include/dev/usb/usb_sw_transfer.h
 # 20090405: removal of if_ppp(4) and if_sl(4)
 OLD_FILES+=sbin/slattach rescue/slattach
 OLD_FILES+=sbin/startslip rescue/startslip
@@ -60,6 +77,7 @@ OLD_FILES+=usr/lib/libusb20.a
 OLD_FILES+=usr/lib/libusb20.so
 OLD_FILES+=usr/lib/libusb20_p.a
 OLD_FILES+=usr/include/libusb20_compat01.h
+OLD_FILES+=usr/include/libusb20_compat10.h
 .if ${TARGET_ARCH} == "amd64"
 OLD_LIBS+=usr/lib32/libusb20.so.1
 OLD_FILES+=usr/lib32/libusb20.a
@@ -103,6 +121,8 @@ OLD_FILES+=usr/include/dev/usb/if_udavre
 OLD_FILES+=usr/include/dev/usb/if_upgtvar.h
 OLD_FILES+=usr/include/dev/usb/if_uralreg.h
 OLD_FILES+=usr/include/dev/usb/if_uralvar.h
+OLD_FILES+=usr/include/dev/usb/if_urtwreg.h
+OLD_FILES+=usr/include/dev/usb/if_urtwvar.h
 OLD_FILES+=usr/include/dev/usb/if_zydfw.h
 OLD_FILES+=usr/include/dev/usb/if_zydreg.h
 OLD_FILES+=usr/include/dev/usb/kue_fw.h
@@ -128,6 +148,8 @@ OLD_FILES+=usr/include/dev/usb/usbdi.h
 OLD_FILES+=usr/include/dev/usb/usbdi_util.h
 OLD_FILES+=usr/include/dev/usb/usbdivar.h
 OLD_FILES+=usr/include/dev/usb/uxb360gp_rdesc.h
+OLD_FILES+=usr/sbin/usbdevs
+OLD_FILES+=usr/share/man/man8/usbdevs.8.gz
 # 20090203: removal of pccard header files
 OLD_FILES+=usr/include/pccard/cardinfo.h
 OLD_FILES+=usr/include/pccard/cis.h
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r191250 - head

2009-04-18 Thread Ruslan Ermilov
On Sat, Apr 18, 2009 at 06:21:42PM +, Antoine Brodin wrote:
> Modified: head/ObsoleteFiles.inc
[...]
> +OLD_FILES+=usr/sbin/usbdevs
> +OLD_FILES+=usr/share/man/man8/usbdevs.8.gz

Hmm, when I asked, I was told that usbdevs(8) was disconnected
from the build only temporarily.


Cheers,
-- 
Ruslan Ermilov
r...@freebsd.org
FreeBSD committer
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r191250 - head

2009-04-18 Thread Antoine Brodin
On Sat, Apr 18, 2009 at 8:50 PM, Ruslan Ermilov  wrote:
> On Sat, Apr 18, 2009 at 06:21:42PM +, Antoine Brodin wrote:
>> Modified: head/ObsoleteFiles.inc
> [...]
>> +OLD_FILES+=usr/sbin/usbdevs
>> +OLD_FILES+=usr/share/man/man8/usbdevs.8.gz
>
> Hmm, when I asked, I was told that usbdevs(8) was disconnected
> from the build only temporarily.

I can remove theses two lines now or they can be removed when
usbdevs(8) is reconnected.
What do you prefer?

Cheers,

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


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

2009-04-18 Thread Robert Watson
Author: rwatson
Date: Sat Apr 18 20:09:43 2009
New Revision: 191251
URL: http://svn.freebsd.org/changeset/base/191251

Log:
  Garbage collect man page reference to IFF_NEEDSGIANT.

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

Modified: head/share/man/man9/altq.9
==
--- head/share/man/man9/altq.9  Sat Apr 18 18:21:42 2009(r191250)
+++ head/share/man/man9/altq.9  Sat Apr 18 20:09:43 2009(r191251)
@@ -543,11 +543,6 @@ Make sure that calls to
 and
 .Fn IFQ_DRV_PURGE
 are protected with a mutex of some kind.
-Setting
-.Dv IFF_NEEDSGIANT
-in
-.Va if_flags
-might also be appropriate.
 .Ss Attach routine
 Use
 .Fn IFQ_SET_MAXLEN
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r191252 - head/sbin/ifconfig

2009-04-18 Thread Robert Watson
Author: rwatson
Date: Sat Apr 18 20:10:39 2009
New Revision: 191252
URL: http://svn.freebsd.org/changeset/base/191252

Log:
  ifconfig(8) no longer needs to know how to print the IFF_NEEDSGIANT flag,
  since it shortly won't be defined at all.

Modified:
  head/sbin/ifconfig/ifconfig.c

Modified: head/sbin/ifconfig/ifconfig.c
==
--- head/sbin/ifconfig/ifconfig.c   Sat Apr 18 20:09:43 2009
(r191251)
+++ head/sbin/ifconfig/ifconfig.c   Sat Apr 18 20:10:39 2009
(r191252)
@@ -783,7 +783,7 @@ setifname(const char *val, int dummy __u
 #defineIFFBITS \
 "\020\1UP\2BROADCAST\3DEBUG\4LOOPBACK\5POINTOPOINT\6SMART\7RUNNING" \
 "\10NOARP\11PROMISC\12ALLMULTI\13OACTIVE\14SIMPLEX\15LINK0\16LINK1\17LINK2" \
-"\20MULTICAST\22PPROMISC\23MONITOR\24STATICARP\25NEEDSGIANT"
+"\20MULTICAST\22PPROMISC\23MONITOR\24STATICARP"
 
 #defineIFCAPBITS \
 "\020\1RXCSUM\2TXCSUM\3NETCONS\4VLAN_MTU\5VLAN_HWTAGGING\6JUMBO_MTU\7POLLING" \
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r191253 - head/sys/net

2009-04-18 Thread Robert Watson
Author: rwatson
Date: Sat Apr 18 20:39:17 2009
New Revision: 191253
URL: http://svn.freebsd.org/changeset/base/191253

Log:
  Remove IFF_NEEDSGIANT interface flag: we no longer provide ifnet-layer
  infrastructure to support non-MPSAFE network device drivers.

Modified:
  head/sys/net/if.h

Modified: head/sys/net/if.h
==
--- head/sys/net/if.h   Sat Apr 18 20:10:39 2009(r191252)
+++ head/sys/net/if.h   Sat Apr 18 20:39:17 2009(r191253)
@@ -149,7 +149,6 @@ struct if_data {
 #defineIFF_PPROMISC0x2 /* (n) user-requested promisc 
mode */
 #defineIFF_MONITOR 0x4 /* (n) user-requested monitor 
mode */
 #defineIFF_STATICARP   0x8 /* (n) static ARP */
-#defineIFF_NEEDSGIANT  0x10/* (i) hold Giant over if_start 
calls */
 
 /*
  * Old names for driver flags so that user space tools can continue to use
@@ -163,8 +162,7 @@ struct if_data {
 /* flags set internally only: */
 #defineIFF_CANTCHANGE \
(IFF_BROADCAST|IFF_POINTOPOINT|IFF_DRV_RUNNING|IFF_DRV_OACTIVE|\
-   IFF_SIMPLEX|IFF_MULTICAST|IFF_ALLMULTI|IFF_SMART|IFF_PROMISC|\
-   IFF_NEEDSGIANT)
+   IFF_SIMPLEX|IFF_MULTICAST|IFF_ALLMULTI|IFF_SMART|IFF_PROMISC)
 
 /*
  * Values for if_link_state.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r191250 - head

2009-04-18 Thread Ruslan Ermilov
On Sat, Apr 18, 2009 at 09:08:52PM +0200, Antoine Brodin wrote:
> On Sat, Apr 18, 2009 at 8:50 PM, Ruslan Ermilov  wrote:
> > On Sat, Apr 18, 2009 at 06:21:42PM +, Antoine Brodin wrote:
> >> Modified: head/ObsoleteFiles.inc
> > [...]
> >> +OLD_FILES+=usr/sbin/usbdevs
> >> +OLD_FILES+=usr/share/man/man8/usbdevs.8.gz
> >
> > Hmm, when I asked, I was told that usbdevs(8) was disconnected
> > from the build only temporarily.
> 
> I can remove theses two lines now or they can be removed when
> usbdevs(8) is reconnected.
> What do you prefer?
> 
The former, as usbdevs(8) is not obsoleted.


Cheers,
-- 
Ruslan Ermilov
r...@freebsd.org
FreeBSD committer
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r191254 - head

2009-04-18 Thread Antoine Brodin
Author: antoine
Date: Sat Apr 18 22:16:46 2009
New Revision: 191254
URL: http://svn.freebsd.org/changeset/base/191254

Log:
  usbdevs(8) is not obsoleted, just temporarily disconnected from the build
  
  Noticed by:   ru@

Modified:
  head/ObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Sat Apr 18 20:39:17 2009(r191253)
+++ head/ObsoleteFiles.inc  Sat Apr 18 22:16:46 2009(r191254)
@@ -148,8 +148,6 @@ OLD_FILES+=usr/include/dev/usb/usbdi.h
 OLD_FILES+=usr/include/dev/usb/usbdi_util.h
 OLD_FILES+=usr/include/dev/usb/usbdivar.h
 OLD_FILES+=usr/include/dev/usb/uxb360gp_rdesc.h
-OLD_FILES+=usr/sbin/usbdevs
-OLD_FILES+=usr/share/man/man8/usbdevs.8.gz
 # 20090203: removal of pccard header files
 OLD_FILES+=usr/include/pccard/cardinfo.h
 OLD_FILES+=usr/include/pccard/cis.h
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r191255 - in head/sys: amd64/conf conf i386/conf net

2009-04-18 Thread Kip Macy
Author: kmacy
Date: Sun Apr 19 00:16:04 2009
New Revision: 191255
URL: http://svn.freebsd.org/changeset/base/191255

Log:
  - Import infrastructure for caching flows as a means of accelerating L3 and 
L2 lookups
as well as providing stateful load balancing when used with RADIX_MPATH.
  - Currently compiled in to i386 and amd64 but disabled by default, it can be 
enabled at
runtime with 'sysctl net.inet.flowtable.enable=1'.
  
  - Embedded users can remove it entirely from the kernel by adding 'nooption 
FLOWTABLE' to
their kernel config files.
  
  - A minimal hookup will be added to ip_output in a subsequent commit. I would 
like to see
more review before bringing in changes that require more churn.
  
  Supported by: Bitgravity Inc.

Added:
  head/sys/net/flowtable.c   (contents, props changed)
  head/sys/net/flowtable.h   (contents, props changed)
Modified:
  head/sys/amd64/conf/DEFAULTS
  head/sys/conf/NOTES
  head/sys/conf/files
  head/sys/conf/options
  head/sys/i386/conf/DEFAULTS

Modified: head/sys/amd64/conf/DEFAULTS
==
--- head/sys/amd64/conf/DEFAULTSSat Apr 18 22:16:46 2009
(r191254)
+++ head/sys/amd64/conf/DEFAULTSSun Apr 19 00:16:04 2009
(r191255)
@@ -20,3 +20,5 @@ options   GEOM_PART_BSD
 optionsGEOM_PART_EBR
 optionsGEOM_PART_EBR_COMPAT
 optionsGEOM_PART_MBR
+
+optionsFLOWTABLE

Modified: head/sys/conf/NOTES
==
--- head/sys/conf/NOTES Sat Apr 18 22:16:46 2009(r191254)
+++ head/sys/conf/NOTES Sun Apr 19 00:16:04 2009(r191255)
@@ -553,6 +553,9 @@ options LIBMCHAIN
 # libalias library, performing NAT
 optionsLIBALIAS
 
+# flowtable cache
+optionsFLOWTABLE
+
 #
 # SCTP is a NEW transport protocol defined by
 # RFC2960 updated by RFC3309 and RFC3758.. and

Modified: head/sys/conf/files
==
--- head/sys/conf/files Sat Apr 18 22:16:46 2009(r191254)
+++ head/sys/conf/files Sun Apr 19 00:16:04 2009(r191255)
@@ -2145,6 +2145,7 @@ net/bpf_jitter.c  optional bpf_jitter
 net/bpf_filter.c   optional bpf | netgraph_bpf
 net/bpf_zerocopy.c optional bpf
 net/bridgestp.coptional bridge | if_bridge
+net/flowtable.coptional flowtable
 net/ieee8023ad_lacp.c  optional lagg
 net/if.c   standard
 net/if_arcsubr.c   optional arcnet

Modified: head/sys/conf/options
==
--- head/sys/conf/options   Sat Apr 18 22:16:46 2009(r191254)
+++ head/sys/conf/options   Sun Apr 19 00:16:04 2009(r191255)
@@ -417,6 +417,7 @@ TCP_OFFLOAD_DISABLE opt_inet.h #Disable 
 TCP_SIGNATURE  opt_inet.h
 VLAN_ARRAY opt_vlan.h
 XBONEHACK
+FLOWTABLE  opt_route.h
 
 #
 # SCTP

Modified: head/sys/i386/conf/DEFAULTS
==
--- head/sys/i386/conf/DEFAULTS Sat Apr 18 22:16:46 2009(r191254)
+++ head/sys/i386/conf/DEFAULTS Sun Apr 19 00:16:04 2009(r191255)
@@ -28,3 +28,5 @@ options   GEOM_PART_MBR
 # enable support for native hardware
 optionsNATIVE
 device atpic
+
+optionsFLOWTABLE

Added: head/sys/net/flowtable.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/net/flowtable.cSun Apr 19 00:16:04 2009(r191255)
@@ -0,0 +1,1105 @@
+/**
+
+Copyright (c) 2008-2009, BitGravity Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+
+ 2. Neither the name of the BitGravity Corporation 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 COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 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) HOWEVE

svn commit: r191256 - head/sys/vm

2009-04-18 Thread Alan Cox
Author: alc
Date: Sun Apr 19 00:34:34 2009
New Revision: 191256
URL: http://svn.freebsd.org/changeset/base/191256

Log:
  Allow valid pages to be mapped for read access when they have a non-zero
  busy count.  Only mappings that allow write access should be prevented by
  a non-zero busy count.
  
  (The prohibition on mapping pages for read access when they have a non-
  zero busy count originated in revision 1.202 of i386/i386/pmap.c when
  this code was a part of the pmap.)
  
  Reviewed by:  tegge

Modified:
  head/sys/vm/vm_fault.c
  head/sys/vm/vm_map.c

Modified: head/sys/vm/vm_fault.c
==
--- head/sys/vm/vm_fault.c  Sun Apr 19 00:16:04 2009(r191255)
+++ head/sys/vm/vm_fault.c  Sun Apr 19 00:34:34 2009(r191256)
@@ -1027,7 +1027,6 @@ vm_fault_prefault(pmap_t pmap, vm_offset
break;
}
if (((m->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL) &&
-   (m->busy == 0) &&
(m->flags & PG_FICTITIOUS) == 0) {
 
vm_page_lock_queues();

Modified: head/sys/vm/vm_map.c
==
--- head/sys/vm/vm_map.cSun Apr 19 00:16:04 2009(r191255)
+++ head/sys/vm/vm_map.cSun Apr 19 00:34:34 2009(r191256)
@@ -1683,8 +1683,7 @@ vm_map_pmap_enter(vm_map_t map, vm_offse
psize = tmpidx;
break;
}
-   if ((p->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL &&
-   (p->busy == 0)) {
+   if ((p->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL) {
if (p_start == NULL) {
start = addr + ptoa(tmpidx);
p_start = p;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r191257 - head/sys/net

2009-04-18 Thread Kip Macy
Author: kmacy
Date: Sun Apr 19 04:24:56 2009
New Revision: 191257
URL: http://svn.freebsd.org/changeset/base/191257

Log:
  - put larger flowtable members at the end
  - fix bug where tail pointer of the free list would not get advanced
  - clear entry's next pointer when it is added to the freelist to avoid freeing
an entry that it still points to

Modified:
  head/sys/net/flowtable.c

Modified: head/sys/net/flowtable.c
==
--- head/sys/net/flowtable.cSun Apr 19 00:34:34 2009(r191256)
+++ head/sys/net/flowtable.cSun Apr 19 04:24:56 2009(r191257)
@@ -282,14 +282,12 @@ union flentryp {
 };
 
 struct flowtable {
-   union flentryp  ft_table;
int ft_size;
-   bitstr_t*ft_masks[MAXCPU];
-   struct mtx  *ft_locks;
int ft_lock_count;
uint32_tft_flags;
uint32_tft_collisions;
uint32_tft_allocated;
+   uint32_tft_misses;
uint64_tft_hits;
 
uint32_tft_udp_idle;
@@ -300,8 +298,11 @@ struct flowtable {
fl_lock_t   *ft_lock;
fl_lock_t   *ft_unlock;
fl_rtalloc_t*ft_rtalloc;
+   struct mtx  *ft_locks;
 
struct flowtable *ft_next;
+   union flentryp  ft_table;
+   bitstr_t*ft_masks[MAXCPU];
 };
 
 static struct proc *flowcleanerproc;
@@ -991,10 +992,11 @@ flowtable_free_stale(struct flowtable *f
flefreehead = flefreetail = NULL;
mask = flowtable_mask(ft);
while ((curbit = bit_fns(mask, ft->ft_size, curbit, &mask_tmp)) != -1) {
-   if (curbit >= ft->ft_size) {
-   log(LOG_DEBUG,
-   "warning curbit=%d exceeds ft_size\n",
+   if (curbit >= ft->ft_size || curbit < -1) {
+   log(LOG_ALERT,
+   "warning: bad curbit value %d \n",
curbit);
+   break;
}

FL_ENTRY_LOCK(ft, curbit);
@@ -1002,14 +1004,13 @@ flowtable_free_stale(struct flowtable *f
fle = fleprev = *flehead;
 
flowtable_free_checks++;
-#ifdef DIAGNOSTICS
+#ifdef DIAGNOSTIC
if (fle == NULL && curbit > 0) {
-   log(LOG_DEBUG,
-   "warning bit=%d set, but no fle found index=%d p=%p 
index=%d p=%p\n",
-   curbit, curbit-1, FL_ENTRY(ft, curbit - 1),
-   curbit+1, FL_ENTRY(ft, curbit + 1));
+   log(LOG_ALERT,
+   "warning bit=%d set, but no fle found\n",
+   curbit);
}
-#endif
+#endif 
while (fle != NULL) {   
if (!flow_stale(ft, fle)) {
fleprev = fle;
@@ -1037,8 +1038,11 @@ flowtable_free_stale(struct flowtable *f

if (flefreehead == NULL)
flefreehead = flefreetail = fletmp;
-   else
+   else {
flefreetail->f_next = fletmp;
+   flefreetail = fletmp;
+   }
+   fletmp->f_next = NULL;
}
if (*flehead == NULL)
bit_clear(mask, curbit);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r191258 - head/sys/net

2009-04-18 Thread Kip Macy
Author: kmacy
Date: Sun Apr 19 04:39:42 2009
New Revision: 191258
URL: http://svn.freebsd.org/changeset/base/191258

Log:
  update TODO list

Modified:
  head/sys/net/flowtable.c

Modified: head/sys/net/flowtable.c
==
--- head/sys/net/flowtable.cSun Apr 19 04:24:56 2009(r191257)
+++ head/sys/net/flowtable.cSun Apr 19 04:39:42 2009(r191258)
@@ -313,8 +313,11 @@ static uma_zone_t ipv6_zone;
 
 /*
  * TODO:
- * - Add per flowtable sysctls for statistics and configuring timeouts
+ * - Make flowtable stats per-cpu, aggregated at sysctl call time,
+ *   to avoid extra cache evictions caused by incrementing a shared
+ *   counter
  * - add IPv6 support to flow lookup
+ * - Add per flowtable sysctls for statistics and configuring timeouts
  * - add saturation counter to rtentry to support per-packet load-balancing
  *   add flag to indicate round-robin flow, add list lookup from head
  for flows
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r191259 - head/sys/netinet

2009-04-18 Thread Kip Macy
Author: kmacy
Date: Sun Apr 19 04:44:05 2009
New Revision: 191259
URL: http://svn.freebsd.org/changeset/base/191259

Log:
  - Allocate a small flowtable in ip_input.c (changeable by tuneable)
  - Use for accelerating ip_output

Modified:
  head/sys/netinet/ip_input.c
  head/sys/netinet/ip_output.c
  head/sys/netinet/vinet.h

Modified: head/sys/netinet/ip_input.c
==
--- head/sys/netinet/ip_input.c Sun Apr 19 04:39:42 2009(r191258)
+++ head/sys/netinet/ip_input.c Sun Apr 19 04:44:05 2009(r191259)
@@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -211,6 +212,11 @@ SYSCTL_INT(_net_inet_ip, IPCTL_DEFMTU, m
 SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_ip, OID_AUTO, stealth, CTLFLAG_RW,
 ipstealth, 0, "IP stealth mode, no TTL decrementation on forwarding");
 #endif
+static int ip_output_flowtable_size = 2048;
+TUNABLE_INT("net.inet.ip.output_flowtable_size", &ip_output_flowtable_size);
+SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_ip, OID_AUTO, output_flowtable_size,
+CTLFLAG_RDTUN, ip_output_flowtable_size, 2048,
+"number of entries in the per-cpu output flow caches");
 
 /*
  * ipfw_ether and ipfw_bridge hooks.
@@ -221,6 +227,7 @@ ip_dn_io_t *ip_dn_io_ptr = NULL;
 #ifdef VIMAGE_GLOBALS
 int fw_one_pass;
 #endif
+struct flowtable *ip_ft;
 
 static voidip_freef(struct ipqhead *, struct ipq *);
 
@@ -342,6 +349,8 @@ ip_init(void)
ipintrq.ifq_maxlen = ipqmaxlen;
mtx_init(&ipintrq.ifq_mtx, "ip_inq", NULL, MTX_DEF);
netisr_register(NETISR_IP, ip_input, &ipintrq, 0);
+
+   ip_ft = flowtable_alloc(ip_output_flowtable_size, FL_PCPU);
 }
 
 void

Modified: head/sys/netinet/ip_output.c
==
--- head/sys/netinet/ip_output.cSun Apr 19 04:39:42 2009
(r191258)
+++ head/sys/netinet/ip_output.cSun Apr 19 04:44:05 2009
(r191259)
@@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #ifdef RADIX_MPATH
 #include 
 #endif
@@ -135,6 +136,7 @@ ip_output(struct mbuf *m, struct mbuf *o
int hlen = sizeof (struct ip);
int mtu;
int len, error = 0;
+   int nortfree = 0;
struct sockaddr_in *dst = NULL; /* keep compiler happy */
struct in_ifaddr *ia = NULL;
int isbroadcast, sw_csum;
@@ -158,6 +160,10 @@ ip_output(struct mbuf *m, struct mbuf *o
m->m_flags |= M_FLOWID;
}
}
+   if ((ro == &iproute) && (ro->ro_rt == NULL) && (ro->ro_lle == NULL)) {
+   if (flowtable_lookup(ip_ft, m, ro) == 0)
+   nortfree = 1;
+   }
 
if (opt) {
len = 0;
@@ -199,7 +205,8 @@ again:
if (ro->ro_rt && ((ro->ro_rt->rt_flags & RTF_UP) == 0 ||
  dst->sin_family != AF_INET ||
  dst->sin_addr.s_addr != ip->ip_dst.s_addr)) {
-   RTFREE(ro->ro_rt);
+   if (!nortfree)
+   RTFREE(ro->ro_rt);
ro->ro_rt = (struct rtentry *)NULL;
}
 #ifdef IPFIREWALL_FORWARD
@@ -638,7 +645,7 @@ passout:
IPSTAT_INC(ips_fragmented);
 
 done:
-   if (ro == &iproute && ro->ro_rt) {
+   if (ro == &iproute && ro->ro_rt && !nortfree) {
RTFREE(ro->ro_rt);
}
return (error);

Modified: head/sys/netinet/vinet.h
==
--- head/sys/netinet/vinet.hSun Apr 19 04:39:42 2009(r191258)
+++ head/sys/netinet/vinet.hSun Apr 19 04:44:05 2009(r191259)
@@ -72,6 +72,7 @@ struct vnet_inet {
int _ip_sendsourcequench;
int _ip_do_randomid;
int _ip_checkinterface;
+   int _ip_output_flowtable_size;
u_short _ip_id;
 
uma_zone_t _ipq_zone;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r191260 - head/sys/ufs/ufs

2009-04-18 Thread Konstantin Belousov
Author: kib
Date: Sun Apr 19 05:34:07 2009
New Revision: 191260
URL: http://svn.freebsd.org/changeset/base/191260

Log:
  When verifying '..' after VFS_VGET() in ufs_lookup(), do not return
  error if '..' is still there but changed between lookup and check.
  Start relookup instead. Rename is supposed to change '..' reference
  atomically, so transient failures introduced by r191137 are wrong.
  
  While rearranging the code to allow lookup restart in ufs_lookup(),
  remove the comment that only distracts the reader.
  
  Noted and reviewed by:tegge
  Also reported by: pho
  MFC after:1 month

Modified:
  head/sys/ufs/ufs/ufs_lookup.c

Modified: head/sys/ufs/ufs/ufs_lookup.c
==
--- head/sys/ufs/ufs/ufs_lookup.c   Sun Apr 19 04:44:05 2009
(r191259)
+++ head/sys/ufs/ufs/ufs_lookup.c   Sun Apr 19 05:34:07 2009
(r191260)
@@ -78,7 +78,7 @@ SYSCTL_INT(_debug, OID_AUTO, dircheck, C
 #define OFSFMT(vp) ((vp)->v_mount->mnt_maxsymlinklen <= 0)
 
 static int ufs_lookup_(struct vnode *, struct vnode **, struct componentname *,
-ino_t);
+ino_t *);
 
 /*
  * Convert a component of a pathname into a pointer to a locked inode.
@@ -134,12 +134,12 @@ ufs_lookup(ap)
} */ *ap;
 {
 
-   return (ufs_lookup_(ap->a_dvp, ap->a_vpp, ap->a_cnp, 0));
+   return (ufs_lookup_(ap->a_dvp, ap->a_vpp, ap->a_cnp, NULL));
 }
 
 static int
 ufs_lookup_(struct vnode *vdp, struct vnode **vpp, struct componentname *cnp,
-ino_t dd_ino)
+ino_t *dd_ino)
 {
struct inode *dp;   /* inode for directory being searched */
struct buf *bp; /* a buffer of directory entries */
@@ -163,15 +163,9 @@ ufs_lookup_(struct vnode *vdp, struct vn
struct ucred *cred = cnp->cn_cred;
int flags = cnp->cn_flags;
int nameiop = cnp->cn_nameiop;
-   ino_t ino;
+   ino_t ino, ino1;
int ltype;
 
-   bp = NULL;
-   slotoffset = -1;
-/*
- *  XXX there was a soft-update diff about this I couldn't merge.
- * I think this was the equiv.
- */
if (vpp != NULL)
*vpp = NULL;
 
@@ -185,6 +179,12 @@ ufs_lookup_(struct vnode *vdp, struct vn
 */
vnode_create_vobject(vdp, DIP(dp, i_size), cnp->cn_thread);
 
+   bmask = VFSTOUFS(vdp->v_mount)->um_mountp->mnt_stat.f_iosize - 1;
+
+restart:
+   bp = NULL;
+   slotoffset = -1;
+
/*
 * We now have a segment name to search for, and a directory to search.
 *
@@ -202,7 +202,6 @@ ufs_lookup_(struct vnode *vdp, struct vn
slotstatus = NONE;
slotneeded = DIRECTSIZ(cnp->cn_namelen);
}
-   bmask = VFSTOUFS(vdp->v_mount)->um_mountp->mnt_stat.f_iosize - 1;
 
 #ifdef UFS_DIRHASH
/*
@@ -487,9 +486,8 @@ found:
if ((flags & ISLASTCN) && nameiop == LOOKUP)
dp->i_diroff = i_offset &~ (DIRBLKSIZ - 1);
 
-   if (dd_ino != 0) {
-   if (ino != dd_ino)
-   return (ENOENT);
+   if (dd_ino != NULL) {
+   *dd_ino = ino;
return (0);
}
 
@@ -600,11 +598,15 @@ found:
 * to the inode we looked up before vdp lock was
 * dropped.
 */
-   error = ufs_lookup_(pdp, NULL, cnp, ino);
+   error = ufs_lookup_(pdp, NULL, cnp, &ino1);
if (error) {
vput(tdp);
return (error);
}
+   if (ino1 != ino) {
+   vput(tdp);
+   goto restart;
+   }
 
*vpp = tdp;
} else if (dp->i_number == ino) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r191261 - in head/sys/powerpc: aim include

2009-04-18 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Sun Apr 19 06:30:00 2009
New Revision: 191261
URL: http://svn.freebsd.org/changeset/base/191261

Log:
  Fix a typo in the SRR1 comparison for program exceptions. While here,
  replace magic numbers with constants to keep this from happening again.
  
  Without this fix, some programs would occasionally get SIGTRAP instead
  of SIGILL on an illegal instruction. This affected Altivec detection
  in pixman, and possibly other software.
  
  Reported by:  Andreas Tobler
  MFC after:1 week

Modified:
  head/sys/powerpc/aim/trap.c
  head/sys/powerpc/include/trap_aim.h

Modified: head/sys/powerpc/aim/trap.c
==
--- head/sys/powerpc/aim/trap.c Sun Apr 19 05:34:07 2009(r191260)
+++ head/sys/powerpc/aim/trap.c Sun Apr 19 06:30:00 2009(r191261)
@@ -208,9 +208,8 @@ trap(struct trapframe *frame)
break;
 
case EXC_PGM:
-   /* XXX temporarily */
-   /* XXX: Magic Number? */
-   if (frame->srr1 & 0x0002000)
+   /* Identify the trap reason */
+   if (frame->srr1 & EXC_PGM_TRAP)
sig = SIGTRAP;
else
sig = SIGILL;

Modified: head/sys/powerpc/include/trap_aim.h
==
--- head/sys/powerpc/include/trap_aim.h Sun Apr 19 05:34:07 2009
(r191260)
+++ head/sys/powerpc/include/trap_aim.h Sun Apr 19 06:30:00 2009
(r191261)
@@ -103,4 +103,15 @@
 #define EXC_ALI_RST(dsisr) ((dsisr >> 5) & 0x1f)   /* source or target */
 #define EXC_ALI_RA(dsisr) (dsisr & 0x1f)
 
+/*
+ * SRR1 bits for program exception traps. These identify what caused
+ * the program exception. See section 6.5.9 of the Power ISA Version
+ * 2.05.
+ */
+
+#defineEXC_PGM_FPENABLED   (1UL << 20)
+#defineEXC_PGM_ILLEGAL (1UL << 19)
+#defineEXC_PGM_PRIV(1UL << 18)
+#defineEXC_PGM_TRAP(1UL << 17)
+
 #endif /* _POWERPC_TRAP_H_ */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r191262 - head/usr.bin/cpio

2009-04-18 Thread Tim Kientzle
Author: kientzle
Date: Sun Apr 19 06:59:12 2009
New Revision: 191262
URL: http://svn.freebsd.org/changeset/base/191262

Log:
  When compiled for the release crunches, be a bit
  more selective about what libarchive features we pull in:
   * No compression support
   * Only cpio and ustar writing
   * Only cpio and tar/pax readers
  This reduces a statically linked, stripped binary from 900k to 680k
  and completely eliminates the dependency on libcrypto.

Modified:
  head/usr.bin/cpio/Makefile
  head/usr.bin/cpio/cpio.c

Modified: head/usr.bin/cpio/Makefile
==
--- head/usr.bin/cpio/Makefile  Sun Apr 19 06:30:00 2009(r191261)
+++ head/usr.bin/cpio/Makefile  Sun Apr 19 06:59:12 2009(r191262)
@@ -9,6 +9,11 @@ WARNS?=6
 DPADD= ${LIBARCHIVE} ${LIBZ} ${LIBBZ2}
 CFLAGS+= -DBSDCPIO_VERSION_STRING=\"${BSDCPIO_VERSION_STRING}\"
 CFLAGS+= -DPLATFORM_CONFIG_H=\"config_freebsd.h\"
+.ifdef RELEASE_CRUNCH
+# FreeBSD's installer uses cpio in crunched binaries that are
+# statically linked, cannot use -lcrypto, and are size sensitive.
+CFLAGS+= -DSMALLER
+.endif
 LDADD+=-larchive -lz -lbz2 -lmd
 .if ${MK_OPENSSL} != "no"
 LDADD+= -lcrypto

Modified: head/usr.bin/cpio/cpio.c
==
--- head/usr.bin/cpio/cpio.cSun Apr 19 06:30:00 2009(r191261)
+++ head/usr.bin/cpio/cpio.cSun Apr 19 06:59:12 2009(r191262)
@@ -461,24 +461,37 @@ mode_out(struct cpio *cpio)
if (cpio->archive == NULL)
cpio_errc(1, 0, "Failed to allocate archive object");
switch (cpio->compress) {
-#ifdef HAVE_BZLIB_H
+#ifndef SMALLER
case 'j': case 'y':
-   archive_write_set_compression_bzip2(cpio->archive);
+   r = archive_write_set_compression_bzip2(cpio->archive);
break;
-#endif
-#ifdef HAVE_ZLIB_H
case 'z':
-   archive_write_set_compression_gzip(cpio->archive);
+   r = archive_write_set_compression_gzip(cpio->archive);
break;
-#endif
case 'Z':
-   archive_write_set_compression_compress(cpio->archive);
+   r = archive_write_set_compression_compress(cpio->archive);
break;
-   default:
-   archive_write_set_compression_none(cpio->archive);
+#endif
+   case '\0':
+   r = archive_write_set_compression_none(cpio->archive);
break;
+   default:
+   cpio_errc(1, 0, "Unrecognized compression option");
}
+   if (r != ARCHIVE_OK)
+   cpio_errc(1, 0, "Unsupported compression format");
+#ifdef SMALLER
+   if (strcmp(cpio->format, "cpio"))
+   r = archive_write_set_format_cpio(cpio->archive);
+   else if (strcmp(cpio->format, "odc"))
+   r = archive_write_set_format_cpio(cpio->archive);
+   else if (strcmp(cpio->format, "newc"))
+   r = archive_write_set_format_cpio(cpio->archive);
+   else if (strcmp(cpio->format, "ustar"))
+   r = archive_write_set_format_cpio(cpio->archive);
+#else
r = archive_write_set_format_by_name(cpio->archive, cpio->format);
+#endif
if (r != ARCHIVE_OK)
cpio_errc(1, 0, archive_error_string(cpio->archive));
archive_write_set_bytes_per_block(cpio->archive, cpio->bytes_per_block);
@@ -815,8 +828,13 @@ mode_in(struct cpio *cpio)
a = archive_read_new();
if (a == NULL)
cpio_errc(1, 0, "Couldn't allocate archive object");
+#ifdef SMALLER
+   archive_read_support_format_cpio(a);
+   archive_read_support_format_tar(a);
+#else
archive_read_support_compression_all(a);
archive_read_support_format_all(a);
+#endif
 
if (archive_read_open_file(a, cpio->filename, cpio->bytes_per_block))
cpio_errc(1, archive_errno(a),
@@ -907,8 +925,13 @@ mode_list(struct cpio *cpio)
a = archive_read_new();
if (a == NULL)
cpio_errc(1, 0, "Couldn't allocate archive object");
+#ifdef SMALLER
+   archive_read_support_format_cpio(a);
+   archive_read_support_format_tar(a);
+#else
archive_read_support_compression_all(a);
archive_read_support_format_all(a);
+#endif
 
if (archive_read_open_file(a, cpio->filename, cpio->bytes_per_block))
cpio_errc(1, archive_errno(a),
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"