Date: Sat, 15 Mar 2008 06:52:03 GMT From: Kip Macy <kmacy@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 137778 for review Message-ID: <200803150652.m2F6q3f1089273@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=137778 Change 137778 by kmacy@pandemonium:kmacy:iwarp on 2008/03/15 06:51:07 IFC 137757 Affected files ... .. //depot/projects/iwarp/lib/libarchive/Makefile#3 integrate .. //depot/projects/iwarp/lib/libarchive/archive.h.in#3 integrate .. //depot/projects/iwarp/lib/libarchive/archive_entry.3#3 integrate .. //depot/projects/iwarp/lib/libarchive/archive_entry.c#4 integrate .. //depot/projects/iwarp/lib/libarchive/archive_entry.h#3 integrate .. //depot/projects/iwarp/lib/libarchive/archive_read_support_format_tar.c#5 integrate .. //depot/projects/iwarp/lib/libarchive/archive_string.h#2 integrate .. //depot/projects/iwarp/lib/libarchive/archive_string_sprintf.c#2 integrate .. //depot/projects/iwarp/lib/libarchive/archive_util.c#3 integrate .. //depot/projects/iwarp/lib/libarchive/archive_write.c#2 integrate .. //depot/projects/iwarp/lib/libarchive/archive_write_set_compression_compress.c#1 branch .. //depot/projects/iwarp/lib/libarchive/test/Makefile#5 integrate .. //depot/projects/iwarp/lib/libarchive/test/test_archive_api_feature.c#2 integrate .. //depot/projects/iwarp/lib/libarchive/test/test_entry.c#3 integrate .. //depot/projects/iwarp/lib/libarchive/test/test_write_compress.c#1 branch .. //depot/projects/iwarp/lib/libpmc/pmc.3#4 integrate .. //depot/projects/iwarp/share/man/man9/Makefile#10 integrate .. //depot/projects/iwarp/share/man/man9/stack.9#2 integrate .. //depot/projects/iwarp/sys/amd64/amd64/intr_machdep.c#4 integrate .. //depot/projects/iwarp/sys/amd64/include/intr_machdep.h#2 integrate .. //depot/projects/iwarp/sys/arm/arm/intr.c#2 integrate .. //depot/projects/iwarp/sys/dev/aac/aac.c#6 integrate .. //depot/projects/iwarp/sys/dev/hwpmc/pmc_events.h#2 integrate .. //depot/projects/iwarp/sys/dev/usb/usb_quirks.c#3 integrate .. //depot/projects/iwarp/sys/dev/usb/usbdevs#11 integrate .. //depot/projects/iwarp/sys/i386/i386/intr_machdep.c#4 edit .. //depot/projects/iwarp/sys/i386/include/intr_machdep.h#2 integrate .. //depot/projects/iwarp/sys/ia64/ia64/interrupt.c#3 integrate .. //depot/projects/iwarp/sys/kern/kern_intr.c#6 integrate .. //depot/projects/iwarp/sys/kern/sched_ule.c#8 integrate .. //depot/projects/iwarp/sys/netinet/ip_ipsec.c#2 integrate .. //depot/projects/iwarp/sys/netinet6/ip6_ipsec.c#3 integrate .. //depot/projects/iwarp/sys/netinet6/ip6_ipsec.h#3 integrate .. //depot/projects/iwarp/sys/netinet6/ip6_output.c#6 integrate .. //depot/projects/iwarp/sys/netipsec/ipsec_output.c#3 integrate .. //depot/projects/iwarp/sys/netipsec/key.c#3 integrate .. //depot/projects/iwarp/sys/pc98/include/nexusvar.h#1 branch .. //depot/projects/iwarp/sys/powerpc/powerpc/intr_machdep.c#6 integrate .. //depot/projects/iwarp/sys/sparc64/sparc64/intr_machdep.c#3 integrate .. //depot/projects/iwarp/sys/sun4v/sun4v/intr_machdep.c#2 integrate .. //depot/projects/iwarp/sys/sys/interrupt.h#2 integrate .. //depot/projects/iwarp/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.c#3 integrate Differences ... ==== //depot/projects/iwarp/lib/libarchive/Makefile#3 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/lib/libarchive/Makefile,v 1.80 2008/01/23 05:48:07 kientzle Exp $ +# $FreeBSD: src/lib/libarchive/Makefile,v 1.82 2008/03/14 23:00:53 kientzle Exp $ LIB= archive DPADD= ${LIBBZ2} ${LIBZ} @@ -81,6 +81,7 @@ archive_write_open_filename.c \ archive_write_open_memory.c \ archive_write_set_compression_bzip2.c \ + archive_write_set_compression_compress.c \ archive_write_set_compression_gzip.c \ archive_write_set_compression_none.c \ archive_write_set_compression_program.c \ @@ -120,6 +121,8 @@ MLINKS+= archive_entry.3 archive_entry_copy_gname.3 MLINKS+= archive_entry.3 archive_entry_copy_gname_w.3 MLINKS+= archive_entry.3 archive_entry_copy_hardlink_w.3 +MLINKS+= archive_entry.3 archive_entry_copy_link.3 +MLINKS+= archive_entry.3 archive_entry_copy_link_w.3 MLINKS+= archive_entry.3 archive_entry_copy_pathname_w.3 MLINKS+= archive_entry.3 archive_entry_copy_stat.3 MLINKS+= archive_entry.3 archive_entry_copy_symlink_w.3 ==== //depot/projects/iwarp/lib/libarchive/archive.h.in#3 (text+ko) ==== @@ -22,18 +22,12 @@ * (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/lib/libarchive/archive.h.in,v 1.47 2007/12/30 04:58:21 kientzle Exp $ + * $FreeBSD: src/lib/libarchive/archive.h.in,v 1.49 2008/03/14 22:19:50 kientzle Exp $ */ #ifndef ARCHIVE_H_INCLUDED #define ARCHIVE_H_INCLUDED -/* - * This header file corresponds to: - * Library version @ARCHIVE_VERSION@ - * Shared library version @SHLIB_MAJOR@ - */ - #include <sys/types.h> /* Linux requires this for off_t */ @ARCHIVE_H_INCLUDE_INTTYPES_H@ #include <stdio.h> /* For FILE * */ @@ -51,58 +45,59 @@ #endif /* - * Each of the version identifiers comes as a macro and a function. + * The version number is provided as both a macro and a function. * The macro identifies the installed header; the function identifies * the library version (which may not be the same if you're using a * dynamically-linked version of the library). */ /* - * Textual name/version of the library, useful for version displays. - */ -#define ARCHIVE_LIBRARY_VERSION "libarchive @LIBARCHIVE_VERSION_STRING@" -const char * archive_version(void); - -/* - * The "version stamp" is a single integer that makes it easy to check - * the exact version: for version a.b.c, the version stamp is - * printf("%d%03d%03d",a,b,c). For example, version 2.12.108 has - * version stamp 2012108. + * The version number is expressed as a single integer that makes it + * easy to compare versions at build time: for version a.b.c, the + * version number is printf("%d%03d%03d",a,b,c). For example, if you + * know your application requires version 2.12.108 or later, you can + * assert that ARCHIVE_VERSION >= 2012108. * - * This was introduced with libarchive 1.9.0 in the libarchive 1.x family - * and libarchive 2.2.4 in the libarchive 2.x family. The following - * may be useful if you really want to do feature detection for earlier - * libarchive versions (which defined API_VERSION and API_FEATURE): + * This single-number format was introduced with libarchive 1.9.0 in + * the libarchive 1.x family and libarchive 2.2.4 in the libarchive + * 2.x family. The following may be useful if you really want to do + * feature detection for earlier libarchive versions (which defined + * ARCHIVE_API_VERSION and ARCHIVE_API_FEATURE instead): * - * #ifndef ARCHIVE_VERSION_STAMP - * #define ARCHIVE_VERSION_STAMP \ + * #ifndef ARCHIVE_VERSION_NUMBER + * #define ARCHIVE_VERSION_NUMBER \ * (ARCHIVE_API_VERSION * 1000000 + ARCHIVE_API_FEATURE * 1000) * #endif */ -#define ARCHIVE_VERSION_STAMP @LIBARCHIVE_VERSION@ -int archive_version_stamp(void); +#define ARCHIVE_VERSION_NUMBER @LIBARCHIVE_VERSION@ +int archive_version_number(void); /* - * Major version number: If ARCHIVE_API_VERSION != - * archive_api_version(), then the library you were linked with is - * using an incompatible API to the one you were compiled with. This - * is almost certainly a fatal problem. - * This is deprecated and will be removed; use ARCHIVE_VERSION_STAMP - * instead. + * Textual name/version of the library, useful for version displays. */ -#define ARCHIVE_API_VERSION (ARCHIVE_VERSION_STAMP / 1000000) -int archive_api_version(void); +const char * archive_version_string(void); +#if ARCHIVE_VERSION_NUMBER < 3000000 /* - * Minor version number. This is deprecated and will be removed. - * Use ARCHIVE_VERSION_STAMP to adapt to libarchive API variations. + * Deprecated; these are older names that will be removed in favor of + * the simpler definitions above. */ -#define ARCHIVE_API_FEATURE ((ARCHIVE_VERSION_STAMP / 1000) % 1000) +#define ARCHIVE_VERSION_STAMP ARCHIVE_VERSION_NUMBER +int archive_version_stamp(void); +#define ARCHIVE_LIBRARY_VERSION "libarchive @LIBARCHIVE_VERSION_STRING@" +const char * archive_version(void); +#define ARCHIVE_API_VERSION (ARCHIVE_VERSION_NUMBER / 1000000) +int archive_api_version(void); +#define ARCHIVE_API_FEATURE ((ARCHIVE_VERSION_NUMBER / 1000) % 1000) int archive_api_feature(void); +#endif - +#if ARCHIVE_VERSION_NUMBER < 3000000 +/* This should never have been here in the first place. */ +/* Legacy of old tar assumptions, will be removed in libarchive 3.0. */ #define ARCHIVE_BYTES_PER_RECORD 512 #define ARCHIVE_DEFAULT_BYTES_PER_BLOCK 10240 +#endif /* Declare our basic types. */ struct archive; @@ -119,6 +114,7 @@ #define ARCHIVE_WARN (-20) /* Partial success. */ /* For example, if write_header "fails", then you can't push data. */ #define ARCHIVE_FAILED (-25) /* Current operation cannot complete. */ +/* But if write_header is "fatal," then this archive is dead and useless. */ #define ARCHIVE_FATAL (-30) /* No more operations are possible. */ /* @@ -146,7 +142,7 @@ typedef ssize_t archive_read_callback(struct archive *, void *_client_data, const void **_buffer); /* Skips at most request bytes from archive and returns the skipped amount */ -#if ARCHIVE_API_VERSION < 2 +#if ARCHIVE_VERSION_NUMBER < 2000000 typedef ssize_t archive_skip_callback(struct archive *, void *_client_data, size_t request); #else @@ -370,7 +366,7 @@ int archive_read_close(struct archive *); /* Release all resources and destroy the object. */ /* Note that archive_read_finish will call archive_read_close for you. */ -#if ARCHIVE_API_VERSION > 1 +#if ARCHIVE_VERSION_NUMBER >= 2000000 int archive_read_finish(struct archive *); #else /* Temporarily allow library to compile with either 1.x or 2.0 API. */ @@ -407,6 +403,7 @@ int archive_write_set_skip_file(struct archive *, dev_t, ino_t); int archive_write_set_compression_bzip2(struct archive *); +int archive_write_set_compression_compress(struct archive *); int archive_write_set_compression_gzip(struct archive *); int archive_write_set_compression_none(struct archive *); int archive_write_set_compression_program(struct archive *, @@ -445,7 +442,7 @@ */ int archive_write_header(struct archive *, struct archive_entry *); -#if ARCHIVE_API_VERSION > 1 +#if ARCHIVE_VERSION_NUMBER >= 2000000 ssize_t archive_write_data(struct archive *, const void *, size_t); #else /* Temporarily allow library to compile with either 1.x or 2.0 API. */ @@ -455,7 +452,7 @@ ssize_t archive_write_data_block(struct archive *, const void *, size_t, off_t); int archive_write_finish_entry(struct archive *); int archive_write_close(struct archive *); -#if ARCHIVE_API_VERSION > 1 +#if ARCHIVE_VERSION_NUMBER >= 2000000 int archive_write_finish(struct archive *); #else /* Temporarily allow library to compile with either 1.x or 2.0 API. */ ==== //depot/projects/iwarp/lib/libarchive/archive_entry.3#3 (text+ko) ==== @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libarchive/archive_entry.3,v 1.16 2008/03/10 14:44:40 jkoshy Exp $ +.\" $FreeBSD: src/lib/libarchive/archive_entry.3,v 1.17 2008/03/14 23:00:53 kientzle Exp $ .\" .Dd December 15, 2003 .Dt archive_entry 3 @@ -45,6 +45,8 @@ .Nm archive_entry_copy_gname_w , .Nm archive_entry_copy_hardlink , .Nm archive_entry_copy_hardlink_w , +.Nm archive_entry_copy_link , +.Nm archive_entry_copy_link_w , .Nm archive_entry_copy_pathname_w , .Nm archive_entry_copy_stat , .Nm archive_entry_copy_symlink , ==== //depot/projects/iwarp/lib/libarchive/archive_entry.c#4 (text+ko) ==== @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_entry.c,v 1.47 2008/03/12 04:47:37 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_entry.c,v 1.51 2008/03/14 23:19:46 kientzle Exp $"); #ifdef HAVE_SYS_STAT_H #include <sys/stat.h> @@ -207,6 +207,8 @@ static const wchar_t * aes_get_wcs(struct aes *aes) { + int r; + if (aes->aes_wcs == NULL && aes->aes_mbs == NULL) return NULL; if (aes->aes_wcs == NULL && aes->aes_mbs != NULL) { @@ -221,8 +223,13 @@ aes->aes_wcs = aes->aes_wcs_alloc; if (aes->aes_wcs == NULL) __archive_errx(1, "No memory for aes_get_wcs()"); - mbstowcs(aes->aes_wcs_alloc, aes->aes_mbs, wcs_length); + r = mbstowcs(aes->aes_wcs_alloc, aes->aes_mbs, wcs_length); aes->aes_wcs_alloc[wcs_length] = 0; + if (r == -1) { + /* Conversion failed, don't lie to our clients. */ + free(aes->aes_wcs_alloc); + aes->aes_wcs = aes->aes_wcs_alloc = NULL; + } } return (aes->aes_wcs); } @@ -307,6 +314,8 @@ struct archive_entry * archive_entry_clear(struct archive_entry *entry) { + if (entry == NULL) + return (NULL); aes_clean(&entry->ae_fflags_text); aes_clean(&entry->ae_gname); aes_clean(&entry->ae_hardlink); @@ -752,7 +761,29 @@ aes_set_mbs(&entry->ae_hardlink, target); } +/* Set symlink if symlink is already set, else set hardlink. */ void +archive_entry_copy_link(struct archive_entry *entry, const char *target) +{ + if (entry->ae_symlink.aes_mbs != NULL || + entry->ae_symlink.aes_wcs != NULL) + aes_copy_mbs(&entry->ae_symlink, target); + else + aes_copy_mbs(&entry->ae_hardlink, target); +} + +/* Set symlink if symlink is already set, else set hardlink. */ +void +archive_entry_copy_link_w(struct archive_entry *entry, const wchar_t *target) +{ + if (entry->ae_symlink.aes_mbs != NULL || + entry->ae_symlink.aes_wcs != NULL) + aes_copy_wcs(&entry->ae_symlink, target); + else + aes_copy_wcs(&entry->ae_hardlink, target); +} + +void archive_entry_set_mode(struct archive_entry *entry, mode_t m) { entry->stat_valid = 0; @@ -1148,7 +1179,7 @@ archive_entry_acl_text_w(struct archive_entry *entry, int flags) { int count; - int length; + size_t length; const wchar_t *wname; const wchar_t *prefix; wchar_t separator; ==== //depot/projects/iwarp/lib/libarchive/archive_entry.h#3 (text+ko) ==== @@ -22,7 +22,7 @@ * (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/lib/libarchive/archive_entry.h,v 1.24 2007/12/30 04:58:21 kientzle Exp $ + * $FreeBSD: src/lib/libarchive/archive_entry.h,v 1.26 2008/03/14 23:00:53 kientzle Exp $ */ #ifndef ARCHIVE_ENTRY_H_INCLUDED @@ -57,7 +57,25 @@ struct archive_entry; /* - * File-type constants. These are returned from archive_entry_filetype(). + * File-type constants. These are returned from archive_entry_filetype() + * and passed to archive_entry_set_filetype(). + * + * These values match S_XXX defines on every platform I've checked, + * including Windows, AIX, Linux, Solaris, and BSD. They're + * (re)defined here because platforms generally don't define the ones + * they don't support. For example, Windows doesn't define S_IFLNK or + * S_IFBLK. Instead of having a mass of conditional logic and system + * checks to define any S_XXX values that aren't supported locally, + * I've just defined a new set of such constants so that + * libarchive-based applications can manipulate and identify archive + * entries properly even if the hosting platform can't store them on + * disk. + * + * These values are also used directly within some portable formats, + * such as cpio. If you find a platform that varies from these, the + * correct solution is to leave these alone and translate from these + * portable values to platform-native values when entries are read from + * or written to disk. */ #define AE_IFMT 0170000 #define AE_IFREG 0100000 @@ -91,7 +109,8 @@ dev_t archive_entry_devminor(struct archive_entry *); mode_t archive_entry_filetype(struct archive_entry *); void archive_entry_fflags(struct archive_entry *, - unsigned long *set, unsigned long *clear); + unsigned long * /* set */, + unsigned long * /* clear */); const char *archive_entry_fflags_text(struct archive_entry *); gid_t archive_entry_gid(struct archive_entry *); const char *archive_entry_gname(struct archive_entry *); @@ -130,7 +149,7 @@ void archive_entry_set_devminor(struct archive_entry *, dev_t); void archive_entry_set_filetype(struct archive_entry *, unsigned int); void archive_entry_set_fflags(struct archive_entry *, - unsigned long set, unsigned long clear); + unsigned long /* set */, unsigned long /* clear */); /* Returns pointer to start of first invalid token, or NULL if none. */ /* Note that all recognized tokens are processed, regardless. */ const wchar_t *archive_entry_copy_fflags_text_w(struct archive_entry *, @@ -144,6 +163,8 @@ void archive_entry_copy_hardlink_w(struct archive_entry *, const wchar_t *); void archive_entry_set_ino(struct archive_entry *, unsigned long); void archive_entry_set_link(struct archive_entry *, const char *); +void archive_entry_copy_link(struct archive_entry *, const char *); +void archive_entry_copy_link_w(struct archive_entry *, const wchar_t *); void archive_entry_set_mode(struct archive_entry *, mode_t); void archive_entry_set_mtime(struct archive_entry *, time_t, long); void archive_entry_set_nlink(struct archive_entry *, unsigned int); @@ -182,6 +203,13 @@ * = there are many different ACL text formats * = would like to be able to read/convert archives containing ACLs * on platforms that lack ACL libraries + * + * This last point, in particular, forces me to implement a reasonably + * complete set of ACL support routines. + * + * TODO: Extend this to support NFSv4/NTFS permissions. That should + * allow full ACL support on Mac OS, in particular, which uses + * POSIX.1e-style interfaces to manipulate NFSv4/NTFS permissions. */ /* @@ -216,21 +244,24 @@ */ void archive_entry_acl_clear(struct archive_entry *); void archive_entry_acl_add_entry(struct archive_entry *, - int type, int permset, int tag, int qual, const char *name); + int /* type */, int /* permset */, int /* tag */, + int /* qual */, const char * /* name */); void archive_entry_acl_add_entry_w(struct archive_entry *, - int type, int permset, int tag, int qual, const wchar_t *name); + int /* type */, int /* permset */, int /* tag */, + int /* qual */, const wchar_t * /* name */); /* * To retrieve the ACL, first "reset", then repeatedly ask for the * "next" entry. The want_type parameter allows you to request only * access entries or only default entries. */ -int archive_entry_acl_reset(struct archive_entry *, int want_type); -int archive_entry_acl_next(struct archive_entry *, int want_type, - int *type, int *permset, int *tag, int *qual, const char **name); -int archive_entry_acl_next_w(struct archive_entry *, int want_type, - int *type, int *permset, int *tag, int *qual, - const wchar_t **name); +int archive_entry_acl_reset(struct archive_entry *, int /* want_type */); +int archive_entry_acl_next(struct archive_entry *, int /* want_type */, + int * /* type */, int * /* permset */, int * /* tag */, + int * /* qual */, const char ** /* name */); +int archive_entry_acl_next_w(struct archive_entry *, int /* want_type */, + int * /* type */, int * /* permset */, int * /* tag */, + int * /* qual */, const wchar_t ** /* name */); /* * Construct a text-format ACL. The flags argument is a bitmask that @@ -245,10 +276,11 @@ */ #define ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID 1024 #define ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT 2048 -const wchar_t *archive_entry_acl_text_w(struct archive_entry *, int flags); +const wchar_t *archive_entry_acl_text_w(struct archive_entry *, + int /* flags */); /* Return a count of entries matching 'want_type' */ -int archive_entry_acl_count(struct archive_entry *, int want_type); +int archive_entry_acl_count(struct archive_entry *, int /* want_type */); /* * Private ACL parser. This is private because it handles some @@ -259,9 +291,12 @@ * this interface are likely to be surprised when it changes. * * You were warned! + * + * TODO: Move this declaration out of the public header and into + * a private header. Warnings above are silly. */ int __archive_entry_acl_parse_w(struct archive_entry *, - const wchar_t *, int type); + const wchar_t *, int /* type */); /* * extended attributes @@ -269,7 +304,8 @@ void archive_entry_xattr_clear(struct archive_entry *); void archive_entry_xattr_add_entry(struct archive_entry *, - const char *name, const void *value, size_t size); + const char * /* name */, const void * /* value */, + size_t /* size */); /* * To retrieve the xattr list, first "reset", then repeatedly ask for the @@ -279,7 +315,7 @@ int archive_entry_xattr_count(struct archive_entry *); int archive_entry_xattr_reset(struct archive_entry *); int archive_entry_xattr_next(struct archive_entry *, - const char **name, const void **value, size_t *); + const char ** /* name */, const void ** /* value */, size_t *); /* * Utility to detect hardlinks. ==== //depot/projects/iwarp/lib/libarchive/archive_read_support_format_tar.c#5 (text+ko) ==== @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_tar.c,v 1.65 2008/01/31 07:41:45 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_tar.c,v 1.66 2008/03/14 20:32:20 kientzle Exp $"); #ifdef HAVE_ERRNO_H #include <errno.h> @@ -714,7 +714,7 @@ { unsigned i; - for (i = 0; i < ARCHIVE_BYTES_PER_RECORD / sizeof(*p); i++) + for (i = 0; i < 512; i++) if (*p++) return (0); return (1); ==== //depot/projects/iwarp/lib/libarchive/archive_string.h#2 (text+ko) ==== @@ -22,7 +22,7 @@ * (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/lib/libarchive/archive_string.h,v 1.9 2007/05/29 01:00:19 kientzle Exp $ + * $FreeBSD: src/lib/libarchive/archive_string.h,v 1.10 2008/03/14 22:00:09 kientzle Exp $ * */ @@ -116,4 +116,7 @@ va_list); #define archive_string_vsprintf __archive_string_vsprintf +void __archive_string_sprintf(struct archive_string *, const char *, ...); +#define archive_string_sprintf __archive_string_sprintf + #endif ==== //depot/projects/iwarp/lib/libarchive/archive_string_sprintf.c#2 (text+ko) ==== @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_string_sprintf.c,v 1.9 2007/07/15 19:13:59 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_string_sprintf.c,v 1.10 2008/03/14 22:00:09 kientzle Exp $"); /* * The use of printf()-family functions can be troublesome @@ -44,6 +44,16 @@ #include "archive_string.h" #include "archive_private.h" +void +__archive_string_sprintf(struct archive_string *as, const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + archive_string_vsprintf(as, fmt, ap); + va_end(ap); +} + /* * Like 'vsprintf', but ensures the target is big enough, resizing if * necessary. ==== //depot/projects/iwarp/lib/libarchive/archive_util.c#3 (text+ko) ==== @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_util.c,v 1.16 2007/12/30 04:58:21 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_util.c,v 1.17 2008/03/14 22:31:57 kientzle Exp $"); #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> @@ -38,29 +38,71 @@ #include "archive.h" #include "archive_private.h" +#include "archive_string.h" +#if ARCHIVE_VERSION_NUMBER < 3000000 +/* These disappear in libarchive 3.0 */ +/* Deprecated. */ int archive_api_feature(void) { return (ARCHIVE_API_FEATURE); } +/* Deprecated. */ int archive_api_version(void) { return (ARCHIVE_API_VERSION); } +/* Deprecated synonym for archive_version_number() */ int archive_version_stamp(void) { - return (ARCHIVE_VERSION_STAMP); + return (archive_version_number()); } +/* Deprecated synonym for archive_version_string() */ const char * archive_version(void) { - return (ARCHIVE_LIBRARY_VERSION); + return (archive_version_string()); +} +#endif + +int +archive_version_number(void) +{ + return (ARCHIVE_VERSION_NUMBER); +} + +/* + * Format a version string of the form "libarchive x.y.z", where x, y, + * z are the correct parts of the version ID from + * archive_version_number(). + * + * I used to do all of this at build time in shell scripts but that + * proved to be a portability headache. + */ + +const char * +archive_version_string(void) +{ + static char buff[128]; + struct archive_string as; + int n; + + if (buff[0] == '\0') { + n = archive_version_number(); + memset(&as, 0, sizeof(as)); + archive_string_sprintf(&as, "libarchive %d.%d.%d", + n / 1000000, (n / 1000) % 1000, n % 1000); + strncpy(buff, as.s, sizeof(buff)); + buff[sizeof(buff) - 1] = '\0'; + archive_string_free(&as); + } + return (buff); } int ==== //depot/projects/iwarp/lib/libarchive/archive_write.c#2 (text+ko) ==== @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_write.c,v 1.26 2007/05/29 01:00:19 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_write.c,v 1.27 2008/03/14 23:09:02 kientzle Exp $"); /* * This file contains the "essential" portions of the write API, that @@ -97,7 +97,12 @@ a->archive.magic = ARCHIVE_WRITE_MAGIC; a->archive.state = ARCHIVE_STATE_NEW; a->archive.vtable = archive_write_vtable(); - a->bytes_per_block = ARCHIVE_DEFAULT_BYTES_PER_BLOCK; + /* + * The value 10240 here matches the traditional tar default, + * but is otherwise arbitrary. + * TODO: Set the default block size from the format selected. + */ + a->bytes_per_block = 10240; a->bytes_in_last_block = -1; /* Default */ /* Initialize a block of nulls for padding purposes. */ ==== //depot/projects/iwarp/lib/libarchive/test/Makefile#5 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/lib/libarchive/test/Makefile,v 1.15 2008/03/12 05:12:23 kientzle Exp $ +# $FreeBSD: src/lib/libarchive/test/Makefile,v 1.16 2008/03/14 20:35:38 kientzle Exp $ # Where to find the libarchive sources LA_SRCDIR=${.CURDIR}/.. @@ -48,6 +48,7 @@ test_tar_filenames.c \ test_tar_large.c \ test_write_compress_program.c \ + test_write_compress.c \ test_write_disk.c \ test_write_disk_hardlink.c \ test_write_disk_perms.c \ ==== //depot/projects/iwarp/lib/libarchive/test/test_archive_api_feature.c#2 (text+ko) ==== @@ -23,10 +23,23 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/lib/libarchive/test/test_archive_api_feature.c,v 1.3 2007/07/06 15:43:11 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/test/test_archive_api_feature.c,v 1.4 2008/03/14 22:31:57 kientzle Exp $"); DEFINE_TEST(test_archive_api_feature) { + char buff[128]; + + /* This is the (hopefully) final versioning API. */ + assertEqualInt(ARCHIVE_VERSION_NUMBER, archive_version_number()); + sprintf(buff, "libarchive %d.%d.%d", + archive_version_number() / 1000000, + (archive_version_number() / 1000) % 1000, + archive_version_number() % 1000); + assertEqualString(buff, archive_version_string()); + +/* This is all scheduled to disappear in libarchive 3.0 */ +#if ARCHIVE_VERSION_NUMBER < 3000000 + assertEqualInt(ARCHIVE_VERSION_STAMP, ARCHIVE_VERSION_NUMBER); assertEqualInt(ARCHIVE_API_FEATURE, archive_api_feature()); assertEqualInt(ARCHIVE_API_VERSION, archive_api_version()); /* @@ -48,4 +61,5 @@ skipping("archive_version_stamp()"); #endif assertEqualString(ARCHIVE_LIBRARY_VERSION, archive_version()); +#endif } ==== //depot/projects/iwarp/lib/libarchive/test/test_entry.c#3 (text+ko) ==== @@ -23,7 +23,9 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/lib/libarchive/test/test_entry.c,v 1.3 2008/03/12 04:47:37 kientzle Exp $"); +__FBSDID("$FreeBSD: src/lib/libarchive/test/test_entry.c,v 1.5 2008/03/14 23:19:46 kientzle Exp $"); + +#include <locale.h> /* * Most of these tests are system-independent, though a few depend on @@ -120,8 +122,37 @@ #else skipping("archive_entry_ino()"); #endif + /* link */ - /* TODO: implement these tests. */ + archive_entry_set_hardlink(e, "hardlinkname"); + archive_entry_set_symlink(e, NULL); + archive_entry_set_link(e, "link"); + assertEqualString(archive_entry_hardlink(e), "link"); + assertEqualString(archive_entry_symlink(e), NULL); + archive_entry_copy_link(e, "link2"); + assertEqualString(archive_entry_hardlink(e), "link2"); + assertEqualString(archive_entry_symlink(e), NULL); + archive_entry_copy_link_w(e, L"link3"); + assertEqualString(archive_entry_hardlink(e), "link3"); + assertEqualString(archive_entry_symlink(e), NULL); + archive_entry_set_hardlink(e, NULL); + archive_entry_set_symlink(e, "symlink"); + archive_entry_set_link(e, "link"); + assertEqualString(archive_entry_hardlink(e), NULL); + assertEqualString(archive_entry_symlink(e), "link"); + archive_entry_copy_link(e, "link2"); + assertEqualString(archive_entry_hardlink(e), NULL); + assertEqualString(archive_entry_symlink(e), "link2"); + archive_entry_copy_link_w(e, L"link3"); + assertEqualString(archive_entry_hardlink(e), NULL); + assertEqualString(archive_entry_symlink(e), "link3"); + /* Arbitrarily override hardlink if both hardlink and symlink set. */ + archive_entry_set_hardlink(e, "hardlink"); + archive_entry_set_symlink(e, "symlink"); + archive_entry_set_link(e, "link"); + assertEqualString(archive_entry_hardlink(e), "hardlink"); + assertEqualString(archive_entry_symlink(e), "link"); + /* mode */ archive_entry_set_mode(e, 0123456); assertEqualInt(archive_entry_mode(e), 0123456); @@ -692,6 +723,39 @@ #endif #endif + /* + * Exercise the character-conversion logic, if we can. + */ + failure("Can't exercise charset-conversion logic."); + if (assert(NULL != setlocale(LC_ALL, "de_DE.UTF-8"))) { + /* A filename that cannot be converted to wide characters. */ + archive_entry_copy_pathname(e, "abc\314\214mno\374xyz"); + failure("Converting invalid chars to Unicode should fail."); + assert(NULL == archive_entry_pathname_w(e)); + //failure("Converting invalid chars to UTF-8 should fail."); + //assert(NULL == archive_entry_pathname_utf8(e)); + + /* A group name that cannot be converted. */ + archive_entry_copy_gname(e, "abc\314\214mno\374xyz"); + failure("Converting invalid chars to Unicode should fail."); + assert(NULL == archive_entry_gname_w(e)); + + /* A user name that cannot be converted. */ + archive_entry_copy_uname(e, "abc\314\214mno\374xyz"); + failure("Converting invalid chars to Unicode should fail."); + assert(NULL == archive_entry_uname_w(e)); + + /* A hardlink target that cannot be converted. */ + archive_entry_copy_hardlink(e, "abc\314\214mno\374xyz"); + failure("Converting invalid chars to Unicode should fail."); + assert(NULL == archive_entry_hardlink_w(e)); + + /* A symlink target that cannot be converted. */ + archive_entry_copy_symlink(e, "abc\314\214mno\374xyz"); + failure("Converting invalid chars to Unicode should fail."); + assert(NULL == archive_entry_symlink_w(e)); + } + /* Release the experimental entry. */ archive_entry_free(e); } ==== //depot/projects/iwarp/lib/libpmc/pmc.3#4 (text+ko) ==== @@ -1,4 +1,4 @@ -.\" Copyright (c) 2003-2007 Joseph Koshy. All rights reserved. +.\" Copyright (c) 2003-2008 Joseph Koshy. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -21,9 +21,9 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $FreeBSD: src/lib/libpmc/pmc.3,v 1.16 2008/02/03 06:04:38 jkoshy Exp $ +.\" $FreeBSD: src/lib/libpmc/pmc.3,v 1.17 2008/03/14 06:22:03 jkoshy Exp $ .\" -.Dd November 25, 2007 +.Dd March 14, 2008 .Os .Dt PMC 3 .Sh NAME @@ -136,6 +136,10 @@ .It PMC_CPU_AMD_K8 .Tn "AMD Athlon64" CPUs. +.It PMC_CPU_INTEL_P5 +.Tn Intel +.Tn "Pentium" +CPUs. .It PMC_CPU_INTEL_P6 .Tn Intel .Tn "Pentium Pro" @@ -169,6 +173,11 @@ Programmable hardware counters present in .Tn "AMD Athlon64" CPUs. +.It PMC_CLASS_P5 +Programmable hardware counters present in +.Tn Intel +.Tn Pentium +CPUs. .It PMC_CLASS_P6 Programmable hardware counters present in .Tn Intel @@ -1198,6 +1207,333 @@ .Pp The default is to count all types of messages. .El +.Ss Intel Pentium PMCS +Intel Pentium PMCs are present in Intel +.Tn Pentium +and +.Tn "Pentium MMX" +processors. +.Pp +These CPUs have two counters. +Some events may only be used on specific counters and some events +are defined only on processors supporting the MMX instruction set. +.Pp +These PMCs are documented in +.Rs +.%B "Intel 64 and IA-32 Intel(R) Architectures Software Developer's Manual" +.%T "Volume 3B: System Programming Guide, Part 2" +.%N "Order Number 253669-024US" +.%D "August 2007" +.%Q "Intel Corporation" +.Re +.Pp +Event specifiers for Intel Pentium PMCs can have the following common +qualifiers: +.Bl -tag -width indent +.It Li duration +Count duration (in clocks) of events. +The default is to count events. +.It Li os +Measure events at privilege levels 0, 1 and 2. +.It Li overflow +Assert the external processor pin associated with a counter on counter +overflow. +.It Li usr +Measure events at privilege level 3. +.El +.Pp +Note that these PMCs do not have the ability to interrupt the CPU. +.Pp +The event specifiers supported by Intel Pentium PMCs are: +.Bl -tag -width indent +.It Li p5-any-segment-register-loaded +The number of writes to any segment register, including the LDTR, +GDTR, TR and IDTR. +Far control transfers and task switches that involve privilege +level changes will count this event twice. +.It Li p5-bank-conflicts +The number of actual bank conflicts. +.It Li p5-branches +The number of taken and not taken branches including branches, jumps, calls, +software interrupts and interrupt returns. +.It Li p5-breakpoint-match-on-dr0-register +The number of matches on the DR0 breakpoint register. +.It Li p5-breakpoint-match-on-dr1-register +The number of matches on the DR1 breakpoint register. +.It Li p5-breakpoint-match-on-dr2-register +The number of matches on the DR2 breakpoint register. +.It Li p5-breakpoint-match-on-dr3-register +The number of matches on the DR3 breakpoint register. +.It Li p5-btb-false-entries +.Pq Tn Pentium MMX +The number of false entries in the BTB. +This event is only allocated on counter 0. +.It Li p5-btb-hits +The number of branches executed that hit in the branch table buffer. +.It Li p5-btb-miss-prediction-on-not-taken-branch +.Pq Tn Pentium MMX +The number of times the BTB predicted a not-taken branch as taken. +This event is only allocated on counter 1. +.It Li p5-bus-cycle-duration +The number of cycles while a bus cycle was in progress. +.It Li p5-bus-ownership-latency +.Pq Tn Pentium MMX +The time from bus ownership being requested to ownership being granted. +This event is only allocated on counter 0. +.It Li p5-bus-ownership-transfers +.Pq Tn Pentium MMX +The number of bus ownership transfers. +This event is only allocated on counter 1. +.It Li p5-bus-utilization-due-to-processor-activity +.Pq Tn Pentium MMX +The number of clocks the bus is busy due to the processor's own +activity. +This event is only allocated on counter 0. +.It Li p5-cache-line-sharing +.Pq Tn Pentium MMX +The number of shared data lines in L1 cache. +This event is only allocated on counter 1. +.It Li p5-cache-m-state-line-sharing +.Pq Tn Pentium MMX +The number of hits to an M- state line due to a memory access by +another processor. +This event is only allocated on counter 0. +.It Li p5-code-cache-miss +The number of instruction reads that miss the internal code cache. +Both cacheable and uncacheable misses are counted. +.It Li p5-code-read +The number of instruction reads to both cacheable and uncacheable regions. +.It Li p5-code-tlb-miss +The number of instruction reads that miss the instruction TLB. +Both cacheable and uncacheable unreads are counted. +.It Li p5-d1-starvation-and-fifo-is-empty +.Pq Tn Pentium MMX +The number of times the D1 stage cannot issue any instructions because +the FIFO was empty. +This event is only allocated on counter 0. +.It Li p5-d1-starvation-and-only-one-instruction-in-fifo +.Pq Tn Pentium MMX +The number of times the D1 stage could issue only one instruction +because the FIFO had one instruction ready. +This event is only allocated on counter 1. +.It Li p5-data-cache-lines-written-back +The number of data cache lines that are written back, including +those caused by internal and external snoops. +.It Li p5-data-cache-tlb-miss-stall-duration +.Pq Tn Pentium MMX +The number of clocks the pipeline is stalled due to a data cache +TLB miss. +This event is only allocated on counter 1. +.It Li p5-data-read >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200803150652.m2F6q3f1089273>