libarchive-static 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/Makefile +6 -0
- data/ext/extconf.rb +61 -0
- data/ext/libarchive-0.1.1/COPYING.libarchive +60 -0
- data/ext/libarchive-0.1.1/LICENSE.libbzip2 +42 -0
- data/ext/libarchive-0.1.1/README.txt +143 -0
- data/ext/libarchive-0.1.1/ext/Makefile.in +0 -0
- data/ext/libarchive-0.1.1/ext/archive_read_support_compression.c +31 -0
- data/ext/libarchive-0.1.1/ext/archive_read_support_compression.h +6 -0
- data/ext/libarchive-0.1.1/ext/archive_read_support_format.c +32 -0
- data/ext/libarchive-0.1.1/ext/archive_read_support_format.h +6 -0
- data/ext/libarchive-0.1.1/ext/archive_write_open_rb_str.c +29 -0
- data/ext/libarchive-0.1.1/ext/archive_write_open_rb_str.h +6 -0
- data/ext/libarchive-0.1.1/ext/archive_write_set_compression.c +32 -0
- data/ext/libarchive-0.1.1/ext/archive_write_set_compression.h +6 -0
- data/ext/libarchive-0.1.1/ext/config.h.in +22 -0
- data/ext/libarchive-0.1.1/ext/configure +3904 -0
- data/ext/libarchive-0.1.1/ext/configure.in +11 -0
- data/ext/libarchive-0.1.1/ext/depend +19 -0
- data/ext/libarchive-0.1.1/ext/extconf.rb +6 -0
- data/ext/libarchive-0.1.1/ext/install-sh +250 -0
- data/ext/libarchive-0.1.1/ext/libarchive.c +89 -0
- data/ext/libarchive-0.1.1/ext/libarchive_archive.c +84 -0
- data/ext/libarchive-0.1.1/ext/libarchive_entry.c +1015 -0
- data/ext/libarchive-0.1.1/ext/libarchive_internal.h +155 -0
- data/ext/libarchive-0.1.1/ext/libarchive_reader.c +328 -0
- data/ext/libarchive-0.1.1/ext/libarchive_win32.h +52 -0
- data/ext/libarchive-0.1.1/ext/libarchive_writer.c +246 -0
- data/ext/libarchive-0.1.1/libarchive.c +1762 -0
- data/ext/libarchive-2.8.4/Makefile.in +7076 -0
- data/ext/libarchive-2.8.4/build/autoconf/check_stdcall_func.m4 +51 -0
- data/ext/libarchive-2.8.4/build/autoconf/compile +143 -0
- data/ext/libarchive-2.8.4/build/autoconf/config.guess +1502 -0
- data/ext/libarchive-2.8.4/build/autoconf/config.sub +1708 -0
- data/ext/libarchive-2.8.4/build/autoconf/depcomp +630 -0
- data/ext/libarchive-2.8.4/build/autoconf/install-sh +291 -0
- data/ext/libarchive-2.8.4/build/autoconf/la_uid_t.m4 +20 -0
- data/ext/libarchive-2.8.4/build/autoconf/ltmain.sh +8406 -0
- data/ext/libarchive-2.8.4/build/autoconf/missing +376 -0
- data/ext/libarchive-2.8.4/build/pkgconfig/libarchive.pc.in +10 -0
- data/ext/libarchive-2.8.4/config.h.in +772 -0
- data/ext/libarchive-2.8.4/configure +17916 -0
- data/ext/libarchive-2.8.4/libarchive/archive.h +741 -0
- data/ext/libarchive-2.8.4/libarchive/archive_check_magic.c +134 -0
- data/ext/libarchive-2.8.4/libarchive/archive_crc32.h +66 -0
- data/ext/libarchive-2.8.4/libarchive/archive_endian.h +162 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry.c +2202 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry.h +524 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry_copy_bhfi.c +74 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry_copy_stat.c +77 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry_link_resolver.c +405 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry_private.h +184 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry_stat.c +118 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry_strmode.c +87 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry_xattr.c +158 -0
- data/ext/libarchive-2.8.4/libarchive/archive_hash.h +281 -0
- data/ext/libarchive-2.8.4/libarchive/archive_platform.h +165 -0
- data/ext/libarchive-2.8.4/libarchive/archive_private.h +124 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read.c +1249 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_data_into_fd.c +93 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_disk.c +198 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_disk_entry_from_file.c +570 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_disk_private.h +62 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_disk_set_standard_lookup.c +303 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_extract.c +182 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_open_fd.c +190 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_open_file.c +165 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_open_filename.c +272 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_open_memory.c +156 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_private.h +199 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_all.c +60 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_bzip2.c +353 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_compress.c +444 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_gzip.c +465 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_none.c +40 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_program.c +459 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_rpm.c +287 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_uu.c +627 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_xz.c +708 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_all.c +43 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_ar.c +584 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_cpio.c +777 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_empty.c +93 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_iso9660.c +2830 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_mtree.c +1304 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_raw.c +185 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_tar.c +2418 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_xar.c +3151 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_zip.c +903 -0
- data/ext/libarchive-2.8.4/libarchive/archive_string.c +453 -0
- data/ext/libarchive-2.8.4/libarchive/archive_string.h +148 -0
- data/ext/libarchive-2.8.4/libarchive/archive_string_sprintf.c +164 -0
- data/ext/libarchive-2.8.4/libarchive/archive_util.c +391 -0
- data/ext/libarchive-2.8.4/libarchive/archive_virtual.c +94 -0
- data/ext/libarchive-2.8.4/libarchive/archive_windows.c +1236 -0
- data/ext/libarchive-2.8.4/libarchive/archive_windows.h +347 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write.c +466 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_disk.c +2628 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_disk_private.h +38 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_disk_set_standard_lookup.c +262 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_open_fd.c +141 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_open_file.c +105 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_open_filename.c +162 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_open_memory.c +126 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_private.h +122 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_bzip2.c +408 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_compress.c +492 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_gzip.c +477 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_none.c +257 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_program.c +347 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_xz.c +438 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format.c +72 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_ar.c +550 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_by_name.c +76 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_cpio.c +344 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_cpio_newc.c +295 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_mtree.c +1050 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_pax.c +1386 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_shar.c +626 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_ustar.c +587 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_zip.c +667 -0
- data/ext/libarchive-2.8.4/libarchive/config_freebsd.h +154 -0
- data/ext/libarchive-2.8.4/libarchive/filter_fork.c +161 -0
- data/ext/libarchive-2.8.4/libarchive/filter_fork.h +41 -0
- data/ext/libarchive-2.8.4/libarchive/filter_fork_windows.c +113 -0
- data/ext/libarchive-static-makefile +80 -0
- data/ext/libarchive-static-wrapper-makefile +22 -0
- data/ext/zlib-1.2.5/Makefile.in +257 -0
- data/ext/zlib-1.2.5/adler32.c +169 -0
- data/ext/zlib-1.2.5/compress.c +80 -0
- data/ext/zlib-1.2.5/configure +596 -0
- data/ext/zlib-1.2.5/crc32.c +442 -0
- data/ext/zlib-1.2.5/crc32.h +441 -0
- data/ext/zlib-1.2.5/deflate.c +1834 -0
- data/ext/zlib-1.2.5/deflate.h +342 -0
- data/ext/zlib-1.2.5/example.c +565 -0
- data/ext/zlib-1.2.5/gzclose.c +25 -0
- data/ext/zlib-1.2.5/gzguts.h +132 -0
- data/ext/zlib-1.2.5/gzlib.c +537 -0
- data/ext/zlib-1.2.5/gzread.c +653 -0
- data/ext/zlib-1.2.5/gzwrite.c +531 -0
- data/ext/zlib-1.2.5/infback.c +632 -0
- data/ext/zlib-1.2.5/inffast.c +340 -0
- data/ext/zlib-1.2.5/inffast.h +11 -0
- data/ext/zlib-1.2.5/inffixed.h +94 -0
- data/ext/zlib-1.2.5/inflate.c +1480 -0
- data/ext/zlib-1.2.5/inflate.h +122 -0
- data/ext/zlib-1.2.5/inftrees.c +330 -0
- data/ext/zlib-1.2.5/inftrees.h +62 -0
- data/ext/zlib-1.2.5/minigzip.c +440 -0
- data/ext/zlib-1.2.5/trees.c +1244 -0
- data/ext/zlib-1.2.5/trees.h +128 -0
- data/ext/zlib-1.2.5/uncompr.c +59 -0
- data/ext/zlib-1.2.5/zconf.h +428 -0
- data/ext/zlib-1.2.5/zlib.h +1613 -0
- data/ext/zlib-1.2.5/zutil.c +318 -0
- data/ext/zlib-1.2.5/zutil.h +274 -0
- metadata +211 -0
@@ -0,0 +1,524 @@
|
|
1
|
+
/*-
|
2
|
+
* Copyright (c) 2003-2008 Tim Kientzle
|
3
|
+
* All rights reserved.
|
4
|
+
*
|
5
|
+
* Redistribution and use in source and binary forms, with or without
|
6
|
+
* modification, are permitted provided that the following conditions
|
7
|
+
* are met:
|
8
|
+
* 1. Redistributions of source code must retain the above copyright
|
9
|
+
* notice, this list of conditions and the following disclaimer.
|
10
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
11
|
+
* notice, this list of conditions and the following disclaimer in the
|
12
|
+
* documentation and/or other materials provided with the distribution.
|
13
|
+
*
|
14
|
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
|
15
|
+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
16
|
+
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
17
|
+
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
|
18
|
+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
19
|
+
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
20
|
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
21
|
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
22
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
23
|
+
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
24
|
+
*
|
25
|
+
* $FreeBSD: head/lib/libarchive/archive_entry.h 201096 2009-12-28 02:41:27Z kientzle $
|
26
|
+
*/
|
27
|
+
|
28
|
+
#ifndef ARCHIVE_ENTRY_H_INCLUDED
|
29
|
+
#define ARCHIVE_ENTRY_H_INCLUDED
|
30
|
+
|
31
|
+
/*
|
32
|
+
* Note: archive_entry.h is for use outside of libarchive; the
|
33
|
+
* configuration headers (config.h, archive_platform.h, etc.) are
|
34
|
+
* purely internal. Do NOT use HAVE_XXX configuration macros to
|
35
|
+
* control the behavior of this header! If you must conditionalize,
|
36
|
+
* use predefined compiler and/or platform macros.
|
37
|
+
*/
|
38
|
+
|
39
|
+
#include <sys/types.h>
|
40
|
+
#include <stddef.h> /* for wchar_t */
|
41
|
+
#include <time.h>
|
42
|
+
|
43
|
+
#if defined(_WIN32) && !defined(__CYGWIN__)
|
44
|
+
#include <windows.h>
|
45
|
+
#endif
|
46
|
+
|
47
|
+
/* Get appropriate definitions of standard POSIX-style types. */
|
48
|
+
/* These should match the types used in 'struct stat' */
|
49
|
+
#if defined(_WIN32) && !defined(__CYGWIN__)
|
50
|
+
#define __LA_INT64_T __int64
|
51
|
+
# if defined(__BORLANDC__)
|
52
|
+
# define __LA_UID_T uid_t
|
53
|
+
# define __LA_GID_T gid_t
|
54
|
+
# define __LA_DEV_T dev_t
|
55
|
+
# define __LA_MODE_T mode_t
|
56
|
+
# else
|
57
|
+
# define __LA_UID_T short
|
58
|
+
# define __LA_GID_T short
|
59
|
+
# define __LA_DEV_T unsigned int
|
60
|
+
# define __LA_MODE_T unsigned short
|
61
|
+
# endif
|
62
|
+
#else
|
63
|
+
#include <unistd.h>
|
64
|
+
#define __LA_INT64_T int64_t
|
65
|
+
#define __LA_UID_T uid_t
|
66
|
+
#define __LA_GID_T gid_t
|
67
|
+
#define __LA_DEV_T dev_t
|
68
|
+
#define __LA_MODE_T mode_t
|
69
|
+
#endif
|
70
|
+
|
71
|
+
/*
|
72
|
+
* XXX Is this defined for all Windows compilers? If so, in what
|
73
|
+
* header? It would be nice to remove the __LA_INO_T indirection and
|
74
|
+
* just use plain ino_t everywhere. Likewise for the other types just
|
75
|
+
* above.
|
76
|
+
*/
|
77
|
+
#define __LA_INO_T ino_t
|
78
|
+
|
79
|
+
|
80
|
+
/*
|
81
|
+
* On Windows, define LIBARCHIVE_STATIC if you're building or using a
|
82
|
+
* .lib. The default here assumes you're building a DLL. Only
|
83
|
+
* libarchive source should ever define __LIBARCHIVE_BUILD.
|
84
|
+
*/
|
85
|
+
#if ((defined __WIN32__) || (defined _WIN32) || defined(__CYGWIN__)) && (!defined LIBARCHIVE_STATIC)
|
86
|
+
# ifdef __LIBARCHIVE_BUILD
|
87
|
+
# ifdef __GNUC__
|
88
|
+
# define __LA_DECL __attribute__((dllexport)) extern
|
89
|
+
# else
|
90
|
+
# define __LA_DECL __declspec(dllexport)
|
91
|
+
# endif
|
92
|
+
# else
|
93
|
+
# ifdef __GNUC__
|
94
|
+
# define __LA_DECL __attribute__((dllimport)) extern
|
95
|
+
# else
|
96
|
+
# define __LA_DECL __declspec(dllimport)
|
97
|
+
# endif
|
98
|
+
# endif
|
99
|
+
#else
|
100
|
+
/* Static libraries on all platforms and shared libraries on non-Windows. */
|
101
|
+
# define __LA_DECL
|
102
|
+
#endif
|
103
|
+
|
104
|
+
#ifdef __cplusplus
|
105
|
+
extern "C" {
|
106
|
+
#endif
|
107
|
+
|
108
|
+
/*
|
109
|
+
* Description of an archive entry.
|
110
|
+
*
|
111
|
+
* You can think of this as "struct stat" with some text fields added in.
|
112
|
+
*
|
113
|
+
* TODO: Add "comment", "charset", and possibly other entries that are
|
114
|
+
* supported by "pax interchange" format. However, GNU, ustar, cpio,
|
115
|
+
* and other variants don't support these features, so they're not an
|
116
|
+
* excruciatingly high priority right now.
|
117
|
+
*
|
118
|
+
* TODO: "pax interchange" format allows essentially arbitrary
|
119
|
+
* key/value attributes to be attached to any entry. Supporting
|
120
|
+
* such extensions may make this library useful for special
|
121
|
+
* applications (e.g., a package manager could attach special
|
122
|
+
* package-management attributes to each entry).
|
123
|
+
*/
|
124
|
+
struct archive_entry;
|
125
|
+
|
126
|
+
/*
|
127
|
+
* File-type constants. These are returned from archive_entry_filetype()
|
128
|
+
* and passed to archive_entry_set_filetype().
|
129
|
+
*
|
130
|
+
* These values match S_XXX defines on every platform I've checked,
|
131
|
+
* including Windows, AIX, Linux, Solaris, and BSD. They're
|
132
|
+
* (re)defined here because platforms generally don't define the ones
|
133
|
+
* they don't support. For example, Windows doesn't define S_IFLNK or
|
134
|
+
* S_IFBLK. Instead of having a mass of conditional logic and system
|
135
|
+
* checks to define any S_XXX values that aren't supported locally,
|
136
|
+
* I've just defined a new set of such constants so that
|
137
|
+
* libarchive-based applications can manipulate and identify archive
|
138
|
+
* entries properly even if the hosting platform can't store them on
|
139
|
+
* disk.
|
140
|
+
*
|
141
|
+
* These values are also used directly within some portable formats,
|
142
|
+
* such as cpio. If you find a platform that varies from these, the
|
143
|
+
* correct solution is to leave these alone and translate from these
|
144
|
+
* portable values to platform-native values when entries are read from
|
145
|
+
* or written to disk.
|
146
|
+
*/
|
147
|
+
#define AE_IFMT 0170000
|
148
|
+
#define AE_IFREG 0100000
|
149
|
+
#define AE_IFLNK 0120000
|
150
|
+
#define AE_IFSOCK 0140000
|
151
|
+
#define AE_IFCHR 0020000
|
152
|
+
#define AE_IFBLK 0060000
|
153
|
+
#define AE_IFDIR 0040000
|
154
|
+
#define AE_IFIFO 0010000
|
155
|
+
|
156
|
+
/*
|
157
|
+
* Basic object manipulation
|
158
|
+
*/
|
159
|
+
|
160
|
+
__LA_DECL struct archive_entry *archive_entry_clear(struct archive_entry *);
|
161
|
+
/* The 'clone' function does a deep copy; all of the strings are copied too. */
|
162
|
+
__LA_DECL struct archive_entry *archive_entry_clone(struct archive_entry *);
|
163
|
+
__LA_DECL void archive_entry_free(struct archive_entry *);
|
164
|
+
__LA_DECL struct archive_entry *archive_entry_new(void);
|
165
|
+
|
166
|
+
/*
|
167
|
+
* Retrieve fields from an archive_entry.
|
168
|
+
*
|
169
|
+
* There are a number of implicit conversions among these fields. For
|
170
|
+
* example, if a regular string field is set and you read the _w wide
|
171
|
+
* character field, the entry will implicitly convert narrow-to-wide
|
172
|
+
* using the current locale. Similarly, dev values are automatically
|
173
|
+
* updated when you write devmajor or devminor and vice versa.
|
174
|
+
*
|
175
|
+
* In addition, fields can be "set" or "unset." Unset string fields
|
176
|
+
* return NULL, non-string fields have _is_set() functions to test
|
177
|
+
* whether they've been set. You can "unset" a string field by
|
178
|
+
* assigning NULL; non-string fields have _unset() functions to
|
179
|
+
* unset them.
|
180
|
+
*
|
181
|
+
* Note: There is one ambiguity in the above; string fields will
|
182
|
+
* also return NULL when implicit character set conversions fail.
|
183
|
+
* This is usually what you want.
|
184
|
+
*/
|
185
|
+
__LA_DECL time_t archive_entry_atime(struct archive_entry *);
|
186
|
+
__LA_DECL long archive_entry_atime_nsec(struct archive_entry *);
|
187
|
+
__LA_DECL int archive_entry_atime_is_set(struct archive_entry *);
|
188
|
+
__LA_DECL time_t archive_entry_birthtime(struct archive_entry *);
|
189
|
+
__LA_DECL long archive_entry_birthtime_nsec(struct archive_entry *);
|
190
|
+
__LA_DECL int archive_entry_birthtime_is_set(struct archive_entry *);
|
191
|
+
__LA_DECL time_t archive_entry_ctime(struct archive_entry *);
|
192
|
+
__LA_DECL long archive_entry_ctime_nsec(struct archive_entry *);
|
193
|
+
__LA_DECL int archive_entry_ctime_is_set(struct archive_entry *);
|
194
|
+
__LA_DECL dev_t archive_entry_dev(struct archive_entry *);
|
195
|
+
__LA_DECL dev_t archive_entry_devmajor(struct archive_entry *);
|
196
|
+
__LA_DECL dev_t archive_entry_devminor(struct archive_entry *);
|
197
|
+
__LA_DECL __LA_MODE_T archive_entry_filetype(struct archive_entry *);
|
198
|
+
__LA_DECL void archive_entry_fflags(struct archive_entry *,
|
199
|
+
unsigned long * /* set */,
|
200
|
+
unsigned long * /* clear */);
|
201
|
+
__LA_DECL const char *archive_entry_fflags_text(struct archive_entry *);
|
202
|
+
__LA_DECL __LA_GID_T archive_entry_gid(struct archive_entry *);
|
203
|
+
__LA_DECL const char *archive_entry_gname(struct archive_entry *);
|
204
|
+
__LA_DECL const wchar_t *archive_entry_gname_w(struct archive_entry *);
|
205
|
+
__LA_DECL const char *archive_entry_hardlink(struct archive_entry *);
|
206
|
+
__LA_DECL const wchar_t *archive_entry_hardlink_w(struct archive_entry *);
|
207
|
+
__LA_DECL __LA_INO_T archive_entry_ino(struct archive_entry *);
|
208
|
+
__LA_DECL __LA_INT64_T archive_entry_ino64(struct archive_entry *);
|
209
|
+
__LA_DECL __LA_MODE_T archive_entry_mode(struct archive_entry *);
|
210
|
+
__LA_DECL time_t archive_entry_mtime(struct archive_entry *);
|
211
|
+
__LA_DECL long archive_entry_mtime_nsec(struct archive_entry *);
|
212
|
+
__LA_DECL int archive_entry_mtime_is_set(struct archive_entry *);
|
213
|
+
__LA_DECL unsigned int archive_entry_nlink(struct archive_entry *);
|
214
|
+
__LA_DECL const char *archive_entry_pathname(struct archive_entry *);
|
215
|
+
__LA_DECL const wchar_t *archive_entry_pathname_w(struct archive_entry *);
|
216
|
+
__LA_DECL dev_t archive_entry_rdev(struct archive_entry *);
|
217
|
+
__LA_DECL dev_t archive_entry_rdevmajor(struct archive_entry *);
|
218
|
+
__LA_DECL dev_t archive_entry_rdevminor(struct archive_entry *);
|
219
|
+
__LA_DECL const char *archive_entry_sourcepath(struct archive_entry *);
|
220
|
+
__LA_DECL __LA_INT64_T archive_entry_size(struct archive_entry *);
|
221
|
+
__LA_DECL int archive_entry_size_is_set(struct archive_entry *);
|
222
|
+
__LA_DECL const char *archive_entry_strmode(struct archive_entry *);
|
223
|
+
__LA_DECL const char *archive_entry_symlink(struct archive_entry *);
|
224
|
+
__LA_DECL const wchar_t *archive_entry_symlink_w(struct archive_entry *);
|
225
|
+
__LA_DECL __LA_UID_T archive_entry_uid(struct archive_entry *);
|
226
|
+
__LA_DECL const char *archive_entry_uname(struct archive_entry *);
|
227
|
+
__LA_DECL const wchar_t *archive_entry_uname_w(struct archive_entry *);
|
228
|
+
|
229
|
+
/*
|
230
|
+
* Set fields in an archive_entry.
|
231
|
+
*
|
232
|
+
* Note that string 'set' functions do not copy the string, only the pointer.
|
233
|
+
* In contrast, 'copy' functions do copy the object pointed to.
|
234
|
+
*
|
235
|
+
* Note: As of libarchive 2.4, 'set' functions do copy the string and
|
236
|
+
* are therefore exact synonyms for the 'copy' versions. The 'copy'
|
237
|
+
* names will be retired in libarchive 3.0.
|
238
|
+
*/
|
239
|
+
|
240
|
+
__LA_DECL void archive_entry_set_atime(struct archive_entry *, time_t, long);
|
241
|
+
__LA_DECL void archive_entry_unset_atime(struct archive_entry *);
|
242
|
+
#if defined(_WIN32) && !defined(__CYGWIN__)
|
243
|
+
__LA_DECL void archive_entry_copy_bhfi(struct archive_entry *,
|
244
|
+
BY_HANDLE_FILE_INFORMATION *);
|
245
|
+
#endif
|
246
|
+
__LA_DECL void archive_entry_set_birthtime(struct archive_entry *, time_t, long);
|
247
|
+
__LA_DECL void archive_entry_unset_birthtime(struct archive_entry *);
|
248
|
+
__LA_DECL void archive_entry_set_ctime(struct archive_entry *, time_t, long);
|
249
|
+
__LA_DECL void archive_entry_unset_ctime(struct archive_entry *);
|
250
|
+
__LA_DECL void archive_entry_set_dev(struct archive_entry *, dev_t);
|
251
|
+
__LA_DECL void archive_entry_set_devmajor(struct archive_entry *, dev_t);
|
252
|
+
__LA_DECL void archive_entry_set_devminor(struct archive_entry *, dev_t);
|
253
|
+
__LA_DECL void archive_entry_set_filetype(struct archive_entry *, unsigned int);
|
254
|
+
__LA_DECL void archive_entry_set_fflags(struct archive_entry *,
|
255
|
+
unsigned long /* set */, unsigned long /* clear */);
|
256
|
+
/* Returns pointer to start of first invalid token, or NULL if none. */
|
257
|
+
/* Note that all recognized tokens are processed, regardless. */
|
258
|
+
__LA_DECL const char *archive_entry_copy_fflags_text(struct archive_entry *,
|
259
|
+
const char *);
|
260
|
+
__LA_DECL const wchar_t *archive_entry_copy_fflags_text_w(struct archive_entry *,
|
261
|
+
const wchar_t *);
|
262
|
+
__LA_DECL void archive_entry_set_gid(struct archive_entry *, __LA_GID_T);
|
263
|
+
__LA_DECL void archive_entry_set_gname(struct archive_entry *, const char *);
|
264
|
+
__LA_DECL void archive_entry_copy_gname(struct archive_entry *, const char *);
|
265
|
+
__LA_DECL void archive_entry_copy_gname_w(struct archive_entry *, const wchar_t *);
|
266
|
+
__LA_DECL int archive_entry_update_gname_utf8(struct archive_entry *, const char *);
|
267
|
+
__LA_DECL void archive_entry_set_hardlink(struct archive_entry *, const char *);
|
268
|
+
__LA_DECL void archive_entry_copy_hardlink(struct archive_entry *, const char *);
|
269
|
+
__LA_DECL void archive_entry_copy_hardlink_w(struct archive_entry *, const wchar_t *);
|
270
|
+
__LA_DECL int archive_entry_update_hardlink_utf8(struct archive_entry *, const char *);
|
271
|
+
#if ARCHIVE_VERSION_NUMBER >= 3000000
|
272
|
+
/* Starting with libarchive 3.0, this will be synonym for ino64. */
|
273
|
+
__LA_DECL void archive_entry_set_ino(struct archive_entry *, __LA_INT64_T);
|
274
|
+
#else
|
275
|
+
__LA_DECL void archive_entry_set_ino(struct archive_entry *, unsigned long);
|
276
|
+
#endif
|
277
|
+
__LA_DECL void archive_entry_set_ino64(struct archive_entry *, __LA_INT64_T);
|
278
|
+
__LA_DECL void archive_entry_set_link(struct archive_entry *, const char *);
|
279
|
+
__LA_DECL void archive_entry_copy_link(struct archive_entry *, const char *);
|
280
|
+
__LA_DECL void archive_entry_copy_link_w(struct archive_entry *, const wchar_t *);
|
281
|
+
__LA_DECL int archive_entry_update_link_utf8(struct archive_entry *, const char *);
|
282
|
+
__LA_DECL void archive_entry_set_mode(struct archive_entry *, __LA_MODE_T);
|
283
|
+
__LA_DECL void archive_entry_set_mtime(struct archive_entry *, time_t, long);
|
284
|
+
__LA_DECL void archive_entry_unset_mtime(struct archive_entry *);
|
285
|
+
__LA_DECL void archive_entry_set_nlink(struct archive_entry *, unsigned int);
|
286
|
+
__LA_DECL void archive_entry_set_pathname(struct archive_entry *, const char *);
|
287
|
+
__LA_DECL void archive_entry_copy_pathname(struct archive_entry *, const char *);
|
288
|
+
__LA_DECL void archive_entry_copy_pathname_w(struct archive_entry *, const wchar_t *);
|
289
|
+
__LA_DECL int archive_entry_update_pathname_utf8(struct archive_entry *, const char *);
|
290
|
+
__LA_DECL void archive_entry_set_perm(struct archive_entry *, __LA_MODE_T);
|
291
|
+
__LA_DECL void archive_entry_set_rdev(struct archive_entry *, dev_t);
|
292
|
+
__LA_DECL void archive_entry_set_rdevmajor(struct archive_entry *, dev_t);
|
293
|
+
__LA_DECL void archive_entry_set_rdevminor(struct archive_entry *, dev_t);
|
294
|
+
__LA_DECL void archive_entry_set_size(struct archive_entry *, __LA_INT64_T);
|
295
|
+
__LA_DECL void archive_entry_unset_size(struct archive_entry *);
|
296
|
+
__LA_DECL void archive_entry_copy_sourcepath(struct archive_entry *, const char *);
|
297
|
+
__LA_DECL void archive_entry_set_symlink(struct archive_entry *, const char *);
|
298
|
+
__LA_DECL void archive_entry_copy_symlink(struct archive_entry *, const char *);
|
299
|
+
__LA_DECL void archive_entry_copy_symlink_w(struct archive_entry *, const wchar_t *);
|
300
|
+
__LA_DECL int archive_entry_update_symlink_utf8(struct archive_entry *, const char *);
|
301
|
+
__LA_DECL void archive_entry_set_uid(struct archive_entry *, __LA_UID_T);
|
302
|
+
__LA_DECL void archive_entry_set_uname(struct archive_entry *, const char *);
|
303
|
+
__LA_DECL void archive_entry_copy_uname(struct archive_entry *, const char *);
|
304
|
+
__LA_DECL void archive_entry_copy_uname_w(struct archive_entry *, const wchar_t *);
|
305
|
+
__LA_DECL int archive_entry_update_uname_utf8(struct archive_entry *, const char *);
|
306
|
+
/*
|
307
|
+
* Routines to bulk copy fields to/from a platform-native "struct
|
308
|
+
* stat." Libarchive used to just store a struct stat inside of each
|
309
|
+
* archive_entry object, but this created issues when trying to
|
310
|
+
* manipulate archives on systems different than the ones they were
|
311
|
+
* created on.
|
312
|
+
*
|
313
|
+
* TODO: On Linux, provide both stat32 and stat64 versions of these functions.
|
314
|
+
*/
|
315
|
+
__LA_DECL const struct stat *archive_entry_stat(struct archive_entry *);
|
316
|
+
__LA_DECL void archive_entry_copy_stat(struct archive_entry *, const struct stat *);
|
317
|
+
|
318
|
+
|
319
|
+
/*
|
320
|
+
* ACL routines. This used to simply store and return text-format ACL
|
321
|
+
* strings, but that proved insufficient for a number of reasons:
|
322
|
+
* = clients need control over uname/uid and gname/gid mappings
|
323
|
+
* = there are many different ACL text formats
|
324
|
+
* = would like to be able to read/convert archives containing ACLs
|
325
|
+
* on platforms that lack ACL libraries
|
326
|
+
*
|
327
|
+
* This last point, in particular, forces me to implement a reasonably
|
328
|
+
* complete set of ACL support routines.
|
329
|
+
*
|
330
|
+
* TODO: Extend this to support NFSv4/NTFS permissions. That should
|
331
|
+
* allow full ACL support on Mac OS, in particular, which uses
|
332
|
+
* POSIX.1e-style interfaces to manipulate NFSv4/NTFS permissions.
|
333
|
+
*/
|
334
|
+
|
335
|
+
/*
|
336
|
+
* Permission bits mimic POSIX.1e. Note that I've not followed POSIX.1e's
|
337
|
+
* "permset"/"perm" abstract type nonsense. A permset is just a simple
|
338
|
+
* bitmap, following long-standing Unix tradition.
|
339
|
+
*/
|
340
|
+
#define ARCHIVE_ENTRY_ACL_EXECUTE 1
|
341
|
+
#define ARCHIVE_ENTRY_ACL_WRITE 2
|
342
|
+
#define ARCHIVE_ENTRY_ACL_READ 4
|
343
|
+
|
344
|
+
/* We need to be able to specify either or both of these. */
|
345
|
+
#define ARCHIVE_ENTRY_ACL_TYPE_ACCESS 256
|
346
|
+
#define ARCHIVE_ENTRY_ACL_TYPE_DEFAULT 512
|
347
|
+
|
348
|
+
/* Tag values mimic POSIX.1e */
|
349
|
+
#define ARCHIVE_ENTRY_ACL_USER 10001 /* Specified user. */
|
350
|
+
#define ARCHIVE_ENTRY_ACL_USER_OBJ 10002 /* User who owns the file. */
|
351
|
+
#define ARCHIVE_ENTRY_ACL_GROUP 10003 /* Specified group. */
|
352
|
+
#define ARCHIVE_ENTRY_ACL_GROUP_OBJ 10004 /* Group who owns the file. */
|
353
|
+
#define ARCHIVE_ENTRY_ACL_MASK 10005 /* Modify group access. */
|
354
|
+
#define ARCHIVE_ENTRY_ACL_OTHER 10006 /* Public. */
|
355
|
+
|
356
|
+
/*
|
357
|
+
* Set the ACL by clearing it and adding entries one at a time.
|
358
|
+
* Unlike the POSIX.1e ACL routines, you must specify the type
|
359
|
+
* (access/default) for each entry. Internally, the ACL data is just
|
360
|
+
* a soup of entries. API calls here allow you to retrieve just the
|
361
|
+
* entries of interest. This design (which goes against the spirit of
|
362
|
+
* POSIX.1e) is useful for handling archive formats that combine
|
363
|
+
* default and access information in a single ACL list.
|
364
|
+
*/
|
365
|
+
__LA_DECL void archive_entry_acl_clear(struct archive_entry *);
|
366
|
+
__LA_DECL void archive_entry_acl_add_entry(struct archive_entry *,
|
367
|
+
int /* type */, int /* permset */, int /* tag */,
|
368
|
+
int /* qual */, const char * /* name */);
|
369
|
+
__LA_DECL void archive_entry_acl_add_entry_w(struct archive_entry *,
|
370
|
+
int /* type */, int /* permset */, int /* tag */,
|
371
|
+
int /* qual */, const wchar_t * /* name */);
|
372
|
+
|
373
|
+
/*
|
374
|
+
* To retrieve the ACL, first "reset", then repeatedly ask for the
|
375
|
+
* "next" entry. The want_type parameter allows you to request only
|
376
|
+
* access entries or only default entries.
|
377
|
+
*/
|
378
|
+
__LA_DECL int archive_entry_acl_reset(struct archive_entry *, int /* want_type */);
|
379
|
+
__LA_DECL int archive_entry_acl_next(struct archive_entry *, int /* want_type */,
|
380
|
+
int * /* type */, int * /* permset */, int * /* tag */,
|
381
|
+
int * /* qual */, const char ** /* name */);
|
382
|
+
__LA_DECL int archive_entry_acl_next_w(struct archive_entry *, int /* want_type */,
|
383
|
+
int * /* type */, int * /* permset */, int * /* tag */,
|
384
|
+
int * /* qual */, const wchar_t ** /* name */);
|
385
|
+
|
386
|
+
/*
|
387
|
+
* Construct a text-format ACL. The flags argument is a bitmask that
|
388
|
+
* can include any of the following:
|
389
|
+
*
|
390
|
+
* ARCHIVE_ENTRY_ACL_TYPE_ACCESS - Include access entries.
|
391
|
+
* ARCHIVE_ENTRY_ACL_TYPE_DEFAULT - Include default entries.
|
392
|
+
* ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID - Include extra numeric ID field in
|
393
|
+
* each ACL entry. (As used by 'star'.)
|
394
|
+
* ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT - Include "default:" before each
|
395
|
+
* default ACL entry.
|
396
|
+
*/
|
397
|
+
#define ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID 1024
|
398
|
+
#define ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT 2048
|
399
|
+
__LA_DECL const wchar_t *archive_entry_acl_text_w(struct archive_entry *,
|
400
|
+
int /* flags */);
|
401
|
+
|
402
|
+
/* Return a count of entries matching 'want_type' */
|
403
|
+
__LA_DECL int archive_entry_acl_count(struct archive_entry *, int /* want_type */);
|
404
|
+
|
405
|
+
/*
|
406
|
+
* Private ACL parser. This is private because it handles some
|
407
|
+
* very weird formats that clients should not be messing with.
|
408
|
+
* Clients should only deal with their platform-native formats.
|
409
|
+
* Because of the need to support many formats cleanly, new arguments
|
410
|
+
* are likely to get added on a regular basis. Clients who try to use
|
411
|
+
* this interface are likely to be surprised when it changes.
|
412
|
+
*
|
413
|
+
* You were warned!
|
414
|
+
*
|
415
|
+
* TODO: Move this declaration out of the public header and into
|
416
|
+
* a private header. Warnings above are silly.
|
417
|
+
*/
|
418
|
+
__LA_DECL int __archive_entry_acl_parse_w(struct archive_entry *,
|
419
|
+
const wchar_t *, int /* type */);
|
420
|
+
|
421
|
+
/*
|
422
|
+
* extended attributes
|
423
|
+
*/
|
424
|
+
|
425
|
+
__LA_DECL void archive_entry_xattr_clear(struct archive_entry *);
|
426
|
+
__LA_DECL void archive_entry_xattr_add_entry(struct archive_entry *,
|
427
|
+
const char * /* name */, const void * /* value */,
|
428
|
+
size_t /* size */);
|
429
|
+
|
430
|
+
/*
|
431
|
+
* To retrieve the xattr list, first "reset", then repeatedly ask for the
|
432
|
+
* "next" entry.
|
433
|
+
*/
|
434
|
+
|
435
|
+
__LA_DECL int archive_entry_xattr_count(struct archive_entry *);
|
436
|
+
__LA_DECL int archive_entry_xattr_reset(struct archive_entry *);
|
437
|
+
__LA_DECL int archive_entry_xattr_next(struct archive_entry *,
|
438
|
+
const char ** /* name */, const void ** /* value */, size_t *);
|
439
|
+
|
440
|
+
/*
|
441
|
+
* Utility to match up hardlinks.
|
442
|
+
*
|
443
|
+
* The 'struct archive_entry_linkresolver' is a cache of archive entries
|
444
|
+
* for files with multiple links. Here's how to use it:
|
445
|
+
* 1. Create a lookup object with archive_entry_linkresolver_new()
|
446
|
+
* 2. Tell it the archive format you're using.
|
447
|
+
* 3. Hand each archive_entry to archive_entry_linkify().
|
448
|
+
* That function will return 0, 1, or 2 entries that should
|
449
|
+
* be written.
|
450
|
+
* 4. Call archive_entry_linkify(resolver, NULL) until
|
451
|
+
* no more entries are returned.
|
452
|
+
* 5. Call archive_entry_link_resolver_free(resolver) to free resources.
|
453
|
+
*
|
454
|
+
* The entries returned have their hardlink and size fields updated
|
455
|
+
* appropriately. If an entry is passed in that does not refer to
|
456
|
+
* a file with multiple links, it is returned unchanged. The intention
|
457
|
+
* is that you should be able to simply filter all entries through
|
458
|
+
* this machine.
|
459
|
+
*
|
460
|
+
* To make things more efficient, be sure that each entry has a valid
|
461
|
+
* nlinks value. The hardlink cache uses this to track when all links
|
462
|
+
* have been found. If the nlinks value is zero, it will keep every
|
463
|
+
* name in the cache indefinitely, which can use a lot of memory.
|
464
|
+
*
|
465
|
+
* Note that archive_entry_size() is reset to zero if the file
|
466
|
+
* body should not be written to the archive. Pay attention!
|
467
|
+
*/
|
468
|
+
struct archive_entry_linkresolver;
|
469
|
+
|
470
|
+
/*
|
471
|
+
* There are three different strategies for marking hardlinks.
|
472
|
+
* The descriptions below name them after the best-known
|
473
|
+
* formats that rely on each strategy:
|
474
|
+
*
|
475
|
+
* "Old cpio" is the simplest, it always returns any entry unmodified.
|
476
|
+
* As far as I know, only cpio formats use this. Old cpio archives
|
477
|
+
* store every link with the full body; the onus is on the dearchiver
|
478
|
+
* to detect and properly link the files as they are restored.
|
479
|
+
* "tar" is also pretty simple; it caches a copy the first time it sees
|
480
|
+
* any link. Subsequent appearances are modified to be hardlink
|
481
|
+
* references to the first one without any body. Used by all tar
|
482
|
+
* formats, although the newest tar formats permit the "old cpio" strategy
|
483
|
+
* as well. This strategy is very simple for the dearchiver,
|
484
|
+
* and reasonably straightforward for the archiver.
|
485
|
+
* "new cpio" is trickier. It stores the body only with the last
|
486
|
+
* occurrence. The complication is that we might not
|
487
|
+
* see every link to a particular file in a single session, so
|
488
|
+
* there's no easy way to know when we've seen the last occurrence.
|
489
|
+
* The solution here is to queue one link until we see the next.
|
490
|
+
* At the end of the session, you can enumerate any remaining
|
491
|
+
* entries by calling archive_entry_linkify(NULL) and store those
|
492
|
+
* bodies. If you have a file with three links l1, l2, and l3,
|
493
|
+
* you'll get the following behavior if you see all three links:
|
494
|
+
* linkify(l1) => NULL (the resolver stores l1 internally)
|
495
|
+
* linkify(l2) => l1 (resolver stores l2, you write l1)
|
496
|
+
* linkify(l3) => l2, l3 (all links seen, you can write both).
|
497
|
+
* If you only see l1 and l2, you'll get this behavior:
|
498
|
+
* linkify(l1) => NULL
|
499
|
+
* linkify(l2) => l1
|
500
|
+
* linkify(NULL) => l2 (at end, you retrieve remaining links)
|
501
|
+
* As the name suggests, this strategy is used by newer cpio variants.
|
502
|
+
* It's noticably more complex for the archiver, slightly more complex
|
503
|
+
* for the dearchiver than the tar strategy, but makes it straightforward
|
504
|
+
* to restore a file using any link by simply continuing to scan until
|
505
|
+
* you see a link that is stored with a body. In contrast, the tar
|
506
|
+
* strategy requires you to rescan the archive from the beginning to
|
507
|
+
* correctly extract an arbitrary link.
|
508
|
+
*/
|
509
|
+
|
510
|
+
__LA_DECL struct archive_entry_linkresolver *archive_entry_linkresolver_new(void);
|
511
|
+
__LA_DECL void archive_entry_linkresolver_set_strategy(
|
512
|
+
struct archive_entry_linkresolver *, int /* format_code */);
|
513
|
+
__LA_DECL void archive_entry_linkresolver_free(struct archive_entry_linkresolver *);
|
514
|
+
__LA_DECL void archive_entry_linkify(struct archive_entry_linkresolver *,
|
515
|
+
struct archive_entry **, struct archive_entry **);
|
516
|
+
|
517
|
+
#ifdef __cplusplus
|
518
|
+
}
|
519
|
+
#endif
|
520
|
+
|
521
|
+
/* This is meaningless outside of this header. */
|
522
|
+
#undef __LA_DECL
|
523
|
+
|
524
|
+
#endif /* !ARCHIVE_ENTRY_H_INCLUDED */
|
@@ -0,0 +1,74 @@
|
|
1
|
+
/*-
|
2
|
+
* Copyright (c) 2003-2007 Tim Kientzle
|
3
|
+
* All rights reserved.
|
4
|
+
*
|
5
|
+
* Redistribution and use in source and binary forms, with or without
|
6
|
+
* modification, are permitted provided that the following conditions
|
7
|
+
* are met:
|
8
|
+
* 1. Redistributions of source code must retain the above copyright
|
9
|
+
* notice, this list of conditions and the following disclaimer.
|
10
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
11
|
+
* notice, this list of conditions and the following disclaimer in the
|
12
|
+
* documentation and/or other materials provided with the distribution.
|
13
|
+
*
|
14
|
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
|
15
|
+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
16
|
+
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
17
|
+
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
|
18
|
+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
19
|
+
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
20
|
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
21
|
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
22
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
23
|
+
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
24
|
+
*/
|
25
|
+
|
26
|
+
#include "archive_platform.h"
|
27
|
+
__FBSDID("$FreeBSD$");
|
28
|
+
|
29
|
+
#include "archive_private.h"
|
30
|
+
#include "archive_entry.h"
|
31
|
+
|
32
|
+
#if defined(_WIN32) && !defined(__CYGWIN__)
|
33
|
+
|
34
|
+
#define EPOC_TIME ARCHIVE_LITERAL_ULL(116444736000000000)
|
35
|
+
|
36
|
+
__inline static void
|
37
|
+
fileTimeToUtc(const FILETIME *filetime, time_t *time, long *ns)
|
38
|
+
{
|
39
|
+
ULARGE_INTEGER utc;
|
40
|
+
|
41
|
+
utc.HighPart = filetime->dwHighDateTime;
|
42
|
+
utc.LowPart = filetime->dwLowDateTime;
|
43
|
+
if (utc.QuadPart >= EPOC_TIME) {
|
44
|
+
utc.QuadPart -= EPOC_TIME;
|
45
|
+
*time = (time_t)(utc.QuadPart / 10000000); /* milli seconds base */
|
46
|
+
*ns = (long)(utc.QuadPart % 10000000) * 100;/* nano seconds base */
|
47
|
+
} else {
|
48
|
+
*time = 0;
|
49
|
+
*ns = 0;
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
void
|
54
|
+
archive_entry_copy_bhfi(struct archive_entry *entry,
|
55
|
+
BY_HANDLE_FILE_INFORMATION *bhfi)
|
56
|
+
{
|
57
|
+
time_t secs;
|
58
|
+
long nsecs;
|
59
|
+
|
60
|
+
fileTimeToUtc(&bhfi->ftLastAccessTime, &secs, &nsecs);
|
61
|
+
archive_entry_set_atime(entry, secs, nsecs);
|
62
|
+
fileTimeToUtc(&bhfi->ftLastWriteTime, &secs, &nsecs);
|
63
|
+
archive_entry_set_mtime(entry, secs, nsecs);
|
64
|
+
fileTimeToUtc(&bhfi->ftCreationTime, &secs, &nsecs);
|
65
|
+
archive_entry_set_birthtime(entry, secs, nsecs);
|
66
|
+
archive_entry_set_dev(entry, bhfi->dwVolumeSerialNumber);
|
67
|
+
archive_entry_set_ino64(entry, (((int64_t)bhfi->nFileIndexHigh) << 32)
|
68
|
+
+ bhfi->nFileIndexLow);
|
69
|
+
archive_entry_set_nlink(entry, bhfi->nNumberOfLinks);
|
70
|
+
archive_entry_set_size(entry, (((int64_t)bhfi->nFileSizeHigh) << 32)
|
71
|
+
+ bhfi->nFileSizeLow);
|
72
|
+
// archive_entry_set_mode(entry, st->st_mode);
|
73
|
+
}
|
74
|
+
#endif
|
@@ -0,0 +1,77 @@
|
|
1
|
+
/*-
|
2
|
+
* Copyright (c) 2003-2007 Tim Kientzle
|
3
|
+
* All rights reserved.
|
4
|
+
*
|
5
|
+
* Redistribution and use in source and binary forms, with or without
|
6
|
+
* modification, are permitted provided that the following conditions
|
7
|
+
* are met:
|
8
|
+
* 1. Redistributions of source code must retain the above copyright
|
9
|
+
* notice, this list of conditions and the following disclaimer.
|
10
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
11
|
+
* notice, this list of conditions and the following disclaimer in the
|
12
|
+
* documentation and/or other materials provided with the distribution.
|
13
|
+
*
|
14
|
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
|
15
|
+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
16
|
+
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
17
|
+
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
|
18
|
+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
19
|
+
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
20
|
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
21
|
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
22
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
23
|
+
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
24
|
+
*/
|
25
|
+
|
26
|
+
#include "archive_platform.h"
|
27
|
+
__FBSDID("$FreeBSD: head/lib/libarchive/archive_entry_copy_stat.c 189466 2009-03-07 00:52:02Z kientzle $");
|
28
|
+
|
29
|
+
#ifdef HAVE_SYS_STAT_H
|
30
|
+
#include <sys/stat.h>
|
31
|
+
#endif
|
32
|
+
|
33
|
+
#include "archive_entry.h"
|
34
|
+
|
35
|
+
void
|
36
|
+
archive_entry_copy_stat(struct archive_entry *entry, const struct stat *st)
|
37
|
+
{
|
38
|
+
#if HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC
|
39
|
+
archive_entry_set_atime(entry, st->st_atime, st->st_atimespec.tv_nsec);
|
40
|
+
archive_entry_set_ctime(entry, st->st_ctime, st->st_ctimespec.tv_nsec);
|
41
|
+
archive_entry_set_mtime(entry, st->st_mtime, st->st_mtimespec.tv_nsec);
|
42
|
+
#elif HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
|
43
|
+
archive_entry_set_atime(entry, st->st_atime, st->st_atim.tv_nsec);
|
44
|
+
archive_entry_set_ctime(entry, st->st_ctime, st->st_ctim.tv_nsec);
|
45
|
+
archive_entry_set_mtime(entry, st->st_mtime, st->st_mtim.tv_nsec);
|
46
|
+
#elif HAVE_STRUCT_STAT_ST_MTIME_N
|
47
|
+
archive_entry_set_atime(entry, st->st_atime, st->st_atime_n);
|
48
|
+
archive_entry_set_ctime(entry, st->st_ctime, st->st_ctime_n);
|
49
|
+
archive_entry_set_mtime(entry, st->st_mtime, st->st_mtime_n);
|
50
|
+
#elif HAVE_STRUCT_STAT_ST_UMTIME
|
51
|
+
archive_entry_set_atime(entry, st->st_atime, st->st_uatime * 1000);
|
52
|
+
archive_entry_set_ctime(entry, st->st_ctime, st->st_uctime * 1000);
|
53
|
+
archive_entry_set_mtime(entry, st->st_mtime, st->st_umtime * 1000);
|
54
|
+
#elif HAVE_STRUCT_STAT_ST_MTIME_USEC
|
55
|
+
archive_entry_set_atime(entry, st->st_atime, st->st_atime_usec * 1000);
|
56
|
+
archive_entry_set_ctime(entry, st->st_ctime, st->st_ctime_usec * 1000);
|
57
|
+
archive_entry_set_mtime(entry, st->st_mtime, st->st_mtime_usec * 1000);
|
58
|
+
#else
|
59
|
+
archive_entry_set_atime(entry, st->st_atime, 0);
|
60
|
+
archive_entry_set_ctime(entry, st->st_ctime, 0);
|
61
|
+
archive_entry_set_mtime(entry, st->st_mtime, 0);
|
62
|
+
#if HAVE_STRUCT_STAT_ST_BIRTHTIME
|
63
|
+
archive_entry_set_birthtime(entry, st->st_birthtime, 0);
|
64
|
+
#endif
|
65
|
+
#endif
|
66
|
+
#if HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC
|
67
|
+
archive_entry_set_birthtime(entry, st->st_birthtime, st->st_birthtimespec.tv_nsec);
|
68
|
+
#endif
|
69
|
+
archive_entry_set_dev(entry, st->st_dev);
|
70
|
+
archive_entry_set_gid(entry, st->st_gid);
|
71
|
+
archive_entry_set_uid(entry, st->st_uid);
|
72
|
+
archive_entry_set_ino(entry, st->st_ino);
|
73
|
+
archive_entry_set_nlink(entry, st->st_nlink);
|
74
|
+
archive_entry_set_rdev(entry, st->st_rdev);
|
75
|
+
archive_entry_set_size(entry, st->st_size);
|
76
|
+
archive_entry_set_mode(entry, st->st_mode);
|
77
|
+
}
|