|
libaaruformat 1.0
Aaru Data Preservation Suite - Format Library
|
Go to the source code of this file.
Data Structures | |
| struct | NgcwJunkEntry |
| In-memory junk map entry. More... | |
Macros | |
| #define | AARUFORMAT_CONTEXT_DECLARED |
| #define | NGCW_JUNK_MAP_VERSION 1 |
| Current junk map serialization version. | |
Typedefs | |
| typedef struct NgcwJunkEntry | NgcwJunkEntry |
| In-memory junk map entry. | |
Functions | |
| int32_t | ngcw_serialize_junk_map (const NgcwJunkEntry *entries, uint32_t count, uint8_t **out_data, uint32_t *out_len) |
| Serialize a junk map for storage as a media tag. | |
| int32_t | ngcw_deserialize_junk_map (const uint8_t *data, uint32_t data_len, NgcwJunkEntry **entries, uint32_t *count, uint16_t *seed_size) |
| Deserialize a junk map from a media tag buffer. | |
| int | ngcw_regenerate_junk_sector (const NgcwJunkEntry *entries, uint32_t entry_count, uint64_t disc_offset, uint8_t *output, uint32_t length) |
| Regenerate a junk sector from the junk map. | |
| void | ngcw_junk_lazy_init (aaruformat_context *ctx) |
| Lazy initialization: load junk map from media tags. | |
| #define AARUFORMAT_CONTEXT_DECLARED |
Definition at line 31 of file ngcw_junk.h.
| #define NGCW_JUNK_MAP_VERSION 1 |
Current junk map serialization version.
Definition at line 40 of file ngcw_junk.h.
Referenced by ngcw_deserialize_junk_map(), and ngcw_serialize_junk_map().
| typedef struct NgcwJunkEntry NgcwJunkEntry |
In-memory junk map entry.
Each entry describes a contiguous region of LFG-generated junk on disc.
| int32_t ngcw_deserialize_junk_map | ( | const uint8_t * | data, |
| uint32_t | data_len, | ||
| NgcwJunkEntry ** | entries, | ||
| uint32_t * | count, | ||
| uint16_t * | seed_size ) |
Deserialize a junk map from a media tag buffer.
| data | Serialized data buffer. |
| data_len | Length of the data buffer. |
| entries | Output: malloc'd array of NgcwJunkEntry (caller must free). |
| count | Output: number of entries. |
| seed_size | Output: seed size in uint32 words. |
< Current junk map serialization version.
< Number of uint32 words needed to seed the LFG.
Definition at line 104 of file ngcw_junk.c.
References JUNK_MAP_HEADER_SIZE, NgcwJunkEntry::length, NGC_LFG_SEED_SIZE, ngcw_deserialize_junk_map(), NGCW_JUNK_MAP_VERSION, NgcwJunkEntry::offset, NgcwJunkEntry::partition_index, read_le16(), read_le32(), and read_le64().
Referenced by ngcw_deserialize_junk_map(), and ngcw_junk_lazy_init().
| void ngcw_junk_lazy_init | ( | aaruformat_context * | ctx | ) |
Lazy initialization: load junk map from media tags.
Populates ctx->ngcw_junk_entries from the kMediaTagNgcwJunkMap media tag.
| ctx | AaruFormat context. |
Definition at line 211 of file ngcw_junk.c.
References mediaTagEntry::data, JUNK_MAP_HEADER_SIZE, kMediaTagNgcwJunkMap, mediaTagEntry::length, aaruformat_context::mediaTags, ngcw_deserialize_junk_map(), aaruformat_context::ngcw_junk_entries, aaruformat_context::ngcw_junk_entry_count, ngcw_junk_lazy_init(), and aaruformat_context::ngcw_junk_seed_size.
Referenced by aaruf_read_sector(), and ngcw_junk_lazy_init().
| int ngcw_regenerate_junk_sector | ( | const NgcwJunkEntry * | entries, |
| uint32_t | entry_count, | ||
| uint64_t | disc_offset, | ||
| uint8_t * | output, | ||
| uint32_t | length ) |
Regenerate a junk sector from the junk map.
Looks up the given disc byte offset in the junk map, initializes the LFG with the matching entry's seed, advances to the correct stream position, and generates the requested number of bytes.
| entries | Array of junk entries (sorted by offset). |
| entry_count | Number of entries. |
| disc_offset | Disc byte offset of the sector to regenerate. |
| output | Output buffer to fill. |
| length | Number of bytes to generate. |
< Number of uint32 words needed to seed the LFG.
Definition at line 154 of file ngcw_junk.c.
References NgcwJunkEntry::length, ngc_lfg_get_bytes(), NGC_LFG_SEED_SIZE, ngc_lfg_set_seed(), ngcw_regenerate_junk_sector(), and NgcwJunkEntry::offset.
Referenced by aaruf_read_sector(), and ngcw_regenerate_junk_sector().
| int32_t ngcw_serialize_junk_map | ( | const NgcwJunkEntry * | entries, |
| uint32_t | count, | ||
| uint8_t ** | out_data, | ||
| uint32_t * | out_len ) |
Serialize a junk map for storage as a media tag.
Format (all little-endian): [2 bytes] version (uint16) [4 bytes] entry_count (uint32) [2 bytes] seed_size (uint16) — NGC_LFG_SEED_SIZE For each entry (86 bytes when seed_size=17): [8 bytes] offset (uint64) [8 bytes] length (uint64) [2 bytes] partition_index (uint16) [seed_size * 4 bytes] seed (raw bytes, big-endian uint32 words)
| entries | Array of junk entries. |
| count | Number of entries. |
| out_data | Output: malloc'd buffer (caller must free). |
| out_len | Output: length of the buffer. |
< Number of uint32 words needed to seed the LFG.
< Current junk map serialization version.
< Number of uint32 words needed to seed the LFG.
< Number of uint32 words needed to seed the LFG.
Definition at line 75 of file ngcw_junk.c.
References JUNK_MAP_HEADER_SIZE, NGC_LFG_SEED_SIZE, NGCW_JUNK_MAP_VERSION, ngcw_serialize_junk_map(), write_le16(), write_le32(), and write_le64().
Referenced by ngcw_serialize_junk_map().