2 * Copyright (c) 2003-2007 Tim Kientzle
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
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.
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.
28 #ifndef __LIBARCHIVE_BUILD
29 #error This header is only to be used internally to libarchive.
32 #ifndef ARCHIVE_ENTRY_PRIVATE_H_INCLUDED
33 #define ARCHIVE_ENTRY_PRIVATE_H_INCLUDED
35 #include "archive_acl_private.h"
36 #include "archive_string.h"
39 struct ae_xattr *next;
47 struct ae_sparse *next;
54 * Description of an archive entry.
56 * Basically, this is a "struct stat" with a few text fields added in.
58 * TODO: Add "comment", "charset", and possibly other entries
59 * that are supported by "pax interchange" format. However, GNU, ustar,
60 * cpio, and other variants don't support these features, so they're not an
61 * excruciatingly high priority right now.
63 * TODO: "pax interchange" format allows essentially arbitrary
64 * key/value attributes to be attached to any entry. Supporting
65 * such extensions may make this library useful for special
66 * applications (e.g., a package manager could attach special
67 * package-management attributes to each entry). There are tricky
68 * API issues involved, so this is not going to happen until
69 * there's a real demand for it.
71 * TODO: Design a good API for handling sparse files.
73 struct archive_entry {
74 struct archive *archive;
77 * Note that ae_stat.st_mode & AE_IFMT can be 0!
79 * This occurs when the actual file type of the object is not
80 * in the archive. For example, 'tar' archives store
81 * hardlinks without marking the type of the underlying
86 * We have a "struct aest" for holding file metadata rather than just
87 * a "struct stat" because on some platforms the "struct stat" has
88 * fields which are too narrow to hold the range of possible values;
89 * we don't want to lose information if we read an archive and write
90 * out another (e.g., in "tar -cf new.tar @old.tar").
92 * The "stat" pointer points to some form of platform-specific struct
93 * stat; it is declared as a void * rather than a struct stat * as
94 * some platforms have multiple varieties of stat structures.
97 int stat_valid; /* Set to 0 whenever a field in aest changes. */
101 uint32_t aest_atime_nsec;
103 uint32_t aest_ctime_nsec;
105 uint32_t aest_mtime_nsec;
106 int64_t aest_birthtime;
107 uint32_t aest_birthtime_nsec;
114 * Because converting between device codes and
115 * major/minor values is platform-specific and
116 * inherently a bit risky, we only do that conversion
117 * lazily. That way, we will do a better job of
118 * preserving information in those cases where no
119 * conversion is actually required.
121 int aest_dev_is_broken_down;
125 int aest_rdev_is_broken_down;
127 dev_t aest_rdevmajor;
128 dev_t aest_rdevminor;
131 int ae_set; /* bitmap of fields that are currently set */
132 #define AE_SET_HARDLINK 1
133 #define AE_SET_SYMLINK 2
134 #define AE_SET_ATIME 4
135 #define AE_SET_CTIME 8
136 #define AE_SET_MTIME 16
137 #define AE_SET_BIRTHTIME 32
138 #define AE_SET_SIZE 64
139 #define AE_SET_INO 128
140 #define AE_SET_DEV 256
143 * Use aes here so that we get transparent mbs<->wcs conversions.
145 struct archive_mstring ae_fflags_text; /* Text fflags per fflagstostr(3) */
146 unsigned long ae_fflags_set; /* Bitmap fflags */
147 unsigned long ae_fflags_clear;
148 struct archive_mstring ae_gname; /* Name of owning group */
149 struct archive_mstring ae_hardlink; /* Name of target for hardlink */
150 struct archive_mstring ae_pathname; /* Name of entry */
151 struct archive_mstring ae_symlink; /* symlink contents */
152 struct archive_mstring ae_uname; /* Name of owner */
154 /* Not used within libarchive; useful for some clients. */
155 struct archive_mstring ae_sourcepath; /* Path this entry is sourced from. */
158 size_t mac_metadata_size;
161 struct archive_acl acl;
163 /* extattr support. */
164 struct ae_xattr *xattr_head;
165 struct ae_xattr *xattr_p;
167 /* sparse support. */
168 struct ae_sparse *sparse_head;
169 struct ae_sparse *sparse_tail;
170 struct ae_sparse *sparse_p;
176 #endif /* ARCHIVE_ENTRY_PRIVATE_H_INCLUDED */