ohos-rawfile-sys 0.1.3

Raw Bindings to the rawfile API of OpenHarmony
Documentation
// automatically generated by rust-bindgen 0.71.1

#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#[cfg(doc)]
use crate::raw_file_manager::OH_ResourceManager_OpenRawFile64;
#[cfg(doc)]
use crate::raw_file_manager::{OH_ResourceManager_OpenRawDir, OH_ResourceManager_OpenRawFile};
use crate::raw_file_types_ffi::*;

extern "C" {
    /// Reads a raw file.
    ///
    /// This function attempts to read data of <b>length</b> bytes from the current offset.
    ///
    /// # Arguments
    ///
    /// * `rawFile` - Indicates the pointer to [`RawFile`].
    ///
    /// * `buf` - Indicates the pointer to the buffer for receiving the data read.
    ///
    /// * `length` - Indicates the number of bytes to read.
    ///
    /// # Returns
    ///
    /// * Returns the number of bytes read if any;
    /// if the number reaches the end of file (EOF) or rawFile is nullptr also returns <b>0</b>
    ///
    /// Available since API-level: 8
    ///
    /// Version: 1.0
    pub fn OH_ResourceManager_ReadRawFile(
        rawFile: *const RawFile,
        buf: *mut ::core::ffi::c_void,
        length: usize,
    ) -> ::core::ffi::c_int;
    /// Uses the 32-bit data type to seek a data read position based on the specified offset within a raw file.
    ///
    /// # Arguments
    ///
    /// * `rawFile` - Indicates the pointer to [`RawFile`].
    ///
    /// * `offset` - Indicates the specified offset.
    ///
    /// * `whence` - Indicates the new read position, which can be one of the following values:
    ///
    /// <b>0</b>: The new read position is set to <b>offset</b>.
    ///
    /// <b>1</b>: The read position is set to the current position plus <b>offset</b>.
    ///
    /// <b>2</b>: The read position is set to the end of file (EOF) plus <b>offset</b>.
    ///
    /// # Returns
    ///
    /// * Returns <b>(int) 0</b> if the operation is successful; returns <b>(int) -1</b> if an error
    /// occurs.
    ///
    /// Available since API-level: 8
    ///
    /// Version: 1.0
    pub fn OH_ResourceManager_SeekRawFile(
        rawFile: *const RawFile,
        offset: ::core::ffi::c_long,
        whence: ::core::ffi::c_int,
    ) -> ::core::ffi::c_int;
    /// Obtains the raw file length represented by an long.
    ///
    /// # Arguments
    ///
    /// * `rawFile` - Indicates the pointer to [`RawFile`].
    ///
    /// # Returns
    ///
    /// * Returns the total length of the raw file. If rawFile is nullptr also returns 0.
    ///
    /// Available since API-level: 8
    ///
    /// Version: 1.0
    pub fn OH_ResourceManager_GetRawFileSize(rawFile: *mut RawFile) -> ::core::ffi::c_long;
    /// Obtains the remaining raw file length represented by an long.
    ///
    /// # Arguments
    ///
    /// * `rawFile` - Indicates the pointer to [`RawFile`].
    ///
    /// # Returns
    ///
    /// * Returns the remaining length of the raw file. If rawFile is nullptr also returns 0.
    ///
    /// Available since API-level: 11
    ///
    /// Version: 1.0
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_ResourceManager_GetRawFileRemainingLength(
        rawFile: *const RawFile,
    ) -> ::core::ffi::c_long;
    /// Closes an opened [`RawFile`] and releases all associated resources.
    ///
    ///
    ///
    /// # Arguments
    ///
    /// * `rawFile` - Indicates the pointer to [`RawFile`].
    /// [`OH_ResourceManager_OpenRawFile`]
    /// Available since API-level: 8
    ///
    /// Version: 1.0
    pub fn OH_ResourceManager_CloseRawFile(rawFile: *mut RawFile);
    /// Obtains the current offset of a raw file, represented by an long.
    ///
    /// The current offset of a raw file.
    ///
    /// # Arguments
    ///
    /// * `rawFile` - Indicates the pointer to [`RawFile`].
    ///
    /// # Returns
    ///
    /// * Returns the current offset of a raw file. If rawFile is nullptr also returns 0.
    ///
    /// Available since API-level: 8
    ///
    /// Version: 1.0
    pub fn OH_ResourceManager_GetRawFileOffset(rawFile: *const RawFile) -> ::core::ffi::c_long;
    /// Opens the file descriptor of a raw file based on the long offset and file length.
    ///
    /// The opened raw file descriptor is used to read the raw file.
    ///
    /// # Arguments
    ///
    /// * `rawFile` - Indicates the pointer to [`RawFile`].
    ///
    /// * `descriptor` - Indicates the raw file's file descriptor, start position and the length in the HAP.
    ///
    /// # Returns
    ///
    /// * Returns true: open the raw file descriptor successfully, false: the raw file is not allowed to access.
    ///
    /// Available since API-level: 8
    ///
    /// Version: 1.0
    ///
    /// **Deprecated** since 12
    /// OH_ResourceManager_GetRawFileDescriptorData
    #[deprecated(since = "12")]
    pub fn OH_ResourceManager_GetRawFileDescriptor(
        rawFile: *const RawFile,
        descriptor: *mut RawFileDescriptor,
    ) -> bool;
    /// Obtains the file descriptor of a raw file based on the long offset and file length.
    ///
    /// The obtains raw file descriptor is used to read the raw file.
    ///
    /// # Arguments
    ///
    /// * `rawFile` - Indicates the pointer to [`RawFile`].
    ///
    /// * `descriptor` - Indicates the raw file's file descriptor, start position and the length in the HAP.
    ///
    /// # Returns
    ///
    /// * Returns true: obtains the raw file descriptor successfully, false: the raw file is not allowed to access.
    ///
    /// Available since API-level: 12
    ///
    /// Version: 1.0
    #[cfg(feature = "api-12")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
    pub fn OH_ResourceManager_GetRawFileDescriptorData(
        rawFile: *const RawFile,
        descriptor: *mut RawFileDescriptor,
    ) -> bool;
    /// Closes the file descriptor of a raw file.
    ///
    /// The opened raw file descriptor must be released after used to avoid the file descriptor leak.
    ///
    /// # Arguments
    ///
    /// * `descriptor` - Indicates the raw file's file descriptor, start position and the length in the HAP.
    ///
    /// # Returns
    ///
    /// * Returns true: closes the raw file descriptor successfully, false: closes the raw file descriptor failed.
    ///
    /// Available since API-level: 8
    ///
    /// Version: 1.0
    ///
    /// **Deprecated** since 12
    /// OH_ResourceManager_ReleaseRawFileDescriptorData
    #[deprecated(since = "12")]
    pub fn OH_ResourceManager_ReleaseRawFileDescriptor(
        descriptor: *const RawFileDescriptor,
    ) -> bool;
    /// Release the file descriptor of a raw file.
    ///
    /// The opened raw file descriptor must be released after used to avoid the file descriptor leak.
    ///
    /// # Arguments
    ///
    /// * `descriptor` - Indicates the raw file's file descriptor, start position and the length in the HAP.
    ///
    /// # Returns
    ///
    /// * Returns true: release the raw file descriptor successfully, false: release the raw file descriptor failed.
    ///
    /// Available since API-level: 12
    ///
    /// Version: 1.0
    #[cfg(feature = "api-12")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
    pub fn OH_ResourceManager_ReleaseRawFileDescriptorData(
        descriptor: *const RawFileDescriptor,
    ) -> bool;
    /// Reads a raw file.
    ///
    /// This function attempts to read data of <b>length</b> bytes from the current offset. using a 64-bit
    ///
    /// # Arguments
    ///
    /// * `rawFile` - Indicates the pointer to [`RawFile64`].
    ///
    /// * `buf` - Indicates the pointer to the buffer for receiving the data read.
    ///
    /// * `length` - Indicates the number of bytes to read.
    ///
    /// # Returns
    ///
    /// * Returns the number of bytes read if any;
    /// returns <b>0</b> if the number reaches the end of file (EOF). or rawFile is nullptr also returns 0
    ///
    /// Available since API-level: 11
    ///
    /// Version: 1.0
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_ResourceManager_ReadRawFile64(
        rawFile: *const RawFile64,
        buf: *mut ::core::ffi::c_void,
        length: i64,
    ) -> i64;
    /// Uses the 64-bit data type to seek a data read position based on the specified offset within a raw file.
    ///
    /// # Arguments
    ///
    /// * `rawFile` - Indicates the pointer to [`RawFile64`].
    ///
    /// * `offset` - Indicates the specified offset.
    ///
    /// * `whence` - Indicates the new read position, which can be one of the following values:
    ///
    /// <b>0</b>: The new read position is set to <b>offset</b>.
    ///
    /// <b>1</b>: The read position is set to the current position plus <b>offset</b>.
    ///
    /// <b>2</b>: The read position is set to the end of file (EOF) plus <b>offset</b>.
    ///
    /// # Returns
    ///
    /// * Returns <b>(int) 0</b> if the operation is successful; returns <b>(int) -1</b> if an error
    /// occurs.
    ///
    /// Available since API-level: 11
    ///
    /// Version: 1.0
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_ResourceManager_SeekRawFile64(
        rawFile: *const RawFile64,
        offset: i64,
        whence: ::core::ffi::c_int,
    ) -> ::core::ffi::c_int;
    /// Obtains the raw file length represented by an int64_t.
    ///
    /// # Arguments
    ///
    /// * `rawFile` - Indicates the pointer to [`RawFile64`].
    ///
    /// # Returns
    ///
    /// * Returns the total length of the raw file. If rawFile is nullptr also returns 0.
    ///
    /// Available since API-level: 11
    ///
    /// Version: 1.0
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_ResourceManager_GetRawFileSize64(rawFile: *mut RawFile64) -> i64;
    /// Obtains the remaining raw file length represented by an int64_t.
    ///
    /// # Arguments
    ///
    /// * `rawFile` - Indicates the pointer to [`RawFile64`].
    ///
    /// # Returns
    ///
    /// * Returns the remaining length of the raw file. If rawFile is nullptr also returns 0.
    ///
    /// Available since API-level: 11
    ///
    /// Version: 1.0
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_ResourceManager_GetRawFileRemainingLength64(rawFile: *const RawFile64) -> i64;
    /// Closes an opened [`RawFile64`] and releases all associated resources.
    ///
    ///
    ///
    /// # Arguments
    ///
    /// * `rawFile` - Indicates the pointer to [`RawFile64`].
    /// [`OH_ResourceManager_OpenRawFile64`]
    /// Available since API-level: 11
    ///
    /// Version: 1.0
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_ResourceManager_CloseRawFile64(rawFile: *mut RawFile64);
    /// Obtains the current offset of a raw file, represented by an int64_t.
    ///
    /// The current offset of a raw file.
    ///
    /// # Arguments
    ///
    /// * `rawFile` - Indicates the pointer to [`RawFile64`].
    ///
    /// # Returns
    ///
    /// * Returns the current offset of a raw file. If rawFile is nullptr also returns 0.
    ///
    /// Available since API-level: 11
    ///
    /// Version: 1.0
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_ResourceManager_GetRawFileOffset64(rawFile: *const RawFile64) -> i64;
    /// Opens the file descriptor of a raw file based on the int64_t offset and file length.
    ///
    /// The opened raw file descriptor is used to read the raw file.
    ///
    /// # Arguments
    ///
    /// * `rawFile` - Indicates the pointer to [`RawFile64`].
    ///
    /// * `descriptor` - Indicates the raw file's file descriptor, start position and the length in the HAP.
    ///
    /// # Returns
    ///
    /// * Returns true: open the raw file descriptor successfully, false: the raw file is not allowed to access.
    ///
    /// Available since API-level: 11
    ///
    /// Version: 1.0
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_ResourceManager_GetRawFileDescriptor64(
        rawFile: *const RawFile64,
        descriptor: *mut RawFileDescriptor64,
    ) -> bool;
    /// Closes the file descriptor of a raw file.
    ///
    /// The opened raw file descriptor must be released after used to avoid the file descriptor leak.
    ///
    /// # Arguments
    ///
    /// * `descriptor` - Indicates the raw file's file descriptor, start position and the length in the HAP.
    ///
    /// # Returns
    ///
    /// * Returns true: closes the raw file descriptor successfully, false: closes the raw file descriptor failed.
    ///
    /// Available since API-level: 11
    ///
    /// Version: 1.0
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_ResourceManager_ReleaseRawFileDescriptor64(
        descriptor: *const RawFileDescriptor64,
    ) -> bool;
}