Rizin
unix-like reverse engineering framework and cli tools
|
Listing information about .xz files. More...
Go to the source code of this file.
Classes | |
struct | xz_file_info |
Information about a .xz file. More... | |
struct | block_header_info |
Information about a .xz Block. More... | |
Macros | |
#define | XZ_FILE_INFO_INIT { NULL, 0, 0, true, 50000002 } |
#define | CHECKS_STR_SIZE 1024 |
Functions | |
static const char * | xz_ver_to_str (uint32_t ver) |
Convert XZ Utils version number to a string. More... | |
static bool | parse_indexes (xz_file_info *xfi, file_pair *pair) |
Parse the Index(es) from the given .xz file. More... | |
static bool | parse_block_header (file_pair *pair, const lzma_index_iter *iter, block_header_info *bhi, xz_file_info *xfi) |
Parse the Block Header. More... | |
static bool | parse_check_value (file_pair *pair, const lzma_index_iter *iter) |
Parse the Check field and put it into check_value[]. More... | |
static bool | parse_details (file_pair *pair, const lzma_index_iter *iter, block_header_info *bhi, xz_file_info *xfi) |
Parse detailed information about a Block. More... | |
static const char * | get_ratio (uint64_t compressed_size, uint64_t uncompressed_size) |
Get the compression ratio. More... | |
static void | get_check_names (char buf[CHECKS_STR_SIZE], uint32_t checks, bool space_after_comma) |
Get a comma-separated list of Check names. More... | |
static bool | print_info_basic (const xz_file_info *xfi, file_pair *pair) |
static void | print_adv_helper (uint64_t stream_count, uint64_t block_count, uint64_t compressed_size, uint64_t uncompressed_size, uint32_t checks, uint64_t stream_padding) |
static bool | print_info_adv (xz_file_info *xfi, file_pair *pair) |
static bool | print_info_robot (xz_file_info *xfi, file_pair *pair) |
static void | update_totals (const xz_file_info *xfi) |
static void | print_totals_basic (void) |
static void | print_totals_adv (void) |
static void | print_totals_robot (void) |
void | list_totals (void) |
Show the totals after all files have been listed. More... | |
void | list_file (const char *filename) |
List information about the given .xz file. More... | |
Variables | |
static const char | check_names [LZMA_CHECK_ID_MAX+1][12] |
Check ID to string mapping. More... | |
static char | check_value [2 *LZMA_CHECK_SIZE_MAX+1] |
struct { | |
uint64_t files | |
uint64_t streams | |
uint64_t blocks | |
uint64_t compressed_size | |
uint64_t uncompressed_size | |
uint64_t stream_padding | |
uint64_t memusage_max | |
uint32_t checks | |
uint32_t min_version | |
bool all_have_sizes | |
} | totals = { 0, 0, 0, 0, 0, 0, 0, 0, 50000002, true } |
Listing information about .xz files.
Definition in file list.c.
#define CHECKS_STR_SIZE 1024 |
Buffer size for get_check_names(). This may be a bit ridiculous, but at least it's enough if some language needs many multibyte chars.
|
static |
Get a comma-separated list of Check names.
The check names are translated with gettext except when in robot mode.
buf | Buffer to hold the resulting string |
checks | Bit mask of Checks to print |
space_after_comma | It's better to not use spaces in table-like listings, but in more verbose formats a space after a comma is good for readability. |
Definition at line 638 of file list.c.
References _, check_names, checks, CHECKS_STR_SIZE, comma, i, LZMA_CHECK_ID_MAX, my_snprintf(), opt_robot, pos, and UINT32_C.
Referenced by print_adv_helper(), print_info_basic(), print_info_robot(), print_totals_basic(), and print_totals_robot().
Get the compression ratio.
This has slightly different format than that is used in message.c.
Definition at line 611 of file list.c.
References compressed_size, snprintf, and uncompressed_size.
Referenced by print_adv_helper(), print_info_adv(), print_info_basic(), print_info_robot(), print_totals_basic(), and print_totals_robot().
void list_file | ( | const char * | filename | ) |
List information about the given .xz file.
Definition at line 1143 of file list.c.
References _, fail, FORMAT_AUTO, FORMAT_XZ, xz_file_info::idx, io_close(), io_open_src(), message_error(), message_fatal(), message_filename(), message_verbosity_get(), NULL, opt_force, opt_format, opt_robot, opt_stdout, parse_indexes(), print_info_adv(), print_info_basic(), print_info_robot(), stdin_filename, update_totals(), V_WARNING, and XZ_FILE_INFO_INIT.
Referenced by main().
void list_totals | ( | void | ) |
Show the totals after all files have been listed.
Definition at line 1121 of file list.c.
References message_verbosity_get(), opt_robot, print_totals_adv(), print_totals_basic(), print_totals_robot(), totals, and V_WARNING.
Referenced by main().
|
static |
Parse the Block Header.
The result is stored into *bhi. The caller takes care of initializing it.
Definition at line 406 of file list.c.
References xz_file_info::all_have_sizes, lzma_block::check, lzma_block::compressed_size, block_header_info::compressed_size, block_header_info::filter_chain, lzma_block::filters, filters, block_header_info::flags, free(), lzma_block::header_size, block_header_info::header_size, i, lzma_filter::id, io_pread(), lzma_block_header_size_decode, LZMA_BLOCK_HEADER_SIZE_MAX, LZMA_DATA_ERROR, LZMA_FILTER_LZMA2, LZMA_FILTERS_MAX, LZMA_OK, LZMA_OPTIONS_ERROR, LZMA_VLI_UNKNOWN, block_header_info::memusage, xz_file_info::memusage_max, message_bug(), message_error(), message_filters_to_str(), message_strm(), xz_file_info::min_version, my_min, NULL, options, file_pair::src_name, lzma_block::uncompressed_size, and lzma_block::version.
Referenced by parse_details().
|
static |
Parse the Check field and put it into check_value[].
Definition at line 546 of file list.c.
References check_value, conv32le, conv64le, i, io_pread(), LZMA_CHECK_NONE, PRIx32, PRIx64, and snprintf.
Referenced by parse_details().
|
static |
Parse detailed information about a Block.
Since this requires seek(s), listing information about all Blocks can be slow.
pair | Input file |
iter | Location of the Block whose Check value should be printed. |
bhi | Pointer to structure where to store the information about the Block Header field. |
Definition at line 594 of file list.c.
References parse_block_header(), and parse_check_value().
Referenced by print_info_adv(), and print_info_robot().
|
static |
Parse the Index(es) from the given .xz file.
xfi | Pointer to structure where the decoded information is stored. |
pair | Input file |
Definition at line 150 of file list.c.
References _, lzma_stream::avail_in, lzma_stream_flags::backward_size, error(), hardware_memlimit_get(), i, xz_file_info::idx, index_size(), IO_BUFFER_SIZE, io_pread(), LZMA_BUF_ERROR, LZMA_DATA_ERROR, LZMA_MEMLIMIT_ERROR, LZMA_OK, LZMA_OPTIONS_ERROR, LZMA_RUN, LZMA_STREAM_END, LZMA_STREAM_HEADER_SIZE, LZMA_STREAM_INIT, memlimit, message_bug(), message_error(), message_mem_needed(), message_strm(), MODE_LIST, my_min, lzma_stream::next_in, NULL, pos, file_pair::src_name, file_pair::src_st, xz_file_info::stream_padding, stream_padding, strm, UINT64_MAX, V_ERROR, and lzma_stream_flags::version.
Referenced by list_file().
|
static |
Definition at line 710 of file list.c.
References _, checks, CHECKS_STR_SIZE, compressed_size, get_check_names(), get_ratio(), NICESTR_B, NICESTR_TIB, printf(), stream_padding, uint64_to_nicestr(), uint64_to_str(), and uncompressed_size.
Referenced by print_info_adv(), and print_totals_adv().
|
static |
Definition at line 738 of file list.c.
References _, xz_file_info::all_have_sizes, check_names, check_value, compressed_size, block_header_info::filter_chain, block_header_info::flags, get_ratio(), block_header_info::header_size, xz_file_info::idx, LZMA_INDEX_ITER_BLOCK, LZMA_INDEX_ITER_STREAM, block_header_info::memusage, xz_file_info::memusage_max, message_verbosity_get(), xz_file_info::min_version, my_max, parse_details(), print_adv_helper(), printf(), round_up_to_mib(), xz_file_info::stream_padding, tuklib_mbstr_fw, uint64_to_str(), V_DEBUG, and xz_ver_to_str().
Referenced by list_file().
|
static |
Definition at line 668 of file list.c.
References _, checks, CHECKS_STR_SIZE, get_check_names(), get_ratio(), xz_file_info::idx, NICESTR_B, NICESTR_TIB, printf(), file_pair::src_name, tuklib_mbstr_fw, uint64_to_nicestr(), and uint64_to_str().
Referenced by list_file().
|
static |
Definition at line 916 of file list.c.
References xz_file_info::all_have_sizes, check_names, check_value, checks, CHECKS_STR_SIZE, block_header_info::compressed_size, block_header_info::filter_chain, block_header_info::flags, get_check_names(), get_ratio(), block_header_info::header_size, xz_file_info::idx, LZMA_INDEX_ITER_BLOCK, LZMA_INDEX_ITER_STREAM, block_header_info::memusage, xz_file_info::memusage_max, message_verbosity_get(), xz_file_info::min_version, parse_details(), printf(), PRIu32, PRIu64, file_pair::src_name, xz_file_info::stream_padding, V_DEBUG, and V_VERBOSE.
Referenced by list_file().
|
static |
Definition at line 1067 of file list.c.
References _, message_verbosity_get(), print_adv_helper(), printf(), round_up_to_mib(), totals, uint64_to_str(), V_DEBUG, and xz_ver_to_str().
Referenced by list_totals().
|
static |
Definition at line 1025 of file list.c.
References checks, CHECKS_STR_SIZE, get_check_names(), get_ratio(), setup::line, memset(), ngettext, NICESTR_B, NICESTR_TIB, printf(), totals, uint64_to_nicestr(), and uint64_to_str().
Referenced by list_totals().
|
static |
Definition at line 1091 of file list.c.
References checks, CHECKS_STR_SIZE, get_check_names(), get_ratio(), message_verbosity_get(), printf(), PRIu32, PRIu64, totals, and V_DEBUG.
Referenced by list_totals().
|
static |
Definition at line 1001 of file list.c.
References xz_file_info::all_have_sizes, xz_file_info::idx, xz_file_info::memusage_max, xz_file_info::min_version, xz_file_info::stream_padding, and totals.
Referenced by list_file().
Convert XZ Utils version number to a string.
Definition at line 117 of file list.c.
References major, minor, and snprintf.
Referenced by print_info_adv(), and print_totals_adv().
uint64_t blocks |
Definition at line 104 of file list.c.
Referenced by ds_show_flags(), find_block_at_xref_addr(), GetHeapBlocks(), GetSegmentHeapBlocks(), LZMA_API(), main(), noreturn_get_blocks_cb(), pdb7_extract_msf_stream_directory(), rz_analysis_block_automerge(), rz_analysis_function_analyze_jmptable_handler(), rz_analysis_function_blocks_edge_handler(), rz_analysis_function_blocks_switch_type_handler(), rz_analysis_update_analysis_range(), rz_core_analysis_get_stats(), RZ_PACKED(), search_hash(), and update().
|
static |
Check ID to string mapping.
Definition at line 61 of file list.c.
Referenced by get_check_names(), print_info_adv(), and print_info_robot().
|
static |
Value of the Check field as hexadecimal string. This is set by parse_check_value().
Definition at line 95 of file list.c.
Referenced by parse_check_value(), print_info_adv(), and print_info_robot().
uint32_t checks |
Definition at line 109 of file list.c.
Referenced by check_buffer(), get_check_names(), LZMA_API(), print_adv_helper(), print_info_basic(), print_info_robot(), print_totals_basic(), and print_totals_robot().
uint64_t compressed_size |
Definition at line 105 of file list.c.
Referenced by get_ratio(), LZMA_API(), maximum_compressed_size(), print_adv_helper(), print_info_adv(), and zipCloseFileInZipRaw64().
uint64_t stream_padding |
Definition at line 107 of file list.c.
Referenced by index_file_size(), parse_indexes(), and print_adv_helper().
uint64_t streams |
Definition at line 103 of file list.c.
Referenced by bin_pe_dotnet_init_metadata(), LZMA_API(), pdb7_extract_streams(), and rz_test_main().
struct { ... } totals |
Totals that are displayed if there was more than one file. The "files" counter is also used in print_info_adv() to show the file number.
Referenced by list_totals(), print_totals_adv(), print_totals_basic(), print_totals_robot(), and update_totals().
uint64_t uncompressed_size |
Definition at line 106 of file list.c.
Referenced by create_big(), get_ratio(), hash_append(), lzma2_bound(), LZMA_API(), lzma_block_buffer_bound64(), lzma_decoder_uncompressed(), lzma_lz_decoder_uncompressed(), lzma_outq_read(), lzmainfo(), maximum_compressed_size(), print_adv_helper(), stream_encode_mt(), test_read(), zipCloseFileInZipRaw(), and zipCloseFileInZipRaw64().