PERFORCE change 143569 for review
John Birrell
jb at FreeBSD.org
Mon Jun 16 06:08:51 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=143569
Change 143569 by jb at freebsd3 on 2008/06/16 06:08:08
IF6
Affected files ...
.. //depot/projects/dtrace6/src/sbin/restore/dirs.c#3 integrate
.. //depot/projects/dtrace6/src/sbin/restore/interactive.c#2 integrate
.. //depot/projects/dtrace6/src/sbin/restore/main.c#2 integrate
.. //depot/projects/dtrace6/src/sbin/restore/restore.8#2 integrate
.. //depot/projects/dtrace6/src/sbin/restore/restore.c#2 integrate
.. //depot/projects/dtrace6/src/sbin/restore/restore.h#3 integrate
.. //depot/projects/dtrace6/src/sbin/restore/tape.c#3 integrate
.. //depot/projects/dtrace6/src/share/man/man4/ciss.4#2 integrate
.. //depot/projects/dtrace6/src/sys/dev/ciss/ciss.c#3 integrate
.. //depot/projects/dtrace6/src/sys/dev/hme/if_hme.c#2 integrate
.. //depot/projects/dtrace6/src/sys/dev/hme/if_hme_pci.c#2 integrate
.. //depot/projects/dtrace6/src/sys/dev/hme/if_hme_sbus.c#2 integrate
.. //depot/projects/dtrace6/src/sys/dev/hme/if_hmereg.h#2 integrate
.. //depot/projects/dtrace6/src/sys/dev/hme/if_hmevar.h#2 integrate
.. //depot/projects/dtrace6/src/sys/nlm/nlm_prot_impl.c#3 integrate
.. //depot/projects/dtrace6/src/sys/sys/param.h#9 integrate
.. //depot/projects/dtrace6/src/usr.bin/make/make.1#2 integrate
.. //depot/projects/dtrace6/src/usr.bin/make/var.c#2 integrate
.. //depot/projects/dtrace6/src/usr.bin/tar/Makefile#2 integrate
.. //depot/projects/dtrace6/src/usr.bin/tar/matching.c#2 integrate
.. //depot/projects/dtrace6/src/usr.sbin/pkg_install/add/main.c#4 integrate
.. //depot/projects/dtrace6/src/usr.sbin/pkg_install/add/pkg_add.1#3 integrate
.. //depot/projects/dtrace6/src/usr.sbin/pkg_install/create/create.h#3 integrate
.. //depot/projects/dtrace6/src/usr.sbin/pkg_install/create/main.c#3 integrate
.. //depot/projects/dtrace6/src/usr.sbin/pkg_install/create/perform.c#3 integrate
.. //depot/projects/dtrace6/src/usr.sbin/pkg_install/create/pkg_create.1#3 integrate
.. //depot/projects/dtrace6/src/usr.sbin/pkg_install/delete/main.c#3 integrate
.. //depot/projects/dtrace6/src/usr.sbin/pkg_install/delete/pkg_delete.1#3 integrate
.. //depot/projects/dtrace6/src/usr.sbin/pkg_install/info/main.c#4 integrate
.. //depot/projects/dtrace6/src/usr.sbin/pkg_install/info/pkg_info.1#3 integrate
.. //depot/projects/dtrace6/src/usr.sbin/pkg_install/lib/lib.h#4 integrate
.. //depot/projects/dtrace6/src/usr.sbin/pkg_install/updating/main.c#2 integrate
.. //depot/projects/dtrace6/src/usr.sbin/pkg_install/updating/pkg_updating.1#2 integrate
.. //depot/projects/dtrace6/src/usr.sbin/pkg_install/version/main.c#3 integrate
.. //depot/projects/dtrace6/src/usr.sbin/pkg_install/version/pkg_version.1#3 integrate
.. //depot/projects/dtrace6/src/usr.sbin/rpc.lockd/lockd.c#3 integrate
.. //depot/projects/dtrace6/src/usr.sbin/tzsetup/tzsetup.c#2 integrate
Differences ...
==== //depot/projects/dtrace6/src/sbin/restore/dirs.c#3 (text+ko) ====
@@ -37,7 +37,7 @@
static char sccsid[] = "@(#)dirs.c 8.7 (Berkeley) 5/1/95";
#endif
static const char rcsid[] =
- "$FreeBSD: src/sbin/restore/dirs.c,v 1.30.2.1 2008/05/23 18:08:31 mckusick Exp $";
+ "$FreeBSD: src/sbin/restore/dirs.c,v 1.30.2.2 2008/06/09 07:53:16 dwmalone Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -120,6 +120,7 @@
static void rst_seekdir(RST_DIR *, long, long);
static long rst_telldir(RST_DIR *);
static struct direct *searchdir(ino_t, char *);
+static void fail_dirtmp(char *);
/*
* Extract directory contents, building up a directory structure
@@ -138,7 +139,7 @@
vprintf(stdout, "Extract directories from tape\n");
if ((tmpdir = getenv("TMPDIR")) == NULL || tmpdir[0] == '\0')
tmpdir = _PATH_TMP;
- (void) sprintf(dirfile, "%s/rstdir%d", tmpdir, dumpdate);
+ (void) sprintf(dirfile, "%s/rstdir%ld", tmpdir, dumpdate);
if (command != 'r' && command != 'R') {
(void *) strcat(dirfile, "-XXXXXX");
fd = mkstemp(dirfile);
@@ -147,11 +148,11 @@
if (fd == -1 || (df = fdopen(fd, "w")) == NULL) {
if (fd != -1)
close(fd);
- warn("%s - cannot create directory temporary\nfopen", dirfile);
+ warn("%s: cannot create directory database", dirfile);
done(1);
}
if (genmode != 0) {
- (void) sprintf(modefile, "%s/rstmode%d", tmpdir, dumpdate);
+ (void) sprintf(modefile, "%s/rstmode%ld", tmpdir, dumpdate);
if (command != 'r' && command != 'R') {
(void *) strcat(modefile, "-XXXXXX");
fd = mkstemp(modefile);
@@ -160,7 +161,7 @@
if (fd == -1 || (mf = fdopen(fd, "w")) == NULL) {
if (fd != -1)
close(fd);
- warn("%s - cannot create modefile\nfopen", modefile);
+ warn("%s: cannot create modefile", modefile);
done(1);
}
}
@@ -172,25 +173,24 @@
for (;;) {
curfile.name = "<directory file - name unknown>";
curfile.action = USING;
- if (curfile.mode == 0 || (curfile.mode & IFMT) != IFDIR) {
- (void) fclose(df);
- dirp = opendirfile(dirfile);
- if (dirp == NULL)
- fprintf(stderr, "opendirfile: %s\n",
- strerror(errno));
- if (mf != NULL)
- (void) fclose(mf);
- i = dirlookup(dot);
- if (i == 0)
- panic("Root directory is not on tape\n");
- return;
- }
+ if (curfile.mode == 0 || (curfile.mode & IFMT) != IFDIR)
+ break;
itp = allocinotab(&curfile, seekpt);
getfile(putdir, putdirattrs, xtrnull);
putent(&nulldir);
flushent();
itp->t_size = seekpt - itp->t_seekpt;
}
+ if (fclose(df) != 0)
+ fail_dirtmp(dirfile);
+ dirp = opendirfile(dirfile);
+ if (dirp == NULL)
+ fprintf(stderr, "opendirfile: %s\n", strerror(errno));
+ if (mf != NULL && fclose(mf) != 0)
+ fail_dirtmp(modefile);
+ i = dirlookup(dot);
+ if (i == 0)
+ panic("Root directory is not on tape\n");
}
/*
@@ -216,7 +216,7 @@
struct direct *dp;
int namelen;
long bpt;
- char locname[MAXPATHLEN + 1];
+ char locname[MAXPATHLEN];
itp = inotablookup(ino);
if (itp == NULL) {
@@ -235,9 +235,8 @@
* begin search through the directory
* skipping over "." and ".."
*/
- (void) strncpy(locname, pname, sizeof(locname) - 1);
- locname[sizeof(locname) - 1] = '\0';
- (void) strncat(locname, "/", sizeof(locname) - strlen(locname));
+ (void) strlcpy(locname, pname, sizeof(locname));
+ (void) strlcat(locname, "/", sizeof(locname));
namelen = strlen(locname);
rst_seekdir(dirp, itp->t_seekpt, itp->t_seekpt);
dp = rst_readdir(dirp); /* "." */
@@ -261,7 +260,7 @@
fprintf(stderr, "%s%s: name exceeds %d char\n",
locname, dp->d_name, sizeof(locname) - 1);
} else {
- (void) strncat(locname, dp->d_name, (int)dp->d_namlen);
+ (void)strlcat(locname, dp->d_name, sizeof(locname));
treescan(locname, dp->d_ino, todo);
rst_seekdir(dirp, bpt, itp->t_seekpt);
}
@@ -391,7 +390,8 @@
if (dirloc + dp->d_reclen > DIRBLKSIZ) {
((struct direct *)(dirbuf + prev))->d_reclen =
DIRBLKSIZ - prev;
- (void) fwrite(dirbuf, 1, DIRBLKSIZ, df);
+ if (fwrite(dirbuf, DIRBLKSIZ, 1, df) != 1)
+ fail_dirtmp(dirfile);
dirloc = 0;
}
memmove(dirbuf + dirloc, dp, (long)dp->d_reclen);
@@ -406,7 +406,8 @@
flushent(void)
{
((struct direct *)(dirbuf + prev))->d_reclen = DIRBLKSIZ - prev;
- (void) fwrite(dirbuf, (int)dirloc, 1, df);
+ if (fwrite(dirbuf, (int)dirloc, 1, df) != 1)
+ fail_dirtmp(dirfile);
seekpt = ftell(df);
dirloc = 0;
}
@@ -418,8 +419,8 @@
putdirattrs(char *buf, long size)
{
- if (mf != NULL)
- (void) fwrite(buf, 1, size, mf);
+ if (mf != NULL && fwrite(buf, size, 1, mf) != 1)
+ fail_dirtmp(modefile);
}
/*
@@ -559,12 +560,13 @@
char *cp, *buf;
const char *tmpdir;
int bufsize;
+ uid_t myuid;
vprintf(stdout, "Set directory mode, owner, and times.\n");
if ((tmpdir = getenv("TMPDIR")) == NULL || tmpdir[0] == '\0')
tmpdir = _PATH_TMP;
if (command == 'r' || command == 'R')
- (void) sprintf(modefile, "%s/rstmode%d", tmpdir, dumpdate);
+ (void) sprintf(modefile, "%s/rstmode%ld", tmpdir, dumpdate);
if (modefile[0] == '#') {
panic("modefile not defined\n");
fprintf(stderr, "directory mode, owner, and times not set\n");
@@ -579,8 +581,14 @@
}
clearerr(mf);
bufsize = 0;
+ myuid = getuid();
for (;;) {
(void) fread((char *)&node, 1, sizeof(struct modeinfo), mf);
+ if (ferror(mf)) {
+ warn("%s: cannot read modefile.", modefile);
+ fprintf(stderr, "Mode, owner, and times not set.\n");
+ break;
+ }
if (feof(mf))
break;
if (node.extsize > 0) {
@@ -595,8 +603,22 @@
}
if (bufsize >= node.extsize) {
(void) fread(buf, 1, node.extsize, mf);
+ if (ferror(mf)) {
+ warn("%s: cannot read modefile.",
+ modefile);
+ fprintf(stderr, "Not all external ");
+ fprintf(stderr, "attributes set.\n");
+ break;
+ }
} else {
(void) fseek(mf, node.extsize, SEEK_CUR);
+ if (ferror(mf)) {
+ warn("%s: cannot seek in modefile.",
+ modefile);
+ fprintf(stderr, "Not all directory ");
+ fprintf(stderr, "attributes set.\n");
+ break;
+ }
}
}
ep = lookupino(node.ino);
@@ -625,7 +647,10 @@
"extended attributes for ", cp);
}
}
- (void) chown(cp, node.uid, node.gid);
+ if (myuid != 0)
+ (void) chown(cp, myuid, node.gid);
+ else
+ (void) chown(cp, node.uid, node.gid);
(void) chmod(cp, node.mode);
utimes(cp, node.ctimep);
utimes(cp, node.mtimep);
@@ -635,8 +660,6 @@
}
if (bufsize > 0)
free(buf);
- if (ferror(mf))
- panic("error setting directory modes\n");
(void) fclose(mf);
}
@@ -730,7 +753,8 @@
node.flags = ctxp->file_flags;
node.uid = ctxp->uid;
node.gid = ctxp->gid;
- (void) fwrite((char *)&node, 1, sizeof(struct modeinfo), mf);
+ if (fwrite((char *)&node, sizeof(struct modeinfo), 1, mf) != 1)
+ fail_dirtmp(modefile);
return (itp);
}
@@ -756,9 +780,33 @@
{
closemt();
- if (modefile[0] != '#')
+ if (modefile[0] != '#') {
+ (void) truncate(modefile, 0);
(void) unlink(modefile);
- if (dirfile[0] != '#')
+ }
+ if (dirfile[0] != '#') {
+ (void) truncate(dirfile, 0);
(void) unlink(dirfile);
+ }
exit(exitcode);
}
+
+/*
+ * Print out information about the failure to save directory,
+ * extended attribute, and mode information.
+ */
+static void
+fail_dirtmp(char *filename)
+{
+ const char *tmpdir;
+
+ warn("%s: cannot write directory database", filename);
+ if (errno == ENOSPC) {
+ if ((tmpdir = getenv("TMPDIR")) == NULL || tmpdir[0] == '\0')
+ tmpdir = _PATH_TMP;
+ fprintf(stderr, "Try making space in %s, %s\n%s\n", tmpdir,
+ "or set environment variable TMPDIR",
+ "to an alternate location with more disk space.");
+ }
+ done(1);
+}
==== //depot/projects/dtrace6/src/sbin/restore/interactive.c#2 (text+ko) ====
@@ -34,7 +34,7 @@
#endif /* not lint */
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sbin/restore/interactive.c,v 1.17.2.1 2005/10/09 03:50:30 delphij Exp $");
+__FBSDID("$FreeBSD: src/sbin/restore/interactive.c,v 1.17.2.2 2008/06/09 07:53:16 dwmalone Exp $");
#include <sys/param.h>
#include <sys/stat.h>
@@ -502,7 +502,7 @@
struct afile single;
RST_DIR *dirp;
int entries, len, namelen;
- char locname[MAXPATHLEN + 1];
+ char locname[MAXPATHLEN];
dp = pathsearch(name);
if (dp == NULL || (!dflag && TSTINO(dp->d_ino, dumpmap) == 0) ||
@@ -533,8 +533,8 @@
fprintf(stderr, "%s:\n", name);
entries = 0;
listp = list;
- (void) strncpy(locname, name, MAXPATHLEN);
- (void) strncat(locname, "/", MAXPATHLEN);
+ (void)strlcpy(locname, name, MAXPATHLEN);
+ (void)strlcat(locname, "/", MAXPATHLEN);
namelen = strlen(locname);
while ((dp = rst_readdir(dirp))) {
if (dp == NULL)
@@ -545,13 +545,11 @@
strcmp(dp->d_name, ".") == 0 ||
strcmp(dp->d_name, "..") == 0))
continue;
- locname[namelen] = '\0';
if (namelen + dp->d_namlen >= MAXPATHLEN) {
fprintf(stderr, "%s%s: name exceeds %d char\n",
locname, dp->d_name, MAXPATHLEN);
} else {
- (void) strncat(locname, dp->d_name,
- (int)dp->d_namlen);
+ (void)strlcat(locname, dp->d_name, MAXPATHLEN);
mkentry(locname, dp, listp++);
entries++;
}
==== //depot/projects/dtrace6/src/sbin/restore/main.c#2 (text+ko) ====
@@ -40,7 +40,7 @@
#endif /* not lint */
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sbin/restore/main.c,v 1.26 2005/05/29 15:57:00 charnier Exp $");
+__FBSDID("$FreeBSD: src/sbin/restore/main.c,v 1.26.2.1 2008/06/09 07:53:16 dwmalone Exp $");
#include <sys/param.h>
#include <sys/stat.h>
@@ -60,7 +60,7 @@
#include "restore.h"
#include "extern.h"
-int bflag = 0, cvtflag = 0, dflag = 0, vflag = 0, yflag = 0;
+int bflag = 0, cvtflag = 0, dflag = 0, Dflag = 0, vflag = 0, yflag = 0;
int hflag = 1, mflag = 1, Nflag = 0;
int uflag = 0;
int pipecmd = 0;
@@ -97,7 +97,7 @@
inputdev = NULL;
obsolete(&argc, &argv);
- while ((ch = getopt(argc, argv, "b:df:himNP:Rrs:tuvxy")) != -1)
+ while ((ch = getopt(argc, argv, "b:dDf:himNP:Rrs:tuvxy")) != -1)
switch(ch) {
case 'b':
/* Change default tape blocksize. */
@@ -111,6 +111,9 @@
case 'd':
dflag = 1;
break;
+ case 'D':
+ Dflag = 1;
+ break;
case 'f':
if (pipecmd)
errx(1,
==== //depot/projects/dtrace6/src/sbin/restore/restore.8#2 (text+ko) ====
@@ -26,7 +26,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)restore.8 8.4 (Berkeley) 5/1/95
-.\" $FreeBSD: src/sbin/restore/restore.8,v 1.50.2.1 2006/10/16 12:01:04 ru Exp $
+.\" $FreeBSD: src/sbin/restore/restore.8,v 1.50.2.2 2008/06/09 07:53:16 dwmalone Exp $
.\"
.Dd October 12, 2006
.Dt RESTORE 8
@@ -38,32 +38,32 @@
.Sh SYNOPSIS
.Nm
.Fl i
-.Op Fl dhmNuvy
+.Op Fl dDhmNuvy
.Op Fl b Ar blocksize
.Op Fl f Ar file | Fl P Ar pipecommand
.Op Fl s Ar fileno
.Nm
.Fl R
-.Op Fl dNuvy
+.Op Fl dDNuvy
.Op Fl b Ar blocksize
.Op Fl f Ar file | Fl P Ar pipecommand
.Op Fl s Ar fileno
.Nm
.Fl r
-.Op Fl dNuvy
+.Op Fl dDNuvy
.Op Fl b Ar blocksize
.Op Fl f Ar file | Fl P Ar pipecommand
.Op Fl s Ar fileno
.Nm
.Fl t
-.Op Fl dhNuvy
+.Op Fl dDhNuvy
.Op Fl b Ar blocksize
.Op Fl f Ar file | Fl P Ar pipecommand
.Op Fl s Ar fileno
.Op Ar
.Nm
.Fl x
-.Op Fl dhmNuvy
+.Op Fl dDhmNuvy
.Op Fl b Ar blocksize
.Op Fl f Ar file | Fl P Ar pipecommand
.Op Fl s Ar fileno
@@ -278,6 +278,12 @@
tries to determine the media block size dynamically.
.It Fl d
Sends verbose debugging output to the standard error.
+.It Fl D
+This puts
+.Nm
+into degraded mode,
+causing restore to operate less efficiently
+but to try harder to read corrupted backups.
.It Fl f Ar file
Read the backup from
.Ar file ;
@@ -406,9 +412,6 @@
Common errors are given below.
.Pp
.Bl -tag -width Ds -compact
-.It Converting to new file system format.
-A dump tape created from the old file system has been loaded.
-It is automatically converted to the new file system format.
.Pp
.It <filename>: not found on tape
The specified file name was listed in the tape directory,
==== //depot/projects/dtrace6/src/sbin/restore/restore.c#2 (text+ko) ====
@@ -34,7 +34,7 @@
#endif /* not lint */
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sbin/restore/restore.c,v 1.18 2005/05/29 15:57:00 charnier Exp $");
+__FBSDID("$FreeBSD: src/sbin/restore/restore.c,v 1.18.2.1 2008/06/09 07:53:16 dwmalone Exp $");
#include <sys/types.h>
@@ -687,6 +687,17 @@
*/
if (first > last)
return;
+ if (Dflag) {
+ if (curfile.ino == maxino)
+ return;
+ if((ep = lookupino(curfile.ino)) != NULL &&
+ (ep->e_flags & (NEW|EXTRACT))) {
+ goto justgetit;
+ } else {
+ skipfile();
+ continue;
+ }
+ }
/*
* Reject any volumes with inodes greater than the last
* one needed, so that we can quickly skip backwards to
@@ -749,6 +760,7 @@
ep = lookupino(next);
if (ep == NULL)
panic("corrupted symbol table\n");
+justgetit:
(void) extractfile(myname(ep));
ep->e_flags &= ~NEW;
if (volno != curvol)
==== //depot/projects/dtrace6/src/sbin/restore/restore.h#3 (text+ko) ====
@@ -32,7 +32,7 @@
* SUCH DAMAGE.
*
* @(#)restore.h 8.3 (Berkeley) 9/13/94
- * $FreeBSD: src/sbin/restore/restore.h,v 1.10.2.1 2008/05/23 18:08:31 mckusick Exp $
+ * $FreeBSD: src/sbin/restore/restore.h,v 1.10.2.2 2008/06/09 07:53:16 dwmalone Exp $
*/
/*
@@ -40,6 +40,7 @@
*/
extern int bflag; /* set input block size */
extern int dflag; /* print out debugging info */
+extern int Dflag; /* degraded mode - try hard to get stuff back */
extern int hflag; /* restore heirarchies */
extern int mflag; /* restore by name instead of inode number */
extern int Nflag; /* do not write the disk */
==== //depot/projects/dtrace6/src/sbin/restore/tape.c#3 (text+ko) ====
@@ -39,7 +39,7 @@
#endif /* not lint */
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sbin/restore/tape.c,v 1.44.2.2 2008/05/23 18:08:31 mckusick Exp $");
+__FBSDID("$FreeBSD: src/sbin/restore/tape.c,v 1.44.2.3 2008/06/09 07:53:16 dwmalone Exp $");
#include <sys/param.h>
#include <sys/file.h>
@@ -57,6 +57,7 @@
#include <limits.h>
#include <paths.h>
#include <setjmp.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -77,6 +78,7 @@
static int numtrec;
static char *tapebuf;
static union u_spcl endoftapemark;
+static long byteslide = 0;
static long blksread; /* blocks read since last header */
static int64_t tapeaddr = 0; /* current TP_BSIZE tape record */
static long tapesread;
@@ -179,12 +181,13 @@
if (size <= tapebufsize)
return;
if (tapebuf != NULL)
- free(tapebuf);
- tapebuf = malloc(size * TP_BSIZE);
+ free(tapebuf - TP_BSIZE);
+ tapebuf = malloc((size+1) * TP_BSIZE);
if (tapebuf == NULL) {
fprintf(stderr, "Cannot allocate space for tape buffer\n");
done(1);
}
+ tapebuf += TP_BSIZE;
tapebufsize = size;
}
@@ -579,7 +582,9 @@
ctimep[1].tv_sec = curfile.birthtime_sec;
ctimep[1].tv_usec = curfile.birthtime_nsec / 1000;
extsize = curfile.extsize;
- uid = curfile.uid;
+ uid = getuid();
+ if (uid == 0)
+ uid = curfile.uid;
gid = curfile.gid;
mode = curfile.mode;
flags = curfile.file_flags;
@@ -666,7 +671,7 @@
if (uflag)
(void) unlink(name);
if (mknod(name, (mode & (IFCHR | IFBLK)) | 0600,
- (int)curfile.rdev) < 0) {
+ (int)curfile.rdev) < 0) {
fprintf(stderr, "%s: cannot create special file: %s\n",
name, strerror(errno));
skipfile();
@@ -953,6 +958,15 @@
}
loop:
for (i = 0; i < spcl.c_count; i++) {
+ if (!readmapflag && i > TP_NINDIR) {
+ if (Dflag) {
+ fprintf(stderr, "spcl.c_count = %jd\n",
+ (intmax_t)spcl.c_count);
+ break;
+ } else
+ panic("spcl.c_count = %jd\n",
+ (intmax_t)spcl.c_count);
+ }
if (readmapflag || spcl.c_addr[i]) {
readtape(&buf[curblk++][0]);
if (curblk == fssize / TP_BSIZE) {
@@ -985,9 +999,20 @@
if (spcl.c_count - i > 1)
dprintf(stdout, "skipping %d junk block(s)\n",
spcl.c_count - i - 1);
- for (i++; i < spcl.c_count; i++)
+ for (i++; i < spcl.c_count; i++) {
+ if (!readmapflag && i > TP_NINDIR) {
+ if (Dflag) {
+ fprintf(stderr,
+ "spcl.c_count = %jd\n",
+ (intmax_t)spcl.c_count);
+ break;
+ } else
+ panic("spcl.c_count = %jd\n",
+ (intmax_t)spcl.c_count);
+ }
if (readmapflag || spcl.c_addr[i])
readtape(junk);
+ }
break;
}
}
@@ -1149,15 +1174,19 @@
static void
readtape(char *buf)
{
- long rd, newvol, i;
+ long rd, newvol, i, oldnumtrec;
int cnt, seek_failed;
- if (blkcnt < numtrec) {
- memmove(buf, &tapebuf[(blkcnt++ * TP_BSIZE)], (long)TP_BSIZE);
+ if (blkcnt + (byteslide > 0) < numtrec) {
+ memmove(buf, &tapebuf[(blkcnt++ * TP_BSIZE) + byteslide], (long)TP_BSIZE);
blksread++;
tapeaddr++;
return;
}
+ if (numtrec > 0)
+ memmove(&tapebuf[-TP_BSIZE],
+ &tapebuf[(numtrec-1) * TP_BSIZE], (long)TP_BSIZE);
+ oldnumtrec = numtrec;
for (i = 0; i < ntrec; i++)
((struct s_spcl *)&tapebuf[i * TP_BSIZE])->c_magic = 0;
if (numtrec == 0)
@@ -1258,8 +1287,12 @@
terminateinput();
memmove(&tapebuf[rd], &endoftapemark, (long)TP_BSIZE);
}
- blkcnt = 0;
- memmove(buf, &tapebuf[(blkcnt++ * TP_BSIZE)], (long)TP_BSIZE);
+ if (oldnumtrec == 0)
+ blkcnt = 0;
+ else
+ blkcnt -= oldnumtrec;
+ memmove(buf,
+ &tapebuf[(blkcnt++ * TP_BSIZE) + byteslide], (long)TP_BSIZE);
blksread++;
tapeaddr++;
}
@@ -1360,28 +1393,25 @@
/*
* Have to patch up missing information in bit map headers
*/
- buf->c_inumber = 0;
buf->c_size = buf->c_count * TP_BSIZE;
if (buf->c_count > TP_NINDIR)
readmapflag = 1;
else
for (i = 0; i < buf->c_count; i++)
buf->c_addr[i]++;
- break;
+ /* FALL THROUGH */
case TS_TAPE:
- if (buf->c_magic == NFS_MAGIC) {
- if ((buf->c_flags & NFS_DR_NEWINODEFMT) == 0)
- oldinofmt = 1;
- buf->c_date = _time32_to_time(buf->c_old_date);
- buf->c_ddate = _time32_to_time(buf->c_old_ddate);
- buf->c_tapea = buf->c_old_tapea;
- buf->c_firstrec = buf->c_old_firstrec;
- }
+ if (buf->c_magic == NFS_MAGIC &&
+ (buf->c_flags & NFS_DR_NEWINODEFMT) == 0)
+ oldinofmt = 1;
+ /* FALL THROUGH */
+
case TS_END:
buf->c_inumber = 0;
- break;
+ /* FALL THROUGH */
+ case TS_ADDR:
case TS_INODE:
/*
* For old dump tapes, have to copy up old fields to
@@ -1394,16 +1424,18 @@
buf->c_ddate = _time32_to_time(buf->c_old_ddate);
buf->c_atime = _time32_to_time(buf->c_old_atime);
buf->c_mtime = _time32_to_time(buf->c_old_mtime);
+ buf->c_birthtime = 0;
+ buf->c_birthtimensec = 0;
+ buf->c_extsize = 0;
}
break;
- case TS_ADDR:
- break;
-
default:
panic("gethead: unknown inode type %d\n", buf->c_type);
break;
}
+ if (dumpdate != 0 && _time64_to_time(buf->c_date) != dumpdate)
+ fprintf(stderr, "Header with wrong dumpdate.\n");
/*
* If we're restoring a filesystem with the old (FreeBSD 1)
* format inodes, copy the uid/gid to the new location
@@ -1502,8 +1534,17 @@
if (header->c_addr[i])
readtape(buf);
while (gethead(header) == FAIL ||
- _time64_to_time(header->c_date) != dumpdate)
+ _time64_to_time(header->c_date) != dumpdate) {
skipcnt++;
+ if (Dflag) {
+ byteslide++;
+ if (byteslide < TP_BSIZE) {
+ blkcnt--;
+ blksread--;
+ } else
+ byteslide = 0;
+ }
+ }
break;
case TS_INODE:
@@ -1541,18 +1582,36 @@
break;
case TS_TAPE:
- panic("unexpected tape header\n");
- /* NOTREACHED */
+ if (Dflag)
+ fprintf(stderr, "unexpected tape header\n");
+ else
+ panic("unexpected tape header\n");
default:
- panic("unknown tape header type %d\n", spcl.c_type);
- /* NOTREACHED */
+ if (Dflag)
+ fprintf(stderr, "unknown tape header type %d\n",
+ spcl.c_type);
+ else
+ panic("unknown tape header type %d\n",
+ spcl.c_type);
+ while (gethead(header) == FAIL ||
+ _time64_to_time(header->c_date) != dumpdate) {
+ skipcnt++;
+ if (Dflag) {
+ byteslide++;
+ if (byteslide < TP_BSIZE) {
+ blkcnt--;
+ blksread--;
+ } else
+ byteslide = 0;
+ }
+ }
}
} while (htype == TS_ADDR);
if (skipcnt > 0)
- fprintf(stderr, "resync restore, skipped %ld blocks\n",
- skipcnt);
+ fprintf(stderr, "resync restore, skipped %ld %s\n",
+ skipcnt, Dflag ? "bytes" : "blocks");
skipcnt = 0;
}
==== //depot/projects/dtrace6/src/share/man/man4/ciss.4#2 (text+ko) ====
@@ -1,4 +1,4 @@
-.\" $FreeBSD: src/share/man/man4/ciss.4,v 1.11.2.3 2006/12/21 08:03:03 delphij Exp $
+.\" $FreeBSD: src/share/man/man4/ciss.4,v 1.11.2.4 2008/06/10 18:31:19 ps Exp $
.\" Written by Tom Rhodes
.\" This file is in the public domain.
.\"
@@ -113,14 +113,24 @@
.It
HP Smart Array E200i
.It
+HP Smart Array P212
+.It
HP Smart Array P400
.It
HP Smart Array P400i
.It
+HP Smart Array P410
+.It
+HP Smart Array P410i
+.It
+HP Smart Array P411
+.It
HP Smart Array P600
.It
HP Smart Array P800
.It
+HP Smart Array P812
+.It
HP Modular Smart Array 20 (MSA20)
.It
HP Modular Smart Array 500 (MSA500)
==== //depot/projects/dtrace6/src/sys/dev/ciss/ciss.c#3 (text+ko) ====
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/dev/ciss/ciss.c,v 1.64.2.5 2008/05/16 08:30:25 ps Exp $
+ * $FreeBSD: src/sys/dev/ciss/ciss.c,v 1.64.2.6 2008/06/10 18:31:19 ps Exp $
*/
/*
@@ -293,6 +293,11 @@
{ 0x103C, 0x323A, CISS_BOARD_SA5, "HP Smart Array" },
{ 0x103C, 0x323B, CISS_BOARD_SA5, "HP Smart Array" },
{ 0x103C, 0x323C, CISS_BOARD_SA5, "HP Smart Array" },
+ { 0x103C, 0x3241, CISS_BOARD_SA5, "HP Smart Array P212" },
+ { 0x103C, 0x3243, CISS_BOARD_SA5, "HP Smart Array P410" },
+ { 0x103C, 0x3245, CISS_BOARD_SA5, "HP Smart Array P410i" },
+ { 0x103C, 0x3247, CISS_BOARD_SA5, "HP Smart Array P411" },
+ { 0x103C, 0x3249, CISS_BOARD_SA5, "HP Smart Array P812" },
{ 0, 0, 0, NULL }
};
==== //depot/projects/dtrace6/src/sys/dev/hme/if_hme.c#2 (text+ko) ====
@@ -34,11 +34,11 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- * from: NetBSD: hme.c,v 1.35 2003/02/27 14:58:22 pk Exp
+ * from: NetBSD: hme.c,v 1.45 2005/02/18 00:22:11 heas Exp
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/hme/if_hme.c,v 1.37.2.10 2007/09/15 10:45:34 marius Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/hme/if_hme.c,v 1.37.2.12 2008/06/11 20:38:06 marius Exp $");
/*
* HME Ethernet module driver.
@@ -61,7 +61,9 @@
* can be reactivated by setting special link option link0 with ifconfig(8).
*/
#define HME_CSUM_FEATURES (CSUM_TCP)
+#if 0
#define HMEDEBUG
+#endif
#define KTR_HME KTR_CT2 /* XXX */
#include <sys/param.h>
@@ -99,6 +101,9 @@
#include <dev/hme/if_hmereg.h>
#include <dev/hme/if_hmevar.h>
+CTASSERT(powerof2(HME_NRXDESC) && HME_NRXDESC >= 32 && HME_NRXDESC <= 256);
+CTASSERT(HME_NTXDESC % 16 == 0 && HME_NTXDESC >= 16 && HME_NTXDESC <= 256);
+
static void hme_start(struct ifnet *);
static void hme_start_locked(struct ifnet *);
static void hme_stop(struct hme_softc *);
@@ -123,7 +128,6 @@
static void hme_eint(struct hme_softc *, u_int);
static void hme_rint(struct hme_softc *);
static void hme_tint(struct hme_softc *);
-static void hme_txcksum(struct mbuf *, u_int32_t *);
static void hme_rxcksum(struct mbuf *, u_int32_t);
static void hme_cdma_callback(void *, bus_dma_segment_t *, int, int);
@@ -141,17 +145,30 @@
#define HME_SPC_WRITE_4(spc, sc, offs, v) \
bus_space_write_4((sc)->sc_ ## spc ## t, (sc)->sc_ ## spc ## h, \
(offs), (v))
+#define HME_SPC_BARRIER(spc, sc, offs, l, f) \
+ bus_space_barrier((sc)->sc_ ## spc ## t, (sc)->sc_ ## spc ## h, \
+ (offs), (l), (f))
#define HME_SEB_READ_4(sc, offs) HME_SPC_READ_4(seb, (sc), (offs))
#define HME_SEB_WRITE_4(sc, offs, v) HME_SPC_WRITE_4(seb, (sc), (offs), (v))
+#define HME_SEB_BARRIER(sc, offs, l, f) \
+ HME_SPC_BARRIER(seb, (sc), (offs), (l), (f))
#define HME_ERX_READ_4(sc, offs) HME_SPC_READ_4(erx, (sc), (offs))
#define HME_ERX_WRITE_4(sc, offs, v) HME_SPC_WRITE_4(erx, (sc), (offs), (v))
+#define HME_ERX_BARRIER(sc, offs, l, f) \
+ HME_SPC_BARRIER(erx, (sc), (offs), (l), (f))
#define HME_ETX_READ_4(sc, offs) HME_SPC_READ_4(etx, (sc), (offs))
#define HME_ETX_WRITE_4(sc, offs, v) HME_SPC_WRITE_4(etx, (sc), (offs), (v))
+#define HME_ETX_BARRIER(sc, offs, l, f) \
+ HME_SPC_BARRIER(etx, (sc), (offs), (l), (f))
#define HME_MAC_READ_4(sc, offs) HME_SPC_READ_4(mac, (sc), (offs))
#define HME_MAC_WRITE_4(sc, offs, v) HME_SPC_WRITE_4(mac, (sc), (offs), (v))
+#define HME_MAC_BARRIER(sc, offs, l, f) \
+ HME_SPC_BARRIER(mac, (sc), (offs), (l), (f))
#define HME_MIF_READ_4(sc, offs) HME_SPC_READ_4(mif, (sc), (offs))
#define HME_MIF_WRITE_4(sc, offs, v) HME_SPC_WRITE_4(mif, (sc), (offs), (v))
+#define HME_MIF_BARRIER(sc, offs, l, f) \
+ HME_SPC_BARRIER(mif, (sc), (offs), (l), (f))
#define HME_MAXERR 5
#define HME_WHINE(dev, ...) do { \
@@ -205,55 +222,52 @@
hme_stop(sc);
HME_UNLOCK(sc);
+ error = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev), 1, 0,
+ BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
+ BUS_SPACE_MAXSIZE_32BIT, 0, BUS_SPACE_MAXSIZE_32BIT, 0,
+ NULL, NULL, &sc->sc_pdmatag);
+ if (error)
+ goto fail_ifnet;
+
/*
- * Allocate DMA capable memory
+ * Create control, RX and TX mbuf DMA tags.
* Buffer descriptors must be aligned on a 2048 byte boundary;
* take this into account when calculating the size. Note that
* the maximum number of descriptors (256) occupies 2048 bytes,
* so we allocate that much regardless of HME_N*DESC.
*/
- size = 4096;
-
- error = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev), 1, 0,
- BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, size,
- HME_NTXDESC + HME_NRXDESC + 1, BUS_SPACE_MAXSIZE_32BIT, 0,
- NULL, NULL, &sc->sc_pdmatag);
- if (error)
- goto fail_ifnet;
-
+ size = 4096;
error = bus_dma_tag_create(sc->sc_pdmatag, 2048, 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, size,
- 1, BUS_SPACE_MAXSIZE_32BIT, 0, busdma_lock_mutex,
- &sc->sc_lock, &sc->sc_cdmatag);
+ 1, size, 0, busdma_lock_mutex, &sc->sc_lock, &sc->sc_cdmatag);
if (error)
goto fail_ptag;
error = bus_dma_tag_create(sc->sc_pdmatag, max(0x10, sc->sc_burst), 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES,
- HME_NRXDESC, BUS_SPACE_MAXSIZE_32BIT, BUS_DMA_ALLOCNOW,
- NULL, NULL, &sc->sc_rdmatag);
+ 1, MCLBYTES, BUS_DMA_ALLOCNOW, NULL, NULL, &sc->sc_rdmatag);
if (error)
goto fail_ctag;
error = bus_dma_tag_create(sc->sc_pdmatag, max(0x10, sc->sc_burst), 0,
- BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES,
- HME_NTXDESC, BUS_SPACE_MAXSIZE_32BIT, BUS_DMA_ALLOCNOW,
+ BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
+ MCLBYTES * HME_NTXSEGS, HME_NTXSEGS, MCLBYTES, BUS_DMA_ALLOCNOW,
NULL, NULL, &sc->sc_tdmatag);
if (error)
goto fail_rtag;
- /* Allocate control/TX DMA buffer */
+ /* Allocate the control DMA buffer. */
error = bus_dmamem_alloc(sc->sc_cdmatag, (void **)&sc->sc_rb.rb_membase,
- 0, &sc->sc_cdmamap);
+ BUS_DMA_WAITOK | BUS_DMA_COHERENT | BUS_DMA_ZERO, &sc->sc_cdmamap);
if (error != 0) {
device_printf(sc->sc_dev, "DMA buffer alloc error %d\n", error);
goto fail_ttag;
}
- /* Load the buffer */
+ /* Load the control DMA buffer. */
sc->sc_rb.rb_dmabase = 0;
if ((error = bus_dmamap_load(sc->sc_cdmatag, sc->sc_cdmamap,
- sc->sc_rb.rb_membase, size, hme_cdma_callback, sc, 0)) != 0 ||
+ sc->sc_rb.rb_membase, size, hme_cdma_callback, sc, 0)) != 0 ||
sc->sc_rb.rb_dmabase == 0) {
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list