Re: svn commit: r223029 - head/usr.sbin/makefs/ffs

2011-06-12 Thread Kostik Belousov
On Mon, Jun 13, 2011 at 01:04:00AM +, Dimitry Andric wrote:
> Author: dim
> Date: Mon Jun 13 01:04:00 2011
> New Revision: 223029
> URL: http://svn.freebsd.org/changeset/base/223029
> 
> Log:
>   Apparently makefs needs a few more system headers to compile during
>   buildworld.
> 
> Modified:
>   head/usr.sbin/makefs/ffs/ffs_bswap.c
>   head/usr.sbin/makefs/ffs/ffs_subr.c
> 
> Modified: head/usr.sbin/makefs/ffs/ffs_bswap.c
> ==
> --- head/usr.sbin/makefs/ffs/ffs_bswap.c  Mon Jun 13 00:55:29 2011
> (r223028)
> +++ head/usr.sbin/makefs/ffs/ffs_bswap.c  Mon Jun 13 01:04:00 2011
> (r223029)
> @@ -35,6 +35,8 @@ __FBSDID("$FreeBSD$");
>  
>  #include 
>  #include 
> +#include 
> +#include 
>  #if defined(_KERNEL)
>  #include 
>  #endif
> 
> Modified: head/usr.sbin/makefs/ffs/ffs_subr.c
> ==
> --- head/usr.sbin/makefs/ffs/ffs_subr.c   Mon Jun 13 00:55:29 2011
> (r223028)
> +++ head/usr.sbin/makefs/ffs/ffs_subr.c   Mon Jun 13 01:04:00 2011
> (r223029)
> @@ -35,6 +35,9 @@
>  __FBSDID("$FreeBSD$");
>  
>  #include 
> +#include 
> +#include 
> +#include 
>  
>  #include 
>  #include 

I suspect it is easier and less controversial to put the structure
under #ifdef _KERNEL braces instead.


pgpjjbOYwrUAu.pgp
Description: PGP signature


Re: svn commit: r223029 - head/usr.sbin/makefs/ffs

2011-06-12 Thread Bruce Evans

On Mon, 13 Jun 2011, Dimitry Andric wrote:


Log:
 Apparently makefs needs a few more system headers to compile during
 buildworld.


This expands the bug.


Modified:
 head/usr.sbin/makefs/ffs/ffs_bswap.c
 head/usr.sbin/makefs/ffs/ffs_subr.c

Modified: head/usr.sbin/makefs/ffs/ffs_bswap.c
==
--- head/usr.sbin/makefs/ffs/ffs_bswap.cMon Jun 13 00:55:29 2011
(r223028)
+++ head/usr.sbin/makefs/ffs/ffs_bswap.cMon Jun 13 01:04:00 2011
(r223029)
@@ -35,6 +35,8 @@ __FBSDID("$FreeBSD$");

#include 
#include 
+#include 
+#include 
#if defined(_KERNEL)
#include 
#endif


Kernel variables like sn_lock should not be exported to userland.  And
even when they are, the full kernel API for accessing them should not
by included by userland (or in kernel headers).  The system provides
headers  and  to help avoid exposing the
full API.

These bugs are in many networking headers, but should not be added in
new code.  The networking headers are so convuluted and broken that
many of them have to expose the full API.  This should be even easier
to avoid adding in new code.

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: r223035 - head/usr.bin/find

2011-06-12 Thread Tai-hwa Liang
Author: avatar
Date: Mon Jun 13 05:22:07 2011
New Revision: 223035
URL: http://svn.freebsd.org/changeset/base/223035

Log:
  Using statfs.f_fstypename rather than statfs.f_type whilst performing fstype
  comparsion as nullfs will copy f_type from underlayer FS.
  
  PR:   bin/156258
  Submitted by: Marcin Wisnicki 
  MFC after:1 month

Modified:
  head/usr.bin/find/function.c

Modified: head/usr.bin/find/function.c
==
--- head/usr.bin/find/function.cMon Jun 13 04:55:29 2011
(r223034)
+++ head/usr.bin/find/function.cMon Jun 13 05:22:07 2011
(r223035)
@@ -846,7 +846,8 @@ f_fstype(PLAN *plan, FTSENT *entry)
static dev_t curdev;/* need a guaranteed illegal dev value */
static int first = 1;
struct statfs sb;
-   static int val_type, val_flags;
+   static int val_flags;
+   static char fstype[sizeof(sb.f_fstypename)];
char *p, save[2] = {0,0};
 
if ((plan->flags & F_MTMASK) == F_MTUNKNOWN)
@@ -888,13 +889,13 @@ f_fstype(PLAN *plan, FTSENT *entry)
 * always copy both of them.
 */
val_flags = sb.f_flags;
-   val_type = sb.f_type;
+   strlcpy(fstype, sb.f_fstypename, sizeof(fstype));
}
switch (plan->flags & F_MTMASK) {
case F_MTFLAG:
return val_flags & plan->mt_data;
case F_MTTYPE:
-   return val_type == plan->mt_data;
+   return (strncmp(fstype, plan->c_data, sizeof(fstype)) == 0);
default:
abort();
}
@@ -905,22 +906,11 @@ c_fstype(OPTION *option, char ***argvp)
 {
char *fsname;
PLAN *new;
-   struct xvfsconf vfc;
 
fsname = nextarg(option, argvp);
ftsoptions &= ~FTS_NOSTAT;
 
new = palloc(option);
-
-   /*
-* Check first for a filesystem name.
-*/
-   if (getvfsbyname(fsname, &vfc) == 0) {
-   new->flags |= F_MTTYPE;
-   new->mt_data = vfc.vfc_typenum;
-   return new;
-   }
-
switch (*fsname) {
case 'l':
if (!strcmp(fsname, "local")) {
@@ -938,12 +928,8 @@ c_fstype(OPTION *option, char ***argvp)
break;
}
 
-   /*
-* We need to make filesystem checks for filesystems
-* that exists but aren't in the kernel work.
-*/
-   fprintf(stderr, "Warning: Unknown filesystem type %s\n", fsname);
-   new->flags |= F_MTUNKNOWN;
+   new->flags |= F_MTTYPE;
+   new->c_data = fsname;
return new;
 }
 
___
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: r223032 - head/sys/dev/ath

2011-06-12 Thread Adrian Chadd
Author: adrian
Date: Mon Jun 13 04:31:57 2011
New Revision: 223032
URL: http://svn.freebsd.org/changeset/base/223032

Log:
  Fix ath_ahb(4) bus attach and eeprom error handling.
  
  Submitted by: Luiz Otavio O Souza 

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

Modified: head/sys/dev/ath/if_ath_ahb.c
==
--- head/sys/dev/ath/if_ath_ahb.c   Mon Jun 13 02:23:51 2011
(r223031)
+++ head/sys/dev/ath/if_ath_ahb.c   Mon Jun 13 04:31:57 2011
(r223032)
@@ -123,7 +123,7 @@ ath_ahb_attach(device_t dev)
device_printf(sc->sc_dev, "eeprom @ %p\n", (void *) eepromaddr);
psc->sc_eeprom = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, 
(uintptr_t) eepromaddr,
  (uintptr_t) eepromaddr + (uintptr_t) ((ATH_EEPROM_DATA_SIZE * 2) - 
1), 0, RF_ACTIVE);
-   if (psc->sc_sr == NULL) {
+   if (psc->sc_eeprom == NULL) {
device_printf(dev, "cannot map eeprom space\n");
goto bad0;
}
@@ -139,6 +139,10 @@ ath_ahb_attach(device_t dev)
 
/* Copy the EEPROM data out */
sc->sc_eepromdata = malloc(ATH_EEPROM_DATA_SIZE * 2, M_TEMP, M_NOWAIT | 
M_ZERO);
+   if (sc->sc_eepromdata == NULL) {
+   device_printf(dev, "cannot allocate memory for eeprom data\n");
+   goto bad1;
+   }
device_printf(sc->sc_dev, "eeprom data @ %p\n", (void *) 
rman_get_bushandle(psc->sc_eeprom));
/* XXX why doesn't this work? -adrian */
 #if 0
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r223025 - head/usr.sbin/makefs/ffs

2011-06-12 Thread Buganini
still broken:
cc -O2 -pipe  -I/usr/src/usr.sbin/makefs
-I/usr/src/usr.sbin/makefs/../../sys/fs/cd9660/
-I/usr/src/usr.sbin/makefs/../../sys/ufs/ffs
-I/usr/src/usr.sbin/makefs/compat -DHAVE_STRUCT_STAT_ST_FLAGS=1
-DHAVE_STRUCT_STAT_ST_GEN=1 -I/usr/src/usr.sbin/makefs/../mtree
-std=gnu99 -fstack-protector -Wsystem-headers -Wall -Wno-format-y2k
-Wno-uninitialized -Wno-pointer-sign -c
/usr/src/usr.sbin/makefs/ffs/ffs_bswap.c
In file included from /usr/src/usr.sbin/makefs/ffs/ffs_bswap.c:52:
/usr/obj/usr/src/tmp/usr/include/ufs/ffs/ffs_extern.h:176: error:
field 'sn_lock' has incomplete type
*** Error code 1

Stop in /usr/src/usr.sbin/makefs.
*** Error code 1

Following lock(9):
#include 
#include 
#include 
fix it.

and another breakage:
cc -O2 -pipe  -I/usr/src/usr.sbin/makefs
-I/usr/src/usr.sbin/makefs/../../sys/fs/cd9660/
-I/usr/src/usr.sbin/makefs/../../sys/ufs/ffs
-I/usr/src/usr.sbin/makefs/compat -DHAVE_STRUCT_STAT_ST_FLAGS=1
-DHAVE_STRUCT_STAT_ST_GEN=1 -I/usr/src/usr.sbin/makefs/../mtree
-std=gnu99 -fstack-protector -Wsystem-headers -Wall -Wno-format-y2k
-Wno-uninitialized -Wno-pointer-sign -c
/usr/src/usr.sbin/makefs/ffs/ffs_subr.c
In file included from /usr/src/usr.sbin/makefs/ffs/ffs_subr.c:48:
/usr/obj/usr/src/tmp/usr/include/ufs/ffs/ffs_extern.h:169: warning:
data definition has no type or storage class
/usr/obj/usr/src/tmp/usr/include/ufs/ffs/ffs_extern.h:169: warning:
parameter names (without types) in function declaration
/usr/obj/usr/src/tmp/usr/include/ufs/ffs/ffs_extern.h:172: error:
expected specifier-qualifier-list before 'LIST_ENTRY'
*** Error code 1

#include 
#include 
#include 
#include 
fix it.
___
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: r223029 - head/usr.sbin/makefs/ffs

2011-06-12 Thread Dimitry Andric
Author: dim
Date: Mon Jun 13 01:04:00 2011
New Revision: 223029
URL: http://svn.freebsd.org/changeset/base/223029

Log:
  Apparently makefs needs a few more system headers to compile during
  buildworld.

Modified:
  head/usr.sbin/makefs/ffs/ffs_bswap.c
  head/usr.sbin/makefs/ffs/ffs_subr.c

Modified: head/usr.sbin/makefs/ffs/ffs_bswap.c
==
--- head/usr.sbin/makefs/ffs/ffs_bswap.cMon Jun 13 00:55:29 2011
(r223028)
+++ head/usr.sbin/makefs/ffs/ffs_bswap.cMon Jun 13 01:04:00 2011
(r223029)
@@ -35,6 +35,8 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
+#include 
 #if defined(_KERNEL)
 #include 
 #endif

Modified: head/usr.sbin/makefs/ffs/ffs_subr.c
==
--- head/usr.sbin/makefs/ffs/ffs_subr.c Mon Jun 13 00:55:29 2011
(r223028)
+++ head/usr.sbin/makefs/ffs/ffs_subr.c Mon Jun 13 01:04:00 2011
(r223029)
@@ -35,6 +35,9 @@
 __FBSDID("$FreeBSD$");
 
 #include 
+#include 
+#include 
+#include 
 
 #include 
 #include 
___
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: r222980 - in head/sys: amd64/conf i386/conf

2011-06-12 Thread Adrian Chadd
On 13 June 2011 07:53, Daniel O'Connor  wrote:

>> PC Card has also had the standard structure and interface for many years.  
>> When I tried to move this to PCI many years ago, I encountered a lot of 
>> resistance that didn't make sense to me at the time (so I can't do it 
>> justice now).  This should tell you how long the problem has languished.  It 
>> was the primary motivator behind writing devd, but the pci resistance lead 
>> me to put aside the problem for a while.  I'll be happy to pick it back up, 
>> especially if I can get some help going through all the drivers and tagging 
>> things appropriately.
>
> I would be interested in helping, certainly with the mechanical changes.

Give me a couple weeks to tinker with the build so I can at least
populate a modules.conf file and boot i386/amd64 from a modules-only
kernel, then I'll post an update to -arch.

This kind of device enumeration would be nice but it's mostly
orthogonal to the initial discussion point. Eg, given that you need to
have loaded the root devices (eg ata/scsi, usb+umass, etc) before you
boot the kernel, those will have to either be enumerated by loader
(ew?) or loaded by loader at load time.


Adrian

(Alliteration was intentional. :)
___
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: r222980 - in head/sys: amd64/conf i386/conf

2011-06-12 Thread Daniel O'Connor

On 13/06/2011, at 7:46, Warner Losh wrote:
>> ISTR there a few modules which call some blob to determine if the module is 
>> supported but I think it's quite rare (the 80/20 rule works for me here :)
> 
> I've looked into this extensively.  usb comes the closest right now, since 
> nearly all of its drivers use the right interface to match driver to device.  
> There is a standard structure people use.  However, even it is impossible to 
> extract this data in a reliable automated fashion.  Ideally, these tables 
> would move to their own section which could then be extracted by a tool to 
> see when to load it.  This section would also need some additional metadata 
> in it so we know how to interpret the section.
> 
> The situation with the PCI bus is much less uniform.  While many drivers have 
> tables, these tables are all ad-hoc.  There's no standard structure so 
> everybody invents their own.  In addition to annotating the tables, you'd 
> have to regularize them all across all pci drivers.  Doing this for 100+ 
> drivers is a bit tedious.  Also, there are at least two cases where we have 
> to load two drivers to be sure that one of them attaches because there's 
> matching done outside of the normal plug and play identifiers (eg 
> vendor/device/function/subvendor/subdevice) in their probe routines.

> PC Card has also had the standard structure and interface for many years.  
> When I tried to move this to PCI many years ago, I encountered a lot of 
> resistance that didn't make sense to me at the time (so I can't do it justice 
> now).  This should tell you how long the problem has languished.  It was the 
> primary motivator behind writing devd, but the pci resistance lead me to put 
> aside the problem for a while.  I'll be happy to pick it back up, especially 
> if I can get some help going through all the drivers and tagging things 
> appropriately.

I would be interested in helping, certainly with the mechanical changes.

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C






___
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: r223026 - head/sys/dev/safe

2011-06-12 Thread Xin LI
Author: delphij
Date: Sun Jun 12 23:33:08 2011
New Revision: 223026
URL: http://svn.freebsd.org/changeset/base/223026

Log:
  Use swap32() right.
  
  Submitted by: gcopper
  MFC after:2 weeks

Modified:
  head/sys/dev/safe/safe.c

Modified: head/sys/dev/safe/safe.c
==
--- head/sys/dev/safe/safe.cSun Jun 12 23:09:00 2011(r223025)
+++ head/sys/dev/safe/safe.cSun Jun 12 23:33:08 2011(r223026)
@@ -1580,9 +1580,12 @@ safe_callback(struct safe_softc *sc, str
 * SHA-1 ICV's are byte-swapped; fix 'em up
 * before copy them to their destination.
 */
-   bswap32(re->re_sastate.sa_saved_indigest[0]);
-   bswap32(re->re_sastate.sa_saved_indigest[1]);
-   bswap32(re->re_sastate.sa_saved_indigest[2]);
+   re->re_sastate.sa_saved_indigest[0] =
+   
bswap32(re->re_sastate.sa_saved_indigest[0]);
+   re->re_sastate.sa_saved_indigest[1] =
+   
bswap32(re->re_sastate.sa_saved_indigest[1]);
+   re->re_sastate.sa_saved_indigest[2] =
+   
bswap32(re->re_sastate.sa_saved_indigest[2]);
}
crypto_copyback(crp->crp_flags, crp->crp_buf,
crd->crd_inject,
___
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: r223025 - head/usr.sbin/makefs/ffs

2011-06-12 Thread Dimitry Andric
Author: dim
Date: Sun Jun 12 23:09:00 2011
New Revision: 223025
URL: http://svn.freebsd.org/changeset/base/223025

Log:
  Unbreak usr.sbin/makefs after r223020.
  
  Pointy hat to:mckusick

Modified:
  head/usr.sbin/makefs/ffs/ffs_bswap.c

Modified: head/usr.sbin/makefs/ffs/ffs_bswap.c
==
--- head/usr.sbin/makefs/ffs/ffs_bswap.cSun Jun 12 23:06:04 2011
(r223024)
+++ head/usr.sbin/makefs/ffs/ffs_bswap.cSun Jun 12 23:09:00 2011
(r223025)
@@ -34,6 +34,7 @@
 __FBSDID("$FreeBSD$");
 
 #include 
+#include 
 #if defined(_KERNEL)
 #include 
 #endif
___
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: r223024 - head/bin/sh

2011-06-12 Thread Jilles Tjoelker
Author: jilles
Date: Sun Jun 12 23:06:04 2011
New Revision: 223024
URL: http://svn.freebsd.org/changeset/base/223024

Log:
  sh: Save/restore changed variables in optimized command substitution.
  
  In optimized command substitution, save and restore any variables changed by
  expansions (${var=value} and $((var=assigned))), instead of trying to
  determine if an expansion may cause such changes.
  
  If $! is referenced in optimized command substitution, do not cause jobs to
  be remembered longer.
  
  This fixes $(jobs $!) again, simplifies the man page and shortens the code.

Modified:
  head/bin/sh/eval.c
  head/bin/sh/expand.c
  head/bin/sh/expand.h
  head/bin/sh/jobs.c
  head/bin/sh/sh.1
  head/bin/sh/var.c
  head/bin/sh/var.h

Modified: head/bin/sh/eval.c
==
--- head/bin/sh/eval.c  Sun Jun 12 22:47:04 2011(r223023)
+++ head/bin/sh/eval.c  Sun Jun 12 23:06:04 2011(r223024)
@@ -571,14 +571,8 @@ evalpipe(union node *n)
 static int
 is_valid_fast_cmdsubst(union node *n)
 {
-   union node *argp;
 
-   if (n->type != NCMD)
-   return 0;
-   for (argp = n->ncmd.args ; argp ; argp = argp->narg.next)
-   if (expandhassideeffects(argp->narg.text))
-   return 0;
-   return 1;
+   return (n->type == NCMD);
 }
 
 /*
@@ -596,6 +590,7 @@ evalbackcmd(union node *n, struct backcm
struct stackmark smark; /* unnecessary */
struct jmploc jmploc;
struct jmploc *savehandler;
+   struct localvar *savelocalvars;
 
setstackmark(&smark);
result->fd = -1;
@@ -608,12 +603,18 @@ evalbackcmd(union node *n, struct backcm
}
if (is_valid_fast_cmdsubst(n)) {
exitstatus = oexitstatus;
+   savelocalvars = localvars;
+   localvars = NULL;
+   forcelocal++;
savehandler = handler;
if (setjmp(jmploc.loc)) {
if (exception == EXERROR || exception == EXEXEC)
exitstatus = 2;
else if (exception != 0) {
handler = savehandler;
+   forcelocal--;
+   poplocalvars();
+   localvars = savelocalvars;
longjmp(handler->loc, 1);
}
} else {
@@ -621,6 +622,9 @@ evalbackcmd(union node *n, struct backcm
evalcommand(n, EV_BACKCMD, result);
}
handler = savehandler;
+   forcelocal--;
+   poplocalvars();
+   localvars = savelocalvars;
} else {
exitstatus = 0;
if (pipe(pip) < 0)

Modified: head/bin/sh/expand.c
==
--- head/bin/sh/expand.cSun Jun 12 22:47:04 2011(r223023)
+++ head/bin/sh/expand.cSun Jun 12 23:06:04 2011(r223024)
@@ -1621,78 +1621,6 @@ cvtnum(int num, char *buf)
 }
 
 /*
- * Check statically if expanding a string may have side effects.
- */
-int
-expandhassideeffects(const char *p)
-{
-   int c;
-   int arinest;
-
-   arinest = 0;
-   while ((c = *p++) != '\0') {
-   switch (c) {
-   case CTLESC:
-   p++;
-   break;
-   case CTLVAR:
-   c = *p++;
-   /* Expanding $! sets the job to remembered. */
-   if (*p == '!')
-   return 1;
-   if ((c & VSTYPE) == VSASSIGN)
-   return 1;
-   /*
-* If we are in arithmetic, the parameter may contain
-* '=' which may cause side effects. Exceptions are
-* the length of a parameter and $$, $# and $? which
-* are always numeric.
-*/
-   if ((c & VSTYPE) == VSLENGTH) {
-   while (*p != '=')
-   p++;
-   p++;
-   break;
-   }
-   if ((*p == '$' || *p == '#' || *p == '?') &&
-   p[1] == '=') {
-   p += 2;
-   break;
-   }
-   if (arinest > 0)
-   return 1;
-   break;
-   case CTLBACKQ:
-   case CTLBACKQ | CTLQUOTE:
-   if (arinest > 0)
-   return 1;
-   break;
-   case CTLARI:
-   arinest++;
- 

Re: svn commit: r222980 - in head/sys: amd64/conf i386/conf

2011-06-12 Thread Warner Losh

On Jun 12, 2011, at 8:46 AM, Daniel O'Connor wrote:
> On 12/06/2011, at 20:51, Alexey Dokuchaev wrote:
>>> I think trasz@ tried that and there is a problem. Loading modules on
>>> boot is very slow. If you try to load everything that GENERIC has as
>>> modules the boot will take forever.
>> 
>> Perhaps then we need to come up with something more intelligent, i.e. do not
>> load everything trying to get maximum coverage of users' hardware, but
>> load only required bits based on what we see on PCI bus (roughly speaking).
> 
> Now the tricky part is extracting supported device IDs from drivers in an 
> automatic fashion :)
> 
> I imagine some symbol magic could be done for the general case so a tool 
> could extract the IDs & the bus type (so it could work for PCI & USB which 
> covers about 99.9% of the hardware in question).
> 
> ISTR there a few modules which call some blob to determine if the module is 
> supported but I think it's quite rare (the 80/20 rule works for me here :)

I've looked into this extensively.  usb comes the closest right now, since 
nearly all of its drivers use the right interface to match driver to device.  
There is a standard structure people use.  However, even it is impossible to 
extract this data in a reliable automated fashion.  Ideally, these tables would 
move to their own section which could then be extracted by a tool to see when 
to load it.  This section would also need some additional metadata in it so we 
know how to interpret the section.

The situation with the PCI bus is much less uniform.  While many drivers have 
tables, these tables are all ad-hoc.  There's no standard structure so 
everybody invents their own.  In addition to annotating the tables, you'd have 
to regularize them all across all pci drivers.  Doing this for 100+ drivers is 
a bit tedious.  Also, there are at least two cases where we have to load two 
drivers to be sure that one of them attaches because there's matching done 
outside of the normal plug and play identifiers (eg 
vendor/device/function/subvendor/subdevice) in their probe routines.

PC Card has also had the standard structure and interface for many years.  When 
I tried to move this to PCI many years ago, I encountered a lot of resistance 
that didn't make sense to me at the time (so I can't do it justice now).  This 
should tell you how long the problem has languished.  It was the primary 
motivator behind writing devd, but the pci resistance lead me to put aside the 
problem for a while.  I'll be happy to pick it back up, especially if I can get 
some help going through all the drivers and tagging things appropriately.

Warner___
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: cvs commit: src Makefile.inc1 src/lib/libc Makefile src/lib/libc_r Makefile src/lib/libpthread Makefile pthread.map src/lib/libpthread/thread thr_private.h src/lib/librt Makefile s

2011-06-12 Thread Bjoern A. Zeeb

On Sun, 13 May 2007, Daniel Eischen wrote:


deischen2007-05-13 14:12:41 UTC

 FreeBSD src repository

 Modified files:
   .Makefile.inc1
   lib/libc Makefile
   lib/libc_r   Makefile
   lib/libpthread   Makefile pthread.map
   lib/libpthread/thread thr_private.h
   lib/librtMakefile
   lib/libthr   Makefile pthread.map
   lib/libthread_db Makefile
   lib/msun Makefile
   libexec/rtld-elf Makefile
   share/mk bsd.lib.mk bsd.libnames.mk bsd.own.mk
bsd.symver.mk
 Log:
 Enable symbol versioning by default.  Use WITHOUT_SYMVER to disable it.
 Warning, after symbol versioning is enabled, going back is not easy
 (use WITHOUT_SYMVER at your own risk).

 Change the default thread library to libthr.

 There most likely still needs to be a version bump for at least the
 thread libraries.  If necessary, this will happen later.


http://svnweb.freebsd.org/base?view=revision&revision=169524

I figured WITHOUT_SYMVER= hs been useless since 201001.  I am no
longer able to do build worlds with WITHOUT_SYMVER= set in src.conf
on a system with symbol versioning.

I'd love someone to fix that and allow us to build libraries without
all the historic stuff in them.  If we cannot get it back working our
libraries will grow bigger and bigger forever.

If one is building images for clean-state systems that will never run
anything older than the current CURRENT build, there is no need for
the extra size.   Contrary to what people think, memory and direct
attached storage can still be expensive in some environments.

Anyone who understands the system can come up with patches to fix this?

/bz

--
Bjoern A. Zeeb You have to have visions!
 Stop bit received. Insert coin for new address family.
___
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: r223020 - in head/sys/ufs: ffs ufs

2011-06-12 Thread Dimitry Andric

On 2011-06-12 21:27, Kirk McKusick wrote:

Author: mckusick
Date: Sun Jun 12 19:27:05 2011
New Revision: 223020
URL: http://svn.freebsd.org/changeset/base/223020

...

Modified: head/sys/ufs/ffs/ffs_extern.h
==
--- head/sys/ufs/ffs/ffs_extern.h   Sun Jun 12 18:52:39 2011
(r223019)
+++ head/sys/ufs/ffs/ffs_extern.h   Sun Jun 12 19:27:05 2011
(r223020)

...

@@ -161,4 +166,14 @@ void   softdep_journal_fsync(struct inode

  int   ffs_rdonly(struct inode *);

+TAILQ_HEAD(snaphead, inode);
+
+struct snapdata {
+   LIST_ENTRY(snapdata) sn_link;
+   struct snaphead sn_head;
+   daddr_t sn_listsize;
+   daddr_t *sn_blklist;
+   struct lock sn_lock;
+};
+
  #endif /* !_UFS_FFS_EXTERN_H */


This addition breaks world compilation in usr.sbin/makefs, apparently
because the TAILQ_HEAD macro isn't defined at that point:

...
cc -O2 -pipe  -I/usr/src/usr.sbin/makefs 
-I/usr/src/usr.sbin/makefs/../../sys/fs/cd9660/ 
-I/usr/src/usr.sbin/makefs/../../sys/ufs/ffs -I/usr/src/usr.sbin/makefs/compat 
-DHAVE_STRUCT_STAT_ST_FLAGS=1 -DHAVE_STRUCT_STAT_ST_GEN=1 
-I/usr/src/usr.sbin/makefs/../mtree -std=gnu99 -fstack-protector 
-Wsystem-headers -Werror -Wall -Wno-format-y2k -Wno-uninitialized 
-Wno-pointer-sign -c /usr/src/usr.sbin/makefs/ffs/ffs_bswap.c
cc1: warnings being treated as errors
In file included from /usr/src/usr.sbin/makefs/ffs/ffs_bswap.c:51:
/usr/obj/usr/src/tmp/usr/include/ufs/ffs/ffs_extern.h:169: warning: data 
definition has no type or storage class
/usr/obj/usr/src/tmp/usr/include/ufs/ffs/ffs_extern.h:169: warning: parameter 
names (without types) in function declaration
/usr/obj/usr/src/tmp/usr/include/ufs/ffs/ffs_extern.h:172: error: expected 
specifier-qualifier-list before 'LIST_ENTRY'
*** Error code 1

Stop in /usr/src/usr.sbin/makefs.
___
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: r222980 - in head/sys: amd64/conf i386/conf

2011-06-12 Thread Warner Losh

On Jun 12, 2011, at 5:21 AM, Alexey Dokuchaev wrote:

> On Sat, Jun 11, 2011 at 08:51:32PM +0200, Pawel Jakub Dawidek wrote:
>> On Sat, Jun 11, 2011 at 10:44:14AM -0600, Warner Losh wrote:
>>> I think our best bet for 9 is to strip GENERIC to the bone and have a
>>> 'generic.conf' if you will that loads everything we compile in today.
>> 
>> I think trasz@ tried that and there is a problem. Loading modules on
>> boot is very slow. If you try to load everything that GENERIC has as
>> modules the boot will take forever.
> 
> Perhaps then we need to come up with something more intelligent, i.e. do not
> load everything trying to get maximum coverage of users' hardware, but
> load only required bits based on what we see on PCI bus (roughly speaking).

Yea.  Good luck with that.  I had that idea like 4 or 5 years ago.  However, 
there's a lot of grunt work to do on all the drivers in the system to get them 
into good enough shape to export their PCI ID lists in a uniform way so we 
could automatically do the right thing.

This isn't a 9.x item, but it could easily be a 10.x item.

Warner___
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: r223020 - in head/sys/ufs: ffs ufs

2011-06-12 Thread Kirk McKusick
Author: mckusick
Date: Sun Jun 12 19:27:05 2011
New Revision: 223020
URL: http://svn.freebsd.org/changeset/base/223020

Log:
  Update to soft updates journaling to properly track freed blocks
  that get claimed by snapshots.
  
  Submitted by: Jeff Roberson
  Tested by:Peter Holm

Modified:
  head/sys/ufs/ffs/ffs_alloc.c
  head/sys/ufs/ffs/ffs_extern.h
  head/sys/ufs/ffs/ffs_snapshot.c
  head/sys/ufs/ffs/ffs_softdep.c
  head/sys/ufs/ufs/ufs_vnops.c

Modified: head/sys/ufs/ffs/ffs_alloc.c
==
--- head/sys/ufs/ffs/ffs_alloc.cSun Jun 12 18:52:39 2011
(r223019)
+++ head/sys/ufs/ffs/ffs_alloc.cSun Jun 12 19:27:05 2011
(r223020)
@@ -2035,7 +2035,7 @@ ffs_blkfree(ump, fs, devvp, bno, size, i
 */
if (devvp->v_type != VREG &&
(devvp->v_vflag & VV_COPYONWRITE) &&
-   ffs_snapblkfree(fs, devvp, bno, size, inum)) {
+   ffs_snapblkfree(fs, devvp, bno, size, inum, dephd)) {
return;
}
if (!ump->um_candelete) {

Modified: head/sys/ufs/ffs/ffs_extern.h
==
--- head/sys/ufs/ffs/ffs_extern.h   Sun Jun 12 18:52:39 2011
(r223019)
+++ head/sys/ufs/ffs/ffs_extern.h   Sun Jun 12 19:27:05 2011
(r223020)
@@ -80,12 +80,14 @@ int ffs_realloccg(struct inode *, ufs2_d
ufs2_daddr_t, int, int, int, struct ucred *, struct buf **);
 intffs_sbupdate(struct ufsmount *, int, int);
 void   ffs_setblock(struct fs *, u_char *, ufs1_daddr_t);
-intffs_snapblkfree(struct fs *, struct vnode *, ufs2_daddr_t, long, ino_t);
+intffs_snapblkfree(struct fs *, struct vnode *, ufs2_daddr_t, long, ino_t,
+   struct workhead *);
 void   ffs_snapremove(struct vnode *vp);
 intffs_snapshot(struct mount *mp, char *snapfile);
 void   ffs_snapshot_mount(struct mount *mp);
 void   ffs_snapshot_unmount(struct mount *mp);
 void   process_deferred_inactive(struct mount *mp);
+void   ffs_sync_snap(struct mount *, int);
 intffs_syncvnode(struct vnode *vp, int waitfor);
 intffs_truncate(struct vnode *, off_t, int, struct ucred *, struct thread 
*);
 intffs_update(struct vnode *, int);
@@ -149,6 +151,9 @@ int softdep_prealloc(struct vnode *, int
 intsoftdep_journal_lookup(struct mount *, struct vnode **);
 void   softdep_journal_freeblocks(struct inode *, struct ucred *, off_t, int);
 void   softdep_journal_fsync(struct inode *);
+void   softdep_buf_append(struct buf *, struct workhead *);
+void   softdep_inode_append(struct inode *, struct ucred *, struct workhead *);
+void   softdep_freework(struct workhead *);
 
 
 /*
@@ -161,4 +166,14 @@ void   softdep_journal_fsync(struct inode 
 
 intffs_rdonly(struct inode *);
 
+TAILQ_HEAD(snaphead, inode);
+
+struct snapdata {
+   LIST_ENTRY(snapdata) sn_link;
+   struct snaphead sn_head;
+   daddr_t sn_listsize;
+   daddr_t *sn_blklist;
+   struct lock sn_lock;
+};
+
 #endif /* !_UFS_FFS_EXTERN_H */

Modified: head/sys/ufs/ffs/ffs_snapshot.c
==
--- head/sys/ufs/ffs/ffs_snapshot.c Sun Jun 12 18:52:39 2011
(r223019)
+++ head/sys/ufs/ffs/ffs_snapshot.c Sun Jun 12 19:27:05 2011
(r223020)
@@ -81,12 +81,13 @@ ffs_snapshot(mp, snapfile)
 }
 
 int
-ffs_snapblkfree(fs, devvp, bno, size, inum)
+ffs_snapblkfree(fs, devvp, bno, size, inum, wkhd)
struct fs *fs;
struct vnode *devvp;
ufs2_daddr_t bno;
long size;
ino_t inum;
+   struct workhead *wkhd;
 {
return (EINVAL);
 }
@@ -123,19 +124,16 @@ ffs_copyonwrite(devvp, bp)
return (EINVAL);
 }
 
+void
+ffs_sync_snap(mp, waitfor)
+   struct mount *mp;
+   int waitfor;
+{
+}
+
 #else
 FEATURE(ffs_snapshot, "FFS snapshot support");
 
-TAILQ_HEAD(snaphead, inode);
-
-struct snapdata {
-   LIST_ENTRY(snapdata) sn_link;
-   struct snaphead sn_head;
-   daddr_t sn_listsize;
-   daddr_t *sn_blklist;
-   struct lock sn_lock;
-};
-
 LIST_HEAD(, snapdata) snapfree;
 static struct mtx snapfree_lock;
 MTX_SYSINIT(ffs_snapfree, &snapfree_lock, "snapdata free list", MTX_DEF);
@@ -1635,7 +1633,7 @@ ffs_snapremove(vp)
DIP_SET(ip, i_db[blkno], 0);
else if ((dblk == blkstofrags(fs, blkno) &&
 ffs_snapblkfree(fs, ip->i_devvp, dblk, fs->fs_bsize,
-ip->i_number))) {
+ip->i_number, NULL))) {
DIP_SET(ip, i_blocks, DIP(ip, i_blocks) -
btodb(fs->fs_bsize));
DIP_SET(ip, i_db[blkno], 0);
@@ -1660,7 +1658,7 @@ ffs_snapremove(vp)
((ufs1_daddr_t *)(ibp->b_data))[loc]= 0;
else if ((dblk == blkstofrags(fs, blkno) &&
   

Re: svn commit: r222980 - in head/sys: amd64/conf i386/conf

2011-06-12 Thread Doug Barton

On 6/12/2011 4:16 AM, Alexey Dokuchaev wrote:

On Sat, Jun 11, 2011 at 01:55:15PM -0700, Doug Barton wrote:

I have 3 or 4 modules loaded via loader.conf at boot time. They take at
least 2 seconds each. IMO loading everything via loader.conf would slow
the boot so much as to be a non-starter.


With my normal slim kernel with most of the modules loaded via loader.conf
(other few loaded later in runtime) I have this:

$ kldstat | wc -l
   60

I do not observe noticeable difference compared to GENERIC kernel.


Try the script I posted to -current and see how it goes for you.


Plus, users try to reboot their machines as rarely as possible, no?


A) Arguing from anecdote
B) I realize desktop is not a priority for us, but desktop users 
generally reboot much more frequently (usually daily for me).
C) For those times that you do need to reboot a system, why add minutes 
to the boot without reason?


I mentioned the problem, and proposed a solution for it ... I'm asking 
people to test the solution I proposed.



Doug

--

Nothin' ever doesn't change, but nothin' changes much.
-- OK Go

Breadth of IT experience, and depth of knowledge in the DNS.
Yours for the right price.  :)  http://SupersetSolutions.com/

___
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: r223019 - head/sys/cam/ata

2011-06-12 Thread Alexander Motin
Author: mav
Date: Sun Jun 12 18:52:39 2011
New Revision: 223019
URL: http://svn.freebsd.org/changeset/base/223019

Log:
  Do not report CFA devices as ATAPI, even though IDENTIFY data look alike.

Modified:
  head/sys/cam/ata/ata_all.c
  head/sys/cam/ata/ata_xpt.c

Modified: head/sys/cam/ata/ata_all.c
==
--- head/sys/cam/ata/ata_all.c  Sun Jun 12 18:46:48 2011(r223018)
+++ head/sys/cam/ata/ata_all.c  Sun Jun 12 18:52:39 2011(r223019)
@@ -270,6 +270,7 @@ ata_print_ident(struct ata_params *ident
   sizeof(revision));
printf("<%s %s> %s-%d",
product, revision,
+   (ident_data->config == ATA_PROTO_CFA) ? "CFA" :
(ident_data->config & ATA_PROTO_ATAPI) ? "ATAPI" : "ATA",
ata_version(ident_data->version_major));
if (ident_data->satacapabilities && ident_data->satacapabilities != 
0x) {

Modified: head/sys/cam/ata/ata_xpt.c
==
--- head/sys/cam/ata/ata_xpt.c  Sun Jun 12 18:46:48 2011(r223018)
+++ head/sys/cam/ata/ata_xpt.c  Sun Jun 12 18:52:39 2011(r223019)
@@ -1583,12 +1583,14 @@ ata_device_transport(struct cam_path *pa
cts.proto_specific.valid = 0;
if (ident_buf) {
if (path->device->transport == XPORT_ATA) {
-   cts.xport_specific.ata.atapi = 
+   cts.xport_specific.ata.atapi =
+   (ident_buf->config == ATA_PROTO_CFA) ? 0 :
((ident_buf->config & ATA_PROTO_MASK) == 
ATA_PROTO_ATAPI_16) ? 16 :
((ident_buf->config & ATA_PROTO_MASK) == 
ATA_PROTO_ATAPI_12) ? 12 : 0;
cts.xport_specific.ata.valid = CTS_ATA_VALID_ATAPI;
} else {
-   cts.xport_specific.sata.atapi = 
+   cts.xport_specific.sata.atapi =
+   (ident_buf->config == ATA_PROTO_CFA) ? 0 :
((ident_buf->config & ATA_PROTO_MASK) == 
ATA_PROTO_ATAPI_16) ? 16 :
((ident_buf->config & ATA_PROTO_MASK) == 
ATA_PROTO_ATAPI_12) ? 12 : 0;
cts.xport_specific.sata.valid = CTS_SATA_VALID_ATAPI;
@@ -1638,7 +1640,9 @@ ata_action(union ccb *start_ccb)
uint16_t p =
device->ident_data.config & ATA_PROTO_MASK;
 
-   maxlen = (p == ATA_PROTO_ATAPI_16) ? 16 :
+   maxlen =
+   (device->ident_data.config == ATA_PROTO_CFA) ? 0 :
+   (p == ATA_PROTO_ATAPI_16) ? 16 :
(p == ATA_PROTO_ATAPI_12) ? 12 : 0;
}
if (start_ccb->csio.cdb_len > maxlen) {
___
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: r223018 - head/sys/ufs/ffs

2011-06-12 Thread Kirk McKusick
Author: mckusick
Date: Sun Jun 12 18:46:48 2011
New Revision: 223018
URL: http://svn.freebsd.org/changeset/base/223018

Log:
  Disable the soft updates journaling after a filesystem is successfully
  downgraded to read-only. It will be restarted if the filesystem is
  upgraded back to read-write.

Modified:
  head/sys/ufs/ffs/ffs_softdep.c
  head/sys/ufs/ffs/ffs_vfsops.c

Modified: head/sys/ufs/ffs/ffs_softdep.c
==
--- head/sys/ufs/ffs/ffs_softdep.c  Sun Jun 12 18:01:31 2011
(r223017)
+++ head/sys/ufs/ffs/ffs_softdep.c  Sun Jun 12 18:46:48 2011
(r223018)
@@ -2386,8 +2386,15 @@ softdep_unmount(mp)
struct mount *mp;
 {
 
-   if (mp->mnt_kern_flag & MNTK_SUJ)
-   journal_unmount(mp);
+   MNT_ILOCK(mp);
+   mp->mnt_flag &= ~MNT_SOFTDEP;
+   if ((mp->mnt_kern_flag & MNTK_SUJ) == 0) {
+   MNT_IUNLOCK(mp);
+   return;
+   }
+   mp->mnt_kern_flag &= ~MNTK_SUJ;
+   MNT_IUNLOCK(mp);
+   journal_unmount(mp);
 }
 
 struct jblocks {

Modified: head/sys/ufs/ffs/ffs_vfsops.c
==
--- head/sys/ufs/ffs/ffs_vfsops.c   Sun Jun 12 18:01:31 2011
(r223017)
+++ head/sys/ufs/ffs/ffs_vfsops.c   Sun Jun 12 18:46:48 2011
(r223018)
@@ -269,6 +269,8 @@ ffs_mount(struct mount *mp)
vfs_write_resume(mp);
return (error);
}
+   if (mp->mnt_flag & MNT_SOFTDEP)
+   softdep_unmount(mp);
DROP_GIANT();
g_topology_lock();
g_access(ump->um_cp, 0, -1, 0);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2011-06-12 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Sun Jun 12 15:19:38 2011
New Revision: 223012
URL: http://svn.freebsd.org/changeset/base/223012

Log:
  I forgot what year it is, apparently.
  
  Submitted by: brucec

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

Modified: head/usr.sbin/bsdinstall/bsdinstall.8
==
--- head/usr.sbin/bsdinstall/bsdinstall.8   Sun Jun 12 12:55:46 2011
(r223011)
+++ head/usr.sbin/bsdinstall/bsdinstall.8   Sun Jun 12 15:19:38 2011
(r223012)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 11, 2010
+.Dd June 11, 2011
 .Dt bsdinstall 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: r222980 - in head/sys: amd64/conf i386/conf

2011-06-12 Thread Daniel O'Connor

On 12/06/2011, at 20:51, Alexey Dokuchaev wrote:
>> I think trasz@ tried that and there is a problem. Loading modules on
>> boot is very slow. If you try to load everything that GENERIC has as
>> modules the boot will take forever.
> 
> Perhaps then we need to come up with something more intelligent, i.e. do not
> load everything trying to get maximum coverage of users' hardware, but
> load only required bits based on what we see on PCI bus (roughly speaking).

Now the tricky part is extracting supported device IDs from drivers in an 
automatic fashion :)

I imagine some symbol magic could be done for the general case so a tool could 
extract the IDs & the bus type (so it could work for PCI & USB which covers 
about 99.9% of the hardware in question).

ISTR there a few modules which call some blob to determine if the module is 
supported but I think it's quite rare (the 80/20 rule works for me here :)

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C






___
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: r223011 - head/tools/regression/bin/sh/builtins

2011-06-12 Thread Jilles Tjoelker
Author: jilles
Date: Sun Jun 12 12:55:46 2011
New Revision: 223011
URL: http://svn.freebsd.org/changeset/base/223011

Log:
  sh: Add test for LC_COLLATE-based character ranges in case.

Added:
  head/tools/regression/bin/sh/builtins/case7.0   (contents, props changed)

Added: head/tools/regression/bin/sh/builtins/case7.0
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/bin/sh/builtins/case7.0   Sun Jun 12 12:55:46 
2011(r223011)
@@ -0,0 +1,24 @@
+# $FreeBSD$
+
+# Character ranges in a locale other than the POSIX locale, not specified
+# by POSIX.
+
+unset LC_ALL
+LC_CTYPE=de_DE.ISO8859-1
+export LC_CTYPE
+LC_COLLATE=de_DE.ISO8859-1
+export LC_COLLATE
+
+c1=e
+# o umlaut
+c2=$(printf '\366')
+
+case $c1$c2 in
+[a-z][a-z]) ;;
+*) echo wrong at $LINENO ;;
+esac
+
+case $c1$c2 in
+[a-f][n-p]) ;;
+*) echo wrong at $LINENO ;;
+esac
___
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: r223010 - head/bin/sh

2011-06-12 Thread Jilles Tjoelker
Author: jilles
Date: Sun Jun 12 12:54:52 2011
New Revision: 223010
URL: http://svn.freebsd.org/changeset/base/223010

Log:
  sh: Fix locale-dependent ranges in bracket expressions.
  
  When I added UTF-8 support in r221646, the LC_COLLATE-based ordering broke
  because of sign extension of char.
  
  Because of libc restrictions, this does not work for UTF-8. For UTF-8
  locales, ranges always use character code order.

Modified:
  head/bin/sh/expand.c

Modified: head/bin/sh/expand.c
==
--- head/bin/sh/expand.cSun Jun 12 12:51:58 2011(r223009)
+++ head/bin/sh/expand.cSun Jun 12 12:54:52 2011(r223010)
@@ -1430,7 +1430,7 @@ patmatch(const char *pattern, const char
if (localeisutf8)
wc = get_wc(&q);
else
-   wc = *q++;
+   wc = (unsigned char)*q++;
if (wc == '\0')
return 0;
break;
@@ -1487,7 +1487,7 @@ patmatch(const char *pattern, const char
if (localeisutf8)
chr = get_wc(&q);
else
-   chr = *q++;
+   chr = (unsigned char)*q++;
if (chr == '\0')
return 0;
c = *p++;
@@ -1502,7 +1502,7 @@ patmatch(const char *pattern, const char
if (wc == 0) /* bad utf-8 */
return 0;
} else
-   wc = c;
+   wc = (unsigned char)c;
if (*p == '-' && p[1] != ']') {
p++;
while (*p == CTLQUOTEMARK)
@@ -1514,7 +1514,7 @@ patmatch(const char *pattern, const char
if (wc2 == 0) /* bad utf-8 */
return 0;
} else
-   wc2 = *p++;
+   wc2 = (unsigned char)*p++;
if (   collate_range_cmp(chr, wc) >= 0
&& collate_range_cmp(chr, wc2) <= 0
   )
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r223009 - head/usr.bin/grep

2011-06-12 Thread Gabor Kovesdan
Author: gabor
Date: Sun Jun 12 12:51:58 2011
New Revision: 223009
URL: http://svn.freebsd.org/changeset/base/223009

Log:
  - Use REG_NOSUB to bypass submatch counting when not necessary. This may
yield in somewhat better performance in a few cases.
  
  Approved by:  delphij (mentor)

Modified:
  head/usr.bin/grep/grep.c
  head/usr.bin/grep/util.c

Modified: head/usr.bin/grep/grep.c
==
--- head/usr.bin/grep/grep.cSun Jun 12 12:44:02 2011(r223008)
+++ head/usr.bin/grep/grep.cSun Jun 12 12:51:58 2011(r223009)
@@ -73,7 +73,7 @@ const char*errstr[] = {
 };
 
 /* Flags passed to regcomp() and regexec() */
-int cflags = 0;
+int cflags = REG_NOSUB;
 int eflags = REG_STARTEND;
 
 /* Shortcut for matching all cases like empty regex */
@@ -519,6 +519,7 @@ main(int argc, char *argv[])
break;
case 'o':
oflag = true;
+   cflags &= ~REG_NOSUB;
break;
case 'p':
linkbehave = LINK_SKIP;
@@ -552,9 +553,11 @@ main(int argc, char *argv[])
break;
case 'w':
wflag = true;
+   cflags &= ~REG_NOSUB;
break;
case 'x':
xflag = true;
+   cflags &= ~REG_NOSUB;
break;
case 'Z':
filebehave = FILE_GZIP;
@@ -588,6 +591,7 @@ main(int argc, char *argv[])
strcasecmp("none", optarg) != 0 &&
strcasecmp("no", optarg) != 0)
errx(2, getstr(3), "--color");
+   cflags &= ~REG_NOSUB;
break;
case LABEL_OPT:
label = optarg;

Modified: head/usr.bin/grep/util.c
==
--- head/usr.bin/grep/util.cSun Jun 12 12:44:02 2011(r223008)
+++ head/usr.bin/grep/util.cSun Jun 12 12:51:58 2011(r223009)
@@ -309,7 +309,9 @@ procline(struct str *l, int nottext)
r = regexec(&r_pattern[i], l->dat, 1,
&pmatch, eflags);
r = (r == 0) ? 0 : REG_NOMATCH;
-   st = pmatch.rm_eo;
+   st = (cflags & REG_NOSUB)
+   ? (size_t)l->len
+   : (size_t)pmatch.rm_eo;
if (r == REG_NOMATCH)
continue;
/* Check for full match */
___
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: r223008 - head/usr.bin/grep

2011-06-12 Thread Gabor Kovesdan
Author: gabor
Date: Sun Jun 12 12:44:02 2011
New Revision: 223008
URL: http://svn.freebsd.org/changeset/base/223008

Log:
  - Fix -w behavior
  - Make -F and -w work together
  - Fix --color to colorize all of the matches
  
  PR:   bin/156826
  Submitted by: Yuri Pankov 
  Approved by:  delphij (mentor)

Modified:
  head/usr.bin/grep/fastgrep.c
  head/usr.bin/grep/util.c

Modified: head/usr.bin/grep/fastgrep.c
==
--- head/usr.bin/grep/fastgrep.cSun Jun 12 12:27:17 2011
(r223007)
+++ head/usr.bin/grep/fastgrep.cSun Jun 12 12:44:02 2011
(r223008)
@@ -89,7 +89,7 @@ fastcomp(fastgrep_t *fg, const char *pat
fg->bol = false;
fg->eol = false;
fg->reversed = false;
-   fg->word = wflag;
+   fg->word = false;
 
/* Remove end-of-line character ('$'). */
if (fg->len > 0 && pat[fg->len - 1] == '$') {

Modified: head/usr.bin/grep/util.c
==
--- head/usr.bin/grep/util.cSun Jun 12 12:27:17 2011(r223007)
+++ head/usr.bin/grep/util.cSun Jun 12 12:44:02 2011(r223008)
@@ -301,18 +301,15 @@ procline(struct str *l, int nottext)
  * XXX: grep_search() is a workaround for speed up and should be
  * removed in the future.  See fastgrep.c.
  */
-   if (fg_pattern[i].pattern) {
+   if (fg_pattern[i].pattern)
r = grep_search(&fg_pattern[i],
(unsigned char *)l->dat,
l->len, &pmatch);
-   r = (r == 0) ? 0 : REG_NOMATCH;
-   st = pmatch.rm_eo;
-   } else {
+   else
r = regexec(&r_pattern[i], l->dat, 1,
&pmatch, eflags);
-   r = (r == 0) ? 0 : REG_NOMATCH;
-   st = pmatch.rm_eo;
-   }
+   r = (r == 0) ? 0 : REG_NOMATCH;
+   st = pmatch.rm_eo;
if (r == REG_NOMATCH)
continue;
/* Check for full match */
@@ -321,8 +318,7 @@ procline(struct str *l, int nottext)
(size_t)pmatch.rm_eo != l->len)
r = REG_NOMATCH;
/* Check for whole word match */
-   if (r == 0 && fg_pattern[i].word &&
-   pmatch.rm_so != 0) {
+   if (r == 0 && (wflag || fg_pattern[i].word)) {
wint_t wbegin, wend;
 
wbegin = wend = L' ';
@@ -330,11 +326,13 @@ procline(struct str *l, int nottext)
sscanf(&l->dat[pmatch.rm_so - 1],
"%lc", &wbegin) != 1)
r = REG_NOMATCH;
-   else if ((size_t)pmatch.rm_eo != l->len 
&&
+   else if ((size_t)pmatch.rm_eo !=
+   l->len &&
sscanf(&l->dat[pmatch.rm_eo],
"%lc", &wend) != 1)
r = REG_NOMATCH;
-   else if (iswword(wbegin) || 
iswword(wend))
+   else if (iswword(wbegin) ||
+   iswword(wend))
r = REG_NOMATCH;
}
if (r == 0) {
@@ -343,7 +341,8 @@ procline(struct str *l, int nottext)
if (m < MAX_LINE_MATCHES)
matches[m++] = pmatch;
/* matches - skip further patterns */
-   if ((color != NULL && !oflag) || qflag 
|| lflag)
+   if ((color == NULL && !oflag) ||
+   qflag || lflag)
break;
}
}
@@ -353,7 +352,7 @@ procline(struct str *l, int nottext)
break;
}
/* One pass if we are not recording matches */
-   if ((color != NULL && !of

svn commit: r223007 - head/tools/regression/bin/sh/builtins

2011-06-12 Thread Jilles Tjoelker
Author: jilles
Date: Sun Jun 12 12:27:17 2011
New Revision: 223007
URL: http://svn.freebsd.org/changeset/base/223007

Log:
  sh: Add test for case pattern matching with iso-8859-1 charset.
  
  This also passes on stable/8.

Added:
  head/tools/regression/bin/sh/builtins/case6.0   (contents, props changed)

Added: head/tools/regression/bin/sh/builtins/case6.0
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/bin/sh/builtins/case6.0   Sun Jun 12 12:27:17 
2011(r223007)
@@ -0,0 +1,52 @@
+# $FreeBSD$
+
+unset LC_ALL
+LC_CTYPE=de_DE.ISO8859-1
+export LC_CTYPE
+
+c1=e
+# o umlaut
+c2=$(printf '\366')
+# non-break space
+c3=$(printf '\240')
+c4=$(printf '\240')
+# $c2$c3$c4 form one utf-8 character
+
+ok=0
+case $c1$c2$c3$c4 in
+*) ok=1 ;;
+esac
+if [ $ok = 0 ]; then
+   echo wrong at $LINENO
+   exit 3
+fi
+
+case $c1$c2$c3$c4 in
+$c1$c2$c3$c4) ;;
+*) echo wrong at $LINENO ;;
+esac
+
+case $c1$c2$c3$c4 in
+"$c1$c2$c3$c4") ;;
+*) echo wrong at $LINENO ;;
+esac
+
+case $c1$c2$c3$c4 in
+) ;;
+*) echo wrong at $LINENO ;;
+esac
+
+case $c1$c2$c3$c4 in
+[!$c2][!b][!c][!d]) ;;
+*) echo wrong at $LINENO ;;
+esac
+
+case $c1$c2$c3$c4 in
+[$c1][$c2][$c3][$c4]) ;;
+*) echo wrong at $LINENO ;;
+esac
+
+case $c1$c2$c3$c4 in
+["$c1"]["$c2"]["$c3"]["$c4"]) ;;
+*) echo wrong at $LINENO ;;
+esac
___
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: r222980 - in head/sys: amd64/conf i386/conf

2011-06-12 Thread Alexey Dokuchaev
On Sat, Jun 11, 2011 at 08:51:32PM +0200, Pawel Jakub Dawidek wrote:
> On Sat, Jun 11, 2011 at 10:44:14AM -0600, Warner Losh wrote:
> > I think our best bet for 9 is to strip GENERIC to the bone and have a
> > 'generic.conf' if you will that loads everything we compile in today.
> 
> I think trasz@ tried that and there is a problem. Loading modules on
> boot is very slow. If you try to load everything that GENERIC has as
> modules the boot will take forever.

Perhaps then we need to come up with something more intelligent, i.e. do not
load everything trying to get maximum coverage of users' hardware, but
load only required bits based on what we see on PCI bus (roughly speaking).

> On all my servers and my laptop I use such minimalistic kernels and load
> everything from modules.

Yes, this is very convenient and IMHO the way to go.  :-)

./danfe
___
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: r222980 - in head/sys: amd64/conf i386/conf

2011-06-12 Thread Alexey Dokuchaev
On Sat, Jun 11, 2011 at 01:55:15PM -0700, Doug Barton wrote:
> I have 3 or 4 modules loaded via loader.conf at boot time. They take at 
> least 2 seconds each. IMO loading everything via loader.conf would slow 
> the boot so much as to be a non-starter.

With my normal slim kernel with most of the modules loaded via loader.conf
(other few loaded later in runtime) I have this:

$ kldstat | wc -l
  60

I do not observe noticeable difference compared to GENERIC kernel.  Plus,
users try to reboot their machines as rarely as possible, no?

./danfe
___
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: r223005 - head/bin/sh

2011-06-12 Thread Jilles Tjoelker
Author: jilles
Date: Sun Jun 12 10:13:48 2011
New Revision: 223005
URL: http://svn.freebsd.org/changeset/base/223005

Log:
  sh: Read .profile from the home directory (or / if HOME is not set).
  
  In most cases, login shells are started from the home directory, but not in
  all, such as xterm -ls.
  
  This commit depends on r222957 for read_profile() performing parameter
  expansion.
  
  PR:   bin/50569

Modified:
  head/bin/sh/main.c

Modified: head/bin/sh/main.c
==
--- head/bin/sh/main.c  Sun Jun 12 09:18:48 2011(r223004)
+++ head/bin/sh/main.c  Sun Jun 12 10:13:48 2011(r223005)
@@ -150,7 +150,7 @@ main(int argc, char *argv[])
 state1:
state = 2;
if (privileged == 0)
-   read_profile(".profile");
+   read_profile("${HOME-}/.profile");
else
read_profile("/etc/suid_profile");
}
___
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: r222998 - head/usr.sbin/bsdinstall

2011-06-12 Thread Bruce Cran

On 11/06/2011 22:44, Nathan Whitehorn wrote:

Author: nwhitehorn
Date: Sat Jun 11 21:44:07 2011
New Revision: 222998
URL: http://svn.freebsd.org/changeset/base/222998

Log:
   Long-overdue man page for bsdinstall.




+.Dd June 11, 2010


I guess this should be 2011?

--
Bruce Cran
___
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"