libarchive 1.0.3.0 → 1.0.4.0
raw patch · 10 files changed
+536/−439 lines, 10 files
Files
- CHANGELOG.md +7/−0
- README.md +1/−1
- libarchive.cabal +6/−7
- src/Codec/Archive.hs +3/−59
- src/Codec/Archive/Common.hs +14/−0
- src/Codec/Archive/Foreign/Archive.chs +228/−223
- src/Codec/Archive/Foreign/ArchiveEntry.chs +148/−148
- src/Codec/Archive/Pack.hs +3/−0
- src/Codec/Archive/Unpack.hs +56/−1
- src/Codec/Archive/Unpack/Lazy.hs +70/−0
CHANGELOG.md view
@@ -1,5 +1,12 @@ # libarchive +## 1.0.4.0++ * Add `noOpenCallback`+ * Add various facilities for lazy/streaming archives, viz. `unpackToDirLazy`,+ `bslToArchive`, and `readArchiveBSL`.+ * Remove `unsafe` stuff everywhere+ ## 1.0.3.0 * Fix types for `archive_set_read_callback` and
README.md view
@@ -10,4 +10,4 @@ formats. It has a high-level Haskell API for creating and unpacking archives in addition-to the C API.+to the C API. Like the `tar` package, it can stream from lazy `ByteString`s.
libarchive.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.18 name: libarchive-version: 1.0.3.0+version: 1.0.4.0 license: BSD3 license-file: LICENSE copyright: Copyright: (c) 2018-2019 Vanessa McHale@@ -10,7 +10,7 @@ bug-reports: https://github.com/vmchale/libarchive/issues synopsis: Haskell interface to libarchive description:- Haskell bindings for [libarchive](https://www.libarchive.org/). Provides the ability to unpack archives.+ Haskell bindings for [libarchive](https://www.libarchive.org/). Provides the ability to unpack archives, including the ability to unpack archives lazily. category: Codec build-type: Simple extra-source-files:@@ -33,20 +33,19 @@ hs-source-dirs: src other-modules: Codec.Archive.Pack+ Codec.Archive.Unpack.Lazy Codec.Archive.Unpack Codec.Archive.Foreign.Common Codec.Archive.Types+ Codec.Archive.Common default-language: Haskell2010- ghc-options: -Wall+ ghc-options: -Wall -Wincomplete-uni-patterns+ -Wincomplete-record-updates -Wredundant-constraints build-depends: base >=4.9 && <5, bytestring -any, filepath -any, composition-prelude -any-- if impl(ghc >=8.0)- ghc-options: -Wincomplete-uni-patterns -Wincomplete-record-updates- -Wredundant-constraints -Widentities if impl(ghc >=8.4) ghc-options: -Wmissing-export-lists
src/Codec/Archive.hs view
@@ -4,6 +4,7 @@ module Codec.Archive ( -- * High-level functionality unpackToDir+ , unpackToDirLazy , unpackArchive , entriesToFile , entriesToFileZip@@ -13,6 +14,7 @@ , entriesToBSzip , readArchiveFile , readArchiveBS+ , readArchiveBSL -- * Concrete (Haskell) types , Entry (..) , EntryContent (..)@@ -25,65 +27,7 @@ , executablePermissions ) where -import Codec.Archive.Foreign import Codec.Archive.Pack import Codec.Archive.Types import Codec.Archive.Unpack-import Control.Monad (void, (<=<))-import Data.ByteString (useAsCStringLen)-import qualified Data.ByteString as BS-import Foreign.C.String-import Foreign.Ptr (Ptr)-import System.IO.Unsafe (unsafePerformIO)---- | Read from an 'Archive' and then free it-actFree :: (Ptr Archive -> IO a) -> Ptr Archive -> IO a-actFree fact a = fact a <* archive_read_free a---- | Read an archive from a file. The format of the archive is automatically--- detected.-readArchiveFile :: FilePath -> IO [Entry]-readArchiveFile = actFree hsEntries <=< archiveFile---- | Read an archive contained in a 'BS.ByteString'. The format of the archive is--- automatically detected.-readArchiveBS :: BS.ByteString -> [Entry]-readArchiveBS = unsafePerformIO . (actFree hsEntries <=< bsToArchive)-{-# NOINLINE readArchiveBS #-}--archiveFile :: FilePath -> IO (Ptr Archive)-archiveFile fp = withCString fp $ \cpath -> do- a <- archive_read_new- void $ archive_read_support_format_all a- void $ archive_read_open_filename a cpath 10240- pure a---- | This is more efficient than------ @--- unpackToDir "llvm" =<< BS.readFile "llvm.tar"--- @-unpackArchive :: FilePath -- ^ Filepath pointing to archive- -> FilePath -- ^ Dirctory to unpack in- -> IO ()-unpackArchive tarFp dirFp = do- a <- archiveFile tarFp- unpackEntriesFp a dirFp- void $ archive_read_free a--bsToArchive :: BS.ByteString -> IO (Ptr Archive)-bsToArchive bs = do- a <- archive_read_new- void $ archive_read_support_format_all a- useAsCStringLen bs $- \(charPtr, sz) ->- void $ archive_read_open_memory a charPtr (fromIntegral sz)- pure a--unpackToDir :: FilePath -- ^ Directory to unpack in- -> BS.ByteString -- ^ 'BS.ByteString' containing archive- -> IO ()-unpackToDir fp bs = do- a <- bsToArchive bs- unpackEntriesFp a fp- void $ archive_read_free a+import Codec.Archive.Unpack.Lazy
+ src/Codec/Archive/Common.hs view
@@ -0,0 +1,14 @@+module Codec.Archive.Common ( actFree+ , actFreeCallback+ ) where++import Codec.Archive.Foreign+import Foreign.Marshal.Alloc (free)+import Foreign.Ptr++-- | Read from an 'Archive' and then free it+actFree :: (Ptr Archive -> IO a) -> Ptr Archive -> IO a+actFree fact a = fact a <* archive_free a++actFreeCallback :: (Ptr Archive -> IO a) -> (Ptr Archive, IO ()) -> IO a+actFreeCallback fact (a, freeAct) = fact a <* archive_free a <* freeAct
src/Codec/Archive/Foreign/Archive.chs view
@@ -323,6 +323,7 @@ , ArchiveSwitchCallback , ArchivePassphraseCallback -- * Callback constructors+ , noOpenCallback , mkReadCallback , mkSkipCallback , mkSeekCallback@@ -345,7 +346,7 @@ import Codec.Archive.Types import Foreign.C.String import Foreign.C.Types-import Foreign.Ptr (FunPtr, Ptr)+import Foreign.Ptr import System.Posix.Types (Fd (..)) -- Miscellaneous@@ -364,6 +365,10 @@ foreign import ccall "wrapper" mkSwitchCallback :: ArchiveSwitchCallback a b -> IO (FunPtr (ArchiveSwitchCallback a b)) foreign import ccall "wrapper" mkPassphraseCallback :: ArchivePassphraseCallback a -> IO (FunPtr (ArchivePassphraseCallback a)) +-- | Don't use an open callback. This is the recommended argument to 'archive_open_reada+noOpenCallback :: FunPtr (ArchiveOpenCallback a)+noOpenCallback = castPtrToFunPtr nullPtr+ foreign import ccall "wrapper" mkWriteLookup :: (Ptr a -> CString -> Int64 -> IO Int64) -> IO (FunPtr (Ptr a -> CString -> Int64 -> IO Int64)) foreign import ccall "wrapper" mkReadLookup :: (Ptr a -> Int64 -> IO CString) -> IO (FunPtr (Ptr a -> Int64 -> IO CString)) foreign import ccall "wrapper" mkCleanup :: (Ptr a -> IO ()) -> IO (FunPtr (Ptr a -> IO ()))@@ -388,250 +393,250 @@ type ArchivePassphraseCallback a = Ptr Archive -> Ptr a -> IO CString -- Archive read-foreign import ccall unsafe archive_read_new :: IO (Ptr Archive)-foreign import ccall unsafe archive_read_support_filter_all :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_read_support_filter_bzip2 :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_read_support_filter_compress :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_read_support_filter_gzip :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_read_support_filter_grzip :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_read_support_filter_lrzip :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_read_support_filter_lz4 :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_read_support_filter_lzip :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_read_support_filter_lzma :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_read_support_filter_lzop :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_read_support_filter_none :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_read_support_filter_program :: Ptr Archive -> CString -> IO ArchiveError-foreign import ccall unsafe archive_read_support_filter_program_signature :: Ptr Archive -> CString -> CString -> CSize -> IO ArchiveError-foreign import ccall unsafe archive_read_support_filter_rpm :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_read_support_filter_uu :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_read_support_filter_xz :: Ptr Archive -> IO ArchiveError--- foreign import ccall unsafe archive_read_support_filter_zstd :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_new :: IO (Ptr Archive)+foreign import ccall archive_read_support_filter_all :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_support_filter_bzip2 :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_support_filter_compress :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_support_filter_gzip :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_support_filter_grzip :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_support_filter_lrzip :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_support_filter_lz4 :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_support_filter_lzip :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_support_filter_lzma :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_support_filter_lzop :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_support_filter_none :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_support_filter_program :: Ptr Archive -> CString -> IO ArchiveError+foreign import ccall archive_read_support_filter_program_signature :: Ptr Archive -> CString -> CString -> CSize -> IO ArchiveError+foreign import ccall archive_read_support_filter_rpm :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_support_filter_uu :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_support_filter_xz :: Ptr Archive -> IO ArchiveError+-- foreign import ccall archive_read_support_filter_zstd :: Ptr Archive -> IO ArchiveError -foreign import ccall unsafe archive_read_support_format_7zip :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_read_support_format_all :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_read_support_format_ar :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_read_support_format_by_code :: Ptr Archive -> CInt -> IO ArchiveError-foreign import ccall unsafe archive_read_support_format_cab :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_read_support_format_cpio :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_read_support_format_empty :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_read_support_format_gnutar :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_read_support_format_iso9660 :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_read_support_format_lha :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_read_support_format_mtree :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_read_support_format_rar :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_read_support_format_raw :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_read_support_format_tar :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_read_support_format_warc :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_read_support_format_xar :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_read_support_format_zip :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_read_support_format_zip_streamable :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_read_support_format_zip_seekable :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_read_set_format :: Ptr Archive -> ArchiveFormat -> IO ArchiveError-foreign import ccall unsafe archive_read_append_filter :: Ptr Archive -> ArchiveFilter -> IO ArchiveError-foreign import ccall unsafe archive_read_append_filter_program :: Ptr Archive -> CString -> IO ArchiveError-foreign import ccall unsafe archive_read_append_filter_program_signature :: Ptr Archive -> CString -> Ptr a -> CSize -> IO ArchiveError-foreign import ccall unsafe archive_read_set_open_callback :: Ptr Archive -> FunPtr (ArchiveOpenCallback a) -> IO ArchiveError-foreign import ccall unsafe archive_read_set_read_callback :: Ptr Archive -> FunPtr (ArchiveReadCallback a b) -> IO ArchiveError-foreign import ccall unsafe archive_read_set_seek_callback :: Ptr Archive -> FunPtr (ArchiveSeekCallback a) -> IO ArchiveError-foreign import ccall unsafe archive_read_set_skip_callback :: Ptr Archive -> FunPtr (ArchiveSkipCallback a) -> IO ArchiveError-foreign import ccall unsafe archive_read_set_close_callback :: Ptr Archive -> FunPtr (ArchiveCloseCallback a) -> IO ArchiveError-foreign import ccall unsafe archive_read_set_switch_callback :: Ptr Archive -> FunPtr (ArchiveSwitchCallback a b) -> IO ArchiveError-foreign import ccall unsafe archive_read_set_callback_data :: Ptr Archive -> Ptr a -> IO ArchiveError-foreign import ccall unsafe archive_read_set_callback_data2 :: Ptr Archive -> Ptr a -> CUInt -> IO ArchiveError-foreign import ccall unsafe archive_read_add_callback_data :: Ptr Archive -> Ptr a -> CUInt -> IO ArchiveError-foreign import ccall unsafe archive_read_append_callback_data :: Ptr Archive -> Ptr a -> IO ArchiveError-foreign import ccall unsafe archive_read_prepend_callback_data :: Ptr Archive -> Ptr a -> IO ArchiveError-foreign import ccall unsafe archive_read_open1 :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_read_open :: Ptr Archive -> Ptr a -> FunPtr (ArchiveOpenCallback a) -> FunPtr (ArchiveReadCallback a b) -> FunPtr (ArchiveCloseCallback a) -> IO ArchiveError-foreign import ccall unsafe archive_read_open2 :: Ptr Archive -> Ptr a -> FunPtr (ArchiveOpenCallback a) -> FunPtr (ArchiveReadCallback a b) -> FunPtr (ArchiveSkipCallback a) -> FunPtr (ArchiveCloseCallback a) -> IO ArchiveError-foreign import ccall unsafe archive_read_open_filename :: Ptr Archive -> CString -> CSize -> IO ArchiveError-foreign import ccall unsafe archive_read_open_filenames :: Ptr Archive -> Ptr CString -> CSize -> IO ArchiveError-foreign import ccall unsafe archive_read_open_filename_w :: Ptr Archive -> CWString -> CSize -> IO ArchiveError-foreign import ccall unsafe archive_read_open_memory :: Ptr Archive -> Ptr CChar -> CSize -> IO ArchiveError-foreign import ccall unsafe archive_read_open_memory2 :: Ptr Archive -> Ptr a -> CSize -> CSize -> IO ArchiveError-foreign import ccall unsafe archive_read_open_fd :: Ptr Archive -> Fd -> CSize -> IO ArchiveError--- foreign import ccall unsafe archive_read_open_FILE -foreign import ccall unsafe archive_read_next_header :: Ptr Archive -> Ptr (Ptr ArchiveEntry) -> IO ArchiveError-foreign import ccall unsafe archive_read_next_header2 :: Ptr Archive -> Ptr ArchiveEntry -> IO ArchiveError-foreign import ccall unsafe archive_read_header_position :: Ptr Archive -> IO Int64-foreign import ccall unsafe archive_read_has_encrypted_entries :: Ptr Archive -> IO CInt-foreign import ccall unsafe archive_read_format_capabilities :: Ptr Archive -> IO ArchiveCapabilities+foreign import ccall archive_read_support_format_7zip :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_support_format_all :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_support_format_ar :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_support_format_by_code :: Ptr Archive -> CInt -> IO ArchiveError+foreign import ccall archive_read_support_format_cab :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_support_format_cpio :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_support_format_empty :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_support_format_gnutar :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_support_format_iso9660 :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_support_format_lha :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_support_format_mtree :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_support_format_rar :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_support_format_raw :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_support_format_tar :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_support_format_warc :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_support_format_xar :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_support_format_zip :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_support_format_zip_streamable :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_support_format_zip_seekable :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_set_format :: Ptr Archive -> ArchiveFormat -> IO ArchiveError+foreign import ccall archive_read_append_filter :: Ptr Archive -> ArchiveFilter -> IO ArchiveError+foreign import ccall archive_read_append_filter_program :: Ptr Archive -> CString -> IO ArchiveError+foreign import ccall archive_read_append_filter_program_signature :: Ptr Archive -> CString -> Ptr a -> CSize -> IO ArchiveError+foreign import ccall archive_read_set_open_callback :: Ptr Archive -> FunPtr (ArchiveOpenCallback a) -> IO ArchiveError+foreign import ccall archive_read_set_read_callback :: Ptr Archive -> FunPtr (ArchiveReadCallback a b) -> IO ArchiveError+foreign import ccall archive_read_set_seek_callback :: Ptr Archive -> FunPtr (ArchiveSeekCallback a) -> IO ArchiveError+foreign import ccall archive_read_set_skip_callback :: Ptr Archive -> FunPtr (ArchiveSkipCallback a) -> IO ArchiveError+foreign import ccall archive_read_set_close_callback :: Ptr Archive -> FunPtr (ArchiveCloseCallback a) -> IO ArchiveError+foreign import ccall archive_read_set_switch_callback :: Ptr Archive -> FunPtr (ArchiveSwitchCallback a b) -> IO ArchiveError+foreign import ccall archive_read_set_callback_data :: Ptr Archive -> Ptr a -> IO ArchiveError+foreign import ccall archive_read_set_callback_data2 :: Ptr Archive -> Ptr a -> CUInt -> IO ArchiveError+foreign import ccall archive_read_add_callback_data :: Ptr Archive -> Ptr a -> CUInt -> IO ArchiveError+foreign import ccall archive_read_append_callback_data :: Ptr Archive -> Ptr a -> IO ArchiveError+foreign import ccall archive_read_prepend_callback_data :: Ptr Archive -> Ptr a -> IO ArchiveError+foreign import ccall archive_read_open1 :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_open :: Ptr Archive -> Ptr a -> FunPtr (ArchiveOpenCallback a) -> FunPtr (ArchiveReadCallback a b) -> FunPtr (ArchiveCloseCallback a) -> IO ArchiveError+foreign import ccall archive_read_open2 :: Ptr Archive -> Ptr a -> FunPtr (ArchiveOpenCallback a) -> FunPtr (ArchiveReadCallback a b) -> FunPtr (ArchiveSkipCallback a) -> FunPtr (ArchiveCloseCallback a) -> IO ArchiveError+foreign import ccall archive_read_open_filename :: Ptr Archive -> CString -> CSize -> IO ArchiveError+foreign import ccall archive_read_open_filenames :: Ptr Archive -> Ptr CString -> CSize -> IO ArchiveError+foreign import ccall archive_read_open_filename_w :: Ptr Archive -> CWString -> CSize -> IO ArchiveError+foreign import ccall archive_read_open_memory :: Ptr Archive -> Ptr CChar -> CSize -> IO ArchiveError+foreign import ccall archive_read_open_memory2 :: Ptr Archive -> Ptr a -> CSize -> CSize -> IO ArchiveError+foreign import ccall archive_read_open_fd :: Ptr Archive -> Fd -> CSize -> IO ArchiveError+-- foreign import ccall archive_read_open_FILE +foreign import ccall archive_read_next_header :: Ptr Archive -> Ptr (Ptr ArchiveEntry) -> IO ArchiveError+foreign import ccall archive_read_next_header2 :: Ptr Archive -> Ptr ArchiveEntry -> IO ArchiveError+foreign import ccall archive_read_header_position :: Ptr Archive -> IO Int64+foreign import ccall archive_read_has_encrypted_entries :: Ptr Archive -> IO CInt+foreign import ccall archive_read_format_capabilities :: Ptr Archive -> IO ArchiveCapabilities -foreign import ccall unsafe archive_read_data :: Ptr Archive -> Ptr a -> CSize -> IO CSize-foreign import ccall unsafe archive_seek_data :: Ptr Archive -> Int64 -> CInt -> IO Int64-foreign import ccall unsafe archive_read_data_block :: Ptr Archive -> Ptr (Ptr a) -> Ptr CSize -> Ptr Int64 -> IO ArchiveError-foreign import ccall unsafe archive_read_data_skip :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_read_data_into_fd :: Ptr Archive -> Fd -> IO ArchiveError+foreign import ccall archive_read_data :: Ptr Archive -> Ptr a -> CSize -> IO CSize+foreign import ccall archive_seek_data :: Ptr Archive -> Int64 -> CInt -> IO Int64+foreign import ccall archive_read_data_block :: Ptr Archive -> Ptr (Ptr a) -> Ptr CSize -> Ptr Int64 -> IO ArchiveError+foreign import ccall archive_read_data_skip :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_data_into_fd :: Ptr Archive -> Fd -> IO ArchiveError -foreign import ccall unsafe archive_read_set_format_option :: Ptr Archive -> CString -> CString -> CString -> IO ArchiveError-foreign import ccall unsafe archive_read_set_filter_option :: Ptr Archive -> CString -> CString -> CString -> IO ArchiveError-foreign import ccall unsafe archive_read_set_option :: Ptr Archive -> CString -> CString -> CString -> IO ArchiveError-foreign import ccall unsafe archive_read_set_options :: Ptr Archive -> CString -> IO ArchiveError+foreign import ccall archive_read_set_format_option :: Ptr Archive -> CString -> CString -> CString -> IO ArchiveError+foreign import ccall archive_read_set_filter_option :: Ptr Archive -> CString -> CString -> CString -> IO ArchiveError+foreign import ccall archive_read_set_option :: Ptr Archive -> CString -> CString -> CString -> IO ArchiveError+foreign import ccall archive_read_set_options :: Ptr Archive -> CString -> IO ArchiveError -foreign import ccall unsafe archive_read_add_passphrase :: Ptr Archive -> CString -> IO ArchiveError-foreign import ccall unsafe archive_read_set_passphrase_callback :: Ptr Archive -> Ptr a -> FunPtr (ArchivePassphraseCallback a) -> IO ArchiveError+foreign import ccall archive_read_add_passphrase :: Ptr Archive -> CString -> IO ArchiveError+foreign import ccall archive_read_set_passphrase_callback :: Ptr Archive -> Ptr a -> FunPtr (ArchivePassphraseCallback a) -> IO ArchiveError -foreign import ccall unsafe archive_read_extract :: Ptr Archive -> Ptr ArchiveEntry -> Flags -> IO ArchiveError-foreign import ccall unsafe archive_read_extract2 :: Ptr Archive -> Ptr ArchiveEntry -> Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_read_extract_set_progress_callback :: Ptr Archive -> (FunPtr (Ptr a -> IO ())) -> Ptr a -> IO ()-foreign import ccall unsafe archive_read_extract_set_skip_file :: Ptr Archive -> Int64 -> Int64 -> IO ()+foreign import ccall archive_read_extract :: Ptr Archive -> Ptr ArchiveEntry -> Flags -> IO ArchiveError+foreign import ccall archive_read_extract2 :: Ptr Archive -> Ptr ArchiveEntry -> Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_extract_set_progress_callback :: Ptr Archive -> (FunPtr (Ptr a -> IO ())) -> Ptr a -> IO ()+foreign import ccall archive_read_extract_set_skip_file :: Ptr Archive -> Int64 -> Int64 -> IO () -foreign import ccall unsafe archive_read_close :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_read_free :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_close :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_free :: Ptr Archive -> IO ArchiveError -- Archive write-foreign import ccall unsafe archive_write_new :: IO (Ptr Archive)-foreign import ccall unsafe archive_write_set_bytes_per_block :: Ptr Archive -> CInt -> IO ArchiveError-foreign import ccall unsafe archive_write_get_bytes_per_block :: Ptr Archive -> IO CInt-foreign import ccall unsafe archive_write_set_bytes_in_last_block :: Ptr Archive -> CInt -> IO ArchiveError-foreign import ccall unsafe archive_write_get_bytes_in_last_block :: Ptr Archive -> IO CInt-foreign import ccall unsafe archive_write_set_skip_file :: Ptr Archive -> Int64 -> Int64 -> IO ArchiveError-foreign import ccall unsafe archive_write_add_filter :: Ptr Archive -> ArchiveFilter -> IO ArchiveError-foreign import ccall unsafe archive_write_add_filter_by_name :: Ptr Archive -> CString -> IO ArchiveError-foreign import ccall unsafe archive_write_add_filter_b64encode :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_write_add_filter_bzip2 :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_write_add_filter_compress :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_write_add_filter_grzip :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_write_add_filter_gzip :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_write_add_filter_lrzip :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_write_add_filter_lz4 :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_write_add_filter_lzip :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_write_add_filter_lzma :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_write_add_filter_lzop :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_write_add_filter_none :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_write_add_filter_program :: Ptr Archive -> CString -> IO ArchiveError-foreign import ccall unsafe archive_write_add_filter_uuencode :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_write_add_filter_xz :: Ptr Archive -> IO ArchiveError--- foreign import ccall unsafe archive_write_add_filter_zstd :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_write_new :: IO (Ptr Archive)+foreign import ccall archive_write_set_bytes_per_block :: Ptr Archive -> CInt -> IO ArchiveError+foreign import ccall archive_write_get_bytes_per_block :: Ptr Archive -> IO CInt+foreign import ccall archive_write_set_bytes_in_last_block :: Ptr Archive -> CInt -> IO ArchiveError+foreign import ccall archive_write_get_bytes_in_last_block :: Ptr Archive -> IO CInt+foreign import ccall archive_write_set_skip_file :: Ptr Archive -> Int64 -> Int64 -> IO ArchiveError+foreign import ccall archive_write_add_filter :: Ptr Archive -> ArchiveFilter -> IO ArchiveError+foreign import ccall archive_write_add_filter_by_name :: Ptr Archive -> CString -> IO ArchiveError+foreign import ccall archive_write_add_filter_b64encode :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_write_add_filter_bzip2 :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_write_add_filter_compress :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_write_add_filter_grzip :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_write_add_filter_gzip :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_write_add_filter_lrzip :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_write_add_filter_lz4 :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_write_add_filter_lzip :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_write_add_filter_lzma :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_write_add_filter_lzop :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_write_add_filter_none :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_write_add_filter_program :: Ptr Archive -> CString -> IO ArchiveError+foreign import ccall archive_write_add_filter_uuencode :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_write_add_filter_xz :: Ptr Archive -> IO ArchiveError+-- foreign import ccall archive_write_add_filter_zstd :: Ptr Archive -> IO ArchiveError -foreign import ccall unsafe archive_write_set_format :: Ptr Archive -> ArchiveFormat -> IO ArchiveError-foreign import ccall unsafe archive_write_set_format_by_name :: Ptr Archive -> CString -> IO ArchiveError-foreign import ccall unsafe archive_write_set_format_7zip :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_write_set_format_ar_bsd :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_write_set_format_ar_svr4 :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_write_set_format_cpio :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_write_set_format_cpio_newc :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_write_set_format_gnutar :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_write_set_format_iso9660 :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_write_set_format_mtree :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_write_set_format_mtree_classic :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_write_set_format_pax :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_write_set_format_pax_restricted :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_write_set_format_raw :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_write_set_format_shar :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_write_set_format_shar_dump :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_write_set_format_ustar :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_write_set_format_v7tar :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_write_set_format_warc :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_write_set_format_xar :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_write_set_format_zip :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_write_set_format_filter_by_ext :: Ptr Archive -> CString -> IO ArchiveError-foreign import ccall unsafe archive_write_set_format_filter_by_ext_def :: Ptr Archive -> CString -> CString -> IO ArchiveError-foreign import ccall unsafe archive_write_zip_set_compression_deflate :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_write_zip_set_compression_store :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_write_open :: Ptr Archive -> Ptr a -> FunPtr (ArchiveOpenCallback a) -> FunPtr (ArchiveWriteCallback a b) -> FunPtr (ArchiveCloseCallback a) -> IO ArchiveError-foreign import ccall unsafe archive_write_open_fd :: Ptr Archive -> Fd -> IO ArchiveError-foreign import ccall unsafe archive_write_open_filename :: Ptr Archive -> CString -> IO ArchiveError-foreign import ccall unsafe archive_write_open_filename_w :: Ptr Archive -> CWString -> IO ArchiveError--- foreign import ccall unsafe archive_write_open_FILE-foreign import ccall unsafe archive_write_open_memory :: Ptr Archive -> Ptr a -> CSize -> Ptr CSize -> IO ArchiveError+foreign import ccall archive_write_set_format :: Ptr Archive -> ArchiveFormat -> IO ArchiveError+foreign import ccall archive_write_set_format_by_name :: Ptr Archive -> CString -> IO ArchiveError+foreign import ccall archive_write_set_format_7zip :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_write_set_format_ar_bsd :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_write_set_format_ar_svr4 :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_write_set_format_cpio :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_write_set_format_cpio_newc :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_write_set_format_gnutar :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_write_set_format_iso9660 :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_write_set_format_mtree :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_write_set_format_mtree_classic :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_write_set_format_pax :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_write_set_format_pax_restricted :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_write_set_format_raw :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_write_set_format_shar :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_write_set_format_shar_dump :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_write_set_format_ustar :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_write_set_format_v7tar :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_write_set_format_warc :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_write_set_format_xar :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_write_set_format_zip :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_write_set_format_filter_by_ext :: Ptr Archive -> CString -> IO ArchiveError+foreign import ccall archive_write_set_format_filter_by_ext_def :: Ptr Archive -> CString -> CString -> IO ArchiveError+foreign import ccall archive_write_zip_set_compression_deflate :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_write_zip_set_compression_store :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_write_open :: Ptr Archive -> Ptr a -> FunPtr (ArchiveOpenCallback a) -> FunPtr (ArchiveWriteCallback a b) -> FunPtr (ArchiveCloseCallback a) -> IO ArchiveError+foreign import ccall archive_write_open_fd :: Ptr Archive -> Fd -> IO ArchiveError+foreign import ccall archive_write_open_filename :: Ptr Archive -> CString -> IO ArchiveError+foreign import ccall archive_write_open_filename_w :: Ptr Archive -> CWString -> IO ArchiveError+-- foreign import ccall archive_write_open_FILE+foreign import ccall archive_write_open_memory :: Ptr Archive -> Ptr a -> CSize -> Ptr CSize -> IO ArchiveError -foreign import ccall unsafe archive_write_header :: Ptr Archive -> Ptr ArchiveEntry -> IO ArchiveError-foreign import ccall unsafe archive_write_data :: Ptr Archive -> Ptr a -> CSize -> IO CSize+foreign import ccall archive_write_header :: Ptr Archive -> Ptr ArchiveEntry -> IO ArchiveError+foreign import ccall archive_write_data :: Ptr Archive -> Ptr a -> CSize -> IO CSize -foreign import ccall unsafe archive_write_data_block :: Ptr Archive -> Ptr a -> CSize -> Int64 -> IO ArchiveError+foreign import ccall archive_write_data_block :: Ptr Archive -> Ptr a -> CSize -> Int64 -> IO ArchiveError -foreign import ccall unsafe archive_write_finish_entry :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_write_close :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_write_fail :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_write_free :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_write_finish_entry :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_write_close :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_write_fail :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_write_free :: Ptr Archive -> IO ArchiveError -foreign import ccall unsafe archive_write_set_format_option :: Ptr Archive -> CString -> CString -> CString -> IO ArchiveError-foreign import ccall unsafe archive_write_set_filter_option :: Ptr Archive -> CString -> CString -> CString -> IO ArchiveError-foreign import ccall unsafe archive_write_set_option :: Ptr Archive -> CString -> CString -> CString -> IO ArchiveError-foreign import ccall unsafe archive_write_set_options :: Ptr Archive -> CString -> IO ArchiveError+foreign import ccall archive_write_set_format_option :: Ptr Archive -> CString -> CString -> CString -> IO ArchiveError+foreign import ccall archive_write_set_filter_option :: Ptr Archive -> CString -> CString -> CString -> IO ArchiveError+foreign import ccall archive_write_set_option :: Ptr Archive -> CString -> CString -> CString -> IO ArchiveError+foreign import ccall archive_write_set_options :: Ptr Archive -> CString -> IO ArchiveError -foreign import ccall unsafe archive_write_set_passphrase :: Ptr Archive -> CString -> IO ArchiveError-foreign import ccall unsafe archive_write_set_passphrase_callback :: Ptr Archive -> Ptr a -> FunPtr (ArchivePassphraseCallback a) -> IO ArchiveError+foreign import ccall archive_write_set_passphrase :: Ptr Archive -> CString -> IO ArchiveError+foreign import ccall archive_write_set_passphrase_callback :: Ptr Archive -> Ptr a -> FunPtr (ArchivePassphraseCallback a) -> IO ArchiveError -foreign import ccall unsafe archive_write_disk_new :: IO (Ptr Archive)-foreign import ccall unsafe archive_write_disk_set_skip_file :: Ptr Archive -> Int64 -> Int64 -> IO ArchiveError-foreign import ccall unsafe archive_write_disk_set_options :: Ptr Archive -> Flags -> IO ArchiveError+foreign import ccall archive_write_disk_new :: IO (Ptr Archive)+foreign import ccall archive_write_disk_set_skip_file :: Ptr Archive -> Int64 -> Int64 -> IO ArchiveError+foreign import ccall archive_write_disk_set_options :: Ptr Archive -> Flags -> IO ArchiveError -foreign import ccall unsafe archive_write_disk_set_standard_lookup :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_write_disk_set_group_lookup :: Ptr Archive -> Ptr a -> FunPtr (Ptr a -> CString -> Int64 -> IO Int64) -> FunPtr (Ptr a -> IO ()) -> IO ArchiveError-foreign import ccall unsafe archive_write_disk_set_user_lookup :: Ptr Archive -> Ptr a -> FunPtr (Ptr a -> CString -> Int64 -> IO Int64) -> FunPtr (Ptr a -> IO ()) -> IO ArchiveError-foreign import ccall unsafe archive_write_disk_gid :: Ptr Archive -> CString -> Int64 -> IO Int64-foreign import ccall unsafe archive_write_disk_uid :: Ptr Archive -> CString -> Int64 -> IO Int64+foreign import ccall archive_write_disk_set_standard_lookup :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_write_disk_set_group_lookup :: Ptr Archive -> Ptr a -> FunPtr (Ptr a -> CString -> Int64 -> IO Int64) -> FunPtr (Ptr a -> IO ()) -> IO ArchiveError+foreign import ccall archive_write_disk_set_user_lookup :: Ptr Archive -> Ptr a -> FunPtr (Ptr a -> CString -> Int64 -> IO Int64) -> FunPtr (Ptr a -> IO ()) -> IO ArchiveError+foreign import ccall archive_write_disk_gid :: Ptr Archive -> CString -> Int64 -> IO Int64+foreign import ccall archive_write_disk_uid :: Ptr Archive -> CString -> Int64 -> IO Int64 -foreign import ccall unsafe archive_read_disk_new :: IO (Ptr Archive)-foreign import ccall unsafe archive_read_disk_set_symlink_logical :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_read_disk_set_symlink_physical :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_read_disk_set_symlink_hybrid :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_read_disk_entry_from_file :: Ptr Archive -> Ptr ArchiveEntry -> Fd -> Ptr Stat -> IO ArchiveError-foreign import ccall unsafe archive_read_disk_gname :: Ptr Archive -> Int64 -> IO CString-foreign import ccall unsafe archive_read_disk_uname :: Ptr Archive -> Int64 -> IO CString-foreign import ccall unsafe archive_read_disk_set_standard_lookup :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_read_disk_set_gname_lookup :: Ptr Archive -> Ptr a -> FunPtr (Ptr a -> Int64 -> IO CString) -> FunPtr (Ptr a -> IO ()) -> IO ArchiveError-foreign import ccall unsafe archive_read_disk_set_uname_lookup :: Ptr Archive -> Ptr a -> FunPtr (Ptr a -> Int64 -> IO CString) -> FunPtr (Ptr a -> IO ()) -> IO ArchiveError-foreign import ccall unsafe archive_read_disk_open :: Ptr Archive -> CString -> IO ArchiveError-foreign import ccall unsafe archive_read_disk_open_w :: Ptr Archive -> CWString -> IO ArchiveError-foreign import ccall unsafe archive_read_disk_descend :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_read_disk_can_descend :: Ptr Archive -> IO CInt-foreign import ccall unsafe archive_read_disk_current_filesystem :: Ptr Archive -> IO CInt-foreign import ccall unsafe archive_read_disk_current_filesystem_is_synthetic :: Ptr Archive -> IO CInt-foreign import ccall unsafe archive_read_disk_current_filesystem_is_remote :: Ptr Archive -> IO CInt-foreign import ccall unsafe archive_read_disk_set_atime_restored :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_read_disk_set_behavior :: Ptr Archive -> ReadDiskFlags -> IO ArchiveError+foreign import ccall archive_read_disk_new :: IO (Ptr Archive)+foreign import ccall archive_read_disk_set_symlink_logical :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_disk_set_symlink_physical :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_disk_set_symlink_hybrid :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_disk_entry_from_file :: Ptr Archive -> Ptr ArchiveEntry -> Fd -> Ptr Stat -> IO ArchiveError+foreign import ccall archive_read_disk_gname :: Ptr Archive -> Int64 -> IO CString+foreign import ccall archive_read_disk_uname :: Ptr Archive -> Int64 -> IO CString+foreign import ccall archive_read_disk_set_standard_lookup :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_disk_set_gname_lookup :: Ptr Archive -> Ptr a -> FunPtr (Ptr a -> Int64 -> IO CString) -> FunPtr (Ptr a -> IO ()) -> IO ArchiveError+foreign import ccall archive_read_disk_set_uname_lookup :: Ptr Archive -> Ptr a -> FunPtr (Ptr a -> Int64 -> IO CString) -> FunPtr (Ptr a -> IO ()) -> IO ArchiveError+foreign import ccall archive_read_disk_open :: Ptr Archive -> CString -> IO ArchiveError+foreign import ccall archive_read_disk_open_w :: Ptr Archive -> CWString -> IO ArchiveError+foreign import ccall archive_read_disk_descend :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_disk_can_descend :: Ptr Archive -> IO CInt+foreign import ccall archive_read_disk_current_filesystem :: Ptr Archive -> IO CInt+foreign import ccall archive_read_disk_current_filesystem_is_synthetic :: Ptr Archive -> IO CInt+foreign import ccall archive_read_disk_current_filesystem_is_remote :: Ptr Archive -> IO CInt+foreign import ccall archive_read_disk_set_atime_restored :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_read_disk_set_behavior :: Ptr Archive -> ReadDiskFlags -> IO ArchiveError -foreign import ccall unsafe archive_read_disk_set_matching :: Ptr Archive -> Ptr Archive -> FunPtr (Ptr Archive -> Ptr a -> Ptr ArchiveEntry -> IO ()) -> Ptr a -> IO ArchiveError-foreign import ccall unsafe archive_read_disk_set_metadata_filter_callback :: Ptr Archive -> FunPtr (Ptr Archive -> Ptr a -> Ptr ArchiveEntry -> IO CInt) -> Ptr a -> IO ArchiveError+foreign import ccall archive_read_disk_set_matching :: Ptr Archive -> Ptr Archive -> FunPtr (Ptr Archive -> Ptr a -> Ptr ArchiveEntry -> IO ()) -> Ptr a -> IO ArchiveError+foreign import ccall archive_read_disk_set_metadata_filter_callback :: Ptr Archive -> FunPtr (Ptr Archive -> Ptr a -> Ptr ArchiveEntry -> IO CInt) -> Ptr a -> IO ArchiveError -foreign import ccall unsafe archive_free :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_free :: Ptr Archive -> IO ArchiveError -foreign import ccall unsafe archive_filter_count :: Ptr Archive -> IO CInt-foreign import ccall unsafe archive_filter_bytes :: Ptr Archive -> CInt -> Int64-foreign import ccall unsafe archive_filter_code :: Ptr Archive -> CInt -> IO Int-foreign import ccall unsafe archive_filter_name :: Ptr Archive -> CInt -> IO CString+foreign import ccall archive_filter_count :: Ptr Archive -> IO CInt+foreign import ccall archive_filter_bytes :: Ptr Archive -> CInt -> Int64+foreign import ccall archive_filter_code :: Ptr Archive -> CInt -> IO Int+foreign import ccall archive_filter_name :: Ptr Archive -> CInt -> IO CString -foreign import ccall unsafe archive_errno :: Ptr Archive -> IO CInt-foreign import ccall unsafe archive_error_string :: Ptr Archive -> IO CString-foreign import ccall unsafe archive_format_name :: Ptr Archive -> IO CString-foreign import ccall unsafe archive_format :: Ptr Archive -> IO ArchiveFormat-foreign import ccall unsafe archive_clear_error :: Ptr Archive -> IO ()-foreign import ccall unsafe archive_set_error :: Ptr Archive -> CInt -> CString -> IO () -- TODO: variadic lol-foreign import ccall unsafe archive_copy_error :: Ptr Archive -> Ptr Archive -> IO ()-foreign import ccall unsafe archive_file_count :: Ptr Archive -> IO CInt+foreign import ccall archive_errno :: Ptr Archive -> IO CInt+foreign import ccall archive_error_string :: Ptr Archive -> IO CString+foreign import ccall archive_format_name :: Ptr Archive -> IO CString+foreign import ccall archive_format :: Ptr Archive -> IO ArchiveFormat+foreign import ccall archive_clear_error :: Ptr Archive -> IO ()+foreign import ccall archive_set_error :: Ptr Archive -> CInt -> CString -> IO () -- TODO: variadic lol+foreign import ccall archive_copy_error :: Ptr Archive -> Ptr Archive -> IO ()+foreign import ccall archive_file_count :: Ptr Archive -> IO CInt -foreign import ccall unsafe archive_match_new :: Ptr Archive-foreign import ccall unsafe archive_match_free :: Ptr Archive -> IO ArchiveError-foreign import ccall unsafe archive_match_excluded :: Ptr Archive -> IO CInt-foreign import ccall unsafe archive_match_path_excluded :: Ptr Archive -> Ptr ArchiveEntry -> IO CInt-foreign import ccall unsafe archive_match_exclude_pattern :: Ptr Archive -> CString -> IO ArchiveError-foreign import ccall unsafe archive_match_exclude_pattern_w :: Ptr Archive -> CWString -> IO ArchiveError-foreign import ccall unsafe archive_match_exclude_pattern_from_file :: Ptr Archive -> CString -> CInt -> IO ArchiveError-foreign import ccall unsafe archive_match_exclude_pattern_from_file_w :: Ptr Archive -> CWString -> CInt -> IO ArchiveError-foreign import ccall unsafe archive_match_include_pattern :: Ptr Archive -> CString -> IO ArchiveError-foreign import ccall unsafe archive_match_include_pattern_w :: Ptr Archive -> CWString -> IO ArchiveError-foreign import ccall unsafe archive_match_include_pattern_from_file :: Ptr Archive -> CString -> CInt -> IO ArchiveError-foreign import ccall unsafe archive_match_include_pattern_from_file_w :: Ptr Archive -> CString -> CInt -> IO ArchiveError-foreign import ccall unsafe archive_match_path_unmatched_inclusions :: Ptr Archive -> IO CInt-foreign import ccall unsafe archive_match_path_unmatched_inclusions_next :: Ptr Archive -> Ptr CString -> IO ArchiveError-foreign import ccall unsafe archive_match_path_unmatched_inclusions_next_w :: Ptr Archive -> Ptr CWString -> IO ArchiveError-foreign import ccall unsafe archive_match_time_excluded :: Ptr Archive -> Ptr ArchiveEntry -> IO CInt-foreign import ccall unsafe archive_match_include_time :: Ptr Archive -> TimeFlag -> CTime -> CLong -> IO ArchiveError-foreign import ccall unsafe archive_match_include_date :: Ptr Archive -> TimeFlag -> CString -> IO ArchiveError-foreign import ccall unsafe archive_match_include_date_w :: Ptr Archive -> TimeFlag -> CWString -> IO ArchiveError-foreign import ccall unsafe archive_match_include_file_time :: Ptr Archive -> TimeFlag -> CString -> IO ArchiveError-foreign import ccall unsafe archive_match_include_file_time_w :: Ptr Archive -> TimeFlag -> CWString -> IO ArchiveError-foreign import ccall unsafe archive_match_exclude_entry :: Ptr Archive -> TimeFlag -> Ptr ArchiveEntry -> IO ArchiveError-foreign import ccall unsafe archive_match_owner_excluded :: Ptr Archive -> Ptr ArchiveEntry -> IO CInt-foreign import ccall unsafe archive_match_include_gid :: Ptr Archive -> Id -> IO ArchiveError-foreign import ccall unsafe archive_match_include_uid :: Ptr Archive -> Id -> IO ArchiveError-foreign import ccall unsafe archive_match_include_uname :: Ptr Archive -> CString -> IO ArchiveError-foreign import ccall unsafe archive_match_include_uname_w :: Ptr Archive -> CWString -> IO ArchiveError-foreign import ccall unsafe archive_match_include_gname :: Ptr Archive -> CString -> IO ArchiveError-foreign import ccall unsafe archive_match_include_gname_w :: Ptr Archive -> CWString -> IO ArchiveError+foreign import ccall archive_match_new :: Ptr Archive+foreign import ccall archive_match_free :: Ptr Archive -> IO ArchiveError+foreign import ccall archive_match_excluded :: Ptr Archive -> IO CInt+foreign import ccall archive_match_path_excluded :: Ptr Archive -> Ptr ArchiveEntry -> IO CInt+foreign import ccall archive_match_exclude_pattern :: Ptr Archive -> CString -> IO ArchiveError+foreign import ccall archive_match_exclude_pattern_w :: Ptr Archive -> CWString -> IO ArchiveError+foreign import ccall archive_match_exclude_pattern_from_file :: Ptr Archive -> CString -> CInt -> IO ArchiveError+foreign import ccall archive_match_exclude_pattern_from_file_w :: Ptr Archive -> CWString -> CInt -> IO ArchiveError+foreign import ccall archive_match_include_pattern :: Ptr Archive -> CString -> IO ArchiveError+foreign import ccall archive_match_include_pattern_w :: Ptr Archive -> CWString -> IO ArchiveError+foreign import ccall archive_match_include_pattern_from_file :: Ptr Archive -> CString -> CInt -> IO ArchiveError+foreign import ccall archive_match_include_pattern_from_file_w :: Ptr Archive -> CString -> CInt -> IO ArchiveError+foreign import ccall archive_match_path_unmatched_inclusions :: Ptr Archive -> IO CInt+foreign import ccall archive_match_path_unmatched_inclusions_next :: Ptr Archive -> Ptr CString -> IO ArchiveError+foreign import ccall archive_match_path_unmatched_inclusions_next_w :: Ptr Archive -> Ptr CWString -> IO ArchiveError+foreign import ccall archive_match_time_excluded :: Ptr Archive -> Ptr ArchiveEntry -> IO CInt+foreign import ccall archive_match_include_time :: Ptr Archive -> TimeFlag -> CTime -> CLong -> IO ArchiveError+foreign import ccall archive_match_include_date :: Ptr Archive -> TimeFlag -> CString -> IO ArchiveError+foreign import ccall archive_match_include_date_w :: Ptr Archive -> TimeFlag -> CWString -> IO ArchiveError+foreign import ccall archive_match_include_file_time :: Ptr Archive -> TimeFlag -> CString -> IO ArchiveError+foreign import ccall archive_match_include_file_time_w :: Ptr Archive -> TimeFlag -> CWString -> IO ArchiveError+foreign import ccall archive_match_exclude_entry :: Ptr Archive -> TimeFlag -> Ptr ArchiveEntry -> IO ArchiveError+foreign import ccall archive_match_owner_excluded :: Ptr Archive -> Ptr ArchiveEntry -> IO CInt+foreign import ccall archive_match_include_gid :: Ptr Archive -> Id -> IO ArchiveError+foreign import ccall archive_match_include_uid :: Ptr Archive -> Id -> IO ArchiveError+foreign import ccall archive_match_include_uname :: Ptr Archive -> CString -> IO ArchiveError+foreign import ccall archive_match_include_uname_w :: Ptr Archive -> CWString -> IO ArchiveError+foreign import ccall archive_match_include_gname :: Ptr Archive -> CString -> IO ArchiveError+foreign import ccall archive_match_include_gname_w :: Ptr Archive -> CWString -> IO ArchiveError #include <archive.h>
src/Codec/Archive/Foreign/ArchiveEntry.chs view
@@ -224,164 +224,164 @@ #include <archive_entry.h> -- Archive entry-foreign import ccall unsafe archive_entry_clear :: Ptr ArchiveEntry -> IO (Ptr ArchiveEntry)-foreign import ccall unsafe archive_entry_clone :: Ptr ArchiveEntry -> IO (Ptr ArchiveEntry)-foreign import ccall unsafe archive_entry_free :: Ptr ArchiveEntry -> IO ()-foreign import ccall unsafe archive_entry_new :: IO (Ptr ArchiveEntry)-foreign import ccall unsafe archive_entry_new2 :: Ptr ArchiveEntry -> IO (Ptr ArchiveEntry)+foreign import ccall archive_entry_clear :: Ptr ArchiveEntry -> IO (Ptr ArchiveEntry)+foreign import ccall archive_entry_clone :: Ptr ArchiveEntry -> IO (Ptr ArchiveEntry)+foreign import ccall archive_entry_free :: Ptr ArchiveEntry -> IO ()+foreign import ccall archive_entry_new :: IO (Ptr ArchiveEntry)+foreign import ccall archive_entry_new2 :: Ptr ArchiveEntry -> IO (Ptr ArchiveEntry) -foreign import ccall unsafe archive_entry_atime :: Ptr ArchiveEntry -> IO CTime-foreign import ccall unsafe archive_entry_atime_nsec :: Ptr ArchiveEntry -> IO CLong-foreign import ccall unsafe archive_entry_atime_is_set :: Ptr ArchiveEntry -> IO CInt-foreign import ccall unsafe archive_entry_birthtime :: Ptr ArchiveEntry -> IO CTime-foreign import ccall unsafe archive_entry_birthtime_nsec :: Ptr ArchiveEntry -> IO CLong-foreign import ccall unsafe archive_entry_birthtime_is_set :: Ptr ArchiveEntry -> IO CInt-foreign import ccall unsafe archive_entry_ctime :: Ptr ArchiveEntry -> IO CTime-foreign import ccall unsafe archive_entry_ctime_nsec :: Ptr ArchiveEntry -> IO CLong-foreign import ccall unsafe archive_entry_ctime_is_set :: Ptr ArchiveEntry -> IO CInt-foreign import ccall unsafe archive_entry_dev :: Ptr ArchiveEntry -> IO Word64-foreign import ccall unsafe archive_entry_dev_is_set :: Ptr ArchiveEntry -> IO CInt-foreign import ccall unsafe archive_entry_devmajor :: Ptr ArchiveEntry -> IO Word64-foreign import ccall unsafe archive_entry_devminor :: Ptr ArchiveEntry -> IO Word64-foreign import ccall unsafe archive_entry_filetype :: Ptr ArchiveEntry -> IO FileType-foreign import ccall unsafe archive_entry_fflags :: Ptr ArchiveEntry -> CULong -> CULong -> IO ()-foreign import ccall unsafe archive_entry_fflags_text :: Ptr ArchiveEntry -> IO CString-foreign import ccall unsafe archive_entry_gid :: Ptr ArchiveEntry -> IO Id-foreign import ccall unsafe archive_entry_gname :: Ptr ArchiveEntry -> IO CString-foreign import ccall unsafe archive_entry_gname_utf8 :: Ptr ArchiveEntry -> IO CString-foreign import ccall unsafe archive_entry_gname_w :: Ptr ArchiveEntry -> IO CWString-foreign import ccall unsafe archive_entry_hardlink :: Ptr ArchiveEntry -> IO CString-foreign import ccall unsafe archive_entry_hardlink_utf8 :: Ptr ArchiveEntry -> IO CString-foreign import ccall unsafe archive_entry_hardlink_w :: Ptr ArchiveEntry -> IO CWString-foreign import ccall unsafe archive_entry_ino :: Ptr ArchiveEntry -> IO Int64-foreign import ccall unsafe archive_entry_ino64 :: Ptr ArchiveEntry -> IO Int64-foreign import ccall unsafe archive_entry_ino_is_set :: Ptr ArchiveEntry -> IO CInt-foreign import ccall unsafe archive_entry_mode :: Ptr ArchiveEntry -> IO CMode-foreign import ccall unsafe archive_entry_mtime :: Ptr ArchiveEntry -> IO CTime-foreign import ccall unsafe archive_entry_mtime_nsec :: Ptr ArchiveEntry -> IO CLong-foreign import ccall unsafe archive_entry_mtime_is_set :: Ptr ArchiveEntry -> IO CInt-foreign import ccall unsafe archive_entry_nlink :: Ptr ArchiveEntry -> IO CUInt-foreign import ccall unsafe archive_entry_pathname :: Ptr ArchiveEntry -> IO CString-foreign import ccall unsafe archive_entry_pathname_utf8 :: Ptr ArchiveEntry -> IO CString-foreign import ccall unsafe archive_entry_pathname_w :: Ptr ArchiveEntry -> IO CWString-foreign import ccall unsafe archive_entry_perm :: Ptr ArchiveEntry -> IO CMode-foreign import ccall unsafe archive_entry_rdev :: Ptr ArchiveEntry -> IO Word64-foreign import ccall unsafe archive_entry_rdevmajor :: Ptr ArchiveEntry -> IO Word64-foreign import ccall unsafe archive_entry_rdevminor :: Ptr ArchiveEntry -> IO Word64-foreign import ccall unsafe archive_entry_sourcepath :: Ptr ArchiveEntry -> IO CString-foreign import ccall unsafe archive_entry_sourcepath_w :: Ptr ArchiveEntry -> IO CWString-foreign import ccall unsafe archive_entry_size :: Ptr ArchiveEntry -> IO Int64-foreign import ccall unsafe archive_entry_size_is_set :: Ptr ArchiveEntry -> IO CInt-foreign import ccall unsafe archive_entry_strmode :: Ptr ArchiveEntry -> IO CString-foreign import ccall unsafe archive_entry_symlink :: Ptr ArchiveEntry -> IO CString-foreign import ccall unsafe archive_entry_symlink_utf8 :: Ptr ArchiveEntry -> IO CString-foreign import ccall unsafe archive_entry_symlink_w :: Ptr ArchiveEntry -> IO CWString-foreign import ccall unsafe archive_entry_uid :: Ptr ArchiveEntry -> IO Id-foreign import ccall unsafe archive_entry_uname :: Ptr ArchiveEntry -> IO CString-foreign import ccall unsafe archive_entry_uname_utf8 :: Ptr ArchiveEntry -> IO CString-foreign import ccall unsafe archive_entry_uname_w :: Ptr ArchiveEntry -> IO CWString-foreign import ccall unsafe archive_entry_is_data_encrypted :: Ptr ArchiveEntry -> IO CInt-foreign import ccall unsafe archive_entry_is_metadata_encrypted :: Ptr ArchiveEntry -> IO CInt-foreign import ccall unsafe archive_entry_is_encrypted :: Ptr ArchiveEntry -> IO CInt+foreign import ccall archive_entry_atime :: Ptr ArchiveEntry -> IO CTime+foreign import ccall archive_entry_atime_nsec :: Ptr ArchiveEntry -> IO CLong+foreign import ccall archive_entry_atime_is_set :: Ptr ArchiveEntry -> IO CInt+foreign import ccall archive_entry_birthtime :: Ptr ArchiveEntry -> IO CTime+foreign import ccall archive_entry_birthtime_nsec :: Ptr ArchiveEntry -> IO CLong+foreign import ccall archive_entry_birthtime_is_set :: Ptr ArchiveEntry -> IO CInt+foreign import ccall archive_entry_ctime :: Ptr ArchiveEntry -> IO CTime+foreign import ccall archive_entry_ctime_nsec :: Ptr ArchiveEntry -> IO CLong+foreign import ccall archive_entry_ctime_is_set :: Ptr ArchiveEntry -> IO CInt+foreign import ccall archive_entry_dev :: Ptr ArchiveEntry -> IO Word64+foreign import ccall archive_entry_dev_is_set :: Ptr ArchiveEntry -> IO CInt+foreign import ccall archive_entry_devmajor :: Ptr ArchiveEntry -> IO Word64+foreign import ccall archive_entry_devminor :: Ptr ArchiveEntry -> IO Word64+foreign import ccall archive_entry_filetype :: Ptr ArchiveEntry -> IO FileType+foreign import ccall archive_entry_fflags :: Ptr ArchiveEntry -> CULong -> CULong -> IO ()+foreign import ccall archive_entry_fflags_text :: Ptr ArchiveEntry -> IO CString+foreign import ccall archive_entry_gid :: Ptr ArchiveEntry -> IO Id+foreign import ccall archive_entry_gname :: Ptr ArchiveEntry -> IO CString+foreign import ccall archive_entry_gname_utf8 :: Ptr ArchiveEntry -> IO CString+foreign import ccall archive_entry_gname_w :: Ptr ArchiveEntry -> IO CWString+foreign import ccall archive_entry_hardlink :: Ptr ArchiveEntry -> IO CString+foreign import ccall archive_entry_hardlink_utf8 :: Ptr ArchiveEntry -> IO CString+foreign import ccall archive_entry_hardlink_w :: Ptr ArchiveEntry -> IO CWString+foreign import ccall archive_entry_ino :: Ptr ArchiveEntry -> IO Int64+foreign import ccall archive_entry_ino64 :: Ptr ArchiveEntry -> IO Int64+foreign import ccall archive_entry_ino_is_set :: Ptr ArchiveEntry -> IO CInt+foreign import ccall archive_entry_mode :: Ptr ArchiveEntry -> IO CMode+foreign import ccall archive_entry_mtime :: Ptr ArchiveEntry -> IO CTime+foreign import ccall archive_entry_mtime_nsec :: Ptr ArchiveEntry -> IO CLong+foreign import ccall archive_entry_mtime_is_set :: Ptr ArchiveEntry -> IO CInt+foreign import ccall archive_entry_nlink :: Ptr ArchiveEntry -> IO CUInt+foreign import ccall archive_entry_pathname :: Ptr ArchiveEntry -> IO CString+foreign import ccall archive_entry_pathname_utf8 :: Ptr ArchiveEntry -> IO CString+foreign import ccall archive_entry_pathname_w :: Ptr ArchiveEntry -> IO CWString+foreign import ccall archive_entry_perm :: Ptr ArchiveEntry -> IO CMode+foreign import ccall archive_entry_rdev :: Ptr ArchiveEntry -> IO Word64+foreign import ccall archive_entry_rdevmajor :: Ptr ArchiveEntry -> IO Word64+foreign import ccall archive_entry_rdevminor :: Ptr ArchiveEntry -> IO Word64+foreign import ccall archive_entry_sourcepath :: Ptr ArchiveEntry -> IO CString+foreign import ccall archive_entry_sourcepath_w :: Ptr ArchiveEntry -> IO CWString+foreign import ccall archive_entry_size :: Ptr ArchiveEntry -> IO Int64+foreign import ccall archive_entry_size_is_set :: Ptr ArchiveEntry -> IO CInt+foreign import ccall archive_entry_strmode :: Ptr ArchiveEntry -> IO CString+foreign import ccall archive_entry_symlink :: Ptr ArchiveEntry -> IO CString+foreign import ccall archive_entry_symlink_utf8 :: Ptr ArchiveEntry -> IO CString+foreign import ccall archive_entry_symlink_w :: Ptr ArchiveEntry -> IO CWString+foreign import ccall archive_entry_uid :: Ptr ArchiveEntry -> IO Id+foreign import ccall archive_entry_uname :: Ptr ArchiveEntry -> IO CString+foreign import ccall archive_entry_uname_utf8 :: Ptr ArchiveEntry -> IO CString+foreign import ccall archive_entry_uname_w :: Ptr ArchiveEntry -> IO CWString+foreign import ccall archive_entry_is_data_encrypted :: Ptr ArchiveEntry -> IO CInt+foreign import ccall archive_entry_is_metadata_encrypted :: Ptr ArchiveEntry -> IO CInt+foreign import ccall archive_entry_is_encrypted :: Ptr ArchiveEntry -> IO CInt -foreign import ccall unsafe archive_entry_set_atime :: Ptr ArchiveEntry -> CTime -> CLong -> IO ()-foreign import ccall unsafe archive_entry_unset_atime :: Ptr ArchiveEntry -> IO ()-foreign import ccall unsafe archive_entry_set_birthtime :: Ptr ArchiveEntry -> CTime -> CLong -> IO ()-foreign import ccall unsafe archive_entry_unset_birthtime :: Ptr ArchiveEntry -> IO ()-foreign import ccall unsafe archive_entry_set_ctime :: Ptr ArchiveEntry -> CTime -> CLong -> IO ()-foreign import ccall unsafe archive_entry_unset_ctime :: Ptr ArchiveEntry -> IO ()-foreign import ccall unsafe archive_entry_set_dev :: Ptr ArchiveEntry -> Int64 -> IO ()-foreign import ccall unsafe archive_entry_set_devmajor :: Ptr ArchiveEntry -> Int64 -> IO ()-foreign import ccall unsafe archive_entry_set_devminor :: Ptr ArchiveEntry -> Int64 -> IO ()-foreign import ccall unsafe archive_entry_set_filetype :: Ptr ArchiveEntry -> FileType -> IO ()-foreign import ccall unsafe archive_entry_set_fflags :: Ptr ArchiveEntry -> CULong -> CULong -> IO ()-foreign import ccall unsafe archive_entry_copy_fflags_text :: Ptr ArchiveEntry -> CString -> IO CString-foreign import ccall unsafe archive_entry_copy_fflags_text_w :: Ptr ArchiveEntry -> CWString -> IO CWString-foreign import ccall unsafe archive_entry_set_gid :: Ptr ArchiveEntry -> Id -> IO ()-foreign import ccall unsafe archive_entry_set_gname :: Ptr ArchiveEntry -> CString -> IO ()-foreign import ccall unsafe archive_entry_set_gname_utf8 :: Ptr ArchiveEntry -> CString -> IO ()-foreign import ccall unsafe archive_entry_copy_gname :: Ptr ArchiveEntry -> CString -> IO ()-foreign import ccall unsafe archive_entry_copy_gname_w :: Ptr ArchiveEntry -> CWString -> IO ()-foreign import ccall unsafe archive_entry_update_gname_utf8 :: Ptr ArchiveEntry -> CString -> IO CInt-foreign import ccall unsafe archive_entry_set_hardlink :: Ptr ArchiveEntry -> CString -> IO ()-foreign import ccall unsafe archive_entry_set_hardlink_utf8 :: Ptr ArchiveEntry -> CString -> IO ()-foreign import ccall unsafe archive_entry_copy_hardlink :: Ptr ArchiveEntry -> CString -> IO ()-foreign import ccall unsafe archive_entry_copy_hardlink_w :: Ptr ArchiveEntry -> CWString -> IO ()-foreign import ccall unsafe archive_entry_update_hardlink_utf8 :: Ptr ArchiveEntry -> CString -> IO CInt-foreign import ccall unsafe archive_entry_set_ino :: Ptr ArchiveEntry -> Int64 -> IO ()-foreign import ccall unsafe archive_entry_set_ino64 :: Ptr ArchiveEntry -> Int64 -> IO ()-foreign import ccall unsafe archive_entry_set_link :: Ptr ArchiveEntry -> CString -> IO ()-foreign import ccall unsafe archive_entry_set_link_utf8 :: Ptr ArchiveEntry -> CString -> IO ()-foreign import ccall unsafe archive_entry_copy_link :: Ptr ArchiveEntry -> CString -> IO ()-foreign import ccall unsafe archive_entry_copy_link_w :: Ptr ArchiveEntry -> CWString -> IO ()-foreign import ccall unsafe archive_entry_update_link_utf8 :: Ptr ArchiveEntry -> CString -> IO CInt-foreign import ccall unsafe archive_entry_set_mode :: Ptr ArchiveEntry -> CMode -> IO ()-foreign import ccall unsafe archive_entry_set_mtime :: Ptr ArchiveEntry -> CTime -> CLong -> IO ()-foreign import ccall unsafe archive_entry_unset_mtime :: Ptr ArchiveEntry -> IO ()-foreign import ccall unsafe archive_entry_set_nlink :: Ptr ArchiveEntry -> CUInt -> IO ()-foreign import ccall unsafe archive_entry_set_pathname :: Ptr ArchiveEntry -> CString -> IO ()-foreign import ccall unsafe archive_entry_set_pathname_utf8 :: Ptr ArchiveEntry -> CString -> IO ()-foreign import ccall unsafe archive_entry_copy_pathname :: Ptr ArchiveEntry -> CString -> IO ()-foreign import ccall unsafe archive_entry_copy_pathname_w :: Ptr ArchiveEntry -> CWString -> IO ()-foreign import ccall unsafe archive_entry_update_pathname_utf8 :: Ptr ArchiveEntry -> CString -> IO CInt-foreign import ccall unsafe archive_entry_set_perm :: Ptr ArchiveEntry -> CMode -> IO ()-foreign import ccall unsafe archive_entry_set_rdev :: Ptr ArchiveEntry -> Int64 -> IO ()-foreign import ccall unsafe archive_entry_set_rdevmajor :: Ptr ArchiveEntry -> Int64 -> IO ()-foreign import ccall unsafe archive_entry_set_rdevminor :: Ptr ArchiveEntry -> Int64 -> IO ()-foreign import ccall unsafe archive_entry_set_size :: Ptr ArchiveEntry -> Int64 -> IO ()-foreign import ccall unsafe archive_entry_unset_size :: Ptr ArchiveEntry -> IO ()-foreign import ccall unsafe archive_entry_copy_sourcepath :: Ptr ArchiveEntry -> CString -> IO ()-foreign import ccall unsafe archive_entry_copy_sourcepath_w :: Ptr ArchiveEntry -> CWString -> IO ()-foreign import ccall unsafe archive_entry_set_symlink :: Ptr ArchiveEntry -> CString -> IO ()-foreign import ccall unsafe archive_entry_set_symlink_utf8 :: Ptr ArchiveEntry -> CString -> IO ()-foreign import ccall unsafe archive_entry_copy_symlink :: Ptr ArchiveEntry -> CString -> IO ()-foreign import ccall unsafe archive_entry_copy_symlink_w :: Ptr ArchiveEntry -> CWString -> IO ()-foreign import ccall unsafe archive_entry_update_symlink_utf8 :: Ptr ArchiveEntry -> CString -> IO CInt-foreign import ccall unsafe archive_entry_set_uid :: Ptr ArchiveEntry -> Id -> IO ()-foreign import ccall unsafe archive_entry_set_uname :: Ptr ArchiveEntry -> CString -> IO ()-foreign import ccall unsafe archive_entry_set_uname_utf8 :: Ptr ArchiveEntry -> CString -> IO ()-foreign import ccall unsafe archive_entry_copy_uname :: Ptr ArchiveEntry -> CString -> IO ()-foreign import ccall unsafe archive_entry_copy_uname_w :: Ptr ArchiveEntry -> CWString -> IO ()-foreign import ccall unsafe archive_entry_update_uname_utf8 :: Ptr ArchiveEntry -> CString -> IO CInt-foreign import ccall unsafe archive_entry_stat :: Ptr ArchiveEntry -> IO (Ptr Stat)-foreign import ccall unsafe archive_entry_copy_stat :: Ptr ArchiveEntry -> Ptr Stat -> IO ()-foreign import ccall unsafe archive_entry_mac_metadata :: Ptr ArchiveEntry -> Ptr CSize -> IO (Ptr a)-foreign import ccall unsafe archive_entry_copy_mac_metadata :: Ptr ArchiveEntry -> Ptr a -> CSize -> IO ()+foreign import ccall archive_entry_set_atime :: Ptr ArchiveEntry -> CTime -> CLong -> IO ()+foreign import ccall archive_entry_unset_atime :: Ptr ArchiveEntry -> IO ()+foreign import ccall archive_entry_set_birthtime :: Ptr ArchiveEntry -> CTime -> CLong -> IO ()+foreign import ccall archive_entry_unset_birthtime :: Ptr ArchiveEntry -> IO ()+foreign import ccall archive_entry_set_ctime :: Ptr ArchiveEntry -> CTime -> CLong -> IO ()+foreign import ccall archive_entry_unset_ctime :: Ptr ArchiveEntry -> IO ()+foreign import ccall archive_entry_set_dev :: Ptr ArchiveEntry -> Int64 -> IO ()+foreign import ccall archive_entry_set_devmajor :: Ptr ArchiveEntry -> Int64 -> IO ()+foreign import ccall archive_entry_set_devminor :: Ptr ArchiveEntry -> Int64 -> IO ()+foreign import ccall archive_entry_set_filetype :: Ptr ArchiveEntry -> FileType -> IO ()+foreign import ccall archive_entry_set_fflags :: Ptr ArchiveEntry -> CULong -> CULong -> IO ()+foreign import ccall archive_entry_copy_fflags_text :: Ptr ArchiveEntry -> CString -> IO CString+foreign import ccall archive_entry_copy_fflags_text_w :: Ptr ArchiveEntry -> CWString -> IO CWString+foreign import ccall archive_entry_set_gid :: Ptr ArchiveEntry -> Id -> IO ()+foreign import ccall archive_entry_set_gname :: Ptr ArchiveEntry -> CString -> IO ()+foreign import ccall archive_entry_set_gname_utf8 :: Ptr ArchiveEntry -> CString -> IO ()+foreign import ccall archive_entry_copy_gname :: Ptr ArchiveEntry -> CString -> IO ()+foreign import ccall archive_entry_copy_gname_w :: Ptr ArchiveEntry -> CWString -> IO ()+foreign import ccall archive_entry_update_gname_utf8 :: Ptr ArchiveEntry -> CString -> IO CInt+foreign import ccall archive_entry_set_hardlink :: Ptr ArchiveEntry -> CString -> IO ()+foreign import ccall archive_entry_set_hardlink_utf8 :: Ptr ArchiveEntry -> CString -> IO ()+foreign import ccall archive_entry_copy_hardlink :: Ptr ArchiveEntry -> CString -> IO ()+foreign import ccall archive_entry_copy_hardlink_w :: Ptr ArchiveEntry -> CWString -> IO ()+foreign import ccall archive_entry_update_hardlink_utf8 :: Ptr ArchiveEntry -> CString -> IO CInt+foreign import ccall archive_entry_set_ino :: Ptr ArchiveEntry -> Int64 -> IO ()+foreign import ccall archive_entry_set_ino64 :: Ptr ArchiveEntry -> Int64 -> IO ()+foreign import ccall archive_entry_set_link :: Ptr ArchiveEntry -> CString -> IO ()+foreign import ccall archive_entry_set_link_utf8 :: Ptr ArchiveEntry -> CString -> IO ()+foreign import ccall archive_entry_copy_link :: Ptr ArchiveEntry -> CString -> IO ()+foreign import ccall archive_entry_copy_link_w :: Ptr ArchiveEntry -> CWString -> IO ()+foreign import ccall archive_entry_update_link_utf8 :: Ptr ArchiveEntry -> CString -> IO CInt+foreign import ccall archive_entry_set_mode :: Ptr ArchiveEntry -> CMode -> IO ()+foreign import ccall archive_entry_set_mtime :: Ptr ArchiveEntry -> CTime -> CLong -> IO ()+foreign import ccall archive_entry_unset_mtime :: Ptr ArchiveEntry -> IO ()+foreign import ccall archive_entry_set_nlink :: Ptr ArchiveEntry -> CUInt -> IO ()+foreign import ccall archive_entry_set_pathname :: Ptr ArchiveEntry -> CString -> IO ()+foreign import ccall archive_entry_set_pathname_utf8 :: Ptr ArchiveEntry -> CString -> IO ()+foreign import ccall archive_entry_copy_pathname :: Ptr ArchiveEntry -> CString -> IO ()+foreign import ccall archive_entry_copy_pathname_w :: Ptr ArchiveEntry -> CWString -> IO ()+foreign import ccall archive_entry_update_pathname_utf8 :: Ptr ArchiveEntry -> CString -> IO CInt+foreign import ccall archive_entry_set_perm :: Ptr ArchiveEntry -> CMode -> IO ()+foreign import ccall archive_entry_set_rdev :: Ptr ArchiveEntry -> Int64 -> IO ()+foreign import ccall archive_entry_set_rdevmajor :: Ptr ArchiveEntry -> Int64 -> IO ()+foreign import ccall archive_entry_set_rdevminor :: Ptr ArchiveEntry -> Int64 -> IO ()+foreign import ccall archive_entry_set_size :: Ptr ArchiveEntry -> Int64 -> IO ()+foreign import ccall archive_entry_unset_size :: Ptr ArchiveEntry -> IO ()+foreign import ccall archive_entry_copy_sourcepath :: Ptr ArchiveEntry -> CString -> IO ()+foreign import ccall archive_entry_copy_sourcepath_w :: Ptr ArchiveEntry -> CWString -> IO ()+foreign import ccall archive_entry_set_symlink :: Ptr ArchiveEntry -> CString -> IO ()+foreign import ccall archive_entry_set_symlink_utf8 :: Ptr ArchiveEntry -> CString -> IO ()+foreign import ccall archive_entry_copy_symlink :: Ptr ArchiveEntry -> CString -> IO ()+foreign import ccall archive_entry_copy_symlink_w :: Ptr ArchiveEntry -> CWString -> IO ()+foreign import ccall archive_entry_update_symlink_utf8 :: Ptr ArchiveEntry -> CString -> IO CInt+foreign import ccall archive_entry_set_uid :: Ptr ArchiveEntry -> Id -> IO ()+foreign import ccall archive_entry_set_uname :: Ptr ArchiveEntry -> CString -> IO ()+foreign import ccall archive_entry_set_uname_utf8 :: Ptr ArchiveEntry -> CString -> IO ()+foreign import ccall archive_entry_copy_uname :: Ptr ArchiveEntry -> CString -> IO ()+foreign import ccall archive_entry_copy_uname_w :: Ptr ArchiveEntry -> CWString -> IO ()+foreign import ccall archive_entry_update_uname_utf8 :: Ptr ArchiveEntry -> CString -> IO CInt+foreign import ccall archive_entry_stat :: Ptr ArchiveEntry -> IO (Ptr Stat)+foreign import ccall archive_entry_copy_stat :: Ptr ArchiveEntry -> Ptr Stat -> IO ()+foreign import ccall archive_entry_mac_metadata :: Ptr ArchiveEntry -> Ptr CSize -> IO (Ptr a)+foreign import ccall archive_entry_copy_mac_metadata :: Ptr ArchiveEntry -> Ptr a -> CSize -> IO () -foreign import ccall unsafe archive_entry_acl_clear :: Ptr ArchiveEntry -> IO ()-foreign import ccall unsafe archive_entry_acl_add_entry :: Ptr ArchiveEntry -> EntryACL -> EntryACL -> EntryACL -> CInt -> CString -> IO ArchiveError-foreign import ccall unsafe archive_entry_acl_add_entry_w :: Ptr ArchiveEntry -> EntryACL -> EntryACL -> EntryACL -> CInt -> CWString -> IO ArchiveError-foreign import ccall unsafe archive_entry_acl_reset :: Ptr ArchiveEntry -> EntryACL -> IO CInt-foreign import ccall unsafe archive_entry_acl_next :: Ptr ArchiveEntry -> EntryACL -> EntryACL -> EntryACL -> EntryACL -> CInt -> Ptr CString -> IO ArchiveError--- foreign import ccall unsafe archive_entry_acl_next_w :: Ptr ArchiveEntry -> EntryACL -> EntryACL -> EntryACL -> EntryACL -> CInt -> Ptr CWString -> IO ArchiveError+foreign import ccall archive_entry_acl_clear :: Ptr ArchiveEntry -> IO ()+foreign import ccall archive_entry_acl_add_entry :: Ptr ArchiveEntry -> EntryACL -> EntryACL -> EntryACL -> CInt -> CString -> IO ArchiveError+foreign import ccall archive_entry_acl_add_entry_w :: Ptr ArchiveEntry -> EntryACL -> EntryACL -> EntryACL -> CInt -> CWString -> IO ArchiveError+foreign import ccall archive_entry_acl_reset :: Ptr ArchiveEntry -> EntryACL -> IO CInt+foreign import ccall archive_entry_acl_next :: Ptr ArchiveEntry -> EntryACL -> EntryACL -> EntryACL -> EntryACL -> CInt -> Ptr CString -> IO ArchiveError+-- foreign import ccall archive_entry_acl_next_w :: Ptr ArchiveEntry -> EntryACL -> EntryACL -> EntryACL -> EntryACL -> CInt -> Ptr CWString -> IO ArchiveError --- foreign import ccall unsafe archive_entry_acl_to_text_w :: Ptr ArchiveEntry -> CSize -> EntryACL -> IO CWString--- foreign import ccall unsafe archive_entry_acl_to_text :: Ptr ArchiveEntry -> CSize -> EntryACL -> IO CString--- foreign import ccall unsafe archive_entry_acl_from_text :: Ptr ArchiveEntry -> CString -> EntryACL -> IO ArchiveError--- foreign import ccall unsafe archive_entry_acl_from_text_w :: Ptr ArchiveEntry -> CWString -> EntryACL -> IO ArchiveError--- foreign import ccall unsafe archive_entry_acl_types :: Ptr ArchiveEntry -> IO EntryACL--- foreign import ccall unsafe archive_entry_count :: Ptr ArchiveEntry -> EntryACL -> IO CInt+-- foreign import ccall archive_entry_acl_to_text_w :: Ptr ArchiveEntry -> CSize -> EntryACL -> IO CWString+-- foreign import ccall archive_entry_acl_to_text :: Ptr ArchiveEntry -> CSize -> EntryACL -> IO CString+-- foreign import ccall archive_entry_acl_from_text :: Ptr ArchiveEntry -> CString -> EntryACL -> IO ArchiveError+-- foreign import ccall archive_entry_acl_from_text_w :: Ptr ArchiveEntry -> CWString -> EntryACL -> IO ArchiveError+-- foreign import ccall archive_entry_acl_types :: Ptr ArchiveEntry -> IO EntryACL+-- foreign import ccall archive_entry_count :: Ptr ArchiveEntry -> EntryACL -> IO CInt -- don't bother with archive_entry_acl -foreign import ccall unsafe archive_entry_xattr_clear :: Ptr ArchiveEntry -> IO ()-foreign import ccall unsafe archive_entry_xattr_add_entry :: Ptr ArchiveEntry -> CString -> Ptr a -> CSize -> IO ()-foreign import ccall unsafe archive_entry_xattr_count :: Ptr ArchiveEntry -> IO CInt-foreign import ccall unsafe archive_entry_xattr_reset :: Ptr ArchiveEntry -> IO CInt-foreign import ccall unsafe archive_entry_xattr_next :: Ptr ArchiveEntry -> Ptr CString -> Ptr (Ptr a) -> Ptr CSize -> IO ArchiveError+foreign import ccall archive_entry_xattr_clear :: Ptr ArchiveEntry -> IO ()+foreign import ccall archive_entry_xattr_add_entry :: Ptr ArchiveEntry -> CString -> Ptr a -> CSize -> IO ()+foreign import ccall archive_entry_xattr_count :: Ptr ArchiveEntry -> IO CInt+foreign import ccall archive_entry_xattr_reset :: Ptr ArchiveEntry -> IO CInt+foreign import ccall archive_entry_xattr_next :: Ptr ArchiveEntry -> Ptr CString -> Ptr (Ptr a) -> Ptr CSize -> IO ArchiveError -- TODO: higher level archiveEntryXattrList? -foreign import ccall unsafe archive_entry_sparse_clear :: Ptr ArchiveEntry -> IO ()-foreign import ccall unsafe archive_entry_sparse_add_entry :: Ptr ArchiveEntry -> Int64 -> Int64 -> IO ()-foreign import ccall unsafe archive_entry_sparse_count :: Ptr ArchiveEntry -> IO CInt-foreign import ccall unsafe archive_entry_sparse_reset :: Ptr ArchiveEntry -> IO CInt-foreign import ccall unsafe archive_entry_sparse_next :: Ptr ArchiveEntry -> Ptr Int64 -> Ptr Int64 -> IO ArchiveError+foreign import ccall archive_entry_sparse_clear :: Ptr ArchiveEntry -> IO ()+foreign import ccall archive_entry_sparse_add_entry :: Ptr ArchiveEntry -> Int64 -> Int64 -> IO ()+foreign import ccall archive_entry_sparse_count :: Ptr ArchiveEntry -> IO CInt+foreign import ccall archive_entry_sparse_reset :: Ptr ArchiveEntry -> IO CInt+foreign import ccall archive_entry_sparse_next :: Ptr ArchiveEntry -> Ptr Int64 -> Ptr Int64 -> IO ArchiveError -foreign import ccall unsafe archive_entry_linkresolver_new :: Ptr LinkResolver-foreign import ccall unsafe archive_entry_linkresolver_set_strategy :: Ptr LinkResolver -> ArchiveFormat -> IO ()-foreign import ccall unsafe archive_entry_linkresolver_free :: Ptr LinkResolver -> IO ()-foreign import ccall unsafe archive_entry_linkify :: Ptr LinkResolver -> Ptr (Ptr ArchiveEntry) -> Ptr (Ptr ArchiveEntry) -> IO ()-foreign import ccall unsafe archive_entry_partial_links :: Ptr LinkResolver -> Ptr CUInt -> IO (Ptr ArchiveEntry)+foreign import ccall archive_entry_linkresolver_new :: Ptr LinkResolver+foreign import ccall archive_entry_linkresolver_set_strategy :: Ptr LinkResolver -> ArchiveFormat -> IO ()+foreign import ccall archive_entry_linkresolver_free :: Ptr LinkResolver -> IO ()+foreign import ccall archive_entry_linkify :: Ptr LinkResolver -> Ptr (Ptr ArchiveEntry) -> Ptr (Ptr ArchiveEntry) -> IO ()+foreign import ccall archive_entry_partial_links :: Ptr LinkResolver -> Ptr CUInt -> IO (Ptr ArchiveEntry) -- stupid function to work around some annoying C quirk mode_t :: Integer -> FileType
src/Codec/Archive/Pack.hs view
@@ -75,6 +75,9 @@ entriesToBSzip = unsafePerformIO . entriesToBSGeneral archive_write_set_format_zip {-# NOINLINE entriesToBSzip #-} +-- entriesToBSLGeneral :: Foldable t => (Ptr Archive -> IO ArchiveError) -> t Entry -> IO BSL.ByteString+-- entriesToBSLGeneral =+ -- | Internal function to be used with 'archive_write_set_format_pax' etc. entriesToBSGeneral :: (Foldable t) => (Ptr Archive -> IO ArchiveError) -> t Entry -> IO BS.ByteString entriesToBSGeneral modifier hsEntries' = do
src/Codec/Archive/Unpack.hs view
@@ -1,17 +1,65 @@ module Codec.Archive.Unpack ( hsEntries , unpackEntriesFp+ , unpackArchive+ , readArchiveFile+ , readArchiveBS+ , unpackToDir ) where +import Codec.Archive.Common import Codec.Archive.Foreign import Codec.Archive.Types-import Control.Monad (void)+import Control.Monad (void, (<=<))+import Data.ByteString (useAsCStringLen) import qualified Data.ByteString as BS import Foreign.C.String import Foreign.Marshal.Alloc (alloca, allocaBytes) import Foreign.Ptr (Ptr) import Foreign.Storable (Storable (..)) import System.FilePath ((</>))+import System.IO.Unsafe (unsafePerformIO) ++-- | Read an archive contained in a 'BS.ByteString'. The format of the archive is+-- automatically detected.+readArchiveBS :: BS.ByteString -> [Entry]+readArchiveBS = unsafePerformIO . (actFree hsEntries <=< bsToArchive)+{-# NOINLINE readArchiveBS #-}++bsToArchive :: BS.ByteString -> IO (Ptr Archive)+bsToArchive bs = do+ a <- archive_read_new+ void $ archive_read_support_format_all a+ useAsCStringLen bs $+ \(charPtr, sz) ->+ void $ archive_read_open_memory a charPtr (fromIntegral sz)+ pure a++-- | Read an archive from a file. The format of the archive is automatically+-- detected.+readArchiveFile :: FilePath -> IO [Entry]+readArchiveFile = actFree hsEntries <=< archiveFile++archiveFile :: FilePath -> IO (Ptr Archive)+archiveFile fp = withCString fp $ \cpath -> do+ a <- archive_read_new+ void $ archive_read_support_format_all a+ void $ archive_read_open_filename a cpath 10240+ pure a++-- | This is more efficient than+--+-- @+-- unpackToDir "llvm" =<< BS.readFile "llvm.tar"+-- @+unpackArchive :: FilePath -- ^ Filepath pointing to archive+ -> FilePath -- ^ Dirctory to unpack in+ -> IO ()+unpackArchive tarFp dirFp = do+ a <- archiveFile tarFp+ unpackEntriesFp a dirFp+ void $ archive_read_free a+ readEntry :: Ptr Archive -> Ptr ArchiveEntry -> IO Entry readEntry a entry = Entry@@ -89,3 +137,10 @@ then pure Nothing else Just <$> peek ptr +unpackToDir :: FilePath -- ^ Directory to unpack in+ -> BS.ByteString -- ^ 'BS.ByteString' containing archive+ -> IO ()+unpackToDir fp bs = do+ a <- bsToArchive bs+ unpackEntriesFp a fp+ void $ archive_read_free a
+ src/Codec/Archive/Unpack/Lazy.hs view
@@ -0,0 +1,70 @@+module Codec.Archive.Unpack.Lazy ( readArchiveBSL+ , bslToArchive+ , unpackToDirLazy+ ) where++import Codec.Archive.Common+import Codec.Archive.Foreign+import Codec.Archive.Types+import Codec.Archive.Unpack+import Control.Monad (void, (<=<))+import Data.ByteString (useAsCStringLen)+import qualified Data.ByteString.Lazy as BSL+import Data.Functor (($>))+import Data.IORef (modifyIORef, newIORef, readIORef)+import Foreign.C.Types+import Foreign.Marshal.Alloc (free, mallocBytes)+import Foreign.Ptr+import Foreign.Storable (poke)+import System.IO.Unsafe (unsafePerformIO)++foreign import ccall memcpy :: Ptr a -- ^ Destination+ -> Ptr b -- ^ Source+ -> CSize -- ^ Size+ -> IO (Ptr a) -- ^ Pointer to destination++unpackToDirLazy :: FilePath -- ^ Directory to unpack in+ -> BSL.ByteString -- ^ 'BSL.ByteString' containing archive+ -> IO ()+unpackToDirLazy fp bs = do+ (a, act) <- bslToArchive bs+ unpackEntriesFp a fp+ void $ archive_read_free a+ act++-- | Read an archive lazily. The format of the archive is automatically+-- detected.+readArchiveBSL :: BSL.ByteString -> [Entry]+readArchiveBSL = unsafePerformIO . (actFreeCallback hsEntries <=< bslToArchive)++freeBits :: FunPtr a -> Ptr b -> IO ()+freeBits fp ptr = freeHaskellFunPtr fp *> free ptr++-- | Lazily stream a 'BSL.ByteString'+bslToArchive :: BSL.ByteString+ -> IO (Ptr Archive, IO ()) -- ^ Returns an 'IO' action that can be used to free things after we're done with the archive+bslToArchive bs = do+ a <- archive_read_new+ void $ archive_read_support_format_all a+ bufPtr <- mallocBytes (32 * 1024) -- default to 32k byte chunks; should really do something more rigorous+ bsChunksRef <- newIORef bsChunks+ rc <- mkReadCallback (readBSL bsChunksRef bufPtr)+ cc <- mkCloseCallback (\_ ptr -> freeHaskellFunPtr rc *> free ptr $> archiveOk)+ nothingPtr <- mallocBytes 0+ sequence_ [ archive_read_set_read_callback a rc+ , archive_read_set_close_callback a cc+ , archive_read_set_callback_data a nothingPtr+ , archive_read_open1 a+ ]+ let act = freeBits cc bufPtr+ pure (a, act)+ where readBSL bsRef bufPtr _ _ dataPtr = do+ bs' <- readIORef bsRef+ case bs' of+ [] -> pure 0+ (x:_) -> do+ modifyIORef bsRef tail+ useAsCStringLen x $ \(charPtr, sz) -> do+ void $ memcpy bufPtr charPtr (fromIntegral sz)+ poke dataPtr bufPtr $> fromIntegral sz+ bsChunks = BSL.toChunks bs