PERFORCE change 149307 for review

Ed Schouten ed at FreeBSD.org
Sat Sep 6 10:26:17 UTC 2008


http://perforce.freebsd.org/chv.cgi?CH=149307

Change 149307 by ed at ed_dull on 2008/09/06 10:25:45

	IFC.
	
	Maybe this will remove the $P4$ expansion in
	sys/contrib/dev/ath/public/mipsisa32-be-elf.hal.o.uu.

Affected files ...

.. //depot/projects/mpsafetty/lib/libarchive/archive_entry_link_resolver.c#2 integrate
.. //depot/projects/mpsafetty/lib/libarchive/archive_write_disk.c#5 integrate
.. //depot/projects/mpsafetty/lib/libarchive/test/test_write_disk.c#5 integrate
.. //depot/projects/mpsafetty/lib/libarchive/test/test_write_disk_hardlink.c#4 integrate
.. //depot/projects/mpsafetty/lib/libc/regex/re_format.7#2 integrate
.. //depot/projects/mpsafetty/lib/libc/stdlib/malloc.c#6 integrate
.. //depot/projects/mpsafetty/share/man/man4/Makefile#11 integrate
.. //depot/projects/mpsafetty/share/man/man9/CTASSERT.9#2 integrate
.. //depot/projects/mpsafetty/sys/arm/at91/at91.c#3 integrate
.. //depot/projects/mpsafetty/sys/arm/at91/at91_mci.c#2 integrate
.. //depot/projects/mpsafetty/sys/arm/at91/at91_ssc.c#2 integrate
.. //depot/projects/mpsafetty/sys/arm/at91/kb920x_machdep.c#2 integrate
.. //depot/projects/mpsafetty/sys/boot/sparc64/loader/main.c#5 integrate
.. //depot/projects/mpsafetty/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c#2 integrate
.. //depot/projects/mpsafetty/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c#3 integrate
.. //depot/projects/mpsafetty/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c#2 integrate
.. //depot/projects/mpsafetty/sys/contrib/dev/ath/public/mipsisa32-be-elf.hal.o.uu#4 integrate
.. //depot/projects/mpsafetty/sys/contrib/dev/ath/public/wisoc.hal.o.uu#1 branch
.. //depot/projects/mpsafetty/sys/contrib/dev/ath/public/wisoc.inc#1 branch
.. //depot/projects/mpsafetty/sys/contrib/dev/ath/public/wisoc.opt_ah.h#1 branch
.. //depot/projects/mpsafetty/sys/dev/re/if_re.c#5 integrate
.. //depot/projects/mpsafetty/sys/dev/usb/if_zyd.c#2 integrate
.. //depot/projects/mpsafetty/sys/dev/usb/ucom.c#6 integrate
.. //depot/projects/mpsafetty/sys/dev/usb/ucomvar.h#3 integrate
.. //depot/projects/mpsafetty/sys/dev/usb/usbdevs#8 integrate
.. //depot/projects/mpsafetty/sys/geom/part/g_part.c#3 integrate
.. //depot/projects/mpsafetty/sys/geom/part/g_part.h#2 integrate
.. //depot/projects/mpsafetty/sys/geom/part/g_part_gpt.c#2 integrate
.. //depot/projects/mpsafetty/sys/i386/include/pmc_mdep.h#2 integrate
.. //depot/projects/mpsafetty/sys/kern/kern_resource.c#4 integrate
.. //depot/projects/mpsafetty/sys/kern/uipc_mbuf.c#2 integrate
.. //depot/projects/mpsafetty/sys/kern/uipc_mqueue.c#3 integrate
.. //depot/projects/mpsafetty/sys/net/route.h#2 integrate
.. //depot/projects/mpsafetty/sys/netinet/if_ether.c#5 integrate
.. //depot/projects/mpsafetty/sys/sparc64/include/cpu.h#2 integrate
.. //depot/projects/mpsafetty/sys/sparc64/include/dcr.h#1 branch
.. //depot/projects/mpsafetty/sys/sparc64/include/trap.h#2 integrate
.. //depot/projects/mpsafetty/sys/sparc64/include/tte.h#3 integrate
.. //depot/projects/mpsafetty/sys/sparc64/sparc64/cheetah.c#4 integrate
.. //depot/projects/mpsafetty/sys/sparc64/sparc64/exception.S#5 integrate
.. //depot/projects/mpsafetty/sys/sparc64/sparc64/genassym.c#3 integrate
.. //depot/projects/mpsafetty/sys/sparc64/sparc64/machdep.c#4 integrate
.. //depot/projects/mpsafetty/sys/sparc64/sparc64/mp_machdep.c#5 integrate
.. //depot/projects/mpsafetty/sys/sparc64/sparc64/pmap.c#3 integrate
.. //depot/projects/mpsafetty/sys/sparc64/sparc64/trap.c#4 integrate
.. //depot/projects/mpsafetty/sys/sys/gpt.h#2 integrate

Differences ...

==== //depot/projects/mpsafetty/lib/libarchive/archive_entry_link_resolver.c#2 (text+ko) ====

@@ -24,7 +24,7 @@
  */
 
 #include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_entry_link_resolver.c,v 1.3 2008/06/15 04:31:43 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_entry_link_resolver.c,v 1.4 2008/09/05 06:15:25 kientzle Exp $");
 
 #ifdef HAVE_SYS_STAT_H
 #include <sys/stat.h>
@@ -189,7 +189,7 @@
 	case ARCHIVE_ENTRY_LINKIFY_LIKE_TAR:
 		le = find_entry(res, *e);
 		if (le != NULL) {
-			archive_entry_set_size(*e, 0);
+			archive_entry_unset_size(*e);
 			archive_entry_copy_hardlink(*e,
 			    archive_entry_pathname(le->canonical));
 		} else
@@ -217,7 +217,7 @@
 			*e = le->entry;
 			le->entry = t;
 			/* Make the old entry into a hardlink. */
-			archive_entry_set_size(*e, 0);
+			archive_entry_unset_size(*e);
 			archive_entry_copy_hardlink(*e,
 			    archive_entry_pathname(le->canonical));
 			/* If we ran out of links, return the

==== //depot/projects/mpsafetty/lib/libarchive/archive_write_disk.c#5 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_disk.c,v 1.33 2008/09/01 02:50:24 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_disk.c,v 1.35 2008/09/05 06:13:11 kientzle Exp $");
 
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
@@ -176,7 +176,7 @@
 	int			 fd;
 	/* Current offset for writing data to the file. */
 	off_t			 offset;
-	/* Maximum size of file. */
+	/* Maximum size of file, -1 if unknown. */
 	off_t			 filesize;
 	/* Dir we were in before this restore; only for deep paths. */
 	int			 restore_pwd;
@@ -231,8 +231,9 @@
 static struct fixup_entry *sort_dir_list(struct fixup_entry *p);
 static gid_t	trivial_lookup_gid(void *, const char *, gid_t);
 static uid_t	trivial_lookup_uid(void *, const char *, uid_t);
+static ssize_t	write_data_block(struct archive_write_disk *,
+		    const char *, size_t, off_t);
 
-
 static struct archive_vtable *archive_write_disk_vtable(void);
 
 static int	_archive_write_close(struct archive *);
@@ -337,7 +338,10 @@
 	a->offset = 0;
 	a->uid = a->user_uid;
 	a->mode = archive_entry_mode(a->entry);
-	a->filesize = archive_entry_size(a->entry);
+	if (archive_entry_size_is_set(a->entry))
+		a->filesize = archive_entry_size(a->entry);
+	else
+		a->filesize = -1;
 	archive_strcpy(&(a->_name_data), archive_entry_pathname(a->entry));
 	a->name = a->_name_data.s;
 	archive_clear_error(&a->archive);
@@ -439,15 +443,25 @@
 		fe->mode = a->mode;
 	}
 
-	if (a->deferred & TODO_TIMES) {
+	if ((a->deferred & TODO_TIMES)
+		&& (archive_entry_mtime_is_set(entry)
+		    || archive_entry_atime_is_set(entry))) {
 		fe = current_fixup(a, archive_entry_pathname(entry));
 		fe->fixup |= TODO_TIMES;
-		fe->mtime = archive_entry_mtime(entry);
-		fe->mtime_nanos = archive_entry_mtime_nsec(entry);
-		fe->atime = archive_entry_atime(entry);
-		fe->atime_nanos = archive_entry_atime_nsec(entry);
-		if (fe->atime == 0 && fe->atime_nanos == 0)
+		if (archive_entry_mtime_is_set(entry)) {
+			fe->mtime = archive_entry_mtime(entry);
+			fe->mtime_nanos = archive_entry_mtime_nsec(entry);
+		} else {
+			fe->mtime = a->start_time;
+			fe->mtime_nanos = 0;
+		}
+		if (archive_entry_atime_is_set(entry)) {
+			fe->atime = archive_entry_atime(entry);
+			fe->atime_nanos = archive_entry_atime_nsec(entry);
+		} else {
 			fe->atime = a->start_time;
+			fe->atime_nanos = 0;
+		}
 	}
 
 	if (a->deferred & TODO_FFLAGS) {
@@ -486,89 +500,113 @@
 }
 
 static ssize_t
-_archive_write_data_block(struct archive *_a,
-    const void *buff, size_t size, off_t offset)
+write_data_block(struct archive_write_disk *a,
+    const char *buff, size_t size, off_t offset)
 {
-	struct archive_write_disk *a = (struct archive_write_disk *)_a;
 	ssize_t bytes_written = 0;
-	ssize_t block_size, bytes_to_write;
-	int r = ARCHIVE_OK;
+	ssize_t block_size = 0, bytes_to_write;
+	int r;
 
-	__archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC,
-	    ARCHIVE_STATE_DATA, "archive_write_disk_block");
-	if (a->fd < 0) {
-		archive_set_error(&a->archive, 0, "File not open");
+	if (a->filesize == 0 || a->fd < 0) {
+		archive_set_error(&a->archive, 0,
+		    "Attempt to write to an empty file");
 		return (ARCHIVE_WARN);
 	}
-	archive_clear_error(&a->archive);
 
 	if (a->flags & ARCHIVE_EXTRACT_SPARSE) {
 		if ((r = _archive_write_disk_lazy_stat(a)) != ARCHIVE_OK)
 			return (r);
 		block_size = a->pst->st_blksize;
-	} else
-		block_size = -1;
+	}
 
-	if ((off_t)(offset + size) > a->filesize) {
-		size = (size_t)(a->filesize - a->offset);
-		archive_set_error(&a->archive, 0,
-		    "Write request too large");
-		r = ARCHIVE_WARN;
-	}
+	if (a->filesize >= 0 && (off_t)(offset + size) > a->filesize)
+		size = (size_t)(a->filesize - offset);
 
 	/* Write the data. */
 	while (size > 0) {
-		if (block_size != -1) {
-			const char *buf;
+		if (block_size == 0) {
+			bytes_to_write = size;
+		} else {
+			/* We're sparsifying the file. */
+			const char *p, *end;
+			off_t block_end;
 
-			for (buf = buff; size; ++buf, --size, ++offset) {
-				if (*buf != '\0')
+			/* Skip leading zero bytes. */
+			for (p = buff, end = buff + size; p < end; ++p) {
+				if (*p != '\0')
 					break;
 			}
+			offset += p - buff;
+			size -= p - buff;
+			buff = p;
 			if (size == 0)
 				break;
-			bytes_to_write = block_size - offset % block_size;
-			buff = buf;
-		} else
+
+			/* Calculate next block boundary after offset. */
+			block_end
+			    = (offset / block_size) * block_size + block_size;
+
+			/* If the adjusted write would cross block boundary,
+			 * truncate it to the block boundary. */
 			bytes_to_write = size;
+			if (offset + bytes_to_write > block_end)
+				bytes_to_write = block_end - offset;
+		}
+
 		/* Seek if necessary to the specified offset. */
 		if (offset != a->last_offset) {
 			if (lseek(a->fd, offset, SEEK_SET) < 0) {
-				archive_set_error(&a->archive, errno, "Seek failed");
+				archive_set_error(&a->archive, errno,
+				    "Seek failed");
 				return (ARCHIVE_FATAL);
 			}
  		}
-		bytes_written = write(a->fd, buff, size);
+		bytes_written = write(a->fd, buff, bytes_to_write);
 		if (bytes_written < 0) {
 			archive_set_error(&a->archive, errno, "Write failed");
 			return (ARCHIVE_WARN);
 		}
-		buff = (const char *)buff + bytes_written;
+		buff += bytes_written;
 		size -= bytes_written;
 		offset += bytes_written;
 		a->archive.file_position += bytes_written;
 		a->archive.raw_position += bytes_written;
 		a->last_offset = a->offset = offset;
 	}
-	a->offset = offset;
-	return (r);
+	return (bytes_written);
+}
+
+static ssize_t
+_archive_write_data_block(struct archive *_a,
+    const void *buff, size_t size, off_t offset)
+{
+	struct archive_write_disk *a = (struct archive_write_disk *)_a;
+	ssize_t r;
+
+	__archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC,
+	    ARCHIVE_STATE_DATA, "archive_write_disk_block");
+
+	r = write_data_block(a, buff, size, offset);
+
+	if (r < 0)
+		return (r);
+	if ((size_t)r < size) {
+		archive_set_error(&a->archive, 0,
+		    "Write request too large");
+		return (ARCHIVE_WARN);
+	}
+	return (ARCHIVE_OK);
 }
 
 static ssize_t
 _archive_write_data(struct archive *_a, const void *buff, size_t size)
 {
 	struct archive_write_disk *a = (struct archive_write_disk *)_a;
-	int r;
 
 	__archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC,
 	    ARCHIVE_STATE_DATA, "archive_write_data");
-	if (a->fd < 0)
-		return (ARCHIVE_OK);
 
-	r = _archive_write_data_block(_a, buff, size, a->offset);
-	if (r < ARCHIVE_OK)
-		return (r);
-	return size;
+	return (write_data_block(a, buff, size, a->offset));
 }
 
 static int
@@ -584,7 +622,15 @@
 		return (ARCHIVE_OK);
 	archive_clear_error(&a->archive);
 
-	if (a->last_offset != a->filesize && a->fd >= 0) {
+	/* Pad or truncate file to the right size. */
+	if (a->fd < 0) {
+		/* There's no file. */
+	} else if (a->filesize < 0) {
+		/* File size is unknown, so we can't set the size. */
+	} else if (a->last_offset == a->filesize) {
+		/* Last write ended at exactly the filesize; we're done. */
+		/* Hopefully, this is the common case. */
+	} else {
 		if (ftruncate(a->fd, a->filesize) == -1 &&
 		    a->filesize == 0) {
 			archive_set_error(&a->archive, errno,
@@ -601,7 +647,8 @@
 		if (a->st.st_size != a->filesize) {
 			const char nul = '\0';
 			if (lseek(a->fd, a->st.st_size - 1, SEEK_SET) < 0) {
-				archive_set_error(&a->archive, errno, "Seek failed");
+				archive_set_error(&a->archive, errno,
+				    "Seek failed");
 				return (ARCHIVE_FATAL);
 			}
 			if (write(a->fd, &nul, 1) < 0) {
@@ -609,6 +656,7 @@
 				    "Write to restore size failed");
 				return (ARCHIVE_FATAL);
 			}
+			a->pst = NULL;
 		}
 	}
 
@@ -963,7 +1011,7 @@
 		 * If the hardlink does carry data, let the last
 		 * archive entry decide ownership.
 		 */
-		if (r == 0 && a->filesize == 0) {
+		if (r == 0 && a->filesize <= 0) {
 			a->todo = 0;
 			a->deferred = 0;
 		} if (r == 0 && a->filesize > 0) {
@@ -1623,18 +1671,31 @@
 {
 	struct timeval times[2];
 
-	times[1].tv_sec = archive_entry_mtime(a->entry);
-	times[1].tv_usec = archive_entry_mtime_nsec(a->entry) / 1000;
+	/* If no time was provided, we're done. */
+	if (!archive_entry_atime_is_set(a->entry)
+	    && !archive_entry_mtime_is_set(a->entry))
+		return (ARCHIVE_OK);
 
-	times[0].tv_sec = archive_entry_atime(a->entry);
-	times[0].tv_usec = archive_entry_atime_nsec(a->entry) / 1000;
+	/* We know at least one is set, so... */
+	if (archive_entry_mtime_is_set(a->entry)) {
+		times[1].tv_sec = archive_entry_mtime(a->entry);
+		times[1].tv_usec = archive_entry_mtime_nsec(a->entry) / 1000;
+	} else {
+		times[1].tv_sec = a->start_time;
+		times[1].tv_usec = 0;
+	}
 
 	/* If no atime was specified, use start time instead. */
 	/* In theory, it would be marginally more correct to use
 	 * time(NULL) here, but that would cost us an extra syscall
 	 * for little gain. */
-	if (times[0].tv_sec == 0 && times[0].tv_usec == 0)
+	if (archive_entry_atime_is_set(a->entry)) {
+		times[0].tv_sec = archive_entry_atime(a->entry);
+		times[0].tv_usec = archive_entry_atime_nsec(a->entry) / 1000;
+	} else {
 		times[0].tv_sec = a->start_time;
+		times[0].tv_usec = 0;
+	}
 
 #ifdef HAVE_FUTIMES
 	if (a->fd >= 0 && futimes(a->fd, times) == 0) {
@@ -1672,10 +1733,24 @@
 {
 	struct utimbuf times;
 
-	times.modtime = archive_entry_mtime(a->entry);
-	times.actime = archive_entry_atime(a->entry);
-	if (times.actime == 0)
+	/* If no time was provided, we're done. */
+	if (!archive_entry_atime_is_set(a->entry)
+	    && !archive_entry_mtime_is_set(a->entry))
+		return (ARCHIVE_OK);
+
+	/* We know at least one is set, so... */
+	/* Set mtime from mtime if set, else start time. */
+	if (archive_entry_mtime_is_set(a->entry))
+		times.modtime = archive_entry_mtime(a->entry);
+	else
+		times.modtime = a->start_time;
+
+	/* Set atime from provided atime, else mtime. */
+	if (archive_entry_atime_is_set(a->entry))
+		times.actime = archive_entry_atime(a->entry);
+	else
 		times.actime = a->start_time;
+
 	if (!S_ISLNK(a->mode) && utime(a->name, &times) != 0) {
 		archive_set_error(&a->archive, errno,
 		    "Can't update time for %s", a->name);

==== //depot/projects/mpsafetty/lib/libarchive/test/test_write_disk.c#5 (text+ko) ====

@@ -23,7 +23,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 #include "test.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_disk.c,v 1.13 2008/09/01 05:38:33 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_disk.c,v 1.14 2008/09/05 06:13:11 kientzle Exp $");
 
 #if ARCHIVE_VERSION_NUMBER >= 1009000
 
@@ -84,7 +84,7 @@
 	 * the entry being a maximum size.
 	 */
 	archive_entry_set_size(ae, sizeof(data));
-        archive_entry_set_mtime(ae, 123456789, 0);
+	archive_entry_set_mtime(ae, 123456789, 0);
 	assertEqualIntA(ad, 0, archive_write_header(ad, ae));
 	assertEqualInt(sizeof(data), archive_write_data(ad, data, sizeof(data)));
 	assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
@@ -152,8 +152,63 @@
 	free(compare);
 	free(data);
 }
+
+static void create_reg_file3(struct archive_entry *ae, const char *msg)
+{
+	static const char data[]="abcdefghijklmnopqrstuvwxyz";
+	struct archive *ad;
+	struct stat st;
+
+	/* Write the entry to disk. */
+	assert((ad = archive_write_disk_new()) != NULL);
+	failure("%s", msg);
+	/* Set the size smaller than the data and verify the truncation. */
+	archive_entry_set_size(ae, 5);
+	assertEqualIntA(ad, 0, archive_write_header(ad, ae));
+	assertEqualInt(5, archive_write_data(ad, data, sizeof(data)));
+	assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+	archive_write_finish(ad);
+#else
+	assertEqualInt(0, archive_write_finish(ad));
 #endif
+	/* Test the entry on disk. */
+	assert(0 == stat(archive_entry_pathname(ae), &st));
+	failure("st.st_mode=%o archive_entry_mode(ae)=%o",
+	    st.st_mode, archive_entry_mode(ae));
+	assertEqualInt(st.st_mode, (archive_entry_mode(ae) & ~UMASK));
+	assertEqualInt(st.st_size, 5);
+}
+
+
+static void create_reg_file4(struct archive_entry *ae, const char *msg)
+{
+	static const char data[]="abcdefghijklmnopqrstuvwxyz";
+	struct archive *ad;
+	struct stat st;
 
+	/* Write the entry to disk. */
+	assert((ad = archive_write_disk_new()) != NULL);
+	/* Leave the size unset.  The data should not be truncated. */
+	assertEqualIntA(ad, 0, archive_write_header(ad, ae));
+	assertEqualInt(ARCHIVE_OK,
+	    archive_write_data_block(ad, data, sizeof(data), 0));
+	assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+	archive_write_finish(ad);
+#else
+	assertEqualInt(0, archive_write_finish(ad));
+#endif
+	/* Test the entry on disk. */
+	assert(0 == stat(archive_entry_pathname(ae), &st));
+	failure("st.st_mode=%o archive_entry_mode(ae)=%o",
+	    st.st_mode, archive_entry_mode(ae));
+	assertEqualInt(st.st_mode, (archive_entry_mode(ae) & ~UMASK));
+	failure(msg);
+	assertEqualInt(st.st_size, sizeof(data));
+}
+#endif
+
 DEFINE_TEST(test_write_disk)
 {
 #if ARCHIVE_VERSION_NUMBER < 1009000
@@ -178,6 +233,20 @@
 	create_reg_file2(ae, "Test creating another regular file");
 	archive_entry_free(ae);
 
+	/* A regular file with a size restriction */
+	assert((ae = archive_entry_new()) != NULL);
+	archive_entry_copy_pathname(ae, "file3");
+	archive_entry_set_mode(ae, S_IFREG | 0755);
+	create_reg_file3(ae, "Regular file with size restriction");
+	archive_entry_free(ae);
+
+	/* A regular file with an unspecified size */
+	assert((ae = archive_entry_new()) != NULL);
+	archive_entry_copy_pathname(ae, "file3");
+	archive_entry_set_mode(ae, S_IFREG | 0755);
+	create_reg_file4(ae, "Regular file with unspecified size");
+	archive_entry_free(ae);
+
 	/* A regular file over an existing file */
 	assert((ae = archive_entry_new()) != NULL);
 	archive_entry_copy_pathname(ae, "file");

==== //depot/projects/mpsafetty/lib/libarchive/test/test_write_disk_hardlink.c#4 (text+ko) ====

@@ -23,7 +23,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 #include "test.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_disk_hardlink.c,v 1.4 2008/09/01 05:38:33 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_disk_hardlink.c,v 1.5 2008/09/05 06:13:11 kientzle Exp $");
 
 #define UMASK 022
 
@@ -61,18 +61,48 @@
 	archive_entry_set_mode(ae, S_IFREG | 0755);
 	archive_entry_set_size(ae, sizeof(data));
 	assertEqualIntA(ad, 0, archive_write_header(ad, ae));
-	assertEqualInt(sizeof(data), archive_write_data(ad, data, sizeof(data)));
+	assertEqualInt(sizeof(data),
+	    archive_write_data(ad, data, sizeof(data)));
 	assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
 	archive_entry_free(ae);
 
-	/* Link. */
+	/* Link.  Size of zero means this doesn't carry data. */
 	assert((ae = archive_entry_new()) != NULL);
 	archive_entry_copy_pathname(ae, "link1b");
-	archive_entry_set_mode(ae, S_IFREG | 0600);
+	archive_entry_set_mode(ae, S_IFREG | 0642);
 	archive_entry_set_size(ae, 0);
 	archive_entry_copy_hardlink(ae, "link1a");
 	assertEqualIntA(ad, 0, archive_write_header(ad, ae));
-	assertEqualInt(0, archive_write_data(ad, data, sizeof(data)));
+	assertEqualInt(ARCHIVE_WARN,
+	    archive_write_data(ad, data, sizeof(data)));
+	assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
+	archive_entry_free(ae);
+
+	/*
+	 * Repeat tar approach test, but use unset to mark the
+	 * hardlink as having no data.
+	 */
+
+	/* Regular file. */
+	assert((ae = archive_entry_new()) != NULL);
+	archive_entry_copy_pathname(ae, "link2a");
+	archive_entry_set_mode(ae, S_IFREG | 0755);
+	archive_entry_set_size(ae, sizeof(data));
+	assertEqualIntA(ad, 0, archive_write_header(ad, ae));
+	assertEqualInt(sizeof(data),
+	    archive_write_data(ad, data, sizeof(data)));
+	assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
+	archive_entry_free(ae);
+
+	/* Link.  Unset size means this doesn't carry data. */
+	assert((ae = archive_entry_new()) != NULL);
+	archive_entry_copy_pathname(ae, "link2b");
+	archive_entry_set_mode(ae, S_IFREG | 0642);
+	archive_entry_unset_size(ae);
+	archive_entry_copy_hardlink(ae, "link2a");
+	assertEqualIntA(ad, 0, archive_write_header(ad, ae));
+	assertEqualInt(ARCHIVE_WARN,
+	    archive_write_data(ad, data, sizeof(data)));
 	assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
 	archive_entry_free(ae);
 
@@ -83,7 +113,7 @@
 
 	/* Regular file. */
 	assert((ae = archive_entry_new()) != NULL);
-	archive_entry_copy_pathname(ae, "link2a");
+	archive_entry_copy_pathname(ae, "link3a");
 	archive_entry_set_mode(ae, S_IFREG | 0600);
 	archive_entry_set_size(ae, sizeof(data));
 	assertEqualIntA(ad, 0, archive_write_header(ad, ae));
@@ -93,10 +123,10 @@
 
 	/* Link. */
 	assert((ae = archive_entry_new()) != NULL);
-	archive_entry_copy_pathname(ae, "link2b");
+	archive_entry_copy_pathname(ae, "link3b");
 	archive_entry_set_mode(ae, S_IFREG | 0755);
 	archive_entry_set_size(ae, sizeof(data));
-	archive_entry_copy_hardlink(ae, "link2a");
+	archive_entry_copy_hardlink(ae, "link3a");
 	assertEqualIntA(ad, 0, archive_write_header(ad, ae));
 	assertEqualInt(sizeof(data), archive_write_data(ad, data, sizeof(data)));
 	assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
@@ -109,7 +139,7 @@
 
 	/* Regular file. */
 	assert((ae = archive_entry_new()) != NULL);
-	archive_entry_copy_pathname(ae, "link3a");
+	archive_entry_copy_pathname(ae, "link4a");
 	archive_entry_set_mode(ae, S_IFREG | 0600);
 	archive_entry_set_size(ae, 0);
 	assertEqualIntA(ad, 0, archive_write_header(ad, ae));
@@ -123,10 +153,10 @@
 
 	/* Link. */
 	assert((ae = archive_entry_new()) != NULL);
-	archive_entry_copy_pathname(ae, "link3b");
+	archive_entry_copy_pathname(ae, "link4b");
 	archive_entry_set_mode(ae, S_IFREG | 0755);
 	archive_entry_set_size(ae, sizeof(data));
-	archive_entry_copy_hardlink(ae, "link3a");
+	archive_entry_copy_hardlink(ae, "link4a");
 	assertEqualIntA(ad, 0, archive_write_header(ad, ae));
 	assertEqualInt(sizeof(data), archive_write_data(ad, data, sizeof(data)));
 	assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
@@ -138,36 +168,63 @@
 #endif
 
 	/* Test the entries on disk. */
+
+	/* Test #1 */
 	assert(0 == stat("link1a", &st));
+	/* If the hardlink was successfully created and the archive
+	 * doesn't carry data for it, we consider it to be
+	 * non-authoritive for meta data as well.  This is consistent
+	 * with GNU tar and BSD pax.  */
 	assertEqualInt(st.st_mode, (S_IFREG | 0755) & ~UMASK);
 	assertEqualInt(st.st_size, sizeof(data));
 	assertEqualInt(st.st_nlink, 2);
 
 	assert(0 == stat("link1b", &st2));
-	assertEqualInt(st2.st_mode, (S_IFREG | 0755) & ~UMASK);
-	assertEqualInt(st2.st_size, sizeof(data));
-	assertEqualInt(st2.st_nlink, 2);
+	assertEqualInt(st.st_mode, st2.st_mode);
+	assertEqualInt(st.st_size, st2.st_size);
+	assertEqualInt(st.st_nlink, st2.st_nlink);
 	assertEqualInt(st.st_ino, st2.st_ino);
 	assertEqualInt(st.st_dev, st2.st_dev);
 
+	/* Test #2: Should produce identical results to test #1 */
+	/* Note that marking a hardlink with size = 0 is treated the
+	 * same as having an unset size.  This is partly for backwards
+	 * compatibility (we used to not have unset tracking, so
+	 * relied on size == 0) and partly to match the model used by
+	 * common file formats that store a size of zero for
+	 * hardlinks. */
 	assert(0 == stat("link2a", &st));
 	assertEqualInt(st.st_mode, (S_IFREG | 0755) & ~UMASK);
 	assertEqualInt(st.st_size, sizeof(data));
 	assertEqualInt(st.st_nlink, 2);
 
 	assert(0 == stat("link2b", &st2));
+	assertEqualInt(st.st_mode, st2.st_mode);
+	assertEqualInt(st.st_size, st2.st_size);
+	assertEqualInt(st.st_nlink, st2.st_nlink);
+	assertEqualInt(st.st_ino, st2.st_ino);
+	assertEqualInt(st.st_dev, st2.st_dev);
+
+	/* Test #3 */
+	assert(0 == stat("link3a", &st));
+	assertEqualInt(st.st_mode, (S_IFREG | 0755) & ~UMASK);
+	assertEqualInt(st.st_size, sizeof(data));
+	assertEqualInt(st.st_nlink, 2);
+
+	assert(0 == stat("link3b", &st2));
 	assertEqualInt(st2.st_mode, (S_IFREG | 0755) & ~UMASK);
 	assertEqualInt(st2.st_size, sizeof(data));
 	assertEqualInt(st2.st_nlink, 2);
 	assertEqualInt(st.st_ino, st2.st_ino);
 	assertEqualInt(st.st_dev, st2.st_dev);
 
-	assert(0 == stat("link3a", &st));
+	/* Test #4 */
+	assert(0 == stat("link4a", &st));
 	assertEqualInt(st.st_mode, (S_IFREG | 0755) & ~UMASK);
 	assertEqualInt(st.st_size, sizeof(data));
 	assertEqualInt(st.st_nlink, 2);
 
-	assert(0 == stat("link3b", &st2));
+	assert(0 == stat("link4b", &st2));
 	assertEqualInt(st2.st_mode, (S_IFREG | 0755) & ~UMASK);
 	assertEqualInt(st2.st_size, sizeof(data));
 	assertEqualInt(st2.st_nlink, 2);

==== //depot/projects/mpsafetty/lib/libc/regex/re_format.7#2 (text+ko) ====

@@ -34,7 +34,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)re_format.7	8.3 (Berkeley) 3/20/94
-.\" $FreeBSD: src/lib/libc/regex/re_format.7,v 1.11 2004/07/02 23:52:12 ru Exp $
+.\" $FreeBSD: src/lib/libc/regex/re_format.7,v 1.12 2008/09/05 17:41:20 keramida Exp $
 .\"
 .Dd March 20, 1994
 .Dt RE_FORMAT 7
@@ -288,6 +288,14 @@
 A locale may provide others.
 A character class may not be used as an endpoint of a range.
 .Pp
+A bracketed expression like
+.Ql [[:class:]]
+can be used to match a single character that belongs to a character
+class.
+The reverse, matching any character that does not belong to a specific
+class, the negation operator of bracket expressions may be used:
+.Ql [^[:class:]] .
+.Pp
 There are two special cases\(dd of bracket expressions:
 the bracket expressions
 .Ql [[:<:]]

==== //depot/projects/mpsafetty/lib/libc/stdlib/malloc.c#6 (text+ko) ====

@@ -156,7 +156,7 @@
 #define	MALLOC_DSS
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/malloc.c,v 1.177 2008/08/27 02:00:53 jasone Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/stdlib/malloc.c,v 1.178 2008/09/06 05:26:31 marcel Exp $");
 
 #include "libc_private.h"
 #ifdef MALLOC_DEBUG
@@ -226,7 +226,7 @@
 #  define CPU_SPINWAIT		__asm__ volatile("pause")
 #endif
 #ifdef __ia64__
-#  define PAGESIZE_2POW		12
+#  define PAGESIZE_2POW		13
 #  define QUANTUM_2POW		4
 #  define SIZEOF_PTR_2POW	3
 #endif

==== //depot/projects/mpsafetty/share/man/man4/Makefile#11 (text+ko) ====

@@ -1,5 +1,5 @@
 #	@(#)Makefile	8.1 (Berkeley) 6/18/93
-# $FreeBSD: src/share/man/man4/Makefile,v 1.430 2008/08/25 02:05:04 imp Exp $
+# $FreeBSD: src/share/man/man4/Makefile,v 1.431 2008/09/04 20:45:36 brueffer Exp $
 
 MAN=	aac.4 \
 	acpi.4 \
@@ -148,6 +148,7 @@
 	iwi.4 \
 	iwn.4 \
 	ixgb.4 \
+	ixgbe.4 \
 	jme.4 \
 	joy.4 \
 	${_k8temp.4} \
@@ -492,6 +493,7 @@
 MLINKS+=ipw.4 if_ipw.4
 MLINKS+=iwi.4 if_iwi.4
 MLINKS+=ixgb.4 if_ixgb.4
+MLINKS+=ixgbe.4 if_ixgbe.4
 MLINKS+=kue.4 if_kue.4
 MLINKS+=lagg.4 trunk.4
 MLINKS+=le.4 if_le.4

==== //depot/projects/mpsafetty/share/man/man9/CTASSERT.9#2 (text+ko) ====

@@ -24,9 +24,9 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $FreeBSD: src/share/man/man9/CTASSERT.9,v 1.2 2003/05/30 21:13:32 ru Exp $
+.\" $FreeBSD: src/share/man/man9/CTASSERT.9,v 1.3 2008/09/05 15:24:54 emaste Exp $
 .\"
-.Dd May 15, 2003
+.Dd September 5, 2008
 .Os
 .Dt CTASSERT 9
 .Sh NAME
@@ -48,6 +48,14 @@
 macro is useful for asserting the size or alignment of important
 data structures and variables during compilation, which would
 otherwise cause the code to fail at run time.
+.Sh IMPLEMENTATION NOTES
+The
+.Fn CTASSERT
+macro should not be used in a header file.
+It is implemented using a dummy typedef, with a name (based on line number)
+that may conflict with a
+.Fn CTASSERT
+in a source file including that header.
 .Sh EXAMPLES
 Assert that the size of the
 .Vt uuid

==== //depot/projects/mpsafetty/sys/arm/at91/at91.c#3 (text) ====

@@ -23,7 +23,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/arm/at91/at91.c,v 1.17 2008/08/19 22:15:14 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/arm/at91/at91.c,v 1.18 2008/09/05 22:27:10 imp Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -458,10 +458,6 @@
 	sc->sc_irq_rman.rm_descr = "AT91 IRQs";
 	sc->sc_mem_rman.rm_type = RMAN_ARRAY;
 	sc->sc_mem_rman.rm_descr = "AT91 Memory";
-#if 0
-	sc->sc_usbmem_rman.rm_type = RMAN_ARRAY;
-	sc->sc_usbmem_rman.rm_descr = "AT91RM9200 USB Memory-mapped regs";
-#endif
 	if (rman_init(&sc->sc_irq_rman) != 0 ||
 	    rman_manage_region(&sc->sc_irq_rman, 1, 31) != 0)
 		panic("at91_attach: failed to set up IRQ rman");
@@ -536,14 +532,8 @@
 		    start, end, count, flags, child);
 		break;
 	case SYS_RES_MEMORY:
-#if 0
-		if (start >= 0x00300000 && start <= 0x003fffff)
-			rle->res = rman_reserve_resource(&sc->sc_usbmem_rman,
-			    start, end, count, flags, child);
-		else
-#endif
-			rle->res = rman_reserve_resource(&sc->sc_mem_rman,
-			    start, end, count, flags, child);
+		rle->res = rman_reserve_resource(&sc->sc_mem_rman,
+		    start, end, count, flags, child);
 		rman_set_bustag(rle->res, &at91_bs_tag);
 		rman_set_bushandle(rle->res, start);
 		break;

==== //depot/projects/mpsafetty/sys/arm/at91/at91_mci.c#2 (text+ko) ====

@@ -24,7 +24,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/arm/at91/at91_mci.c,v 1.4 2007/09/16 07:48:58 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/arm/at91/at91_mci.c,v 1.5 2008/09/05 22:30:59 imp Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -298,14 +298,7 @@
 	else
 		WR4(sc, MCI_SDCR, RD4(sc, MCI_SDCR) & ~MCI_SDCR_SDCBUS);
 	WR4(sc, MCI_MR, (RD4(sc, MCI_MR) & ~MCI_MR_CLKDIV) | clkdiv);
-#if 0
-	if (sc->vcc_pin) {
-		if (sc->power_mode == MMC_POWER_OFF)
-			gpio_set(sc->vcc_pin, 0);
-		else
-			gpio_set(sc->vcc_pin, 1);
-	}
-#endif
+	/* XXX We need to turn the device on/off here with a GPIO pin */
 	return (0);
 }
 

==== //depot/projects/mpsafetty/sys/arm/at91/at91_ssc.c#2 (text) ====

@@ -23,7 +23,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/arm/at91/at91_ssc.c,v 1.4 2007/02/23 12:18:27 piso Exp $");
+__FBSDID("$FreeBSD: src/sys/arm/at91/at91_ssc.c,v 1.5 2008/09/05 22:29:50 imp Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -209,16 +209,6 @@
 at91_ssc_intr(void *xsc)
 {
 	struct at91_ssc_softc *sc = xsc;
-#if 0
-	uint32_t status;
-
-	/* Reading the status also clears the interrupt */
-	status = RD4(sc, SSC_SR);
-	if (status == 0)
-		return;
-	AT91_SSC_LOCK(sc);
-	AT91_SSC_UNLOCK(sc);
-#endif
 	wakeup(sc);
 	return;
 }
@@ -232,9 +222,6 @@
 	AT91_SSC_LOCK(sc);
 	if (!(sc->flags & OPENED)) {
 		sc->flags |= OPENED;
-#if 0
-	// Enable interrupts
-#endif
 	}
 	AT91_SSC_UNLOCK(sc);
     	return (0);
@@ -248,9 +235,6 @@
 	sc = CDEV2SOFTC(dev);
 	AT91_SSC_LOCK(sc);
 	sc->flags &= ~OPENED;
-#if 0
-	// Disable interrupts
-#endif
 	AT91_SSC_UNLOCK(sc);
 	return (0);
 }

==== //depot/projects/mpsafetty/sys/arm/at91/kb920x_machdep.c#2 (text) ====

@@ -47,7 +47,7 @@
 #include "opt_at91.h"
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/arm/at91/kb920x_machdep.c,v 1.30 2008/04/03 16:44:49 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/arm/at91/kb920x_machdep.c,v 1.31 2008/09/05 22:23:41 imp Exp $");
 
 #define _ARM32_BUS_DMA_PRIVATE
 #include <sys/param.h>
@@ -164,7 +164,6 @@
 	 * initialization is done. However, the AT91 resource allocation
 	 * system doesn't know how to use pmap_mapdev() yet.
 	 */
-#if 1
 	{
 		/*
 		 * Add the ohci controller, and anything else that might be
@@ -176,7 +175,6 @@
 		VM_PROT_READ|VM_PROT_WRITE,                             
 		PTE_NOCACHE,
 	},
-#endif
 	{
 		0,
 		0,

==== //depot/projects/mpsafetty/sys/boot/sparc64/loader/main.c#5 (text+ko) ====

@@ -8,7 +8,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/boot/sparc64/loader/main.c,v 1.35 2008/08/30 16:03:22 marius Exp $");
+__FBSDID("$FreeBSD: src/sys/boot/sparc64/loader/main.c,v 1.36 2008/09/04 19:41:54 marius Exp $");
 
 /*
  * FreeBSD/sparc64 kernel loader - machine dependent part
@@ -396,36 +396,44 @@
 static vm_offset_t
 dtlb_va_to_pa_sun4u(vm_offset_t va)
 {
-	u_long reg;
+	u_long pstate, reg;
 	int i;
 
+	pstate = rdpr(pstate);
+	wrpr(pstate, pstate & ~PSTATE_IE, 0);
 	for (i = 0; i < dtlb_slot_max; i++) {
 		reg = ldxa(TLB_DAR_SLOT(i), ASI_DTLB_TAG_READ_REG);
 		if (TLB_TAR_VA(reg) != va)
 			continue;
 		reg = dtlb_get_data_sun4u(i);
+		wrpr(pstate, pstate, 0);
 		if (cpu_impl >= CPU_IMPL_ULTRASPARCIII)
 			return ((reg & TD_PA_CH_MASK) >> TD_PA_SHIFT);
 		return ((reg & TD_PA_SF_MASK) >> TD_PA_SHIFT);
 	}
+	wrpr(pstate, pstate, 0);
 	return (-1);
 }
 
 static vm_offset_t
 itlb_va_to_pa_sun4u(vm_offset_t va)
 {
-	u_long reg;
+	u_long pstate, reg;
 	int i;
 
+	pstate = rdpr(pstate);

>>> TRUNCATED FOR MAIL (1000 lines) <<<


More information about the p4-projects mailing list