@papyrus-sdk/engine-native 0.2.22-beta.9.epub.2 → 0.2.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/PapyrusNativeEngine.podspec +45 -0
- package/android/build.gradle +1 -0
- package/android/src/main/cpp/CMakeLists.txt +137 -0
- package/android/src/main/cpp/PapyrusComicArchiveJni.cpp +68 -0
- package/android/src/main/cpp/PapyrusComicArchiveTest.cpp +55 -0
- package/android/src/main/cpp/papyrus_outline_loader_test.cpp +240 -0
- package/android/src/main/cpp/papyrus_text_word_test.cpp +72 -0
- package/android/src/main/java/com/papyrus/engine/PapyrusComicArchiveNative.java +14 -0
- package/android/src/main/java/com/papyrus/engine/PapyrusComicDocumentView.java +491 -0
- package/android/src/main/java/com/papyrus/engine/PapyrusComicDocumentViewManager.java +32 -0
- package/android/src/main/java/com/papyrus/engine/PapyrusComicPageLayout.java +38 -0
- package/android/src/main/java/com/papyrus/engine/PapyrusNativeEngineModule.java +305 -35
- package/android/src/main/java/com/papyrus/engine/PapyrusNativeTextModel.java +195 -0
- package/android/src/main/java/com/papyrus/engine/PapyrusPackage.java +3 -1
- package/android/src/main/java/com/papyrus/engine/PapyrusPdfViewerView.java +195 -5
- package/android/src/main/java/com/papyrus/engine/PapyrusPdfViewerViewManager.java +20 -1
- package/android/src/main/java/com/papyrus/engine/PapyrusSelectionMenuIcon.java +48 -0
- package/android/src/main/java/com/papyrus/engine/PapyrusTextAnnotationModel.java +22 -0
- package/android/src/main/java/com/papyrus/engine/PapyrusTextDocumentView.java +661 -0
- package/android/src/main/java/com/papyrus/engine/PapyrusTextDocumentViewManager.java +49 -0
- package/android/src/main/java/com/papyrus/engine/PapyrusTextStore.java +43 -0
- package/dist/index.d.mts +614 -4
- package/dist/index.d.ts +614 -4
- package/dist/index.js +484 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +477 -7
- package/dist/index.mjs.map +1 -1
- package/ios/PapyrusComicDocumentView.h +21 -0
- package/ios/PapyrusComicDocumentView.m +554 -0
- package/ios/PapyrusComicDocumentViewManager.m +23 -0
- package/ios/PapyrusEngineStore.h +3 -0
- package/ios/PapyrusEngineStore.m +32 -6
- package/ios/PapyrusNativeEngine.m +684 -5
- package/ios/PapyrusPageRotationRegistry.h +29 -0
- package/ios/PapyrusPageRotationRegistry.m +179 -0
- package/ios/PapyrusPageView.m +38 -11
- package/ios/PapyrusPdfDocumentView.h +55 -0
- package/ios/PapyrusPdfDocumentView.m +2370 -0
- package/ios/PapyrusPdfDocumentViewManager.m +61 -0
- package/ios/PapyrusPdfPageTheme.h +15 -0
- package/ios/PapyrusPdfPageTheme.m +218 -0
- package/ios/PapyrusSelectionMenu.h +27 -0
- package/ios/PapyrusTextAnnotationRange.h +2 -0
- package/ios/PapyrusTextAnnotationRange.m +29 -0
- package/ios/PapyrusTextDocumentView.h +32 -0
- package/ios/PapyrusTextDocumentView.m +518 -0
- package/ios/PapyrusTextDocumentViewManager.m +34 -0
- package/ios/PapyrusTextStore.h +13 -0
- package/ios/PapyrusTextStore.m +73 -0
- package/package.json +10 -8
- package/react-native.config.js +1 -1
- package/third_party_licenses/BLAKE2-NOTICE.txt +11 -0
- package/third_party_licenses/libarchive-COPYING +65 -0
- package/vendor/libarchive/PapyrusComicArchive.cpp +376 -0
- package/vendor/libarchive/PapyrusComicArchive.h +30 -0
- package/vendor/libarchive/README.papyrus.md +15 -0
- package/vendor/libarchive/android.h +192 -0
- package/vendor/libarchive/config/PapyrusArchiveConfig.h +71 -0
- package/vendor/libarchive/libarchive/CMakeLists.txt +293 -0
- package/vendor/libarchive/libarchive/android_lf.h +36 -0
- package/vendor/libarchive/libarchive/archive.h +1266 -0
- package/vendor/libarchive/libarchive/archive_acl.c +2025 -0
- package/vendor/libarchive/libarchive/archive_acl_private.h +85 -0
- package/vendor/libarchive/libarchive/archive_blake2.h +197 -0
- package/vendor/libarchive/libarchive/archive_blake2_impl.h +161 -0
- package/vendor/libarchive/libarchive/archive_blake2s_ref.c +369 -0
- package/vendor/libarchive/libarchive/archive_blake2sp_ref.c +361 -0
- package/vendor/libarchive/libarchive/archive_check_magic.c +183 -0
- package/vendor/libarchive/libarchive/archive_cmdline.c +211 -0
- package/vendor/libarchive/libarchive/archive_cmdline_private.h +45 -0
- package/vendor/libarchive/libarchive/archive_crc32.h +123 -0
- package/vendor/libarchive/libarchive/archive_cryptor.c +534 -0
- package/vendor/libarchive/libarchive/archive_cryptor_private.h +199 -0
- package/vendor/libarchive/libarchive/archive_digest.c +1584 -0
- package/vendor/libarchive/libarchive/archive_digest_private.h +431 -0
- package/vendor/libarchive/libarchive/archive_disk_acl_darwin.c +558 -0
- package/vendor/libarchive/libarchive/archive_disk_acl_freebsd.c +712 -0
- package/vendor/libarchive/libarchive/archive_disk_acl_linux.c +760 -0
- package/vendor/libarchive/libarchive/archive_disk_acl_sunos.c +824 -0
- package/vendor/libarchive/libarchive/archive_endian.h +234 -0
- package/vendor/libarchive/libarchive/archive_entry.3 +147 -0
- package/vendor/libarchive/libarchive/archive_entry.c +2297 -0
- package/vendor/libarchive/libarchive/archive_entry.h +763 -0
- package/vendor/libarchive/libarchive/archive_entry_acl.3 +458 -0
- package/vendor/libarchive/libarchive/archive_entry_copy_bhfi.c +55 -0
- package/vendor/libarchive/libarchive/archive_entry_copy_stat.c +82 -0
- package/vendor/libarchive/libarchive/archive_entry_link_resolver.c +472 -0
- package/vendor/libarchive/libarchive/archive_entry_linkify.3 +224 -0
- package/vendor/libarchive/libarchive/archive_entry_locale.h +90 -0
- package/vendor/libarchive/libarchive/archive_entry_misc.3 +63 -0
- package/vendor/libarchive/libarchive/archive_entry_paths.3 +153 -0
- package/vendor/libarchive/libarchive/archive_entry_perms.3 +210 -0
- package/vendor/libarchive/libarchive/archive_entry_private.h +205 -0
- package/vendor/libarchive/libarchive/archive_entry_sparse.c +156 -0
- package/vendor/libarchive/libarchive/archive_entry_stat.3 +274 -0
- package/vendor/libarchive/libarchive/archive_entry_stat.c +121 -0
- package/vendor/libarchive/libarchive/archive_entry_strmode.c +69 -0
- package/vendor/libarchive/libarchive/archive_entry_time.3 +127 -0
- package/vendor/libarchive/libarchive/archive_entry_xattr.c +155 -0
- package/vendor/libarchive/libarchive/archive_hmac.c +345 -0
- package/vendor/libarchive/libarchive/archive_hmac_private.h +119 -0
- package/vendor/libarchive/libarchive/archive_integer.h +267 -0
- package/vendor/libarchive/libarchive/archive_match.c +1869 -0
- package/vendor/libarchive/libarchive/archive_openssl_evp_private.h +54 -0
- package/vendor/libarchive/libarchive/archive_openssl_hmac_private.h +54 -0
- package/vendor/libarchive/libarchive/archive_options.c +219 -0
- package/vendor/libarchive/libarchive/archive_options_private.h +49 -0
- package/vendor/libarchive/libarchive/archive_pack_dev.c +330 -0
- package/vendor/libarchive/libarchive/archive_pack_dev.h +49 -0
- package/vendor/libarchive/libarchive/archive_parse_date.c +1173 -0
- package/vendor/libarchive/libarchive/archive_pathmatch.c +480 -0
- package/vendor/libarchive/libarchive/archive_pathmatch.h +50 -0
- package/vendor/libarchive/libarchive/archive_platform.h +213 -0
- package/vendor/libarchive/libarchive/archive_platform_acl.h +53 -0
- package/vendor/libarchive/libarchive/archive_platform_stat.h +45 -0
- package/vendor/libarchive/libarchive/archive_platform_xattr.h +45 -0
- package/vendor/libarchive/libarchive/archive_ppmd7.c +1173 -0
- package/vendor/libarchive/libarchive/archive_ppmd7_private.h +119 -0
- package/vendor/libarchive/libarchive/archive_ppmd8.c +1293 -0
- package/vendor/libarchive/libarchive/archive_ppmd8_private.h +123 -0
- package/vendor/libarchive/libarchive/archive_ppmd_private.h +159 -0
- package/vendor/libarchive/libarchive/archive_private.h +209 -0
- package/vendor/libarchive/libarchive/archive_random.c +274 -0
- package/vendor/libarchive/libarchive/archive_random_private.h +36 -0
- package/vendor/libarchive/libarchive/archive_rb.c +709 -0
- package/vendor/libarchive/libarchive/archive_rb.h +113 -0
- package/vendor/libarchive/libarchive/archive_read.3 +250 -0
- package/vendor/libarchive/libarchive/archive_read.c +1814 -0
- package/vendor/libarchive/libarchive/archive_read_add_passphrase.3 +72 -0
- package/vendor/libarchive/libarchive/archive_read_add_passphrase.c +189 -0
- package/vendor/libarchive/libarchive/archive_read_append_filter.c +209 -0
- package/vendor/libarchive/libarchive/archive_read_data.3 +128 -0
- package/vendor/libarchive/libarchive/archive_read_data_into_fd.c +207 -0
- package/vendor/libarchive/libarchive/archive_read_disk.3 +422 -0
- package/vendor/libarchive/libarchive/archive_read_disk_entry_from_file.c +1086 -0
- package/vendor/libarchive/libarchive/archive_read_disk_posix.c +2639 -0
- package/vendor/libarchive/libarchive/archive_read_disk_private.h +97 -0
- package/vendor/libarchive/libarchive/archive_read_disk_set_standard_lookup.c +315 -0
- package/vendor/libarchive/libarchive/archive_read_disk_windows.c +2603 -0
- package/vendor/libarchive/libarchive/archive_read_extract.3 +135 -0
- package/vendor/libarchive/libarchive/archive_read_extract.c +59 -0
- package/vendor/libarchive/libarchive/archive_read_extract2.c +154 -0
- package/vendor/libarchive/libarchive/archive_read_filter.3 +163 -0
- package/vendor/libarchive/libarchive/archive_read_format.3 +190 -0
- package/vendor/libarchive/libarchive/archive_read_free.3 +91 -0
- package/vendor/libarchive/libarchive/archive_read_header.3 +89 -0
- package/vendor/libarchive/libarchive/archive_read_new.3 +57 -0
- package/vendor/libarchive/libarchive/archive_read_open.3 +247 -0
- package/vendor/libarchive/libarchive/archive_read_open_fd.c +236 -0
- package/vendor/libarchive/libarchive/archive_read_open_file.c +257 -0
- package/vendor/libarchive/libarchive/archive_read_open_filename.c +652 -0
- package/vendor/libarchive/libarchive/archive_read_open_memory.c +188 -0
- package/vendor/libarchive/libarchive/archive_read_private.h +274 -0
- package/vendor/libarchive/libarchive/archive_read_set_format.c +116 -0
- package/vendor/libarchive/libarchive/archive_read_set_options.3 +290 -0
- package/vendor/libarchive/libarchive/archive_read_set_options.c +132 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_all.c +84 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_by_code.c +68 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_bzip2.c +360 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_compress.c +457 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_grzip.c +108 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_gzip.c +538 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_lrzip.c +119 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_lz4.c +829 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_lzop.c +493 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_none.c +51 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_program.c +497 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_rpm.c +249 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_uu.c +739 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_xz.c +792 -0
- package/vendor/libarchive/libarchive/archive_read_support_filter_zstd.c +356 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_7zip.c +4650 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_all.c +88 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_ar.c +597 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_by_code.c +76 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_cab.c +3410 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_cpio.c +1152 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_empty.c +95 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_iso9660.c +3516 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_lha.c +2931 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_mtree.c +2113 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_rar.c +3932 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_rar5.c +4501 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_raw.c +194 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_tar.c +3785 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_warc.c +875 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_xar.c +3770 -0
- package/vendor/libarchive/libarchive/archive_read_support_format_zip.c +4710 -0
- package/vendor/libarchive/libarchive/archive_string.c +4391 -0
- package/vendor/libarchive/libarchive/archive_string.h +244 -0
- package/vendor/libarchive/libarchive/archive_string_composition.h +2289 -0
- package/vendor/libarchive/libarchive/archive_string_sprintf.c +200 -0
- package/vendor/libarchive/libarchive/archive_time.c +168 -0
- package/vendor/libarchive/libarchive/archive_time_private.h +47 -0
- package/vendor/libarchive/libarchive/archive_util.3 +239 -0
- package/vendor/libarchive/libarchive/archive_util.c +668 -0
- package/vendor/libarchive/libarchive/archive_version_details.c +516 -0
- package/vendor/libarchive/libarchive/archive_virtual.c +162 -0
- package/vendor/libarchive/libarchive/archive_windows.c +1035 -0
- package/vendor/libarchive/libarchive/archive_windows.h +332 -0
- package/vendor/libarchive/libarchive/archive_write.3 +266 -0
- package/vendor/libarchive/libarchive/archive_write.c +896 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter.c +71 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter_b64encode.c +329 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter_by_name.c +76 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter_bzip2.c +411 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter_compress.c +459 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter_grzip.c +143 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter_gzip.c +493 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter_lrzip.c +214 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter_lz4.c +710 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter_lzop.c +500 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter_none.c +42 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter_program.c +398 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter_uuencode.c +320 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter_xz.c +547 -0
- package/vendor/libarchive/libarchive/archive_write_add_filter_zstd.c +608 -0
- package/vendor/libarchive/libarchive/archive_write_blocksize.3 +112 -0
- package/vendor/libarchive/libarchive/archive_write_data.3 +88 -0
- package/vendor/libarchive/libarchive/archive_write_disk.3 +360 -0
- package/vendor/libarchive/libarchive/archive_write_disk_posix.c +4789 -0
- package/vendor/libarchive/libarchive/archive_write_disk_private.h +43 -0
- package/vendor/libarchive/libarchive/archive_write_disk_set_standard_lookup.c +265 -0
- package/vendor/libarchive/libarchive/archive_write_disk_windows.c +2952 -0
- package/vendor/libarchive/libarchive/archive_write_filter.3 +140 -0
- package/vendor/libarchive/libarchive/archive_write_finish_entry.3 +77 -0
- package/vendor/libarchive/libarchive/archive_write_format.3 +187 -0
- package/vendor/libarchive/libarchive/archive_write_free.3 +94 -0
- package/vendor/libarchive/libarchive/archive_write_header.3 +71 -0
- package/vendor/libarchive/libarchive/archive_write_new.3 +56 -0
- package/vendor/libarchive/libarchive/archive_write_open.3 +270 -0
- package/vendor/libarchive/libarchive/archive_write_open_fd.c +141 -0
- package/vendor/libarchive/libarchive/archive_write_open_file.c +102 -0
- package/vendor/libarchive/libarchive/archive_write_open_filename.c +272 -0
- package/vendor/libarchive/libarchive/archive_write_open_memory.c +110 -0
- package/vendor/libarchive/libarchive/archive_write_private.h +166 -0
- package/vendor/libarchive/libarchive/archive_write_set_format.c +124 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_7zip.c +2571 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_ar.c +540 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_by_name.c +93 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_cpio.c +11 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_cpio_binary.c +618 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_cpio_newc.c +457 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_cpio_odc.c +508 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_filter_by_ext.c +141 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_gnutar.c +790 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_iso9660.c +8216 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_mtree.c +2307 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_pax.c +2249 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_private.h +40 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_raw.c +123 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_shar.c +650 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_ustar.c +768 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_v7tar.c +648 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_warc.c +491 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_xar.c +3799 -0
- package/vendor/libarchive/libarchive/archive_write_set_format_zip.c +2548 -0
- package/vendor/libarchive/libarchive/archive_write_set_options.3 +779 -0
- package/vendor/libarchive/libarchive/archive_write_set_options.c +129 -0
- package/vendor/libarchive/libarchive/archive_write_set_passphrase.3 +72 -0
- package/vendor/libarchive/libarchive/archive_write_set_passphrase.c +95 -0
- package/vendor/libarchive/libarchive/archive_xxhash.h +48 -0
- package/vendor/libarchive/libarchive/config_freebsd.h +275 -0
- package/vendor/libarchive/libarchive/cpio.5 +389 -0
- package/vendor/libarchive/libarchive/filter_fork.h +44 -0
- package/vendor/libarchive/libarchive/filter_fork_posix.c +269 -0
- package/vendor/libarchive/libarchive/filter_fork_windows.c +270 -0
- package/vendor/libarchive/libarchive/libarchive-formats.5 +478 -0
- package/vendor/libarchive/libarchive/libarchive.3 +297 -0
- package/vendor/libarchive/libarchive/libarchive_changes.3 +339 -0
- package/vendor/libarchive/libarchive/libarchive_internals.3 +363 -0
- package/vendor/libarchive/libarchive/module.modulemap +34 -0
- package/vendor/libarchive/libarchive/mtree.5 +323 -0
- package/vendor/libarchive/libarchive/tar.5 +947 -0
- package/vendor/libarchive/libarchive/xxhash.c +531 -0
- package/ios/PapyrusNativeEngine.podspec +0 -15
|
@@ -0,0 +1,207 @@
|
|
|
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
|
+
|
|
28
|
+
#ifdef HAVE_SYS_TYPES_H
|
|
29
|
+
#include <sys/types.h>
|
|
30
|
+
#endif
|
|
31
|
+
#ifdef HAVE_ERRNO_H
|
|
32
|
+
#include <errno.h>
|
|
33
|
+
#endif
|
|
34
|
+
#ifdef HAVE_UNISTD_H
|
|
35
|
+
#include <unistd.h>
|
|
36
|
+
#endif
|
|
37
|
+
|
|
38
|
+
#include "archive.h"
|
|
39
|
+
#include "archive_private.h"
|
|
40
|
+
#include "archive_read_private.h"
|
|
41
|
+
|
|
42
|
+
/* Maximum amount of data to write at one time. */
|
|
43
|
+
#define MAX_WRITE (1024 * 1024)
|
|
44
|
+
|
|
45
|
+
/*
|
|
46
|
+
* This implementation minimizes copying of data and is sparse-file aware.
|
|
47
|
+
*/
|
|
48
|
+
static int
|
|
49
|
+
pad_to(struct archive *a, int fd, int can_lseek,
|
|
50
|
+
char **nulls, int64_t target_offset, int64_t actual_offset)
|
|
51
|
+
{
|
|
52
|
+
const size_t nulls_size = 16384;
|
|
53
|
+
size_t to_write;
|
|
54
|
+
ssize_t bytes_written;
|
|
55
|
+
|
|
56
|
+
if (can_lseek) {
|
|
57
|
+
actual_offset = lseek(fd,
|
|
58
|
+
target_offset - actual_offset, SEEK_CUR);
|
|
59
|
+
if (actual_offset != target_offset) {
|
|
60
|
+
archive_set_error(a,
|
|
61
|
+
actual_offset == -1 ? errno : ARCHIVE_ERRNO_MISC,
|
|
62
|
+
"Seek error");
|
|
63
|
+
return (ARCHIVE_FATAL);
|
|
64
|
+
}
|
|
65
|
+
return (ARCHIVE_OK);
|
|
66
|
+
}
|
|
67
|
+
if (*nulls == NULL) {
|
|
68
|
+
*nulls = calloc(1, nulls_size);
|
|
69
|
+
if (*nulls == NULL) {
|
|
70
|
+
archive_set_error(a, errno, "Out of memory");
|
|
71
|
+
return (ARCHIVE_FATAL);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
while (target_offset > actual_offset) {
|
|
76
|
+
to_write = nulls_size;
|
|
77
|
+
if (target_offset < actual_offset + (int64_t)nulls_size)
|
|
78
|
+
to_write = (size_t)(target_offset - actual_offset);
|
|
79
|
+
bytes_written = write(fd, *nulls, to_write);
|
|
80
|
+
if (bytes_written < 0) {
|
|
81
|
+
archive_set_error(a, errno, "Write error");
|
|
82
|
+
return (ARCHIVE_FATAL);
|
|
83
|
+
}
|
|
84
|
+
actual_offset += bytes_written;
|
|
85
|
+
}
|
|
86
|
+
return (ARCHIVE_OK);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
int
|
|
91
|
+
archive_read_data_into_fd(struct archive *a, int fd)
|
|
92
|
+
{
|
|
93
|
+
struct stat st;
|
|
94
|
+
int r, r2;
|
|
95
|
+
const void *buff;
|
|
96
|
+
size_t size, bytes_to_write;
|
|
97
|
+
ssize_t bytes_written;
|
|
98
|
+
int64_t fd_offset;
|
|
99
|
+
int64_t target_offset;
|
|
100
|
+
int64_t actual_offset = 0;
|
|
101
|
+
int64_t declared_size;
|
|
102
|
+
int can_lseek;
|
|
103
|
+
char *nulls = NULL;
|
|
104
|
+
|
|
105
|
+
archive_check_magic(a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_DATA,
|
|
106
|
+
"archive_read_data_into_fd");
|
|
107
|
+
|
|
108
|
+
declared_size = ((struct archive_read *)a)->entry_bytes_declared;
|
|
109
|
+
|
|
110
|
+
can_lseek = (fstat(fd, &st) == 0) && S_ISREG(st.st_mode);
|
|
111
|
+
if (can_lseek) {
|
|
112
|
+
fd_offset = lseek(fd, 0, SEEK_CUR);
|
|
113
|
+
if (fd_offset == -1)
|
|
114
|
+
can_lseek = 0;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
while ((r = archive_read_data_block(a, &buff, &size, &target_offset)) ==
|
|
118
|
+
ARCHIVE_OK) {
|
|
119
|
+
const char *p = buff;
|
|
120
|
+
int overran = 0;
|
|
121
|
+
|
|
122
|
+
if (declared_size >= 0) {
|
|
123
|
+
/* We know the expected size, let's enforce that we don't overrun. */
|
|
124
|
+
if (target_offset > declared_size) {
|
|
125
|
+
/* We're already beyond the end? Don't write any more. */
|
|
126
|
+
target_offset = declared_size;
|
|
127
|
+
size = 0;
|
|
128
|
+
overran = 1;
|
|
129
|
+
} else if (size > (uint64_t)(declared_size - target_offset)) {
|
|
130
|
+
/* Above is safe because target_offset <= declared_size */
|
|
131
|
+
/* This block is bigger than the expected remainder */
|
|
132
|
+
size = (size_t)(declared_size - target_offset);
|
|
133
|
+
overran = 1;
|
|
134
|
+
}
|
|
135
|
+
/* Else size <= expected remainder of data and we're OK. */
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (target_offset > actual_offset) {
|
|
139
|
+
r = pad_to(a, fd, can_lseek, &nulls,
|
|
140
|
+
target_offset, actual_offset);
|
|
141
|
+
if (r != ARCHIVE_OK)
|
|
142
|
+
break;
|
|
143
|
+
actual_offset = target_offset;
|
|
144
|
+
}
|
|
145
|
+
while (size > 0) {
|
|
146
|
+
bytes_to_write = size;
|
|
147
|
+
if (bytes_to_write > MAX_WRITE)
|
|
148
|
+
bytes_to_write = MAX_WRITE;
|
|
149
|
+
bytes_written = write(fd, p, bytes_to_write);
|
|
150
|
+
if (bytes_written < 0) {
|
|
151
|
+
archive_set_error(a, errno, "Write error");
|
|
152
|
+
r = ARCHIVE_FATAL;
|
|
153
|
+
goto cleanup;
|
|
154
|
+
}
|
|
155
|
+
actual_offset += bytes_written;
|
|
156
|
+
p += bytes_written;
|
|
157
|
+
size -= bytes_written;
|
|
158
|
+
}
|
|
159
|
+
if (overran) {
|
|
160
|
+
archive_set_error(a, ARCHIVE_ERRNO_MISC,
|
|
161
|
+
"Actual entry size exceeds the declared size "
|
|
162
|
+
"(%jd); truncated output at the declared size",
|
|
163
|
+
(intmax_t)declared_size);
|
|
164
|
+
r = ARCHIVE_FAILED;
|
|
165
|
+
goto cleanup;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (r == ARCHIVE_EOF && target_offset > actual_offset) {
|
|
170
|
+
int trailing_hole_overran =
|
|
171
|
+
declared_size >= 0 && target_offset > declared_size;
|
|
172
|
+
if (trailing_hole_overran)
|
|
173
|
+
target_offset = declared_size;
|
|
174
|
+
if (target_offset > actual_offset) {
|
|
175
|
+
r2 = pad_to(a, fd, can_lseek, &nulls,
|
|
176
|
+
target_offset, actual_offset);
|
|
177
|
+
if (r2 != ARCHIVE_OK)
|
|
178
|
+
r = r2;
|
|
179
|
+
else
|
|
180
|
+
actual_offset = target_offset;
|
|
181
|
+
}
|
|
182
|
+
if (trailing_hole_overran) {
|
|
183
|
+
archive_set_error(a, ARCHIVE_ERRNO_MISC,
|
|
184
|
+
"Actual entry size exceeds the declared size "
|
|
185
|
+
"(%jd); truncated output at the declared size",
|
|
186
|
+
(intmax_t)declared_size);
|
|
187
|
+
r = ARCHIVE_FAILED;
|
|
188
|
+
goto cleanup;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
cleanup:
|
|
193
|
+
free(nulls);
|
|
194
|
+
if (r != ARCHIVE_EOF)
|
|
195
|
+
return (r);
|
|
196
|
+
r = ARCHIVE_OK;
|
|
197
|
+
if (can_lseek) {
|
|
198
|
+
int64_t offset = lseek(fd, 0, SEEK_CUR);
|
|
199
|
+
if (offset - fd_offset != actual_offset) {
|
|
200
|
+
archive_set_error(a,
|
|
201
|
+
offset == -1 ? errno : ARCHIVE_ERRNO_MISC,
|
|
202
|
+
"Seek error");
|
|
203
|
+
r = ARCHIVE_FATAL;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return (r);
|
|
207
|
+
}
|
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
.\" Copyright (c) 2003-2009 Tim Kientzle
|
|
2
|
+
.\" All rights reserved.
|
|
3
|
+
.\"
|
|
4
|
+
.\" Redistribution and use in source and binary forms, with or without
|
|
5
|
+
.\" modification, are permitted provided that the following conditions
|
|
6
|
+
.\" are met:
|
|
7
|
+
.\" 1. Redistributions of source code must retain the above copyright
|
|
8
|
+
.\" notice, this list of conditions and the following disclaimer.
|
|
9
|
+
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
10
|
+
.\" notice, this list of conditions and the following disclaimer in the
|
|
11
|
+
.\" documentation and/or other materials provided with the distribution.
|
|
12
|
+
.\"
|
|
13
|
+
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
14
|
+
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
15
|
+
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
16
|
+
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
17
|
+
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
18
|
+
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
19
|
+
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
20
|
+
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
21
|
+
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
22
|
+
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
23
|
+
.\" SUCH DAMAGE.
|
|
24
|
+
.\"
|
|
25
|
+
.Dd April 3, 2017
|
|
26
|
+
.Dt ARCHIVE_READ_DISK 3
|
|
27
|
+
.Os
|
|
28
|
+
.Sh NAME
|
|
29
|
+
.Nm archive_read_disk_new ,
|
|
30
|
+
.Nm archive_read_disk_open ,
|
|
31
|
+
.Nm archive_read_disk_open_w ,
|
|
32
|
+
.Nm archive_read_disk_set_behavior ,
|
|
33
|
+
.Nm archive_read_disk_set_symlink_logical ,
|
|
34
|
+
.Nm archive_read_disk_set_symlink_physical ,
|
|
35
|
+
.Nm archive_read_disk_set_symlink_hybrid ,
|
|
36
|
+
.Nm archive_read_disk_entry_from_file ,
|
|
37
|
+
.Nm archive_read_disk_gname ,
|
|
38
|
+
.Nm archive_read_disk_uname ,
|
|
39
|
+
.Nm archive_read_disk_set_uname_lookup ,
|
|
40
|
+
.Nm archive_read_disk_set_gname_lookup ,
|
|
41
|
+
.Nm archive_read_disk_set_standard_lookup ,
|
|
42
|
+
.Nm archive_read_disk_descend ,
|
|
43
|
+
.Nm archive_read_disk_can_descend ,
|
|
44
|
+
.Nm archive_read_disk_current_filesystem ,
|
|
45
|
+
.Nm archive_read_disk_current_filesystem_is_synthetic ,
|
|
46
|
+
.Nm archive_read_disk_current_filesystem_is_remote ,
|
|
47
|
+
.Nm archive_read_disk_set_matching ,
|
|
48
|
+
.Nm archive_read_disk_set_metadata_filter_callback ,
|
|
49
|
+
.Nd functions for reading objects from disk
|
|
50
|
+
.Sh LIBRARY
|
|
51
|
+
Streaming Archive Library (libarchive, -larchive)
|
|
52
|
+
.Sh SYNOPSIS
|
|
53
|
+
.In archive.h
|
|
54
|
+
.Ft struct archive *
|
|
55
|
+
.Fn archive_read_disk_new "void"
|
|
56
|
+
.Ft int
|
|
57
|
+
.Fn archive_read_disk_open "struct archive *" "const char *"
|
|
58
|
+
.Ft int
|
|
59
|
+
.Fn archive_read_disk_open_w "struct archive *" "const wchar_t *"
|
|
60
|
+
.Ft int
|
|
61
|
+
.Fn archive_read_disk_set_behavior "struct archive *" "int"
|
|
62
|
+
.Ft int
|
|
63
|
+
.Fn archive_read_disk_set_symlink_logical "struct archive *"
|
|
64
|
+
.Ft int
|
|
65
|
+
.Fn archive_read_disk_set_symlink_physical "struct archive *"
|
|
66
|
+
.Ft int
|
|
67
|
+
.Fn archive_read_disk_set_symlink_hybrid "struct archive *"
|
|
68
|
+
.Ft const char *
|
|
69
|
+
.Fn archive_read_disk_gname "struct archive *" "gid_t"
|
|
70
|
+
.Ft const char *
|
|
71
|
+
.Fn archive_read_disk_uname "struct archive *" "uid_t"
|
|
72
|
+
.Ft int
|
|
73
|
+
.Fo archive_read_disk_set_gname_lookup
|
|
74
|
+
.Fa "struct archive *"
|
|
75
|
+
.Fa "void *"
|
|
76
|
+
.Fa "const char *(*lookup)(void *, gid_t)"
|
|
77
|
+
.Fa "void (*cleanup)(void *)"
|
|
78
|
+
.Fc
|
|
79
|
+
.Ft int
|
|
80
|
+
.Fo archive_read_disk_set_uname_lookup
|
|
81
|
+
.Fa "struct archive *"
|
|
82
|
+
.Fa "void *"
|
|
83
|
+
.Fa "const char *(*lookup)(void *, uid_t)"
|
|
84
|
+
.Fa "void (*cleanup)(void *)"
|
|
85
|
+
.Fc
|
|
86
|
+
.Ft int
|
|
87
|
+
.Fn archive_read_disk_set_standard_lookup "struct archive *"
|
|
88
|
+
.Ft int
|
|
89
|
+
.Fo archive_read_disk_entry_from_file
|
|
90
|
+
.Fa "struct archive *"
|
|
91
|
+
.Fa "struct archive_entry *"
|
|
92
|
+
.Fa "int fd"
|
|
93
|
+
.Fa "const struct stat *"
|
|
94
|
+
.Fc
|
|
95
|
+
.Ft int
|
|
96
|
+
.Fn archive_read_disk_descend "struct archive *"
|
|
97
|
+
.Ft int
|
|
98
|
+
.Fn archive_read_disk_can_descend "struct archive *"
|
|
99
|
+
.Ft int
|
|
100
|
+
.Fn archive_read_disk_current_filesystem "struct archive *"
|
|
101
|
+
.Ft int
|
|
102
|
+
.Fn archive_read_disk_current_filesystem_is_synthetic "struct archive *"
|
|
103
|
+
.Ft int
|
|
104
|
+
.Fn archive_read_disk_current_filesystem_is_remote "struct archive *"
|
|
105
|
+
.Ft int
|
|
106
|
+
.Fo archive_read_disk_set_matching
|
|
107
|
+
.Fa "struct archive *"
|
|
108
|
+
.Fa "struct archive *"
|
|
109
|
+
.Fa "void (*excluded_func)(struct archive *, void *, struct archive entry *)"
|
|
110
|
+
.Fa "void *"
|
|
111
|
+
.Fc
|
|
112
|
+
.Ft int
|
|
113
|
+
.Fo archive_read_disk_set_metadata_filter_callback
|
|
114
|
+
.Fa "struct archive *"
|
|
115
|
+
.Fa "int (*metadata_filter_func)(struct archive *, void*, struct archive_entry *)"
|
|
116
|
+
.Fa "void *"
|
|
117
|
+
.Fc
|
|
118
|
+
.Sh DESCRIPTION
|
|
119
|
+
These functions provide an API for reading information about
|
|
120
|
+
objects on disk.
|
|
121
|
+
In particular, they provide an interface for populating
|
|
122
|
+
.Tn struct archive_entry
|
|
123
|
+
objects.
|
|
124
|
+
.Bl -tag -width indent
|
|
125
|
+
.It Fn archive_read_disk_new
|
|
126
|
+
Allocates and initializes a
|
|
127
|
+
.Tn struct archive
|
|
128
|
+
object suitable for reading object information from disk.
|
|
129
|
+
.It Fn archive_read_disk_open
|
|
130
|
+
Opens the file or directory from the given path and prepares the
|
|
131
|
+
.Tn struct archive
|
|
132
|
+
to read it from disk.
|
|
133
|
+
.It Fn archive_read_disk_open_w
|
|
134
|
+
Opens the file or directory from the given path as a wide character string and prepares the
|
|
135
|
+
.Tn struct archive
|
|
136
|
+
to read it from disk.
|
|
137
|
+
.It Fn archive_read_disk_set_behavior
|
|
138
|
+
Configures various behavior options when reading entries from disk.
|
|
139
|
+
The flags field consists of a bitwise OR of one or more of the
|
|
140
|
+
following values:
|
|
141
|
+
.Bl -tag -compact -width "indent"
|
|
142
|
+
.It Cm ARCHIVE_READDISK_HONOR_NODUMP
|
|
143
|
+
Skip files and directories with the nodump file attribute (file flag) set.
|
|
144
|
+
By default, the nodump file attribute is ignored.
|
|
145
|
+
.It Cm ARCHIVE_READDISK_MAC_COPYFILE
|
|
146
|
+
Mac OS X specific.
|
|
147
|
+
Read metadata (ACLs and extended attributes) with
|
|
148
|
+
.Xr copyfile 3 .
|
|
149
|
+
By default, metadata is read using
|
|
150
|
+
.Xr copyfile 3 .
|
|
151
|
+
.It Cm ARCHIVE_READDISK_NO_ACL
|
|
152
|
+
Do not read Access Control Lists.
|
|
153
|
+
By default, ACLs are read from disk.
|
|
154
|
+
.It Cm ARCHIVE_READDISK_NO_FFLAGS
|
|
155
|
+
Do not read file attributes (file flags).
|
|
156
|
+
By default, file attributes are read from disk.
|
|
157
|
+
See
|
|
158
|
+
.Xr chattr 1
|
|
159
|
+
.Pq Linux
|
|
160
|
+
or
|
|
161
|
+
.Xr chflags 1
|
|
162
|
+
.Pq FreeBSD, Mac OS X
|
|
163
|
+
for more information on file attributes.
|
|
164
|
+
.It Cm ARCHIVE_READDISK_NO_TRAVERSE_MOUNTS
|
|
165
|
+
Do not traverse mount points.
|
|
166
|
+
By default, mount points are traversed.
|
|
167
|
+
.It Cm ARCHIVE_READDISK_NO_XATTR
|
|
168
|
+
Do not read extended file attributes (xattrs).
|
|
169
|
+
By default, extended file attributes are read from disk.
|
|
170
|
+
See
|
|
171
|
+
.Xr xattr 7
|
|
172
|
+
.Pq Linux ,
|
|
173
|
+
.Xr xattr 2
|
|
174
|
+
.Pq Mac OS X ,
|
|
175
|
+
or
|
|
176
|
+
.Xr getextattr 8
|
|
177
|
+
.Pq FreeBSD
|
|
178
|
+
for more information on extended file attributes.
|
|
179
|
+
.It Cm ARCHIVE_READDISK_RESTORE_ATIME
|
|
180
|
+
Restore access time of traversed files.
|
|
181
|
+
By default, access time of traversed files is not restored.
|
|
182
|
+
.It Cm ARCHIVE_READDISK_NO_SPARSE
|
|
183
|
+
Do not read sparse file information.
|
|
184
|
+
By default, sparse file information is read from disk.
|
|
185
|
+
.El
|
|
186
|
+
.It Xo
|
|
187
|
+
.Fn archive_read_disk_set_symlink_logical ,
|
|
188
|
+
.Fn archive_read_disk_set_symlink_physical ,
|
|
189
|
+
.Fn archive_read_disk_set_symlink_hybrid
|
|
190
|
+
.Xc
|
|
191
|
+
This sets the mode used for handling symbolic links.
|
|
192
|
+
The
|
|
193
|
+
.Dq logical
|
|
194
|
+
mode follows all symbolic links.
|
|
195
|
+
The
|
|
196
|
+
.Dq physical
|
|
197
|
+
mode does not follow any symbolic links.
|
|
198
|
+
The
|
|
199
|
+
.Dq hybrid
|
|
200
|
+
mode currently behaves identically to the
|
|
201
|
+
.Dq logical
|
|
202
|
+
mode.
|
|
203
|
+
.It Xo
|
|
204
|
+
.Fn archive_read_disk_gname ,
|
|
205
|
+
.Fn archive_read_disk_uname
|
|
206
|
+
.Xc
|
|
207
|
+
Returns a user or group name given a gid or uid value.
|
|
208
|
+
By default, these always return a NULL string.
|
|
209
|
+
.It Xo
|
|
210
|
+
.Fn archive_read_disk_set_gname_lookup ,
|
|
211
|
+
.Fn archive_read_disk_set_uname_lookup
|
|
212
|
+
.Xc
|
|
213
|
+
These allow you to override the functions used for
|
|
214
|
+
user and group name lookups.
|
|
215
|
+
You may also provide a
|
|
216
|
+
.Tn void *
|
|
217
|
+
pointer to a private data structure and a cleanup function for
|
|
218
|
+
that data.
|
|
219
|
+
The cleanup function will be invoked when the
|
|
220
|
+
.Tn struct archive
|
|
221
|
+
object is destroyed or when new lookup functions are registered.
|
|
222
|
+
.It Fn archive_read_disk_set_standard_lookup
|
|
223
|
+
This convenience function installs a standard set of user
|
|
224
|
+
and group name lookup functions.
|
|
225
|
+
These functions use
|
|
226
|
+
.Xr getpwuid 3
|
|
227
|
+
and
|
|
228
|
+
.Xr getgrgid 3
|
|
229
|
+
to convert ids to names, defaulting to NULL if the names cannot
|
|
230
|
+
be looked up.
|
|
231
|
+
These functions also implement a simple memory cache to reduce
|
|
232
|
+
the number of calls to
|
|
233
|
+
.Xr getpwuid 3
|
|
234
|
+
and
|
|
235
|
+
.Xr getgrgid 3 .
|
|
236
|
+
.It Fn archive_read_disk_entry_from_file
|
|
237
|
+
Populates a
|
|
238
|
+
.Tn struct archive_entry
|
|
239
|
+
object with information about a particular file.
|
|
240
|
+
The
|
|
241
|
+
.Tn archive_entry
|
|
242
|
+
object must have already been created with
|
|
243
|
+
.Xr archive_entry_new 3
|
|
244
|
+
and at least one of the source path or path fields must already be set.
|
|
245
|
+
(If both are set, the source path will be used.)
|
|
246
|
+
.Pp
|
|
247
|
+
Information is read from disk using the path name from the
|
|
248
|
+
.Tn struct archive_entry
|
|
249
|
+
object.
|
|
250
|
+
If a file descriptor is provided, some information will be obtained using
|
|
251
|
+
that file descriptor, on platforms that support the appropriate
|
|
252
|
+
system calls.
|
|
253
|
+
.Pp
|
|
254
|
+
If a pointer to a
|
|
255
|
+
.Tn struct stat
|
|
256
|
+
is provided, information from that structure will be used instead
|
|
257
|
+
of reading from the disk where appropriate.
|
|
258
|
+
This can provide performance benefits in scenarios where
|
|
259
|
+
.Tn struct stat
|
|
260
|
+
information has already been read from the disk as a side effect
|
|
261
|
+
of some other operation.
|
|
262
|
+
(For example, directory traversal libraries often provide this information.)
|
|
263
|
+
.Pp
|
|
264
|
+
Where necessary, user and group ids are converted to user and group names
|
|
265
|
+
using the currently-registered lookup functions above.
|
|
266
|
+
This affects the file ownership fields and ACL values in the
|
|
267
|
+
.Tn struct archive_entry
|
|
268
|
+
object.
|
|
269
|
+
.It Fn archive_read_disk_descend
|
|
270
|
+
If the current entry can be descended, this function will mark the directory as the next entry for
|
|
271
|
+
.Xr archive_read_header 3
|
|
272
|
+
to visit.
|
|
273
|
+
.It Fn archive_read_disk_can_descend
|
|
274
|
+
Returns 1 if the current entry is an unvisited directory and 0 otherwise.
|
|
275
|
+
.It Fn archive_read_disk_current_filesystem
|
|
276
|
+
Returns the index of the most recent filesystem entry that has been visited through archive_read_disk
|
|
277
|
+
.It Fn archive_read_disk_current_filesystem_is_synthetic
|
|
278
|
+
Returns 1 if the current filesystem is a virtual filesystem. Returns 0 if the current filesystem is not a virtual filesystem. Returns -1 if it is unknown.
|
|
279
|
+
.It Fn archive_read_disk_current_filesystem_is_remote
|
|
280
|
+
Returns 1 if the current filesystem is a remote filesystem. Returns 0 if the current filesystem is not a remote filesystem. Returns -1 if it is unknown.
|
|
281
|
+
.It Fn archive_read_disk_set_matching
|
|
282
|
+
Allows the caller to set
|
|
283
|
+
.Tn struct archive
|
|
284
|
+
*_ma to compare each entry during
|
|
285
|
+
.Xr archive_read_header 3
|
|
286
|
+
calls. If matched based on calls to
|
|
287
|
+
.Tn archive_match_path_excluded ,
|
|
288
|
+
.Tn archive_match_time_excluded ,
|
|
289
|
+
or
|
|
290
|
+
.Tn archive_match_owner_excluded ,
|
|
291
|
+
then the callback function specified by the _excluded_func parameter will execute. This function will receive data provided to the fourth parameter, void *_client_data.
|
|
292
|
+
.It Fn archive_read_disk_set_metadata_filter_callback
|
|
293
|
+
Allows the caller to set a callback function during calls to
|
|
294
|
+
.Xr archive_read_header 3
|
|
295
|
+
to filter out metadata for each entry. The callback function receives the
|
|
296
|
+
.Tn struct archive
|
|
297
|
+
object, void* custom filter data, and the
|
|
298
|
+
.Tn struct archive_entry .
|
|
299
|
+
If the callback function returns an error, ARCHIVE_RETRY will be returned and the entry will not be further processed.
|
|
300
|
+
.El
|
|
301
|
+
More information about the
|
|
302
|
+
.Va struct archive
|
|
303
|
+
object and the overall design of the library can be found in the
|
|
304
|
+
.Xr libarchive 3
|
|
305
|
+
overview.
|
|
306
|
+
.Sh EXAMPLES
|
|
307
|
+
The following illustrates basic usage of the library by
|
|
308
|
+
showing how to use it to copy an item on disk into an archive.
|
|
309
|
+
.Bd -literal -offset indent
|
|
310
|
+
void
|
|
311
|
+
file_to_archive(struct archive *a, const char *name)
|
|
312
|
+
{
|
|
313
|
+
char buff[8192];
|
|
314
|
+
size_t bytes_read;
|
|
315
|
+
struct archive *ard;
|
|
316
|
+
struct archive_entry *entry;
|
|
317
|
+
int fd;
|
|
318
|
+
|
|
319
|
+
ard = archive_read_disk_new();
|
|
320
|
+
archive_read_disk_set_standard_lookup(ard);
|
|
321
|
+
entry = archive_entry_new();
|
|
322
|
+
fd = open(name, O_RDONLY);
|
|
323
|
+
if (fd < 0)
|
|
324
|
+
return;
|
|
325
|
+
archive_entry_copy_pathname(entry, name);
|
|
326
|
+
archive_read_disk_entry_from_file(ard, entry, fd, NULL);
|
|
327
|
+
archive_write_header(a, entry);
|
|
328
|
+
while ((bytes_read = read(fd, buff, sizeof(buff))) > 0)
|
|
329
|
+
archive_write_data(a, buff, bytes_read);
|
|
330
|
+
archive_write_finish_entry(a);
|
|
331
|
+
archive_read_free(ard);
|
|
332
|
+
archive_entry_free(entry);
|
|
333
|
+
}
|
|
334
|
+
.Ed
|
|
335
|
+
.Sh RETURN VALUES
|
|
336
|
+
Most functions return
|
|
337
|
+
.Cm ARCHIVE_OK
|
|
338
|
+
(zero) on success, or one of several negative
|
|
339
|
+
error codes for errors.
|
|
340
|
+
Specific error codes include:
|
|
341
|
+
.Cm ARCHIVE_RETRY
|
|
342
|
+
for operations that might succeed if retried,
|
|
343
|
+
.Cm ARCHIVE_WARN
|
|
344
|
+
for unusual conditions that do not prevent further operations, and
|
|
345
|
+
.Cm ARCHIVE_FATAL
|
|
346
|
+
for serious errors that make remaining operations impossible.
|
|
347
|
+
.Pp
|
|
348
|
+
.Fn archive_read_disk_new
|
|
349
|
+
returns a pointer to a newly-allocated
|
|
350
|
+
.Tn struct archive
|
|
351
|
+
object or NULL if the allocation failed for any reason.
|
|
352
|
+
.Pp
|
|
353
|
+
.Fn archive_read_disk_gname
|
|
354
|
+
and
|
|
355
|
+
.Fn archive_read_disk_uname
|
|
356
|
+
return
|
|
357
|
+
.Tn const char *
|
|
358
|
+
pointers to the textual name or NULL if the lookup failed for any reason.
|
|
359
|
+
The returned pointer points to internal storage that
|
|
360
|
+
may be reused on the next call to either of these functions;
|
|
361
|
+
callers should copy the string if they need to continue accessing it.
|
|
362
|
+
.\"
|
|
363
|
+
.Sh ERRORS
|
|
364
|
+
Detailed error codes and textual descriptions are available from the
|
|
365
|
+
.Fn archive_errno
|
|
366
|
+
and
|
|
367
|
+
.Fn archive_error_string
|
|
368
|
+
functions.
|
|
369
|
+
.\"
|
|
370
|
+
.Sh SEE ALSO
|
|
371
|
+
.Xr tar 1 ,
|
|
372
|
+
.Xr archive_read 3 ,
|
|
373
|
+
.Xr archive_util 3 ,
|
|
374
|
+
.Xr archive_write 3 ,
|
|
375
|
+
.Xr archive_write_disk 3 ,
|
|
376
|
+
.Xr libarchive 3
|
|
377
|
+
.Sh HISTORY
|
|
378
|
+
The
|
|
379
|
+
.Nm libarchive
|
|
380
|
+
library first appeared in
|
|
381
|
+
.Fx 5.3 .
|
|
382
|
+
The
|
|
383
|
+
.Nm archive_read_disk
|
|
384
|
+
interface was added to
|
|
385
|
+
.Nm libarchive 2.6
|
|
386
|
+
and first appeared in
|
|
387
|
+
.Fx 8.0 .
|
|
388
|
+
.Sh AUTHORS
|
|
389
|
+
.An -nosplit
|
|
390
|
+
The
|
|
391
|
+
.Nm libarchive
|
|
392
|
+
library was written by
|
|
393
|
+
.An Tim Kientzle Aq kientzle@FreeBSD.org .
|
|
394
|
+
.Sh BUGS
|
|
395
|
+
The
|
|
396
|
+
.Dq standard
|
|
397
|
+
user name and group name lookup functions are not the defaults because
|
|
398
|
+
.Xr getgrgid 3
|
|
399
|
+
and
|
|
400
|
+
.Xr getpwuid 3
|
|
401
|
+
are sometimes too large for particular applications.
|
|
402
|
+
The current design allows the application author to use a more
|
|
403
|
+
compact implementation when appropriate.
|
|
404
|
+
.Pp
|
|
405
|
+
The full list of metadata read from disk by
|
|
406
|
+
.Fn archive_read_disk_entry_from_file
|
|
407
|
+
is necessarily system-dependent.
|
|
408
|
+
.Pp
|
|
409
|
+
The
|
|
410
|
+
.Fn archive_read_disk_entry_from_file
|
|
411
|
+
function reads as much information as it can from disk.
|
|
412
|
+
Some method should be provided to limit this so that clients who
|
|
413
|
+
do not need ACLs, for instance, can avoid the extra work needed
|
|
414
|
+
to look up such information.
|
|
415
|
+
.Pp
|
|
416
|
+
This API should provide a set of methods for walking a directory tree.
|
|
417
|
+
That would make it a direct parallel of the
|
|
418
|
+
.Xr archive_read 3
|
|
419
|
+
API.
|
|
420
|
+
When such methods are implemented, the
|
|
421
|
+
.Dq hybrid
|
|
422
|
+
symbolic link mode will make sense.
|