Re: svn commit: r213744 - head/bin/sh

2010-10-13 Thread Bruce Evans

On Wed, 13 Oct 2010, John Baldwin wrote:


On Wednesday, October 13, 2010 12:29:27 am Bruce Evans wrote:

On Tue, 12 Oct 2010, David O'Brien wrote:


On Wed, Oct 13, 2010 at 02:18:33PM +1100, Bruce Evans wrote:
...

Of course, debugging and profiling are magic,
but I don't want to have to adorn all functions with STATICs and
__attributes() (and pragmas for othercc...) to recover historical/normal
or variant debugging or profiling of them.


I agree, and would not add STATIC's to a program's code that didn't
already have them.  But in this case we inherited it from 4.4BSD.
I'm just making it actually do something other than being a gratuitous
spelling change.

I believe I've made things more consistent with r213760.


Add __noinline or whatever attributes to STATIC (but keep static in
it) for the DEBUG >= 3 case if you are going that far.  __noinline
should be a syntax error for variables, so this should also find any
STATICs still on variables.  The spelling fix of changing STATIC to
what it actually means
(ASSORTED_HACKS_FOR_DEBUGGING_BUT_NOW_ONLY_FOR_FUNCTIONS) goes too far
for me.


To be honest, I think changing STATIC is excessive churn.


I agree, but 'static' was already spelled 'STATIC' in all cases without
style bugs (except in the #define of STATIC).  Adding __noinline to
the #define of STATIC is a small change.


The "right" fix
is to use 'make DEBUG_FLAGS="-g -DDEBUG=2 -fno-inline"'.  I often use
'make DEBUG_FLAGS="-g -fno-inline"' to workaround excessive inlining when
debugging.  I think all of the STATIC changes should just be backed out.


Adding -fno-inline on the command line is more flexible, but might change
the generated code too much.  Sometimes you want to keep all the little
inline functions inline so as not to see them, or just to give the same
code for them.  -fno-inline-functions-called-once may be more useful.
-fno-inline doesn't affect functions declared as __inline, so in the
kernel where __inline is used too much, -fno-inline doesn't have such a
large effect.  Putting the non-inlining flag in the definition of STATIC
gives even finer control.  But I would only use it if STATIC is already
used.  I would try the hack of "#define static /**/" or
"#define static __noinline_mumble" before changing the source 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"


Re: svn commit: r213793 - in head/sys/dev: ce cp

2010-10-13 Thread Bruce Evans

On Wed, 13 Oct 2010, Jung-uk Kim wrote:


On Wednesday 13 October 2010 01:27 pm, Roman Divacky wrote:


Modified: head/sys/dev/ce/if_ce.c
=
= --- head/sys/dev/ce/if_ce.c   Wed Oct 13 17:16:08
2010(r213792) +++ head/sys/dev/ce/if_ce.c   Wed Oct 13 17:17:50
2010(r213793) @@ -1313,7 +1313,7 @@ static int ce_ioctl (struct
cdev *dev, u IFP2SP(d->ifp)->pp_flags &= ~(PP_FR);
IFP2SP(d->ifp)->pp_flags |= PP_KEEPALIVE;
d->ifp->if_flags |= PP_CISCO;
-   } else if (! strcmp ("fr", (char*)data) && PP_FR) {
+   } else if (! strcmp ("fr", (char*)data)) {


this is wrong I think... the PP_FR was used for compiling in/out
support for something.. see the comment:

/* If we don't have Cronyx's sppp version, we don't have fr support
via sppp */ #ifndef PP_FR
#define PP_FR 0
#endif

note that PP_FR is used in some other places as a flag. I guess
that by compiling with something like make -DPP_FR=42 some magic
would happen.

anyway - this does not look like a bug but like an intent, please
revert.


I think the attached patch should do.


% Index: sys/dev/ce/if_ce.c
% ===
% --- sys/dev/ce/if_ce.c(revision 213782)
% +++ sys/dev/ce/if_ce.c(working copy)
% @@ -1313,9 +1313,11 @@ static int ce_ioctl (struct cdev *dev, u_long cmd,
%   IFP2SP(d->ifp)->pp_flags &= ~(PP_FR);
%   IFP2SP(d->ifp)->pp_flags |= PP_KEEPALIVE;
%   d->ifp->if_flags |= PP_CISCO;
% - } else if (! strcmp ("fr", (char*)data) && PP_FR) {
% +#if PP_FR > 0
% + } else if (! strcmp ("fr", (char*)data)) {
%   d->ifp->if_flags &= ~(PP_CISCO);
%   IFP2SP(d->ifp)->pp_flags |= PP_FR | PP_KEEPALIVE;
% +#endif
%   } else if (! strcmp ("ppp", (char*)data)) {
%   IFP2SP(d->ifp)->pp_flags &= ~PP_FR;
%   IFP2SP(d->ifp)->pp_flags &= ~PP_KEEPALIVE;
% ...

This gives different behaviour if PP_FR is even or negative.  Even values
used to fail the match, but now the match succeeds for even values > 0 and
then the bits of PP_FR are put in pp_flags.  Negative values used to pass
the match if they were odd, but now the match is not attempted for any
negative value.  It just might be useful for PP_FR to have multiple bits
set, with the 1 bit used for enabling this and the other bits used for
setting pp_flags.  If not, then only values of 0 and 1 for PP_FR make sense,
and the ifdef should be "#if PP_FR == 1".

One of the 3 style bugs of "! strcmp (...)" is larger now.  The normal
style of "strcmp(...) == 0" would have inhibited this bug, but perhaps
"!" was used to emphasize that the result is boolean.  The 3 strcmp's
visible in the above patch are the only ones in the file with the "!
" style bugs.  The normal style of explicitly comparing the result of
strcmp with 0 is used 2 times, with consistency only for using a
gnu-style space before the left parentheses.

I don't see why clang complained about this.  "! strcmp()" has a boolean
result with value of 1 for "true".  It is perfectly valid to AND
this result with a boolean flag that also has value 1 for "true",
or with an integral bitmap that uses bit 0 (value 1) for this test.

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: r213815 - head/bin/sh

2010-10-13 Thread David E. O'Brien
Author: obrien
Date: Wed Oct 13 23:31:17 2010
New Revision: 213815
URL: http://svn.freebsd.org/changeset/base/213815

Log:
  We only need to look as far as '..' to find 'test/'.

Modified:
  head/bin/sh/Makefile

Modified: head/bin/sh/Makefile
==
--- head/bin/sh/MakefileWed Oct 13 23:29:09 2010(r213814)
+++ head/bin/sh/MakefileWed Oct 13 23:31:17 2010(r213815)
@@ -26,7 +26,7 @@ WARNS?=   2
 WFORMAT=0
 
 .PATH: ${.CURDIR}/bltin \
-   ${.CURDIR}/../../bin/test
+   ${.CURDIR}/../test
 
 CLEANFILES+= mkinit mkinit.o mknodes mknodes.o \
mksyntax mksyntax.o
___
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: r213814 - in head: bin/sh tools/regression/bin/sh/expansion

2010-10-13 Thread David E. O'Brien
Author: obrien
Date: Wed Oct 13 23:29:09 2010
New Revision: 213814
URL: http://svn.freebsd.org/changeset/base/213814

Log:
  Do not assume in growstackstr() that a "precious" character will be
  immediately written into the stack after the call.  Instead let the caller
  manage the "space left".
  
  Previously, growstackstr()'s assumption causes problems with STACKSTRNUL()
  where we want to be able to turn a stack into a C string, and later
  pretend the NUL is not there.
  
  This fixes a bug in STACKSTRNUL() (that grew the stack) where:
  1. STADJUST() called after a STACKSTRNUL() results in an improper adjust.
 This can be seen in ${var%pattern} and ${var%%pattern} evaluation.
  2. Memory leak in STPUTC() called after a STACKSTRNUL().
  
  Reviewed by:  jilles

Added:
  head/tools/regression/bin/sh/expansion/trim4.0   (contents, props changed)
Modified:
  head/bin/sh/histedit.c
  head/bin/sh/memalloc.c
  head/bin/sh/memalloc.h

Modified: head/bin/sh/histedit.c
==
--- head/bin/sh/histedit.c  Wed Oct 13 22:59:04 2010(r213813)
+++ head/bin/sh/histedit.c  Wed Oct 13 23:29:09 2010(r213814)
@@ -418,7 +418,7 @@ fc_replace(const char *s, char *p, char 
} else
STPUTC(*s++, dest);
}
-   STACKSTRNUL(dest);
+   STPUTC('\0', dest);
dest = grabstackstr(dest);
 
return (dest);

Modified: head/bin/sh/memalloc.c
==
--- head/bin/sh/memalloc.c  Wed Oct 13 22:59:04 2010(r213813)
+++ head/bin/sh/memalloc.c  Wed Oct 13 23:29:09 2010(r213814)
@@ -295,6 +295,13 @@ grabstackblock(int len)
  * is space for at least one character.
  */
 
+static char *
+growstrstackblock(int n)
+{
+   growstackblock();
+   sstrnleft = stackblocksize() - n;
+   return stackblock() + n;
+}
 
 char *
 growstackstr(void)
@@ -304,12 +311,10 @@ growstackstr(void)
len = stackblocksize();
if (herefd >= 0 && len >= 1024) {
xwrite(herefd, stackblock(), len);
-   sstrnleft = len - 1;
+   sstrnleft = len;
return stackblock();
}
-   growstackblock();
-   sstrnleft = stackblocksize() - len - 1;
-   return stackblock() + len;
+   return growstrstackblock(len);
 }
 
 
@@ -323,9 +328,7 @@ makestrspace(void)
int len;
 
len = stackblocksize() - sstrnleft;
-   growstackblock();
-   sstrnleft = stackblocksize() - len;
-   return stackblock() + len;
+   return growstrstackblock(len);
 }
 
 

Modified: head/bin/sh/memalloc.h
==
--- head/bin/sh/memalloc.h  Wed Oct 13 22:59:04 2010(r213813)
+++ head/bin/sh/memalloc.h  Wed Oct 13 23:29:09 2010(r213814)
@@ -67,9 +67,16 @@ void ungrabstackstr(char *, char *);
 #define stackblock() stacknxt
 #define stackblocksize() stacknleft
 #define STARTSTACKSTR(p)   p = stackblock(), sstrnleft = stackblocksize()
-#define STPUTC(c, p)   (--sstrnleft >= 0? (*p++ = (c)) : (p = growstackstr(), 
*p++ = (c)))
+#define STPUTC(c, p)   (--sstrnleft >= 0? (*p++ = (c)) : (p = growstackstr(), 
--sstrnleft, *p++ = (c)))
 #define CHECKSTRSPACE(n, p){ if (sstrnleft < n) p = makestrspace(); }
 #define USTPUTC(c, p)  (--sstrnleft, *p++ = (c))
+/*
+ * STACKSTRNUL's use is where we want to be able to turn a stack
+ * (non-sentinel, character counting string) into a C string,
+ * and later pretend the NUL is not there.
+ * Note: Because of STACKSTRNUL's semantics, STACKSTRNUL cannot be used
+ * on a stack that will grabstackstr()ed.
+ */
 #define STACKSTRNUL(p) (sstrnleft == 0? (p = growstackstr(), *p = '\0') : (*p 
= '\0'))
 #define STUNPUTC(p)(++sstrnleft, --p)
 #define STTOPC(p)  p[-1]

Added: head/tools/regression/bin/sh/expansion/trim4.0
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/bin/sh/expansion/trim4.0  Wed Oct 13 23:29:09 
2010(r213814)
@@ -0,0 +1,15 @@
+# $FreeBSD$
+
+v1=/homes/SOME_USER
+v2=
+v3=C123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
+
+# Trigger bug in VSTRIMRIGHT processing STADJUST() call in 
expand.c:subevalvar()
+while [ ${#v2} -lt 2000 ]; do
+   v4="${v2} ${v1%/*} $v3"
+   if [ ${#v4} -ne $((${#v2} + ${#v3} + 8)) ]; then
+   echo bad: ${#v4} -ne $((${#v2} + ${#v3} + 8))
+   fi
+   v2=x$v2
+   v3=y$v3
+done
___
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: r213813 - in head: share/man/man9 sys/kern sys/sys

2010-10-13 Thread Matthew D Fleming
Author: mdf
Date: Wed Oct 13 22:59:04 2010
New Revision: 213813
URL: http://svn.freebsd.org/changeset/base/213813

Log:
  Use a safer mechanism for determining if a task is currently running,
  that does not rely on the lifetime of pointers being the same. This also
  restores the task KBI.
  
  Suggested by: jhb
  MFC after:1 month

Modified:
  head/share/man/man9/taskqueue.9
  head/sys/kern/subr_taskqueue.c
  head/sys/sys/_task.h
  head/sys/sys/taskqueue.h

Modified: head/share/man/man9/taskqueue.9
==
--- head/share/man/man9/taskqueue.9 Wed Oct 13 22:29:48 2010
(r213812)
+++ head/share/man/man9/taskqueue.9 Wed Oct 13 22:59:04 2010
(r213813)
@@ -68,7 +68,7 @@ struct task {
 .Ft int
 .Fn taskqueue_member "struct taskqueue *queue" "struct thread *td"
 .Ft void
-.Fn taskqueue_run "struct taskqueue *queue" "struct task **tpp"
+.Fn taskqueue_run "struct taskqueue *queue"
 .Fn TASK_INIT "struct task *task" "int priority" "task_fn_t *func" "void 
*context"
 .Fn TASKQUEUE_DECLARE "name"
 .Fn TASKQUEUE_DEFINE "name" "taskqueue_enqueue_fn enqueue" "void *context" 
"init"
@@ -185,13 +185,6 @@ The
 function will run all pending tasks in the specified
 .Fa queue .
 Normally this function is only used internally.
-The
-.Fa tpp
-argument is a pointer to a
-.Vt struct task *
-that is used to record the currently running task.
-The lifetime of this pointer must match that of the
-.Fa queue .
 .Pp
 A convenience macro,
 .Fn TASK_INIT "task" "priority" "func" "context"

Modified: head/sys/kern/subr_taskqueue.c
==
--- head/sys/kern/subr_taskqueue.c  Wed Oct 13 22:29:48 2010
(r213812)
+++ head/sys/kern/subr_taskqueue.c  Wed Oct 13 22:59:04 2010
(r213813)
@@ -46,12 +46,17 @@ static MALLOC_DEFINE(M_TASKQUEUE, "taskq
 static void*taskqueue_giant_ih;
 static void*taskqueue_ih;
 
+struct taskqueue_busy {
+   struct task *tb_running;
+   TAILQ_ENTRY(taskqueue_busy) tb_link;
+};
+
 struct taskqueue {
STAILQ_HEAD(, task) tq_queue;
const char  *tq_name;
taskqueue_enqueue_fntq_enqueue;
void*tq_context;
-   struct task *tq_running;
+   TAILQ_HEAD(, taskqueue_busy) tq_active;
struct mtx  tq_mutex;
struct thread   **tq_threads;
int tq_tcount;
@@ -102,6 +107,7 @@ _taskqueue_create(const char *name, int 
return NULL;
 
STAILQ_INIT(&queue->tq_queue);
+   TAILQ_INIT(&queue->tq_active);
queue->tq_name = name;
queue->tq_enqueue = enqueue;
queue->tq_context = context;
@@ -140,6 +146,7 @@ taskqueue_free(struct taskqueue *queue)
TQ_LOCK(queue);
queue->tq_flags &= ~TQ_FLAGS_ACTIVE;
taskqueue_terminate(queue->tq_threads, queue);
+   KASSERT(TAILQ_EMPTY(&queue->tq_active), ("Tasks still running?"));
mtx_destroy(&queue->tq_mutex);
free(queue->tq_threads, M_TASKQUEUE);
free(queue, M_TASKQUEUE);
@@ -214,13 +221,17 @@ taskqueue_unblock(struct taskqueue *queu
TQ_UNLOCK(queue);
 }
 
-void
-taskqueue_run(struct taskqueue *queue, struct task **tpp)
+static void
+taskqueue_run_locked(struct taskqueue *queue)
 {
+   struct taskqueue_busy tb;
struct task *task;
int pending;
 
mtx_assert(&queue->tq_mutex, MA_OWNED);
+   tb.tb_running = NULL;
+   TAILQ_INSERT_TAIL(&queue->tq_active, &tb, tb_link);
+
while (STAILQ_FIRST(&queue->tq_queue)) {
/*
 * Carefully remove the first task from the queue and
@@ -230,16 +241,38 @@ taskqueue_run(struct taskqueue *queue, s
STAILQ_REMOVE_HEAD(&queue->tq_queue, ta_link);
pending = task->ta_pending;
task->ta_pending = 0;
-   task->ta_running = tpp;
-   *tpp = task;
+   tb.tb_running = task;
TQ_UNLOCK(queue);
 
task->ta_func(task->ta_context, pending);
 
TQ_LOCK(queue);
-   *tpp = NULL;
+   tb.tb_running = NULL;
wakeup(task);
}
+   TAILQ_REMOVE(&queue->tq_active, &tb, tb_link);
+}
+
+void
+taskqueue_run(struct taskqueue *queue)
+{
+
+   TQ_LOCK(queue);
+   taskqueue_run_locked(queue);
+   TQ_UNLOCK(queue);
+}
+
+static int
+task_is_running(struct taskqueue *queue, struct task *task)
+{
+   struct taskqueue_busy *tb;
+
+   mtx_assert(&queue->tq_mutex, MA_OWNED);
+   TAILQ_FOREACH(tb, &queue->tq_active, tb_link) {
+   if (tb->tb_running == task)
+   return (1);
+   }
+   return (0);
 }
 
 void
@@ -250,10 +283,8 @@ taskqueue_drain(struct taskqueue *queue,
WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, __func__);
 

svn commit: r213812 - head/sys/dev/bge

2010-10-13 Thread Pyun YongHyeon
Author: yongari
Date: Wed Oct 13 22:29:48 2010
New Revision: 213812
URL: http://svn.freebsd.org/changeset/base/213812

Log:
  Fix a regression introduced in r213710. r213710 removed the use of
  auto polling such that it made all controllers obtain link status
  information from the state of the LNKRDY input signal. Broadcom
  recommends disabling auto polling such that driver should rely on
  PHY interrupts for link status change indications. Unfortunately it
  seems some controllers(BCM5703, BCM5704 and BCM5705) have PHY
  related issues so Linux took other approach to workaround it.
  bge(4) didn't follow that and it used to enable auto polling to
  workaround it. Restore this old behavior for BCM5700 family
  controllers and BCM5705 to use auto polling. For BCM5700 and
  BCM5701, it seems it does not need to enable auto polling but I
  restored it for safety.
  Special thanks to marius who tried lots of patches with patience.
  
  Reported by:  marius
  Tested by:marius

Modified:
  head/sys/dev/bge/if_bge.c

Modified: head/sys/dev/bge/if_bge.c
==
--- head/sys/dev/bge/if_bge.c   Wed Oct 13 22:18:03 2010(r213811)
+++ head/sys/dev/bge/if_bge.c   Wed Oct 13 22:29:48 2010(r213812)
@@ -2012,6 +2012,10 @@ bge_blockinit(struct bge_softc *sc)
if (sc->bge_flags & BGE_FLAG_TBI) {
CSR_WRITE_4(sc, BGE_MI_STS, BGE_MISTS_LINK);
} else {
+   if (sc->bge_mi_mode & BGE_MIMODE_AUTOPOLL) {
+   CSR_WRITE_4(sc, BGE_MI_MODE, sc->bge_mi_mode);
+   DELAY(80);
+   }
if (sc->bge_asicrev == BGE_ASICREV_BCM5700 &&
sc->bge_chipid != BGE_CHIPID_BCM5700_B2)
CSR_WRITE_4(sc, BGE_MAC_EVT_ENB,
@@ -2677,6 +2681,9 @@ bge_attach(device_t dev)
sc->bge_mi_mode = BGE_MIMODE_500KHZ_CONST;
else
sc->bge_mi_mode = BGE_MIMODE_BASE;
+   /* Enable auto polling for BCM570[0-5]. */
+   if (BGE_IS_5700_FAMILY(sc) || sc->bge_asicrev == BGE_ASICREV_BCM5705)
+   sc->bge_mi_mode |= BGE_MIMODE_AUTOPOLL;
 
/*
 * All controllers that are not 5755 or higher have 4GB
___
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: r213744 - head/bin/sh

2010-10-13 Thread David O'Brien
On Wed, Oct 13, 2010 at 09:07:59AM -0400, John Baldwin wrote:
> To be honest, I think changing STATIC is excessive churn.

At this point I'm just making everything consistently "static" so that
folks that add to ash won't need to realize that "STATIC" exists.  Some
of the folks making various FreeBSD changes did not realize this and
created inconsistencies.  Surely this inconsistency isn't desired.

> The "right" fix
> is to use 'make DEBUG_FLAGS="-g -DDEBUG=2 -fno-inline"'.  I often use
> 'make DEBUG_FLAGS="-g -fno-inline"' to workaround excessive inlining when

I've added "-fno-inline" to DEBUG_FLAGS and will leave it up to others if
that spelling isn't accepted by clang, Intel C, or what ever compiler
someone may want to use.

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


Re: svn commit: r213744 - head/bin/sh

2010-10-13 Thread David O'Brien
On Wed, Oct 13, 2010 at 03:29:27PM +1100, Bruce Evans wrote:
> Add __noinline or whatever attributes to STATIC (but keep static in
> it) for the DEBUG >= 3 case if you are going that far.  __noinline
> should be a syntax error for variables, so this should also find any
> STATICs still on variables.  The spelling fix of changing STATIC to
> what it actually means
> (ASSORTED_HACKS_FOR_DEBUGGING_BUT_NOW_ONLY_FOR_FUNCTIONS) goes too far
> for me.

I've make all uses "static".  Otherwise we have some of the functions and
variable "STATIC" (if from 4.4BSD), and some others "static" (added later
by FreeBSD).  Surely this inconsistency isn't desired.

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


svn commit: r213811 - head/bin/sh

2010-10-13 Thread David E. O'Brien
Author: obrien
Date: Wed Oct 13 22:18:03 2010
New Revision: 213811
URL: http://svn.freebsd.org/changeset/base/213811

Log:
  In the spirit of r90111, depend on c89 and remove the "STATIC" macro
  and its usage.

Modified:
  head/bin/sh/Makefile
  head/bin/sh/alias.c
  head/bin/sh/cd.c
  head/bin/sh/error.c
  head/bin/sh/eval.c
  head/bin/sh/exec.c
  head/bin/sh/expand.c
  head/bin/sh/histedit.c
  head/bin/sh/input.c
  head/bin/sh/jobs.c
  head/bin/sh/main.c
  head/bin/sh/memalloc.c
  head/bin/sh/nodes.c.pat
  head/bin/sh/options.c
  head/bin/sh/output.c
  head/bin/sh/parser.c
  head/bin/sh/redir.c
  head/bin/sh/shell.h
  head/bin/sh/show.c
  head/bin/sh/trap.c
  head/bin/sh/var.c

Modified: head/bin/sh/Makefile
==
--- head/bin/sh/MakefileWed Oct 13 22:07:57 2010(r213810)
+++ head/bin/sh/MakefileWed Oct 13 22:18:03 2010(r213811)
@@ -21,7 +21,7 @@ LDADD= -ll -ledit -ltermcap
 LFLAGS= -8 # 8-bit lex scanner for arithmetic
 CFLAGS+=-DSHELL -I. -I${.CURDIR}
 # for debug:
-# DEBUG_FLAGS+= -g -DDEBUG=3 -fno-inline
+# DEBUG_FLAGS+= -g -DDEBUG=2 -fno-inline
 WARNS?=2
 WFORMAT=0
 

Modified: head/bin/sh/alias.c
==
--- head/bin/sh/alias.c Wed Oct 13 22:07:57 2010(r213810)
+++ head/bin/sh/alias.c Wed Oct 13 22:18:03 2010(r213811)
@@ -52,11 +52,11 @@ __FBSDID("$FreeBSD$");
 static struct alias *atab[ATABSIZE];
 static int aliases;
 
-STATIC void setalias(const char *, const char *);
-STATIC int unalias(const char *);
-STATIC struct alias **hashalias(const char *);
+static void setalias(const char *, const char *);
+static int unalias(const char *);
+static struct alias **hashalias(const char *);
 
-STATIC
+static
 void
 setalias(const char *name, const char *val)
 {
@@ -111,7 +111,7 @@ setalias(const char *name, const char *v
INTON;
 }
 
-STATIC int
+static int
 unalias(const char *name)
 {
struct alias *ap, **app;
@@ -191,7 +191,7 @@ lookupalias(const char *name, int check)
return (NULL);
 }
 
-STATIC int
+static int
 comparealiases(const void *p1, const void *p2)
 {
const struct alias *const *a1 = p1;
@@ -200,7 +200,7 @@ comparealiases(const void *p1, const voi
return strcmp((*a1)->name, (*a2)->name);
 }
 
-STATIC void
+static void
 printalias(const struct alias *a)
 {
char *p;
@@ -214,7 +214,7 @@ printalias(const struct alias *a)
out1c('\n');
 }
 
-STATIC void
+static void
 printaliases(void)
 {
int i, j;
@@ -276,7 +276,7 @@ unaliascmd(int argc __unused, char **arg
return (i);
 }
 
-STATIC struct alias **
+static struct alias **
 hashalias(const char *p)
 {
unsigned int hashval;

Modified: head/bin/sh/cd.c
==
--- head/bin/sh/cd.cWed Oct 13 22:07:57 2010(r213810)
+++ head/bin/sh/cd.cWed Oct 13 22:18:03 2010(r213811)
@@ -64,14 +64,14 @@ __FBSDID("$FreeBSD$");
 #include "show.h"
 #include "cd.h"
 
-STATIC int cdlogical(char *);
-STATIC int cdphysical(char *);
-STATIC int docd(char *, int, int);
-STATIC char *getcomponent(void);
-STATIC char *findcwd(char *);
-STATIC void updatepwd(char *);
-STATIC char *getpwd(void);
-STATIC char *getpwd2(void);
+static int cdlogical(char *);
+static int cdphysical(char *);
+static int docd(char *, int, int);
+static char *getcomponent(void);
+static char *findcwd(char *);
+static void updatepwd(char *);
+static char *getpwd(void);
+static char *getpwd2(void);
 
 static char *curdir = NULL;/* current working directory */
 static char *prevdir;  /* previous working directory */
@@ -145,7 +145,7 @@ cdcmd(int argc, char **argv)
  * Actually change the directory.  In an interactive shell, print the
  * directory name if "print" is nonzero.
  */
-STATIC int
+static int
 docd(char *dest, int print, int phys)
 {
 
@@ -161,7 +161,7 @@ docd(char *dest, int print, int phys)
return 0;
 }
 
-STATIC int
+static int
 cdlogical(char *dest)
 {
char *p;
@@ -213,7 +213,7 @@ cdlogical(char *dest)
return (0);
 }
 
-STATIC int
+static int
 cdphysical(char *dest)
 {
char *p;
@@ -232,7 +232,7 @@ cdphysical(char *dest)
  * Get the next component of the path name pointed to by cdcomppath.
  * This routine overwrites the string pointed to by cdcomppath.
  */
-STATIC char *
+static char *
 getcomponent(void)
 {
char *p;
@@ -253,7 +253,7 @@ getcomponent(void)
 }
 
 
-STATIC char *
+static char *
 findcwd(char *dir)
 {
char *new;
@@ -296,7 +296,7 @@ findcwd(char *dir)
  * cd command.  We also call hashcd to let the routines in exec.c know
  * that the current directory has changed.
  */
-STATIC void
+static void
 updatepwd(char *dir)
 {
hashcd();   /* update command hash table */
@@ -352,7 +352,7 @@ pwdcmd(int argc, char **argv)
 /*
  

svn commit: r213810 - head/sbin/ipfw

2010-10-13 Thread Luigi Rizzo
Author: luigi
Date: Wed Oct 13 22:07:57 2010
New Revision: 213810
URL: http://svn.freebsd.org/changeset/base/213810

Log:
  document logging through bpf

Modified:
  head/sbin/ipfw/ipfw.8

Modified: head/sbin/ipfw/ipfw.8
==
--- head/sbin/ipfw/ipfw.8   Wed Oct 13 22:04:55 2010(r213809)
+++ head/sbin/ipfw/ipfw.8   Wed Oct 13 22:07:57 2010(r213810)
@@ -557,28 +557,33 @@ packet delivery.
 Note: this condition is checked before any other condition, including
 ones such as keep-state or check-state which might have side effects.
 .It Cm log Op Cm logamount Ar number
-When a packet matches a rule with the
+Packets matching a rule with the
 .Cm log
-keyword, a message will be
-logged to
+keyword will be made available for logging in two ways:
+if the sysctl variable
+.Va net.inet.ip.fw.verbose
+is set to 0 (default), one can use
+.Xr bpf 4
+attached to the
+.Xr ipfw0
+pseudo interface. There is no overhead if no 
+.Xr bpf
+is attached to the pseudo interface.
+.Pp
+If
+.Va net.inet.ip.fw.verbose
+is set to 1, packets will be logged to
 .Xr syslogd 8
 with a
 .Dv LOG_SECURITY
-facility.
-The logging only occurs if the sysctl variable
-.Va net.inet.ip.fw.verbose
-is set to 1
-(which is the default when the kernel is compiled with
-.Dv IPFIREWALL_VERBOSE )
-and the number of packets logged so far for that
-particular rule does not exceed the
+facility up to a maximum of
 .Cm logamount
-parameter.
+packets.
 If no
 .Cm logamount
 is specified, the limit is taken from the sysctl variable
 .Va net.inet.ip.fw.verbose_limit .
-In both cases, a value of 0 removes the logging limit.
+In both cases, a value of 0 means unlimited logging.
 .Pp
 Once the limit is reached, logging can be re-enabled by
 clearing the logging counter or the packet counter for that entry, see 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: r213809 - in head/sys/dev/usb: . net

2010-10-13 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Oct 13 22:04:55 2010
New Revision: 213809
URL: http://svn.freebsd.org/changeset/base/213809

Log:
  USB network (NCM driver):
  - correct the ethernet payload remainder which
  must be post-offseted by -14 bytes instead of
  0 bytes. This is not very clearly defined in the
  NCM specification.
  - add development feature about limiting the
  maximum datagram count in each NCM payload.
  - zero-pad alignment data
  - add TX-interval tuning sysctl
  
  Approved by:thompsa (mentor)

Modified:
  head/sys/dev/usb/net/if_cdce.c
  head/sys/dev/usb/net/if_cdcereg.h
  head/sys/dev/usb/usb_cdc.h

Modified: head/sys/dev/usb/net/if_cdce.c
==
--- head/sys/dev/usb/net/if_cdce.c  Wed Oct 13 21:53:37 2010
(r213808)
+++ head/sys/dev/usb/net/if_cdce.c  Wed Oct 13 22:04:55 2010
(r213809)
@@ -110,10 +110,13 @@ static uint32_t   cdce_m_crc32(struct mbuf
 
 #ifdef USB_DEBUG
 static int cdce_debug = 0;
+static int cdce_tx_interval = 0;
 
 SYSCTL_NODE(_hw_usb, OID_AUTO, cdce, CTLFLAG_RW, 0, "USB CDC-Ethernet");
 SYSCTL_INT(_hw_usb_cdce, OID_AUTO, debug, CTLFLAG_RW, &cdce_debug, 0,
 "Debug level");
+SYSCTL_INT(_hw_usb_cdce, OID_AUTO, interval, CTLFLAG_RW, &cdce_tx_interval, 0,
+"NCM transmit interval in ms");
 #endif
 
 static const struct usb_config cdce_config[CDCE_N_TRANSFER] = {
@@ -192,7 +195,7 @@ static const struct usb_config cdce_ncm_
.if_index = 0,
.frames = CDCE_NCM_TX_FRAMES_MAX,
.bufsize = (CDCE_NCM_TX_FRAMES_MAX * CDCE_NCM_TX_MAXLEN),
-   .flags = {.pipe_bof = 1,.force_short_xfer = 1,},
+   .flags = {.pipe_bof = 1,},
.callback = cdce_ncm_bulk_write_callback,
.timeout = 1,   /* 10 seconds */
.usb_mode = USB_MODE_DUAL,  /* both modes */
@@ -294,9 +297,22 @@ cdce_ncm_init(struct cdce_softc *sc)
 {
struct usb_ncm_parameters temp;
struct usb_device_request req;
-   uDWord value;
+   struct usb_ncm_func_descriptor *ufd;
+   uint8_t value[8];
int err;
 
+   ufd = usbd_find_descriptor(sc->sc_ue.ue_udev, NULL,
+   sc->sc_ifaces_index[1], UDESC_CS_INTERFACE, 0 - 1,
+   UCDC_NCM_FUNC_DESC_SUBTYPE, 0 - 1);
+
+   /* verify length of NCM functional descriptor */
+   if (ufd != NULL) {
+   if (ufd->bLength < sizeof(*ufd))
+   ufd = NULL;
+   else
+   DPRINTFN(1, "Found NCM functional descriptor.\n");
+   }
+
req.bmRequestType = UT_READ_CLASS_INTERFACE;
req.bRequest = UCDC_NCM_GET_NTB_PARAMETERS;
USETW(req.wValue, 0);
@@ -317,17 +333,19 @@ cdce_ncm_init(struct cdce_softc *sc)
sc->sc_ncm.tx_remainder = UGETW(temp.wNdpOutPayloadRemainder);
sc->sc_ncm.tx_modulus = UGETW(temp.wNdpOutDivisor);
sc->sc_ncm.tx_struct_align = UGETW(temp.wNdpOutAlignment);
+   sc->sc_ncm.tx_nframe = UGETW(temp.wNtbOutMaxDatagrams);
} else {
sc->sc_ncm.rx_max = UGETDW(temp.dwNtbOutMaxSize);
sc->sc_ncm.tx_max = UGETDW(temp.dwNtbInMaxSize);
sc->sc_ncm.tx_remainder = UGETW(temp.wNdpInPayloadRemainder);
sc->sc_ncm.tx_modulus = UGETW(temp.wNdpInDivisor);
sc->sc_ncm.tx_struct_align = UGETW(temp.wNdpInAlignment);
+   sc->sc_ncm.tx_nframe = UGETW(temp.wNtbOutMaxDatagrams);
}
 
/* Verify maximum receive length */
 
-   if (err || (sc->sc_ncm.rx_max < 32) || 
+   if ((sc->sc_ncm.rx_max < 32) || 
(sc->sc_ncm.rx_max > CDCE_NCM_RX_MAXLEN)) {
DPRINTFN(1, "Using default maximum receive length\n");
sc->sc_ncm.rx_max = CDCE_NCM_RX_MAXLEN;
@@ -335,7 +353,7 @@ cdce_ncm_init(struct cdce_softc *sc)
 
/* Verify maximum transmit length */
 
-   if (err || (sc->sc_ncm.tx_max < 32) ||
+   if ((sc->sc_ncm.tx_max < 32) ||
(sc->sc_ncm.tx_max > CDCE_NCM_TX_MAXLEN)) {
DPRINTFN(1, "Using default maximum transmit length\n");
sc->sc_ncm.tx_max = CDCE_NCM_TX_MAXLEN;
@@ -347,7 +365,7 @@ cdce_ncm_init(struct cdce_softc *sc)
 * - not greater than the maximum transmit length
 * - not less than four bytes
 */
-   if (err || (sc->sc_ncm.tx_struct_align < 4) ||
+   if ((sc->sc_ncm.tx_struct_align < 4) ||
(sc->sc_ncm.tx_struct_align != 
 ((-sc->sc_ncm.tx_struct_align) & sc->sc_ncm.tx_struct_align)) ||
(sc->sc_ncm.tx_struct_align >= sc->sc_ncm.tx_max)) {
@@ -361,7 +379,7 @@ cdce_ncm_init(struct cdce_softc *sc)
 * - not greater than the maximum transmit length
 * - not less than four bytes
 */
-   if (err || (sc->sc_ncm.tx_modulus < 4) ||
+   if ((sc->sc_ncm.tx_modulus < 4) ||
(sc->sc_ncm.tx_m

svn commit: r213808 - head/sys/dev/bge

2010-10-13 Thread Pyun YongHyeon
Author: yongari
Date: Wed Oct 13 21:53:37 2010
New Revision: 213808
URL: http://svn.freebsd.org/changeset/base/213808

Log:
  Add more checks for resolved link speed in bge_miibus_statchg().
  Link UP state could be reported first before actual completion of
  auto-negotiation. This change makes bge(4) reprogram BGE_MAC_MODE,
  BGE_TX_MODE and BGE_RX_MODE register only after controller got a
  valid link.

Modified:
  head/sys/dev/bge/if_bge.c

Modified: head/sys/dev/bge/if_bge.c
==
--- head/sys/dev/bge/if_bge.c   Wed Oct 13 21:45:56 2010(r213807)
+++ head/sys/dev/bge/if_bge.c   Wed Oct 13 21:53:37 2010(r213808)
@@ -878,6 +878,29 @@ bge_miibus_statchg(device_t dev)
sc = device_get_softc(dev);
mii = device_get_softc(sc->bge_miibus);
 
+   if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) ==
+   (IFM_ACTIVE | IFM_AVALID)) {
+   switch (IFM_SUBTYPE(mii->mii_media_active)) {
+   case IFM_10_T:
+   case IFM_100_TX:
+   sc->bge_link = 1;
+   break;
+   case IFM_1000_T:
+   case IFM_1000_SX:
+   case IFM_2500_SX:
+   if (sc->bge_asicrev != BGE_ASICREV_BCM5906)
+   sc->bge_link = 1;
+   else
+   sc->bge_link = 0;
+   break;
+   default:
+   sc->bge_link = 0;
+   break;
+   }
+   } else
+   sc->bge_link = 0;
+   if (sc->bge_link == 0)
+   return;
BGE_CLRBIT(sc, BGE_MAC_MODE, BGE_MACMODE_PORTMODE);
if (IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T ||
IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_SX)
@@ -5065,12 +5088,7 @@ bge_link_upd(struct bge_softc *sc)
 */
mii = device_get_softc(sc->bge_miibus);
mii_pollstat(mii);
-   if (!sc->bge_link && mii->mii_media_status & IFM_ACTIVE &&
-   IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) {
-   bge_miibus_statchg(sc->bge_dev);
-   sc->bge_link = 1;
-   } else
-   sc->bge_link = 0;
+   bge_miibus_statchg(sc->bge_dev);
}
 
/* Clear the attention. */
___
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: r213807 - head/sys/mips/cavium/octe

2010-10-13 Thread Juli Mallett
Author: jmallett
Date: Wed Oct 13 21:45:56 2010
New Revision: 213807
URL: http://svn.freebsd.org/changeset/base/213807

Log:
  Keep polling at 50hz as long as link state is changing.

Modified:
  head/sys/mips/cavium/octe/ethernet.c

Modified: head/sys/mips/cavium/octe/ethernet.c
==
--- head/sys/mips/cavium/octe/ethernet.cWed Oct 13 21:37:02 2010
(r213806)
+++ head/sys/mips/cavium/octe/ethernet.cWed Oct 13 21:45:56 2010
(r213807)
@@ -173,6 +173,7 @@ static void cvm_oct_update_link(void *co
 static void cvm_do_timer(void *arg)
 {
static int port;
+   static int updated;
if (port < CVMX_PIP_NUM_INPUT_PORTS) {
if (cvm_oct_device[port]) {
int queues_per_port;
@@ -186,6 +187,7 @@ static void cvm_do_timer(void *arg)
MDIO_UNLOCK();
 
if (priv->need_link_update) {
+   updated++;

taskqueue_enqueue(cvm_oct_link_taskq, &priv->link_task);
}
}
@@ -220,9 +222,19 @@ static void cvm_do_timer(void *arg)
callout_reset(&cvm_oct_poll_timer, hz / 50, cvm_do_timer, NULL);
} else {
port = 0;
-   /* All ports have been polled. Start the next iteration through
-  the ports in one second */
-   callout_reset(&cvm_oct_poll_timer, hz, cvm_do_timer, NULL);
+   /* If any updates were made in this run, continue iterating at
+* 1/50th of a second, so that if a link has merely gone down
+* temporarily (e.g. because of interface reinitialization) it
+* will not be forced to stay down for an entire second.
+*/
+   if (updated > 0) {
+   updated = 0;
+   callout_reset(&cvm_oct_poll_timer, hz / 50, 
cvm_do_timer, NULL);
+   } else {
+   /* All ports have been polled. Start the next iteration 
through
+  the ports in one second */
+   callout_reset(&cvm_oct_poll_timer, hz, cvm_do_timer, 
NULL);
+   }
}
 }
 
___
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: r213779 - head/sys/dev/sound/pci

2010-10-13 Thread Jung-uk Kim
On Wednesday 13 October 2010 05:17 pm, Rui Paulo wrote:
> On 13 Oct 2010, at 22:03, Jung-uk Kim wrote:
> > On Wednesday 13 October 2010 04:30 pm, you wrote:
> >> I read the PR and the mailing list posts, but I don't see what
> >> problem does "case SPICDS_TYPE_AK4381 || SPICDS_TYPE_AK4396:"
> >> fix.
> >
> > A similar bug for right channel was fixed by netchild@ in
> > r188480:
> >
> > http://svn.freebsd.org/viewvc/base/head/sys/dev/sound/pci/spicds.
> >c?view=log
> >
> > but he missed the left channel, which caused volume differences
> > between the two channels.
> >
> > "In FreeBSD 7.2 it worked just like a charm but after upgrading
> > to 8.0 the left stereo channel is only half as loud as the right
> > one. It can be reproduced with either speakers and headphones. I
> > tracked it down to a change in revision 188480 of spicds.c, the
> > change "fix: stupid bug with volume control for AK4396" breaks
> > volume control for me.
> >
> > http://lists.freebsd.org/pipermail/freebsd-multimedia/2009-Decemb
> >er/010553html
> >
> > Carl Johan Gustavsson submitted a correct patch:
> >
> > http://lists.freebsd.org/pipermail/freebsd-multimedia/2009-Decemb
> >er/010558html
> >
> > ariff@ said he would take it but I guess he never did:
> >
> > http://lists.freebsd.org/pipermail/freebsd-multimedia/2009-Decemb
> >er/010575html
>
> Oh, I read your previous email backwards. This explains it, thanks.

:-)

> Guess we can close the PR now.

Yes, that's exactly what I wanted to tell you.

Thanks!

Jung-uk Kim
___
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: r213806 - in head/sys/contrib/dev/acpica: . common compiler events include include/platform utilities

2010-10-13 Thread Jung-uk Kim
Author: jkim
Date: Wed Oct 13 21:37:02 2010
New Revision: 213806
URL: http://svn.freebsd.org/changeset/base/213806

Log:
  Merge ACPICA 20101013.

Added:
  head/sys/contrib/dev/acpica/compiler/aslmessages.h
 - copied unchanged from r213804, 
vendor-sys/acpica/dist/compiler/aslmessages.h
Modified:
  head/sys/contrib/dev/acpica/acpica_prep.sh
  head/sys/contrib/dev/acpica/changes.txt
  head/sys/contrib/dev/acpica/common/adisasm.c
  head/sys/contrib/dev/acpica/compiler/aslanalyze.c
  head/sys/contrib/dev/acpica/compiler/aslcodegen.c
  head/sys/contrib/dev/acpica/compiler/aslcompile.c
  head/sys/contrib/dev/acpica/compiler/aslcompiler.h
  head/sys/contrib/dev/acpica/compiler/asldefine.h
  head/sys/contrib/dev/acpica/compiler/aslmain.c
  head/sys/contrib/dev/acpica/compiler/aslresource.c
  head/sys/contrib/dev/acpica/compiler/aslrestype1.c
  head/sys/contrib/dev/acpica/compiler/aslrestype1i.c
  head/sys/contrib/dev/acpica/compiler/aslrestype2d.c
  head/sys/contrib/dev/acpica/compiler/aslrestype2e.c
  head/sys/contrib/dev/acpica/compiler/aslrestype2q.c
  head/sys/contrib/dev/acpica/compiler/aslrestype2w.c
  head/sys/contrib/dev/acpica/compiler/asltypes.h
  head/sys/contrib/dev/acpica/compiler/aslutils.c
  head/sys/contrib/dev/acpica/compiler/dtcompile.c
  head/sys/contrib/dev/acpica/compiler/dttemplate.c
  head/sys/contrib/dev/acpica/events/evxfregn.c
  head/sys/contrib/dev/acpica/include/acapps.h
  head/sys/contrib/dev/acpica/include/aclocal.h
  head/sys/contrib/dev/acpica/include/acpixf.h
  head/sys/contrib/dev/acpica/include/platform/acenv.h
  head/sys/contrib/dev/acpica/osunixxf.c
  head/sys/contrib/dev/acpica/utilities/utglobal.c
  head/sys/contrib/dev/acpica/utilities/utids.c
  head/sys/contrib/dev/acpica/utilities/utosi.c
Directory Properties:
  head/sys/contrib/dev/acpica/   (props changed)

Modified: head/sys/contrib/dev/acpica/acpica_prep.sh
==
--- head/sys/contrib/dev/acpica/acpica_prep.sh  Wed Oct 13 21:36:42 2010
(r213805)
+++ head/sys/contrib/dev/acpica/acpica_prep.sh  Wed Oct 13 21:37:02 2010
(r213806)
@@ -22,8 +22,8 @@ fulldirs="common compiler debugger disas
 stripdirs="acpisrc acpixtract examples generate os_specific tests"
 stripfiles="Makefile README acintel.h aclinux.h acmsvc.h acnetbsd.h\
acos2.h accygwin.h acefi.h acwin.h acwin64.h aeexec.c   \
-   aehandlers.c aemain.c aetables.c osunixdir.c readme.txt \
-   utclib.c"
+   aehandlers.c aemain.c aetables.c aetables.h osunixdir.c \
+   readme.txt utclib.c"
 
 # include files to canonify
 src_headers="acapps.h accommon.h acconfig.h acdebug.h acdisasm.h   \
@@ -33,8 +33,8 @@ src_headers="acapps.h accommon.h acconfi
acresrc.h acrestyp.h acstruct.h actables.h actbl.h actbl1.h \
actbl2.h actypes.h acutils.h amlcode.h amlresrc.h   \
platform/acenv.h platform/acfreebsd.h platform/acgcc.h"
-comp_headers="aslcompiler.h asldefine.h aslglobal.h asltypes.h \
-   dtcompiler.h dttemplate.h"
+comp_headers="aslcompiler.h asldefine.h aslglobal.h aslmessages.h  \
+   asltypes.h dtcompiler.h dttemplate.h"
 platform_headers="acfreebsd.h acgcc.h"
 
 # pre-clean

Modified: head/sys/contrib/dev/acpica/changes.txt
==
--- head/sys/contrib/dev/acpica/changes.txt Wed Oct 13 21:36:42 2010
(r213805)
+++ head/sys/contrib/dev/acpica/changes.txt Wed Oct 13 21:37:02 2010
(r213806)
@@ -1,4 +1,64 @@
 ----
+13 October 2010. Summary of changes for version 20101013:
+
+This release is available at www.acpica.org/downloads
+
+1) ACPI CA Core Subsystem:
+
+Added support to clear the PCIEXP_WAKE event. When clearing ACPI events, now 
+clear the PCIEXP_WAKE_STS bit in the ACPI PM1 Status Register, via 
+HwClearAcpiStatus. Original change from Colin King. ACPICA BZ 880.
+
+Changed the type of the predefined namespace object _TZ from ThermalZone to 
+Device. This was found to be confusing to the host software that processes 
+the various thermal zones, since _TZ is not really a ThermalZone. However, a 
+Notify() can still be performed on it. ACPICA BZ 876. Suggestion from Rui 
+Zhang.
+
+Added Windows Vista SP2 to the list of supported _OSI strings. The actual 
+string is "Windows 2006 SP2".
+
+Eliminated duplicate code in AcpiUtExecute* functions. Now that the nsrepair 
+code automatically repairs _HID-related strings, this type of code is no 
+longer needed in Execute_HID, Execute_CID, and Execute_UID. ACPICA BZ 878.
+
+Example Code and Data Size: These are the sizes for the OS-independent 
+acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. The 
+debug version of the code includes the debug output trace mechanism and has a 
+much larger 

svn commit: r213805 - in head/sys: conf dev/usb/net modules/usb modules/usb/ipheth

2010-10-13 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Oct 13 21:36:42 2010
New Revision: 213805
URL: http://svn.freebsd.org/changeset/base/213805

Log:
  USB Network:
  - Add new driver for iPhone tethering
  - Supports the iPhone 3G/3GS/4G ethernet protocol
  
  Approved by:thompsa (mentor)

Added:
  head/sys/dev/usb/net/if_ipheth.c   (contents, props changed)
  head/sys/dev/usb/net/if_iphethvar.h   (contents, props changed)
  head/sys/modules/usb/ipheth/
  head/sys/modules/usb/ipheth/Makefile   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/modules/usb/Makefile

Modified: head/sys/conf/files
==
--- head/sys/conf/files Wed Oct 13 20:56:54 2010(r213804)
+++ head/sys/conf/files Wed Oct 13 21:36:42 2010(r213805)
@@ -1790,6 +1790,7 @@ dev/usb/net/if_aue.c  optional aue
 dev/usb/net/if_axe.c   optional axe
 dev/usb/net/if_cdce.c  optional cdce
 dev/usb/net/if_cue.c   optional cue
+dev/usb/net/if_ipheth.coptional ipheth
 dev/usb/net/if_kue.c   optional kue
 dev/usb/net/if_rue.c   optional rue
 dev/usb/net/if_udav.c  optional udav

Added: head/sys/dev/usb/net/if_ipheth.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/usb/net/if_ipheth.cWed Oct 13 21:36:42 2010
(r213805)
@@ -0,0 +1,528 @@
+/*-
+ * Copyright (c) 2010 Hans Petter Selasky. All rights reserved.
+ * Copyright (c) 2009 Diego Giagio. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Thanks to Diego Giagio for figuring out the programming details for
+ * the Apple iPhone Ethernet driver.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include "usbdevs.h"
+
+#defineUSB_DEBUG_VAR ipheth_debug
+#include 
+#include 
+
+#include 
+#include 
+
+static device_probe_t ipheth_probe;
+static device_attach_t ipheth_attach;
+static device_detach_t ipheth_detach;
+
+static usb_callback_t ipheth_bulk_write_callback;
+static usb_callback_t ipheth_bulk_read_callback;
+
+static uether_fn_t ipheth_attach_post;
+static uether_fn_t ipheth_tick;
+static uether_fn_t ipheth_init;
+static uether_fn_t ipheth_stop;
+static uether_fn_t ipheth_start;
+static uether_fn_t ipheth_setmulti;
+static uether_fn_t ipheth_setpromisc;
+
+#ifdef USB_DEBUG
+static int ipheth_debug = 0;
+
+SYSCTL_NODE(_hw_usb, OID_AUTO, ipheth, CTLFLAG_RW, 0, "USB iPhone ethernet");
+SYSCTL_INT(_hw_usb_ipheth, OID_AUTO, debug, CTLFLAG_RW, &ipheth_debug, 0, 
"Debug level");
+#endif
+
+static const struct usb_config ipheth_config[IPHETH_N_TRANSFER] = {
+
+   [IPHETH_BULK_RX] = {
+   .type = UE_BULK,
+   .endpoint = UE_ADDR_ANY,
+   .direction = UE_DIR_RX,
+   .frames = IPHETH_RX_FRAMES_MAX,
+   .bufsize = (IPHETH_RX_FRAMES_MAX * MCLBYTES),
+   .flags = {.short_frames_ok = 1,.short_xfer_ok = 1,.ext_buffer = 
1,},
+   .callback = ipheth_bulk_read_callback,
+   .timeout = 0,   /* no timeout */
+   },
+
+   [IPHETH_BULK_TX] = {
+   .type = UE_BULK,
+   .endpoint = UE_ADDR_ANY,
+   .direction = UE_DIR_TX,
+   .frames = IPHETH_TX_FRAMES_MAX,
+   .bufsize = (IPHETH_TX_FRAMES_MAX * IPHETH_BUF_SIZE),
+   .flags = {.force_short_xfer 

Re: svn commit: r213779 - head/sys/dev/sound/pci

2010-10-13 Thread Rui Paulo

On 13 Oct 2010, at 22:03, Jung-uk Kim wrote:

> On Wednesday 13 October 2010 04:30 pm, you wrote:
>> I read the PR and the mailing list posts, but I don't see what
>> problem does "case SPICDS_TYPE_AK4381 || SPICDS_TYPE_AK4396:" fix.
> 
> A similar bug for right channel was fixed by netchild@ in r188480:
> 
> http://svn.freebsd.org/viewvc/base/head/sys/dev/sound/pci/spicds.c?view=log
> 
> but he missed the left channel, which caused volume differences 
> between the two channels.
> 
> "In FreeBSD 7.2 it worked just like a charm but after upgrading to 8.0
> the left stereo channel is only half as loud as the right one. It can 
> be reproduced with either speakers and headphones. I tracked it down 
> to a change in revision 188480 of spicds.c, the change "fix: stupid 
> bug with volume control for AK4396" breaks volume control for me.
> 
> http://lists.freebsd.org/pipermail/freebsd-multimedia/2009-December/010553html
> 
> Carl Johan Gustavsson submitted a correct patch:
> 
> http://lists.freebsd.org/pipermail/freebsd-multimedia/2009-December/010558html
> 
> ariff@ said he would take it but I guess he never did:
> 
> http://lists.freebsd.org/pipermail/freebsd-multimedia/2009-December/010575html

Oh, I read your previous email backwards. This explains it, thanks. Guess we 
can close the PR now.

Regards,
--
Rui Paulo


___
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: r213779 - head/sys/dev/sound/pci

2010-10-13 Thread Jung-uk Kim
On Wednesday 13 October 2010 04:30 pm, you wrote:
> I read the PR and the mailing list posts, but I don't see what
> problem does "case SPICDS_TYPE_AK4381 || SPICDS_TYPE_AK4396:" fix.

A similar bug for right channel was fixed by netchild@ in r188480:

http://svn.freebsd.org/viewvc/base/head/sys/dev/sound/pci/spicds.c?view=log

but he missed the left channel, which caused volume differences 
between the two channels.

"In FreeBSD 7.2 it worked just like a charm but after upgrading to 8.0
the left stereo channel is only half as loud as the right one. It can 
be reproduced with either speakers and headphones. I tracked it down 
to a change in revision 188480 of spicds.c, the change "fix: stupid 
bug with volume control for AK4396" breaks volume control for me.

http://lists.freebsd.org/pipermail/freebsd-multimedia/2009-December/010553.html

Carl Johan Gustavsson submitted a correct patch:

http://lists.freebsd.org/pipermail/freebsd-multimedia/2009-December/010558.html

ariff@ said he would take it but I guess he never did:

http://lists.freebsd.org/pipermail/freebsd-multimedia/2009-December/010575.html

Jung-uk Kim
___
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: r213804 - head/sys/dev/usb/wlan

2010-10-13 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Oct 13 20:56:54 2010
New Revision: 213804
URL: http://svn.freebsd.org/changeset/base/213804

Log:
  USB WLAN:
  - Add new device ID
  
  PR:   usb/150989
  Approved by:thompsa (mentor)

Modified:
  head/sys/dev/usb/wlan/if_upgt.c

Modified: head/sys/dev/usb/wlan/if_upgt.c
==
--- head/sys/dev/usb/wlan/if_upgt.c Wed Oct 13 20:51:06 2010
(r213803)
+++ head/sys/dev/usb/wlan/if_upgt.c Wed Oct 13 20:56:54 2010
(r213804)
@@ -182,6 +182,7 @@ static const struct usb_device_id upgt_d
UPGT_DEV(FSC,   E5400),
UPGT_DEV(GLOBESPAN, PRISM_GT_1),
UPGT_DEV(GLOBESPAN, PRISM_GT_2),
+   UPGT_DEV(NETGEAR,   WG111V2_2),
UPGT_DEV(INTERSIL,  PRISM_GT),
UPGT_DEV(SMC,   2862WG),
UPGT_DEV(USR,   USR5422),
___
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: r213803 - head/sys/dev/usb/net

2010-10-13 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Oct 13 20:51:06 2010
New Revision: 213803
URL: http://svn.freebsd.org/changeset/base/213803

Log:
  USB network (UHSO):
  - Correct network interface flags.
  
  PR:   usb/149039
  Submitted by: Fredrik Lindberg
  Approved by:thompsa (mentor)

Modified:
  head/sys/dev/usb/net/uhso.c

Modified: head/sys/dev/usb/net/uhso.c
==
--- head/sys/dev/usb/net/uhso.c Wed Oct 13 20:37:19 2010(r213802)
+++ head/sys/dev/usb/net/uhso.c Wed Oct 13 20:51:06 2010(r213803)
@@ -1560,7 +1560,7 @@ uhso_attach_ifnet(struct uhso_softc *sc,
ifp->if_init = uhso_if_init;
ifp->if_start = uhso_if_start;
ifp->if_output = uhso_if_output;
-   ifp->if_flags = 0;
+   ifp->if_flags = IFF_BROADCAST | IFF_MULTICAST | IFF_NOARP;
ifp->if_softc = sc;
IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen);
ifp->if_snd.ifq_drv_maxlen = ifqmaxlen;
___
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: r213802 - head/sys/dev/usb/controller

2010-10-13 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Oct 13 20:37:19 2010
New Revision: 213802
URL: http://svn.freebsd.org/changeset/base/213802

Log:
  Correct some root HUB descriptor fields in multiple controller drivers.
  Remove an unused structure.
  
  Approved by:thompsa (mentor)

Modified:
  head/sys/dev/usb/controller/at91dci.c
  head/sys/dev/usb/controller/atmegadci.c
  head/sys/dev/usb/controller/avr32dci.c
  head/sys/dev/usb/controller/musb_otg.c
  head/sys/dev/usb/controller/ohci.c
  head/sys/dev/usb/controller/uss820dci.c

Modified: head/sys/dev/usb/controller/at91dci.c
==
--- head/sys/dev/usb/controller/at91dci.c   Wed Oct 13 20:36:42 2010
(r213801)
+++ head/sys/dev/usb/controller/at91dci.c   Wed Oct 13 20:37:19 2010
(r213802)
@@ -1689,7 +1689,7 @@ static const struct usb_device_descripto
.bcdUSB = {0x00, 0x02},
.bDeviceClass = UDCLASS_HUB,
.bDeviceSubClass = UDSUBCLASS_HUB,
-   .bDeviceProtocol = UDPROTO_HSHUBSTT,
+   .bDeviceProtocol = UDPROTO_FSHUB,
.bMaxPacketSize = 64,
.bcdDevice = {0x00, 0x01},
.iManufacturer = 1,
@@ -1697,17 +1697,6 @@ static const struct usb_device_descripto
.bNumConfigurations = 1,
 };
 
-static const struct usb_device_qualifier at91dci_odevd = {
-   .bLength = sizeof(struct usb_device_qualifier),
-   .bDescriptorType = UDESC_DEVICE_QUALIFIER,
-   .bcdUSB = {0x00, 0x02},
-   .bDeviceClass = UDCLASS_HUB,
-   .bDeviceSubClass = UDSUBCLASS_HUB,
-   .bDeviceProtocol = UDPROTO_FSHUB,
-   .bMaxPacketSize0 = 0,
-   .bNumConfigurations = 0,
-};
-
 static const struct at91dci_config_desc at91dci_confd = {
.confd = {
.bLength = sizeof(struct usb_config_descriptor),
@@ -1725,7 +1714,7 @@ static const struct at91dci_config_desc 
.bNumEndpoints = 1,
.bInterfaceClass = UICLASS_HUB,
.bInterfaceSubClass = UISUBCLASS_HUB,
-   .bInterfaceProtocol = UIPROTO_HSHUBSTT,
+   .bInterfaceProtocol = 0,
},
.endpd = {
.bLength = sizeof(struct usb_endpoint_descriptor),

Modified: head/sys/dev/usb/controller/atmegadci.c
==
--- head/sys/dev/usb/controller/atmegadci.c Wed Oct 13 20:36:42 2010
(r213801)
+++ head/sys/dev/usb/controller/atmegadci.c Wed Oct 13 20:37:19 2010
(r213802)
@@ -1511,7 +1511,7 @@ static const struct usb_device_descripto
.bcdUSB = {0x00, 0x02},
.bDeviceClass = UDCLASS_HUB,
.bDeviceSubClass = UDSUBCLASS_HUB,
-   .bDeviceProtocol = UDPROTO_HSHUBSTT,
+   .bDeviceProtocol = UDPROTO_FSHUB,
.bMaxPacketSize = 64,
.bcdDevice = {0x00, 0x01},
.iManufacturer = 1,
@@ -1519,17 +1519,6 @@ static const struct usb_device_descripto
.bNumConfigurations = 1,
 };
 
-static const struct usb_device_qualifier atmegadci_odevd = {
-   .bLength = sizeof(struct usb_device_qualifier),
-   .bDescriptorType = UDESC_DEVICE_QUALIFIER,
-   .bcdUSB = {0x00, 0x02},
-   .bDeviceClass = UDCLASS_HUB,
-   .bDeviceSubClass = UDSUBCLASS_HUB,
-   .bDeviceProtocol = UDPROTO_FSHUB,
-   .bMaxPacketSize0 = 0,
-   .bNumConfigurations = 0,
-};
-
 static const struct atmegadci_config_desc atmegadci_confd = {
.confd = {
.bLength = sizeof(struct usb_config_descriptor),
@@ -1547,7 +1536,7 @@ static const struct atmegadci_config_des
.bNumEndpoints = 1,
.bInterfaceClass = UICLASS_HUB,
.bInterfaceSubClass = UISUBCLASS_HUB,
-   .bInterfaceProtocol = UIPROTO_HSHUBSTT,
+   .bInterfaceProtocol = 0,
},
.endpd = {
.bLength = sizeof(struct usb_endpoint_descriptor),

Modified: head/sys/dev/usb/controller/avr32dci.c
==
--- head/sys/dev/usb/controller/avr32dci.c  Wed Oct 13 20:36:42 2010
(r213801)
+++ head/sys/dev/usb/controller/avr32dci.c  Wed Oct 13 20:37:19 2010
(r213802)
@@ -1480,7 +1480,7 @@ static const struct avr32dci_config_desc
.bNumEndpoints = 1,
.bInterfaceClass = UICLASS_HUB,
.bInterfaceSubClass = UISUBCLASS_HUB,
-   .bInterfaceProtocol = UIPROTO_HSHUBSTT,
+   .bInterfaceProtocol = 0,
},
.endpd = {
.bLength = sizeof(struct usb_endpoint_descriptor),

Modified: head/sys/dev/usb/controller/musb_otg.c
==
--- head/sys/dev/usb/controller/musb_otg.c  Wed Oct 13 20:36:42 2010
(r213801)
+++ head/sys/dev/usb/controller/musb_otg.c  Wed Oct 13 20:37:19 2010
(r213802)
@@ -2181,7 +2181,7 @@ static const struct musbotg_config_desc

Re: svn commit: r213779 - head/sys/dev/sound/pci

2010-10-13 Thread Rui Paulo
On 13 Oct 2010, at 20:46, Jung-uk Kim wrote:

> On Wednesday 13 October 2010 10:39 am, Rui Paulo wrote:
>> Author: rpaulo
>> Date: Wed Oct 13 14:39:54 2010
>> New Revision: 213779
>> URL: http://svn.freebsd.org/changeset/base/213779
>> 
>> Log:
>>  Fix a brain-o: wrong case statement semantics.
>> 
>>  Found with: clang
>> 
>> Modified:
>>  head/sys/dev/sound/pci/envy24ht.c
>>  head/sys/dev/sound/pci/spicds.c
>> 
>> Modified: head/sys/dev/sound/pci/envy24ht.c
>> ===
>> === --- head/sys/dev/sound/pci/envy24ht.cWed Oct 13
>> 14:37:52 2010(r213778) +++ head/sys/dev/sound/pci/envy24ht.c Wed
>> Oct 13 14:39:54 2010 (r213779) @@ -2236,7 +2236,8 @@
>> envy24ht_putcfg(struct sc_info *sc)
>>  else
>>  printf("not implemented\n");
>> switch (sc->adcn) {
>> -case 0x01 || 0x02:
>> +case 0x01:
>> +case 0x02:
>> printf("  ADC #: ");
>> printf("%d\n", sc->adcn);
>> break;
>> 
>> Modified: head/sys/dev/sound/pci/spicds.c
>> ===
>> === --- head/sys/dev/sound/pci/spicds.c  Wed Oct 13 14:37:52
>> 2010 (r213778) +++ head/sys/dev/sound/pci/spicds.c   Wed Oct 13
>> 14:39:54 2010(r213779) @@ -283,7 +283,8 @@ spicds_set(struct
>> spicds_info *codec, in case SPICDS_TYPE_WM8770:
>>  left = left + 27;
>>  break;
>> -case SPICDS_TYPE_AK4381 || SPICDS_TYPE_AK4396:
>> +case SPICDS_TYPE_AK4381:
>> +case SPICDS_TYPE_AK4396:
>>  left = left * 255 / 100;
>>  break;
>>  default:
> 
> Although it was rediscovered by clang, spicds.c patch actually known 
> to fix a problem.  Please see kern/146758.

I read the PR and the mailing list posts, but I don't see what problem does 
"case SPICDS_TYPE_AK4381 || SPICDS_TYPE_AK4396:" fix.

Regards,
--
Rui Paulo


___
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: r213799 - head/usr.bin/truss

2010-10-13 Thread Benedict Reuschling
Author: bcr (doc committer)
Date: Wed Oct 13 20:08:02 2010
New Revision: 213799
URL: http://svn.freebsd.org/changeset/base/213799

Log:
  s/sytem/system in comments, no functional changes.
  
  Reviewed by:alfred@

Modified:
  head/usr.bin/truss/amd64-fbsd.c
  head/usr.bin/truss/amd64-fbsd32.c
  head/usr.bin/truss/i386-fbsd.c
  head/usr.bin/truss/ia64-fbsd.c
  head/usr.bin/truss/mips-fbsd.c
  head/usr.bin/truss/powerpc-fbsd.c
  head/usr.bin/truss/powerpc64-fbsd.c
  head/usr.bin/truss/sparc64-fbsd.c

Modified: head/usr.bin/truss/amd64-fbsd.c
==
--- head/usr.bin/truss/amd64-fbsd.c Wed Oct 13 18:23:43 2010
(r213798)
+++ head/usr.bin/truss/amd64-fbsd.c Wed Oct 13 20:08:02 2010
(r213799)
@@ -257,7 +257,7 @@ amd64_syscall_entry(struct trussinfo *tr
  * And when the system call is done, we handle it here.
  * Currently, no attempt is made to ensure that the system calls
  * match -- this needs to be fixed (and is, in fact, why S_SCX includes
- * the sytem call number instead of, say, an error status).
+ * the system call number instead of, say, an error status).
  */
 
 long

Modified: head/usr.bin/truss/amd64-fbsd32.c
==
--- head/usr.bin/truss/amd64-fbsd32.c   Wed Oct 13 18:23:43 2010
(r213798)
+++ head/usr.bin/truss/amd64-fbsd32.c   Wed Oct 13 20:08:02 2010
(r213799)
@@ -260,7 +260,7 @@ amd64_fbsd32_syscall_entry(struct trussi
  * And when the system call is done, we handle it here.
  * Currently, no attempt is made to ensure that the system calls
  * match -- this needs to be fixed (and is, in fact, why S_SCX includes
- * the sytem call number instead of, say, an error status).
+ * the system call number instead of, say, an error status).
  */
 
 long

Modified: head/usr.bin/truss/i386-fbsd.c
==
--- head/usr.bin/truss/i386-fbsd.c  Wed Oct 13 18:23:43 2010
(r213798)
+++ head/usr.bin/truss/i386-fbsd.c  Wed Oct 13 20:08:02 2010
(r213799)
@@ -250,7 +250,7 @@ i386_syscall_entry(struct trussinfo *tru
  * And when the system call is done, we handle it here.
  * Currently, no attempt is made to ensure that the system calls
  * match -- this needs to be fixed (and is, in fact, why S_SCX includes
- * the sytem call number instead of, say, an error status).
+ * the system call number instead of, say, an error status).
  */
 
 long

Modified: head/usr.bin/truss/ia64-fbsd.c
==
--- head/usr.bin/truss/ia64-fbsd.c  Wed Oct 13 18:23:43 2010
(r213798)
+++ head/usr.bin/truss/ia64-fbsd.c  Wed Oct 13 20:08:02 2010
(r213799)
@@ -231,7 +231,7 @@ ia64_syscall_entry(struct trussinfo *tru
  * And when the system call is done, we handle it here.
  * Currently, no attempt is made to ensure that the system calls
  * match -- this needs to be fixed (and is, in fact, why S_SCX includes
- * the sytem call number instead of, say, an error status).
+ * the system call number instead of, say, an error status).
  */
 
 long

Modified: head/usr.bin/truss/mips-fbsd.c
==
--- head/usr.bin/truss/mips-fbsd.c  Wed Oct 13 18:23:43 2010
(r213798)
+++ head/usr.bin/truss/mips-fbsd.c  Wed Oct 13 20:08:02 2010
(r213799)
@@ -276,7 +276,7 @@ mips_syscall_entry(struct trussinfo *tru
  * And when the system call is done, we handle it here.
  * Currently, no attempt is made to ensure that the system calls
  * match -- this needs to be fixed (and is, in fact, why S_SCX includes
- * the sytem call number instead of, say, an error status).
+ * the system call number instead of, say, an error status).
  */
 
 long

Modified: head/usr.bin/truss/powerpc-fbsd.c
==
--- head/usr.bin/truss/powerpc-fbsd.c   Wed Oct 13 18:23:43 2010
(r213798)
+++ head/usr.bin/truss/powerpc-fbsd.c   Wed Oct 13 20:08:02 2010
(r213799)
@@ -262,7 +262,7 @@ powerpc_syscall_entry(struct trussinfo *
  * And when the system call is done, we handle it here.
  * Currently, no attempt is made to ensure that the system calls
  * match -- this needs to be fixed (and is, in fact, why S_SCX includes
- * the sytem call number instead of, say, an error status).
+ * the system call number instead of, say, an error status).
  */
 
 long

Modified: head/usr.bin/truss/powerpc64-fbsd.c
==
--- head/usr.bin/truss/powerpc64-fbsd.c Wed Oct 13 18:23:43 2010
(r213798)
+++ head/usr.bin/truss/powerpc64-fbsd.c Wed Oct 13 20:08:02 2010
(r213799)
@@ -250,7 +250,7 @@ powerpc64_syscall_entry(struct trussinfo
  * And when the system call is done, we handle it 

Re: svn commit: r213793 - in head/sys/dev: ce cp

2010-10-13 Thread John Baldwin
On Wednesday, October 13, 2010 1:59:42 pm Jung-uk Kim wrote:
> On Wednesday 13 October 2010 01:27 pm, Roman Divacky wrote:
> > On Wed, Oct 13, 2010 at 05:17:50PM +, Rui Paulo wrote:
> > > Author: rpaulo
> > > Date: Wed Oct 13 17:17:50 2010
> > > New Revision: 213793
> > > URL: http://svn.freebsd.org/changeset/base/213793
> > >
> > > Log:
> > >   Don't do a logical AND of the result of strcmp() with a
> > > constant.
> > >
> > >   Found with: clang
> > >
> > > Modified:
> > >   head/sys/dev/ce/if_ce.c
> > >   head/sys/dev/cp/if_cp.c
> > >
> > > Modified: head/sys/dev/ce/if_ce.c
> > > =
> > >= --- head/sys/dev/ce/if_ce.c  Wed Oct 13 17:16:08
> > > 2010  (r213792) +++ head/sys/dev/ce/if_ce.c   Wed Oct 13 17:17:50
> > > 2010  (r213793) @@ -1313,7 +1313,7 @@ static int ce_ioctl (struct
> > > cdev *dev, u IFP2SP(d->ifp)->pp_flags &= ~(PP_FR);
> > >   IFP2SP(d->ifp)->pp_flags |= PP_KEEPALIVE;
> > >   d->ifp->if_flags |= PP_CISCO;
> > > - } else if (! strcmp ("fr", (char*)data) && PP_FR) {
> > > + } else if (! strcmp ("fr", (char*)data)) {
> >
> > this is wrong I think... the PP_FR was used for compiling in/out
> > support for something.. see the comment:
> >
> > /* If we don't have Cronyx's sppp version, we don't have fr support
> > via sppp */ #ifndef PP_FR
> > #define PP_FR 0
> > #endif
> >
> > note that PP_FR is used in some other places as a flag. I guess
> > that by compiling with something like make -DPP_FR=42 some magic
> > would happen.
> >
> > anyway - this does not look like a bug but like an intent, please
> > revert.
> 
> I think the attached patch should do.

This is certainly more obvious and readable.

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


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

2010-10-13 Thread John Baldwin
On Wednesday, October 13, 2010 12:21:44 pm Gennady Proskurin wrote:
> Thank you and Bruce for explanation.
> The key point here (which I did not understand) is that
> "something == PCPU_GET(cpuid))" may be true only if "something" is set by the
> current cpu, in which case its value is not stale.

Yes.  mtx_owned() (and mtx_assert()) depend on a similar "feature" in that
stale values don't hurt.

> On Wed, Oct 13, 2010 at 09:05:04AM -0400, John Baldwin wrote:
> > On Tuesday, October 12, 2010 5:08:04 pm Gennady Proskurin wrote:
> > > On Sat, Oct 09, 2010 at 12:48:50PM +0300, Andriy Gapon wrote:
> > > > on 09/10/2010 12:33 Bruce Evans said the following:
> > > > > On Sat, 9 Oct 2010, Andriy Gapon wrote:
> > > > > 
> > > > >> Log:
> > > > >>  panic_cpu variable should be volatile
> > > > >>
> > > > >>  This is to prevent caching of its value in a register when it is 
> > > > >> checked
> > > > >>  and modified by multiple CPUs in parallel.
> > > > >>  Also, move the variable  into the scope of the only function that 
> > > > >> uses it.
> > > > >>
> > > > >>  Reviewed by:jhb
> > > > >>  Hint from:mdf
> > > > >>  MFC after:1 week
> > > > > 
> > > > > I doubt that this is either necessary or sufficient.  Most variables
> > > > > aren't volatile while they are locked by a mutex.  But panic() cannot 
> > > > > use
> > > > > normal mutex locking, so it should access this variable using atomic
> > > > > ops with memory barriers.  The compiler part of the memory barriers
> > > > > effectively make _all_ variables temporily volatile.  However, 2 of 
> > > > > the
> > > > > the 4 accesses to this variable doesn't use an atomic op.
> > > > > 
> > > > > % #ifdef SMP
> > > > > % /*
> > > > > %  * We don't want multiple CPU's to panic at the same time, so we
> > > > > %  * use panic_cpu as a simple spinlock.  We have to keep checking
> > > > > %  * panic_cpu if we are spinning in case the panic on the first
> > > > > %  * CPU is canceled.
> > > > > %  */
> > > > > % if (panic_cpu != PCPU_GET(cpuid))
> > > > > 
> > > > > This access doesn't use an atomic op.
> > > > > 
> > > > > % while (atomic_cmpset_int(&panic_cpu, NOCPU,
> > > > > % PCPU_GET(cpuid)) == 0)
> > > > > 
> > > > > This access uses an atomic op.  Not all atomic ops use memory 
> > > > > barriers,
> > > > > at least on i386.  However, this one does, at least on i386.
> > > > > 
> > > > >   (I'm always confused about what atomic_any() without acq or release
> > > > >   means.  Do they mean that you don't want a memory barrier (this is
> > > > >   what the mostly give, at least on i386), and if so, what use are
> > > > >   they?  There are far too many atomic ops, for far too many 
> > > > > never-used
> > > > >   widths, with alternative spellings to encourage using a wrong one.
> > > > >   cmpset is is especially confusing since it you can spell it as 
> > > > > cmpset,
> > > > >   cmpset_acq or compset_rel and always get the barrier, at least on
> > > > >   i386.  At least cmpset only supports 1 width, at least on i386.)
> > > > > 
> > > > > % while (panic_cpu != NOCPU)
> > > > > 
> > > > > This access doesn't use an atomic op.
> > > > > 
> > > > > % ; /* nothing */
> > > > > % #endif
> > > > > % ...
> > > > > % #ifdef RESTARTABLE_PANICS
> > > > > % /* See if the user aborted the panic, in which case we 
> > > > > continue. */
> > > > > % if (panicstr == NULL) {
> > > > > % #ifdef SMP
> > > > > % atomic_store_rel_int(&panic_cpu, NOCPU);
> > > > > 
> > > > > This access uses an atomic op with a memory barrier, at least on i386.
> > > > > Now its rel semantics are clear.
> > > > > 
> > > > > panicstr is non-volatile and never accessed by an atomic op, so it 
> > > > > probably
> > > > > strictly needs to be declared volatile even more than panic_cpu.  I 
> > > > > think
> > > > 
> > > > I agree about panicstr.
> > > > But I am not sure if we have places in code (beyond panic function) 
> > > > itself where
> > > > volatile vs. non-volatile would make any actual difference.
> > > > But still.
> > > > 
> > > > > the only thing that makes it work now is that it is bogusly pubic, and
> > > > > compilers can't analyze the whole program yet -- if they could, then 
> > > > > they
> > > > > would see that it is only set in panic().
> > > > > 
> > > > > % #endif
> > > > > % return;
> > > > > % }
> > > > > % #endif
> > > > > % #endif
> > > > > 
> > > > > Now, why don't the partial memory barriers prevent caching the 
> > > > > variable?
> > > > > 
> > > > > % if (panic_cpu != PCPU_GET(cpuid))
> > > > > % while (atomic_cmpset_int(&panic_cpu, NOCPU,
> > > > > % PCPU_GET(cpuid)) == 0)
> > > > > % while (panic_cpu != NOCPU)
> > > > > % ; /* nothing */
> > > > > 
> > > > > The very first access can't reasonably use a cachec value.  
> > > > > atomic_cmpset()
> > > > > can change panic_cpu, so even without the m

Re: svn commit: r213779 - head/sys/dev/sound/pci

2010-10-13 Thread Jung-uk Kim
On Wednesday 13 October 2010 10:39 am, Rui Paulo wrote:
> Author: rpaulo
> Date: Wed Oct 13 14:39:54 2010
> New Revision: 213779
> URL: http://svn.freebsd.org/changeset/base/213779
>
> Log:
>   Fix a brain-o: wrong case statement semantics.
>
>   Found with: clang
>
> Modified:
>   head/sys/dev/sound/pci/envy24ht.c
>   head/sys/dev/sound/pci/spicds.c
>
> Modified: head/sys/dev/sound/pci/envy24ht.c
> ===
>=== --- head/sys/dev/sound/pci/envy24ht.c  Wed Oct 13
> 14:37:52 2010 (r213778) +++ head/sys/dev/sound/pci/envy24ht.c Wed
> Oct 13 14:39:54 2010  (r213779) @@ -2236,7 +2236,8 @@
> envy24ht_putcfg(struct sc_info *sc)
>   else
>   printf("not implemented\n");
>  switch (sc->adcn) {
> -case 0x01 || 0x02:
> +case 0x01:
> + case 0x02:
>  printf("  ADC #: ");
>  printf("%d\n", sc->adcn);
>  break;
>
> Modified: head/sys/dev/sound/pci/spicds.c
> ===
>=== --- head/sys/dev/sound/pci/spicds.cWed Oct 13 14:37:52
> 2010  (r213778) +++ head/sys/dev/sound/pci/spicds.c   Wed Oct 13
> 14:39:54 2010 (r213779) @@ -283,7 +283,8 @@ spicds_set(struct
> spicds_info *codec, in case SPICDS_TYPE_WM8770:
>   left = left + 27;
>   break;
> - case SPICDS_TYPE_AK4381 || SPICDS_TYPE_AK4396:
> + case SPICDS_TYPE_AK4381:
> + case SPICDS_TYPE_AK4396:
>   left = left * 255 / 100;
>   break;
>   default:

Although it was rediscovered by clang, spicds.c patch actually known 
to fix a problem.  Please see kern/146758.

Jung-uk Kim
___
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: r213798 - head/bin/sh

2010-10-13 Thread David E. O'Brien
Author: obrien
Date: Wed Oct 13 18:23:43 2010
New Revision: 213798
URL: http://svn.freebsd.org/changeset/base/213798

Log:
  If one wishes to set breakpoints of static the functions here, they
  cannot be inlined.
  
  Submitted by: jhb

Modified:
  head/bin/sh/Makefile

Modified: head/bin/sh/Makefile
==
--- head/bin/sh/MakefileWed Oct 13 17:55:53 2010(r213797)
+++ head/bin/sh/MakefileWed Oct 13 18:23:43 2010(r213798)
@@ -21,7 +21,7 @@ LDADD= -ll -ledit -ltermcap
 LFLAGS= -8 # 8-bit lex scanner for arithmetic
 CFLAGS+=-DSHELL -I. -I${.CURDIR}
 # for debug:
-# DEBUG_FLAGS+= -g -DDEBUG=3
+# DEBUG_FLAGS+= -g -DDEBUG=3 -fno-inline
 WARNS?=2
 WFORMAT=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: r213793 - in head/sys/dev: ce cp

2010-10-13 Thread Jung-uk Kim
On Wednesday 13 October 2010 01:27 pm, Roman Divacky wrote:
> On Wed, Oct 13, 2010 at 05:17:50PM +, Rui Paulo wrote:
> > Author: rpaulo
> > Date: Wed Oct 13 17:17:50 2010
> > New Revision: 213793
> > URL: http://svn.freebsd.org/changeset/base/213793
> >
> > Log:
> >   Don't do a logical AND of the result of strcmp() with a
> > constant.
> >
> >   Found with:   clang
> >
> > Modified:
> >   head/sys/dev/ce/if_ce.c
> >   head/sys/dev/cp/if_cp.c
> >
> > Modified: head/sys/dev/ce/if_ce.c
> > =
> >= --- head/sys/dev/ce/if_ce.cWed Oct 13 17:16:08
> > 2010(r213792) +++ head/sys/dev/ce/if_ce.c   Wed Oct 13 17:17:50
> > 2010(r213793) @@ -1313,7 +1313,7 @@ static int ce_ioctl (struct
> > cdev *dev, u IFP2SP(d->ifp)->pp_flags &= ~(PP_FR);
> > IFP2SP(d->ifp)->pp_flags |= PP_KEEPALIVE;
> > d->ifp->if_flags |= PP_CISCO;
> > -   } else if (! strcmp ("fr", (char*)data) && PP_FR) {
> > +   } else if (! strcmp ("fr", (char*)data)) {
>
> this is wrong I think... the PP_FR was used for compiling in/out
> support for something.. see the comment:
>
> /* If we don't have Cronyx's sppp version, we don't have fr support
> via sppp */ #ifndef PP_FR
> #define PP_FR 0
> #endif
>
> note that PP_FR is used in some other places as a flag. I guess
> that by compiling with something like make -DPP_FR=42 some magic
> would happen.
>
> anyway - this does not look like a bug but like an intent, please
> revert.

I think the attached patch should do.

Jung-uk Kim
Index: sys/dev/ce/if_ce.c
===
--- sys/dev/ce/if_ce.c  (revision 213782)
+++ sys/dev/ce/if_ce.c  (working copy)
@@ -1313,9 +1313,11 @@ static int ce_ioctl (struct cdev *dev, u_long cmd,
IFP2SP(d->ifp)->pp_flags &= ~(PP_FR);
IFP2SP(d->ifp)->pp_flags |= PP_KEEPALIVE;
d->ifp->if_flags |= PP_CISCO;
-   } else if (! strcmp ("fr", (char*)data) && PP_FR) {
+#if PP_FR > 0
+   } else if (! strcmp ("fr", (char*)data)) {
d->ifp->if_flags &= ~(PP_CISCO);
IFP2SP(d->ifp)->pp_flags |= PP_FR | PP_KEEPALIVE;
+#endif
} else if (! strcmp ("ppp", (char*)data)) {
IFP2SP(d->ifp)->pp_flags &= ~PP_FR;
IFP2SP(d->ifp)->pp_flags &= ~PP_KEEPALIVE;
Index: sys/dev/cp/if_cp.c
===
--- sys/dev/cp/if_cp.c  (revision 213782)
+++ sys/dev/cp/if_cp.c  (working copy)
@@ -1052,9 +1052,11 @@ static int cp_ioctl (struct cdev *dev, u_long cmd,
IFP2SP(d->ifp)->pp_flags &= ~(PP_FR);
IFP2SP(d->ifp)->pp_flags |= PP_KEEPALIVE;
d->ifp->if_flags |= PP_CISCO;
-   } else if (! strcmp ("fr", (char*)data) && PP_FR) {
+#if PP_FR > 0
+   } else if (! strcmp ("fr", (char*)data)) {
d->ifp->if_flags &= ~(PP_CISCO);
IFP2SP(d->ifp)->pp_flags |= PP_FR | PP_KEEPALIVE;
+#endif
} else if (! strcmp ("ppp", (char*)data)) {
IFP2SP(d->ifp)->pp_flags &= ~PP_FR;
IFP2SP(d->ifp)->pp_flags &= ~PP_KEEPALIVE;
___
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: r213797 - head/sys/crypto/aesni

2010-10-13 Thread Dimitry Andric
Author: dim
Date: Wed Oct 13 17:55:53 2010
New Revision: 213797
URL: http://svn.freebsd.org/changeset/base/213797

Log:
  Change two missed instances of 'retq' in aeskeys_i386.S to 'retl', which
  makes it possible to assemble this file with gas from newer binutils.
  
  Reviewed by:  kib

Modified:
  head/sys/crypto/aesni/aeskeys_i386.S

Modified: head/sys/crypto/aesni/aeskeys_i386.S
==
--- head/sys/crypto/aesni/aeskeys_i386.SWed Oct 13 17:55:19 2010
(r213796)
+++ head/sys/crypto/aesni/aeskeys_i386.SWed Oct 13 17:55:53 2010
(r213797)
@@ -52,7 +52,7 @@ _key_expansion_256a:
pxor%xmm1,%xmm0
movaps  %xmm0,(%edx)
addl$0x10,%edx
-   retq
+   retl
.cfi_endproc
 END(_key_expansion_128)
 
@@ -76,7 +76,7 @@ ENTRY(_key_expansion_192a)
shufps  $0b01001110,%xmm2,%xmm1
movaps  %xmm1,0x10(%edx)
addl$0x20,%edx
-   retq
+   retl
.cfi_endproc
 END(_key_expansion_192a)
 
___
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: r213796 - head/sys/pci

2010-10-13 Thread Pyun YongHyeon
Author: yongari
Date: Wed Oct 13 17:55:19 2010
New Revision: 213796
URL: http://svn.freebsd.org/changeset/base/213796

Log:
  Rewrite interrupt handler to give fairness for both RX and TX.
  Previously rl(4) continuously checked whether there are RX events
  or TX completions in forever loop. This caused TX starvation under
  high RX load as well as consuming too much CPU cycles in the
  interrupt handler. If interrupt was shared with other devices which
  may be always true due to USB devices in these days, rl(4) also
  tried to process the interrupt. This means polling(4) was the only
  way to mitigate the these issues.
  
  To address these issues, rl(4) now disables interrupts when it
  knows the interrupt is ours and limit the number of iteration of
  the loop to 16. The interrupt would be enabled again before exiting
  interrupt handler if the driver is still running. Because RX buffer
  is 64KB in size, the number of iterations in the loop has nothing
  to do with number of RX packets being processed. This change
  ensures sending TX frames under high RX load.
  
  RX handler drops a driver lock to pass received frames to upper
  stack such that there is a window that user can down the interface.
  So rl(4) now checks whether driver is still running before serving
  RX or TX completion in the loop.
  
  While I'm here, exit interrupt handler when driver initialized
  controller.
  
  With this change, now rl(4) can send frames under high RX load even
  though the TX performance is still not good(rl(4) controllers can't
  queue more than 4 frames at a time so low TX performance was one of
  design issue of rl(4) controllers). It's much better than previous
  TX starvation and you should not notice RX performance drop with
  this change. Controller still shows poor performance under high
  network load but for many cases it's now usable without resorting
  to polling(4).
  
  MFC after:2 weeks

Modified:
  head/sys/pci/if_rl.c

Modified: head/sys/pci/if_rl.c
==
--- head/sys/pci/if_rl.cWed Oct 13 17:38:23 2010(r213795)
+++ head/sys/pci/if_rl.cWed Oct 13 17:55:19 2010(r213796)
@@ -1620,6 +1620,7 @@ rl_intr(void *arg)
struct rl_softc *sc = arg;
struct ifnet*ifp = sc->rl_ifp;
uint16_tstatus;
+   int count;
 
RL_LOCK(sc);
 
@@ -1631,30 +1632,41 @@ rl_intr(void *arg)
goto done_locked;
 #endif
 
-   for (;;) {
+   if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
+   goto done_locked2;
+   status = CSR_READ_2(sc, RL_ISR);
+   if (status == 0x || (status & RL_INTRS) == 0)
+   goto done_locked;
+   /*
+* Ours, disable further interrupts.
+*/
+   CSR_WRITE_2(sc, RL_IMR, 0);
+   for (count = 16; count > 0; count--) {
+   CSR_WRITE_2(sc, RL_ISR, status);
+   if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
+   if (status & (RL_ISR_RX_OK | RL_ISR_RX_ERR))
+   rl_rxeof(sc);
+   if (status & (RL_ISR_TX_OK | RL_ISR_TX_ERR))
+   rl_txeof(sc);
+   if (status & RL_ISR_SYSTEM_ERR) {
+   ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
+   rl_init_locked(sc);
+   RL_UNLOCK(sc);
+   return;
+   }
+   }
status = CSR_READ_2(sc, RL_ISR);
/* If the card has gone away, the read returns 0x. */
-   if (status == 0x)
+   if (status == 0x || (status & RL_INTRS) == 0)
break;
-   if (status != 0)
-   CSR_WRITE_2(sc, RL_ISR, status);
-   if ((status & RL_INTRS) == 0)
-   break;
-   if (status & RL_ISR_RX_OK)
-   rl_rxeof(sc);
-   if (status & RL_ISR_RX_ERR)
-   rl_rxeof(sc);
-   if ((status & RL_ISR_TX_OK) || (status & RL_ISR_TX_ERR))
-   rl_txeof(sc);
-   if (status & RL_ISR_SYSTEM_ERR) {
-   ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
-   rl_init_locked(sc);
-   }
}
 
if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
rl_start_locked(ifp);
 
+done_locked2:
+   if (ifp->if_drv_flags & IFF_DRV_RUNNING)
+   CSR_WRITE_2(sc, RL_IMR, RL_INTRS);
 done_locked:
RL_UNLOCK(sc);
 }
___
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: r213795 - in head/sys/dev: ce cp

2010-10-13 Thread Rui Paulo
Author: rpaulo
Date: Wed Oct 13 17:38:23 2010
New Revision: 213795
URL: http://svn.freebsd.org/changeset/base/213795

Log:
  Revert r213793.

Modified:
  head/sys/dev/ce/if_ce.c
  head/sys/dev/cp/if_cp.c

Modified: head/sys/dev/ce/if_ce.c
==
--- head/sys/dev/ce/if_ce.c Wed Oct 13 17:21:21 2010(r213794)
+++ head/sys/dev/ce/if_ce.c Wed Oct 13 17:38:23 2010(r213795)
@@ -1313,7 +1313,7 @@ static int ce_ioctl (struct cdev *dev, u
IFP2SP(d->ifp)->pp_flags &= ~(PP_FR);
IFP2SP(d->ifp)->pp_flags |= PP_KEEPALIVE;
d->ifp->if_flags |= PP_CISCO;
-   } else if (! strcmp ("fr", (char*)data)) {
+   } else if (! strcmp ("fr", (char*)data) && PP_FR) {
d->ifp->if_flags &= ~(PP_CISCO);
IFP2SP(d->ifp)->pp_flags |= PP_FR | PP_KEEPALIVE;
} else if (! strcmp ("ppp", (char*)data)) {

Modified: head/sys/dev/cp/if_cp.c
==
--- head/sys/dev/cp/if_cp.c Wed Oct 13 17:21:21 2010(r213794)
+++ head/sys/dev/cp/if_cp.c Wed Oct 13 17:38:23 2010(r213795)
@@ -1052,7 +1052,7 @@ static int cp_ioctl (struct cdev *dev, u
IFP2SP(d->ifp)->pp_flags &= ~(PP_FR);
IFP2SP(d->ifp)->pp_flags |= PP_KEEPALIVE;
d->ifp->if_flags |= PP_CISCO;
-   } else if (! strcmp ("fr", (char*)data)) {
+   } else if (! strcmp ("fr", (char*)data) && PP_FR) {
d->ifp->if_flags &= ~(PP_CISCO);
IFP2SP(d->ifp)->pp_flags |= PP_FR | PP_KEEPALIVE;
} else if (! strcmp ("ppp", (char*)data)) {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r213793 - in head/sys/dev: ce cp

2010-10-13 Thread Roman Divacky
On Wed, Oct 13, 2010 at 05:17:50PM +, Rui Paulo wrote:
> Author: rpaulo
> Date: Wed Oct 13 17:17:50 2010
> New Revision: 213793
> URL: http://svn.freebsd.org/changeset/base/213793
> 
> Log:
>   Don't do a logical AND of the result of strcmp() with a constant.
>   
>   Found with: clang
> 
> Modified:
>   head/sys/dev/ce/if_ce.c
>   head/sys/dev/cp/if_cp.c
> 
> Modified: head/sys/dev/ce/if_ce.c
> ==
> --- head/sys/dev/ce/if_ce.c   Wed Oct 13 17:16:08 2010(r213792)
> +++ head/sys/dev/ce/if_ce.c   Wed Oct 13 17:17:50 2010(r213793)
> @@ -1313,7 +1313,7 @@ static int ce_ioctl (struct cdev *dev, u
>   IFP2SP(d->ifp)->pp_flags &= ~(PP_FR);
>   IFP2SP(d->ifp)->pp_flags |= PP_KEEPALIVE;
>   d->ifp->if_flags |= PP_CISCO;
> - } else if (! strcmp ("fr", (char*)data) && PP_FR) {
> + } else if (! strcmp ("fr", (char*)data)) {

this is wrong I think... the PP_FR was used for compiling in/out
support for something.. see the comment:

/* If we don't have Cronyx's sppp version, we don't have fr support via sppp */
#ifndef PP_FR
#define PP_FR 0
#endif

note that PP_FR is used in some other places as a flag. I guess that by 
compiling
with something like make -DPP_FR=42 some magic would happen.

anyway - this does not look like a bug but like an intent, please revert.

roman


___
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: r213794 - head/sys/netgraph

2010-10-13 Thread Rui Paulo
Author: rpaulo
Date: Wed Oct 13 17:21:21 2010
New Revision: 213794
URL: http://svn.freebsd.org/changeset/base/213794

Log:
  When calling panic(), always pass a format string.

Modified:
  head/sys/netgraph/ng_UI.c
  head/sys/netgraph/ng_async.c
  head/sys/netgraph/ng_frame_relay.c
  head/sys/netgraph/ng_gif_demux.c
  head/sys/netgraph/ng_iface.c
  head/sys/netgraph/ng_rfc1490.c
  head/sys/netgraph/ng_socket.c
  head/sys/netgraph/ng_tty.c

Modified: head/sys/netgraph/ng_UI.c
==
--- head/sys/netgraph/ng_UI.c   Wed Oct 13 17:17:50 2010(r213793)
+++ head/sys/netgraph/ng_UI.c   Wed Oct 13 17:21:21 2010(r213794)
@@ -197,7 +197,7 @@ ng_UI_rcvdata(hook_p hook, item_p item)
mtod(m, u_char *)[0] = HDLC_UI;
NG_FWD_NEW_DATA(error, item, priv->downlink, m);/* m -> 
NULL */
} else
-   panic(__func__);
+   panic("%s", __func__);
 
 done:
NG_FREE_M(m);   /* does nothing if m == NULL */
@@ -234,7 +234,7 @@ ng_UI_disconnect(hook_p hook)
else if (hook == priv->uplink)
priv->uplink = NULL;
else
-   panic(__func__);
+   panic("%s", __func__);
/*
 * If we are not already shutting down,
 * and we have no more hooks, then DO shut down.

Modified: head/sys/netgraph/ng_async.c
==
--- head/sys/netgraph/ng_async.cWed Oct 13 17:17:50 2010
(r213793)
+++ head/sys/netgraph/ng_async.cWed Oct 13 17:21:21 2010
(r213794)
@@ -256,7 +256,7 @@ nga_rcvdata(hook_p hook, item_p item)
return (nga_rcv_sync(sc, item));
if (hook == sc->async)
return (nga_rcv_async(sc, item));
-   panic(__func__);
+   panic("%s", __func__);
 }
 
 /*
@@ -372,7 +372,7 @@ nga_disconnect(hook_p hook)
else if (hook == sc->sync)
hookp = &sc->sync;
else
-   panic(__func__);
+   panic("%s", __func__);
if (!*hookp)
panic("%s 2", __func__);
*hookp = NULL;

Modified: head/sys/netgraph/ng_frame_relay.c
==
--- head/sys/netgraph/ng_frame_relay.c  Wed Oct 13 17:17:50 2010
(r213793)
+++ head/sys/netgraph/ng_frame_relay.c  Wed Oct 13 17:21:21 2010
(r213794)
@@ -396,7 +396,7 @@ ngfrm_rcvdata(hook_p hook, item_p item)
data[3] |= BYTEX_EA;
break;
default:
-   panic(__func__);
+   panic("%s", __func__);
}
 
/* Send it */

Modified: head/sys/netgraph/ng_gif_demux.c
==
--- head/sys/netgraph/ng_gif_demux.cWed Oct 13 17:17:50 2010
(r213793)
+++ head/sys/netgraph/ng_gif_demux.cWed Oct 13 17:21:21 2010
(r213794)
@@ -391,7 +391,7 @@ ng_gif_demux_disconnect(hook_p hook)
else {
iffam = get_iffam_from_hook(priv, hook);
if (iffam == NULL)
-   panic(__func__);
+   panic("%s", __func__);
*get_hook_from_iffam(priv, iffam) = NULL;
}
 

Modified: head/sys/netgraph/ng_iface.c
==
--- head/sys/netgraph/ng_iface.cWed Oct 13 17:17:50 2010
(r213793)
+++ head/sys/netgraph/ng_iface.cWed Oct 13 17:21:21 2010
(r213794)
@@ -821,7 +821,7 @@ ng_iface_disconnect(hook_p hook)
const iffam_p iffam = get_iffam_from_hook(priv, hook);
 
if (iffam == NULL)
-   panic(__func__);
+   panic("%s", __func__);
*get_hook_from_iffam(priv, iffam) = NULL;
return (0);
 }

Modified: head/sys/netgraph/ng_rfc1490.c
==
--- head/sys/netgraph/ng_rfc1490.c  Wed Oct 13 17:17:50 2010
(r213793)
+++ head/sys/netgraph/ng_rfc1490.c  Wed Oct 13 17:21:21 2010
(r213794)
@@ -440,7 +440,7 @@ switch_on_etype:etype = ntohs(*((const
mtod(m, u_char *)[7] = 0x07;
NG_FWD_NEW_DATA(error, item, priv->downlink, m);
} else
-   panic(__func__);
+   panic("%s", __func__);
 
 done:
if (item)
@@ -485,7 +485,7 @@ ng_rfc1490_disconnect(hook_p hook)
else if (hook == priv->ethernet)
priv->ethernet = NULL;
else
-   panic(__func__);
+   panic("%s", __func__);
return (0);
 }
 

Modified: head/sys/netgraph/ng_socket.c
==
--- head/sys/netgraph/ng_socket.c   Wed Oct 13 17:17:50 2010
(r213793)
+++ head/sys/netgraph/ng_socket.c   

svn commit: r213793 - in head/sys/dev: ce cp

2010-10-13 Thread Rui Paulo
Author: rpaulo
Date: Wed Oct 13 17:17:50 2010
New Revision: 213793
URL: http://svn.freebsd.org/changeset/base/213793

Log:
  Don't do a logical AND of the result of strcmp() with a constant.
  
  Found with:   clang

Modified:
  head/sys/dev/ce/if_ce.c
  head/sys/dev/cp/if_cp.c

Modified: head/sys/dev/ce/if_ce.c
==
--- head/sys/dev/ce/if_ce.c Wed Oct 13 17:16:08 2010(r213792)
+++ head/sys/dev/ce/if_ce.c Wed Oct 13 17:17:50 2010(r213793)
@@ -1313,7 +1313,7 @@ static int ce_ioctl (struct cdev *dev, u
IFP2SP(d->ifp)->pp_flags &= ~(PP_FR);
IFP2SP(d->ifp)->pp_flags |= PP_KEEPALIVE;
d->ifp->if_flags |= PP_CISCO;
-   } else if (! strcmp ("fr", (char*)data) && PP_FR) {
+   } else if (! strcmp ("fr", (char*)data)) {
d->ifp->if_flags &= ~(PP_CISCO);
IFP2SP(d->ifp)->pp_flags |= PP_FR | PP_KEEPALIVE;
} else if (! strcmp ("ppp", (char*)data)) {

Modified: head/sys/dev/cp/if_cp.c
==
--- head/sys/dev/cp/if_cp.c Wed Oct 13 17:16:08 2010(r213792)
+++ head/sys/dev/cp/if_cp.c Wed Oct 13 17:17:50 2010(r213793)
@@ -1052,7 +1052,7 @@ static int cp_ioctl (struct cdev *dev, u
IFP2SP(d->ifp)->pp_flags &= ~(PP_FR);
IFP2SP(d->ifp)->pp_flags |= PP_KEEPALIVE;
d->ifp->if_flags |= PP_CISCO;
-   } else if (! strcmp ("fr", (char*)data) && PP_FR) {
+   } else if (! strcmp ("fr", (char*)data)) {
d->ifp->if_flags &= ~(PP_CISCO);
IFP2SP(d->ifp)->pp_flags |= PP_FR | PP_KEEPALIVE;
} else if (! strcmp ("ppp", (char*)data)) {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r213792 - head/sys/contrib/pf/netinet

2010-10-13 Thread Rui Paulo
Author: rpaulo
Date: Wed Oct 13 17:16:08 2010
New Revision: 213792
URL: http://svn.freebsd.org/changeset/base/213792

Log:
  Ignore the return value of ADDCARRY().

Modified:
  head/sys/contrib/pf/netinet/in4_cksum.c

Modified: head/sys/contrib/pf/netinet/in4_cksum.c
==
--- head/sys/contrib/pf/netinet/in4_cksum.c Wed Oct 13 17:13:43 2010
(r213791)
+++ head/sys/contrib/pf/netinet/in4_cksum.c Wed Oct 13 17:16:08 2010
(r213792)
@@ -75,7 +75,7 @@
 #include 
 
 #define ADDCARRY(x)  (x > 65535 ? x -= 65535 : x)
-#define REDUCE {l_util.l = sum; sum = l_util.s[0] + l_util.s[1]; 
ADDCARRY(sum);}
+#define REDUCE {l_util.l = sum; sum = l_util.s[0] + l_util.s[1]; 
(void)ADDCARRY(sum);}
 
 int in4_cksum(struct mbuf *, u_int8_t, int, int);
 
___
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: r213791 - head/sys/cddl/compat/opensolaris/kern

2010-10-13 Thread Rui Paulo
Author: rpaulo
Date: Wed Oct 13 17:13:43 2010
New Revision: 213791
URL: http://svn.freebsd.org/changeset/base/213791

Log:
  Pass a format string to panic() and to taskqueue_start_threads().
  
  Found with:   clang

Modified:
  head/sys/cddl/compat/opensolaris/kern/opensolaris_cmn_err.c
  head/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c

Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_cmn_err.c
==
--- head/sys/cddl/compat/opensolaris/kern/opensolaris_cmn_err.c Wed Oct 13 
17:12:23 2010(r213790)
+++ head/sys/cddl/compat/opensolaris/kern/opensolaris_cmn_err.c Wed Oct 13 
17:13:43 2010(r213791)
@@ -48,7 +48,7 @@ vcmn_err(int ce, const char *fmt, va_lis
panic("Solaris: unknown severity level");
}
if (ce == CE_PANIC)
-   panic(buf);
+   panic("%s", buf);
if (ce != CE_IGNORE)
vprintf(buf, adx);
 }

Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c
==
--- head/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c   Wed Oct 13 
17:12:23 2010(r213790)
+++ head/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c   Wed Oct 13 
17:13:43 2010(r213791)
@@ -73,7 +73,7 @@ taskq_create(const char *name, int nthre
tq = kmem_alloc(sizeof(*tq), KM_SLEEP);
tq->tq_queue = taskqueue_create(name, M_WAITOK, 
taskqueue_thread_enqueue,
&tq->tq_queue);
-   (void) taskqueue_start_threads(&tq->tq_queue, nthreads, pri, name);
+   (void) taskqueue_start_threads(&tq->tq_queue, nthreads, pri, "%s", 
name);
 
return ((taskq_t *)tq);
 }
___
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: r213790 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2010-10-13 Thread Rui Paulo
Author: rpaulo
Date: Wed Oct 13 17:12:23 2010
New Revision: 213790
URL: http://svn.freebsd.org/changeset/base/213790

Log:
  In zfs_post_common(), use %d instead of %hhu.
  
  Found with:   clang

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fm.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fm.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fm.cWed Oct 
13 17:09:53 2010(r213789)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fm.cWed Oct 
13 17:12:23 2010(r213790)
@@ -350,7 +350,7 @@ zfs_post_common(spa_t *spa, vdev_t *vd, 
 
snprintf(class, sizeof(class), "%s.%s.%s", FM_RSRC_RESOURCE,
ZFS_ERROR_CLASS, name);
-   sbuf_printf(&sb, " %s=%hhu", FM_VERSION, FM_RSRC_VERSION);
+   sbuf_printf(&sb, " %s=%d", FM_VERSION, FM_RSRC_VERSION);
sbuf_printf(&sb, " %s=%s", FM_CLASS, class);
sbuf_printf(&sb, " %s=%ju", FM_EREPORT_PAYLOAD_ZFS_POOL_GUID,
spa_guid(spa));
___
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: r213789 - in head/sys/contrib/ngatm/netnatm: msg sig

2010-10-13 Thread Rui Paulo
Author: rpaulo
Date: Wed Oct 13 17:09:53 2010
New Revision: 213789
URL: http://svn.freebsd.org/changeset/base/213789

Log:
  Properly tell the compiler that we want to ignore the return value of
  certain macros.

Modified:
  head/sys/contrib/ngatm/netnatm/msg/privmsg.c
  head/sys/contrib/ngatm/netnatm/msg/uni_ie.c
  head/sys/contrib/ngatm/netnatm/sig/sig_call.c
  head/sys/contrib/ngatm/netnatm/sig/sig_reset.c

Modified: head/sys/contrib/ngatm/netnatm/msg/privmsg.c
==
--- head/sys/contrib/ngatm/netnatm/msg/privmsg.cWed Oct 13 17:09:16 
2010(r213788)
+++ head/sys/contrib/ngatm/netnatm/msg/privmsg.cWed Oct 13 17:09:53 
2010(r213789)
@@ -145,7 +145,7 @@ uni_decode_body_internal(enum uni_msgtyp
msg->b_rptr = msg->b_wptr;
else
msg->b_rptr += ielen;
-   UNI_SAVE_IERR(cx, ietype, hdr.act, UNI_IERR_UNK);
+   (void)UNI_SAVE_IERR(cx, ietype, hdr.act, UNI_IERR_UNK);
err = -1;
continue;
}
@@ -200,16 +200,16 @@ uni_decode_body_internal(enum uni_msgtyp
 * Unexpected but recognized.
 * Q.2931 5.6.8.3
 */
-   UNI_SAVE_IERR(cx, ietype, hdr.act, UNI_IERR_UNK);
+   (void)UNI_SAVE_IERR(cx, ietype, hdr.act, UNI_IERR_UNK);
err = -1;
break;
 
  case DEC_ERR: /* bad IE */
if (iedecl->flags & UNIFL_ACCESS)
/* this may be wrong: 5.6.8.2 */
-   UNI_SAVE_IERR(cx, ietype, hdr.act, 
UNI_IERR_ACC);
+   (void)UNI_SAVE_IERR(cx, ietype, hdr.act, 
UNI_IERR_ACC);
else
-   UNI_SAVE_IERR(cx, ietype, hdr.act, 
UNI_IERR_BAD);
+   (void)UNI_SAVE_IERR(cx, ietype, hdr.act, 
UNI_IERR_BAD);
err = -1;
break;
 

Modified: head/sys/contrib/ngatm/netnatm/msg/uni_ie.c
==
--- head/sys/contrib/ngatm/netnatm/msg/uni_ie.c Wed Oct 13 17:09:16 2010
(r213788)
+++ head/sys/contrib/ngatm/netnatm/msg/uni_ie.c Wed Oct 13 17:09:53 2010
(r213789)
@@ -214,7 +214,7 @@ uni_encode_msg_hdr(struct uni_msg *msg, 
 {
u_char byte;
 
-   uni_msg_ensure(msg, 9);
+   (void)uni_msg_ensure(msg, 9);
 
APP_BYTE(msg, cx->pnni ? PNNI_PROTO : UNI_PROTO); 
APP_BYTE(msg, 3); 
@@ -652,7 +652,7 @@ uni_encode_ie_hdr(struct uni_msg *msg, e
 {
u_char byte;
 
-   uni_msg_ensure(msg, 4 + len);
+   (void)uni_msg_ensure(msg, 4 + len);
*msg->b_wptr++ = type;
 
byte = 0x80 | (h->coding << 5);

Modified: head/sys/contrib/ngatm/netnatm/sig/sig_call.c
==
--- head/sys/contrib/ngatm/netnatm/sig/sig_call.c   Wed Oct 13 17:09:16 
2010(r213788)
+++ head/sys/contrib/ngatm/netnatm/sig/sig_call.c   Wed Oct 13 17:09:53 
2010(r213789)
@@ -398,7 +398,7 @@ un0_setup(struct call *c, struct uni_msg
if (IE_ISGOOD(u->u.setup.epref) &&
   u->u.setup.epref.flag == 1) {
IE_SETERROR(u->u.setup.epref);
-   UNI_SAVE_IERR(&c->uni->cx, UNI_IE_EPREF,
+   (void)UNI_SAVE_IERR(&c->uni->cx, UNI_IE_EPREF,
u->u.setup.epref.h.act, UNI_IERR_BAD);
}
uni_mandate_epref(c->uni, &u->u.setup.epref);
@@ -578,7 +578,7 @@ u1n6_call_proc(struct call *c, struct un
(cp->epref.flag != 1 ||
 cp->epref.epref != c->msg_setup.epref.epref)) {
IE_SETERROR(cp->epref);
-   UNI_SAVE_IERR(&c->uni->cx, UNI_IE_EPREF,
+   (void)UNI_SAVE_IERR(&c->uni->cx, UNI_IE_EPREF,
cp->epref.h.act, UNI_IERR_BAD);
}
}
@@ -763,7 +763,7 @@ unx_alerting(struct call *c, struct uni_
(al->epref.flag != 1 ||
 al->epref.epref != c->msg_setup.epref.epref)) {
IE_SETERROR(al->epref);
-   UNI_SAVE_IERR(&c->uni->cx, UNI_IE_EPREF,
+   (void)UNI_SAVE_IERR(&c->uni->cx, UNI_IE_EPREF,
al->epref.h.act, UNI_IERR_BAD);
}
}
@@ -1065,7 +1065,7 @@ unx_connect(struct call *c, struct uni_m
if (IE_ISGOOD(co->epref) &&
co->epref.flag != 1) {
IE_SETERROR(co->epref);
-   UNI_SAVE_IE

svn commit: r213788 - head/sys/contrib/ngatm/netnatm/api

2010-10-13 Thread Rui Paulo
Author: rpaulo
Date: Wed Oct 13 17:09:16 2010
New Revision: 213788
URL: http://svn.freebsd.org/changeset/base/213788

Log:
  Fix several cases were a conditional operator was used instead of a
  bitwise operator.
  
  Found with:   clang

Modified:
  head/sys/contrib/ngatm/netnatm/api/cc_conn.c

Modified: head/sys/contrib/ngatm/netnatm/api/cc_conn.c
==
--- head/sys/contrib/ngatm/netnatm/api/cc_conn.cWed Oct 13 17:06:25 
2010(r213787)
+++ head/sys/contrib/ngatm/netnatm/api/cc_conn.cWed Oct 13 17:09:16 
2010(r213788)
@@ -977,25 +977,25 @@ cc_conn_sig_handle(struct ccconn *conn, 
/*
 * attributes
 */
-   if (conn->dirty_attr && CCDIRTY_AAL)
+   if (conn->dirty_attr & CCDIRTY_AAL)
resp->connect.aal = conn->aal;
-   if (conn->dirty_attr && CCDIRTY_BLLI)
+   if (conn->dirty_attr & CCDIRTY_BLLI)
resp->connect.blli =
conn->blli[conn->blli_selector - 1];
-   if (conn->dirty_attr && CCDIRTY_CONNID)
+   if (conn->dirty_attr & CCDIRTY_CONNID)
resp->connect.connid = conn->connid;
/* XXX NOTIFY */
-   if (conn->dirty_attr && CCDIRTY_EETD)
+   if (conn->dirty_attr & CCDIRTY_EETD)
resp->connect.eetd = conn->eetd;
/* XXX GIT */
/* XXX UU */
-   if (conn->dirty_attr && CCDIRTY_TRAFFIC)
+   if (conn->dirty_attr & CCDIRTY_TRAFFIC)
resp->connect.traffic = conn->traffic;
-   if (conn->dirty_attr && CCDIRTY_EXQOS)
+   if (conn->dirty_attr & CCDIRTY_EXQOS)
resp->connect.exqos = conn->exqos;
-   if (conn->dirty_attr && CCDIRTY_ABRSETUP)
+   if (conn->dirty_attr & CCDIRTY_ABRSETUP)
resp->connect.abrsetup = conn->abrsetup;
-   if (conn->dirty_attr && CCDIRTY_ABRADD)
+   if (conn->dirty_attr & CCDIRTY_ABRADD)
resp->connect.abradd = conn->abradd;
 
/*
___
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: r213787 - head/sys/dev/acpica/Osd

2010-10-13 Thread Jung-uk Kim
Author: jkim
Date: Wed Oct 13 17:06:25 2010
New Revision: 213787
URL: http://svn.freebsd.org/changeset/base/213787

Log:
  Clean up unused headers.

Modified:
  head/sys/dev/acpica/Osd/OsdHardware.c

Modified: head/sys/dev/acpica/Osd/OsdHardware.c
==
--- head/sys/dev/acpica/Osd/OsdHardware.c   Wed Oct 13 17:01:33 2010
(r213786)
+++ head/sys/dev/acpica/Osd/OsdHardware.c   Wed Oct 13 17:06:25 2010
(r213787)
@@ -34,12 +34,8 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-#include 
-#include 
 #include 
 #include 
-#include 
-#include 
 
 /*
  * ACPICA's rather gung-ho approach to hardware resource ownership is a little
___
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: r213786 - head/contrib/llvm/tools/clang/lib/Sema

2010-10-13 Thread Roman Divacky
Author: rdivacky
Date: Wed Oct 13 17:01:33 2010
New Revision: 213786
URL: http://svn.freebsd.org/changeset/base/213786

Log:
  Actually, check for any kind of "C string type".
  
  Approved by:rpaulo (mentor)

Modified:
  head/contrib/llvm/tools/clang/lib/Sema/SemaChecking.cpp

Modified: head/contrib/llvm/tools/clang/lib/Sema/SemaChecking.cpp
==
--- head/contrib/llvm/tools/clang/lib/Sema/SemaChecking.cpp Wed Oct 13 
16:57:06 2010(r213785)
+++ head/contrib/llvm/tools/clang/lib/Sema/SemaChecking.cpp Wed Oct 13 
17:01:33 2010(r213786)
@@ -1519,14 +1519,10 @@ CheckPrintfHandler::HandlePrintfSpecifie
 // Now type check the data expression that matches the
 // format specifier.
 const Expr *Ex = getDataArg(argIndex);
-QualType Pointee = S.Context.UnsignedCharTy;
-Pointee.addConst();
-QualType constType = (CS.getKind() == ConversionSpecifier::bArg) ? 
S.Context.IntTy : S.Context.getPointerType(Pointee);
-QualType type = (CS.getKind() == ConversionSpecifier::bArg) ? 
S.Context.IntTy : S.Context.getPointerType(S.Context.UnsignedCharTy);
-const analyze_printf::ArgTypeResult &ConstATR = constType;
-const analyze_printf::ArgTypeResult &ATR = type;
-if (ATR.isValid() && !ATR.matchesType(S.Context, Ex->getType()) &&
-!ConstATR.matchesType(S.Context, Ex->getType()))
+const analyze_printf::ArgTypeResult &ATR = 
+  (CS.getKind() == ConversionSpecifier::bArg) ?
+ArgTypeResult(S.Context.IntTy) : ArgTypeResult::CStrTy;
+if (ATR.isValid() && !ATR.matchesType(S.Context, Ex->getType()))
   S.Diag(getLocationOfByte(CS.getStart()),
  diag::warn_printf_conversion_argument_type_mismatch)
 << ATR.getRepresentativeType(S.Context) << Ex->getType()
___
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: r213785 - in head/lib/libc: net sys

2010-10-13 Thread Rui Paulo
Author: rpaulo
Date: Wed Oct 13 16:57:06 2010
New Revision: 213785
URL: http://svn.freebsd.org/changeset/base/213785

Log:
  Clang related fixes:
  * When calling syslog(), pass a format string.
  * Define YY_NO_INPUT on nslexer.l
  
  Submitted by: Norberto Lopes 

Modified:
  head/lib/libc/net/nslexer.l
  head/lib/libc/sys/stack_protector.c

Modified: head/lib/libc/net/nslexer.l
==
--- head/lib/libc/net/nslexer.l Wed Oct 13 16:34:08 2010(r213784)
+++ head/lib/libc/net/nslexer.l Wed Oct 13 16:57:06 2010(r213785)
@@ -53,6 +53,7 @@ static char *rcsid = 
 
 #include "nsparser.h"
 
+#defineYY_NO_INPUT
 #define YY_NO_UNPUT
 
 %}

Modified: head/lib/libc/sys/stack_protector.c
==
--- head/lib/libc/sys/stack_protector.c Wed Oct 13 16:34:08 2010
(r213784)
+++ head/lib/libc/sys/stack_protector.c Wed Oct 13 16:57:06 2010
(r213785)
@@ -92,7 +92,7 @@ __fail(const char *msg)
(void)sigprocmask(SIG_BLOCK, &mask, NULL);
 
/* This may fail on a chroot jail... */
-   syslog(LOG_CRIT, msg);
+   syslog(LOG_CRIT, "%s", msg);
 
(void)memset(&sa, 0, sizeof(sa));
(void)sigemptyset(&sa.sa_mask);
___
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: r213784 - head/lib/libz

2010-10-13 Thread Warner Losh
Author: imp
Date: Wed Oct 13 16:34:08 2010
New Revision: 213784
URL: http://svn.freebsd.org/changeset/base/213784

Log:
  Revert 212517 to restore pristine state of this file

Modified:
  head/lib/libz/minigzip.c

Modified: head/lib/libz/minigzip.c
==
--- head/lib/libz/minigzip.cWed Oct 13 16:30:41 2010(r213783)
+++ head/lib/libz/minigzip.cWed Oct 13 16:34:08 2010(r213784)
@@ -13,8 +13,6 @@
  * or in pipe mode.
  */
 
-#include 
-__FBSDID("$FreeBSD$");
 /* @(#) $Id$ */
 
 #include "zlib.h"
___
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: r213783 - head/sys/dev/acpica/Osd

2010-10-13 Thread Jung-uk Kim
Author: jkim
Date: Wed Oct 13 16:30:41 2010
New Revision: 213783
URL: http://svn.freebsd.org/changeset/base/213783

Log:
  Remove acpi_bus_number() completely.  It had to be removed in r212761.
  
  Pointed out by:   jhb

Modified:
  head/sys/dev/acpica/Osd/OsdHardware.c

Modified: head/sys/dev/acpica/Osd/OsdHardware.c
==
--- head/sys/dev/acpica/Osd/OsdHardware.c   Wed Oct 13 14:57:13 2010
(r213782)
+++ head/sys/dev/acpica/Osd/OsdHardware.c   Wed Oct 13 16:30:41 2010
(r213783)
@@ -122,58 +122,3 @@ AcpiOsWritePciConfiguration (ACPI_PCI_ID
 
 return (AE_OK);
 }
-
-/*
- * Depth-first recursive case for finding the bus, given the slot/function.
- */
-static int __unused
-acpi_bus_number(ACPI_HANDLE root, ACPI_HANDLE curr, ACPI_PCI_ID *PciId)
-{
-ACPI_HANDLE parent;
-ACPI_STATUS status;
-ACPI_OBJECT_TYPE type;
-UINT32 adr;
-int bus, slot, func, class, subclass, header;
-
-/* Try to get the _BBN object of the root, otherwise assume it is 0. */
-bus = 0;
-if (root == curr) {
-   status = acpi_GetInteger(root, "_BBN", &bus);
-   if (ACPI_FAILURE(status) && bootverbose)
-   printf("acpi_bus_number: root bus has no _BBN, assuming 0\n");
-   return (bus);
-}
-status = AcpiGetParent(curr, &parent);
-if (ACPI_FAILURE(status))
-   return (bus);
-
-/* First, recurse up the tree until we find the host bus. */
-bus = acpi_bus_number(root, parent, PciId);
-
-/* Validate parent bus device type. */
-if (ACPI_FAILURE(AcpiGetType(parent, &type)) || type != ACPI_TYPE_DEVICE) {
-   printf("acpi_bus_number: not a device, type %d\n", type);
-   return (bus);
-}
-
-/* Get the parent's slot and function. */
-status = acpi_GetInteger(parent, "_ADR", &adr);
-if (ACPI_FAILURE(status))
-   return (bus);
-slot = ACPI_HIWORD(adr);
-func = ACPI_LOWORD(adr);
-
-/* Is this a PCI-PCI or Cardbus-PCI bridge? */
-class = pci_cfgregread(bus, slot, func, PCIR_CLASS, 1);
-if (class != PCIC_BRIDGE)
-   return (bus);
-subclass = pci_cfgregread(bus, slot, func, PCIR_SUBCLASS, 1);
-
-/* Find the header type, masking off the multifunction bit. */
-header = pci_cfgregread(bus, slot, func, PCIR_HDRTYPE, 1) & PCIM_HDRTYPE;
-if (header == PCIM_HDRTYPE_BRIDGE && subclass == PCIS_BRIDGE_PCI)
-   bus = pci_cfgregread(bus, slot, func, PCIR_SECBUS_1, 1);
-else if (header == PCIM_HDRTYPE_CARDBUS && subclass == PCIS_BRIDGE_CARDBUS)
-   bus = pci_cfgregread(bus, slot, func, PCIR_SECBUS_2, 1);
-return (bus);
-}
___
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: r213772 - head/sys/dev/acpica/Osd

2010-10-13 Thread Jung-uk Kim
On Wednesday 13 October 2010 08:47 am, John Baldwin wrote:
> On Wednesday, October 13, 2010 7:38:25 am Rui Paulo wrote:
> > Author: rpaulo
> > Date: Wed Oct 13 11:38:24 2010
> > New Revision: 213772
> > URL: http://svn.freebsd.org/changeset/base/213772
> >
> > Log:
> >   Mark acpi_bus_number() as __unused. This allows clang to this
> > file without any warnings.
>
> Actually, I think this should have been removed when
> AcpiOsDerivePciId() was removed during the update to ACPICA
> 20100915.

Yes, you're right.  I'll fix that.

Thanks,

Jung-uk Kim
___
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: r213648 - head/sys/kern

2010-10-13 Thread Gennady Proskurin
Thank you and Bruce for explanation.
The key point here (which I did not understand) is that
"something == PCPU_GET(cpuid))" may be true only if "something" is set by the
current cpu, in which case its value is not stale.

On Wed, Oct 13, 2010 at 09:05:04AM -0400, John Baldwin wrote:
> On Tuesday, October 12, 2010 5:08:04 pm Gennady Proskurin wrote:
> > On Sat, Oct 09, 2010 at 12:48:50PM +0300, Andriy Gapon wrote:
> > > on 09/10/2010 12:33 Bruce Evans said the following:
> > > > On Sat, 9 Oct 2010, Andriy Gapon wrote:
> > > > 
> > > >> Log:
> > > >>  panic_cpu variable should be volatile
> > > >>
> > > >>  This is to prevent caching of its value in a register when it is 
> > > >> checked
> > > >>  and modified by multiple CPUs in parallel.
> > > >>  Also, move the variable  into the scope of the only function that 
> > > >> uses it.
> > > >>
> > > >>  Reviewed by:jhb
> > > >>  Hint from:mdf
> > > >>  MFC after:1 week
> > > > 
> > > > I doubt that this is either necessary or sufficient.  Most variables
> > > > aren't volatile while they are locked by a mutex.  But panic() cannot 
> > > > use
> > > > normal mutex locking, so it should access this variable using atomic
> > > > ops with memory barriers.  The compiler part of the memory barriers
> > > > effectively make _all_ variables temporily volatile.  However, 2 of the
> > > > the 4 accesses to this variable doesn't use an atomic op.
> > > > 
> > > > % #ifdef SMP
> > > > % /*
> > > > %  * We don't want multiple CPU's to panic at the same time, so we
> > > > %  * use panic_cpu as a simple spinlock.  We have to keep checking
> > > > %  * panic_cpu if we are spinning in case the panic on the first
> > > > %  * CPU is canceled.
> > > > %  */
> > > > % if (panic_cpu != PCPU_GET(cpuid))
> > > > 
> > > > This access doesn't use an atomic op.
> > > > 
> > > > % while (atomic_cmpset_int(&panic_cpu, NOCPU,
> > > > % PCPU_GET(cpuid)) == 0)
> > > > 
> > > > This access uses an atomic op.  Not all atomic ops use memory barriers,
> > > > at least on i386.  However, this one does, at least on i386.
> > > > 
> > > >   (I'm always confused about what atomic_any() without acq or release
> > > >   means.  Do they mean that you don't want a memory barrier (this is
> > > >   what the mostly give, at least on i386), and if so, what use are
> > > >   they?  There are far too many atomic ops, for far too many never-used
> > > >   widths, with alternative spellings to encourage using a wrong one.
> > > >   cmpset is is especially confusing since it you can spell it as cmpset,
> > > >   cmpset_acq or compset_rel and always get the barrier, at least on
> > > >   i386.  At least cmpset only supports 1 width, at least on i386.)
> > > > 
> > > > % while (panic_cpu != NOCPU)
> > > > 
> > > > This access doesn't use an atomic op.
> > > > 
> > > > % ; /* nothing */
> > > > % #endif
> > > > % ...
> > > > % #ifdef RESTARTABLE_PANICS
> > > > % /* See if the user aborted the panic, in which case we continue. 
> > > > */
> > > > % if (panicstr == NULL) {
> > > > % #ifdef SMP
> > > > % atomic_store_rel_int(&panic_cpu, NOCPU);
> > > > 
> > > > This access uses an atomic op with a memory barrier, at least on i386.
> > > > Now its rel semantics are clear.
> > > > 
> > > > panicstr is non-volatile and never accessed by an atomic op, so it 
> > > > probably
> > > > strictly needs to be declared volatile even more than panic_cpu.  I 
> > > > think
> > > 
> > > I agree about panicstr.
> > > But I am not sure if we have places in code (beyond panic function) 
> > > itself where
> > > volatile vs. non-volatile would make any actual difference.
> > > But still.
> > > 
> > > > the only thing that makes it work now is that it is bogusly pubic, and
> > > > compilers can't analyze the whole program yet -- if they could, then 
> > > > they
> > > > would see that it is only set in panic().
> > > > 
> > > > % #endif
> > > > % return;
> > > > % }
> > > > % #endif
> > > > % #endif
> > > > 
> > > > Now, why don't the partial memory barriers prevent caching the variable?
> > > > 
> > > > % if (panic_cpu != PCPU_GET(cpuid))
> > > > % while (atomic_cmpset_int(&panic_cpu, NOCPU,
> > > > % PCPU_GET(cpuid)) == 0)
> > > > % while (panic_cpu != NOCPU)
> > > > % ; /* nothing */
> > > > 
> > > > The very first access can't reasonably use a cachec value.  
> > > > atomic_cmpset()
> > > > can change panic_cpu, so even without the memory barrier, panic_cpu must
> > > > be reloaded for the third access the first time.  But then when the 
> > > > third
> > > > access is repeated in the second while loop, the missing atomic op with
> > > > barrier makes things very broken.  panic_cpu isn't changed by the loop,
> > > > and the compiler thinks that it isn't changed by anything else either, 
> > > > so
> > > > the compiler may reduce the loop to:
> > > > 
> > > > %   

svn commit: r213782 - head/sys/contrib/ipfilter/netinet

2010-10-13 Thread Rui Paulo
Author: rpaulo
Date: Wed Oct 13 14:57:13 2010
New Revision: 213782
URL: http://svn.freebsd.org/changeset/base/213782

Log:
  Pass a format string to make_dev().
  
  Found by: clang

Modified:
  head/sys/contrib/ipfilter/netinet/mlfk_ipl.c

Modified: head/sys/contrib/ipfilter/netinet/mlfk_ipl.c
==
--- head/sys/contrib/ipfilter/netinet/mlfk_ipl.cWed Oct 13 14:44:38 
2010(r213781)
+++ head/sys/contrib/ipfilter/netinet/mlfk_ipl.cWed Oct 13 14:57:13 
2010(r213782)
@@ -204,7 +204,7 @@ ipf_modload()
}
if (!c)
c = str;
-   ipf_devs[i] = make_dev(&ipl_cdevsw, i, 0, 0, 0600, c);
+   ipf_devs[i] = make_dev(&ipl_cdevsw, i, 0, 0, 0600, "%s", c);
}
 
error = ipf_pfil_hook();
___
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: r213781 - in head/sys/modules: cryptodev sysvipc/sysvmsg sysvipc/sysvsem

2010-10-13 Thread Rui Paulo
Author: rpaulo
Date: Wed Oct 13 14:44:38 2010
New Revision: 213781
URL: http://svn.freebsd.org/changeset/base/213781

Log:
  Add opt_compat.h to SRCS.

Modified:
  head/sys/modules/cryptodev/Makefile
  head/sys/modules/sysvipc/sysvmsg/Makefile
  head/sys/modules/sysvipc/sysvsem/Makefile

Modified: head/sys/modules/cryptodev/Makefile
==
--- head/sys/modules/cryptodev/Makefile Wed Oct 13 14:41:52 2010
(r213780)
+++ head/sys/modules/cryptodev/Makefile Wed Oct 13 14:44:38 2010
(r213781)
@@ -3,6 +3,6 @@
 .PATH: ${.CURDIR}/../../opencrypto
 KMOD   = cryptodev
 SRCS   = cryptodev.c
-SRCS   += bus_if.h device_if.h
+SRCS   += bus_if.h device_if.h opt_compat.h
 
 .include 

Modified: head/sys/modules/sysvipc/sysvmsg/Makefile
==
--- head/sys/modules/sysvipc/sysvmsg/Makefile   Wed Oct 13 14:41:52 2010
(r213780)
+++ head/sys/modules/sysvipc/sysvmsg/Makefile   Wed Oct 13 14:44:38 2010
(r213781)
@@ -3,6 +3,6 @@
 .PATH: ${.CURDIR}/../../../kern
 
 KMOD=  sysvmsg
-SRCS=  sysv_msg.c opt_sysvipc.h
+SRCS=  sysv_msg.c opt_sysvipc.h opt_compat.h
 
 .include 

Modified: head/sys/modules/sysvipc/sysvsem/Makefile
==
--- head/sys/modules/sysvipc/sysvsem/Makefile   Wed Oct 13 14:41:52 2010
(r213780)
+++ head/sys/modules/sysvipc/sysvsem/Makefile   Wed Oct 13 14:44:38 2010
(r213781)
@@ -3,6 +3,6 @@
 .PATH: ${.CURDIR}/../../../kern
 
 KMOD=  sysvsem
-SRCS=  sysv_sem.c opt_sysvipc.h
+SRCS=  sysv_sem.c opt_sysvipc.h opt_compat.h
 
 .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"


svn commit: r213780 - head/sys/dev/hptrr

2010-10-13 Thread Rui Paulo
Author: rpaulo
Date: Wed Oct 13 14:41:52 2010
New Revision: 213780
URL: http://svn.freebsd.org/changeset/base/213780

Log:
  Pass a format string to make_dev().

Modified:
  head/sys/dev/hptrr/hptrr_osm_bsd.c

Modified: head/sys/dev/hptrr/hptrr_osm_bsd.c
==
--- head/sys/dev/hptrr/hptrr_osm_bsd.c  Wed Oct 13 14:39:54 2010
(r213779)
+++ head/sys/dev/hptrr/hptrr_osm_bsd.c  Wed Oct 13 14:41:52 2010
(r213780)
@@ -1178,7 +1178,7 @@ static void hpt_final_init(void *dummy)
}   
 
make_dev(&hpt_cdevsw, DRIVER_MINOR, UID_ROOT, GID_OPERATOR,
-   S_IRUSR | S_IWUSR, driver_name);
+   S_IRUSR | S_IWUSR, "%s", driver_name);
 }
 
 #if defined(KLD_MODULE) && (__FreeBSD_version >= 503000)
___
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: r213779 - head/sys/dev/sound/pci

2010-10-13 Thread Rui Paulo
Author: rpaulo
Date: Wed Oct 13 14:39:54 2010
New Revision: 213779
URL: http://svn.freebsd.org/changeset/base/213779

Log:
  Fix a brain-o: wrong case statement semantics.
  
  Found with:   clang

Modified:
  head/sys/dev/sound/pci/envy24ht.c
  head/sys/dev/sound/pci/spicds.c

Modified: head/sys/dev/sound/pci/envy24ht.c
==
--- head/sys/dev/sound/pci/envy24ht.c   Wed Oct 13 14:37:52 2010
(r213778)
+++ head/sys/dev/sound/pci/envy24ht.c   Wed Oct 13 14:39:54 2010
(r213779)
@@ -2236,7 +2236,8 @@ envy24ht_putcfg(struct sc_info *sc)
else
printf("not implemented\n");
 switch (sc->adcn) {
-case 0x01 || 0x02:
+case 0x01:
+   case 0x02:
 printf("  ADC #: ");
 printf("%d\n", sc->adcn);
 break;

Modified: head/sys/dev/sound/pci/spicds.c
==
--- head/sys/dev/sound/pci/spicds.c Wed Oct 13 14:37:52 2010
(r213778)
+++ head/sys/dev/sound/pci/spicds.c Wed Oct 13 14:39:54 2010
(r213779)
@@ -283,7 +283,8 @@ spicds_set(struct spicds_info *codec, in
case SPICDS_TYPE_WM8770:
left = left + 27;
break;
-   case SPICDS_TYPE_AK4381 || SPICDS_TYPE_AK4396:
+   case SPICDS_TYPE_AK4381:
+   case SPICDS_TYPE_AK4396:
left = left * 255 / 100;
break;
default:
___
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: r213778 - head/sys/dev/if_ndis

2010-10-13 Thread Rui Paulo
Author: rpaulo
Date: Wed Oct 13 14:37:52 2010
New Revision: 213778
URL: http://svn.freebsd.org/changeset/base/213778

Log:
  WPA_CSE_WEP104 was being incorrectly checked.
  
  Found with:   clang

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

Modified: head/sys/dev/if_ndis/if_ndis.c
==
--- head/sys/dev/if_ndis/if_ndis.c  Wed Oct 13 14:27:47 2010
(r213777)
+++ head/sys/dev/if_ndis/if_ndis.c  Wed Oct 13 14:37:52 2010
(r213778)
@@ -2115,7 +2115,7 @@ ndis_set_cipher(sc, cipher)
 
len = sizeof(arg);
 
-   if (cipher == WPA_CSE_WEP40 || WPA_CSE_WEP104) {
+   if (cipher == WPA_CSE_WEP40 || cipher == WPA_CSE_WEP104) {
if (!(ic->ic_cryptocaps & IEEE80211_CRYPTO_WEP))
return (ENOTSUP);
arg = NDIS_80211_WEPSTAT_ENC1ENABLED;
___
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: r213777 - head/contrib/llvm/tools/clang/lib/Sema

2010-10-13 Thread Roman Divacky
Author: rdivacky
Date: Wed Oct 13 14:27:47 2010
New Revision: 213777
URL: http://svn.freebsd.org/changeset/base/213777

Log:
  Extend this check for const unsigned char *.
  
  Approved by:rpaulo (mentor)

Modified:
  head/contrib/llvm/tools/clang/lib/Sema/SemaChecking.cpp

Modified: head/contrib/llvm/tools/clang/lib/Sema/SemaChecking.cpp
==
--- head/contrib/llvm/tools/clang/lib/Sema/SemaChecking.cpp Wed Oct 13 
14:02:45 2010(r213776)
+++ head/contrib/llvm/tools/clang/lib/Sema/SemaChecking.cpp Wed Oct 13 
14:27:47 2010(r213777)
@@ -1519,10 +1519,14 @@ CheckPrintfHandler::HandlePrintfSpecifie
 // Now type check the data expression that matches the
 // format specifier.
 const Expr *Ex = getDataArg(argIndex);
+QualType Pointee = S.Context.UnsignedCharTy;
+Pointee.addConst();
+QualType constType = (CS.getKind() == ConversionSpecifier::bArg) ? 
S.Context.IntTy : S.Context.getPointerType(Pointee);
 QualType type = (CS.getKind() == ConversionSpecifier::bArg) ? 
S.Context.IntTy : S.Context.getPointerType(S.Context.UnsignedCharTy);
-//const analyze_printf::ArgTypeResult &ATR = S.Context.IntTy;
+const analyze_printf::ArgTypeResult &ConstATR = constType;
 const analyze_printf::ArgTypeResult &ATR = type;
-if (ATR.isValid() && !ATR.matchesType(S.Context, Ex->getType()))
+if (ATR.isValid() && !ATR.matchesType(S.Context, Ex->getType()) &&
+!ConstATR.matchesType(S.Context, Ex->getType()))
   S.Diag(getLocationOfByte(CS.getStart()),
  diag::warn_printf_conversion_argument_type_mismatch)
 << ATR.getRepresentativeType(S.Context) << Ex->getType()
___
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: r213744 - head/bin/sh

2010-10-13 Thread John Baldwin
On Wednesday, October 13, 2010 12:29:27 am Bruce Evans wrote:
> On Tue, 12 Oct 2010, David O'Brien wrote:
> 
> > On Wed, Oct 13, 2010 at 02:18:33PM +1100, Bruce Evans wrote:
> >> On Tue, 12 Oct 2010, David E. O'Brien wrote:
> >>> Log:
> >>>  If DEBUG is 3 or greater, disable STATICization of functions.
> >>>  Also correct the documented location of the trace file.
> >>
> >> Private functions should always be static, which no `#define STATIC 
static'
> > [..]
> >> In theory, the debugging info should make it possible for debuggers
> >> to restore the semantics of not-explictly-inline functions by 
virtualizing
> >> them, but gdb's debugging info and/or gdb are too primitive to do this
> >> (gdb doesn't allow putting a breakpoint at a deleted static function,
> >
> > This is actually what my motivation is -- trying to set breakpoints and
> > finding GDB was unable to.
> >
> >> Of course, debugging and profiling are magic,
> >> but I don't want to have to adorn all functions with STATICs and
> >> __attributes() (and pragmas for othercc...) to recover historical/normal
> >> or variant debugging or profiling of them.
> >
> > I agree, and would not add STATIC's to a program's code that didn't
> > already have them.  But in this case we inherited it from 4.4BSD.
> > I'm just making it actually do something other than being a gratuitous
> > spelling change.
> >
> > I believe I've made things more consistent with r213760.
> 
> Add __noinline or whatever attributes to STATIC (but keep static in
> it) for the DEBUG >= 3 case if you are going that far.  __noinline
> should be a syntax error for variables, so this should also find any
> STATICs still on variables.  The spelling fix of changing STATIC to
> what it actually means
> (ASSORTED_HACKS_FOR_DEBUGGING_BUT_NOW_ONLY_FOR_FUNCTIONS) goes too far
> for me.

To be honest, I think changing STATIC is excessive churn.  The "right" fix
is to use 'make DEBUG_FLAGS="-g -DDEBUG=2 -fno-inline"'.  I often use
'make DEBUG_FLAGS="-g -fno-inline"' to workaround excessive inlining when
debugging.  I think all of the STATIC changes should just be backed out.

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


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

2010-10-13 Thread John Baldwin
On Tuesday, October 12, 2010 5:08:04 pm Gennady Proskurin wrote:
> On Sat, Oct 09, 2010 at 12:48:50PM +0300, Andriy Gapon wrote:
> > on 09/10/2010 12:33 Bruce Evans said the following:
> > > On Sat, 9 Oct 2010, Andriy Gapon wrote:
> > > 
> > >> Log:
> > >>  panic_cpu variable should be volatile
> > >>
> > >>  This is to prevent caching of its value in a register when it is checked
> > >>  and modified by multiple CPUs in parallel.
> > >>  Also, move the variable  into the scope of the only function that uses 
> > >> it.
> > >>
> > >>  Reviewed by:jhb
> > >>  Hint from:mdf
> > >>  MFC after:1 week
> > > 
> > > I doubt that this is either necessary or sufficient.  Most variables
> > > aren't volatile while they are locked by a mutex.  But panic() cannot use
> > > normal mutex locking, so it should access this variable using atomic
> > > ops with memory barriers.  The compiler part of the memory barriers
> > > effectively make _all_ variables temporily volatile.  However, 2 of the
> > > the 4 accesses to this variable doesn't use an atomic op.
> > > 
> > > % #ifdef SMP
> > > % /*
> > > %  * We don't want multiple CPU's to panic at the same time, so we
> > > %  * use panic_cpu as a simple spinlock.  We have to keep checking
> > > %  * panic_cpu if we are spinning in case the panic on the first
> > > %  * CPU is canceled.
> > > %  */
> > > % if (panic_cpu != PCPU_GET(cpuid))
> > > 
> > > This access doesn't use an atomic op.
> > > 
> > > % while (atomic_cmpset_int(&panic_cpu, NOCPU,
> > > % PCPU_GET(cpuid)) == 0)
> > > 
> > > This access uses an atomic op.  Not all atomic ops use memory barriers,
> > > at least on i386.  However, this one does, at least on i386.
> > > 
> > >   (I'm always confused about what atomic_any() without acq or release
> > >   means.  Do they mean that you don't want a memory barrier (this is
> > >   what the mostly give, at least on i386), and if so, what use are
> > >   they?  There are far too many atomic ops, for far too many never-used
> > >   widths, with alternative spellings to encourage using a wrong one.
> > >   cmpset is is especially confusing since it you can spell it as cmpset,
> > >   cmpset_acq or compset_rel and always get the barrier, at least on
> > >   i386.  At least cmpset only supports 1 width, at least on i386.)
> > > 
> > > % while (panic_cpu != NOCPU)
> > > 
> > > This access doesn't use an atomic op.
> > > 
> > > % ; /* nothing */
> > > % #endif
> > > % ...
> > > % #ifdef RESTARTABLE_PANICS
> > > % /* See if the user aborted the panic, in which case we continue. */
> > > % if (panicstr == NULL) {
> > > % #ifdef SMP
> > > % atomic_store_rel_int(&panic_cpu, NOCPU);
> > > 
> > > This access uses an atomic op with a memory barrier, at least on i386.
> > > Now its rel semantics are clear.
> > > 
> > > panicstr is non-volatile and never accessed by an atomic op, so it 
> > > probably
> > > strictly needs to be declared volatile even more than panic_cpu.  I think
> > 
> > I agree about panicstr.
> > But I am not sure if we have places in code (beyond panic function) itself 
> > where
> > volatile vs. non-volatile would make any actual difference.
> > But still.
> > 
> > > the only thing that makes it work now is that it is bogusly pubic, and
> > > compilers can't analyze the whole program yet -- if they could, then they
> > > would see that it is only set in panic().
> > > 
> > > % #endif
> > > % return;
> > > % }
> > > % #endif
> > > % #endif
> > > 
> > > Now, why don't the partial memory barriers prevent caching the variable?
> > > 
> > > % if (panic_cpu != PCPU_GET(cpuid))
> > > % while (atomic_cmpset_int(&panic_cpu, NOCPU,
> > > % PCPU_GET(cpuid)) == 0)
> > > % while (panic_cpu != NOCPU)
> > > % ; /* nothing */
> > > 
> > > The very first access can't reasonably use a cachec value.  
> > > atomic_cmpset()
> > > can change panic_cpu, so even without the memory barrier, panic_cpu must
> > > be reloaded for the third access the first time.  But then when the third
> > > access is repeated in the second while loop, the missing atomic op with
> > > barrier makes things very broken.  panic_cpu isn't changed by the loop,
> > > and the compiler thinks that it isn't changed by anything else either, so
> > > the compiler may reduce the loop to:
> > > 
> > > % if (panic_cpu != NOCPU)
> > > % for (;;)
> > > % ; /* nothing */
> > 
> > 
> > Yes, it's exactly the last loop that had the problem.
> > On amd64 with -O2:
> > .loc 1 544 0
> > movlpanic_cpu(%rip), %eax
> > .LVL134:
> > .p2align 4,,7
> > .L210:
> > cmpl$255, %eax
> > jne .L210
> > jmp .L225
> > 
> > > except I've seen claims that even an endless for loop can be optimized
> > > to nothing.  Declaring panic_cpu as volatile prevents the compiler 

svn commit: r213775 - head/bin/sh

2010-10-13 Thread John Baldwin
Author: jhb
Date: Wed Oct 13 13:22:11 2010
New Revision: 213775
URL: http://svn.freebsd.org/changeset/base/213775

Log:
  Make DEBUG traces 64-bit clean:
  - Use %t to print ptrdiff_t values.
  - Cast a ptrdiff_t value explicitly to int for a field width specifier.
  
  While here, sort includes.
  
  Submitted by: Garrett Cooper

Modified:
  head/bin/sh/expand.c
  head/bin/sh/jobs.c

Modified: head/bin/sh/expand.c
==
--- head/bin/sh/expand.cWed Oct 13 13:17:38 2010(r213774)
+++ head/bin/sh/expand.cWed Oct 13 13:22:11 2010(r213775)
@@ -43,14 +43,15 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
-#include 
-#include 
-#include 
+#include 
+#include 
 #include 
+#include 
 #include 
+#include 
 #include 
+#include 
 
 /*
  * Routines to expand arguments to commands.  We have to deal with
@@ -497,9 +498,9 @@ expbackq(union node *cmd, int quoted, in
exitstatus = waitforjob(in.jp, (int *)NULL);
if (quoted == 0)
recordregion(startloc, dest - stackblock(), 0);
-   TRACE(("evalbackq: size=%d: \"%.*s\"\n",
-   (dest - stackblock()) - startloc,
-   (dest - stackblock()) - startloc,
+   TRACE(("expbackq: size=%td: \"%.*s\"\n",
+   ((dest - stackblock()) - startloc),
+   (int)((dest - stackblock()) - startloc),
stackblock() + startloc));
expdest = dest;
INTON;

Modified: head/bin/sh/jobs.c
==
--- head/bin/sh/jobs.c  Wed Oct 13 13:17:38 2010(r213774)
+++ head/bin/sh/jobs.c  Wed Oct 13 13:22:11 2010(r213775)
@@ -38,18 +38,18 @@ static char sccsid[] = "@(#)jobs.c  8.5 (
 #include 
 __FBSDID("$FreeBSD$");
 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
+#include 
 #include 
-#include 
-#include 
 #include 
+#include 
+#include 
+#include 
+#include 
+#include 
 #include 
-#include 
+#include 
+#include 
+#include 
 
 #include "shell.h"
 #if JOBS
@@ -680,7 +680,7 @@ makejob(union node *node __unused, int n
jp->ps = &jp->ps0;
}
INTON;
-   TRACE(("makejob(%p, %d) returns %%%d\n", (void *)node, nprocs,
+   TRACE(("makejob(%p, %d) returns %%%td\n", (void *)node, nprocs,
jp - jobtab + 1));
return jp;
 }
@@ -766,7 +766,7 @@ forkshell(struct job *jp, union node *n,
pid_t pid;
pid_t pgrp;
 
-   TRACE(("forkshell(%%%d, %p, %d) called\n", jp - jobtab, (void *)n,
+   TRACE(("forkshell(%%%td, %p, %d) called\n", jp - jobtab, (void *)n,
mode));
INTOFF;
if (mode == FORK_BG)
@@ -903,7 +903,7 @@ waitforjob(struct job *jp, int *origstat
int st;
 
INTOFF;
-   TRACE(("waitforjob(%%%d) called\n", jp - jobtab + 1));
+   TRACE(("waitforjob(%%%td) called\n", jp - jobtab + 1));
while (jp->state == 0)
if (dowait(1, jp) == -1)
dotrap();
@@ -1004,7 +1004,7 @@ dowait(int block, struct job *job)
if (stopped) {  /* stopped or done */
int state = done? JOBDONE : JOBSTOPPED;
if (jp->state != state) {
-   TRACE(("Job %d: changing state from %d 
to %d\n", jp - jobtab + 1, jp->state, state));
+   TRACE(("Job %td: changing state from %d 
to %d\n", jp - jobtab + 1, jp->state, state));
jp->state = state;
if (jp != job) {
if (done && !jp->remembered &&
___
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: r213774 - head/bin/sh

2010-10-13 Thread John Baldwin
Author: jhb
Date: Wed Oct 13 13:17:38 2010
New Revision: 213774
URL: http://svn.freebsd.org/changeset/base/213774

Log:
  Suggest that DEBUG_FLAGS be used to enable extra debugging rather than
  frobbing CFLAGS directly.  DEBUG_FLAGS is something that can be specified
  on the make command line without having to edit the Makefile directly.
  
  Submitted by: Garrett Cooper

Modified:
  head/bin/sh/Makefile

Modified: head/bin/sh/Makefile
==
--- head/bin/sh/MakefileWed Oct 13 11:39:36 2010(r213773)
+++ head/bin/sh/MakefileWed Oct 13 13:17:38 2010(r213774)
@@ -21,7 +21,7 @@ LDADD= -ll -ledit -ltermcap
 LFLAGS= -8 # 8-bit lex scanner for arithmetic
 CFLAGS+=-DSHELL -I. -I${.CURDIR}
 # for debug:
-# CFLAGS+= -g -DDEBUG=3
+# DEBUG_FLAGS+= -g -DDEBUG=3
 WARNS?=2
 WFORMAT=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: r213772 - head/sys/dev/acpica/Osd

2010-10-13 Thread John Baldwin
On Wednesday, October 13, 2010 7:38:25 am Rui Paulo wrote:
> Author: rpaulo
> Date: Wed Oct 13 11:38:24 2010
> New Revision: 213772
> URL: http://svn.freebsd.org/changeset/base/213772
> 
> Log:
>   Mark acpi_bus_number() as __unused. This allows clang to this file
>   without any warnings.

Actually, I think this should have been removed when AcpiOsDerivePciId() was
removed during the update to ACPICA 20100915.

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


Re: svn commit: r213769 - head/sys/geom/part

2010-10-13 Thread Stefan Farfeleder
On Wed, Oct 13, 2010 at 11:35:59AM +, Rui Paulo wrote:
> Author: rpaulo
> Date: Wed Oct 13 11:35:59 2010
> New Revision: 213769
> URL: http://svn.freebsd.org/changeset/base/213769
> 
> Log:
>   The canonical way to print __func__ when using KASSERT() is to write
>   ("%s", __func__). This avoids clang's -Wformat-string warnings.
> 

That's a stupid warning, clang should know the value of __func__.

Stefan
___
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: r213772 - head/sys/dev/acpica/Osd

2010-10-13 Thread Rui Paulo
Author: rpaulo
Date: Wed Oct 13 11:38:24 2010
New Revision: 213772
URL: http://svn.freebsd.org/changeset/base/213772

Log:
  Mark acpi_bus_number() as __unused. This allows clang to this file
  without any warnings.

Modified:
  head/sys/dev/acpica/Osd/OsdHardware.c

Modified: head/sys/dev/acpica/Osd/OsdHardware.c
==
--- head/sys/dev/acpica/Osd/OsdHardware.c   Wed Oct 13 11:37:39 2010
(r213771)
+++ head/sys/dev/acpica/Osd/OsdHardware.c   Wed Oct 13 11:38:24 2010
(r213772)
@@ -126,7 +126,7 @@ AcpiOsWritePciConfiguration (ACPI_PCI_ID
 /*
  * Depth-first recursive case for finding the bus, given the slot/function.
  */
-static int
+static int __unused
 acpi_bus_number(ACPI_HANDLE root, ACPI_HANDLE curr, ACPI_PCI_ID *PciId)
 {
 ACPI_HANDLE parent;
___
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: r213771 - head/sys/fs/msdosfs

2010-10-13 Thread Rui Paulo
Author: rpaulo
Date: Wed Oct 13 11:37:39 2010
New Revision: 213771
URL: http://svn.freebsd.org/changeset/base/213771

Log:
  Ignore the return value of DE_INTERNALIZE().

Modified:
  head/sys/fs/msdosfs/msdosfs_denode.c

Modified: head/sys/fs/msdosfs/msdosfs_denode.c
==
--- head/sys/fs/msdosfs/msdosfs_denode.cWed Oct 13 11:37:12 2010
(r213770)
+++ head/sys/fs/msdosfs/msdosfs_denode.cWed Oct 13 11:37:39 2010
(r213771)
@@ -240,7 +240,7 @@ deget(pmp, dirclust, diroffset, depp)
*depp = NULL;
return (error);
}
-   DE_INTERNALIZE(ldep, direntptr);
+   (void)DE_INTERNALIZE(ldep, direntptr);
brelse(bp);
}
 
___
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: r213770 - in head/sys/dev: kbd kbdmux syscons

2010-10-13 Thread Rui Paulo
Author: rpaulo
Date: Wed Oct 13 11:37:12 2010
New Revision: 213770
URL: http://svn.freebsd.org/changeset/base/213770

Log:
  Explicitly tell the compiler that we don't care about the return value
  of kbdd_ioctl().

Modified:
  head/sys/dev/kbd/kbd.c
  head/sys/dev/kbdmux/kbdmux.c
  head/sys/dev/syscons/syscons.c

Modified: head/sys/dev/kbd/kbd.c
==
--- head/sys/dev/kbd/kbd.c  Wed Oct 13 11:35:59 2010(r213769)
+++ head/sys/dev/kbd/kbd.c  Wed Oct 13 11:37:12 2010(r213770)
@@ -224,7 +224,7 @@ kbd_register(keyboard_t *kbd)
strcpy(ki.kb_name, kbd->kb_name);
ki.kb_unit = kbd->kb_unit;
 
-   kbdd_ioctl(mux, KBADDKBD, (caddr_t) &ki);
+   (void)kbdd_ioctl(mux, KBADDKBD, (caddr_t) &ki);
}
 
return (index);
@@ -241,7 +241,7 @@ kbd_register(keyboard_t *kbd)
strcpy(ki.kb_name, kbd->kb_name);
ki.kb_unit = kbd->kb_unit;
 
-   kbdd_ioctl(mux, KBADDKBD, (caddr_t) &ki);
+   (void)kbdd_ioctl(mux, KBADDKBD, (caddr_t) &ki);
}
 
return (index);
@@ -1148,7 +1148,7 @@ genkbd_diag(keyboard_t *kbd, int level)
(s) |= l ## DOWN;   \
(s) ^= l ## ED; \
i = (s) & LOCK_MASK;\
-   kbdd_ioctl((k), KDSETLED, (caddr_t)&i); \
+   (void)kbdd_ioctl((k), KDSETLED, (caddr_t)&i);   \
}
 
 static u_int
@@ -1308,7 +1308,7 @@ genkbd_keyaction(keyboard_t *kbd, int ke
 #else
state &= ~CLKED;
i = state & LOCK_MASK;
-   kbdd_ioctl(kbd, KDSETLED, (caddr_t)&i);
+   (void)kbdd_ioctl(kbd, KDSETLED, (caddr_t)&i);
 #endif
break;
case SLK:
@@ -1344,7 +1344,7 @@ genkbd_keyaction(keyboard_t *kbd, int ke
 #else
state |= CLKED;
i = state & LOCK_MASK;
-   kbdd_ioctl(kbd, KDSETLED, (caddr_t)&i);
+   (void)kbdd_ioctl(kbd, KDSETLED, (caddr_t)&i);
 #endif
break;
case SLK:

Modified: head/sys/dev/kbdmux/kbdmux.c
==
--- head/sys/dev/kbdmux/kbdmux.cWed Oct 13 11:35:59 2010
(r213769)
+++ head/sys/dev/kbdmux/kbdmux.cWed Oct 13 11:37:12 2010
(r213770)
@@ -1115,7 +1115,7 @@ kbdmux_ioctl(keyboard_t *kbd, u_long cmd
 
/* KDSETLED on all slave keyboards */
SLIST_FOREACH(k, &state->ks_kbds, next)
-   kbdd_ioctl(k->kbd, KDSETLED, arg);
+   (void)kbdd_ioctl(k->kbd, KDSETLED, arg);
 
KBDMUX_UNLOCK(state);
break;
@@ -1146,7 +1146,7 @@ kbdmux_ioctl(keyboard_t *kbd, u_long cmd
 
/* KDSKBSTATE on all slave keyboards */
SLIST_FOREACH(k, &state->ks_kbds, next)
-   kbdd_ioctl(k->kbd, KDSKBSTATE, arg);
+   (void)kbdd_ioctl(k->kbd, KDSKBSTATE, arg);
 
KBDMUX_UNLOCK(state);
 
@@ -1192,7 +1192,7 @@ kbdmux_ioctl(keyboard_t *kbd, u_long cmd
 
/* perform command on all slave keyboards */
SLIST_FOREACH(k, &state->ks_kbds, next)
-   kbdd_ioctl(k->kbd, cmd, arg);
+   (void)kbdd_ioctl(k->kbd, cmd, arg);
 
KBDMUX_UNLOCK(state);
break;
@@ -1205,7 +1205,7 @@ kbdmux_ioctl(keyboard_t *kbd, u_long cmd
 
/* perform command on all slave keyboards */
SLIST_FOREACH(k, &state->ks_kbds, next)
-   kbdd_ioctl(k->kbd, cmd, arg);
+   (void)kbdd_ioctl(k->kbd, cmd, arg);
 
KBDMUX_UNLOCK(state);
 /* FALLTHROUGH */

Modified: head/sys/dev/syscons/syscons.c
==
--- head/sys/dev/syscons/syscons.c  Wed Oct 13 11:35:59 2010
(r213769)
+++ head/sys/dev/syscons/syscons.c  Wed Oct 13 11:37:12 2010
(r213770)
@@ -475,7 +475,7 @@ sc_attach_unit(int unit, int flags)
 scrn_timer(sc);
 
 /* set up the keyboard */
-kbdd_ioctl(sc->kbd, KDSKBMODE, (caddr_t)&scp->kbd_mode);
+(void)kbdd_ioctl(sc->kbd, KDSKBMODE, (caddr_t)&scp->kbd_mode);
 update_kbd_state(scp, scp->status, LOCK_MASK);
 
 printf("%s%d: %s <%d virtual consoles, flags=0x%x>\n",
@@ -584,7 +584,7 @@ sctty_open(struct tty *tp)
 #ifndef __sparc64__
if (s

svn commit: r213769 - head/sys/geom/part

2010-10-13 Thread Rui Paulo
Author: rpaulo
Date: Wed Oct 13 11:35:59 2010
New Revision: 213769
URL: http://svn.freebsd.org/changeset/base/213769

Log:
  The canonical way to print __func__ when using KASSERT() is to write
  ("%s", __func__). This avoids clang's -Wformat-string warnings.

Modified:
  head/sys/geom/part/g_part.c
  head/sys/geom/part/g_part_ebr.c
  head/sys/geom/part/g_part_mbr.c

Modified: head/sys/geom/part/g_part.c
==
--- head/sys/geom/part/g_part.c Wed Oct 13 11:23:27 2010(r213768)
+++ head/sys/geom/part/g_part.c Wed Oct 13 11:35:59 2010(r213769)
@@ -1597,7 +1597,8 @@ g_part_ctlreq(struct gctl_req *req, stru
(gpp.gpp_parms & G_PART_PARM_FLAGS) &&
strchr(gpp.gpp_flags, 'C') != NULL) ? 1 : 0;
if (auto_commit) {
-   KASSERT(gpp.gpp_parms & G_PART_PARM_GEOM, (__func__));
+   KASSERT(gpp.gpp_parms & G_PART_PARM_GEOM, ("%s",
+   __func__));
error = g_part_ctl_commit(req, &gpp);
}
}
@@ -1737,11 +1738,11 @@ g_part_dumpconf(struct sbuf *sb, const c
struct g_part_entry *entry;
struct g_part_table *table;
 
-   KASSERT(sb != NULL && gp != NULL, (__func__));
+   KASSERT(sb != NULL && gp != NULL, ("%s", __func__));
table = gp->softc;
 
if (indent == NULL) {
-   KASSERT(cp == NULL && pp != NULL, (__func__));
+   KASSERT(cp == NULL && pp != NULL, ("%s", __func__));
entry = pp->private;
if (entry == NULL)
return;
@@ -1756,7 +1757,7 @@ g_part_dumpconf(struct sbuf *sb, const c
 */
G_PART_DUMPCONF(table, entry, sb, indent);
} else if (cp != NULL) {/* Consumer configuration. */
-   KASSERT(pp == NULL, (__func__));
+   KASSERT(pp == NULL, ("%s", __func__));
/* none */
} else if (pp != NULL) {/* Provider configuration. */
entry = pp->private;
@@ -1799,11 +1800,11 @@ g_part_orphan(struct g_consumer *cp)
struct g_part_table *table;
 
pp = cp->provider;
-   KASSERT(pp != NULL, (__func__));
+   KASSERT(pp != NULL, ("%s", __func__));
G_PART_TRACE((G_T_TOPOLOGY, "%s(%s)", __func__, pp->name));
g_topology_assert();
 
-   KASSERT(pp->error != 0, (__func__));
+   KASSERT(pp->error != 0, ("%s", __func__));
table = cp->geom->softc;
if (table != NULL && table->gpt_opened)
g_access(cp, -1, -1, -1);

Modified: head/sys/geom/part/g_part_ebr.c
==
--- head/sys/geom/part/g_part_ebr.c Wed Oct 13 11:23:27 2010
(r213768)
+++ head/sys/geom/part/g_part_ebr.c Wed Oct 13 11:35:59 2010
(r213769)
@@ -221,8 +221,8 @@ g_part_ebr_add(struct g_part_table *base
if (baseentry->gpe_deleted)
bzero(&entry->ent, sizeof(entry->ent));
 
-   KASSERT(baseentry->gpe_start <= start, (__func__));
-   KASSERT(baseentry->gpe_end >= start + size - 1, (__func__));
+   KASSERT(baseentry->gpe_start <= start, ("%s", __func__));
+   KASSERT(baseentry->gpe_end >= start + size - 1, ("%s", __func__));
baseentry->gpe_index = (start / sectors) + 1;
baseentry->gpe_offset = (off_t)(start + sectors) * pp->sectorsize;
baseentry->gpe_start = start;

Modified: head/sys/geom/part/g_part_mbr.c
==
--- head/sys/geom/part/g_part_mbr.c Wed Oct 13 11:23:27 2010
(r213768)
+++ head/sys/geom/part/g_part_mbr.c Wed Oct 13 11:35:59 2010
(r213769)
@@ -204,8 +204,8 @@ g_part_mbr_add(struct g_part_table *base
if (baseentry->gpe_deleted)
bzero(&entry->ent, sizeof(entry->ent));
 
-   KASSERT(baseentry->gpe_start <= start, (__func__));
-   KASSERT(baseentry->gpe_end >= start + size - 1, (__func__));
+   KASSERT(baseentry->gpe_start <= start, ("%s", __func__));
+   KASSERT(baseentry->gpe_end >= start + size - 1, ("%s", __func__));
baseentry->gpe_start = start;
baseentry->gpe_end = start + size - 1;
entry->ent.dp_start = start;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r213766 - head/sys/netinet6

2010-10-13 Thread Rui Paulo
Author: rpaulo
Date: Wed Oct 13 10:45:22 2010
New Revision: 213766
URL: http://svn.freebsd.org/changeset/base/213766

Log:
  Purposely tell the compiler that we ignore the return value of ADDCARRY()
  in the REDUCE macro.
  
  Reviewed by:  dim, rdivacky

Modified:
  head/sys/netinet6/in6_cksum.c

Modified: head/sys/netinet6/in6_cksum.c
==
--- head/sys/netinet6/in6_cksum.c   Wed Oct 13 10:33:01 2010
(r213765)
+++ head/sys/netinet6/in6_cksum.c   Wed Oct 13 10:45:22 2010
(r213766)
@@ -78,7 +78,7 @@ __FBSDID("$FreeBSD$");
  */
 
 #define ADDCARRY(x)  (x > 65535 ? x -= 65535 : x)
-#define REDUCE {l_util.l = sum; sum = l_util.s[0] + l_util.s[1]; 
ADDCARRY(sum);}
+#define REDUCE {l_util.l = sum; sum = l_util.s[0] + l_util.s[1]; 
(void)ADDCARRY(sum);}
 
 /*
  * m MUST contain a continuous IP6 header.
___
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: r213648 - head/sys/kern

2010-10-13 Thread Gennady Proskurin
On Sat, Oct 09, 2010 at 12:48:50PM +0300, Andriy Gapon wrote:
> on 09/10/2010 12:33 Bruce Evans said the following:
> > On Sat, 9 Oct 2010, Andriy Gapon wrote:
> > 
> >> Log:
> >>  panic_cpu variable should be volatile
> >>
> >>  This is to prevent caching of its value in a register when it is checked
> >>  and modified by multiple CPUs in parallel.
> >>  Also, move the variable  into the scope of the only function that uses it.
> >>
> >>  Reviewed by:jhb
> >>  Hint from:mdf
> >>  MFC after:1 week
> > 
> > I doubt that this is either necessary or sufficient.  Most variables
> > aren't volatile while they are locked by a mutex.  But panic() cannot use
> > normal mutex locking, so it should access this variable using atomic
> > ops with memory barriers.  The compiler part of the memory barriers
> > effectively make _all_ variables temporily volatile.  However, 2 of the
> > the 4 accesses to this variable doesn't use an atomic op.
> > 
> > % #ifdef SMP
> > % /*
> > %  * We don't want multiple CPU's to panic at the same time, so we
> > %  * use panic_cpu as a simple spinlock.  We have to keep checking
> > %  * panic_cpu if we are spinning in case the panic on the first
> > %  * CPU is canceled.
> > %  */
> > % if (panic_cpu != PCPU_GET(cpuid))
> > 
> > This access doesn't use an atomic op.
> > 
> > % while (atomic_cmpset_int(&panic_cpu, NOCPU,
> > % PCPU_GET(cpuid)) == 0)
> > 
> > This access uses an atomic op.  Not all atomic ops use memory barriers,
> > at least on i386.  However, this one does, at least on i386.
> > 
> >   (I'm always confused about what atomic_any() without acq or release
> >   means.  Do they mean that you don't want a memory barrier (this is
> >   what the mostly give, at least on i386), and if so, what use are
> >   they?  There are far too many atomic ops, for far too many never-used
> >   widths, with alternative spellings to encourage using a wrong one.
> >   cmpset is is especially confusing since it you can spell it as cmpset,
> >   cmpset_acq or compset_rel and always get the barrier, at least on
> >   i386.  At least cmpset only supports 1 width, at least on i386.)
> > 
> > % while (panic_cpu != NOCPU)
> > 
> > This access doesn't use an atomic op.
> > 
> > % ; /* nothing */
> > % #endif
> > % ...
> > % #ifdef RESTARTABLE_PANICS
> > % /* See if the user aborted the panic, in which case we continue. */
> > % if (panicstr == NULL) {
> > % #ifdef SMP
> > % atomic_store_rel_int(&panic_cpu, NOCPU);
> > 
> > This access uses an atomic op with a memory barrier, at least on i386.
> > Now its rel semantics are clear.
> > 
> > panicstr is non-volatile and never accessed by an atomic op, so it probably
> > strictly needs to be declared volatile even more than panic_cpu.  I think
> 
> I agree about panicstr.
> But I am not sure if we have places in code (beyond panic function) itself 
> where
> volatile vs. non-volatile would make any actual difference.
> But still.
> 
> > the only thing that makes it work now is that it is bogusly pubic, and
> > compilers can't analyze the whole program yet -- if they could, then they
> > would see that it is only set in panic().
> > 
> > % #endif
> > % return;
> > % }
> > % #endif
> > % #endif
> > 
> > Now, why don't the partial memory barriers prevent caching the variable?
> > 
> > % if (panic_cpu != PCPU_GET(cpuid))
> > % while (atomic_cmpset_int(&panic_cpu, NOCPU,
> > % PCPU_GET(cpuid)) == 0)
> > % while (panic_cpu != NOCPU)
> > % ; /* nothing */
> > 
> > The very first access can't reasonably use a cachec value.  atomic_cmpset()
> > can change panic_cpu, so even without the memory barrier, panic_cpu must
> > be reloaded for the third access the first time.  But then when the third
> > access is repeated in the second while loop, the missing atomic op with
> > barrier makes things very broken.  panic_cpu isn't changed by the loop,
> > and the compiler thinks that it isn't changed by anything else either, so
> > the compiler may reduce the loop to:
> > 
> > % if (panic_cpu != NOCPU)
> > % for (;;)
> > % ; /* nothing */
> 
> 
> Yes, it's exactly the last loop that had the problem.
> On amd64 with -O2:
> .loc 1 544 0
> movlpanic_cpu(%rip), %eax
> .LVL134:
> .p2align 4,,7
> .L210:
> cmpl$255, %eax
> jne .L210
> jmp .L225
> 
> > except I've seen claims that even an endless for loop can be optimized
> > to nothing.  Declaring panic_cpu as volatile prevents the compiler doing
> > this, but I think it is insufficient.  We really do want to see panic_cpu
> > changed by other CPUs, and what is the point of atomic_load_acq*() if not
> > to use for this -- if declaring things volatile were sufficient, then we
> > could just use *(volatile *)&var.  atomic_load/store_acq/rel*() on i386
> 
> I

svn commit: r213765 - head/sys/dev/aic7xxx/aicasm

2010-10-13 Thread Rui Paulo
Author: rpaulo
Date: Wed Oct 13 10:33:01 2010
New Revision: 213765
URL: http://svn.freebsd.org/changeset/base/213765

Log:
  Define YY_NO_INPUT. This makes aicasm buildable by clang with Werror
  turned on.

Modified:
  head/sys/dev/aic7xxx/aicasm/aicasm_macro_scan.l
  head/sys/dev/aic7xxx/aicasm/aicasm_scan.l

Modified: head/sys/dev/aic7xxx/aicasm/aicasm_macro_scan.l
==
--- head/sys/dev/aic7xxx/aicasm/aicasm_macro_scan.l Wed Oct 13 10:31:32 
2010(r213764)
+++ head/sys/dev/aic7xxx/aicasm/aicasm_macro_scan.l Wed Oct 13 10:33:01 
2010(r213765)
@@ -61,6 +61,7 @@
 #include "aicasm_symbol.h"
 #include "aicasm_macro_gram.h"
 
+#define YY_NO_INPUT
 #define MAX_STR_CONST 4096
 static char string_buf[MAX_STR_CONST];
 static char *string_buf_ptr;

Modified: head/sys/dev/aic7xxx/aicasm/aicasm_scan.l
==
--- head/sys/dev/aic7xxx/aicasm/aicasm_scan.l   Wed Oct 13 10:31:32 2010
(r213764)
+++ head/sys/dev/aic7xxx/aicasm/aicasm_scan.l   Wed Oct 13 10:33:01 2010
(r213765)
@@ -61,6 +61,7 @@
 #include "aicasm_symbol.h"
 #include "aicasm_gram.h"
 
+#define YY_NO_INPUT
 /* This is used for macro body capture too, so err on the large size. */
 #define MAX_STR_CONST 4096
 static char string_buf[MAX_STR_CONST];
___
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: r213764 - head/usr.bin/lex

2010-10-13 Thread Rui Paulo
Author: rpaulo
Date: Wed Oct 13 10:31:32 2010
New Revision: 213764
URL: http://svn.freebsd.org/changeset/base/213764

Log:
  Don't define the input() function ifdef YY_NO_INPUT.
  
  This was previously done for the input() function.
  
  Submitted by: Norberto Lopes 

Modified:
  head/usr.bin/lex/flex.skl

Modified: head/usr.bin/lex/flex.skl
==
--- head/usr.bin/lex/flex.skl   Wed Oct 13 09:33:26 2010(r213763)
+++ head/usr.bin/lex/flex.skl   Wed Oct 13 10:31:32 2010(r213764)
@@ -979,6 +979,7 @@ void yyFlexLexer::yyunput( int c, char* 
 
 
 %-
+#ifndef YY_NO_INPUT
 #ifdef __cplusplus
 static int yyinput()
 #else
@@ -1054,6 +1055,7 @@ int yyFlexLexer::yyinput()
 
return c;
}
+#endif /* ifndef YY_NO_INPUT */
 
 
 %-
___
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: r213763 - head/usr.sbin/sysinstall

2010-10-13 Thread Bruce Cran
Author: brucec
Date: Wed Oct 13 09:33:26 2010
New Revision: 213763
URL: http://svn.freebsd.org/changeset/base/213763

Log:
  Use the RFC2606 domain example.com in examples.

Modified:
  head/usr.sbin/sysinstall/tcpip.c

Modified: head/usr.sbin/sysinstall/tcpip.c
==
--- head/usr.sbin/sysinstall/tcpip.cWed Oct 13 09:17:44 2010
(r213762)
+++ head/usr.sbin/sysinstall/tcpip.cWed Oct 13 09:33:26 2010
(r213763)
@@ -72,12 +72,12 @@ static char ipv6addr[INET6_ADDRSTRLEN];
 static Layout layout[] = {
 #define LAYOUT_HOSTNAME0
 { 1, 2, 25, HOSTNAME_FIELD_LEN - 1,
-  "Host:", "Your fully-qualified hostname, e.g. foo.bar.com",
+  "Host:", "Your fully-qualified hostname, e.g. foo.example.com",
   hostname, STRINGOBJ, NULL },
 #define LAYOUT_DOMAINNAME  1
 { 1, 35, 20, HOSTNAME_FIELD_LEN - 1,
   "Domain:",
-  "The name of the domain that your machine is in, e.g. bar.com",
+  "The name of the domain that your machine is in, e.g. example.com",
   domainname, STRINGOBJ, NULL },
 #define LAYOUT_GATEWAY 2
 { 5, 2, 18, IPADDR_FIELD_LEN - 1,
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r213762 - in head/sys/mips: cavium cavium/octe conf

2010-10-13 Thread Juli Mallett
Author: jmallett
Date: Wed Oct 13 09:17:44 2010
New Revision: 213762
URL: http://svn.freebsd.org/changeset/base/213762

Log:
  o) Make it possible to attach a PHY directly to an octe device rather than
 using miibus, since for some devices that use multiple addresses on the 
bus,
 going through miibus may be unclear, and for devices that are not standard
 MII PHYs, miibus may throw a fit, necessitating complicated interfaces to
 fake the interface that it expects during probe/attach.
  o) Make the mv88e61xx SMI interface in octe attach a PHY directly and fix some
 mistakes in the code that resulted from trying too hard to present a nice
 interface to miibus.
  o) Add a PHY driver for the mv88e61xx.  If attached (it is optional in kernel
 compiles so the default behavior of having a dumb switch is preserved) it
 will place the switch in a VLAN-tagging mode such that each physical port
 has a VLAN associated with it and interfaces for the VLANs can be created 
to
 address or bridge between them.
 XXX It would be nice for this to be part of a single module including the
 SMI interface, and for it to fit into a generic switch configuration
 framework and for it to use DSA rather than VLANs, but this is a start
 and gives some sense of the parameters of such frameworks that are not
 currently present in FreeBSD.  In lieu of a switch configuration
 interface, per-port media status and VLAN settings are in a sysctl 
tree.
 XXX There may be some minor nits remaining in the handling of broadcast,
 multicast and unknown destination traffic.  It would also be nice to go
 through and replace the few remaining magic numbers with macros at some
 point in the future.
 XXX This has only been tested with the MV88E6161, but it should work with
 minimal or no modification on related switches, so support for probing
 them was included.
  
  Thanks to Pat Saavedra of TELoIP and Rafal Jaworowski of Semihalf for their
  assistance in understanding the switch chipset.

Added:
  head/sys/mips/cavium/octe/mv88e61xxphy.c   (contents, props changed)
  head/sys/mips/cavium/octe/mv88e61xxphyreg.h   (contents, props changed)
Modified:
  head/sys/mips/cavium/files.octeon1
  head/sys/mips/cavium/octe/cavium-ethernet.h
  head/sys/mips/cavium/octe/ethernet-mdio.c
  head/sys/mips/cavium/octe/ethernet-mv88e61xx.c
  head/sys/mips/cavium/octe/octe.c
  head/sys/mips/conf/OCTEON1

Modified: head/sys/mips/cavium/files.octeon1
==
--- head/sys/mips/cavium/files.octeon1  Wed Oct 13 06:28:40 2010
(r213761)
+++ head/sys/mips/cavium/files.octeon1  Wed Oct 13 09:17:44 2010
(r213762)
@@ -31,6 +31,7 @@ mips/cavium/octe/ethernet-sgmii.c optio
 mips/cavium/octe/ethernet-spi.coptional octe
 mips/cavium/octe/ethernet-tx.c optional octe
 mips/cavium/octe/ethernet-xaui.c   optional octe
+mips/cavium/octe/mv88e61xxphy.coptional octe 
mv88e61xxphy
 mips/cavium/octe/octe.coptional octe
 mips/cavium/octe/octebus.c optional octe
 

Modified: head/sys/mips/cavium/octe/cavium-ethernet.h
==
--- head/sys/mips/cavium/octe/cavium-ethernet.h Wed Oct 13 06:28:40 2010
(r213761)
+++ head/sys/mips/cavium/octe/cavium-ethernet.h Wed Oct 13 09:17:44 2010
(r213762)
@@ -72,6 +72,7 @@ typedef struct {
 
uint8_t mac[6];
int phy_id;
+   const char *phy_device;
int (*mdio_read)(struct ifnet *, int, int);
void (*mdio_write)(struct ifnet *, int, int, int);
 

Modified: head/sys/mips/cavium/octe/ethernet-mdio.c
==
--- head/sys/mips/cavium/octe/ethernet-mdio.c   Wed Oct 13 06:28:40 2010
(r213761)
+++ head/sys/mips/cavium/octe/ethernet-mdio.c   Wed Oct 13 09:17:44 2010
(r213762)
@@ -132,6 +132,7 @@ int cvm_oct_mdio_setup_device(struct ifn
cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
 
priv->phy_id = cvmx_helper_board_get_mii_address(priv->port);
+   priv->phy_device = NULL;
priv->mdio_read = NULL;
priv->mdio_write = NULL;
 

Modified: head/sys/mips/cavium/octe/ethernet-mv88e61xx.c
==
--- head/sys/mips/cavium/octe/ethernet-mv88e61xx.c  Wed Oct 13 06:28:40 
2010(r213761)
+++ head/sys/mips/cavium/octe/ethernet-mv88e61xx.c  Wed Oct 13 09:17:44 
2010(r213762)
@@ -49,8 +49,6 @@ __FBSDID("$FreeBSD$");
 #include "wrapper-cvmx-includes.h"
 #include "ethernet-headers.h"
 
-#defineMV88E61XX_SMI_PHY_SW0x10/* Switch PHY.  */
-
 #defineMV88E61XX_SMI_REG_CMD