urn a reference to a list of alpm_backup_t objects"]
    pub fn alpm_pkg_get_backup(pkg: *mut alpm_pkg_t) -> *mut alpm_list_t;
}
extern "C" {
    #[doc = " Returns the database containing pkg.\n Returns a pointer to the alpm_db_t structure the package is\n originating from, or NULL if the package was loaded from a file.\n @param pkg a pointer to package\n @return a pointer to the DB containing pkg, or NULL."]
    pub fn alpm_pkg_get_db(pkg: *mut alpm_pkg_t) -> *mut alpm_db_t;
}
extern "C" {
    #[doc = " Returns the base64 encoded package signature.\n @param pkg a pointer to package\n @return a reference to an internal string"]
    pub fn alpm_pkg_get_base64_sig(pkg: *mut alpm_pkg_t) -> *const ::std::os::raw::c_char;
}
extern "C" {
    #[doc = " Extracts package signature either from embedded package signature\n or if it is absent then reads data from detached signature file.\n @param pkg a pointer to package.\n @param sig output parameter for signature data. Callee function allocates\n a buffer needed for the signature data. Caller is responsible for\n freeing this buffer.\n @param sig_len output parameter for the signature data length.\n @return 0 on success, negative number on error."]
    pub fn alpm_pkg_get_sig(
        pkg: *mut alpm_pkg_t,
        sig: *mut *mut ::std::os::raw::c_uchar,
        sig_len: *mut usize,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    #[doc = " Returns the method used to validate a package during install.\n @param pkg a pointer to package\n @return an enum member giving the validation method"]
    pub fn alpm_pkg_get_validation(pkg: *mut alpm_pkg_t) -> ::std::os::raw::c_int;
}
extern "C" {
    #[doc = " Gets the extended data field of a package.\n @param pkg a pointer to package\n @return a reference to a list of alpm_pkg_xdata_t objects"]
    pub fn alpm_pkg_get_xdata(pkg: *mut alpm_pkg_t) -> *mut alpm_list_t;
}
extern "C" {
    #[doc = " Returns whether the package has an install scriptlet.\n @return 0 if FALSE, TRUE otherwise"]
    pub fn alpm_pkg_has_scriptlet(pkg: *mut alpm_pkg_t) -> ::std::os::raw::c_int;
}
extern "C" {
    #[doc = " Returns the size of the files that will be downloaded to install a\n package.\n @param newpkg the new package to upgrade to\n @return the size of the download"]
    pub fn alpm_pkg_download_size(newpkg: *mut alpm_pkg_t) -> off_t;
}
extern "C" {
    #[doc = " Set install reason for a package in the local database.\n The provided package object must be from the local database or this method\n will fail. The write to the local database is performed immediately.\n @param pkg the package to update\n @param reason the new install reason\n @return 0 on success, -1 on error (pm_errno is set accordingly)"]
    pub fn alpm_pkg_set_reason(
        pkg: *mut alpm_pkg_t,
        reason: alpm_pkgreason_t,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    #[doc = " Open a package changelog for reading.\n Similar to fopen in functionality, except that the returned 'file\n stream' could really be from an archive as well as from the database.\n @param pkg the package to read the changelog of (either file or db)\n @return a 'file stream' to the package changelog"]
    pub fn alpm_pkg_changelog_open(pkg: *mut alpm_pkg_t) -> *mut ::std::os::raw::c_void;
}
extern "C" {
    #[doc = " Read data from an open changelog 'file stream'.\n Similar to fread in functionality, this function takes a buffer and\n amount of data to read. If an error occurs pm_errno will be set.\n @param ptr a buffer to fill with raw changelog data\n @param size the size of the buffer\n @param pkg the package that the changelog is being read from\n @param fp a 'file stream' to the package changelog\n @return the number of characters read, or 0 if there is no more data or an\n error occurred."]
    pub fn alpm_pkg_changelog_read(
        ptr: *mut ::std::os::raw::c_void,
        size: usize,
        pkg: *const alpm_pkg_t,
        fp: *mut ::std::os::raw::c_void,
    ) -> usize;
}
extern "C" {
    #[doc = " Close a package changelog for reading.\n @param pkg the package to close the changelog of (either file or db)\n @param fp the 'file stream' to the package changelog to close\n @return 0 on success, -1 on error"]
    pub fn alpm_pkg_changelog_close(
        pkg: *const alpm_pkg_t,
        fp: *mut ::std::os::raw::c_void,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    #[doc = " Open a package mtree file for reading.\n @param pkg the local package to read the mtree of\n @return an archive structure for the package mtree file"]
    pub fn alpm_pkg_mtree_open(pkg: *mut alpm_pkg_t) -> *mut archive;
}
extern "C" {
    #[doc = " Read next entry from a package mtree file.\n @param pkg the package that the mtree file is being read from\n @param archive the archive structure reading from the mtree file\n @param entry an archive_entry to store the entry header information\n @return 0 on success, 1 if end of archive is reached, -1 otherwise."]
    pub fn alpm_pkg_mtree_next(
        pkg: *const alpm_pkg_t,
        archive: *mut archive,
        entry: *mut *mut archive_entry,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    #[doc = " Close a package mtree file.\n @param pkg the local package to close the mtree of\n @param archive the archive to close"]
    pub fn alpm_pkg_mtree_close(
        pkg: *const alpm_pkg_t,
        archive: *mut archive,
    ) -> ::std::os::raw::c_int;
}
pub mod _alpm_transflag_t {
    #[doc = " Transaction flags"]
    pub type Type = ::std::os::raw::c_uint;
    #[doc = " Ignore dependency checks."]
    pub const ALPM_TRANS_FLAG_NODEPS: Type = 1;
    #[doc = " Delete files even if they are tagged as backup."]
    pub const ALPM_TRANS_FLAG_NOSAVE: Type = 4;
    #[doc = " Ignore version numbers when checking dependencies."]
    pub const ALPM_TRANS_FLAG_NODEPVERSION: Type = 8;
    #[doc = " Remove also any packages depending on a package being removed."]
    pub const ALPM_TRANS_FLAG_CASCADE: Type = 16;
    #[doc = " Remove packages and their unneeded deps (not explicitly installed)."]
    pub const ALPM_TRANS_FLAG_RECURSE: Type = 32;
    #[doc = " Modify database but do not commit changes to the filesystem."]
    pub const ALPM_TRANS_FLAG_DBONLY: Type = 64;
    #[doc = " Do not run hooks during a transaction"]
    pub const ALPM_TRANS_FLAG_NOHOOKS: Type = 128;
    #[doc = " Use ALPM_PKG_REASON_DEPEND when installing packages."]
    pub const ALPM_TRANS_FLAG_ALLDEPS: Type = 256;
    #[doc = " Only download packages and do not actually install."]
    pub const ALPM_TRANS_FLAG_DOWNLOADONLY: Type = 512;
    #[doc = " Do not execute install scriptlets after installing."]
    pub const ALPM_TRANS_FLAG_NOSCRIPTLET: Type = 1024;
    #[doc = " Ignore dependency conflicts."]
    pub const ALPM_TRANS_FLAG_NOCONFLICTS: Type = 2048;
    #[doc = " Do not install a package if it is already installed and up to date."]
    pub const ALPM_TRANS_FLAG_NEEDED: Type = 8192;
    #[doc = " Use ALPM_PKG_REASON_EXPLICIT when installing packages."]
    pub const ALPM_TRANS_FLAG_ALLEXPLICIT: Type = 16384;
    #[doc = " Do not remove a package if it is needed by another one."]
    pub const ALPM_TRANS_FLAG_UNNEEDED: Type = 32768;
    #[doc = " Remove also explicitly installed unneeded deps (use with ALPM_TRANS_FLAG_RECURSE)."]
    pub const ALPM_TRANS_FLAG_RECURSEALL: Type = 65536;
    #[doc = " Do not lock the database during the operation."]
    pub const ALPM_TRANS_FLAG_NOLOCK: Type = 131072;
}
#[doc = " Transaction flags"]
pub use self::_alpm_transflag_t::Type as alpm_transflag_t;
extern "C" {
    #[doc = " Returns the bitfield of flags for the current transaction.\n @param handle the context handle\n @return the bitfield of transaction flags"]
    pub fn alpm_trans_get_flags(handle: *mut alpm_handle_t) -> ::std::os::raw::c_int;
}
extern "C" {
    #[doc = " Returns a list of packages added by the transaction.\n @param handle the context handle\n @return a list of alpm_pkg_t structures"]
    pub fn alpm_trans_get_add(handle: *mut alpm_handle_t) -> *mut alpm_list_t;
}
extern "C" {
    #[doc = " Returns the list of packages removed by the transaction.\n @param handle the context handle\n @return a list of alpm_pkg_t structures"]
    pub fn alpm_trans_get_remove(handle: *mut alpm_handle_t) -> *mut alpm_list_t;
}
extern "C" {
    #[doc = " Initialize the transaction.\n @param handle the context handle\n @param flags flags of the transaction (like nodeps, etc; see alpm_transflag_t)\n @return 0 on success, -1 on error (pm_errno is set accordingly)"]
    pub fn alpm_trans_init(
        handle: *mut alpm_handle_t,
        flags: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    #[doc = " Prepare a transaction.\n @param handle the context handle\n @param data the address of an alpm_list where a list\n of alpm_depmissing_t objects is dumped (conflicting packages)\n @return 0 on success, -1 on error (pm_errno is set accordingly)"]
    pub fn alpm_trans_prepare(
        handle: *mut alpm_handle_t,
        data: *mut *mut alpm_list_t,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    #[doc = " Commit a transaction.\n @param handle the context handle\n @param data the address of an alpm_list where detailed description\n of an error can be dumped (i.e. list of conflicting files)\n @return 0 on success, -1 on error (pm_errno is set accordingly)"]
    pub fn alpm_trans_commit(
        handle: *mut alpm_handle_t,
        data: *mut *mut alpm_list_t,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    #[doc = " Interrupt a transaction.\n @param handle the context handle\n @return 0 on success, -1 on error (pm_errno is set accordingly)"]
    pub fn alpm_trans_interrupt(handle: *mut alpm_handle_t) -> ::std::os::raw::c_int;
}
extern "C" {
    #[doc = " Release a transaction.\n @param handle the context handle\n @return 0 on success, -1 on error (pm_errno is set accordingly)"]
    pub fn alpm_trans_release(handle: *mut alpm_handle_t) -> ::std::os::raw::c_int;
}
extern "C" {
    #[doc = " Search for packages to upgrade and add them to the transaction.\n @param handle the context handle\n @param enable_downgrade allow downgrading of packages if the remote version is lower\n @return 0 on success, -1 on error (pm_errno is set accordingly)"]
    pub fn alpm_sync_sysupgrade(
        handle: *mut alpm_handle_t,
        enable_downgrade: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    #[doc = " Add a package to the transaction.\n If the package was loaded by alpm_pkg_load(), it will be freed upon\n \\link alpm_trans_release \\endlink invocation.\n @param handle the context handle\n @param pkg the package to add\n @return 0 on success, -1 on error (pm_errno is set accordingly)"]
    pub fn alpm_add_pkg(handle: *mut alpm_handle_t, pkg: *mut alpm_pkg_t) -> ::std::os::raw::c_int;
}
extern "C" {
    #[doc = " Add a package removal to the transaction.\n @param handle the context handle\n @param pkg the package to uninstall\n @return 0 on success, -1 on error (pm_errno is set accordingly)"]
    pub fn alpm_remove_pkg(
        handle: *mut alpm_handle_t,
        pkg: *mut alpm_pkg_t,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    #[doc = " Check for new version of pkg in syncdbs.\n\n If the same package appears multiple dbs only the first will be checked\n\n This only checks the syncdb for a newer version. It does not access the network at all.\n See \\link alpm_db_update \\endlink to update a database."]
    pub fn alpm_sync_get_new_version(
        pkg: *mut alpm_pkg_t,
        dbs_sync: *mut alpm_list_t,
    ) -> *mut alpm_pkg_t;
}
extern "C" {
    #[doc = " Get the md5 sum of file.\n @param filename name of the file\n @return the checksum on success, NULL on error"]
    pub fn alpm_compute_md5sum(
        filename: *const ::std::os::raw::c_char,
    ) -> *mut ::std::os::raw::c_char;
}
extern "C" {
    #[doc = " Get the sha256 sum of file.\n @param filename name of the file\n @return the checksum on success, NULL on error"]
    pub fn alpm_compute_sha256sum(
        filename: *const ::std::os::raw::c_char,
    ) -> *mut ::std::os::raw::c_char;
}
extern "C" {
    #[doc = " Remove the database lock file\n @param handle the context handle\n @return 0 on success, -1 on error\n\n @note Safe to call from inside signal handlers."]
    pub fn alpm_unlock(handle: *mut alpm_handle_t) -> ::std::os::raw::c_int;
}
pub mod alpm_caps {
    #[doc = " Enum of possible compile time features"]
    pub type Type = ::std::os::raw::c_uint;
    #[doc = " localization"]
    pub const ALPM_CAPABILITY_NLS: Type = 1;
    #[doc = " Ability to download"]
    pub const ALPM_CAPABILITY_DOWNLOADER: Type = 2;
    #[doc = " Signature checking"]
    pub const ALPM_CAPABILITY_SIGNATURES: Type = 4;
}
extern "C" {
    #[doc = " Get the version of library.\n @return the library version, e.g. \"6.0.4\""]
    pub fn alpm_version() -> *const ::std::os::raw::c_char;
}
extern "C" {
    #[doc = " Get the capabilities of the library.\n @return a bitmask of the capabilities"]
    pub fn alpm_capabilities() -> ::std::os::raw::c_int;
}
extern "C" {
    #[doc = " Drop privileges by switching to a different user.\n @param handle the context handle\n @param sandboxuser the user to switch to\n @param sandbox_path if non-NULL, restrict writes to this filesystem path\n @param restrict_syscalls whether to deny access to a list of dangerous syscalls\n @return 0 on success, -1 on failure"]
    pub fn alpm_sandbox_setup_child(
        handle: *mut alpm_handle_t,
        sandboxuser: *const ::std::os::raw::c_char,
        sandbox_path: *const ::std::os::raw::c_char,
        restrict_syscalls: bool,
    ) -> ::std::os::raw::c_int;
}
pub type __builtin_va_list = [__va_list_tag; 1usize];
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct __va_list_tag {
    pub gp_offset: ::std::os::raw::c_uint,
    pub fp_offset: ::std::os::raw::c_uint,
    pub overflow_arg_area: *mut ::std::os::raw::c_void,
    pub reg_save_area: *mut ::std::os::raw::c_void,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of __va_list_tag"][::std::mem::size_of::<__va_list_tag>() - 24usize];
    ["Alignment of __va_list_tag"][::std::mem::align_of::<__va_list_tag>() - 8usize];
    ["Offset of field: __va_list_tag::gp_offset"]
        [::std::mem::offset_of!(__va_list_tag, gp_offset) - 0usize];
    ["Offset of field: __va_list_tag::fp_offset"]
        [::std::mem::offset_of!(__va_list_tag, fp_offset) - 4usize];
    ["Offset of field: __va_list_tag::overflow_arg_area"]
        [::std::mem::offset_of!(__va_list_tag, overflow_arg_area) - 8usize];
    ["Offset of field: __va_list_tag::reg_save_area"]
        [::std::mem::offset_of!(__va_list_tag, reg_save_area) - 16usize];
};
