diff --git a/libarchive/src/archive.rs b/libarchive/src/archive.rs index b497894..840b6cf 100644 --- a/libarchive/src/archive.rs +++ b/libarchive/src/archive.rs @@ -56,7 +56,7 @@ pub enum ReadFilter { Rpm, Uu, Xz, - Zstd + Zstd, } impl ReadFilter { @@ -69,7 +69,7 @@ impl ReadFilter { ReadFilter::Lzma => Some(".lzma"), ReadFilter::Xz => Some(".xz"), ReadFilter::Zstd => Some(".zstd"), - _ => None + _ => None, } } } diff --git a/libarchive/src/lib.rs b/libarchive/src/lib.rs index bd99b1b..cbd03db 100644 --- a/libarchive/src/lib.rs +++ b/libarchive/src/lib.rs @@ -1,6 +1,7 @@ pub mod archive; pub mod error; pub mod read; +mod write; pub use archive::{ Entry, ExtractOption, ExtractOptions, Handle, ReadCompression, ReadFilter, ReadFormat, diff --git a/libarchive/src/read/entries.rs b/libarchive/src/read/entries.rs index 3e22155..8a28043 100644 --- a/libarchive/src/read/entries.rs +++ b/libarchive/src/read/entries.rs @@ -2,7 +2,6 @@ use crate::archive::Entry; use crate::error::ArchiveError; use crate::read::Archive; use libarchive3_sys::ffi; -use libc::{c_void, ssize_t}; use std::io; use std::io::Read; use std::marker; diff --git a/libarchive/src/read/mod.rs b/libarchive/src/read/mod.rs index 69c24e3..579b3e5 100644 --- a/libarchive/src/read/mod.rs +++ b/libarchive/src/read/mod.rs @@ -31,7 +31,7 @@ pub trait Archive: Handle + Sized { 3 => Some(ReadFilter::Compress), 5 => Some(ReadFilter::Lzma), 6 => Some(ReadFilter::Xz), - 14 =>Some( ReadFilter::Zstd), + 14 => Some(ReadFilter::Zstd), _ => None, } } diff --git a/libarchive/src/write/builder.rs b/libarchive/src/write/builder.rs new file mode 100644 index 0000000..b075284 --- /dev/null +++ b/libarchive/src/write/builder.rs @@ -0,0 +1,129 @@ +use super::file::FileWriter; +use crate::error::ArchiveError; +use crate::Handle; +use crate::{WriteFilter, WriteFormat}; +use libarchive3_sys::ffi; +use std::ffi::CString; +use std::path::Path; + +pub struct Builder { + handle: *mut ffi::Struct_archive, + consumed: bool, +} + +impl Builder { + pub fn new() -> Self { + Builder::default() + } + + pub fn add_filter(&mut self, filter: WriteFilter) -> crate::Result<()> { + let result = match filter { + WriteFilter::B64Encode => unsafe { + ffi::archive_write_add_filter_b64encode(self.handle) + }, + WriteFilter::Bzip2 => unsafe { ffi::archive_write_add_filter_bzip2(self.handle) }, + WriteFilter::Compress => unsafe { ffi::archive_write_add_filter_compress(self.handle) }, + WriteFilter::Grzip => unsafe { ffi::archive_write_add_filter_grzip(self.handle) }, + WriteFilter::Gzip => unsafe { ffi::archive_write_add_filter_gzip(self.handle) }, + WriteFilter::Lrzip => unsafe { ffi::archive_write_add_filter_lrzip(self.handle) }, + WriteFilter::Lzip => unsafe { ffi::archive_write_add_filter_lzip(self.handle) }, + WriteFilter::Lzma => unsafe { ffi::archive_write_add_filter_lzma(self.handle) }, + WriteFilter::Lzop => unsafe { ffi::archive_write_add_filter_lzop(self.handle) }, + WriteFilter::None => unsafe { ffi::archive_write_add_filter_none(self.handle) }, + WriteFilter::Program(prog) => { + let c_prog = CString::new(prog).unwrap(); + unsafe { ffi::archive_write_add_filter_program(self.handle, c_prog.as_ptr()) } + } + WriteFilter::UuEncode => unsafe { ffi::archive_write_add_filter_uuencode(self.handle) }, + WriteFilter::Xz => unsafe { ffi::archive_write_add_filter_xz(self.handle) }, + }; + match result { + ffi::ARCHIVE_OK => Ok(()), + _ => Result::from(self as &dyn Handle), + } + } + + pub fn set_format(&self, format: WriteFormat) -> crate::Result<()> { + let result = match format { + WriteFormat::SevenZip => unsafe { ffi::archive_write_set_format_7zip(self.handle) }, + WriteFormat::ArBsd => unsafe { ffi::archive_write_set_format_ar_bsd(self.handle) }, + WriteFormat::ArSvr4 => unsafe { ffi::archive_write_set_format_ar_svr4(self.handle) }, + WriteFormat::Cpio => unsafe { ffi::archive_write_set_format_cpio(self.handle) }, + WriteFormat::CpioNewc => unsafe { + ffi::archive_write_set_format_cpio_newc(self.handle) + }, + WriteFormat::Gnutar => unsafe { ffi::archive_write_set_format_gnutar(self.handle) }, + WriteFormat::Iso9660 => unsafe { ffi::archive_write_set_format_iso9660(self.handle) }, + WriteFormat::Mtree => unsafe { ffi::archive_write_set_format_mtree(self.handle) }, + WriteFormat::MtreeClassic => unsafe { + ffi::archive_write_set_format_mtree_classic(self.handle) + }, + WriteFormat::Pax => unsafe { ffi::archive_write_set_format_pax(self.handle) }, + WriteFormat::PaxRestricted => unsafe { + ffi::archive_write_set_format_pax_restricted(self.handle) + }, + WriteFormat::Shar => unsafe { ffi::archive_write_set_format_shar(self.handle) }, + WriteFormat::SharDump => unsafe { + ffi::archive_write_set_format_shar_dump(self.handle) + }, + WriteFormat::Ustar => unsafe { ffi::archive_write_set_format_ustar(self.handle) }, + WriteFormat::V7tar => unsafe { ffi::archive_write_set_format_v7tar(self.handle) }, + WriteFormat::Xar => unsafe { ffi::archive_write_set_format_xar(self.handle) }, + WriteFormat::Zip => unsafe { ffi::archive_write_set_format_zip(self.handle) }, + }; + match result { + ffi::ARCHIVE_OK => Ok(()), + _ => Result::from(self as &dyn Handle), + } + } + + pub fn open_file>(mut self, file: T) -> crate::Result { + if self.consumed { + return Err(ArchiveError::Consumed); + } + let c_file = CString::new(file.as_ref().to_string_lossy().as_bytes()).unwrap(); + let res = unsafe { ffi::archive_write_open_filename(self.handle, c_file.as_ptr()) }; + match res { + ffi::ARCHIVE_OK => { + self.consumed = true; + Ok(FileWriter::new(self.handle)) + } + _ => Err(ArchiveError::from(&self as &dyn Handle)), + } + } +} + +impl Default for Builder { + fn default() -> Self { + unsafe { + let handle = ffi::archive_write_new(); + if handle.is_null() { + panic!("Allocation error"); + } + Builder { + handle, + consumed: false, + } + } + } +} + +impl Handle for Builder { + unsafe fn handle(&self) -> *const ffi::Struct_archive { + self.handle as *const _ + } + + unsafe fn handle_mut(&mut self) -> *mut ffi::Struct_archive { + self.handle + } +} + +impl Drop for Builder { + fn drop(&mut self) { + if !self.consumed { + unsafe { + ffi::archive_write_free(self.handle); + } + } + } +} diff --git a/libarchive/src/write/file.rs b/libarchive/src/write/file.rs new file mode 100644 index 0000000..039a838 --- /dev/null +++ b/libarchive/src/write/file.rs @@ -0,0 +1,79 @@ +use super::WriteEntry; +use crate::Entry; +use crate::Handle; +use libarchive3_sys::ffi; +use libarchive3_sys::ffi::c_void; +use std::fs; +use std::io; +use std::io::Read; +use std::path::Path; + +pub struct FileWriter { + handle: *mut ffi::Struct_archive, + closed: bool, +} + +impl Handle for FileWriter { + unsafe fn handle(&self) -> *const ffi::Struct_archive { + self.handle as *const _ + } + + unsafe fn handle_mut(&mut self) -> *mut ffi::Struct_archive { + self.handle + } +} + +impl FileWriter { + pub fn new(handle: *mut ffi::Struct_archive) -> Self { + FileWriter { + handle, + closed: false, + } + } + + pub fn append_path>( + &mut self, + entry: &mut WriteEntry, + path: P, + ) -> io::Result<()> { + unsafe { + ffi::archive_write_header(self.handle_mut(), entry.entry_mut()); + } + + let mut f = fs::File::open(path)?; + let mut buf = [0; 8192]; + + loop { + match f.read(&mut buf) { + Ok(0) => return Ok(()), + Ok(written) => unsafe { + ffi::archive_write_data(self.handle_mut(), buf.as_ptr() as *const _, written); + }, + Err(err) => match err.kind() { + io::ErrorKind::Interrupted => (), + _ => return Err(err), + }, + }; + } + } + + pub fn close(&mut self) { + unsafe { + ffi::archive_write_close(self.handle_mut()); + } + + self.closed = true; + } +} + +impl Drop for FileWriter { + fn drop(&mut self) { + if !self.closed { + self.close(); + } + + unsafe { + ffi::archive_write_free(self.handle_mut()); + } + } +} diff --git a/libarchive/src/write/mod.rs b/libarchive/src/write/mod.rs new file mode 100644 index 0000000..446edba --- /dev/null +++ b/libarchive/src/write/mod.rs @@ -0,0 +1,34 @@ +mod builder; +mod file; + +use crate::Entry; +pub use builder::Builder; +use libarchive3_sys::ffi; + +pub struct WriteEntry { + entry: *mut ffi::Struct_archive_entry, +} + +impl WriteEntry { + pub fn new() -> Self { + let entry = unsafe { ffi::archive_entry_new() }; + + Self { entry } + } +} + +impl Entry for WriteEntry { + unsafe fn entry(&self) -> *const ffi::Struct_archive_entry { + self.entry as *const _ + } + + unsafe fn entry_mut(&mut self) -> *mut ffi::Struct_archive_entry { + self.entry + } +} + +impl Drop for WriteEntry { + fn drop(&mut self) { + unsafe { ffi::archive_entry_free(self.entry_mut()) } + } +} diff --git a/libarchive3-sys/src/ffi.rs b/libarchive3-sys/src/ffi.rs index e2f347f..92cd267 100644 --- a/libarchive3-sys/src/ffi.rs +++ b/libarchive3-sys/src/ffi.rs @@ -35,42 +35,42 @@ pub const AE_IFMT: c_uint = 0o170000; pub const AE_IFREG: c_uint = 0o100000; pub const AE_IFSOCK: c_uint = 0o140000; -pub enum Struct_archive { } -pub enum Struct_archive_entry { } -pub enum Struct_archive_acl { } -pub enum Struct_archive_entry_linkresolver { } +pub enum Struct_archive {} +pub enum Struct_archive_entry {} +pub enum Struct_archive_acl {} +pub enum Struct_archive_entry_linkresolver {} #[cfg(windows)] pub type mode_t = u16; -pub type archive_read_callback = unsafe extern "C" fn(arg1: *mut Struct_archive, - _client_data: *mut c_void, - _buffer: *mut *const c_void) - -> ssize_t; -pub type archive_skip_callback = unsafe extern "C" fn(arg1: *mut Struct_archive, - _client_data: *mut c_void, - request: i64) - -> i64; -pub type archive_seek_callback = unsafe extern "C" fn(arg1: *mut Struct_archive, - _client_data: *mut c_void, - offset: i64, - whence: c_int) - -> i64; -pub type archive_write_callback = unsafe extern "C" fn(arg1: *mut Struct_archive, - _client_data: *mut c_void, - _buffer: *const c_void, - _length: size_t) - -> ssize_t; -pub type archive_open_callback = unsafe extern "C" fn(arg1: *mut Struct_archive, - _client_data: *mut c_void) - -> c_int; -pub type archive_close_callback = unsafe extern "C" fn(arg1: *mut Struct_archive, - _client_data: *mut c_void) - -> c_int; -pub type archive_switch_callback = unsafe extern "C" fn(arg1: *mut Struct_archive, - _client_data1: *mut c_void, - _client_data2: *mut c_void) - -> c_int; +pub type archive_read_callback = unsafe extern "C" fn( + arg1: *mut Struct_archive, + _client_data: *mut c_void, + _buffer: *mut *const c_void, +) -> ssize_t; +pub type archive_skip_callback = + unsafe extern "C" fn(arg1: *mut Struct_archive, _client_data: *mut c_void, request: i64) -> i64; +pub type archive_seek_callback = unsafe extern "C" fn( + arg1: *mut Struct_archive, + _client_data: *mut c_void, + offset: i64, + whence: c_int, +) -> i64; +pub type archive_write_callback = unsafe extern "C" fn( + arg1: *mut Struct_archive, + _client_data: *mut c_void, + _buffer: *const c_void, + _length: size_t, +) -> ssize_t; +pub type archive_open_callback = + unsafe extern "C" fn(arg1: *mut Struct_archive, _client_data: *mut c_void) -> c_int; +pub type archive_close_callback = + unsafe extern "C" fn(arg1: *mut Struct_archive, _client_data: *mut c_void) -> c_int; +pub type archive_switch_callback = unsafe extern "C" fn( + arg1: *mut Struct_archive, + _client_data1: *mut c_void, + _client_data2: *mut c_void, +) -> c_int; #[link(name = "archive")] extern "C" { @@ -84,14 +84,16 @@ extern "C" { pub fn archive_read_support_compression_lzip(arg1: *mut Struct_archive) -> c_int; pub fn archive_read_support_compression_lzma(arg1: *mut Struct_archive) -> c_int; pub fn archive_read_support_compression_none(arg1: *mut Struct_archive) -> c_int; - pub fn archive_read_support_compression_program(arg1: *mut Struct_archive, - command: *const c_char) - -> c_int; - pub fn archive_read_support_compression_program_signature(arg1: *mut Struct_archive, - arg2: *const c_char, - arg3: *const c_void, - arg4: size_t) - -> c_int; + pub fn archive_read_support_compression_program( + arg1: *mut Struct_archive, + command: *const c_char, + ) -> c_int; + pub fn archive_read_support_compression_program_signature( + arg1: *mut Struct_archive, + arg2: *const c_char, + arg3: *const c_void, + arg4: size_t, + ) -> c_int; pub fn archive_read_support_compression_rpm(arg1: *mut Struct_archive) -> c_int; pub fn archive_read_support_compression_uu(arg1: *mut Struct_archive) -> c_int; pub fn archive_read_support_compression_xz(arg1: *mut Struct_archive) -> c_int; @@ -106,14 +108,16 @@ extern "C" { pub fn archive_read_support_filter_lzop(arg1: *mut Struct_archive) -> c_int; pub fn archive_read_support_filter_zstd(arg1: *mut Struct_archive) -> c_int; pub fn archive_read_support_filter_none(arg1: *mut Struct_archive) -> c_int; - pub fn archive_read_support_filter_program(arg1: *mut Struct_archive, - command: *const c_char) - -> c_int; - pub fn archive_read_support_filter_program_signature(arg1: *mut Struct_archive, - arg2: *const c_char, - arg3: *const c_void, - arg4: size_t) - -> c_int; + pub fn archive_read_support_filter_program( + arg1: *mut Struct_archive, + command: *const c_char, + ) -> c_int; + pub fn archive_read_support_filter_program_signature( + arg1: *mut Struct_archive, + arg2: *const c_char, + arg3: *const c_void, + arg4: size_t, + ) -> c_int; pub fn archive_read_support_filter_rpm(arg1: *mut Struct_archive) -> c_int; pub fn archive_read_support_filter_uu(arg1: *mut Struct_archive) -> c_int; pub fn archive_read_support_filter_xz(arg1: *mut Struct_archive) -> c_int; @@ -135,196 +139,200 @@ extern "C" { pub fn archive_read_support_format_zip(arg1: *mut Struct_archive) -> c_int; pub fn archive_read_set_format(arg1: *mut Struct_archive, arg2: c_int) -> c_int; pub fn archive_read_append_filter(arg1: *mut Struct_archive, arg2: c_int) -> c_int; - pub fn archive_read_append_filter_program(arg1: *mut Struct_archive, - arg2: *const c_char) - -> c_int; - pub fn archive_read_append_filter_program_signature(arg1: *mut Struct_archive, - arg2: *const c_char, - arg3: *const c_void, - arg4: size_t) - -> c_int; - pub fn archive_read_set_open_callback(arg1: *mut Struct_archive, - arg2: - *mut ::std::option::Option - c_int>) - -> c_int; - pub fn archive_read_set_read_callback(arg1: *mut Struct_archive, - arg2: - *mut ::std::option::Option - ssize_t>) - -> c_int; - pub fn archive_read_set_seek_callback(arg1: *mut Struct_archive, - arg2: - *mut ::std::option::Option - i64>) - -> c_int; - pub fn archive_read_set_skip_callback(arg1: *mut Struct_archive, - arg2: - *mut ::std::option::Option - i64>) - -> c_int; - pub fn archive_read_set_close_callback(arg1: *mut Struct_archive, - arg2: - *mut ::std::option::Option - c_int>) - -> c_int; - pub fn archive_read_set_switch_callback(arg1: *mut Struct_archive, - arg2: - *mut ::std::option::Option - c_int>) - -> c_int; + pub fn archive_read_append_filter_program( + arg1: *mut Struct_archive, + arg2: *const c_char, + ) -> c_int; + pub fn archive_read_append_filter_program_signature( + arg1: *mut Struct_archive, + arg2: *const c_char, + arg3: *const c_void, + arg4: size_t, + ) -> c_int; + pub fn archive_read_set_open_callback( + arg1: *mut Struct_archive, + arg2: *mut ::std::option::Option c_int>, + ) -> c_int; + pub fn archive_read_set_read_callback( + arg1: *mut Struct_archive, + arg2: *mut ::std::option::Option ssize_t>, + ) -> c_int; + pub fn archive_read_set_seek_callback( + arg1: *mut Struct_archive, + arg2: *mut ::std::option::Option i64>, + ) -> c_int; + pub fn archive_read_set_skip_callback( + arg1: *mut Struct_archive, + arg2: *mut ::std::option::Option i64>, + ) -> c_int; + pub fn archive_read_set_close_callback( + arg1: *mut Struct_archive, + arg2: *mut ::std::option::Option c_int>, + ) -> c_int; + pub fn archive_read_set_switch_callback( + arg1: *mut Struct_archive, + arg2: *mut ::std::option::Option c_int>, + ) -> c_int; pub fn archive_read_set_callback_data(arg1: *mut Struct_archive, arg2: *mut c_void) -> c_int; - pub fn archive_read_set_callback_data2(arg1: *mut Struct_archive, - arg2: *mut c_void, - arg3: c_uint) - -> c_int; - pub fn archive_read_add_callback_data(arg1: *mut Struct_archive, - arg2: *mut c_void, - arg3: c_uint) - -> c_int; - pub fn archive_read_append_callback_data(arg1: *mut Struct_archive, - arg2: *mut c_void) - -> c_int; - pub fn archive_read_prepend_callback_data(arg1: *mut Struct_archive, - arg2: *mut c_void) - -> c_int; + pub fn archive_read_set_callback_data2( + arg1: *mut Struct_archive, + arg2: *mut c_void, + arg3: c_uint, + ) -> c_int; + pub fn archive_read_add_callback_data( + arg1: *mut Struct_archive, + arg2: *mut c_void, + arg3: c_uint, + ) -> c_int; + pub fn archive_read_append_callback_data(arg1: *mut Struct_archive, arg2: *mut c_void) + -> c_int; + pub fn archive_read_prepend_callback_data( + arg1: *mut Struct_archive, + arg2: *mut c_void, + ) -> c_int; pub fn archive_read_open1(arg1: *mut Struct_archive) -> c_int; - pub fn archive_read_open(arg1: *mut Struct_archive, - _client_data: *mut c_void, - arg2: ::std::option::Option, - arg3: ::std::option::Option, - arg4: ::std::option::Option) - -> c_int; - pub fn archive_read_open2(arg1: *mut Struct_archive, - _client_data: *mut c_void, - arg2: *mut ::std::option::Option c_int>, - arg3: *mut ::std::option::Option ssize_t>, - arg4: *mut ::std::option::Option i64>, - arg5: *mut ::std::option::Option c_int>) - -> c_int; - pub fn archive_read_open_filename(arg1: *mut Struct_archive, - _filename: *const c_char, - _block_size: size_t) - -> c_int; - pub fn archive_read_open_filenames(arg1: *mut Struct_archive, - _filenames: *mut *const c_char, - _block_size: size_t) - -> c_int; - pub fn archive_read_open_filename_w(arg1: *mut Struct_archive, - _filename: *const wchar_t, - _block_size: size_t) - -> c_int; - pub fn archive_read_open_file(arg1: *mut Struct_archive, - _filename: *const c_char, - _block_size: size_t) - -> c_int; - pub fn archive_read_open_memory(arg1: *mut Struct_archive, - buff: *mut c_void, - size: size_t) - -> c_int; - pub fn archive_read_open_memory2(a: *mut Struct_archive, - buff: *mut c_void, - size: size_t, - read_size: size_t) - -> c_int; - pub fn archive_read_open_fd(arg1: *mut Struct_archive, - _fd: c_int, - _block_size: size_t) - -> c_int; + pub fn archive_read_open( + arg1: *mut Struct_archive, + _client_data: *mut c_void, + arg2: ::std::option::Option, + arg3: ::std::option::Option, + arg4: ::std::option::Option, + ) -> c_int; + pub fn archive_read_open2( + arg1: *mut Struct_archive, + _client_data: *mut c_void, + arg2: *mut ::std::option::Option c_int>, + arg3: *mut ::std::option::Option ssize_t>, + arg4: *mut ::std::option::Option i64>, + arg5: *mut ::std::option::Option c_int>, + ) -> c_int; + pub fn archive_read_open_filename( + arg1: *mut Struct_archive, + _filename: *const c_char, + _block_size: size_t, + ) -> c_int; + pub fn archive_read_open_filenames( + arg1: *mut Struct_archive, + _filenames: *mut *const c_char, + _block_size: size_t, + ) -> c_int; + pub fn archive_read_open_filename_w( + arg1: *mut Struct_archive, + _filename: *const wchar_t, + _block_size: size_t, + ) -> c_int; + pub fn archive_read_open_file( + arg1: *mut Struct_archive, + _filename: *const c_char, + _block_size: size_t, + ) -> c_int; + pub fn archive_read_open_memory( + arg1: *mut Struct_archive, + buff: *mut c_void, + size: size_t, + ) -> c_int; + pub fn archive_read_open_memory2( + a: *mut Struct_archive, + buff: *mut c_void, + size: size_t, + read_size: size_t, + ) -> c_int; + pub fn archive_read_open_fd( + arg1: *mut Struct_archive, + _fd: c_int, + _block_size: size_t, + ) -> c_int; pub fn archive_read_open_FILE(arg1: *mut Struct_archive, _file: *mut FILE) -> c_int; - pub fn archive_read_next_header(arg1: *mut Struct_archive, - arg2: *mut *mut Struct_archive_entry) - -> c_int; - pub fn archive_read_next_header2(arg1: *mut Struct_archive, - arg2: *mut Struct_archive_entry) - -> c_int; + pub fn archive_read_next_header( + arg1: *mut Struct_archive, + arg2: *mut *mut Struct_archive_entry, + ) -> c_int; + pub fn archive_read_next_header2( + arg1: *mut Struct_archive, + arg2: *mut Struct_archive_entry, + ) -> c_int; pub fn archive_read_header_position(arg1: *mut Struct_archive) -> i64; - pub fn archive_read_data(arg1: *mut Struct_archive, - arg2: *mut c_void, - arg3: size_t) - -> ssize_t; + pub fn archive_read_data(arg1: *mut Struct_archive, arg2: *mut c_void, arg3: size_t) + -> ssize_t; pub fn archive_seek_data(arg1: *mut Struct_archive, arg2: i64, arg3: c_int) -> i64; - pub fn archive_read_data_block(a: *mut Struct_archive, - buff: *mut *const c_void, - size: *mut size_t, - offset: *mut i64) - -> c_int; + pub fn archive_read_data_block( + a: *mut Struct_archive, + buff: *mut *const c_void, + size: *mut size_t, + offset: *mut i64, + ) -> c_int; pub fn archive_read_data_skip(arg1: *mut Struct_archive) -> c_int; pub fn archive_read_data_into_fd(arg1: *mut Struct_archive, fd: c_int) -> c_int; - pub fn archive_read_set_format_option(_a: *mut Struct_archive, - m: *const c_char, - o: *const c_char, - v: *const c_char) - -> c_int; - pub fn archive_read_set_filter_option(_a: *mut Struct_archive, - m: *const c_char, - o: *const c_char, - v: *const c_char) - -> c_int; - pub fn archive_read_set_option(_a: *mut Struct_archive, - m: *const c_char, - o: *const c_char, - v: *const c_char) - -> c_int; + pub fn archive_read_set_format_option( + _a: *mut Struct_archive, + m: *const c_char, + o: *const c_char, + v: *const c_char, + ) -> c_int; + pub fn archive_read_set_filter_option( + _a: *mut Struct_archive, + m: *const c_char, + o: *const c_char, + v: *const c_char, + ) -> c_int; + pub fn archive_read_set_option( + _a: *mut Struct_archive, + m: *const c_char, + o: *const c_char, + v: *const c_char, + ) -> c_int; pub fn archive_read_set_options(_a: *mut Struct_archive, opts: *const c_char) -> c_int; - pub fn archive_read_extract(arg1: *mut Struct_archive, - arg2: *mut Struct_archive_entry, - flags: c_int) - -> c_int; - pub fn archive_read_extract2(arg1: *mut Struct_archive, - arg2: *mut Struct_archive_entry, - arg3: *mut Struct_archive) - -> c_int; - pub fn archive_read_extract_set_progress_callback(arg1: - *mut Struct_archive, - _progress_func: - ::std::option::Option - ()>, - _user_data: - *mut c_void) - -> (); - pub fn archive_read_extract_set_skip_file(arg1: *mut Struct_archive, - arg2: i64, - arg3: i64) - -> (); + pub fn archive_read_extract( + arg1: *mut Struct_archive, + arg2: *mut Struct_archive_entry, + flags: c_int, + ) -> c_int; + pub fn archive_read_extract2( + arg1: *mut Struct_archive, + arg2: *mut Struct_archive_entry, + arg3: *mut Struct_archive, + ) -> c_int; + pub fn archive_read_extract_set_progress_callback( + arg1: *mut Struct_archive, + _progress_func: ::std::option::Option ()>, + _user_data: *mut c_void, + ) -> (); + pub fn archive_read_extract_set_skip_file( + arg1: *mut Struct_archive, + arg2: i64, + arg3: i64, + ) -> (); pub fn archive_read_close(arg1: *mut Struct_archive) -> c_int; pub fn archive_read_free(arg1: *mut Struct_archive) -> c_int; pub fn archive_read_finish(arg1: *mut Struct_archive) -> c_int; pub fn archive_write_new() -> *mut Struct_archive; - pub fn archive_write_set_bytes_per_block(arg1: *mut Struct_archive, - bytes_per_block: c_int) - -> c_int; + pub fn archive_write_set_bytes_per_block( + arg1: *mut Struct_archive, + bytes_per_block: c_int, + ) -> c_int; pub fn archive_write_get_bytes_per_block(arg1: *mut Struct_archive) -> c_int; - pub fn archive_write_set_bytes_in_last_block(arg1: *mut Struct_archive, - bytes_in_last_block: c_int) - -> c_int; + pub fn archive_write_set_bytes_in_last_block( + arg1: *mut Struct_archive, + bytes_in_last_block: c_int, + ) -> c_int; pub fn archive_write_get_bytes_in_last_block(arg1: *mut Struct_archive) -> c_int; - pub fn archive_write_set_skip_file(arg1: *mut Struct_archive, - arg2: i64, - arg3: i64) - -> c_int; + pub fn archive_write_set_skip_file(arg1: *mut Struct_archive, arg2: i64, arg3: i64) -> c_int; pub fn archive_write_set_compression_bzip2(arg1: *mut Struct_archive) -> c_int; pub fn archive_write_set_compression_compress(arg1: *mut Struct_archive) -> c_int; pub fn archive_write_set_compression_gzip(arg1: *mut Struct_archive) -> c_int; pub fn archive_write_set_compression_lzip(arg1: *mut Struct_archive) -> c_int; pub fn archive_write_set_compression_lzma(arg1: *mut Struct_archive) -> c_int; pub fn archive_write_set_compression_none(arg1: *mut Struct_archive) -> c_int; - pub fn archive_write_set_compression_program(arg1: *mut Struct_archive, - cmd: *const c_char) - -> c_int; + pub fn archive_write_set_compression_program( + arg1: *mut Struct_archive, + cmd: *const c_char, + ) -> c_int; pub fn archive_write_set_compression_xz(arg1: *mut Struct_archive) -> c_int; pub fn archive_write_add_filter(arg1: *mut Struct_archive, filter_code: c_int) -> c_int; - pub fn archive_write_add_filter_by_name(arg1: *mut Struct_archive, - name: *const c_char) - -> c_int; + pub fn archive_write_add_filter_by_name( + arg1: *mut Struct_archive, + name: *const c_char, + ) -> c_int; pub fn archive_write_add_filter_b64encode(arg1: *mut Struct_archive) -> c_int; pub fn archive_write_add_filter_bzip2(arg1: *mut Struct_archive) -> c_int; pub fn archive_write_add_filter_compress(arg1: *mut Struct_archive) -> c_int; @@ -335,15 +343,15 @@ extern "C" { pub fn archive_write_add_filter_lzma(arg1: *mut Struct_archive) -> c_int; pub fn archive_write_add_filter_lzop(arg1: *mut Struct_archive) -> c_int; pub fn archive_write_add_filter_none(arg1: *mut Struct_archive) -> c_int; - pub fn archive_write_add_filter_program(arg1: *mut Struct_archive, - cmd: *const c_char) - -> c_int; + pub fn archive_write_add_filter_program(arg1: *mut Struct_archive, cmd: *const c_char) + -> c_int; pub fn archive_write_add_filter_uuencode(arg1: *mut Struct_archive) -> c_int; pub fn archive_write_add_filter_xz(arg1: *mut Struct_archive) -> c_int; pub fn archive_write_set_format(arg1: *mut Struct_archive, format_code: c_int) -> c_int; - pub fn archive_write_set_format_by_name(arg1: *mut Struct_archive, - name: *const c_char) - -> c_int; + pub fn archive_write_set_format_by_name( + arg1: *mut Struct_archive, + name: *const c_char, + ) -> c_int; pub fn archive_write_set_format_7zip(arg1: *mut Struct_archive) -> c_int; pub fn archive_write_set_format_ar_bsd(arg1: *mut Struct_archive) -> c_int; pub fn archive_write_set_format_ar_svr4(arg1: *mut Struct_archive) -> c_int; @@ -363,106 +371,92 @@ extern "C" { pub fn archive_write_set_format_zip(arg1: *mut Struct_archive) -> c_int; pub fn archive_write_zip_set_compression_deflate(arg1: *mut Struct_archive) -> c_int; pub fn archive_write_zip_set_compression_store(arg1: *mut Struct_archive) -> c_int; - pub fn archive_write_open(arg1: *mut Struct_archive, - arg2: *mut c_void, - arg3: *mut ::std::option::Option c_int>, - arg4: *mut ::std::option::Option ssize_t>, - arg5: *mut ::std::option::Option c_int>) - -> c_int; + pub fn archive_write_open( + arg1: *mut Struct_archive, + arg2: *mut c_void, + arg3: *mut ::std::option::Option c_int>, + arg4: *mut ::std::option::Option ssize_t>, + arg5: *mut ::std::option::Option c_int>, + ) -> c_int; pub fn archive_write_open_fd(arg1: *mut Struct_archive, _fd: c_int) -> c_int; pub fn archive_write_open_filename(arg1: *mut Struct_archive, _file: *const c_char) -> c_int; - pub fn archive_write_open_filename_w(arg1: *mut Struct_archive, - _file: *const wchar_t) - -> c_int; + pub fn archive_write_open_filename_w(arg1: *mut Struct_archive, _file: *const wchar_t) + -> c_int; pub fn archive_write_open_file(arg1: *mut Struct_archive, _file: *const c_char) -> c_int; pub fn archive_write_open_FILE(arg1: *mut Struct_archive, arg2: *mut FILE) -> c_int; - pub fn archive_write_open_memory(arg1: *mut Struct_archive, - _buffer: *mut c_void, - _buffSize: size_t, - _used: *mut size_t) - -> c_int; - pub fn archive_write_header(arg1: *mut Struct_archive, - arg2: *mut Struct_archive_entry) - -> c_int; - pub fn archive_write_data(arg1: *mut Struct_archive, - arg2: *const c_void, - arg3: size_t) - -> ssize_t; - pub fn archive_write_data_block(arg1: *mut Struct_archive, - arg2: *const c_void, - arg3: size_t, - arg4: i64) - -> ssize_t; + pub fn archive_write_open_memory( + arg1: *mut Struct_archive, + _buffer: *mut c_void, + _buffSize: size_t, + _used: *mut size_t, + ) -> c_int; + pub fn archive_write_header( + arg1: *mut Struct_archive, + arg2: *mut Struct_archive_entry, + ) -> c_int; + pub fn archive_write_data( + arg1: *mut Struct_archive, + arg2: *const c_void, + arg3: size_t, + ) -> ssize_t; + pub fn archive_write_data_block( + arg1: *mut Struct_archive, + arg2: *const c_void, + arg3: size_t, + arg4: i64, + ) -> ssize_t; pub fn archive_write_finish_entry(arg1: *mut Struct_archive) -> c_int; pub fn archive_write_close(arg1: *mut Struct_archive) -> c_int; pub fn archive_write_fail(arg1: *mut Struct_archive) -> c_int; pub fn archive_write_free(arg1: *mut Struct_archive) -> c_int; pub fn archive_write_finish(arg1: *mut Struct_archive) -> c_int; - pub fn archive_write_set_format_option(_a: *mut Struct_archive, - m: *const c_char, - o: *const c_char, - v: *const c_char) - -> c_int; - pub fn archive_write_set_filter_option(_a: *mut Struct_archive, - m: *const c_char, - o: *const c_char, - v: *const c_char) - -> c_int; - pub fn archive_write_set_option(_a: *mut Struct_archive, - m: *const c_char, - o: *const c_char, - v: *const c_char) - -> c_int; + pub fn archive_write_set_format_option( + _a: *mut Struct_archive, + m: *const c_char, + o: *const c_char, + v: *const c_char, + ) -> c_int; + pub fn archive_write_set_filter_option( + _a: *mut Struct_archive, + m: *const c_char, + o: *const c_char, + v: *const c_char, + ) -> c_int; + pub fn archive_write_set_option( + _a: *mut Struct_archive, + m: *const c_char, + o: *const c_char, + v: *const c_char, + ) -> c_int; pub fn archive_write_set_options(_a: *mut Struct_archive, opts: *const c_char) -> c_int; pub fn archive_write_disk_new() -> *mut Struct_archive; - pub fn archive_write_disk_set_skip_file(arg1: *mut Struct_archive, - arg2: i64, - arg3: i64) - -> c_int; + pub fn archive_write_disk_set_skip_file( + arg1: *mut Struct_archive, + arg2: i64, + arg3: i64, + ) -> c_int; pub fn archive_write_disk_set_options(arg1: *mut Struct_archive, flags: c_int) -> c_int; pub fn archive_write_disk_set_standard_lookup(arg1: *mut Struct_archive) -> c_int; - pub fn archive_write_disk_set_group_lookup(arg1: *mut Struct_archive, - arg2: *mut c_void, - arg3: - ::std::option::Option - i64>, - arg4: - ::std::option::Option - ()>) - -> c_int; - pub fn archive_write_disk_set_user_lookup(arg1: *mut Struct_archive, - arg2: *mut c_void, - arg3: - ::std::option::Option - i64>, - arg4: - ::std::option::Option - ()>) - -> c_int; - pub fn archive_write_disk_gid(arg1: *mut Struct_archive, - arg2: *const c_char, - arg3: i64) - -> i64; - pub fn archive_write_disk_uid(arg1: *mut Struct_archive, - arg2: *const c_char, - arg3: i64) - -> i64; + pub fn archive_write_disk_set_group_lookup( + arg1: *mut Struct_archive, + arg2: *mut c_void, + arg3: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut c_void, arg2: *const c_char, arg3: i64) -> i64, + >, + arg4: ::std::option::Option ()>, + ) -> c_int; + pub fn archive_write_disk_set_user_lookup( + arg1: *mut Struct_archive, + arg2: *mut c_void, + arg3: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut c_void, arg2: *const c_char, arg3: i64) -> i64, + >, + arg4: ::std::option::Option ()>, + ) -> c_int; + pub fn archive_write_disk_gid(arg1: *mut Struct_archive, arg2: *const c_char, arg3: i64) + -> i64; + pub fn archive_write_disk_uid(arg1: *mut Struct_archive, arg2: *const c_char, arg3: i64) + -> i64; pub fn archive_read_disk_new() -> *mut Struct_archive; pub fn archive_read_disk_set_symlink_logical(arg1: *mut Struct_archive) -> c_int; pub fn archive_read_disk_set_symlink_physical(arg1: *mut Struct_archive) -> c_int; @@ -475,36 +469,22 @@ extern "C" { pub fn archive_read_disk_gname(arg1: *mut Struct_archive, arg2: i64) -> *const c_char; pub fn archive_read_disk_uname(arg1: *mut Struct_archive, arg2: i64) -> *const c_char; pub fn archive_read_disk_set_standard_lookup(arg1: *mut Struct_archive) -> c_int; - pub fn archive_read_disk_set_gname_lookup(arg1: *mut Struct_archive, - arg2: *mut c_void, - arg3: - ::std::option::Option - *const c_char>, - arg4: - ::std::option::Option - ()>) - -> c_int; - pub fn archive_read_disk_set_uname_lookup(arg1: *mut Struct_archive, - arg2: *mut c_void, - arg3: - ::std::option::Option - *const c_char>, - arg4: - ::std::option::Option - ()>) - -> c_int; + pub fn archive_read_disk_set_gname_lookup( + arg1: *mut Struct_archive, + arg2: *mut c_void, + arg3: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut c_void, arg2: i64) -> *const c_char, + >, + arg4: ::std::option::Option ()>, + ) -> c_int; + pub fn archive_read_disk_set_uname_lookup( + arg1: *mut Struct_archive, + arg2: *mut c_void, + arg3: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut c_void, arg2: i64) -> *const c_char, + >, + arg4: ::std::option::Option ()>, + ) -> c_int; pub fn archive_read_disk_open(arg1: *mut Struct_archive, arg2: *const c_char) -> c_int; pub fn archive_read_disk_open_w(arg1: *mut Struct_archive, arg2: *const wchar_t) -> c_int; pub fn archive_read_disk_descend(arg1: *mut Struct_archive) -> c_int; @@ -514,33 +494,29 @@ extern "C" { pub fn archive_read_disk_current_filesystem_is_remote(arg1: *mut Struct_archive) -> c_int; pub fn archive_read_disk_set_atime_restored(arg1: *mut Struct_archive) -> c_int; pub fn archive_read_disk_set_behavior(arg1: *mut Struct_archive, flags: c_int) -> c_int; - pub fn archive_read_disk_set_matching(arg1: *mut Struct_archive, - _matching: *mut Struct_archive, - _excluded_func: - ::std::option::Option - ()>, - _client_data: *mut c_void) - -> c_int; - pub fn archive_read_disk_set_metadata_filter_callback(arg1: - *mut Struct_archive, - _metadata_filter_func: - ::std::option::Option - c_int>, - _client_data: - *mut c_void) - -> c_int; + pub fn archive_read_disk_set_matching( + arg1: *mut Struct_archive, + _matching: *mut Struct_archive, + _excluded_func: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut Struct_archive, + arg2: *mut c_void, + arg3: *mut Struct_archive_entry, + ) -> (), + >, + _client_data: *mut c_void, + ) -> c_int; + pub fn archive_read_disk_set_metadata_filter_callback( + arg1: *mut Struct_archive, + _metadata_filter_func: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut Struct_archive, + arg2: *mut c_void, + arg3: *mut Struct_archive_entry, + ) -> c_int, + >, + _client_data: *mut c_void, + ) -> c_int; pub fn archive_filter_count(arg1: *mut Struct_archive) -> c_int; pub fn archive_filter_bytes(arg1: *mut Struct_archive, arg2: c_int) -> i64; pub fn archive_filter_code(arg1: *mut Struct_archive, arg2: c_int) -> c_int; @@ -554,83 +530,98 @@ extern "C" { pub fn archive_format_name(arg1: *mut Struct_archive) -> *const c_char; pub fn archive_format(arg1: *mut Struct_archive) -> c_int; pub fn archive_clear_error(arg1: *mut Struct_archive) -> (); - pub fn archive_set_error(arg1: *mut Struct_archive, - _err: c_int, - fmt: *const c_char, - ...) - -> (); + pub fn archive_set_error(arg1: *mut Struct_archive, _err: c_int, fmt: *const c_char, ...) + -> (); pub fn archive_copy_error(dest: *mut Struct_archive, src: *mut Struct_archive) -> (); pub fn archive_file_count(arg1: *mut Struct_archive) -> c_int; pub fn archive_match_new() -> *mut Struct_archive; pub fn archive_match_free(arg1: *mut Struct_archive) -> c_int; - pub fn archive_match_excluded(arg1: *mut Struct_archive, - arg2: *mut Struct_archive_entry) - -> c_int; - pub fn archive_match_path_excluded(arg1: *mut Struct_archive, - arg2: *mut Struct_archive_entry) - -> c_int; + pub fn archive_match_excluded( + arg1: *mut Struct_archive, + arg2: *mut Struct_archive_entry, + ) -> c_int; + pub fn archive_match_path_excluded( + arg1: *mut Struct_archive, + arg2: *mut Struct_archive_entry, + ) -> c_int; pub fn archive_match_exclude_pattern(arg1: *mut Struct_archive, arg2: *const c_char) -> c_int; - pub fn archive_match_exclude_pattern_w(arg1: *mut Struct_archive, - arg2: *const wchar_t) - -> c_int; - pub fn archive_match_exclude_pattern_from_file(arg1: *mut Struct_archive, - arg2: *const c_char, - _nullSeparator: c_int) - -> c_int; - pub fn archive_match_exclude_pattern_from_file_w(arg1: *mut Struct_archive, - arg2: *const wchar_t, - _nullSeparator: c_int) - -> c_int; + pub fn archive_match_exclude_pattern_w( + arg1: *mut Struct_archive, + arg2: *const wchar_t, + ) -> c_int; + pub fn archive_match_exclude_pattern_from_file( + arg1: *mut Struct_archive, + arg2: *const c_char, + _nullSeparator: c_int, + ) -> c_int; + pub fn archive_match_exclude_pattern_from_file_w( + arg1: *mut Struct_archive, + arg2: *const wchar_t, + _nullSeparator: c_int, + ) -> c_int; pub fn archive_match_include_pattern(arg1: *mut Struct_archive, arg2: *const c_char) -> c_int; - pub fn archive_match_include_pattern_w(arg1: *mut Struct_archive, - arg2: *const wchar_t) - -> c_int; - pub fn archive_match_include_pattern_from_file(arg1: *mut Struct_archive, - arg2: *const c_char, - _nullSeparator: c_int) - -> c_int; - pub fn archive_match_include_pattern_from_file_w(arg1: *mut Struct_archive, - arg2: *const wchar_t, - _nullSeparator: c_int) - -> c_int; + pub fn archive_match_include_pattern_w( + arg1: *mut Struct_archive, + arg2: *const wchar_t, + ) -> c_int; + pub fn archive_match_include_pattern_from_file( + arg1: *mut Struct_archive, + arg2: *const c_char, + _nullSeparator: c_int, + ) -> c_int; + pub fn archive_match_include_pattern_from_file_w( + arg1: *mut Struct_archive, + arg2: *const wchar_t, + _nullSeparator: c_int, + ) -> c_int; pub fn archive_match_path_unmatched_inclusions(arg1: *mut Struct_archive) -> c_int; - pub fn archive_match_path_unmatched_inclusions_next(arg1: *mut Struct_archive, - arg2: *mut *const c_char) - -> c_int; - pub fn archive_match_path_unmatched_inclusions_next_w(arg1: *mut Struct_archive, - arg2: *mut *const wchar_t) - -> c_int; - pub fn archive_match_time_excluded(arg1: *mut Struct_archive, - arg2: *mut Struct_archive_entry) - -> c_int; - pub fn archive_match_include_time(arg1: *mut Struct_archive, - _flag: c_int, - _sec: time_t, - _nsec: c_long) - -> c_int; - pub fn archive_match_include_date(arg1: *mut Struct_archive, - _flag: c_int, - _datestr: *const c_char) - -> c_int; - pub fn archive_match_include_date_w(arg1: *mut Struct_archive, - _flag: c_int, - _datestr: *const wchar_t) - -> c_int; - pub fn archive_match_include_file_time(arg1: *mut Struct_archive, - _flag: c_int, - _pathname: *const c_char) - -> c_int; - pub fn archive_match_include_file_time_w(arg1: *mut Struct_archive, - _flag: c_int, - _pathname: *const wchar_t) - -> c_int; - pub fn archive_match_exclude_entry(arg1: *mut Struct_archive, - _flag: c_int, - arg2: *mut Struct_archive_entry) - -> c_int; - pub fn archive_match_owner_excluded(arg1: *mut Struct_archive, - arg2: *mut Struct_archive_entry) - -> c_int; + pub fn archive_match_path_unmatched_inclusions_next( + arg1: *mut Struct_archive, + arg2: *mut *const c_char, + ) -> c_int; + pub fn archive_match_path_unmatched_inclusions_next_w( + arg1: *mut Struct_archive, + arg2: *mut *const wchar_t, + ) -> c_int; + pub fn archive_match_time_excluded( + arg1: *mut Struct_archive, + arg2: *mut Struct_archive_entry, + ) -> c_int; + pub fn archive_match_include_time( + arg1: *mut Struct_archive, + _flag: c_int, + _sec: time_t, + _nsec: c_long, + ) -> c_int; + pub fn archive_match_include_date( + arg1: *mut Struct_archive, + _flag: c_int, + _datestr: *const c_char, + ) -> c_int; + pub fn archive_match_include_date_w( + arg1: *mut Struct_archive, + _flag: c_int, + _datestr: *const wchar_t, + ) -> c_int; + pub fn archive_match_include_file_time( + arg1: *mut Struct_archive, + _flag: c_int, + _pathname: *const c_char, + ) -> c_int; + pub fn archive_match_include_file_time_w( + arg1: *mut Struct_archive, + _flag: c_int, + _pathname: *const wchar_t, + ) -> c_int; + pub fn archive_match_exclude_entry( + arg1: *mut Struct_archive, + _flag: c_int, + arg2: *mut Struct_archive_entry, + ) -> c_int; + pub fn archive_match_owner_excluded( + arg1: *mut Struct_archive, + arg2: *mut Struct_archive_entry, + ) -> c_int; pub fn archive_match_include_uid(arg1: *mut Struct_archive, arg2: i64) -> c_int; pub fn archive_match_include_gid(arg1: *mut Struct_archive, arg2: i64) -> c_int; pub fn archive_match_include_uname(arg1: *mut Struct_archive, arg2: *const c_char) -> c_int; @@ -656,10 +647,11 @@ extern "C" { pub fn archive_entry_devmajor(arg1: *mut Struct_archive_entry) -> dev_t; pub fn archive_entry_devminor(arg1: *mut Struct_archive_entry) -> dev_t; pub fn archive_entry_filetype(arg1: *mut Struct_archive_entry) -> mode_t; - pub fn archive_entry_fflags(arg1: *mut Struct_archive_entry, - arg2: *mut c_ulong, - arg3: *mut c_ulong) - -> (); + pub fn archive_entry_fflags( + arg1: *mut Struct_archive_entry, + arg2: *mut c_ulong, + arg3: *mut c_ulong, + ) -> (); pub fn archive_entry_fflags_text(arg1: *mut Struct_archive_entry) -> *const c_char; pub fn archive_entry_gid(arg1: *mut Struct_archive_entry) -> i64; pub fn archive_entry_gname(arg1: *mut Struct_archive_entry) -> *const c_char; @@ -690,183 +682,213 @@ extern "C" { pub fn archive_entry_uid(arg1: *mut Struct_archive_entry) -> i64; pub fn archive_entry_uname(arg1: *mut Struct_archive_entry) -> *const c_char; pub fn archive_entry_uname_w(arg1: *mut Struct_archive_entry) -> *const wchar_t; - pub fn archive_entry_set_atime(arg1: *mut Struct_archive_entry, - arg2: time_t, - arg3: c_long) - -> (); + pub fn archive_entry_set_atime( + arg1: *mut Struct_archive_entry, + arg2: time_t, + arg3: c_long, + ) -> (); pub fn archive_entry_unset_atime(arg1: *mut Struct_archive_entry) -> (); - pub fn archive_entry_set_birthtime(arg1: *mut Struct_archive_entry, - arg2: time_t, - arg3: c_long) - -> (); + pub fn archive_entry_set_birthtime( + arg1: *mut Struct_archive_entry, + arg2: time_t, + arg3: c_long, + ) -> (); pub fn archive_entry_unset_birthtime(arg1: *mut Struct_archive_entry) -> (); - pub fn archive_entry_set_ctime(arg1: *mut Struct_archive_entry, - arg2: time_t, - arg3: c_long) - -> (); + pub fn archive_entry_set_ctime( + arg1: *mut Struct_archive_entry, + arg2: time_t, + arg3: c_long, + ) -> (); pub fn archive_entry_unset_ctime(arg1: *mut Struct_archive_entry) -> (); pub fn archive_entry_set_dev(arg1: *mut Struct_archive_entry, arg2: dev_t) -> (); pub fn archive_entry_set_devmajor(arg1: *mut Struct_archive_entry, arg2: dev_t) -> (); pub fn archive_entry_set_devminor(arg1: *mut Struct_archive_entry, arg2: dev_t) -> (); pub fn archive_entry_set_filetype(arg1: *mut Struct_archive_entry, arg2: c_uint) -> (); - pub fn archive_entry_set_fflags(arg1: *mut Struct_archive_entry, - arg2: c_ulong, - arg3: c_ulong) - -> (); - pub fn archive_entry_copy_fflags_text(arg1: *mut Struct_archive_entry, - arg2: *const c_char) - -> *const c_char; - pub fn archive_entry_copy_fflags_text_w(arg1: *mut Struct_archive_entry, - arg2: *const wchar_t) - -> *const wchar_t; + pub fn archive_entry_set_fflags( + arg1: *mut Struct_archive_entry, + arg2: c_ulong, + arg3: c_ulong, + ) -> (); + pub fn archive_entry_copy_fflags_text( + arg1: *mut Struct_archive_entry, + arg2: *const c_char, + ) -> *const c_char; + pub fn archive_entry_copy_fflags_text_w( + arg1: *mut Struct_archive_entry, + arg2: *const wchar_t, + ) -> *const wchar_t; pub fn archive_entry_set_gid(arg1: *mut Struct_archive_entry, arg2: i64) -> (); pub fn archive_entry_set_gname(arg1: *mut Struct_archive_entry, arg2: *const c_char) -> (); pub fn archive_entry_copy_gname(arg1: *mut Struct_archive_entry, arg2: *const c_char) -> (); pub fn archive_entry_copy_gname_w(arg1: *mut Struct_archive_entry, arg2: *const wchar_t) -> (); - pub fn archive_entry_update_gname_utf8(arg1: *mut Struct_archive_entry, - arg2: *const c_char) - -> c_int; + pub fn archive_entry_update_gname_utf8( + arg1: *mut Struct_archive_entry, + arg2: *const c_char, + ) -> c_int; pub fn archive_entry_set_hardlink(arg1: *mut Struct_archive_entry, arg2: *const c_char) -> (); pub fn archive_entry_copy_hardlink(arg1: *mut Struct_archive_entry, arg2: *const c_char) -> (); - pub fn archive_entry_copy_hardlink_w(arg1: *mut Struct_archive_entry, - arg2: *const wchar_t) - -> (); - pub fn archive_entry_update_hardlink_utf8(arg1: *mut Struct_archive_entry, - arg2: *const c_char) - -> c_int; + pub fn archive_entry_copy_hardlink_w( + arg1: *mut Struct_archive_entry, + arg2: *const wchar_t, + ) -> (); + pub fn archive_entry_update_hardlink_utf8( + arg1: *mut Struct_archive_entry, + arg2: *const c_char, + ) -> c_int; pub fn archive_entry_set_ino(arg1: *mut Struct_archive_entry, arg2: i64) -> (); pub fn archive_entry_set_ino64(arg1: *mut Struct_archive_entry, arg2: i64) -> (); pub fn archive_entry_set_link(arg1: *mut Struct_archive_entry, arg2: *const c_char) -> (); pub fn archive_entry_copy_link(arg1: *mut Struct_archive_entry, arg2: *const c_char) -> (); pub fn archive_entry_copy_link_w(arg1: *mut Struct_archive_entry, arg2: *const wchar_t) -> (); - pub fn archive_entry_update_link_utf8(arg1: *mut Struct_archive_entry, - arg2: *const c_char) - -> c_int; + pub fn archive_entry_update_link_utf8( + arg1: *mut Struct_archive_entry, + arg2: *const c_char, + ) -> c_int; pub fn archive_entry_set_mode(arg1: *mut Struct_archive_entry, arg2: mode_t) -> (); - pub fn archive_entry_set_mtime(arg1: *mut Struct_archive_entry, - arg2: time_t, - arg3: c_long) - -> (); + pub fn archive_entry_set_mtime( + arg1: *mut Struct_archive_entry, + arg2: time_t, + arg3: c_long, + ) -> (); pub fn archive_entry_unset_mtime(arg1: *mut Struct_archive_entry) -> (); pub fn archive_entry_set_nlink(arg1: *mut Struct_archive_entry, arg2: c_uint) -> (); pub fn archive_entry_set_pathname(arg1: *mut Struct_archive_entry, arg2: *const c_char) -> (); pub fn archive_entry_copy_pathname(arg1: *mut Struct_archive_entry, arg2: *const c_char) -> (); - pub fn archive_entry_copy_pathname_w(arg1: *mut Struct_archive_entry, - arg2: *const wchar_t) - -> (); - pub fn archive_entry_update_pathname_utf8(arg1: *mut Struct_archive_entry, - arg2: *const c_char) - -> c_int; + pub fn archive_entry_copy_pathname_w( + arg1: *mut Struct_archive_entry, + arg2: *const wchar_t, + ) -> (); + pub fn archive_entry_update_pathname_utf8( + arg1: *mut Struct_archive_entry, + arg2: *const c_char, + ) -> c_int; pub fn archive_entry_set_perm(arg1: *mut Struct_archive_entry, arg2: mode_t) -> (); pub fn archive_entry_set_rdev(arg1: *mut Struct_archive_entry, arg2: dev_t) -> (); pub fn archive_entry_set_rdevmajor(arg1: *mut Struct_archive_entry, arg2: dev_t) -> (); pub fn archive_entry_set_rdevminor(arg1: *mut Struct_archive_entry, arg2: dev_t) -> (); pub fn archive_entry_set_size(arg1: *mut Struct_archive_entry, arg2: i64) -> (); pub fn archive_entry_unset_size(arg1: *mut Struct_archive_entry) -> (); - pub fn archive_entry_copy_sourcepath(arg1: *mut Struct_archive_entry, - arg2: *const c_char) - -> (); - pub fn archive_entry_copy_sourcepath_w(arg1: *mut Struct_archive_entry, - arg2: *const wchar_t) - -> (); + pub fn archive_entry_copy_sourcepath( + arg1: *mut Struct_archive_entry, + arg2: *const c_char, + ) -> (); + pub fn archive_entry_copy_sourcepath_w( + arg1: *mut Struct_archive_entry, + arg2: *const wchar_t, + ) -> (); pub fn archive_entry_set_symlink(arg1: *mut Struct_archive_entry, arg2: *const c_char) -> (); pub fn archive_entry_copy_symlink(arg1: *mut Struct_archive_entry, arg2: *const c_char) -> (); - pub fn archive_entry_copy_symlink_w(arg1: *mut Struct_archive_entry, - arg2: *const wchar_t) - -> (); - pub fn archive_entry_update_symlink_utf8(arg1: *mut Struct_archive_entry, - arg2: *const c_char) - -> c_int; + pub fn archive_entry_copy_symlink_w( + arg1: *mut Struct_archive_entry, + arg2: *const wchar_t, + ) -> (); + pub fn archive_entry_update_symlink_utf8( + arg1: *mut Struct_archive_entry, + arg2: *const c_char, + ) -> c_int; pub fn archive_entry_set_uid(arg1: *mut Struct_archive_entry, arg2: i64) -> (); pub fn archive_entry_set_uname(arg1: *mut Struct_archive_entry, arg2: *const c_char) -> (); pub fn archive_entry_copy_uname(arg1: *mut Struct_archive_entry, arg2: *const c_char) -> (); pub fn archive_entry_copy_uname_w(arg1: *mut Struct_archive_entry, arg2: *const wchar_t) -> (); - pub fn archive_entry_update_uname_utf8(arg1: *mut Struct_archive_entry, - arg2: *const c_char) - -> c_int; + pub fn archive_entry_update_uname_utf8( + arg1: *mut Struct_archive_entry, + arg2: *const c_char, + ) -> c_int; // pub fn archive_entry_stat(arg1: *mut Struct_archive_entry) -> *const Struct_stat; // pub fn archive_entry_copy_stat(arg1: *mut Struct_archive_entry, // arg2: *const Struct_stat) // -> (); - pub fn archive_entry_mac_metadata(arg1: *mut Struct_archive_entry, - arg2: *mut size_t) - -> *const c_void; - pub fn archive_entry_copy_mac_metadata(arg1: *mut Struct_archive_entry, - arg2: *const c_void, - arg3: size_t) - -> (); + pub fn archive_entry_mac_metadata( + arg1: *mut Struct_archive_entry, + arg2: *mut size_t, + ) -> *const c_void; + pub fn archive_entry_copy_mac_metadata( + arg1: *mut Struct_archive_entry, + arg2: *const c_void, + arg3: size_t, + ) -> (); pub fn archive_entry_acl_clear(arg1: *mut Struct_archive_entry) -> (); - pub fn archive_entry_acl_add_entry(arg1: *mut Struct_archive_entry, - arg2: c_int, - arg3: c_int, - arg4: c_int, - arg5: c_int, - arg6: *const c_char) - -> c_int; - pub fn archive_entry_acl_add_entry_w(arg1: *mut Struct_archive_entry, - arg2: c_int, - arg3: c_int, - arg4: c_int, - arg5: c_int, - arg6: *const wchar_t) - -> c_int; + pub fn archive_entry_acl_add_entry( + arg1: *mut Struct_archive_entry, + arg2: c_int, + arg3: c_int, + arg4: c_int, + arg5: c_int, + arg6: *const c_char, + ) -> c_int; + pub fn archive_entry_acl_add_entry_w( + arg1: *mut Struct_archive_entry, + arg2: c_int, + arg3: c_int, + arg4: c_int, + arg5: c_int, + arg6: *const wchar_t, + ) -> c_int; pub fn archive_entry_acl_reset(arg1: *mut Struct_archive_entry, arg2: c_int) -> c_int; - pub fn archive_entry_acl_next(arg1: *mut Struct_archive_entry, - arg2: c_int, - arg3: *mut c_int, - arg4: *mut c_int, - arg5: *mut c_int, - arg6: *mut c_int, - arg7: *mut *const c_char) - -> c_int; - pub fn archive_entry_acl_next_w(arg1: *mut Struct_archive_entry, - arg2: c_int, - arg3: *mut c_int, - arg4: *mut c_int, - arg5: *mut c_int, - arg6: *mut c_int, - arg7: *mut *const wchar_t) - -> c_int; - pub fn archive_entry_acl_text_w(arg1: *mut Struct_archive_entry, - arg2: c_int) - -> *const wchar_t; + pub fn archive_entry_acl_next( + arg1: *mut Struct_archive_entry, + arg2: c_int, + arg3: *mut c_int, + arg4: *mut c_int, + arg5: *mut c_int, + arg6: *mut c_int, + arg7: *mut *const c_char, + ) -> c_int; + pub fn archive_entry_acl_next_w( + arg1: *mut Struct_archive_entry, + arg2: c_int, + arg3: *mut c_int, + arg4: *mut c_int, + arg5: *mut c_int, + arg6: *mut c_int, + arg7: *mut *const wchar_t, + ) -> c_int; + pub fn archive_entry_acl_text_w(arg1: *mut Struct_archive_entry, arg2: c_int) + -> *const wchar_t; pub fn archive_entry_acl_text(arg1: *mut Struct_archive_entry, arg2: c_int) -> *const c_char; pub fn archive_entry_acl_count(arg1: *mut Struct_archive_entry, arg2: c_int) -> c_int; pub fn archive_entry_acl(arg1: *mut Struct_archive_entry) -> *mut Struct_archive_acl; pub fn archive_entry_xattr_clear(arg1: *mut Struct_archive_entry) -> (); - pub fn archive_entry_xattr_add_entry(arg1: *mut Struct_archive_entry, - arg2: *const c_char, - arg3: *const c_void, - arg4: size_t) - -> (); + pub fn archive_entry_xattr_add_entry( + arg1: *mut Struct_archive_entry, + arg2: *const c_char, + arg3: *const c_void, + arg4: size_t, + ) -> (); pub fn archive_entry_xattr_count(arg1: *mut Struct_archive_entry) -> c_int; pub fn archive_entry_xattr_reset(arg1: *mut Struct_archive_entry) -> c_int; - pub fn archive_entry_xattr_next(arg1: *mut Struct_archive_entry, - arg2: *mut *const c_char, - arg3: *mut *const c_void, - arg4: *mut size_t) - -> c_int; + pub fn archive_entry_xattr_next( + arg1: *mut Struct_archive_entry, + arg2: *mut *const c_char, + arg3: *mut *const c_void, + arg4: *mut size_t, + ) -> c_int; pub fn archive_entry_sparse_clear(arg1: *mut Struct_archive_entry) -> (); - pub fn archive_entry_sparse_add_entry(arg1: *mut Struct_archive_entry, - arg2: i64, - arg3: i64) - -> (); + pub fn archive_entry_sparse_add_entry( + arg1: *mut Struct_archive_entry, + arg2: i64, + arg3: i64, + ) -> (); pub fn archive_entry_sparse_count(arg1: *mut Struct_archive_entry) -> c_int; pub fn archive_entry_sparse_reset(arg1: *mut Struct_archive_entry) -> c_int; - pub fn archive_entry_sparse_next(arg1: *mut Struct_archive_entry, - arg2: *mut i64, - arg3: *mut i64) - -> c_int; + pub fn archive_entry_sparse_next( + arg1: *mut Struct_archive_entry, + arg2: *mut i64, + arg3: *mut i64, + ) -> c_int; pub fn archive_entry_linkresolver_new() -> *mut Struct_archive_entry_linkresolver; - pub fn archive_entry_linkresolver_set_strategy(arg1: *mut Struct_archive_entry_linkresolver, - arg2: c_int) - -> (); + pub fn archive_entry_linkresolver_set_strategy( + arg1: *mut Struct_archive_entry_linkresolver, + arg2: c_int, + ) -> (); pub fn archive_entry_linkresolver_free(arg1: *mut Struct_archive_entry_linkresolver) -> (); - pub fn archive_entry_linkify(arg1: *mut Struct_archive_entry_linkresolver, - arg2: *mut *mut Struct_archive_entry, - arg3: *mut *mut Struct_archive_entry) - -> (); - pub fn archive_entry_partial_links(res: *mut Struct_archive_entry_linkresolver, - links: *mut c_uint) - -> *mut Struct_archive_entry; + pub fn archive_entry_linkify( + arg1: *mut Struct_archive_entry_linkresolver, + arg2: *mut *mut Struct_archive_entry, + arg3: *mut *mut Struct_archive_entry, + ) -> (); + pub fn archive_entry_partial_links( + res: *mut Struct_archive_entry_linkresolver, + links: *mut c_uint, + ) -> *mut Struct_archive_entry; } diff --git a/server/src/main.rs b/server/src/main.rs index 1930d12..8924272 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -1,10 +1,10 @@ mod repo; +use axum::extract::FromRef; use axum::Router; use repo::RepoGroupManager; use std::path::PathBuf; -use std::sync::{RwLock, Arc}; -use axum::extract::FromRef; +use std::sync::{Arc, RwLock}; #[derive(Clone)] pub struct Config {