Exemplo n.º 1
0
/*!
 * \brief Get contents of a file in the archive
 *
 * \param cpio CCpioFile object
 * \param filename Filename
 * \param data Output data
 * \param size Size of output data
 *
 * \return true on success or false on failure and error set appropriately
 *
 * \sa CpioFile::contents()
 */
bool mbp_cpiofile_contents(const CCpioFile *cpio,
                           const char *filename,
                           const unsigned char **data, size_t *size)
{
    CCAST(cpio);
    return cf->contentsC(filename, data, size);
}
Exemplo n.º 2
0
Arquivo: Array.c Projeto: awm/atp
ATP_Array ATP_arrayDuplicate(const ATP_Array *p_array)
{
    UT_array *l_copy;
    utarray_new(l_copy, &cs_valueIcd);
    utarray_concat(l_copy, CCAST(p_array));
    return (struct ATP_ArrayImpl *) l_copy;
}
Exemplo n.º 3
0
/*!
 * \brief Get AutoPatcher arguments
 *
 * \param info CPatchInfo object
 * \param apName AutoPatcher name
 *
 * \return Arguments
 *
 * \sa PatchInfo::autoPatcherArgs()
 */
CStringMap * mbp_patchinfo_autopatcher_args(const CPatchInfo *info,
                                            const char *apName)
{
    CCAST(info);
    mbp::PatchInfo::AutoPatcherArgs *args =
            new mbp::PatchInfo::AutoPatcherArgs(pi->autoPatcherArgs(apName));
    return reinterpret_cast<CStringMap *>(args);
}
Exemplo n.º 4
0
Arquivo: Array.c Projeto: awm/atp
ATP_ValueType ATP_arrayGetType(const ATP_Array *p_array, unsigned int p_index)
{
    Value *l_entry = (Value *) utarray_eltptr(CCAST(p_array), p_index);
    if (l_entry == NULL)
    {
        ERR("Index out of bounds\n");
        return e_ATP_ValueType_none;
    }

    return l_entry->m_type;
}
Exemplo n.º 5
0
/*!
 * \brief Constructs the boot image binary data
 *
 * \note The output data is dynamically allocated. It should be free()'d
 *       when it is no longer needed.
 *
 * \param bootImage CBootImage object
 * \param data Output data
 * \param size Size of output data
 *
 * \sa BootImage::create()
 */
bool mbp_bootimage_create_data(const CBootImage *bootImage,
                               unsigned char **data, size_t *size)
{
    CCAST(bootImage);
    std::vector<unsigned char> vData;
    if (bi->create(&vData)) {
        vector_to_data(vData, reinterpret_cast<void **>(data), size);
        return true;
    } else {
        return false;
    }
}
Exemplo n.º 6
0
Arquivo: Array.c Projeto: awm/atp
int ATP_arrayGetArray(const ATP_Array *p_array, unsigned int p_index, ATP_Array **p_value)
{
    Value *l_entry = (Value *) utarray_eltptr(CCAST(p_array), p_index);
    if (l_entry == NULL)
    {
        ERR("Index out of bounds\n");
        return 0;
    }

    if (l_entry->m_type == e_ATP_ValueType_array)
    {
        *p_value = &l_entry->m_value.m_array;
        return 1;
    }
    return 0;
}
Exemplo n.º 7
0
Arquivo: Array.c Projeto: awm/atp
int ATP_arrayGetString(const ATP_Array *p_array, unsigned int p_index, const char **p_value)
{
    Value *l_entry = (Value *) utarray_eltptr(CCAST(p_array), p_index);
    if (l_entry == NULL)
    {
        ERR("Index out of bounds\n");
        return 0;
    }

    if (l_entry->m_type == e_ATP_ValueType_string)
    {
        *p_value = utstring_body(&l_entry->m_value.m_string);
        return 1;
    }
    return 0;
}
Exemplo n.º 8
0
/*!
 * \brief Whether device model checks should be kept
 *
 * \param info CPatchInfo object
 *
 * \return Whether device model checks should be kept
 *
 * \sa PatchInfo::deviceCheck()
 */
bool mbp_patchinfo_device_check(const CPatchInfo *info)
{
    CCAST(info);
    return pi->deviceCheck();
}
Exemplo n.º 9
0
/*!
 * \brief Whether boot images should be autodetected
 *
 * \param info CPatchInfo object
 *
 * \return Whether boot images should be autodetected
 *
 * \sa PatchInfo::autodetectBootImages()
 */
bool mbp_patchinfo_autodetect_boot_images(const CPatchInfo *info)
{
    CCAST(info);
    return pi->autodetectBootImages();
}
Exemplo n.º 10
0
void mbp_bootimage_sin_header(const CBootImage *bootImage,
                              const unsigned char **data, size_t *size)
{
    CCAST(bootImage);
    bi->sinHeaderC(data, size);
}
Exemplo n.º 11
0
void mbp_bootimage_ramdisk_mtk_header(const CBootImage *bootImage,
                                      const unsigned char **data, size_t *size)
{
    CCAST(bootImage);
    bi->ramdiskMtkHeaderC(data, size);
}
Exemplo n.º 12
0
/*!
 * \brief Device tree image
 *
 * \param bootImage CBootImage object
 * \param data Output data
 * \param size Output size
 *
 * \sa BootImage::deviceTreeImage()
 */
void mbp_bootimage_device_tree_image(const CBootImage *bootImage,
                                     const unsigned char **data, size_t *size)
{
    CCAST(bootImage);
    bi->deviceTreeImageC(data, size);
}
Exemplo n.º 13
0
/*!
 * \brief Kernel cmdline in the boot image header
 *
 * \param bootImage CBootImage object
 *
 * \return Kernel cmdline
 *
 * \sa BootImage::kernelCmdline()
 */
const char * mbp_bootimage_kernel_cmdline(const CBootImage *bootImage)
{
    CCAST(bootImage);
    return bi->kernelCmdlineC();
}
Exemplo n.º 14
0
/*!
 * \brief Board name field in the boot image header
 *
 * \param bootImage CBootImage object
 *
 * \return Board name
 *
 * \sa BootImage::boardName()
 */
const char * mbp_bootimage_boardname(const CBootImage *bootImage)
{
    CCAST(bootImage);
    return bi->boardNameC();
}
Exemplo n.º 15
0
enum BootImageType mbp_bootimage_target_type(const CBootImage *bootImage)
{
    CCAST(bootImage);
    return static_cast<BootImageType>(bi->targetType());
}
Exemplo n.º 16
0
/*!
 * \brief Ramdisk image
 *
 * \param bootImage CBootImage object
 * \param data Output data
 * \param size Output size
 *
 * \sa BootImage::ramdiskImage()
 */
void mbp_bootimage_ramdisk_image(const CBootImage *bootImage,
                                 const unsigned char **data, size_t *size)
{
    CCAST(bootImage);
    bi->ramdiskImageC(data, size);
}
Exemplo n.º 17
0
/*!
 * \brief Second bootloader image
 *
 * \param bootImage CBootImage object
 * \param data Output data
 * \param size Output size
 *
 * \sa BootImage::secondBootloaderImage()
 */
void mbp_bootimage_second_bootloader_image(const CBootImage *bootImage,
                                           const unsigned char **data, size_t *size)
{
    CCAST(bootImage);
    bi->secondBootloaderImageC(data, size);
}
Exemplo n.º 18
0
/*!
 * \brief Page size field in the boot image header
 *
 * \param bootImage CBootImage object
 *
 * \return Page size
 *
 * \sa BootImage::pageSize()
 */
uint32_t mbp_bootimage_page_size(const CBootImage *bootImage)
{
    CCAST(bootImage);
    return bi->pageSize();
}
Exemplo n.º 19
0
void mbp_bootimage_kernel_mtk_header(const CBootImage *bootImage,
                                     const unsigned char **data, size_t *size)
{
    CCAST(bootImage);
    bi->kernelMtkHeaderC(data, size);
}
Exemplo n.º 20
0
/*!
 * \brief Ramdisk address field in the boot image header
 *
 * \param bootImage CBootImage object
 *
 * \return Ramdisk address
 *
 * \sa BootImage::ramdiskAddress()
 */
uint32_t mbp_bootimage_ramdisk_address(const CBootImage *bootImage)
{
    CCAST(bootImage);
    return bi->ramdiskAddress();
}
Exemplo n.º 21
0
void mbp_bootimage_appsbl_image(const CBootImage *bootImage,
                                const unsigned char **data, size_t *size)
{
    CCAST(bootImage);
    bi->appsblImageC(data, size);
}
Exemplo n.º 22
0
/*!
 * \brief Second bootloader address field in the boot image header
 *
 * \param bootImage CBootImage object
 *
 * \return Second bootloader address
 *
 * \sa BootImage::secondBootloaderAddress()
 */
uint32_t mbp_bootimage_second_bootloader_address(const CBootImage *bootImage)
{
    CCAST(bootImage);
    return bi->secondBootloaderAddress();
}
Exemplo n.º 23
0
/*!
 * \brief Get the error information
 *
 * \note The returned ErrorCode is filled with valid data only if a
 *       CBootImage operation has failed.
 *
 * \note The returned ErrorCode should be freed with mbp_error_destroy()
 *       when it is no longer needed.
 *
 * \param bootImage CBootImage object
 *
 * \return ErrorCode
 *
 * \sa BootImage::error()
 */
/* enum ErrorCode */ int mbp_bootimage_error(const CBootImage *bootImage)
{
    CCAST(bootImage);
    return static_cast<int>(bi->error());
}
Exemplo n.º 24
0
/*!
 * \brief Kernel tags address field in the boot image header
 *
 * \param bootImage CBootImage object
 *
 * \return Kernel tags address
 *
 * \sa BootImage::kernelTagsAddress()
 */
uint32_t mbp_bootimage_kernel_tags_address(const CBootImage *bootImage)
{
    CCAST(bootImage);
    return bi->kernelTagsAddress();
}
Exemplo n.º 25
0
/*!
 * \brief Whether the patched file has a boot image
 *
 * \param info CPatchInfo object
 *
 * \return Whether the patched file has a boot image
 *
 * \sa PatchInfo::hasBootImage()
 */
bool mbp_patchinfo_has_boot_image(const CPatchInfo *info)
{
    CCAST(info);
    return pi->hasBootImage();
}
Exemplo n.º 26
0
uint32_t mbp_bootimage_rpm_address(const CBootImage *bootImage)
{
    CCAST(bootImage);
    return bi->rpmAddress();
}
Exemplo n.º 27
0
/*!
 * \brief Which ramdisk patcher to use
 *
 * \note The output data is dynamically allocated. It should be `free()`'d
 *       when it is no longer needed.
 *
 * \param info CPatchInfo object
 *
 * \return Which ramdisk patcher to use
 *
 * \sa PatchInfo::ramdisk()
 */
char * mbp_patchinfo_ramdisk(const CPatchInfo *info)
{
    CCAST(info);
    return string_to_cstring(pi->ramdisk());
}
Exemplo n.º 28
0
uint32_t mbp_bootimage_appsbl_address(const CBootImage *bootImage)
{
    CCAST(bootImage);
    return bi->appsblAddress();
}
Exemplo n.º 29
0
/*!
 * \brief PatchInfo identifier
 *
 * \note The output data is dynamically allocated. It should be `free()`'d
 *       when it is no longer needed.
 *
 * \param info CPatchInfo object
 *
 * \return PatchInfo ID
 *
 * \sa PatchInfo::id()
 */
char * mbp_patchinfo_id(const CPatchInfo *info)
{
    CCAST(info);
    return string_to_cstring(pi->id());
}
Exemplo n.º 30
0
uint32_t mbp_bootimage_entrypoint_address(const CBootImage *bootImage)
{
    CCAST(bootImage);
    return bi->entrypointAddress();
}