svn commit: r189466 - head/lib/libarchive

Tim Kientzle kientzle at FreeBSD.org
Fri Mar 6 16:52:03 PST 2009


Author: kientzle
Date: Sat Mar  7 00:52:02 2009
New Revision: 189466
URL: http://svn.freebsd.org/changeset/base/189466

Log:
  Merge r552,r559 from libarchive.googlecode.com: Support high-resolution
  timestamps on Tru64, AIX, and GNU Hurd.  Thanks to Björn Jacke.

Modified:
  head/lib/libarchive/archive_entry_copy_stat.c
  head/lib/libarchive/archive_entry_stat.c
  head/lib/libarchive/archive_read_support_format_mtree.c
  head/lib/libarchive/archive_write_disk.c

Modified: head/lib/libarchive/archive_entry_copy_stat.c
==============================================================================
--- head/lib/libarchive/archive_entry_copy_stat.c	Sat Mar  7 00:36:50 2009	(r189465)
+++ head/lib/libarchive/archive_entry_copy_stat.c	Sat Mar  7 00:52:02 2009	(r189466)
@@ -43,6 +43,18 @@ archive_entry_copy_stat(struct archive_e
 	archive_entry_set_atime(entry, st->st_atime, st->st_atim.tv_nsec);
 	archive_entry_set_ctime(entry, st->st_ctime, st->st_ctim.tv_nsec);
 	archive_entry_set_mtime(entry, st->st_mtime, st->st_mtim.tv_nsec);
+#elif HAVE_STRUCT_STAT_ST_MTIME_N
+	archive_entry_set_atime(entry, st->st_atime, st->st_atime_n);
+	archive_entry_set_ctime(entry, st->st_ctime, st->st_ctime_n);
+	archive_entry_set_mtime(entry, st->st_mtime, st->st_mtime_n);
+#elif HAVE_STRUCT_STAT_ST_UMTIME
+	archive_entry_set_atime(entry, st->st_atime, st->st_uatime * 1000);
+	archive_entry_set_ctime(entry, st->st_ctime, st->st_uctime * 1000);
+	archive_entry_set_mtime(entry, st->st_mtime, st->st_umtime * 1000);
+#elif HAVE_STRUCT_STAT_ST_MTIME_USEC
+	archive_entry_set_atime(entry, st->st_atime, st->st_atime_usec * 1000);
+	archive_entry_set_ctime(entry, st->st_ctime, st->st_ctime_usec * 1000);
+	archive_entry_set_mtime(entry, st->st_mtime, st->st_mtime_usec * 1000);
 #else
 	archive_entry_set_atime(entry, st->st_atime, 0);
 	archive_entry_set_ctime(entry, st->st_ctime, 0);

Modified: head/lib/libarchive/archive_entry_stat.c
==============================================================================
--- head/lib/libarchive/archive_entry_stat.c	Sat Mar  7 00:36:50 2009	(r189465)
+++ head/lib/libarchive/archive_entry_stat.c	Sat Mar  7 00:52:02 2009	(r189466)
@@ -90,6 +90,18 @@ archive_entry_stat(struct archive_entry 
 	st->st_atim.tv_nsec = archive_entry_atime_nsec(entry);
 	st->st_ctim.tv_nsec = archive_entry_ctime_nsec(entry);
 	st->st_mtim.tv_nsec = archive_entry_mtime_nsec(entry);
+#elif HAVE_STRUCT_STAT_ST_MTIME_N
+	st->st_atime_n = archive_entry_atime_nsec(entry);
+	st->st_ctime_n = archive_entry_ctime_nsec(entry);
+	st->st_mtime_n = archive_entry_mtime_nsec(entry);
+#elif HAVE_STRUCT_STAT_ST_UMTIME
+	st->st_uatime = archive_entry_atime_nsec(entry) / 1000;
+	st->st_uctime = archive_entry_ctime_nsec(entry) / 1000;
+	st->st_umtime = archive_entry_mtime_nsec(entry) / 1000;
+#elif HAVE_STRUCT_STAT_ST_MTIME_USEC
+	st->st_atime_usec = archive_entry_atime_nsec(entry) / 1000;
+	st->st_ctime_usec = archive_entry_ctime_nsec(entry) / 1000;
+	st->st_mtime_usec = archive_entry_mtime_nsec(entry) / 1000;
 #endif
 #if HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC
 	st->st_birthtimespec.tv_nsec = archive_entry_birthtime_nsec(entry);

Modified: head/lib/libarchive/archive_read_support_format_mtree.c
==============================================================================
--- head/lib/libarchive/archive_read_support_format_mtree.c	Sat Mar  7 00:36:50 2009	(r189465)
+++ head/lib/libarchive/archive_read_support_format_mtree.c	Sat Mar  7 00:52:02 2009	(r189466)
@@ -672,6 +672,15 @@ parse_file(struct archive_read *a, struc
 #elif HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
 			archive_entry_set_mtime(entry, st->st_mtime,
 			    st->st_mtim.tv_nsec);
+#elif HAVE_STRUCT_STAT_ST_MTIME_N
+			archive_entry_set_mtime(entry, st->st_mtime,
+			    st->st_mtime_n);
+#elif HAVE_STRUCT_STAT_ST_UMTIME
+			archive_entry_set_mtime(entry, st->st_mtime,
+			    st->st_umtime*1000);
+#elif HAVE_STRUCT_STAT_ST_MTIME_USEC
+			archive_entry_set_mtime(entry, st->st_mtime,
+			    st->st_mtime_usec*1000);
 #else
 			archive_entry_set_mtime(entry, st->st_mtime, 0);
 #endif

Modified: head/lib/libarchive/archive_write_disk.c
==============================================================================
--- head/lib/libarchive/archive_write_disk.c	Sat Mar  7 00:36:50 2009	(r189465)
+++ head/lib/libarchive/archive_write_disk.c	Sat Mar  7 00:52:02 2009	(r189466)
@@ -2535,19 +2535,25 @@ older(struct stat *st, struct archive_en
 	/* Definitely older. */
 	if (st->st_mtimespec.tv_nsec < archive_entry_mtime_nsec(entry))
 		return (1);
-	/* Definitely younger. */
-	if (st->st_mtimespec.tv_nsec > archive_entry_mtime_nsec(entry))
-		return (0);
 #elif HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
 	/* Definitely older. */
 	if (st->st_mtim.tv_nsec < archive_entry_mtime_nsec(entry))
 		return (1);
-	/* Definitely older. */
-	if (st->st_mtim.tv_nsec > archive_entry_mtime_nsec(entry))
-		return (0);
+#elif HAVE_STRUCT_STAT_ST_MTIME_N
+	/* older. */
+	if (st->st_mtime_n < archive_entry_mtime_nsec(entry))
+		return (1);
+#elif HAVE_STRUCT_STAT_ST_UMTIME
+	/* older. */
+	if (st->st_umtime * 1000 < archive_entry_mtime_nsec(entry))
+		return (1);
+#elif HAVE_STRUCT_STAT_ST_MTIME_USEC
+	/* older. */
+	if (st->st_mtime_usec * 1000 < archive_entry_mtime_nsec(entry))
+		return (1);
 #else
 	/* This system doesn't have high-res timestamps. */
 #endif
-	/* Same age, so not older. */
+	/* Same age or newer, so not older. */
 	return (0);
 }


More information about the svn-src-head mailing list