svn commit: r222911 - in projects/largeSMP: bin/sh contrib/less
contrib/top games/fortune/datfiles lib/libstand share/mk
sys/conf sys/dev/ata tools/regression/bin/sh/execution
tools/tools tools/too...
Attilio Rao
attilio at FreeBSD.org
Fri Jun 10 02:40:03 UTC 2011
Author: attilio
Date: Fri Jun 10 02:40:01 2011
New Revision: 222911
URL: http://svn.freebsd.org/changeset/base/222911
Log:
MFC
Added:
projects/largeSMP/tools/regression/bin/sh/execution/set-x3.0
- copied unchanged from r222910, head/tools/regression/bin/sh/execution/set-x3.0
projects/largeSMP/tools/tools/cxgbetool/
- copied from r222910, head/tools/tools/cxgbetool/
Modified:
projects/largeSMP/bin/sh/eval.c
projects/largeSMP/bin/sh/expand.c
projects/largeSMP/bin/sh/parser.c
projects/largeSMP/bin/sh/parser.h
projects/largeSMP/bin/sh/sh.1
projects/largeSMP/contrib/less/NEWS
projects/largeSMP/contrib/less/README
projects/largeSMP/contrib/less/command.c
projects/largeSMP/contrib/less/funcs.h
projects/largeSMP/contrib/less/less.man
projects/largeSMP/contrib/less/less.nro
projects/largeSMP/contrib/less/lessecho.man
projects/largeSMP/contrib/less/lessecho.nro
projects/largeSMP/contrib/less/lesskey.man
projects/largeSMP/contrib/less/lesskey.nro
projects/largeSMP/contrib/less/optfunc.c
projects/largeSMP/contrib/less/opttbl.c
projects/largeSMP/contrib/less/version.c
projects/largeSMP/games/fortune/datfiles/fortunes
projects/largeSMP/lib/libstand/bswap.c
projects/largeSMP/sys/conf/Makefile.powerpc
projects/largeSMP/sys/dev/ata/ata-sata.c
projects/largeSMP/tools/tools/README
projects/largeSMP/usr.sbin/mfiutil/mfi_config.c
projects/largeSMP/usr.sbin/mfiutil/mfi_drive.c
projects/largeSMP/usr.sbin/mfiutil/mfi_evt.c
projects/largeSMP/usr.sbin/mfiutil/mfi_flash.c
projects/largeSMP/usr.sbin/mfiutil/mfi_patrol.c
projects/largeSMP/usr.sbin/mfiutil/mfi_show.c
projects/largeSMP/usr.sbin/mfiutil/mfi_volume.c
Directory Properties:
projects/largeSMP/ (props changed)
projects/largeSMP/cddl/contrib/opensolaris/ (props changed)
projects/largeSMP/contrib/bind9/ (props changed)
projects/largeSMP/contrib/binutils/ (props changed)
projects/largeSMP/contrib/bzip2/ (props changed)
projects/largeSMP/contrib/compiler-rt/ (props changed)
projects/largeSMP/contrib/dialog/ (props changed)
projects/largeSMP/contrib/ee/ (props changed)
projects/largeSMP/contrib/expat/ (props changed)
projects/largeSMP/contrib/file/ (props changed)
projects/largeSMP/contrib/gcc/ (props changed)
projects/largeSMP/contrib/gdb/ (props changed)
projects/largeSMP/contrib/gdtoa/ (props changed)
projects/largeSMP/contrib/gnu-sort/ (props changed)
projects/largeSMP/contrib/groff/ (props changed)
projects/largeSMP/contrib/less/ (props changed)
projects/largeSMP/contrib/libpcap/ (props changed)
projects/largeSMP/contrib/libstdc++/ (props changed)
projects/largeSMP/contrib/llvm/ (props changed)
projects/largeSMP/contrib/llvm/tools/clang/ (props changed)
projects/largeSMP/contrib/ncurses/ (props changed)
projects/largeSMP/contrib/netcat/ (props changed)
projects/largeSMP/contrib/ntp/ (props changed)
projects/largeSMP/contrib/one-true-awk/ (props changed)
projects/largeSMP/contrib/openbsm/ (props changed)
projects/largeSMP/contrib/openpam/ (props changed)
projects/largeSMP/contrib/pf/ (props changed)
projects/largeSMP/contrib/sendmail/ (props changed)
projects/largeSMP/contrib/tcpdump/ (props changed)
projects/largeSMP/contrib/tcsh/ (props changed)
projects/largeSMP/contrib/top/ (props changed)
projects/largeSMP/contrib/top/install-sh (props changed)
projects/largeSMP/contrib/tzcode/stdtime/ (props changed)
projects/largeSMP/contrib/tzcode/zic/ (props changed)
projects/largeSMP/contrib/tzdata/ (props changed)
projects/largeSMP/contrib/wpa/ (props changed)
projects/largeSMP/contrib/xz/ (props changed)
projects/largeSMP/crypto/openssh/ (props changed)
projects/largeSMP/crypto/openssl/ (props changed)
projects/largeSMP/gnu/lib/ (props changed)
projects/largeSMP/gnu/usr.bin/binutils/ (props changed)
projects/largeSMP/gnu/usr.bin/cc/cc_tools/ (props changed)
projects/largeSMP/gnu/usr.bin/gdb/ (props changed)
projects/largeSMP/lib/libc/ (props changed)
projects/largeSMP/lib/libc/stdtime/ (props changed)
projects/largeSMP/lib/libutil/ (props changed)
projects/largeSMP/lib/libz/ (props changed)
projects/largeSMP/sbin/ (props changed)
projects/largeSMP/sbin/ipfw/ (props changed)
projects/largeSMP/share/mk/bsd.arch.inc.mk (props changed)
projects/largeSMP/share/zoneinfo/ (props changed)
projects/largeSMP/sys/ (props changed)
projects/largeSMP/sys/amd64/include/xen/ (props changed)
projects/largeSMP/sys/boot/ (props changed)
projects/largeSMP/sys/boot/i386/efi/ (props changed)
projects/largeSMP/sys/boot/ia64/efi/ (props changed)
projects/largeSMP/sys/boot/ia64/ski/ (props changed)
projects/largeSMP/sys/boot/powerpc/boot1.chrp/ (props changed)
projects/largeSMP/sys/boot/powerpc/ofw/ (props changed)
projects/largeSMP/sys/cddl/contrib/opensolaris/ (props changed)
projects/largeSMP/sys/conf/ (props changed)
projects/largeSMP/sys/contrib/dev/acpica/ (props changed)
projects/largeSMP/sys/contrib/octeon-sdk/ (props changed)
projects/largeSMP/sys/contrib/pf/ (props changed)
projects/largeSMP/sys/contrib/x86emu/ (props changed)
projects/largeSMP/usr.bin/calendar/ (props changed)
projects/largeSMP/usr.bin/csup/ (props changed)
projects/largeSMP/usr.bin/procstat/ (props changed)
projects/largeSMP/usr.sbin/ndiscvt/ (props changed)
projects/largeSMP/usr.sbin/zic/ (props changed)
Modified: projects/largeSMP/bin/sh/eval.c
==============================================================================
--- projects/largeSMP/bin/sh/eval.c Fri Jun 10 02:07:21 2011 (r222910)
+++ projects/largeSMP/bin/sh/eval.c Fri Jun 10 02:40:01 2011 (r222911)
@@ -745,8 +745,9 @@ evalcommand(union node *cmd, int flags,
/* Print the command if xflag is set. */
if (xflag) {
char sep = 0;
- const char *p;
- out2str(ps4val());
+ const char *p, *ps4;
+ ps4 = expandstr(ps4val());
+ out2str(ps4 != NULL ? ps4 : ps4val());
for (sp = varlist.list ; sp ; sp = sp->next) {
if (sep != 0)
out2c(' ');
Modified: projects/largeSMP/bin/sh/expand.c
==============================================================================
--- projects/largeSMP/bin/sh/expand.c Fri Jun 10 02:07:21 2011 (r222910)
+++ projects/largeSMP/bin/sh/expand.c Fri Jun 10 02:40:01 2011 (r222911)
@@ -174,6 +174,7 @@ expandarg(union node *arg, struct arglis
ifslastp = NULL;
argstr(arg->narg.text, flag);
if (arglist == NULL) {
+ STACKSTRNUL(expdest);
return; /* here document expanded */
}
STPUTC('\0', expdest);
Modified: projects/largeSMP/bin/sh/parser.c
==============================================================================
--- projects/largeSMP/bin/sh/parser.c Fri Jun 10 02:07:21 2011 (r222910)
+++ projects/largeSMP/bin/sh/parser.c Fri Jun 10 02:40:01 2011 (r222911)
@@ -2029,3 +2029,47 @@ getprompt(void *unused __unused)
ps[i] = '\0';
return (ps);
}
+
+
+const char *
+expandstr(char *ps)
+{
+ union node n;
+ struct jmploc jmploc;
+ struct jmploc *const savehandler = handler;
+ const int saveprompt = doprompt;
+ struct parsefile *const savetopfile = getcurrentfile();
+ struct parser_temp *const saveparser_temp = parser_temp;
+ const char *result = NULL;
+
+ if (!setjmp(jmploc.loc)) {
+ handler = &jmploc;
+ parser_temp = NULL;
+ setinputstring(ps, 1);
+ doprompt = 0;
+ readtoken1(pgetc(), DQSYNTAX, "\n\n", 0);
+ if (backquotelist != NULL)
+ error("Command substitution not allowed here");
+
+ n.narg.type = NARG;
+ n.narg.next = NULL;
+ n.narg.text = wordtext;
+ n.narg.backquote = backquotelist;
+
+ expandarg(&n, NULL, 0);
+ result = stackblock();
+ INTOFF;
+ }
+ handler = savehandler;
+ doprompt = saveprompt;
+ popfilesupto(savetopfile);
+ if (parser_temp != saveparser_temp) {
+ parser_temp_free_all();
+ parser_temp = saveparser_temp;
+ }
+ if (result != NULL) {
+ INTON;
+ } else if (exception == EXINT)
+ raise(SIGINT);
+ return result;
+}
Modified: projects/largeSMP/bin/sh/parser.h
==============================================================================
--- projects/largeSMP/bin/sh/parser.h Fri Jun 10 02:07:21 2011 (r222910)
+++ projects/largeSMP/bin/sh/parser.h Fri Jun 10 02:40:01 2011 (r222911)
@@ -82,3 +82,4 @@ void fixredir(union node *, const char *
int goodname(const char *);
int isassignment(const char *);
char *getprompt(void *);
+const char *expandstr(char *);
Modified: projects/largeSMP/bin/sh/sh.1
==============================================================================
--- projects/largeSMP/bin/sh/sh.1 Fri Jun 10 02:07:21 2011 (r222910)
+++ projects/largeSMP/bin/sh/sh.1 Fri Jun 10 02:40:01 2011 (r222911)
@@ -32,7 +32,7 @@
.\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95
.\" $FreeBSD$
.\"
-.Dd May 21, 2011
+.Dd June 9, 2011
.Dt SH 1
.Os
.Sh NAME
@@ -324,7 +324,7 @@ Useful for debugging.
Write each command
(preceded by the value of the
.Va PS4
-variable)
+variable subjected to parameter expansion and arithmetic expansion)
to standard error before it is executed.
Useful for debugging.
.El
Modified: projects/largeSMP/contrib/less/NEWS
==============================================================================
--- projects/largeSMP/contrib/less/NEWS Fri Jun 10 02:07:21 2011 (r222910)
+++ projects/largeSMP/contrib/less/NEWS Fri Jun 10 02:40:01 2011 (r222911)
@@ -12,6 +12,15 @@
======================================================================
+ Major changes between "less" versions 443 and 444
+
+* Fix bug in unget handling that can cause strange effects on the
+ command line.
+
+* Remove vestiges of obsolete -l option that can cause a crash.
+
+======================================================================
+
Major changes between "less" versions 436 and 443
* Change search behavior such that when a search is given an explicit
Modified: projects/largeSMP/contrib/less/README
==============================================================================
--- projects/largeSMP/contrib/less/README Fri Jun 10 02:07:21 2011 (r222910)
+++ projects/largeSMP/contrib/less/README Fri Jun 10 02:40:01 2011 (r222911)
@@ -7,9 +7,9 @@
**************************************************************************
**************************************************************************
- Less, version 443
+ Less, version 444
- This is the distribution of less, version 443, released 09 Apr 2011.
+ This is the distribution of less, version 444, released 09 Jun 2011.
This program is part of the GNU project (http://www.gnu.org).
This program is free software. You may redistribute it and/or
Modified: projects/largeSMP/contrib/less/command.c
==============================================================================
--- projects/largeSMP/contrib/less/command.c Fri Jun 10 02:07:21 2011 (r222910)
+++ projects/largeSMP/contrib/less/command.c Fri Jun 10 02:40:01 2011 (r222911)
@@ -302,7 +302,7 @@ is_erase_char(c)
*/
static int
mca_opt_first_char(c)
- int c;
+ int c;
{
int flag = (optflag & ~OPT_NO_PROMPT);
if (flag == OPT_NO_TOGGLE)
@@ -846,6 +846,7 @@ ungetcc(c)
ug->ug_char = c;
ug->ug_next = ungot;
ungot = ug;
+ unget_end = 0;
}
/*
Modified: projects/largeSMP/contrib/less/funcs.h
==============================================================================
--- projects/largeSMP/contrib/less/funcs.h Fri Jun 10 02:07:21 2011 (r222910)
+++ projects/largeSMP/contrib/less/funcs.h Fri Jun 10 02:40:01 2011 (r222911)
@@ -194,7 +194,6 @@
public void unmark ();
public void opt_o ();
public void opt__O ();
- public void opt_l ();
public void opt_j ();
public void calc_jump_sline ();
public void opt_shift ();
Modified: projects/largeSMP/contrib/less/less.man
==============================================================================
--- projects/largeSMP/contrib/less/less.man Fri Jun 10 02:07:21 2011 (r222910)
+++ projects/largeSMP/contrib/less/less.man Fri Jun 10 02:40:01 2011 (r222911)
@@ -1156,7 +1156,7 @@ LESS(1)
next 8bcccbcc18b95.bb125.bb
If neither LESSCHARSET nor LESSCHARDEF is set, but any of the strings
- "UTF-8", "UTF8", "utf-8" or "utf8" is found in the LC_ALL, LC_TYPE or
+ "UTF-8", "UTF8", "utf-8" or "utf8" is found in the LC_ALL, LC_CTYPE or
LANG environment variables, then the default character set is utf-8.
If that string is not found, but your system supports the [4msetlocale[0m
@@ -1580,4 +1580,4 @@ LESS(1)
- Version 443: 09 Apr 2011 LESS(1)
+ Version 444: 09 Jun 2011 LESS(1)
Modified: projects/largeSMP/contrib/less/less.nro
==============================================================================
--- projects/largeSMP/contrib/less/less.nro Fri Jun 10 02:07:21 2011 (r222910)
+++ projects/largeSMP/contrib/less/less.nro Fri Jun 10 02:40:01 2011 (r222911)
@@ -1,4 +1,4 @@
-.TH LESS 1 "Version 443: 09 Apr 2011"
+.TH LESS 1 "Version 444: 09 Jun 2011"
.SH NAME
less \- opposite of more
.SH SYNOPSIS
@@ -1276,7 +1276,7 @@ to each of the possible values for LESSC
.PP
If neither LESSCHARSET nor LESSCHARDEF is set,
but any of the strings "UTF-8", "UTF8", "utf-8" or "utf8"
-is found in the LC_ALL, LC_TYPE or LANG
+is found in the LC_ALL, LC_CTYPE or LANG
environment variables, then the default character set is utf-8.
.PP
If that string is not found, but your system supports the
Modified: projects/largeSMP/contrib/less/lessecho.man
==============================================================================
--- projects/largeSMP/contrib/less/lessecho.man Fri Jun 10 02:07:21 2011 (r222910)
+++ projects/largeSMP/contrib/less/lessecho.man Fri Jun 10 02:40:01 2011 (r222911)
@@ -46,4 +46,4 @@ LESSECHO(1)
- Version 443: 09 Apr 2011 LESSECHO(1)
+ Version 444: 09 Jun 2011 LESSECHO(1)
Modified: projects/largeSMP/contrib/less/lessecho.nro
==============================================================================
--- projects/largeSMP/contrib/less/lessecho.nro Fri Jun 10 02:07:21 2011 (r222910)
+++ projects/largeSMP/contrib/less/lessecho.nro Fri Jun 10 02:40:01 2011 (r222911)
@@ -1,4 +1,4 @@
-.TH LESSECHO 1 "Version 443: 09 Apr 2011"
+.TH LESSECHO 1 "Version 444: 09 Jun 2011"
.SH NAME
lessecho \- expand metacharacters
.SH SYNOPSIS
Modified: projects/largeSMP/contrib/less/lesskey.man
==============================================================================
--- projects/largeSMP/contrib/less/lesskey.man Fri Jun 10 02:07:21 2011 (r222910)
+++ projects/largeSMP/contrib/less/lesskey.man Fri Jun 10 02:40:01 2011 (r222911)
@@ -354,4 +354,4 @@ LESSKEY(1)
- Version 443: 09 Apr 2011 LESSKEY(1)
+ Version 444: 09 Jun 2011 LESSKEY(1)
Modified: projects/largeSMP/contrib/less/lesskey.nro
==============================================================================
--- projects/largeSMP/contrib/less/lesskey.nro Fri Jun 10 02:07:21 2011 (r222910)
+++ projects/largeSMP/contrib/less/lesskey.nro Fri Jun 10 02:40:01 2011 (r222911)
@@ -1,4 +1,4 @@
-.TH LESSKEY 1 "Version 443: 09 Apr 2011"
+.TH LESSKEY 1 "Version 444: 09 Jun 2011"
.SH NAME
lesskey \- specify key bindings for less
.SH SYNOPSIS
Modified: projects/largeSMP/contrib/less/optfunc.c
==============================================================================
--- projects/largeSMP/contrib/less/optfunc.c Fri Jun 10 02:07:21 2011 (r222910)
+++ projects/largeSMP/contrib/less/optfunc.c Fri Jun 10 02:40:01 2011 (r222911)
@@ -132,34 +132,6 @@ opt__O(type, s)
#endif
/*
- * Handlers for -l option.
- */
- public void
-opt_l(type, s)
- int type;
- char *s;
-{
- int err;
- int n;
- char *t;
-
- switch (type)
- {
- case INIT:
- t = s;
- n = getnum(&t, "l", &err);
- if (err || n <= 0)
- {
- error("Line number is required after -l", NULL_PARG);
- return;
- }
- plusoption = TRUE;
- ungetsc(s);
- break;
- }
-}
-
-/*
* Handlers for -j option.
*/
public void
Modified: projects/largeSMP/contrib/less/opttbl.c
==============================================================================
--- projects/largeSMP/contrib/less/opttbl.c Fri Jun 10 02:07:21 2011 (r222910)
+++ projects/largeSMP/contrib/less/opttbl.c Fri Jun 10 02:40:01 2011 (r222911)
@@ -263,10 +263,6 @@ static struct loption option[] =
NULL
}
},
- { 'l', NULL,
- STRING|NO_TOGGLE|NO_QUERY, 0, NULL, opt_l,
- { NULL, NULL, NULL }
- },
{ 'L', &L__optname,
BOOL, OPT_ON, &use_lessopen, NULL,
{
Modified: projects/largeSMP/contrib/less/version.c
==============================================================================
--- projects/largeSMP/contrib/less/version.c Fri Jun 10 02:07:21 2011 (r222910)
+++ projects/largeSMP/contrib/less/version.c Fri Jun 10 02:40:01 2011 (r222911)
@@ -742,6 +742,7 @@ v441 1/21/11 Fix semi-infinite loop i
v442 3/2/11 Fix search bug.
Add ctrl-G line edit command.
v443 4/9/11 Fix Windows build.
+v444 6/8/11 Fix ungetc bug; remove vestiges of obsolete -l option.
*/
-char version[] = "443";
+char version[] = "444";
Modified: projects/largeSMP/games/fortune/datfiles/fortunes
==============================================================================
--- projects/largeSMP/games/fortune/datfiles/fortunes Fri Jun 10 02:07:21 2011 (r222910)
+++ projects/largeSMP/games/fortune/datfiles/fortunes Fri Jun 10 02:40:01 2011 (r222911)
@@ -2057,7 +2057,7 @@ promised me faithfully that you'd be bac
nine. It just can't take that long to play 18 holes of golf."
"Honey, wait," said Harry. "Let me explain. I know what I promised
you, but I have a very good reason for being late. Fred and I tee'd off
-right on time and everything was find for the first three holes. Then, on
+right on time and everything was fine for the first three holes. Then, on
the fourth tee Fred had a stroke. I ran back to the clubhouse but couldn't
find a doctor. And, by the time I got back to Fred, he was dead. So, for
the next 15 holes, it was hit the ball, drag Fred, hit the ball, drag Fred...
@@ -25523,7 +25523,9 @@ him, prussic acid could solve our popula
%
If everybody minded their own business, the world would go
around a deal faster.
- -- The Duchess, "Through the Looking Glass"
+ -- The Duchess; Lewis Carroll,
+ "Through the Looking-Glass,
+ and What Alice Found There" (1871)
%
If everything is coming your way then you're in the wrong lane.
%
@@ -42420,7 +42422,7 @@ in peoples' memories never really happen
Some of them want to use you,
Some of them want to be used by you,
...Everybody's looking for something.
- -- Eurythmics
+ -- Eurythmics, "Sweet Dreams (Are Made Of This)"
%
Some of us are becoming the men we wanted to marry.
-- Gloria Steinem
Modified: projects/largeSMP/lib/libstand/bswap.c
==============================================================================
--- projects/largeSMP/lib/libstand/bswap.c Fri Jun 10 02:07:21 2011 (r222910)
+++ projects/largeSMP/lib/libstand/bswap.c Fri Jun 10 02:40:01 2011 (r222911)
@@ -8,7 +8,7 @@ __FBSDID("$FreeBSD$");
#if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$NetBSD: bswap32.c,v 1.1 1997/10/09 15:42:33 bouyer Exp $";
-static char *rcsid = "$NetBSD: bswap64.c,v 1.1 1997/10/09 15:42:33 bouyer Exp $";
+static char *rcsid = "$NetBSD: bswap64.c,v 1.3 2009/03/16 05:59:21 cegger Exp $";
#endif
#include <sys/types.h>
@@ -30,12 +30,28 @@ bswap32(u_int32_t x)
u_int64_t
bswap64(u_int64_t x)
-{
- u_int32_t *p = (u_int32_t*)&x;
- u_int32_t t;
- t = bswap32(p[0]);
- p[0] = bswap32(p[1]);
- p[1] = t;
- return x;
-}
-
+{
+#ifdef _LP64
+ /*
+ * Assume we have wide enough registers to do it without touching
+ * memory.
+ */
+ return ( (x << 56) & 0xff00000000000000UL ) |
+ ( (x << 40) & 0x00ff000000000000UL ) |
+ ( (x << 24) & 0x0000ff0000000000UL ) |
+ ( (x << 8) & 0x000000ff00000000UL ) |
+ ( (x >> 8) & 0x00000000ff000000UL ) |
+ ( (x >> 24) & 0x0000000000ff0000UL ) |
+ ( (x >> 40) & 0x000000000000ff00UL ) |
+ ( (x >> 56) & 0x00000000000000ffUL );
+#else
+ /*
+ * Split the operation in two 32bit steps.
+ */
+ u_int32_t tl, th;
+
+ th = bswap32((u_int32_t)(x & 0x00000000ffffffffULL));
+ tl = bswap32((u_int32_t)((x >> 32) & 0x00000000ffffffffULL));
+ return ((u_int64_t)th << 32) | tl;
+#endif
+}
Modified: projects/largeSMP/sys/conf/Makefile.powerpc
==============================================================================
--- projects/largeSMP/sys/conf/Makefile.powerpc Fri Jun 10 02:07:21 2011 (r222910)
+++ projects/largeSMP/sys/conf/Makefile.powerpc Fri Jun 10 02:40:01 2011 (r222911)
@@ -35,7 +35,7 @@ LDSCRIPT_NAME?= ldscript.${MACHINE_ARCH}
INCLUDES+= -I$S/contrib/libfdt
-CFLAGS+= -msoft-float
+CFLAGS+= -msoft-float -Wa,-many
DDB_ENABLED!= grep DDB opt_ddb.h || true
.if !empty(DDB_ENABLED)
Modified: projects/largeSMP/sys/dev/ata/ata-sata.c
==============================================================================
--- projects/largeSMP/sys/dev/ata/ata-sata.c Fri Jun 10 02:07:21 2011 (r222910)
+++ projects/largeSMP/sys/dev/ata/ata-sata.c Fri Jun 10 02:40:01 2011 (r222911)
@@ -54,6 +54,11 @@ ata_sata_phy_check_events(device_t dev,
u_int32_t error, status;
ata_sata_scr_read(ch, port, ATA_SERROR, &error);
+
+ /* Check that SError value is sane. */
+ if (error == 0xffffffff)
+ return;
+
/* Clear set error bits/interrupt. */
if (error)
ata_sata_scr_write(ch, port, ATA_SERROR, error);
@@ -163,18 +168,18 @@ ata_sata_phy_reset(device_t dev, int por
if (bootverbose) {
if (port < 0) {
- device_printf(dev, "hardware reset ...\n");
+ device_printf(dev, "hard reset ...\n");
} else {
- device_printf(dev, "p%d: hardware reset ...\n", port);
+ device_printf(dev, "p%d: hard reset ...\n", port);
}
}
for (retry = 0; retry < 10; retry++) {
for (loop = 0; loop < 10; loop++) {
if (ata_sata_scr_write(ch, port, ATA_SCONTROL, ATA_SC_DET_RESET))
- return (0);
+ goto fail;
ata_udelay(100);
if (ata_sata_scr_read(ch, port, ATA_SCONTROL, &val))
- return (0);
+ goto fail;
if ((val & ATA_SC_DET_MASK) == ATA_SC_DET_RESET)
break;
}
@@ -183,15 +188,26 @@ ata_sata_phy_reset(device_t dev, int por
if (ata_sata_scr_write(ch, port, ATA_SCONTROL,
ATA_SC_DET_IDLE | ((ch->pm_level > 0) ? 0 :
ATA_SC_IPM_DIS_PARTIAL | ATA_SC_IPM_DIS_SLUMBER)))
- return (0);
+ goto fail;
ata_udelay(100);
if (ata_sata_scr_read(ch, port, ATA_SCONTROL, &val))
- return (0);
+ goto fail;
if ((val & ATA_SC_DET_MASK) == 0)
return ata_sata_connect(ch, port, 0);
}
}
- return 0;
+fail:
+ /* Clear SATA error register. */
+ ata_sata_scr_write(ch, port, ATA_SERROR, 0xffffffff);
+
+ if (bootverbose) {
+ if (port < 0) {
+ device_printf(dev, "hard reset failed\n");
+ } else {
+ device_printf(dev, "p%d: hard reset failed\n", port);
+ }
+ }
+ return (0);
}
int
Copied: projects/largeSMP/tools/regression/bin/sh/execution/set-x3.0 (from r222910, head/tools/regression/bin/sh/execution/set-x3.0)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/largeSMP/tools/regression/bin/sh/execution/set-x3.0 Fri Jun 10 02:40:01 2011 (r222911, copy of r222910, head/tools/regression/bin/sh/execution/set-x3.0)
@@ -0,0 +1,9 @@
+# $FreeBSD$
+
+key='must contain this'
+PS4='$key+ '
+{ r=`set -x; { :; } 2>&1 >/dev/null`; } 2>/dev/null
+case $r in
+*"$key"*) true ;;
+*) false ;;
+esac
Modified: projects/largeSMP/tools/tools/README
==============================================================================
--- projects/largeSMP/tools/tools/README Fri Jun 10 02:07:21 2011 (r222910)
+++ projects/largeSMP/tools/tools/README Fri Jun 10 02:40:01 2011 (r222911)
@@ -16,6 +16,7 @@ cfi Common Flash Interface (CFI) tool
commitsdb A tool for reconstructing commit history using md5
checksums of the commit logs.
crypto Test and exercise tools related to the crypto framework
+cxgbetool A tool for the cxgbe(4) driver.
diffburst OBSOLETE: equivalent functionality is available via split -p.
For example: "split -p ^diff < patchfile". See split(1).
editing Editor modes and the like to help editing FreeBSD code.
Modified: projects/largeSMP/usr.sbin/mfiutil/mfi_config.c
==============================================================================
--- projects/largeSMP/usr.sbin/mfiutil/mfi_config.c Fri Jun 10 02:07:21 2011 (r222910)
+++ projects/largeSMP/usr.sbin/mfiutil/mfi_config.c Fri Jun 10 02:40:01 2011 (r222911)
@@ -85,6 +85,7 @@ mfi_config_read(int fd, struct mfi_confi
{
struct mfi_config_data *config;
uint32_t config_size;
+ int error;
/*
* Keep fetching the config in a loop until we have a large enough
@@ -97,8 +98,12 @@ fetch:
if (config == NULL)
return (-1);
if (mfi_dcmd_command(fd, MFI_DCMD_CFG_READ, config,
- config_size, NULL, 0, NULL) < 0)
+ config_size, NULL, 0, NULL) < 0) {
+ error = errno;
+ free(config);
+ errno = error;
return (-1);
+ }
if (config->size > config_size) {
config_size = config->size;
@@ -162,12 +167,14 @@ clear_config(int ac, char **av)
if (!mfi_reconfig_supported()) {
warnx("The current mfi(4) driver does not support "
"configuration changes.");
+ close(fd);
return (EOPNOTSUPP);
}
if (mfi_ld_get_list(fd, &list, NULL) < 0) {
error = errno;
warn("Failed to get volume list");
+ close(fd);
return (error);
}
@@ -175,6 +182,7 @@ clear_config(int ac, char **av)
if (mfi_volume_busy(fd, list.ld_list[i].ld.v.target_id)) {
warnx("Volume %s is busy and cannot be deleted",
mfi_volume_name(fd, list.ld_list[i].ld.v.target_id));
+ close(fd);
return (EBUSY);
}
}
@@ -185,12 +193,14 @@ clear_config(int ac, char **av)
ch = getchar();
if (ch != 'y' && ch != 'Y') {
printf("\nAborting\n");
+ close(fd);
return (0);
}
if (mfi_dcmd_command(fd, MFI_DCMD_CFG_CLEAR, NULL, 0, NULL, 0, NULL) < 0) {
error = errno;
warn("Failed to clear configuration");
+ close(fd);
return (error);
}
@@ -336,17 +346,21 @@ parse_array(int fd, int raid_type, char
for (pinfo = info->drives; (cp = strsep(&array_str, ",")) != NULL;
pinfo++) {
error = mfi_lookup_drive(fd, cp, &device_id);
- if (error)
+ if (error) {
+ free(info->drives);
return (error);
+ }
if (mfi_pd_get_info(fd, device_id, pinfo, NULL) < 0) {
error = errno;
warn("Failed to fetch drive info for drive %s", cp);
+ free(info->drives);
return (error);
}
if (pinfo->fw_state != MFI_PD_STATE_UNCONFIGURED_GOOD) {
warnx("Drive %u is not available", device_id);
+ free(info->drives);
return (EINVAL);
}
}
@@ -551,7 +565,12 @@ create_volume(int ac, char **av)
return (EINVAL);
}
-
+ bzero(&state, sizeof(state));
+ config = NULL;
+ arrays = NULL;
+ narrays = 0;
+ error = 0;
+
fd = mfi_open(mfi_unit);
if (fd < 0) {
error = errno;
@@ -562,7 +581,8 @@ create_volume(int ac, char **av)
if (!mfi_reconfig_supported()) {
warnx("The current mfi(4) driver does not support "
"configuration changes.");
- return (EOPNOTSUPP);
+ error = EOPNOTSUPP;
+ goto error;
}
/* Lookup the RAID type first. */
@@ -575,7 +595,8 @@ create_volume(int ac, char **av)
if (raid_type == -1) {
warnx("Unknown or unsupported volume type %s", av[1]);
- return (EINVAL);
+ error = EINVAL;
+ goto error;
}
/* Parse any options. */
@@ -603,7 +624,8 @@ create_volume(int ac, char **av)
break;
case '?':
default:
- return (EINVAL);
+ error = EINVAL;
+ goto error;
}
}
ac -= optind;
@@ -613,7 +635,8 @@ create_volume(int ac, char **av)
narrays = ac;
if (narrays == 0) {
warnx("At least one drive list is required");
- return (EINVAL);
+ error = EINVAL;
+ goto error;
}
switch (raid_type) {
case RT_RAID0:
@@ -623,7 +646,8 @@ create_volume(int ac, char **av)
case RT_CONCAT:
if (narrays != 1) {
warnx("Only one drive list can be specified");
- return (EINVAL);
+ error = EINVAL;
+ goto error;
}
break;
case RT_RAID10:
@@ -632,24 +656,27 @@ create_volume(int ac, char **av)
if (narrays < 1) {
warnx("RAID10, RAID50, and RAID60 require at least "
"two drive lists");
- return (EINVAL);
+ error = EINVAL;
+ goto error;
}
if (narrays > MFI_MAX_SPAN_DEPTH) {
warnx("Volume spans more than %d arrays",
MFI_MAX_SPAN_DEPTH);
- return (EINVAL);
+ error = EINVAL;
+ goto error;
}
break;
}
arrays = calloc(narrays, sizeof(*arrays));
if (arrays == NULL) {
warnx("malloc failed");
- return (ENOMEM);
+ error = ENOMEM;
+ goto error;
}
for (i = 0; i < narrays; i++) {
error = parse_array(fd, raid_type, av[i], &arrays[i]);
if (error)
- return (error);
+ goto error;
}
switch (raid_type) {
@@ -660,7 +687,8 @@ create_volume(int ac, char **av)
if (arrays[i].drive_count != arrays[0].drive_count) {
warnx("All arrays must contain the same "
"number of drives");
- return (EINVAL);
+ error = EINVAL;
+ goto error;
}
}
break;
@@ -673,7 +701,7 @@ create_volume(int ac, char **av)
if (mfi_config_read(fd, &config) < 0) {
error = errno;
warn("Failed to read configuration");
- return (error);
+ goto error;
}
p = (char *)config->array;
state.array_ref = 0xffff;
@@ -683,7 +711,8 @@ create_volume(int ac, char **av)
state.arrays = calloc(config->array_count, sizeof(int));
if (state.arrays == NULL) {
warnx("malloc failed");
- return (ENOMEM);
+ error = ENOMEM;
+ goto error;
}
for (i = 0; i < config->array_count; i++) {
ar = (struct mfi_array *)p;
@@ -699,7 +728,8 @@ create_volume(int ac, char **av)
state.volumes = calloc(config->log_drv_count, sizeof(int));
if (state.volumes == NULL) {
warnx("malloc failed");
- return (ENOMEM);
+ error = ENOMEM;
+ goto error;
}
for (i = 0; i < config->log_drv_count; i++) {
ld = (struct mfi_ld_config *)p;
@@ -739,7 +769,8 @@ create_volume(int ac, char **av)
config = calloc(1, config_size);
if (config == NULL) {
warnx("malloc failed");
- return (ENOMEM);
+ error = ENOMEM;
+ goto error;
}
config->size = config_size;
config->array_count = narrays;
@@ -776,21 +807,20 @@ create_volume(int ac, char **av)
NULL, 0, NULL) < 0) {
error = errno;
warn("Failed to add volume");
- return (error);
+ /* FALLTHROUGH */
}
+error:
/* Clean up. */
free(config);
- if (state.log_drv_count > 0)
- free(state.volumes);
- if (state.array_count > 0)
- free(state.arrays);
+ free(state.volumes);
+ free(state.arrays);
for (i = 0; i < narrays; i++)
free(arrays[i].drives);
free(arrays);
close(fd);
- return (0);
+ return (error);
}
MFI_COMMAND(top, create, create_volume);
@@ -831,24 +861,28 @@ delete_volume(int ac, char **av)
if (!mfi_reconfig_supported()) {
warnx("The current mfi(4) driver does not support "
"configuration changes.");
+ close(fd);
return (EOPNOTSUPP);
}
if (mfi_lookup_volume(fd, av[1], &target_id) < 0) {
error = errno;
warn("Invalid volume %s", av[1]);
+ close(fd);
return (error);
}
if (mfi_ld_get_info(fd, target_id, &info, NULL) < 0) {
error = errno;
warn("Failed to get info for volume %d", target_id);
+ close(fd);
return (error);
}
if (mfi_volume_busy(fd, target_id)) {
warnx("Volume %s is busy and cannot be deleted",
mfi_volume_name(fd, target_id));
+ close(fd);
return (EBUSY);
}
@@ -857,6 +891,7 @@ delete_volume(int ac, char **av)
sizeof(mbox), NULL) < 0) {
error = errno;
warn("Failed to delete volume");
+ close(fd);
return (error);
}
@@ -891,40 +926,44 @@ add_spare(int ac, char **av)
return (error);
}
+ config = NULL;
+ spare = NULL;
error = mfi_lookup_drive(fd, av[1], &device_id);
if (error)
- return (error);
+ goto error;
if (mfi_pd_get_info(fd, device_id, &info, NULL) < 0) {
error = errno;
warn("Failed to fetch drive info");
- return (error);
+ goto error;
}
if (info.fw_state != MFI_PD_STATE_UNCONFIGURED_GOOD) {
warnx("Drive %u is not available", device_id);
- return (EINVAL);
+ error = EINVAL;
+ goto error;
}
if (ac > 2) {
if (mfi_lookup_volume(fd, av[2], &target_id) < 0) {
error = errno;
warn("Invalid volume %s", av[2]);
- return (error);
+ goto error;
}
}
if (mfi_config_read(fd, &config) < 0) {
error = errno;
warn("Failed to read configuration");
- return (error);
+ goto error;
}
spare = malloc(sizeof(struct mfi_spare) + sizeof(uint16_t) *
config->array_count);
if (spare == NULL) {
warnx("malloc failed");
- return (ENOMEM);
+ error = ENOMEM;
+ goto error;
}
bzero(spare, sizeof(struct mfi_spare));
spare->ref = info.ref;
@@ -937,7 +976,8 @@ add_spare(int ac, char **av)
if (ar->size > info.coerced_size) {
warnx("Spare isn't large enough for array %u",
ar->array_ref);
- return (EINVAL);
+ error = EINVAL;
+ goto error;
}
p += config->array_size;
}
@@ -950,7 +990,8 @@ add_spare(int ac, char **av)
ld = mfi_config_lookup_volume(config, target_id);
if (ld == NULL) {
warnx("Did not find volume %d", target_id);
- return (EINVAL);
+ error = EINVAL;
+ goto error;
}
spare->spare_type |= MFI_SPARE_DEDICATED;
@@ -960,29 +1001,33 @@ add_spare(int ac, char **av)
ld->span[i].array_ref);
if (ar == NULL) {
warnx("Missing array; inconsistent config?");
- return (ENXIO);
+ error = ENXIO;
+ goto error;
}
if (ar->size > info.coerced_size) {
warnx("Spare isn't large enough for array %u",
ar->array_ref);
- return (EINVAL);
+ error = EINVAL;
+ goto error;
}
spare->array_ref[i] = ar->array_ref;
}
}
- free(config);
if (mfi_dcmd_command(fd, MFI_DCMD_CFG_MAKE_SPARE, spare,
sizeof(struct mfi_spare) + sizeof(uint16_t) * spare->array_count,
NULL, 0, NULL) < 0) {
error = errno;
warn("Failed to assign spare");
- return (error);
+ /* FALLTHROUGH. */
}
+error:
+ free(spare);
+ free(config);
close(fd);
- return (0);
+ return (error);
}
MFI_COMMAND(top, add, add_spare);
@@ -1007,18 +1052,22 @@ remove_spare(int ac, char **av)
}
error = mfi_lookup_drive(fd, av[1], &device_id);
- if (error)
+ if (error) {
+ close(fd);
return (error);
+ }
/* Get the info for this drive. */
if (mfi_pd_get_info(fd, device_id, &info, NULL) < 0) {
error = errno;
warn("Failed to fetch info for drive %u", device_id);
+ close(fd);
return (error);
}
if (info.fw_state != MFI_PD_STATE_HOT_SPARE) {
warnx("Drive %u is not a hot spare", device_id);
+ close(fd);
return (EINVAL);
}
@@ -1027,6 +1076,7 @@ remove_spare(int ac, char **av)
sizeof(mbox), NULL) < 0) {
error = errno;
warn("Failed to delete spare");
+ close(fd);
return (error);
}
@@ -1151,6 +1201,7 @@ debug_config(int ac, char **av)
if (mfi_config_read(fd, &config) < 0) {
error = errno;
warn("Failed to get config");
+ close(fd);
return (error);
}
@@ -1190,17 +1241,21 @@ dump(int ac, char **av)
warn("Failed to read debug command");
if (error == ENOENT)
error = EOPNOTSUPP;
+ close(fd);
return (error);
}
config = malloc(len);
if (config == NULL) {
warnx("malloc failed");
+ close(fd);
return (ENOMEM);
}
if (sysctlbyname(buf, config, &len, NULL, 0) < 0) {
error = errno;
warn("Failed to read debug command");
+ free(config);
+ close(fd);
return (error);
}
dump_config(fd, config);
Modified: projects/largeSMP/usr.sbin/mfiutil/mfi_drive.c
==============================================================================
--- projects/largeSMP/usr.sbin/mfiutil/mfi_drive.c Fri Jun 10 02:07:21 2011 (r222910)
+++ projects/largeSMP/usr.sbin/mfiutil/mfi_drive.c Fri Jun 10 02:40:01 2011 (r222911)
@@ -310,19 +310,23 @@ drive_set_state(char *drive, uint16_t ne
}
error = mfi_lookup_drive(fd, drive, &device_id);
- if (error)
+ if (error) {
+ close(fd);
return (error);
+ }
/* Get the info for this drive. */
if (mfi_pd_get_info(fd, device_id, &info, NULL) < 0) {
error = errno;
warn("Failed to fetch info for drive %u", device_id);
+ close(fd);
return (error);
}
/* Try to change the state. */
if (info.fw_state == new_state) {
warnx("Drive %u is already in the desired state", device_id);
+ close(fd);
return (EINVAL);
}
@@ -334,6 +338,7 @@ drive_set_state(char *drive, uint16_t ne
error = errno;
warn("Failed to set drive %u to %s", device_id,
mfi_pdstate(new_state));
+ close(fd);
return (error);
}
@@ -406,19 +411,23 @@ start_rebuild(int ac, char **av)
}
error = mfi_lookup_drive(fd, av[1], &device_id);
- if (error)
+ if (error) {
+ close(fd);
return (error);
+ }
/* Get the info for this drive. */
if (mfi_pd_get_info(fd, device_id, &info, NULL) < 0) {
error = errno;
warn("Failed to fetch info for drive %u", device_id);
+ close(fd);
return (error);
}
/* Check the state, must be REBUILD. */
if (info.fw_state != MFI_PD_STATE_REBUILD) {
warnx("Drive %d is not in the REBUILD state", device_id);
+ close(fd);
return (EINVAL);
}
@@ -428,6 +437,7 @@ start_rebuild(int ac, char **av)
NULL) < 0) {
error = errno;
warn("Failed to start rebuild on drive %u", device_id);
+ close(fd);
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-projects
mailing list