Re: svn commit: r211023 - head/usr.sbin/syslogd

2010-08-09 Thread Bruce Evans

On Mon, 9 Aug 2010, Jilles Tjoelker wrote:



On Sun, Aug 08, 2010 at 03:36:08PM -0600, M. Warner Losh wrote:



The casting that syslogd does with struct sockaddrFOO is what triggers
it.  I'm not sure how to fix it, so there's about 6 or 8 programs in
the tree that have WARNS lowered to 3 because of it.


This problem is common with programs that use getaddrinfo() and then
look into the address family specific parts of the address (it was
probably not the intention of the getaddrinfo() API to do this very
often). Obviously, when ai_family is the corresponding value, the
ai_addr really points to that particular kind of sockaddr, but gcc only
knows that struct sockaddr_in and struct sockaddr_in6 have a higher
alignment requirement than struct sockaddr.


POSIX even standardized this broken (unimplementable in C) API.  AT
least in the old 2001 draft 7, it says that sockaddr_un shall include
much the same members that FreeBSD's version has, and that applications
shall access these in an even more broken way than by casting the
pointer: it says that the struct type sockaddr_un shall be cast to
struct access for use with the socket functions.  I don't even remember
seeing code so broken as to expect casting whole structs to an
incompatible type to work.  However, this is not completely
unimplementable -- it just requires the struct types to be compatible,
i.e., the same.  But the reason for existence of sockaddr_un is to have
the struct types not the same.  They are not the same in FreeBSD.  The
pointers can probably made compatible enough in practice by implementing
them in non-C using sufficient alignment and/or packing directives.
Without these, the alignment and packing for the structs could easily
end up incompatible due to gcc wanting to align the larger array of
char more than the smaller array of char, like it does for global
arrays of char.  ABIs may already prevent such extra alignment in
practice.


In some cases, the address may already be copied, and making the
destination the family-based type or struct sockaddr_storage (which has
a high alignment requirement) will avoid problems.

In other cases, I propose adding a cast to void * in between, like
 (struct sockaddr_in *)(void *)ai->ai_addr

Note that this workaround must not be applied mindlessly to avoid
-Wcast-align, but only when it is known from other information that the
object really has that type.


Of course it just breaks the warning.


If you don't like this workaround, perhaps copy the data to a variable
of the correct type. Addresses are not particularly big so the
performance hit should not be bad.

It is unfortunate to have to miss other warnings because of this.


Copying is just a fancier way of breaking the warning in this case.

I was thinking of packing and aligning everything in the struct to ensure
that the struct layouts are identical in their common part, but to just
break the warning in a way that is easy to undo, it might be enough to
declare the whole structs as __aligned(1).  The structs consist of
u_chars (sometimes spelled uint8_t and sometimes spelled char), so their
natural alignment is 1.  But I just remember that arm uses unnattural
alignment.  __aligned(4) might need to be used for it to preserve the ABI.
What is the struct layout for arm?

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


Re: svn commit: r211023 - head/usr.sbin/syslogd

2010-08-09 Thread Dag-Erling Smørgrav
Jilles Tjoelker  writes:
> In other cases, I propose adding a cast to void * in between, like
>   (struct sockaddr_in *)(void *)ai->ai_addr

Better to cast through uintptr_t.  Perhaps we should have a
__DECONST-like macro for this?

#define __ALIGNED_CAST(t, v) ((t)(uintptr_t)(v))

DES
-- 
Dag-Erling Smørgrav - d...@des.no
___
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: r211094 - head/games/fortune/datfiles

2010-08-09 Thread Max Khon
Author: fjoe
Date: Mon Aug  9 09:26:17 2010
New Revision: 211094
URL: http://svn.freebsd.org/changeset/base/211094

Log:
  "whereis netscape" gives empty output for quite a long time already.
  Suggest to use "whereis firefox" instead.

Modified:
  head/games/fortune/datfiles/freebsd-tips

Modified: head/games/fortune/datfiles/freebsd-tips
==
--- head/games/fortune/datfiles/freebsd-tipsMon Aug  9 08:41:29 2010
(r211093)
+++ head/games/fortune/datfiles/freebsd-tipsMon Aug  9 09:26:17 2010
(r211094)
@@ -476,6 +476,6 @@ You can use "whereis" to search standard
 directories for the specified programs. This can be particularly handy
 when you are trying to find where in the ports tree an application is.
 
-Try "whereis netscape" and "whereis whereis".
+Try "whereis firefox" and "whereis whereis".
-- Konstantinos Konstantinidis 
 %
___
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: r208165 - in head/sys: kern mips/conf mips/include mips/mips mips/rmi mips/rmi/dev/xlr

2010-08-09 Thread Attilio Rao
2010/8/9 Jayachandran C. :
> On Mon, Aug 9, 2010 at 5:31 AM, Attilio Rao  wrote:
>> 2010/5/16 Randall Stewart :
>>> Author: rrs
>>> Date: Sun May 16 19:43:48 2010
>>> New Revision: 208165
>>> URL: http://svn.freebsd.org/changeset/base/208165
>>>
>>> Log:
>>>  This pushes all of JC's patches that I have in place. I
>>>  am now able to run 32 cores ok.. but I still will hang
>>>  on buildworld with a NFS problem. I suspect I am missing
>>>  a patch for the netlogic rge driver.
>>>
>>>  JC check and see if I am missing anything except your
>>>  core-mask changes
>>
>>
>>> Modified: head/sys/kern/subr_smp.c
>>> ==
>>> --- head/sys/kern/subr_smp.c    Sun May 16 19:25:56 2010        (r208164)
>>> +++ head/sys/kern/subr_smp.c    Sun May 16 19:43:48 2010        (r208165)
>>> @@ -503,7 +503,10 @@ smp_topo_none(void)
>>>        top = &group[0];
>>>        top->cg_parent = NULL;
>>>        top->cg_child = NULL;
>>> -       top->cg_mask = (1 << mp_ncpus) - 1;
>>> +       if (mp_ncpus == sizeof(top->cg_mask) * 8)
>>> +               top->cg_mask = -1;
>>> +       else
>>> +               top->cg_mask = (1 << mp_ncpus) - 1;
>>>        top->cg_count = mp_ncpus;
>>>        top->cg_children = 0;
>>>        top->cg_level = CG_SHARE_NONE;
>>>
>>
>> ... and this is why I particulary hate big commits with complete lack
>> of technical details.
>>
>> This particulary chunk was supposed to fix a nasty and completely MI
>> bug that some users have already met (kern/148698). The complete lack
>> of details didn't help in identify the issue neither that it was a
>> valuable fix.
>>
>> The fix is, however, improper (there is no clear relationship between
>> the multiplication and why that happens) thus I would rather use what
>> Joe has reported in the PR.
>
>
> I was not aware of the PR when I sent this changes to rrs@, and this
> went as a part of MIPS SMP support for XLR which has 32 CPUs
>
> But I'm not sure that the current change is correct, cg_mask is of
> type cpumask_t and I don't think it is guaranteed to be 32 bit (as it
> is a machine dependent type).

Actually the 32 bits limit is well aware and acknowledged in cpumask_t.
While it is true that it should be an 'opaque' type, in reality it is
not. The maximum limit of 32 CPUs is a reality due to cpumask_t on all
our architectures.
That is why we are going to use cpuset_t for dealing with CPUs numbers
(which is really opaque, at same extent, and is not bound to any
size).

Attilio


-- 
Peace can only be achieved by understanding - A. Einstein
___
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: r211021 - head/sys/dev/usb

2010-08-09 Thread Gavin Atkinson
On Sun, 8 Aug 2010, M. Warner Losh wrote:
> In message: 
> Gavin Atkinson  writes:
> : On Sat, 7 Aug 2010, M. Warner Losh wrote:
> : > In message: <201008071608.o77g8bnn088...@svn.freebsd.org>
> : > Gavin Atkinson  writes:
> : > : Author: gavin
> : > : Date: Sat Aug  7 16:08:37 2010
> : > : New Revision: 211021
> : > : URL: http://svn.freebsd.org/changeset/base/211021
> : > : 
> : > : Log:
> : > :   Sort this file a little better: the vendors are supposed to be sorted 
> by
> : > :   vendor ID in the vendor section, and by symbolic name in the product
> : > :   section.  Products are sorted by product ID.  While here, get rid of a
> : > :   duplicate Microsoft Mouse entry, revealed by sorting.
> : > 
> : > I thought products were sorted by the ID number, not the ID name.
> : 
> : Yes, within a manufacturer, products should be sorted by ID.  Each 
> : manufacturer section is sorted by the symbolic manufacturer name, though.  
> 
> Within each product section, the products are sorted by numeric id,
> not symbolic id.  That's how it was when I was maintaining this file,
> and is how pccarddevs also works.
> 
> eg:
> 
> product ALCOR SDCR_6335   0x6335  SD/MMC Card Reader
> product ALCOR SDCR_6362   0x6362  SD/MMC Card Reader
> product ALCOR TRANSCEND   0x6387  Transcend JetFlash Drive
> product ALCOR MA_KBD_HUB  0x9213  MacAlly Kbd Hub
> product ALCOR AU9814  0x9215  AU9814 Hub
> product ALCOR UMCR_9361   0x9361  USB Multimedia Card Reader
> product ALCOR SM_KBD  0x9410  MicroConnectors/StrongMan Keyboard
> product ALCOR NEC_KBD_HUB 0x9472  NEC Kbd Hub
> product ALCOR AU6390  0x6390  AU6390 USB-IDE converter

Indeed, that is wrong. That's not a section that I have touched, though.

> : I'm not which one of us is misunderstanding the other - do you think my 
> : change is somehow wrong?
> 
> I think your change misorders things, unless I'm misreading it.  It
> sorts based on symbolic ID rather than numeric ID.

The only section I touched with this commit was the MICROSOFT one, and 
here is the ordering after my commit:

product MICROSOFT SIDEPREC  0x0008  SideWinder Precision Pro
product MICROSOFT INTELLIMOUSE  0x0009  IntelliMouse
product MICROSOFT NATURALKBD0x000b  Natural Keyboard Elite
product MICROSOFT DDS80 0x0014  Digital Sound System 80
product MICROSOFT SIDEWINDER0x001a  Sidewinder Precision Racing Wheel
product MICROSOFT INETPRO   0x001c  Internet Keyboard Pro
product MICROSOFT TBEXPLORER0x0024  Trackball Explorer
product MICROSOFT INTELLIEYE0x0025  IntelliEye mouse
product MICROSOFT INETPRO2  0x002b  Internet Keyboard Pro
product MICROSOFT MN510 0x006e  MN510 Wireless
product MICROSOFT MN110 0x007a  10/100 USB NIC
product MICROSOFT WLINTELLIMOUSE 0x008c Wireless Optical IntelliMouse
product MICROSOFT WLNOTEBOOK0x00b9  Wireless Optical Mouse (Model 1023)
product MICROSOFT COMFORT3000   0x00d1  Comfort Optical Mouse 3000 (Model 1043)
product MICROSOFT WLNOTEBOOK3   0x00d2  Wireless Optical Mouse 3000 (Model 1049)
product MICROSOFT NATURAL4000   0x00db  Natural Ergonomic Keyboard 4000
product MICROSOFT WLNOTEBOOK2   0x00e1  Wireless Optical Mouse 3000 (Model 1056)
product MICROSOFT XBOX360   0x0292  XBOX 360 WLAN

I can't see any which are misordered, can you?

Thanks,

Gavin
___
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: r211095 - in head: sbin/iscontrol sys/dev/iscsi/initiator

2010-08-09 Thread Dag-Erling Smorgrav
Author: des
Date: Mon Aug  9 12:36:36 2010
New Revision: 211095
URL: http://svn.freebsd.org/changeset/base/211095

Log:
  - Add full support for header / data digests.
  - Increase target limit from 4 to 64; this limit will be removed entirely
at a later time.
  - Improve recovery from lost network connections.
  - Fix some potential deadlocks and a serious memory leak.
  - Fix incorrect use of MH_ALIGN (instead of M_ALIGN), which makes no
practical difference, but triggers a KASSERT with INVARIANTS.
  - Fix some warnings in iscontrol(8) and improve the man page somewhat.
  
  Submitted by: Daniel Braniss 
  Sponsored by: Dansk Scanning A/S, Data Robotics Inc.

Deleted:
  head/sbin/iscontrol/pdu.h
Modified:
  head/sbin/iscontrol/Makefile
  head/sbin/iscontrol/auth_subr.c
  head/sbin/iscontrol/config.c
  head/sbin/iscontrol/fsm.c
  head/sbin/iscontrol/iscontrol.8
  head/sbin/iscontrol/iscontrol.c
  head/sbin/iscontrol/iscontrol.h
  head/sbin/iscontrol/iscsi.conf.5
  head/sbin/iscontrol/login.c
  head/sbin/iscontrol/misc.c
  head/sbin/iscontrol/pdu.c
  head/sys/dev/iscsi/initiator/isc_cam.c
  head/sys/dev/iscsi/initiator/isc_sm.c
  head/sys/dev/iscsi/initiator/isc_soc.c
  head/sys/dev/iscsi/initiator/isc_subr.c
  head/sys/dev/iscsi/initiator/iscsi.c
  head/sys/dev/iscsi/initiator/iscsi.h
  head/sys/dev/iscsi/initiator/iscsi_subr.c
  head/sys/dev/iscsi/initiator/iscsivar.h

Modified: head/sbin/iscontrol/Makefile
==
--- head/sbin/iscontrol/MakefileMon Aug  9 09:26:17 2010
(r211094)
+++ head/sbin/iscontrol/MakefileMon Aug  9 12:36:36 2010
(r211095)
@@ -4,9 +4,10 @@ SRCS= iscontrol.c pdu.c fsm.c config.c l
 PROG= iscontrol
 DPADD= ${LIBCAM} ${LIBMD}
 LDADD= -lcam -lmd
+S= ${.CURDIR}/../../sys
 
-WARNS?=2
-CFLAGS += -I${.CURDIR}/../../sys/dev/iscsi/initiator
+WARNS?=3
+CFLAGS += -I$S
 #CFLAGS += -g -DDEBUG
 
 MAN= iscsi.conf.5 iscontrol.8

Modified: head/sbin/iscontrol/auth_subr.c
==
--- head/sbin/iscontrol/auth_subr.c Mon Aug  9 09:26:17 2010
(r211094)
+++ head/sbin/iscontrol/auth_subr.c Mon Aug  9 12:36:36 2010
(r211095)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2005-2008 Daniel Braniss 
+ * Copyright (c) 2005-2010 Daniel Braniss 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -52,7 +52,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include "iscsi.h"
+#include 
 #include "iscontrol.h"
 
 static int
@@ -152,7 +152,7 @@ chapDigest(char *ap, char id, char *cp, 
 }
 
 char *
-genChapChallenge(char *encoding, int len)
+genChapChallenge(char *encoding, uint len)
 {
  int   fd;
  unsigned  char tmp[1024];

Modified: head/sbin/iscontrol/config.c
==
--- head/sbin/iscontrol/config.cMon Aug  9 09:26:17 2010
(r211094)
+++ head/sbin/iscontrol/config.cMon Aug  9 12:36:36 2010
(r211095)
@@ -1,5 +1,5 @@
  /*-
- * Copyright (c) 2005-2008 Daniel Braniss 
+ * Copyright (c) 2005-2009 Daniel Braniss 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -41,7 +41,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include "iscsi.h"
+#include 
 #include "iscontrol.h"
 
 /*
@@ -94,6 +94,11 @@ __FBSDID("$FreeBSD$");
 #define OPT_iqn34
 #define OPT_sockbufsize35
 
+/*
+ | sentinel
+ */
+#define OPT_end0
+
 #define _OFF(v)((int)&((isc_opt_t *)NULL)->v)
 #define _E(u, s, v) {.usage=u, .scope=s, .name=#v, .tokenID=OPT_##v}
 
@@ -145,7 +150,7 @@ textkey_t keyMap[] = {
  
  _E(U_LO, S_SW, sessionType),
 
- {0}
+ _E(0, 0, end)
 };
 
 #define _OPT_INT(w)strtol((char *)w, NULL, 0)
@@ -154,7 +159,7 @@ textkey_t keyMap[] = {
 static __inline  int
 _OPT_BOOL(char *w)
 {
- if(isalpha(*w))
+ if(isalpha((unsigned char)*w))
  return strcasecmp(w, "TRUE") == 0;
  else
  return _OPT_INT(w);
@@ -244,12 +249,12 @@ getConfig(FILE *fd, char *key, char **Ar
  len = 0;
  state = 0;
  while((lp = getline(fd)) != NULL) {
- for(; isspace(*lp); lp++)
+ for(; isspace((unsigned char)*lp); lp++)
   ;
  switch(state) {
  case 0:
   if((p = strchr(lp, '{')) != NULL) {
-   while((--p > lp) && *p && isspace(*p));
+   while((--p > lp) && *p && isspace((unsigned char)*p));
n = p - lp;
if(len && strncmp(lp, key, MAX(n, len)) == 0)
 state = 2;
@@ -272,7 +277,7 @@ getConfig(FILE *fd, char *key, char **Ar
  }
 
  
- for(p = &lp[strlen(lp)-1]; isspace(*p); p--)
+ for(p = &lp[strlen(lp

Re: svn commit: r208165 - in head/sys: kern mips/conf mips/include mips/mips mips/rmi mips/rmi/dev/xlr

2010-08-09 Thread Jayachandran C.
On Mon, Aug 9, 2010 at 5:35 PM, Attilio Rao  wrote:
> 2010/8/9 Jayachandran C. :
>> On Mon, Aug 9, 2010 at 5:31 AM, Attilio Rao  wrote:
>>> 2010/5/16 Randall Stewart :
 Author: rrs
 Date: Sun May 16 19:43:48 2010
 New Revision: 208165
 URL: http://svn.freebsd.org/changeset/base/208165

 Log:
  This pushes all of JC's patches that I have in place. I
  am now able to run 32 cores ok.. but I still will hang
  on buildworld with a NFS problem. I suspect I am missing
  a patch for the netlogic rge driver.

  JC check and see if I am missing anything except your
  core-mask changes
>>>
>>>
 Modified: head/sys/kern/subr_smp.c
 ==
 --- head/sys/kern/subr_smp.c    Sun May 16 19:25:56 2010        (r208164)
 +++ head/sys/kern/subr_smp.c    Sun May 16 19:43:48 2010        (r208165)
 @@ -503,7 +503,10 @@ smp_topo_none(void)
        top = &group[0];
        top->cg_parent = NULL;
        top->cg_child = NULL;
 -       top->cg_mask = (1 << mp_ncpus) - 1;
 +       if (mp_ncpus == sizeof(top->cg_mask) * 8)
 +               top->cg_mask = -1;
 +       else
 +               top->cg_mask = (1 << mp_ncpus) - 1;
        top->cg_count = mp_ncpus;
        top->cg_children = 0;
        top->cg_level = CG_SHARE_NONE;

>>>
>>> ... and this is why I particulary hate big commits with complete lack
>>> of technical details.
>>>
>>> This particulary chunk was supposed to fix a nasty and completely MI
>>> bug that some users have already met (kern/148698). The complete lack
>>> of details didn't help in identify the issue neither that it was a
>>> valuable fix.
>>>
>>> The fix is, however, improper (there is no clear relationship between
>>> the multiplication and why that happens) thus I would rather use what
>>> Joe has reported in the PR.
>>
>>
>> I was not aware of the PR when I sent this changes to rrs@, and this
>> went as a part of MIPS SMP support for XLR which has 32 CPUs
>>
>> But I'm not sure that the current change is correct, cg_mask is of
>> type cpumask_t and I don't think it is guaranteed to be 32 bit (as it
>> is a machine dependent type).
>
> Actually the 32 bits limit is well aware and acknowledged in cpumask_t.
> While it is true that it should be an 'opaque' type, in reality it is
> not. The maximum limit of 32 CPUs is a reality due to cpumask_t on all
> our architectures.
> That is why we are going to use cpuset_t for dealing with CPUs numbers
> (which is really opaque, at same extent, and is not bound to any
> size).

In my opinion, your changes added another pitfall for the person who
tries to make the cpumask_t 64 bit to support more cpus, which really
could have been avoided.

But if cpumask_t is going to be changed to cpuset_t soon, I guess we
are fine  :)

JC.
___
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: r211102 - head/sys/kern

2010-08-09 Thread Gavin Atkinson
Author: gavin
Date: Mon Aug  9 14:48:31 2010
New Revision: 211102
URL: http://svn.freebsd.org/changeset/base/211102

Log:
  Add descriptions to a handful of sysctl nodes.
  
  PR:   kern/148580
  Submitted by: Galimov Albert 
  MFC after:1 week

Modified:
  head/sys/kern/init_main.c
  head/sys/kern/kern_cons.c
  head/sys/kern/kern_ktrace.c

Modified: head/sys/kern/init_main.c
==
--- head/sys/kern/init_main.c   Mon Aug  9 14:33:25 2010(r211101)
+++ head/sys/kern/init_main.c   Mon Aug  9 14:48:31 2010(r211102)
@@ -100,9 +100,11 @@ struct vmspace vmspace0;
 struct proc *initproc;
 
 intboothowto = 0;  /* initialized so that it can be patched */
-SYSCTL_INT(_debug, OID_AUTO, boothowto, CTLFLAG_RD, &boothowto, 0, "");
+SYSCTL_INT(_debug, OID_AUTO, boothowto, CTLFLAG_RD, &boothowto, 0,
+   "Boot control flags, passed from loader");
 intbootverbose;
-SYSCTL_INT(_debug, OID_AUTO, bootverbose, CTLFLAG_RW, &bootverbose, 0, "");
+SYSCTL_INT(_debug, OID_AUTO, bootverbose, CTLFLAG_RW, &bootverbose, 0,
+   "Control the output of verbose kernel messages");
 
 /*
  * This ensures that there is at least one entry so that the sysinit_set
@@ -647,7 +649,8 @@ SYSCTL_STRING(_kern, OID_AUTO, init_path
 #endif
 static int init_shutdown_timeout = INIT_SHUTDOWN_TIMEOUT;
 SYSCTL_INT(_kern, OID_AUTO, init_shutdown_timeout,
-   CTLFLAG_RW, &init_shutdown_timeout, 0, "");
+   CTLFLAG_RW, &init_shutdown_timeout, 0, "Shutdown timeout of init(8). "
+   "Unused within kernel, but used to control init(8)");
 
 /*
  * Start the initial user process; try exec'ing each pathname in init_path.

Modified: head/sys/kern/kern_cons.c
==
--- head/sys/kern/kern_cons.c   Mon Aug  9 14:33:25 2010(r211101)
+++ head/sys/kern/kern_cons.c   Mon Aug  9 14:48:31 2010(r211102)
@@ -341,7 +341,8 @@ sysctl_kern_consmute(SYSCTL_HANDLER_ARGS
 }
 
 SYSCTL_PROC(_kern, OID_AUTO, consmute, CTLTYPE_INT|CTLFLAG_RW,
-   0, sizeof(cn_mute), sysctl_kern_consmute, "I", "");
+   0, sizeof(cn_mute), sysctl_kern_consmute, "I",
+   "State of the console muting");
 
 /*
  * Low level console routines.
@@ -429,7 +430,7 @@ cnputs(char *p)
 
 static int consmsgbuf_size = 8192;
 SYSCTL_INT(_kern, OID_AUTO, consmsgbuf_size, CTLFLAG_RW, &consmsgbuf_size, 0,
-"");
+"Console tty buffer size");
 
 /*
  * Redirect console output to a tty.
@@ -471,7 +472,8 @@ constty_clear(void)
 /* Times per second to check for pending console tty messages. */
 static int constty_wakeups_per_second = 5;
 SYSCTL_INT(_kern, OID_AUTO, constty_wakeups_per_second, CTLFLAG_RW,
-&constty_wakeups_per_second, 0, "");
+&constty_wakeups_per_second, 0,
+"Times per second to check for pending console tty messages");
 
 static void
 constty_timeout(void *arg)

Modified: head/sys/kern/kern_ktrace.c
==
--- head/sys/kern/kern_ktrace.c Mon Aug  9 14:33:25 2010(r211101)
+++ head/sys/kern/kern_ktrace.c Mon Aug  9 14:48:31 2010(r211102)
@@ -218,7 +218,8 @@ sysctl_kern_ktrace_request_pool(SYSCTL_H
return (0);
 }
 SYSCTL_PROC(_kern_ktrace, OID_AUTO, request_pool, CTLTYPE_UINT|CTLFLAG_RW,
-&ktr_requestpool, 0, sysctl_kern_ktrace_request_pool, "IU", "");
+&ktr_requestpool, 0, sysctl_kern_ktrace_request_pool, "IU",
+"Pool buffer size for ktrace(1)");
 
 static u_int
 ktrace_resize_pool(u_int newsize)
___
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: r211023 - head/usr.sbin/syslogd

2010-08-09 Thread M. Warner Losh
In message: <86tyn4tbuc@ds4.des.no>
Dag-Erling Smørgrav  writes:
: Jilles Tjoelker  writes:
: > In other cases, I propose adding a cast to void * in between, like
: >   (struct sockaddr_in *)(void *)ai->ai_addr
: 
: Better to cast through uintptr_t.  Perhaps we should have a
: __DECONST-like macro for this?
: 
: #define __ALIGNED_CAST(t, v) ((t)(uintptr_t)(v))

I like the idea of a macro.  Why is a cast through uintptr_t better?

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: svn commit: r211021 - head/sys/dev/usb

2010-08-09 Thread M. Warner Losh
In message: 
Gavin Atkinson  writes:
: On Sun, 8 Aug 2010, M. Warner Losh wrote:
: > In message: 
: > Gavin Atkinson  writes:
: > : On Sat, 7 Aug 2010, M. Warner Losh wrote:
: > : > In message: <201008071608.o77g8bnn088...@svn.freebsd.org>
: > : > Gavin Atkinson  writes:
: > : > : Author: gavin
: > : > : Date: Sat Aug  7 16:08:37 2010
: > : > : New Revision: 211021
: > : > : URL: http://svn.freebsd.org/changeset/base/211021
: > : > : 
: > : > : Log:
: > : > :   Sort this file a little better: the vendors are supposed to be 
sorted by
: > : > :   vendor ID in the vendor section, and by symbolic name in the product
: > : > :   section.  Products are sorted by product ID.  While here, get rid 
of a
: > : > :   duplicate Microsoft Mouse entry, revealed by sorting.
: > : > 
: > : > I thought products were sorted by the ID number, not the ID name.
: > : 
: > : Yes, within a manufacturer, products should be sorted by ID.  Each 
: > : manufacturer section is sorted by the symbolic manufacturer name, though. 
 
: > 
: > Within each product section, the products are sorted by numeric id,
: > not symbolic id.  That's how it was when I was maintaining this file,
: > and is how pccarddevs also works.
: > 
: > eg:
: > 
: > product ALCOR SDCR_6335 0x6335  SD/MMC Card Reader
: > product ALCOR SDCR_6362 0x6362  SD/MMC Card Reader
: > product ALCOR TRANSCEND 0x6387  Transcend JetFlash Drive
: > product ALCOR MA_KBD_HUB0x9213  MacAlly Kbd Hub
: > product ALCOR AU98140x9215  AU9814 Hub
: > product ALCOR UMCR_9361 0x9361  USB Multimedia Card Reader
: > product ALCOR SM_KBD0x9410  MicroConnectors/StrongMan 
Keyboard
: > product ALCOR NEC_KBD_HUB   0x9472  NEC Kbd Hub
: > product ALCOR AU63900x6390  AU6390 USB-IDE converter
: 
: Indeed, that is wrong. That's not a section that I have touched, though.
: 
: > : I'm not which one of us is misunderstanding the other - do you think my 
: > : change is somehow wrong?
: > 
: > I think your change misorders things, unless I'm misreading it.  It
: > sorts based on symbolic ID rather than numeric ID.
: 
: The only section I touched with this commit was the MICROSOFT one, and 
: here is the ordering after my commit:
: 
: product MICROSOFT SIDEPREC0x0008  SideWinder Precision Pro
: product MICROSOFT INTELLIMOUSE0x0009  IntelliMouse
: product MICROSOFT NATURALKBD  0x000b  Natural Keyboard Elite
: product MICROSOFT DDS80   0x0014  Digital Sound System 80
: product MICROSOFT SIDEWINDER  0x001a  Sidewinder Precision Racing Wheel
: product MICROSOFT INETPRO 0x001c  Internet Keyboard Pro
: product MICROSOFT TBEXPLORER  0x0024  Trackball Explorer
: product MICROSOFT INTELLIEYE  0x0025  IntelliEye mouse
: product MICROSOFT INETPRO20x002b  Internet Keyboard Pro
: product MICROSOFT MN510   0x006e  MN510 Wireless
: product MICROSOFT MN110   0x007a  10/100 USB NIC
: product MICROSOFT WLINTELLIMOUSE 0x008c   Wireless Optical IntelliMouse
: product MICROSOFT WLNOTEBOOK  0x00b9  Wireless Optical Mouse (Model 1023)
: product MICROSOFT COMFORT3000 0x00d1  Comfort Optical Mouse 3000 (Model 1043)
: product MICROSOFT WLNOTEBOOK3 0x00d2  Wireless Optical Mouse 3000 (Model 1049)
: product MICROSOFT NATURAL4000 0x00db  Natural Ergonomic Keyboard 4000
: product MICROSOFT WLNOTEBOOK2 0x00e1  Wireless Optical Mouse 3000 (Model 1056)
: product MICROSOFT XBOX360 0x0292  XBOX 360 WLAN
: 
: I can't see any which are misordered, can you?

I must have I misread the diff then.  My mistake.  Sorry for the
noise.  I thought you were sorting based on the third column rather
than the 4th.

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: r211103 - head/sys/dev/mii

2010-08-09 Thread Pyun YongHyeon
Author: yongari
Date: Mon Aug  9 17:22:14 2010
New Revision: 211103
URL: http://svn.freebsd.org/changeset/base/211103

Log:
  Add F1 PHY found on Atheros AR8151 v2.0 PCIe gigabit ethernet
  controller.

Modified:
  head/sys/dev/mii/atphy.c
  head/sys/dev/mii/miidevs

Modified: head/sys/dev/mii/atphy.c
==
--- head/sys/dev/mii/atphy.cMon Aug  9 14:48:31 2010(r211102)
+++ head/sys/dev/mii/atphy.cMon Aug  9 17:22:14 2010(r211103)
@@ -86,6 +86,7 @@ static intatphy_auto(struct mii_softc *
 
 static const struct mii_phydesc atphys[] = {
MII_PHY_DESC(ATHEROS, F1),
+   MII_PHY_DESC(ATHEROS, F1_7),
MII_PHY_DESC(ATHEROS, F2),
MII_PHY_END
 };

Modified: head/sys/dev/mii/miidevs
==
--- head/sys/dev/mii/miidevsMon Aug  9 14:48:31 2010(r211102)
+++ head/sys/dev/mii/miidevsMon Aug  9 17:22:14 2010(r211103)
@@ -121,6 +121,7 @@ model ASIX AX88X9X  0x0031 Ax88x9x inter
 /* Atheros Communications/Attansic PHYs. */
 model ATHEROS F1   0x0001 Atheros F1 10/100/1000 PHY
 model ATHEROS F2   0x0002 Atheros F2 10/100 PHY
+model ATHEROS F1_7 0x0007 Atheros F1 10/100/1000 PHY
 
 /* Broadcom Corp. PHYs. */
 model BROADCOM 3C905B  0x0012 3c905B 10/100 internal PHY
___
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: r211104 - head/sys/dev/usb

2010-08-09 Thread Gavin Atkinson
Author: gavin
Date: Mon Aug  9 17:27:27 2010
New Revision: 211104
URL: http://svn.freebsd.org/changeset/base/211104

Log:
  Add entries for some devices I have locally.

Modified:
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsMon Aug  9 17:22:14 2010(r211103)
+++ head/sys/dev/usb/usbdevsMon Aug  9 17:27:27 2010(r211104)
@@ -666,6 +666,7 @@ vendor ALINK0x1e0e  Alink
 vendor AIRTIES 0x1eda  AirTies
 vendor DLINK   0x2001  D-Link
 vendor PLANEX2 0x2019  Planex Communications
+vendor HAUPPAUGE2  0x2040  Hauppauge Computer Works
 vendor TLAYTECH0x20b9  Tlay Tech
 vendor ENCORE  0x203d  Encore
 vendor PARA0x20b8  PARA Industrial
@@ -971,6 +972,8 @@ product AOX USB101  0x0008  Ethernet
 product APC UPS0x0002  Uninterruptible Power Supply
 
 /* Apple Computer products */
+product APPLE IMAC_KBD 0x0201  USB iMac Keyboard
+product APPLE KBD  0x0202  USB Keyboard M2452
 product APPLE EXT_KBD  0x020c  Apple Extended USB Keyboard
 product APPLE KBD_TP_ANSI  0x0223  Apple Internal Keyboard/Trackpad 
(Wellspring/ANSI)
 product APPLE KBD_TP_ISO   0x0224  Apple Internal Keyboard/Trackpad 
(Wellspring/ISO)
@@ -978,8 +981,10 @@ product APPLE KBD_TP_JIS   0x0225  Apple In
 product APPLE KBD_TP_ANSI2 0x0230  Apple Internal Keyboard/Trackpad 
(Wellspring2/ANSI)
 product APPLE KBD_TP_ISO2  0x0231  Apple Internal Keyboard/Trackpad 
(Wellspring2/ISO)
 product APPLE KBD_TP_JIS2  0x0232  Apple Internal Keyboard/Trackpad 
(Wellspring2/JIS)
+product APPLE MOUSE0x0301  Mouse M4848
 product APPLE OPTMOUSE 0x0302  Optical mouse
 product APPLE MIGHTYMOUSE  0x0304  Mighty Mouse
+product APPLE KBD_HUB  0x1001  Hub in Apple USB Keyboard
 product APPLE EXT_KBD_HUB  0x1003  Hub in Apple Extended USB Keyboard
 product APPLE SPEAKERS 0x1101  Speakers
 product APPLE IPOD 0x1201  iPod
@@ -993,7 +998,11 @@ product APPLE IPOD_08  0x1208  iPod '08'
 product APPLE IPODVIDEO0x1209  iPod Video
 product APPLE IPODNANO 0x120a  iPod Nano
 product APPLE IPHONE   0x1290  iPhone
+product APPLE IPOD_TOUCH   0x1291  iPod Touch
 product APPLE IPHONE_3G0x1292  iPhone 3G
+product APPLE IPHONE_3GS   0x1294  iPhone 3GS
+product APPLE IPHONE_4 0x1297  iPhone 4
+product APPLE IPAD 0x129a  iPad
 product APPLE ETHERNET 0x1402  Ethernet A1277
 
 /* Arkmicro Technologies */
@@ -1059,6 +1068,9 @@ product ATMEL BW002   0x7605  BW002 Wirele
 product ATMEL WL1130USB0x7613  WL-1130 USB
 product ATMEL AT76C505A0x7614  AT76c505a Wireless Adapter
 
+/* AuthenTec products */
+product AUTHENTEC AES1610  0x1600  AES1610 Fingerprint Sensor
+
 /* Avision products */
 product AVISION 1200U  0x0268  1200U scanner
 
@@ -1125,6 +1137,7 @@ product BROTHER HL10500x0002  HL-1050 l
 product BROTHER MFC8600_9650   0x0100  MFC8600/9650 multifunction device
 
 /* Behavior Technology Computer products */
+product BTC BTC61000x5550  6100C Keyboard
 product BTC BTC79320x6782  Keyboard with mouse port
 
 /* Canon, Inc. products */
@@ -1169,6 +1182,7 @@ product CHIC CYPRESS  0x0003  Cypress USB
 
 /* Chicony products */
 product CHICONY KB8933 0x0001  KB-8933 keyboard
+product CHICONY KU0325 0x0116  KU-0325 keyboard
 product CHICONY CNF71290xb071  Notebook Web Camera
 product CHICONY2 TWINKLECAM0x600d  TwinkleCam USB camera
 
@@ -1668,6 +1682,7 @@ product HANDSPRING TREO6000x0300  Handsp
 
 /* Hauppauge Computer Works */
 product HAUPPAUGE WINTV_USB_FM 0x4d12  WinTV USB FM
+product HAUPPAUGE2 NOVAT5000x9580  NovaT 500Stick
 
 /* Hawking Technologies products */
 product HAWKING RT2870_1   0x0001  RT2870
@@ -1739,6 +1754,9 @@ product HTC WINMOBILE 0x00ce  HTC USB Sy
 product HTC PPC6700MODEM   0x00cf  PPC6700 Modem
 product HTC SMARTPHONE 0x0a51  SmartPhone USB Sync
 product HTC WIZARD 0x0bce  HTC Wizard USB Sync
+product HTC LEGENDSYNC 0x0c97  HTC Legend USB Sync
+product HTC LEGEND 0x0ff9  HTC Legend
+product HTC LEGENDINTERNET 0x0ffe  HTC Legend Internet Sharing
 
 /* HUAWEI products */
 product HUAWEI MOBILE  0x1001  Huawei Mobile
@@ -2123,6 +2141,8 @@ product MICROSOFT INETPRO 0x001c  Interne
 product MICROSOFT TBEXPLORER   0x0024  Trackball Explorer
 product MICROSOFT INTELLIEYE   0x0025  IntelliEye mouse
 product MICROSOFT INETPRO2 0x002b  Internet Keyboard Pro
+product MICROSOFT INTELLIMOUSE50x0039  IntelliMouse 1.1 5-Button Mouse
+product MICROSOFT WHEELMOUSE   0x0040  Wheel Mouse Optical
 product MICROSOFT MN

svn commit: r211105 - head/sys/dev/alc

2010-08-09 Thread Pyun YongHyeon
Author: yongari
Date: Mon Aug  9 17:28:08 2010
New Revision: 211105
URL: http://svn.freebsd.org/changeset/base/211105

Log:
  Add support for Atheros AR8151/AR8152 PCIe gigabit/fast ethernet
  controller. These controllers are known as L1D(AR8151) and
  L2CB/B2(AR8152). This change adds supports for the following
  controllers.
   o AR8151 v1.0(L1D) gigabit ethernet controller
   o AR8151 v2.0(L1D) gigabit ethernet controller
   o AR8152 v1.1(L2CB) fast ethernet controller
   o AR8152 v2.0(L2CB2) fast ethernet controller
  These controllers have the same feature of AR8131/AR8132 and
  support improved power saving control. The user visible change at
  this moment is reduced jumbo frame size from 9KB to 6KB. Many
  thanks to Atheros for continuing to support FreeBSD.
  
  HW donated by:Atheros Communications, Inc.

Modified:
  head/sys/dev/alc/if_alc.c
  head/sys/dev/alc/if_alcreg.h
  head/sys/dev/alc/if_alcvar.h

Modified: head/sys/dev/alc/if_alc.c
==
--- head/sys/dev/alc/if_alc.c   Mon Aug  9 17:27:27 2010(r211104)
+++ head/sys/dev/alc/if_alc.c   Mon Aug  9 17:28:08 2010(r211105)
@@ -25,7 +25,7 @@
  * SUCH DAMAGE.
  */
 
-/* Driver for Atheros AR8131/AR8132 PCIe Ethernet. */
+/* Driver for Atheros AR813x/AR815x PCIe Ethernet. */
 
 #include 
 __FBSDID("$FreeBSD$");
@@ -98,18 +98,23 @@ TUNABLE_INT("hw.alc.msix_disable", &msix
 /*
  * Devices supported by this driver.
  */
-static struct alc_dev {
-   uint16_talc_vendorid;
-   uint16_talc_deviceid;
-   const char  *alc_name;
-} alc_devs[] = {
-   { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8131,
+static struct alc_ident alc_ident_table[] = {
+   { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8131, 9 * 1024,
"Atheros AR8131 PCIe Gigabit Ethernet" },
-   { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8132,
-   "Atheros AR8132 PCIe Fast Ethernet" }
+   { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8132, 9 * 1024,
+   "Atheros AR8132 PCIe Fast Ethernet" },
+   { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8151, 6 * 1024,
+   "Atheros AR8151 v1.0 PCIe Gigabit Ethernet" },
+   { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8151_V2, 6 * 1024,
+   "Atheros AR8151 v2.0 PCIe Gigabit Ethernet" },
+   { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8152_B, 6 * 1024,
+   "Atheros AR8152 v1.1 PCIe Fast Ethernet" },
+   { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8152_B2, 6 * 1024,
+   "Atheros AR8152 v2.0 PCIe Fast Ethernet" },
+   { 0, 0, 0, NULL}
 };
 
-static voidalc_aspm(struct alc_softc *);
+static voidalc_aspm(struct alc_softc *, int);
 static int alc_attach(device_t);
 static int alc_check_boundary(struct alc_softc *);
 static int alc_detach(device_t);
@@ -118,6 +123,8 @@ static int  alc_dma_alloc(struct alc_soft
 static voidalc_dma_free(struct alc_softc *);
 static voidalc_dmamap_cb(void *, bus_dma_segment_t *, int, int);
 static int alc_encap(struct alc_softc *, struct mbuf **);
+static struct alc_ident *
+   alc_find_ident(device_t);
 #ifndef __NO_STRICT_ALIGNMENT
 static struct mbuf *
alc_fixup_rx(struct ifnet *, struct mbuf *);
@@ -331,7 +338,7 @@ alc_miibus_statchg(device_t dev)
reg |= MAC_CFG_TX_ENB | MAC_CFG_RX_ENB;
CSR_WRITE_4(sc, ALC_MAC_CFG, reg);
}
-   alc_aspm(sc);
+   alc_aspm(sc, IFM_SUBTYPE(mii->mii_media_active));
 }
 
 static void
@@ -375,23 +382,31 @@ alc_mediachange(struct ifnet *ifp)
return (error);
 }
 
-static int
-alc_probe(device_t dev)
+static struct alc_ident *
+alc_find_ident(device_t dev)
 {
-   struct alc_dev *sp;
-   int i;
+   struct alc_ident *ident;
uint16_t vendor, devid;
 
vendor = pci_get_vendor(dev);
devid = pci_get_device(dev);
-   sp = alc_devs;
-   for (i = 0; i < sizeof(alc_devs) / sizeof(alc_devs[0]); i++) {
-   if (vendor == sp->alc_vendorid &&
-   devid == sp->alc_deviceid) {
-   device_set_desc(dev, sp->alc_name);
-   return (BUS_PROBE_DEFAULT);
-   }
-   sp++;
+   for (ident = alc_ident_table; ident->name != NULL; ident++) {
+   if (vendor == ident->vendorid && devid == ident->deviceid)
+   return (ident);
+   }
+
+   return (NULL);
+}
+
+static int
+alc_probe(device_t dev)
+{
+   struct alc_ident *ident;
+
+   ident = alc_find_ident(dev);
+   if (ident != NULL) {
+   device_set_desc(dev, ident->name);
+   return (BUS_PROBE_DEFAULT);
}
 
return (ENXIO);
@@ -401,20 +416,53 @@ static void
 alc_get_macaddr(struct alc_softc *sc)
 {
uint32_t ea[2], opt;
-   int i;
+   uint16_t val;
+   int eeprom, i;
 
+   eeprom = 0;
opt = CSR_READ_4(sc, ALC_OPT_CFG);
- 

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

2010-08-09 Thread Pyun YongHyeon
Author: yongari
Date: Mon Aug  9 17:33:03 2010
New Revision: 211106
URL: http://svn.freebsd.org/changeset/base/211106

Log:
  Document newly added controller AR8151 and AR8152.

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

Modified: head/share/man/man4/alc.4
==
--- head/share/man/man4/alc.4   Mon Aug  9 17:28:08 2010(r211105)
+++ head/share/man/man4/alc.4   Mon Aug  9 17:33:03 2010(r211106)
@@ -24,12 +24,12 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 10, 2009
+.Dd August 9, 2010
 .Dt ALC 4
 .Os
 .Sh NAME
 .Nm alc
-.Nd Atheros AR8131/AR8132 Gigabit/Fast Ethernet driver
+.Nd Atheros AR813x/AR815x Gigabit/Fast Ethernet driver
 .Sh SYNOPSIS
 To compile this driver into the kernel,
 place the following lines in your
@@ -48,9 +48,8 @@ if_alc_load="YES"
 .Sh DESCRIPTION
 The
 .Nm
-device driver provides support for Atheros AR8131 PCI Express
-Gigabit Ethernet controllers and Atheros AR8132 PCI Express
-Fast Ethernet controllers.
+device driver provides support for Atheros AR813x and AR815x PCI
+Express Gigabit/Fast Ethernet controllers.
 .Pp
 All LOMs supported by the
 .Nm
@@ -59,8 +58,9 @@ segmentation offload (TSO), hardware VLA
 features, Wake On Lan (WOL) and an interrupt moderation mechanism
 as well as a 64-bit multicast hash filter.
 .Pp
-The AR8131/AR8132 supports Jumbo Frames (up to 9216 bytes), which can
-be configured via the interface MTU setting.
+The AR813x and AR815x supports Jumbo Frames (up to 9216 and 6144
+bytes, respectively), which can be configured via the interface
+MTU setting.
 Selecting an MTU larger than 1500 bytes with the
 .Xr ifconfig 8
 utility configures the adapter to receive and transmit Jumbo Frames.
@@ -104,6 +104,14 @@ device driver provides support for the f
 Atheros AR8131 PCI Express Gigabit Ethernet controller
 .It
 Atheros AR8132 PCI Express Fast Ethernet controller
+.It
+Atheros AR8151 v1.0 PCI Express Gigabit Ethernet controller
+.It
+Atheros AR8151 v2.0 PCI Express Gigabit Ethernet controller
+.It
+Atheros AR8152 v1.1 PCI Express Fast Ethernet controller
+.It
+Atheros AR8152 v2.0 PCI Express Fast Ethernet controller
 .El
 .Sh LOADER TUNABLES
 Tunables can be set at the
___
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: r211107 - head/tools/regression/fstest/tests

2010-08-09 Thread Pawel Jakub Dawidek
Author: pjd
Date: Mon Aug  9 17:34:57 2010
New Revision: 211107
URL: http://svn.freebsd.org/changeset/base/211107

Log:
  No need to use grep to check if path start with /.
  
  Suggested by: ed

Modified:
  head/tools/regression/fstest/tests/misc.sh

Modified: head/tools/regression/fstest/tests/misc.sh
==
--- head/tools/regression/fstest/tests/misc.sh  Mon Aug  9 17:33:03 2010
(r211106)
+++ head/tools/regression/fstest/tests/misc.sh  Mon Aug  9 17:34:57 2010
(r211107)
@@ -9,12 +9,14 @@ path1021="${name255}/${name255}/${name25
 path1023="${path1021}/x"
 path1024="${path1023}x"
 
-echo ${dir} | grep '^/' >/dev/null 2>&1
-if [ $? -eq 0 ]; then
+case "${dir}" in
+/*)
maindir="${dir}/../.."
-else
+   ;;
+*)
maindir="`pwd`/${dir}/../.."
-fi
+   ;;
+esac
 fstest="${maindir}/fstest"
 . ${maindir}/tests/conf
 
___
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: r211108 - head/tools/regression/fstest/tests

2010-08-09 Thread Pawel Jakub Dawidek
Author: pjd
Date: Mon Aug  9 17:37:29 2010
New Revision: 211108
URL: http://svn.freebsd.org/changeset/base/211108

Log:
  Small tweaks.

Modified:
  head/tools/regression/fstest/tests/conf
  head/tools/regression/fstest/tests/misc.sh

Modified: head/tools/regression/fstest/tests/conf
==
--- head/tools/regression/fstest/tests/conf Mon Aug  9 17:34:57 2010
(r211107)
+++ head/tools/regression/fstest/tests/conf Mon Aug  9 17:37:29 2010
(r211108)
@@ -1,7 +1,7 @@
 # $FreeBSD$
 # fstest configuration file
 
-# Known operating systems: FreeBSD, SunOS, Linux
+# Supported operating systems: FreeBSD, Darwin, SunOS, Linux
 os=`uname`
 
 case "${os}" in
@@ -9,12 +9,12 @@ FreeBSD|Darwin)
GREP=grep
#fs=`df -T . | tail -1 | awk '{print $2}'`
pattern="`df . | tail -1 | awk '{printf("%s on %s \n", $1, $6)}'`"
-   fs=`mount | egrep "^${pattern}" | awk -F '[(,]' '{print toupper($2)}'`
+   fs=`mount | ${GREP} -E "^${pattern}" | awk -F '[(,]' '{print 
toupper($2)}'`
;;
 Solaris|SunOS)
GREP=ggrep
pattern=`df -k . | tail -1 | awk '{printf("%s on %s \n", $1, $6)}'`
-   fs=`mount -v | egrep "^${pattern}" | awk '{print $5}' | \
+   fs=`mount -v | ${GREP} -E "^${pattern}" | awk '{print $5}' | \
tr -s '[:lower:]' '[:upper:]'`
;;
 Linux)

Modified: head/tools/regression/fstest/tests/misc.sh
==
--- head/tools/regression/fstest/tests/misc.sh  Mon Aug  9 17:34:57 2010
(r211107)
+++ head/tools/regression/fstest/tests/misc.sh  Mon Aug  9 17:37:29 2010
(r211108)
@@ -25,7 +25,7 @@ expect()
e="${1}"
shift
r=`${fstest} $* 2>/dev/null | tail -1`
-   echo "${r}" | ${GREP} -E '^'${e}'$' >/dev/null 2>&1
+   echo "${r}" | ${GREP} -Eq '^'${e}'$'
if [ $? -eq 0 ]; then
if [ -z "${todomsg}" ]; then
echo "ok ${ntest}"
@@ -40,7 +40,7 @@ expect()
fi
fi
todomsg=""
-   ntest=`expr $ntest + 1`
+   ntest=$((ntest+1))
 }
 
 jexpect()
@@ -50,7 +50,7 @@ jexpect()
e="${3}"
shift 3
r=`jail -s ${s} / fstest 127.0.0.1 /bin/sh -c "cd ${d} && ${fstest} $* 
2>/dev/null" | tail -1`
-   echo "${r}" | ${GREP} -E '^'${e}'$' >/dev/null 2>&1
+   echo "${r}" | ${GREP} -Eq '^'${e}'$'
if [ $? -eq 0 ]; then
if [ -z "${todomsg}" ]; then
echo "ok ${ntest}"
@@ -65,7 +65,7 @@ jexpect()
fi
fi
todomsg=""
-   ntest=`expr $ntest + 1`
+   ntest=$((ntest+1))
 }
 
 test_check()
@@ -84,7 +84,7 @@ test_check()
fi
fi
todomsg=""
-   ntest=`expr $ntest + 1`
+   ntest=$((ntest+1))
 }
 
 todo()
___
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: r208165 - in head/sys: kern mips/conf mips/include mips/mips mips/rmi mips/rmi/dev/xlr

2010-08-09 Thread M. Warner Losh
In message: 
"Jayachandran C."  writes:
:         top->cg_level = CG_SHARE_NONE;
: 
: >>>
: >>> ... and this is why I particulary hate big commits with complete lack
: >>> of technical details.
: >>>
: >>> This particulary chunk was supposed to fix a nasty and completely MI
: >>> bug that some users have already met (kern/148698). The complete lack
: >>> of details didn't help in identify the issue neither that it was a
: >>> valuable fix.
: >>>
: >>> The fix is, however, improper (there is no clear relationship between
: >>> the multiplication and why that happens) thus I would rather use what
: >>> Joe has reported in the PR.
: >>
: >>
: >> I was not aware of the PR when I sent this changes to rrs@, and this
: >> went as a part of MIPS SMP support for XLR which has 32 CPUs
: >>
: >> But I'm not sure that the current change is correct, cg_mask is of
: >> type cpumask_t and I don't think it is guaranteed to be 32 bit (as it
: >> is a machine dependent type).
: >
: > Actually the 32 bits limit is well aware and acknowledged in cpumask_t.
: > While it is true that it should be an 'opaque' type, in reality it is
: > not. The maximum limit of 32 CPUs is a reality due to cpumask_t on all
: > our architectures.
: > That is why we are going to use cpuset_t for dealing with CPUs numbers
: > (which is really opaque, at same extent, and is not bound to any
: > size).
: 
: In my opinion, your changes added another pitfall for the person who
: tries to make the cpumask_t 64 bit to support more cpus, which really
: could have been avoided.
: 
: But if cpumask_t is going to be changed to cpuset_t soon, I guess we
: are fine  :)
: 
: JC.

Yes, the correct fix, short of cpuset_t, is not:

 -       top->cg_mask = (1 << mp_ncpus) - 1;
 +       if (mp_ncpus == sizeof(top->cg_mask) * 8)
 +               top->cg_mask = -1;
 +       else
 +               top->cg_mask = (1 << mp_ncpus) - 1;

but rather

if (mp_ncpus > sizeof(top->cg_mask) * NBBY)
mp_ncpus = sizeof(top->cg_mask) * NBBY; /* Or panic */
if (mp_ncpus > sizeof(top->cg_mask) * NBBY)
top->cg_mask = ~0;  /* which avoids the signed error */
else
top->cg_mask = (1 << mp_ncpus) - 1;


I'm not sure why the expression would fail (1 << 32 == 0 -1 == all
bits set), but I've not looked at the old thread to see why the
compiler is generating bogus code.

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: r211109 - head/tools/regression/fstest/tests

2010-08-09 Thread Pawel Jakub Dawidek
Author: pjd
Date: Mon Aug  9 17:40:59 2010
New Revision: 211109
URL: http://svn.freebsd.org/changeset/base/211109

Log:
  Fix file system type detection on Solaris.

Modified:
  head/tools/regression/fstest/tests/conf

Modified: head/tools/regression/fstest/tests/conf
==
--- head/tools/regression/fstest/tests/conf Mon Aug  9 17:37:29 2010
(r211108)
+++ head/tools/regression/fstest/tests/conf Mon Aug  9 17:40:59 2010
(r211109)
@@ -13,7 +13,7 @@ FreeBSD|Darwin)
;;
 Solaris|SunOS)
GREP=ggrep
-   pattern=`df -k . | tail -1 | awk '{printf("%s on %s \n", $1, $6)}'`
+   pattern=`df -Pk . | tail -1 | awk '{printf("%s on %s \n", $1, $6)}'`
fs=`mount -v | ${GREP} -E "^${pattern}" | awk '{print $5}' | \
tr -s '[:lower:]' '[:upper:]'`
;;
___
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: r211110 - head/tools/regression/fstest

2010-08-09 Thread Pawel Jakub Dawidek
Author: pjd
Date: Mon Aug  9 17:42:04 2010
New Revision: 20
URL: http://svn.freebsd.org/changeset/base/20

Log:
  Fix bind(2) and connect(2) support on Solaris.

Modified:
  head/tools/regression/fstest/fstest.c

Modified: head/tools/regression/fstest/fstest.c
==
--- head/tools/regression/fstest/fstest.c   Mon Aug  9 17:40:59 2010
(r211109)
+++ head/tools/regression/fstest/fstest.c   Mon Aug  9 17:42:04 2010
(r20)
@@ -538,28 +538,26 @@ call_syscall(struct syscall_desc *scall,
}
case ACTION_BIND:
{
-   struct sockaddr_un sun;
+   struct sockaddr_un sunx;
 
-   sun.sun_family = AF_UNIX;
-   strlcpy(sun.sun_path, STR(0), sizeof(sun.sun_path));
-   sun.sun_len = SUN_LEN(&sun);
+   sunx.sun_family = AF_UNIX;
+   strlcpy(sunx.sun_path, STR(0), sizeof(sunx.sun_path));
rval = socket(AF_UNIX, SOCK_STREAM, 0);
if (rval < 0)
break;
-   rval = bind(rval, (struct sockaddr *)&sun, sizeof(sun));
+   rval = bind(rval, (struct sockaddr *)&sunx, sizeof(sunx));
break;
}
case ACTION_CONNECT:
{
-   struct sockaddr_un sun;
+   struct sockaddr_un sunx;
 
-   sun.sun_family = AF_UNIX;
-   strlcpy(sun.sun_path, STR(0), sizeof(sun.sun_path));
-   sun.sun_len = SUN_LEN(&sun);
+   sunx.sun_family = AF_UNIX;
+   strlcpy(sunx.sun_path, STR(0), sizeof(sunx.sun_path));
rval = socket(AF_UNIX, SOCK_STREAM, 0);
if (rval < 0)
break;
-   rval = connect(rval, (struct sockaddr *)&sun, sizeof(sun));
+   rval = connect(rval, (struct sockaddr *)&sunx, sizeof(sunx));
break;
}
case ACTION_CHMOD:
___
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: r211111 - head/sys/dev/usb/serial

2010-08-09 Thread Gavin Atkinson
Author: gavin
Date: Mon Aug  9 17:42:05 2010
New Revision: 21
URL: http://svn.freebsd.org/changeset/base/21

Log:
  Attempt to autodetect the cype of chipset, rather than storing this
  within the device table.  This code uses the same algorithm as used in the
  Linux, NetBSD and DragonflyBSD driver.
  
  While investigating this, it became apparent that the Linux driver always
  initialises the device, and not just in the PL2303HX case.  Change
  uplcom(4) to do the same.
  
  This change allows us to synchronize our device ID list with Linux and
  NetBSD, without requiring knowledge of the chipset in use.
  
  Reviewed by:  hselasky
  MFC after:6 weeks

Modified:
  head/sys/dev/usb/serial/uplcom.c

Modified: head/sys/dev/usb/serial/uplcom.c
==
--- head/sys/dev/usb/serial/uplcom.cMon Aug  9 17:42:04 2010
(r20)
+++ head/sys/dev/usb/serial/uplcom.cMon Aug  9 17:42:05 2010
(r21)
@@ -144,7 +144,7 @@ SYSCTL_INT(_hw_usb_uplcom, OID_AUTO, deb
 #defineRSAQ_STATUS_DCD 0x01
 
 #defineTYPE_PL2303 0
-#defineTYPE_PL2303X1
+#defineTYPE_PL2303HX   1
 
 enum {
UPLCOM_BULK_DT_WR,
@@ -174,7 +174,9 @@ struct uplcom_softc {
 /* prototypes */
 
 static usb_error_t uplcom_reset(struct uplcom_softc *, struct usb_device *);
-static int uplcom_pl2303x_init(struct usb_device *);
+static usb_error_t uplcom_pl2303_do(struct usb_device *, int8_t, uint8_t,
+   uint16_t, uint16_t, uint16_t);
+static int uplcom_pl2303_init(struct usb_device *, uint8_t);
 static voiduplcom_cfg_set_dtr(struct ucom_softc *, uint8_t);
 static voiduplcom_cfg_set_rts(struct ucom_softc *, uint8_t);
 static voiduplcom_cfg_set_break(struct ucom_softc *, uint8_t);
@@ -243,59 +245,33 @@ static struct ucom_callback uplcom_callb
.ucom_poll = &uplcom_poll,
 };
 
-#defineUPLCOM_DEV(v,p,rl,rh,t) \
-  { USB_VENDOR(USB_VENDOR_##v), USB_PRODUCT(USB_PRODUCT_##v##_##p), \
-USB_DEV_BCD_GTEQ(rl), USB_DEV_BCD_LTEQ(rh), USB_DRIVER_INFO(TYPE_##t) }
+#defineUPLCOM_DEV(v,p) \
+  { USB_VENDOR(USB_VENDOR_##v), USB_PRODUCT(USB_PRODUCT_##v##_##p) }
 
 static const struct usb_device_id uplcom_devs[] = {
-   /* Belkin F5U257 */
-   UPLCOM_DEV(BELKIN, F5U257, 0, 0x, PL2303X),
-   /* I/O DATA USB-RSAQ */
-   UPLCOM_DEV(IODATA, USBRSAQ, 0, 0x, PL2303),
-   /* I/O DATA USB-RSAQ2 */
-   UPLCOM_DEV(PROLIFIC, RSAQ2, 0, 0x, PL2303),
-   /* I/O DATA USB-RSAQ3 */
-   UPLCOM_DEV(PROLIFIC, RSAQ3, 0, 0x, PL2303X),
-   /* I/O DATA USB-RSAQ5 */
-   UPLCOM_DEV(IODATA, USBRSAQ5, 0, 0x, PL2303X),
-   /* PLANEX USB-RS232 URS-03 */
-   UPLCOM_DEV(ATEN, UC232A, 0, 0x, PL2303),
-   /* TrendNet TU-S9 */
-   UPLCOM_DEV(PROLIFIC, PL2303, 0x0400, 0x, PL2303X),
-   /* ST Lab USB-SERIAL-4 */
-   UPLCOM_DEV(PROLIFIC, PL2303, 0x0300, 0x03FF, PL2303X),
-   /* IOGEAR/ATEN UC-232A (also ST Lab USB-SERIAL-1) */
-   UPLCOM_DEV(PROLIFIC, PL2303, 0, 0x02FF, PL2303),
-   /* TDK USB-PHS Adapter UHA6400 */
-   UPLCOM_DEV(TDK, UHA6400, 0, 0x, PL2303),
-   /* RATOC REX-USB60 */
-   UPLCOM_DEV(RATOC, REXUSB60, 0, 0x, PL2303),
-   /* ELECOM UC-SGT */
-   UPLCOM_DEV(ELECOM, UCSGT, 0, 0x, PL2303),
-   UPLCOM_DEV(ELECOM, UCSGT0, 0, 0x, PL2303),
-   /* Sagem USB-Serial Controller */
-   UPLCOM_DEV(SAGEM, USBSERIAL, 0, 0x, PL2303X),
-   /* Sony Ericsson USB Cable */
-   UPLCOM_DEV(SONYERICSSON, DCU10, 0, 0x, PL2303),
-   /* SOURCENEXT KeikaiDenwa 8 */
-   UPLCOM_DEV(SOURCENEXT, KEIKAI8, 0, 0x, PL2303),
-   /* SOURCENEXT KeikaiDenwa 8 with charger */
-   UPLCOM_DEV(SOURCENEXT, KEIKAI8_CHG, 0, 0, PL2303),
-   /* HAL Corporation Crossam2+USB */
-   UPLCOM_DEV(HAL, IMR001, 0, 0x, PL2303),
-   /* Sitecom USB to Serial */
-   UPLCOM_DEV(SITECOM, SERIAL, 0, 0x, PL2303),
-   /* Tripp-Lite U209-000-R */
-   UPLCOM_DEV(TRIPPLITE, U209, 0, 0x, PL2303X),
-   UPLCOM_DEV(RADIOSHACK, USBCABLE, 0, 0x, PL2303),
-   /* Prolific Pharos */
-   UPLCOM_DEV(PROLIFIC, PHAROS, 0, 0x, PL2303),
-   /* Willcom W-SIM */
-   UPLCOM_DEV(PROLIFIC2, WSIM, 0, 0x, PL2303X),
-   /* Mobile Action MA-620 Infrared Adapter */
-   UPLCOM_DEV(MOBILEACTION, MA620, 0, 0x, PL2303X),
-   /* Corega CG-USBRS232R */
-   UPLCOM_DEV(COREGA, CGUSBRS232R, 0, 0x, PL2303X),
+   UPLCOM_DEV(ATEN, UC232A),   /* PLANEX USB-RS232 URS-03 */
+   UPLCOM_DEV(BELKIN, F5U257), /* Belkin F5U257 */
+   UPLCOM_DEV(COREGA, CGUSBRS232R),/* Corega CG-USBRS232R */
+   UPLCOM_DEV(ELECOM, UCSGT),  /* ELECOM UC-SGT */
+   UPLCOM_D

svn commit: r211112 - head/sys/compat/x86bios

2010-08-09 Thread Jung-uk Kim
Author: jkim
Date: Mon Aug  9 17:54:26 2010
New Revision: 22
URL: http://svn.freebsd.org/changeset/base/22

Log:
  Reduce diffs between VM86 and X86EMU wrappers for x86bios_alloc() and
  x86bios_free().  Add strict sanity checks for VM86 wrapper and add strict
  page table locking for X86EMU wrapper.

Modified:
  head/sys/compat/x86bios/x86bios.c

Modified: head/sys/compat/x86bios/x86bios.c
==
--- head/sys/compat/x86bios/x86bios.c   Mon Aug  9 17:42:05 2010
(r21)
+++ head/sys/compat/x86bios/x86bios.c   Mon Aug  9 17:54:26 2010
(r22)
@@ -112,44 +112,49 @@ x86bios_vmf2emu(struct vm86frame *vmf, s
 void *
 x86bios_alloc(uint32_t *offset, size_t size, int flags)
 {
-   vm_offset_t addr;
+   void *vaddr;
int i;
 
-   addr = (vm_offset_t)contigmalloc(size, M_DEVBUF, flags, 0,
-   X86BIOS_MEM_SIZE, PAGE_SIZE, 0);
-   if (addr != 0) {
-   *offset = vtophys(addr);
+   if (offset == NULL || size == 0)
+   return (NULL);
+   vaddr = contigmalloc(size, M_DEVBUF, flags, 0, X86BIOS_MEM_SIZE,
+   PAGE_SIZE, 0);
+   if (vaddr != NULL) {
+   *offset = vtophys(vaddr);
mtx_lock(&x86bios_lock);
for (i = 0; i < atop(round_page(size)); i++)
vm86_addpage(&x86bios_vmc, atop(*offset) + i,
-   addr + ptoa(i));
+   (vm_offset_t)vaddr + ptoa(i));
mtx_unlock(&x86bios_lock);
}
 
-   return ((void *)addr);
+   return (vaddr);
 }
 
 void
 x86bios_free(void *addr, size_t size)
 {
-   int i, last;
+   vm_paddr_t paddr;
+   int i, nfree;
 
+   if (addr == NULL || size == 0)
+   return;
+   paddr = vtophys(addr);
+   if (paddr >= X86BIOS_MEM_SIZE || (paddr & PAGE_MASK) != 0)
+   return;
+   nfree = atop(round_page(size));
mtx_lock(&x86bios_lock);
-   for (i = 0, last = -1; i < x86bios_vmc.npages; i++)
-   if (x86bios_vmc.pmap[i].kva >= (vm_offset_t)addr &&
-   x86bios_vmc.pmap[i].kva < (vm_offset_t)addr + size) {
-   bzero(&x86bios_vmc.pmap[i],
-   sizeof(x86bios_vmc.pmap[i]));
-   last = i;
-   }
-   if (last < 0) {
+   for (i = 0; i < x86bios_vmc.npages; i++)
+   if (x86bios_vmc.pmap[i].kva == (vm_offset_t)addr)
+   break;
+   if (i >= x86bios_vmc.npages) {
mtx_unlock(&x86bios_lock);
return;
}
-   if (last == x86bios_vmc.npages - 1) {
-   x86bios_vmc.npages -= atop(round_page(size));
-   for (i = x86bios_vmc.npages - 1;
-   i >= 0 && x86bios_vmc.pmap[i].kva == 0; i--)
+   bzero(x86bios_vmc.pmap + i, sizeof(*x86bios_vmc.pmap) * nfree);
+   if (i + nfree == x86bios_vmc.npages) {
+   x86bios_vmc.npages -= nfree;
+   while (--i >= 0 && x86bios_vmc.pmap[i].kva == 0)
x86bios_vmc.npages--;
}
mtx_unlock(&x86bios_lock);
@@ -552,12 +557,13 @@ x86bios_alloc(uint32_t *offset, size_t s
 
if (offset == NULL || size == 0)
return (NULL);
-
vaddr = contigmalloc(size, M_DEVBUF, flags, X86BIOS_RAM_BASE,
x86bios_rom_phys, X86BIOS_PAGE_SIZE, 0);
if (vaddr != NULL) {
*offset = vtophys(vaddr);
+   mtx_lock_spin(&x86bios_lock);
x86bios_set_pages((vm_offset_t)vaddr, *offset, size);
+   mtx_unlock_spin(&x86bios_lock);
}
 
return (vaddr);
@@ -570,14 +576,14 @@ x86bios_free(void *addr, size_t size)
 
if (addr == NULL || size == 0)
return;
-
paddr = vtophys(addr);
if (paddr < X86BIOS_RAM_BASE || paddr >= x86bios_rom_phys ||
paddr % X86BIOS_PAGE_SIZE != 0)
return;
-
+   mtx_lock_spin(&x86bios_lock);
bzero(x86bios_map + paddr / X86BIOS_PAGE_SIZE,
sizeof(*x86bios_map) * howmany(size, X86BIOS_PAGE_SIZE));
+   mtx_unlock_spin(&x86bios_lock);
contigfree(addr, size, M_DEVBUF);
 }
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r211113 - head/sys/teken

2010-08-09 Thread Ed Schouten
Author: ed
Date: Mon Aug  9 18:07:15 2010
New Revision: 23
URL: http://svn.freebsd.org/changeset/base/23

Log:
  Make ^L with cons25 and origin mode bit more sane.
  
  Even though cons25 normally doesn't support origin regions, this
  emulator does allow you to do it. It makes more sense to blank only the
  origin region when emitting ^L instead of blanking the entire screen.
  Apart from that, we should always place the cursor inside the origin
  region, which doesn't happen right now.

Modified:
  head/sys/teken/teken_subr.h

Modified: head/sys/teken/teken_subr.h
==
--- head/sys/teken/teken_subr.h Mon Aug  9 17:54:26 2010(r22)
+++ head/sys/teken/teken_subr.h Mon Aug  9 18:07:15 2010(r23)
@@ -725,11 +725,17 @@ teken_subr_newpage(teken_t *t)
if (t->t_stateflags & TS_CONS25) {
teken_rect_t tr;
 
-   tr.tr_begin.tp_row = tr.tr_begin.tp_col = 0;
-   tr.tr_end = t->t_winsize;
+   /* Clear screen. */
+   tr.tr_begin.tp_row = t->t_originreg.ts_begin;
+   tr.tr_begin.tp_col = 0;
+   tr.tr_end.tp_row = t->t_originreg.ts_end;
+   tr.tr_end.tp_col = t->t_winsize.tp_col;
teken_funcs_fill(t, &tr, BLANK, &t->t_curattr);
 
-   t->t_cursor.tp_row = t->t_cursor.tp_col = 0;
+   /* Cursor at top left. */
+   t->t_cursor.tp_row = t->t_originreg.ts_begin;
+   t->t_cursor.tp_col = 0;
+   t->t_stateflags &= ~TS_WRAPPED;
teken_funcs_cursor(t);
} else {
teken_subr_newline(t);
___
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: r211114 - head/sys/compat/x86bios

2010-08-09 Thread Jung-uk Kim
Author: jkim
Date: Mon Aug  9 18:10:32 2010
New Revision: 24
URL: http://svn.freebsd.org/changeset/base/24

Log:
  Initialize a variable just before its use.

Modified:
  head/sys/compat/x86bios/x86bios.c

Modified: head/sys/compat/x86bios/x86bios.c
==
--- head/sys/compat/x86bios/x86bios.c   Mon Aug  9 18:07:15 2010
(r23)
+++ head/sys/compat/x86bios/x86bios.c   Mon Aug  9 18:10:32 2010
(r24)
@@ -142,7 +142,6 @@ x86bios_free(void *addr, size_t size)
paddr = vtophys(addr);
if (paddr >= X86BIOS_MEM_SIZE || (paddr & PAGE_MASK) != 0)
return;
-   nfree = atop(round_page(size));
mtx_lock(&x86bios_lock);
for (i = 0; i < x86bios_vmc.npages; i++)
if (x86bios_vmc.pmap[i].kva == (vm_offset_t)addr)
@@ -151,6 +150,7 @@ x86bios_free(void *addr, size_t size)
mtx_unlock(&x86bios_lock);
return;
}
+   nfree = atop(round_page(size));
bzero(x86bios_vmc.pmap + i, sizeof(*x86bios_vmc.pmap) * nfree);
if (i + nfree == x86bios_vmc.npages) {
x86bios_vmc.npages -= nfree;
___
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: r211115 - head/sys/netinet6

2010-08-09 Thread Bjoern A. Zeeb
Author: bz
Date: Mon Aug  9 19:53:24 2010
New Revision: 25
URL: http://svn.freebsd.org/changeset/base/25

Log:
  MFp4 CH180235:
  
  Add proto spacers to inet6sw like we have for legacy IP. This allows us
  to dynamically pf_proto_register() for INET6 from modules, needed by
  upcoming CARP changes and SeND.
  MC and SCTP could make use of it as well in theory in the future after
  upcoming VIMAGE vnet teardown work.
  
  Discussed with:   will, anchie
  MFC after:10 days

Modified:
  head/sys/netinet6/in6_proto.c

Modified: head/sys/netinet6/in6_proto.c
==
--- head/sys/netinet6/in6_proto.c   Mon Aug  9 18:10:32 2010
(r24)
+++ head/sys/netinet6/in6_proto.c   Mon Aug  9 19:53:24 2010
(r25)
@@ -145,6 +145,14 @@ static struct pr_usrreqs nousrreqs;
 #define PR_LISTEN  0
 #define PR_ABRTACPTDIS 0
 
+/* Spacer for loadable protocols. */
+#define IP6PROTOSPACER \
+{  \
+   .pr_domain =&inet6domain,   \
+   .pr_protocol =  PROTO_SPACER,   \
+   .pr_usrreqs =   &nousrreqs  \
+}
+
 struct ip6protosw inet6sw[] = {
 {
.pr_type =  0,
@@ -340,6 +348,15 @@ struct ip6protosw inet6sw[] = {
.pr_usrreqs =   &rip6_usrreqs
 },
 #endif /* DEV_CARP */
+/* Spacer n-times for loadable protocols. */
+IP6PROTOSPACER,
+IP6PROTOSPACER,
+IP6PROTOSPACER,
+IP6PROTOSPACER,
+IP6PROTOSPACER,
+IP6PROTOSPACER,
+IP6PROTOSPACER,
+IP6PROTOSPACER,
 /* raw wildcard */
 {
.pr_type =  SOCK_RAW,
___
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: r211116 - head/tools/regression/fstest

2010-08-09 Thread Pawel Jakub Dawidek
Author: pjd
Date: Mon Aug  9 20:16:52 2010
New Revision: 26
URL: http://svn.freebsd.org/changeset/base/26

Log:
  Linux has no strlcpy().

Modified:
  head/tools/regression/fstest/fstest.c

Modified: head/tools/regression/fstest/fstest.c
==
--- head/tools/regression/fstest/fstest.c   Mon Aug  9 19:53:24 2010
(r25)
+++ head/tools/regression/fstest/fstest.c   Mon Aug  9 20:16:52 2010
(r26)
@@ -541,7 +541,8 @@ call_syscall(struct syscall_desc *scall,
struct sockaddr_un sunx;
 
sunx.sun_family = AF_UNIX;
-   strlcpy(sunx.sun_path, STR(0), sizeof(sunx.sun_path));
+   strncpy(sunx.sun_path, STR(0), sizeof(sunx.sun_path) - 1);
+   sunx.sun_path[sizeof(sunx.sun_path) - 1] = '\0';
rval = socket(AF_UNIX, SOCK_STREAM, 0);
if (rval < 0)
break;
@@ -553,7 +554,8 @@ call_syscall(struct syscall_desc *scall,
struct sockaddr_un sunx;
 
sunx.sun_family = AF_UNIX;
-   strlcpy(sunx.sun_path, STR(0), sizeof(sunx.sun_path));
+   strncpy(sunx.sun_path, STR(0), sizeof(sunx.sun_path) - 1);
+   sunx.sun_path[sizeof(sunx.sun_path) - 1] = '\0';
rval = socket(AF_UNIX, SOCK_STREAM, 0);
if (rval < 0)
break;
___
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: r211117 - in head/sys: amd64/amd64 i386/i386

2010-08-09 Thread Attilio Rao
Author: attilio
Date: Mon Aug  9 20:25:06 2010
New Revision: 27
URL: http://svn.freebsd.org/changeset/base/27

Log:
  Simplify the logic for handling ipi_selected() and ipi_cpu() in the
  amd64/i386 case.
  
  Reviewed by:  jhb
  Tested by:gianni
  MFC after:1 month
  X-MFC:210939

Modified:
  head/sys/amd64/amd64/mp_machdep.c
  head/sys/i386/i386/mp_machdep.c

Modified: head/sys/amd64/amd64/mp_machdep.c
==
--- head/sys/amd64/amd64/mp_machdep.c   Mon Aug  9 20:16:52 2010
(r26)
+++ head/sys/amd64/amd64/mp_machdep.c   Mon Aug  9 20:25:06 2010
(r27)
@@ -1087,6 +1087,30 @@ smp_targeted_tlb_shootdown(cpumask_t mas
mtx_unlock_spin(&smp_ipi_mtx);
 }
 
+/*
+ * Send an IPI to specified CPU handling the bitmap logic.
+ */
+static void
+ipi_send_cpu(int cpu, u_int ipi)
+{
+   u_int bitmap, old_pending, new_pending;
+
+   KASSERT(cpu_apic_ids[cpu] != -1, ("IPI to non-existent CPU %d", cpu));
+
+   if (IPI_IS_BITMAPED(ipi)) {
+   bitmap = 1 << ipi;
+   ipi = IPI_BITMAP_VECTOR;
+   do {
+   old_pending = cpu_ipi_pending[cpu];
+   new_pending = old_pending | bitmap;
+   } while  (!atomic_cmpset_int(&cpu_ipi_pending[cpu],
+   old_pending, new_pending)); 
+   if (old_pending)
+   return;
+   }
+   lapic_ipi_vectored(ipi, cpu_apic_ids[cpu]);
+}
+
 void
 smp_cache_flush(void)
 {
@@ -1210,14 +1234,6 @@ void
 ipi_selected(cpumask_t cpus, u_int ipi)
 {
int cpu;
-   u_int bitmap = 0;
-   u_int old_pending;
-   u_int new_pending;
-
-   if (IPI_IS_BITMAPED(ipi)) { 
-   bitmap = 1 << ipi;
-   ipi = IPI_BITMAP_VECTOR;
-   }
 
/*
 * IPI_STOP_HARD maps to a NMI and the trap handler needs a bit
@@ -1231,20 +1247,7 @@ ipi_selected(cpumask_t cpus, u_int ipi)
while ((cpu = ffs(cpus)) != 0) {
cpu--;
cpus &= ~(1 << cpu);
-
-   KASSERT(cpu_apic_ids[cpu] != -1,
-   ("IPI to non-existent CPU %d", cpu));
-
-   if (bitmap) {
-   do {
-   old_pending = cpu_ipi_pending[cpu];
-   new_pending = old_pending | bitmap;
-   } while  (!atomic_cmpset_int(&cpu_ipi_pending[cpu],
-   old_pending, new_pending)); 
-   if (old_pending)
-   continue;
-   }
-   lapic_ipi_vectored(ipi, cpu_apic_ids[cpu]);
+   ipi_send_cpu(cpu, ipi);
}
 }
 
@@ -1254,14 +1257,6 @@ ipi_selected(cpumask_t cpus, u_int ipi)
 void
 ipi_cpu(int cpu, u_int ipi)
 {
-   u_int bitmap = 0;
-   u_int old_pending;
-   u_int new_pending;
-
-   if (IPI_IS_BITMAPED(ipi)) { 
-   bitmap = 1 << ipi;
-   ipi = IPI_BITMAP_VECTOR;
-   }
 
/*
 * IPI_STOP_HARD maps to a NMI and the trap handler needs a bit
@@ -1272,18 +1267,7 @@ ipi_cpu(int cpu, u_int ipi)
atomic_set_int(&ipi_nmi_pending, 1 << cpu);
 
CTR3(KTR_SMP, "%s: cpu: %d ipi: %x", __func__, cpu, ipi);
-   KASSERT(cpu_apic_ids[cpu] != -1, ("IPI to non-existent CPU %d", cpu));
-
-   if (bitmap) {
-   do {
-   old_pending = cpu_ipi_pending[cpu];
-   new_pending = old_pending | bitmap;
-   } while  (!atomic_cmpset_int(&cpu_ipi_pending[cpu],
-   old_pending, new_pending)); 
-   if (old_pending)
-   return;
-   }
-   lapic_ipi_vectored(ipi, cpu_apic_ids[cpu]);
+   ipi_send_cpu(cpu, ipi);
 }
 
 /*

Modified: head/sys/i386/i386/mp_machdep.c
==
--- head/sys/i386/i386/mp_machdep.c Mon Aug  9 20:16:52 2010
(r26)
+++ head/sys/i386/i386/mp_machdep.c Mon Aug  9 20:25:06 2010
(r27)
@@ -1175,6 +1175,30 @@ smp_targeted_tlb_shootdown(cpumask_t mas
mtx_unlock_spin(&smp_ipi_mtx);
 }
 
+/*
+ * Send an IPI to specified CPU handling the bitmap logic.
+ */
+static void
+ipi_send_cpu(int cpu, u_int ipi)
+{
+   u_int bitmap, old_pending, new_pending;
+
+   KASSERT(cpu_apic_ids[cpu] != -1, ("IPI to non-existent CPU %d", cpu));
+
+   if (IPI_IS_BITMAPED(ipi)) {
+   bitmap = 1 << ipi;
+   ipi = IPI_BITMAP_VECTOR;
+   do {
+   old_pending = cpu_ipi_pending[cpu];
+   new_pending = old_pending | bitmap;
+   } while  (!atomic_cmpset_int(&cpu_ipi_pending[cpu],
+   old_pending, new_pending)); 
+   if (old_pending)
+   return;
+   }
+   lapic_ipi_vectored(ipi, cp

Re: svn commit: r211023 - head/usr.sbin/syslogd

2010-08-09 Thread Dag-Erling Smørgrav
"M. Warner Losh"  writes:
> I like the idea of a macro.  Why is a cast through uintptr_t better?

Without the uintptr_t cast, you'll get an error, or at least a warning,
if the pointer is qualified (const and / or volatile).

DES
-- 
Dag-Erling Smørgrav - d...@des.no
___
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: r211120 - head/sys/compat/x86bios

2010-08-09 Thread Jung-uk Kim
Author: jkim
Date: Mon Aug  9 22:06:08 2010
New Revision: 211120
URL: http://svn.freebsd.org/changeset/base/211120

Log:
  Tidy up printf() calls for debugging.

Modified:
  head/sys/compat/x86bios/x86bios.c

Modified: head/sys/compat/x86bios/x86bios.c
==
--- head/sys/compat/x86bios/x86bios.c   Mon Aug  9 21:45:05 2010
(r29)
+++ head/sys/compat/x86bios/x86bios.c   Mon Aug  9 22:06:08 2010
(r211120)
@@ -58,6 +58,13 @@ __FBSDID("$FreeBSD$");
 
 #defineX86BIOS_MEM_SIZE0x0010  /* 1M */
 
+#defineX86BIOS_TRACE(h, n, r)  do {
\
+   printf(__STRING(h)  \
+   " (ax=0x%04x bx=0x%04x cx=0x%04x dx=0x%04x es=0x%04x di=0x%04x)\n",\
+   (n), (r)->R_AX, (r)->R_BX, (r)->R_CX, (r)->R_DX,\
+   (r)->R_ES, (r)->R_DI);  \
+} while (0)
+
 static struct mtx x86bios_lock;
 
 SYSCTL_NODE(_debug, OID_AUTO, x86bios, CTLFLAG_RD, NULL, "x86bios debugging");
@@ -174,10 +181,7 @@ x86bios_call(struct x86regs *regs, uint1
struct vm86frame vmf;
 
if (x86bios_trace_call)
-   printf("Calling 0x%05x (ax=0x%04x bx=0x%04x "
-   "cx=0x%04x dx=0x%04x es=0x%04x di=0x%04x)\n",
-   (seg << 4) + off, regs->R_AX, regs->R_BX, regs->R_CX,
-   regs->R_DX, regs->R_ES, regs->R_DI);
+   X86BIOS_TRACE(Calling 0x%06x, (seg << 4) + off, regs);
 
bzero(&vmf, sizeof(vmf));
x86bios_emu2vmf((struct x86emu_regs *)regs, &vmf);
@@ -189,10 +193,7 @@ x86bios_call(struct x86regs *regs, uint1
x86bios_vmf2emu(&vmf, (struct x86emu_regs *)regs);
 
if (x86bios_trace_call)
-   printf("Exiting 0x%05x (ax=0x%04x bx=0x%04x "
-   "cx=0x%04x dx=0x%04x es=0x%04x di=0x%04x)\n",
-   (seg << 4) + off, regs->R_AX, regs->R_BX, regs->R_CX,
-   regs->R_DX, regs->R_ES, regs->R_DI);
+   X86BIOS_TRACE(Exiting 0x%06x, (seg << 4) + off, regs);
 }
 
 uint32_t
@@ -208,10 +209,7 @@ x86bios_intr(struct x86regs *regs, int i
struct vm86frame vmf;
 
if (x86bios_trace_int)
-   printf("Calling int 0x%x (ax=0x%04x bx=0x%04x "
-   "cx=0x%04x dx=0x%04x es=0x%04x di=0x%04x)\n",
-   intno, regs->R_AX, regs->R_BX, regs->R_CX,
-   regs->R_DX, regs->R_ES, regs->R_DI);
+   X86BIOS_TRACE(Calling INT 0x%02x, intno, regs);
 
bzero(&vmf, sizeof(vmf));
x86bios_emu2vmf((struct x86emu_regs *)regs, &vmf);
@@ -221,10 +219,7 @@ x86bios_intr(struct x86regs *regs, int i
x86bios_vmf2emu(&vmf, (struct x86emu_regs *)regs);
 
if (x86bios_trace_int)
-   printf("Exiting int 0x%x (ax=0x%04x bx=0x%04x "
-   "cx=0x%04x dx=0x%04x es=0x%04x di=0x%04x)\n",
-   intno, regs->R_AX, regs->R_BX, regs->R_CX,
-   regs->R_DX, regs->R_ES, regs->R_DI);
+   X86BIOS_TRACE(Exiting INT 0x%02x, intno, regs);
 }
 
 void *
@@ -271,7 +266,7 @@ x86bios_uninit(void)
 #defineX86BIOS_RAM_BASE0x1000
 #defineX86BIOS_ROM_BASE0x000a
 
-#defineX86BIOS_ROM_SIZE(X86BIOS_MEM_SIZE - 
(uint32_t)x86bios_rom_phys)
+#defineX86BIOS_ROM_SIZE(X86BIOS_MEM_SIZE - x86bios_rom_phys)
 #defineX86BIOS_SEG_SIZEX86BIOS_PAGE_SIZE
 
 #defineX86BIOS_PAGES   (X86BIOS_MEM_SIZE / X86BIOS_PAGE_SIZE)
@@ -604,10 +599,7 @@ x86bios_call(struct x86regs *regs, uint1
return;
 
if (x86bios_trace_call)
-   printf("Calling 0x%05x (ax=0x%04x bx=0x%04x "
-   "cx=0x%04x dx=0x%04x es=0x%04x di=0x%04x)\n",
-   (seg << 4) + off, regs->R_AX, regs->R_BX, regs->R_CX,
-   regs->R_DX, regs->R_ES, regs->R_DI);
+   X86BIOS_TRACE(Calling 0x%06x, (seg << 4) + off, regs);
 
mtx_lock_spin(&x86bios_lock);
memcpy(&x86bios_emu.x86, regs, sizeof(*regs));
@@ -617,12 +609,9 @@ x86bios_call(struct x86regs *regs, uint1
mtx_unlock_spin(&x86bios_lock);
 
if (x86bios_trace_call) {
-   printf("Exiting 0x%05x (ax=0x%04x bx=0x%04x "
-   "cx=0x%04x dx=0x%04x es=0x%04x di=0x%04x)\n",
-   (seg << 4) + off, regs->R_AX, regs->R_BX, regs->R_CX,
-   regs->R_DX, regs->R_ES, regs->R_DI);
+   X86BIOS_TRACE(Exiting 0x%06x, (seg << 4) + off, regs);
if (x86bios_fault)
-   printf("Page fault at 0x%05x from 0x%04x:0x%04x.\n",
+   printf("Page fault at 0x%06x from 0x%04x:0x%04x.\n",
x86bios_fault_addr, x86bios_fault_cs,
x86bios_fault_ip);
}
@@ -649,10 +638,7 @@ x86bios_int

svn commit: r211123 - head/sys/kern

2010-08-09 Thread Ivan Voras
Author: ivoras
Date: Mon Aug  9 22:22:46 2010
New Revision: 211123
URL: http://svn.freebsd.org/changeset/base/211123

Log:
  Elaborate on how hirunningspace was chosen.

Modified:
  head/sys/kern/vfs_bio.c

Modified: head/sys/kern/vfs_bio.c
==
--- head/sys/kern/vfs_bio.c Mon Aug  9 22:22:06 2010(r211122)
+++ head/sys/kern/vfs_bio.c Mon Aug  9 22:22:46 2010(r211123)
@@ -622,8 +622,11 @@ bufinit(void)
 
/*
 * Note: The 16 MB upper limit for hirunningspace was chosen
-* arbitrarily and may need further tuning. The lower 1 MB
-* limit is the historical upper limit for hirunningspace.
+* arbitrarily and may need further tuning. It corresponds to
+* 128 outstanding write IO requests (if IO size is 128 KiB),
+* which fits with many RAID controllers' tagged queing limits.
+* The lower 1 MB limit is the historical upper limit for
+* hirunningspace.
 */
hirunningspace = lmax(lmin(roundup(hibufspace / 64, MAXBSIZE),
16 * 1024 * 1024), 1024 * 1024);
___
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: r211126 - head/sys/kern

2010-08-09 Thread Ivan Voras
Author: ivoras
Date: Mon Aug  9 22:56:10 2010
New Revision: 211126
URL: http://svn.freebsd.org/changeset/base/211126

Log:
  Bumping the read-ahead count once more, to value equivalent to 512 KiB on
  most system, based on benchmark results on a low-end fibre channel SAN
  under VMWare:
  
  vfs.read_max  read performance
  8  (historical default)   83 MB/s
  16 (recent bump)  131 MB/s
  32 (this version) 152 MB/s
  64157 MB/s
  
  (results are +/- 3 MB/s)
  
  As read-ahead is heuristic, based on past IO requests, it shouldn't be
  problematic. The new default is still smaller then in other OSes.

Modified:
  head/sys/kern/vfs_cluster.c

Modified: head/sys/kern/vfs_cluster.c
==
--- head/sys/kern/vfs_cluster.c Mon Aug  9 22:30:14 2010(r211125)
+++ head/sys/kern/vfs_cluster.c Mon Aug  9 22:56:10 2010(r211126)
@@ -71,7 +71,7 @@ static int write_behind = 1;
 SYSCTL_INT(_vfs, OID_AUTO, write_behind, CTLFLAG_RW, &write_behind, 0,
 "Cluster write-behind; 0: disable, 1: enable, 2: backed off");
 
-static int read_max = 16;
+static int read_max = 32;
 SYSCTL_INT(_vfs, OID_AUTO, read_max, CTLFLAG_RW, &read_max, 0,
 "Cluster read-ahead max block count");
 
___
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: r211129 - head/sys/kern

2010-08-09 Thread Ivan Voras
Author: ivoras
Date: Mon Aug  9 23:32:37 2010
New Revision: 211129
URL: http://svn.freebsd.org/changeset/base/211129

Log:
  Fix (hopefully) the spelling of "queuing."
  
  Submitted by: bf1783 at gmail com

Modified:
  head/sys/kern/vfs_bio.c

Modified: head/sys/kern/vfs_bio.c
==
--- head/sys/kern/vfs_bio.c Mon Aug  9 23:29:37 2010(r211128)
+++ head/sys/kern/vfs_bio.c Mon Aug  9 23:32:37 2010(r211129)
@@ -624,7 +624,7 @@ bufinit(void)
 * Note: The 16 MB upper limit for hirunningspace was chosen
 * arbitrarily and may need further tuning. It corresponds to
 * 128 outstanding write IO requests (if IO size is 128 KiB),
-* which fits with many RAID controllers' tagged queing limits.
+* which fits with many RAID controllers' tagged queuing limits.
 * The lower 1 MB limit is the historical upper limit for
 * hirunningspace.
 */
___
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: r211130 - head/libexec/rtld-elf/mips

2010-08-09 Thread Neel Natu
Author: neel
Date: Tue Aug 10 05:15:35 2010
New Revision: 211130
URL: http://svn.freebsd.org/changeset/base/211130

Log:
  Fix compilation error for 64-bit little endian build:
  libexec/rtld-elf/mips/reloc.c:196: warning: right shift count >= width of type
  
  When the expression '(r_info) >> 32' was passed to bswap32() it was promptly
  changed to '(uint32_t)(r_info) >> 32' which is not what we intended.

Modified:
  head/libexec/rtld-elf/mips/reloc.c

Modified: head/libexec/rtld-elf/mips/reloc.c
==
--- head/libexec/rtld-elf/mips/reloc.c  Mon Aug  9 23:32:37 2010
(r211129)
+++ head/libexec/rtld-elf/mips/reloc.c  Tue Aug 10 05:15:35 2010
(r211130)
@@ -75,7 +75,7 @@ void _rtld_relocate_nonplt_self(Elf_Dyn 
  * ELF64 MIPS encodes the relocs uniquely.  The first 32-bits of info contain
  * the symbol index.  The top 32-bits contain three relocation types encoded
  * in big-endian integer with first relocation in LSB.  This means for little
- * endian we have to byte swap that interger (r_type).
+ * endian we have to byte swap that integer (r_type).
  */
 #defineElf_Sxword  Elf64_Sxword
 #defineELF_R_NXTTYPE_64_P(r_type)  r_type) >> 8) & 0xff) == 
R_TYPE(64))
@@ -83,7 +83,7 @@ void _rtld_relocate_nonplt_self(Elf_Dyn 
 #undef ELF_R_SYM
 #undef ELF_R_TYPE
 #define ELF_R_SYM(r_info)  ((r_info) & 0x)
-#define ELF_R_TYPE(r_info) bswap32((r_info) >> 32)
+#define ELF_R_TYPE(r_info) bswap32(((r_info) >> 32))
 #endif
 #else
 #defineELF_R_NXTTYPE_64_P(r_type)  (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: r211131 - head/sys/compat/x86bios

2010-08-09 Thread Jung-uk Kim
Author: jkim
Date: Tue Aug 10 06:25:08 2010
New Revision: 211131
URL: http://svn.freebsd.org/changeset/base/211131

Log:
  Tidy up locking and memory allocation for the real mode emulator wrapper.
  Now we use a regular mutex instead of a spin mutex.  When we enter and exit
  the emulator, spinlock_enter() and spinlock_exit() are additionally used.
  Move some page table related stuff from x86bios_init() and x86bios_uninit()
  to x86bios_map_mem() and x86bios_unmap_mem().

Modified:
  head/sys/compat/x86bios/x86bios.c

Modified: head/sys/compat/x86bios/x86bios.c
==
--- head/sys/compat/x86bios/x86bios.c   Tue Aug 10 05:15:35 2010
(r211130)
+++ head/sys/compat/x86bios/x86bios.c   Tue Aug 10 06:25:08 2010
(r211131)
@@ -556,9 +556,9 @@ x86bios_alloc(uint32_t *offset, size_t s
x86bios_rom_phys, X86BIOS_PAGE_SIZE, 0);
if (vaddr != NULL) {
*offset = vtophys(vaddr);
-   mtx_lock_spin(&x86bios_lock);
+   mtx_lock(&x86bios_lock);
x86bios_set_pages((vm_offset_t)vaddr, *offset, size);
-   mtx_unlock_spin(&x86bios_lock);
+   mtx_unlock(&x86bios_lock);
}
 
return (vaddr);
@@ -575,10 +575,10 @@ x86bios_free(void *addr, size_t size)
if (paddr < X86BIOS_RAM_BASE || paddr >= x86bios_rom_phys ||
paddr % X86BIOS_PAGE_SIZE != 0)
return;
-   mtx_lock_spin(&x86bios_lock);
+   mtx_lock(&x86bios_lock);
bzero(x86bios_map + paddr / X86BIOS_PAGE_SIZE,
sizeof(*x86bios_map) * howmany(size, X86BIOS_PAGE_SIZE));
-   mtx_unlock_spin(&x86bios_lock);
+   mtx_unlock(&x86bios_lock);
contigfree(addr, size, M_DEVBUF);
 }
 
@@ -595,18 +595,17 @@ void
 x86bios_call(struct x86regs *regs, uint16_t seg, uint16_t off)
 {
 
-   if (x86bios_map == NULL)
-   return;
-
if (x86bios_trace_call)
X86BIOS_TRACE(Calling 0x%06x, (seg << 4) + off, regs);
 
-   mtx_lock_spin(&x86bios_lock);
+   mtx_lock(&x86bios_lock);
+   spinlock_enter();
memcpy(&x86bios_emu.x86, regs, sizeof(*regs));
x86bios_fault = 0;
x86emu_exec_call(&x86bios_emu, seg, off);
memcpy(regs, &x86bios_emu.x86, sizeof(*regs));
-   mtx_unlock_spin(&x86bios_lock);
+   spinlock_exit();
+   mtx_unlock(&x86bios_lock);
 
if (x86bios_trace_call) {
X86BIOS_TRACE(Exiting 0x%06x, (seg << 4) + off, regs);
@@ -634,18 +633,17 @@ x86bios_intr(struct x86regs *regs, int i
if (intno < 0 || intno > 255)
return;
 
-   if (x86bios_map == NULL)
-   return;
-
if (x86bios_trace_int)
X86BIOS_TRACE(Calling INT 0x%02x, intno, regs);
 
-   mtx_lock_spin(&x86bios_lock);
+   mtx_lock(&x86bios_lock);
+   spinlock_enter();
memcpy(&x86bios_emu.x86, regs, sizeof(*regs));
x86bios_fault = 0;
x86emu_exec_intr(&x86bios_emu, intno);
memcpy(regs, &x86bios_emu.x86, sizeof(*regs));
-   mtx_unlock_spin(&x86bios_lock);
+   spinlock_exit();
+   mtx_unlock(&x86bios_lock);
 
if (x86bios_trace_int) {
X86BIOS_TRACE(Exiting INT 0x%02x, intno, regs);
@@ -667,6 +665,7 @@ static __inline void
 x86bios_unmap_mem(void)
 {
 
+   free(x86bios_map, M_DEVBUF);
if (x86bios_ivt != NULL)
 #ifdef X86BIOS_NATIVE_ARCH
pmap_unmapdev((vm_offset_t)x86bios_ivt, X86BIOS_IVT_SIZE);
@@ -683,6 +682,9 @@ static __inline int
 x86bios_map_mem(void)
 {
 
+   x86bios_map = malloc(sizeof(*x86bios_map) * X86BIOS_PAGES, M_DEVBUF,
+   M_WAITOK | M_ZERO);
+
 #ifdef X86BIOS_NATIVE_ARCH
x86bios_ivt = pmap_mapbios(X86BIOS_IVT_BASE, X86BIOS_IVT_SIZE);
 
@@ -714,6 +716,13 @@ x86bios_map_mem(void)
X86BIOS_RAM_BASE, x86bios_rom_phys, X86BIOS_PAGE_SIZE, 0);
x86bios_seg_phys = vtophys(x86bios_seg);
 
+   x86bios_set_pages((vm_offset_t)x86bios_ivt, X86BIOS_IVT_BASE,
+   X86BIOS_IVT_SIZE);
+   x86bios_set_pages((vm_offset_t)x86bios_rom, x86bios_rom_phys,
+   X86BIOS_ROM_SIZE);
+   x86bios_set_pages((vm_offset_t)x86bios_seg, x86bios_seg_phys,
+   X86BIOS_SEG_SIZE);
+
if (bootverbose) {
printf("x86bios:  IVT 0x%06jx-0x%06jx at %p\n",
(vm_paddr_t)X86BIOS_IVT_BASE,
@@ -746,20 +755,11 @@ x86bios_init(void)
 {
int i;
 
+   mtx_init(&x86bios_lock, "x86bios lock", NULL, MTX_DEF);
+
if (x86bios_map_mem() != 0)
return (ENOMEM);
 
-   mtx_init(&x86bios_lock, "x86bios lock", NULL, MTX_SPIN);
-
-   x86bios_map = malloc(sizeof(*x86bios_map) * X86BIOS_PAGES, M_DEVBUF,
-   M_WAITOK | M_ZERO);
-   x86bios_set_pages((vm_offset_t)x86bios_ivt, X86BIOS_IVT_BASE,
-   X86BIOS_IVT_SIZE);
-   x86bios_set_pages((vm_offset_t)x86bios_rom, x86bios_rom_phys,
- 

Re: svn commit: r211130 - head/libexec/rtld-elf/mips

2010-08-09 Thread Stefan Farfeleder
On Tue, Aug 10, 2010 at 05:15:35AM +, Neel Natu wrote:
> Author: neel
> Date: Tue Aug 10 05:15:35 2010
> New Revision: 211130
> URL: http://svn.freebsd.org/changeset/base/211130
> 
> Log:
>   Fix compilation error for 64-bit little endian build:
>   libexec/rtld-elf/mips/reloc.c:196: warning: right shift count >= width of 
> type
>   
>   When the expression '(r_info) >> 32' was passed to bswap32() it was promptly
>   changed to '(uint32_t)(r_info) >> 32' which is not what we intended.

Wouldn't it be better to fix the bswap32 macro instead?

> Modified:
>   head/libexec/rtld-elf/mips/reloc.c
> 
> Modified: head/libexec/rtld-elf/mips/reloc.c
> ==
> --- head/libexec/rtld-elf/mips/reloc.cMon Aug  9 23:32:37 2010
> (r211129)
> +++ head/libexec/rtld-elf/mips/reloc.cTue Aug 10 05:15:35 2010
> (r211130)
> @@ -75,7 +75,7 @@ void _rtld_relocate_nonplt_self(Elf_Dyn 
>   * ELF64 MIPS encodes the relocs uniquely.  The first 32-bits of info contain
>   * the symbol index.  The top 32-bits contain three relocation types encoded
>   * in big-endian integer with first relocation in LSB.  This means for little
> - * endian we have to byte swap that interger (r_type).
> + * endian we have to byte swap that integer (r_type).
>   */
>  #define  Elf_Sxword  Elf64_Sxword
>  #define  ELF_R_NXTTYPE_64_P(r_type)  r_type) >> 8) & 0xff) == 
> R_TYPE(64))
> @@ -83,7 +83,7 @@ void _rtld_relocate_nonplt_self(Elf_Dyn 
>  #undef ELF_R_SYM
>  #undef ELF_R_TYPE
>  #define ELF_R_SYM(r_info)((r_info) & 0x)
> -#define ELF_R_TYPE(r_info)   bswap32((r_info) >> 32)
> +#define ELF_R_TYPE(r_info)   bswap32(((r_info) >> 32))
>  #endif
>  #else
>  #define  ELF_R_NXTTYPE_64_P(r_type)  (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: r211132 - head/usr.bin/indent

2010-08-09 Thread Kevin Lo
Author: kevlo
Date: Tue Aug 10 06:58:12 2010
New Revision: 211132
URL: http://svn.freebsd.org/changeset/base/211132

Log:
  Use NULL instead of 0 when setting up pointer.

Modified:
  head/usr.bin/indent/indent.c

Modified: head/usr.bin/indent/indent.c
==
--- head/usr.bin/indent/indent.cTue Aug 10 06:25:08 2010
(r211131)
+++ head/usr.bin/indent/indent.cTue Aug 10 06:58:12 2010
(r211132)
@@ -199,21 +199,21 @@ main(int argc, char **argv)
 * look thru args (if any) for changes to defaults
 */
if (argv[i][0] != '-') {/* no flag on parameter */
-   if (input == 0) {   /* we must have the input file */
+   if (input == NULL) {/* we must have the input file */
in_name = argv[i];  /* remember name of input file */
input = fopen(in_name, "r");
-   if (input == 0) /* check for open error */
+   if (input == NULL)  /* check for open error */
err(1, "%s", in_name);
continue;
}
-   else if (output == 0) { /* we have the output file */
+   else if (output == NULL) {  /* we have the output file */
out_name = argv[i]; /* remember name of output file */
if (strcmp(in_name, out_name) == 0) {   /* attempt to overwrite
 * the file */
errx(1, "input and output files must be different");
}
output = fopen(out_name, "w");
-   if (output == 0)/* check for create error */
+   if (output == NULL) /* check for create error */
err(1, "%s", out_name);
continue;
}
@@ -222,9 +222,9 @@ main(int argc, char **argv)
else
set_option(argv[i]);
 }  /* end of for */
-if (input == 0)
+if (input == NULL)
input = stdin;
-if (output == 0) {
+if (output == NULL) {
if (troff || input == stdin)
output = stdout;
else {
@@ -1223,11 +1223,11 @@ bakcopy(void)
 
 /* re-open backup file as the input file */
 input = fopen(bakfile, "r");
-if (input == 0)
+if (input == NULL)
err(1, "%s", bakfile);
 /* now the original input file will be the output */
 output = fopen(in_name, "w");
-if (output == 0) {
+if (output == NULL) {
unlink(bakfile);
err(1, "%s", in_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"