<trclass="memdesc:abbcf276c3518b3e666885ab250fd374e"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Retrieves the logical CHS geometry from the AaruFormat image. <br/></td></tr>
<trclass="memdesc:ad0b5b12288f159780d065b12ba12bdcc"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Sets the logical CHS geometry for the AaruFormat image. <br/></td></tr>
<trclass="memdesc:a10d528163caf65134a7cec4a0c0a33b8"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Sets the media sequence information for multi-volume media sets. <br/></td></tr>
<trclass="memdesc:af28837461d12252d8258032e370585ae"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Sets the creator (person/operator) information for the image. <br/></td></tr>
<trclass="memdesc:ad24b15e067720825c47610e9477bfc2a"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Sets user comments or notes for the image. <br/></td></tr>
<trclass="memdesc:a2f344544e412db0bfb46d3dfb509dd91"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Sets the media title or label for the image. <br/></td></tr>
<trclass="memdesc:add92b8c91ede6a62dfda5f8980c3ce6d"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Sets the media manufacturer information for the image. <br/></td></tr>
<trclass="memdesc:a0ed36b14e49f1e924906d9c4b26d6214"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Sets the media model or product designation for the image. <br/></td></tr>
<trclass="memdesc:ad06ae4d49d6de002ef565108c73451e1"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Sets the media serial number for the image. <br/></td></tr>
<trclass="memdesc:a0e5be9ff6d87218a8f5b451a27e1b39b"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Sets the media barcode information for the image. <br/></td></tr>
<trclass="memdesc:ac7c87ae51a242428ceb6d2b0a75e0b70"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Sets the media part number or model designation for the image. <br/></td></tr>
<trclass="memdesc:a223856fa226b26c466997800183c97c4"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Sets the drive manufacturer information for the image. <br/></td></tr>
<trclass="memdesc:a29b6c38ce4b3420368ecb84007d8738d"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Sets the drive model information for the image. <br/></td></tr>
<trclass="memdesc:ae6b0a57476896bb90ee7bb8472e1078f"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Sets the drive serial number for the image. <br/></td></tr>
<trclass="memdesc:adaa13a82dfc90987efd6c9a366904dc4"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Sets the drive firmware revision for the image. <br/></td></tr>
<trclass="memdesc:a42f191c2ea4c70c9d7b373c19b59c812"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Retrieves the embedded CICM XML metadata sidecar from the image. <br/></td></tr>
<trclass="memdesc:a01cf0abe0b137236d4be0b91a29d4818"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Retrieves the embedded Aaru metadata JSON from the image. <br/></td></tr>
<trclass="memdesc:a8090a039e00ee003569939332d21094e"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Sets the Aaru metadata JSON for the image during creation. <br/></td></tr>
<trclass="memdesc:aa683ff7387ba3f505b1756da1b408f7e"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Retrieves the media sequence metadata for multi-volume image sets. <br/></td></tr>
<trclass="memdesc:a38d72be7e7854d6cb0bba89172e27b03"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Retrieves the recorded creator (operator) name from the MetadataBlock. <br/></td></tr>
<trclass="memdesc:a9628bcfd2642649a6bcbf1f46d6b6705"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Retrieves the user comments or notes stored in the MetadataBlock. <br/></td></tr>
<trclass="memdesc:af1ca27c052c6cde38a8d6d71e10936db"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Retrieves the media title or label captured during image creation. <br/></td></tr>
<trclass="memdesc:a515c264f726f8b0a5104778b383ad1d4"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Retrieves the recorded media manufacturer name. <br/></td></tr>
<trclass="memdesc:a509892f76c9a03a030693740d043adfc"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Retrieves the media model or product designation metadata. <br/></td></tr>
<trclass="memdesc:a4cb7b7200e36efb4983cf2c5c5543313"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Retrieves the media serial number recorded in the image metadata. <br/></td></tr>
<trclass="memdesc:a580c8bf133cf3481deca14779b8b5419"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Retrieves the barcode assigned to the physical media or its packaging. <br/></td></tr>
<trclass="memdesc:a4cdfb46f5630fcf1fe6447b37ad18ae2"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Retrieves the media part number recorded in the MetadataBlock. <br/></td></tr>
<trclass="memdesc:a5d487a858c48838bcc9f3bba4b5944a1"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Retrieves the drive manufacturer metadata captured during imaging. <br/></td></tr>
<trclass="memdesc:a54d724659818ea4486f9981672f6d01e"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Retrieves the device model information for the imaging drive. <br/></td></tr>
<trclass="memdesc:a1892cc8395305d7e85d04544ded62131"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Retrieves the imaging drive's serial number metadata. <br/></td></tr>
<trclass="memdesc:a3db92f6bebf60195d6ab327e17988cee"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Retrieves the firmware revision metadata for the imaging drive. <br/></td></tr>
<trclass="memdesc:a7e63f10ff3ea353c8c3944cd836a85ee"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Retrieves the total number of user-accessible sectors in the AaruFormat image. <br/></td></tr>
<trclass="memdesc:a8e00d26a8e751fbd412868ac4f92a3c0"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Retrieves the number of negative (pre-gap) sectors in the AaruFormat image. <br/></td></tr>
<trclass="memdesc:aeeae64b120a10bac5e3d757a07a9691a"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Retrieves the number of overflow (post-gap) sectors in the AaruFormat image. <br/></td></tr>
<trclass="memdesc:a65c73217edb9661accbbe3de4f555b62"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Retrieves a deep copy of the <aclass="el"href="structImageInfo.html"title="High-level summary of an opened Aaru image containing metadata and media characteristics.">ImageInfo</a> structure from the AaruFormat image. <br/></td></tr>
<p>Retrieves the embedded Aaru metadata JSON from the image. </p>
<p>Aaru metadata JSON is a structured metadata format that provides machine-readable, comprehensive information about the image, media, imaging session details, hardware configuration, optical disc tracks and sessions, checksums, and preservation metadata. This function extracts the raw JSON payload that was embedded in the AaruFormat image during creation. The JSON data is preserved in its original form without parsing or interpretation by the library, allowing callers to process the structured metadata using standard JSON parsing libraries.</p>
<p>This function supports a two-call pattern for buffer size determination:</p><oltype="1">
<li>First call with a buffer that may be too small returns AARUF_ERROR_BUFFER_TOO_SMALL and sets *length to the required size</li>
<li>Second call with a properly sized buffer retrieves the actual data</li>
</ol>
<p>Alternatively, if the caller already knows the buffer is large enough, a single call will succeed and populate the buffer with the Aaru JSON data.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">context</td><td>Pointer to the aaruformat context (must be a valid, opened image context). </td></tr>
<tr><tdclass="paramname">buffer</td><td>Pointer to a buffer that will receive the Aaru metadata JSON. Must be large enough to hold the entire JSON payload (at least *length bytes on input). The buffer will contain raw UTF-8 encoded JSON data on success. </td></tr>
<tr><tdclass="paramname">length</td><td>Pointer to a size_t that serves dual purpose:<ul>
<li>On input: size of the provided buffer in bytes</li>
<li>On output: actual size of the Aaru metadata JSON in bytes If the function returns AARUF_ERROR_BUFFER_TOO_SMALL, this will be updated to contain the required buffer size for a subsequent successful call.</li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following status codes: </dd></dl>
<dlclass="retval"><dt>Return values</dt><dd>
<tableclass="retval">
<tr><tdclass="paramname">AARUF_STATUS_OK</td><td>(0) Successfully retrieved Aaru metadata JSON. This is returned when:<ul>
<li>The context is valid and properly initialized</li>
<li>The Aaru JSON block is present in the image (identifier == AaruMetadataJsonBlock)</li>
<li>The provided buffer is large enough (>= required length)</li>
<li>The Aaru JSON data is successfully copied to the buffer</li>
<li>The *length parameter is set to the actual size of the JSON data</li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>(-1) The context is invalid. This occurs when:<ul>
<li>The context parameter is NULL</li>
<li>The context magic number doesn't match AARU_MAGIC (invalid context type)</li>
<li>The context was not properly initialized by <aclass="el"href="decls_8h.html#afc4932cdc795ffb2ef3a33d5b8c57656"title="Opens an existing AaruFormat image file.">aaruf_open()</a> or <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a></li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_CANNOT_READ_BLOCK</td><td>(-6) The Aaru JSON block is not present. This occurs when:<ul>
<li>The image was created without Aaru metadata JSON</li>
<li>ctx->jsonBlock is NULL (no data loaded)</li>
<li>ctx->jsonBlockHeader.length is 0 (empty metadata)</li>
<li>The Aaru JSON block was not found during image opening</li>
<li>The *length output parameter is set to 0 to indicate no data available</li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_BUFFER_TOO_SMALL</td><td>(-10) The provided buffer is insufficient. This occurs when:<ul>
<li>The input *length is less than ctx->jsonBlockHeader.length</li>
<li>The *length parameter is updated to contain the required buffer size</li>
<li>No data is copied to the buffer</li>
<li>The caller should allocate a larger buffer and call again</li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dlclass="section note"><dt>Note</dt><dd>Aaru JSON Format and Encoding:<ul>
<li>The JSON payload is stored in UTF-8 encoding</li>
<li>The payload may or may not be null-terminated</li>
<li>The library treats the JSON as opaque binary data</li>
<li>No JSON parsing, interpretation, or validation is performed by libaaruformat</li>
<li>JSON schema validation and parsing are the caller's responsibility</li>
</ul>
</dd>
<dd>
Aaru Metadata JSON Purpose:<ul>
<li>Provides machine-readable structured metadata using modern JSON format</li>
<li>Includes comprehensive information about media, sessions, tracks, and checksums</li>
<li>Enables programmatic access to metadata without XML parsing overhead</li>
<li>Documents imaging session details, hardware configuration, and preservation data</li>
<li>Used by Aaru and compatible tools for metadata exchange and analysis</li>
<li>Complements or serves as alternative to CICM XML metadata</li>
</ul>
</dd>
<dd>
Buffer Size Handling:<ul>
<li>First call with insufficient buffer returns required size in *length</li>
<li>Caller allocates properly sized buffer based on returned length</li>
<li>Second call with adequate buffer retrieves the actual JSON data</li>
<li>Single call succeeds if buffer is already large enough</li>
</ul>
</dd>
<dd>
Data Availability:<ul>
<li>Aaru JSON blocks are optional in AaruFormat images</li>
<li>Not all images will contain Aaru metadata JSON</li>
<li>The presence of JSON data depends on how the image was created</li>
<li>Check return value to handle missing metadata gracefully</li>
<li>Images may contain CICM XML, Aaru JSON, both, or neither</li>
</ul>
</dd>
<dd>
Distinction from CICM XML:<ul>
<li>CICM XML follows the Canary Islands Computer Museum schema (older format)</li>
<li>Aaru JSON follows the Aaru-specific metadata schema (newer format)</li>
<li>Both can coexist in the same image file</li>
<li>Aaru JSON may provide more detailed or different metadata than CICM XML</li>
<li>Different tools and workflows may prefer one format over the other</li>
</ul>
</dd></dl>
<dlclass="section warning"><dt>Warning</dt><dd>This function reads from the in-memory Aaru JSON block loaded during <aclass="el"href="decls_8h.html#afc4932cdc795ffb2ef3a33d5b8c57656"title="Opens an existing AaruFormat image file.">aaruf_open()</a>. It does not perform file I/O operations. The entire JSON is kept in memory for the lifetime of the context.</dd>
<dd>
The buffer parameter must be valid and large enough to hold the JSON data. Passing a buffer smaller than the required size will result in AARUF_ERROR_BUFFER_TOO_SMALL with no partial data copied.</dd>
<dd>
This function does not validate JSON syntax or schema. Corrupted JSON data will be retrieved successfully and errors will only be detected when attempting to parse.</dd></dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="structAaruMetadataJsonBlockHeader.html"title="Header for an Aaru metadata JSON block (identifier == BlockType::AaruMetadataJsonBlock).">AaruMetadataJsonBlockHeader</a> for the on-disk structure definition. </dd>
<dd>
<aclass="el"href="#a42f191c2ea4c70c9d7b373c19b59c812"title="Retrieves the embedded CICM XML metadata sidecar from the image.">aaruf_get_cicm_metadata()</a> for retrieving CICM XML metadata. </dd>
<dd>
<aclass="el"href="blocks_2metadata_8c.html#a84003ec881425a7b28ec24cb48d19f02"title="Processes an Aaru metadata JSON block from the image stream during image opening.">process_aaru_metadata_json_block()</a> for the loading process during image opening. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="metadata_8c_source.html#l02102">2102</a> of file <aclass="el"href="metadata_8c_source.html">metadata.c</a>.</p>
<p>Retrieves the embedded CICM XML metadata sidecar from the image. </p>
<p>CICM (Canary Islands Computer Museum) XML is a standardized metadata format used for documenting preservation and archival information about media and disk images. This function extracts the raw CICM XML payload that was embedded in the AaruFormat image during creation. The XML data is preserved in its original form without parsing, interpretation, or validation by the library. The metadata typically includes detailed information about the physical media, imaging process, checksums, device information, and preservation metadata following the CICM schema.</p>
<p>This function supports a two-call pattern for buffer size determination:</p><oltype="1">
<li>First call with a buffer that may be too small returns AARUF_ERROR_BUFFER_TOO_SMALL and sets *length to the required size</li>
<li>Second call with a properly sized buffer retrieves the actual data</li>
</ol>
<p>Alternatively, if the caller already knows the buffer is large enough, a single call will succeed and populate the buffer with the CICM XML data.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">context</td><td>Pointer to the aaruformat context (must be a valid, opened image context). </td></tr>
<tr><tdclass="paramname">buffer</td><td>Pointer to a buffer that will receive the CICM XML metadata. Must be large enough to hold the entire XML payload (at least *length bytes on input). The buffer will contain raw UTF-8 encoded XML data on success. </td></tr>
<tr><tdclass="paramname">length</td><td>Pointer to a size_t that serves dual purpose:<ul>
<li>On input: size of the provided buffer in bytes</li>
<li>On output: actual size of the CICM XML metadata in bytes If the function returns AARUF_ERROR_BUFFER_TOO_SMALL, this will be updated to contain the required buffer size for a subsequent successful call.</li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following status codes: </dd></dl>
<dlclass="retval"><dt>Return values</dt><dd>
<tableclass="retval">
<tr><tdclass="paramname">AARUF_STATUS_OK</td><td>(0) Successfully retrieved CICM XML metadata. This is returned when:<ul>
<li>The context is valid and properly initialized</li>
<li>The CICM block is present in the image (identifier == CicmBlock)</li>
<li>The provided buffer is large enough (>= required length)</li>
<li>The CICM XML data is successfully copied to the buffer</li>
<li>The *length parameter is set to the actual size of the XML data</li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>(-1) The context is invalid. This occurs when:<ul>
<li>The context parameter is NULL</li>
<li>The context magic number doesn't match AARU_MAGIC (invalid context type)</li>
<li>The context was not properly initialized by <aclass="el"href="decls_8h.html#afc4932cdc795ffb2ef3a33d5b8c57656"title="Opens an existing AaruFormat image file.">aaruf_open()</a> or <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a></li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_CANNOT_READ_BLOCK</td><td>(-6) The CICM block is not present. This occurs when:<ul>
<li>The image was created without CICM XML metadata</li>
<li>ctx->cicmBlock is NULL (no data loaded)</li>
<li>ctx->cicmBlockHeader.length is 0 (empty metadata)</li>
<li>Includes checksums for data integrity verification</li>
<li>Records detailed device and media information</li>
<li>Supports archival and long-term preservation requirements</li>
<li>Provides standardized metadata for digital preservation workflows</li>
<li>Used by cultural heritage institutions and archives</li>
</ul>
</dd>
<dd>
Buffer Size Handling:<ul>
<li>First call with insufficient buffer returns required size in *length</li>
<li>Caller allocates properly sized buffer based on returned length</li>
<li>Second call with adequate buffer retrieves the actual XML data</li>
<li>Single call succeeds if buffer is already large enough</li>
</ul>
</dd>
<dd>
Data Availability:<ul>
<li>CICM blocks are optional in AaruFormat images</li>
<li>Not all images will contain CICM metadata</li>
<li>The presence of CICM data depends on how the image was created</li>
<li>Check return value to handle missing metadata gracefully</li>
</ul>
</dd></dl>
<dlclass="section warning"><dt>Warning</dt><dd>The XML data may contain sensitive information about the imaging environment, personnel, locations, or media content. Handle appropriately for your use case.</dd>
<dd>
This function reads from the in-memory CICM block loaded during <aclass="el"href="decls_8h.html#afc4932cdc795ffb2ef3a33d5b8c57656"title="Opens an existing AaruFormat image file.">aaruf_open()</a>. It does not perform file I/O operations. The entire CICM XML is kept in memory for the lifetime of the context.</dd>
<dd>
The buffer parameter must be valid and large enough to hold the XML data. Passing a buffer smaller than the required size will result in AARUF_ERROR_BUFFER_TOO_SMALL with no partial data copied.</dd></dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="structCicmMetadataBlock.html"title="Header for a CICM XML metadata block (identifier == BlockType::CicmBlock).">CicmMetadataBlock</a> for the on-disk structure definition. </dd>
<dd>
aaruf_set_cicm_metadata() for embedding CICM XML during image creation. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="metadata_8c_source.html#l01947">1947</a> of file <aclass="el"href="metadata_8c_source.html">metadata.c</a>.</p>
<p>Retrieves the user comments or notes stored in the MetadataBlock. </p>
<p>Provides access to the UTF-16LE encoded comments associated with the image. Comments are often used for provenance notes, imaging details, or curator remarks. The function follows the same two-call buffer sizing pattern used by other metadata retrieval APIs: the caller may probe the required size before allocating memory.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">context</td><td>Pointer to a valid aaruformat context opened with <aclass="el"href="decls_8h.html#afc4932cdc795ffb2ef3a33d5b8c57656"title="Opens an existing AaruFormat image file.">aaruf_open()</a> or <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a>. </td></tr>
<tr><tdclass="paramname">buffer</td><td>Destination buffer that receives the comments data. May be NULL when probing size. </td></tr>
<tr><tdclass="paramname">length</td><td>Pointer to an int32_t. On input it contains the size of <codeclass="param">buffer</code> in bytes; on output it is updated with the actual comments length.</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following status codes: </dd></dl>
<dlclass="retval"><dt>Return values</dt><dd>
<tableclass="retval">
<tr><tdclass="paramname">AARUF_STATUS_OK</td><td>(0) Comments were available and copied successfully. </td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>(-1) The context pointer is invalid or not a libaaruformat context. </td></tr>
<tr><tdclass="paramname">AARUF_ERROR_METADATA_NOT_PRESENT</td><td>(-30) No comments metadata exists in the image. </td></tr>
<tr><tdclass="paramname">AARUF_ERROR_BUFFER_TOO_SMALL</td><td>(-10) The supplied buffer was too small. *length is updated with the required size and no data is copied.</td></tr>
</table>
</dd>
</dl>
<dlclass="section note"><dt>Note</dt><dd>Comments are stored exactly as provided during image creation and may include multi-line text or other control characters. No validation or normalization is applied by the library. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="metadata_8c_source.html#l02479">2479</a> of file <aclass="el"href="metadata_8c_source.html">metadata.c</a>.</p>
<p>Retrieves the recorded creator (operator) name from the MetadataBlock. </p>
<p>Copies the UTF-16LE encoded creator string that identifies the person or operator who created the image. The function supports the common two-call pattern: the caller first determines the required buffer size by passing a buffer that may be NULL or too small, then allocates sufficient memory and calls again to obtain the actual data. On success the buffer contains an opaque UTF-16LE string of length *length bytes (not null-terminated).</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">context</td><td>Pointer to a valid aaruformat context opened for reading or writing. </td></tr>
<tr><tdclass="paramname">buffer</td><td>Pointer to the destination buffer that will receive the creator string. May be NULL to query the required size. </td></tr>
<tr><tdclass="paramname">length</td><td>Pointer to an int32_t that on input specifies the size of <codeclass="param">buffer</code> in bytes and on output receives the actual length of the creator metadata.</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following status codes: </dd></dl>
<dlclass="retval"><dt>Return values</dt><dd>
<tableclass="retval">
<tr><tdclass="paramname">AARUF_STATUS_OK</td><td>(0) The creator string was copied successfully. </td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>(-1) The context is NULL or not an aaruformat context. </td></tr>
<tr><tdclass="paramname">AARUF_ERROR_METADATA_NOT_PRESENT</td><td>(-30) Creator metadata has not been recorded in the image. </td></tr>
<tr><tdclass="paramname">AARUF_ERROR_BUFFER_TOO_SMALL</td><td>(-10) The provided buffer was insufficient; *length contains the required size and no data was copied.</td></tr>
</table>
</dd>
</dl>
<dlclass="section note"><dt>Note</dt><dd>The returned data is UTF-16LE encoded and may contain embedded null characters. Callers should treat it as an opaque byte array unless they explicitly handle UTF-16LE strings.</dd>
<dd>
The function does not allocate memory. Callers are responsible for ensuring <codeclass="param">buffer</code> is large enough before requesting the data. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="metadata_8c_source.html#l02407">2407</a> of file <aclass="el"href="metadata_8c_source.html">metadata.c</a>.</p>
<p>Retrieves the firmware revision metadata for the imaging drive. </p>
<p>Returns the UTF-16LE encoded firmware revision string that was captured when the image was created. Firmware information is critical for reproducing imaging environments and diagnosing drive-specific behavior or bugs.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">context</td><td>Pointer to a valid aaruformat context. </td></tr>
<tr><tdclass="paramname">buffer</td><td>Destination buffer for the firmware revision string. May be NULL when probing size. </td></tr>
<tr><tdclass="paramname">length</td><td>Pointer to an int32_t that specifies the buffer capacity in bytes on input and is updated with the actual metadata length on output.</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following status codes: </dd></dl>
<dlclass="retval"><dt>Return values</dt><dd>
<tableclass="retval">
<tr><tdclass="paramname">AARUF_STATUS_OK</td><td>(0) Firmware revision metadata was present and copied successfully. </td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>(-1) The context pointer is invalid. </td></tr>
<tr><tdclass="paramname">AARUF_ERROR_METADATA_NOT_PRESENT</td><td>(-30) No firmware metadata exists in the image. </td></tr>
<tr><tdclass="paramname">AARUF_ERROR_BUFFER_TOO_SMALL</td><td>(-10) The supplied buffer was too small; *length is updated.</td></tr>
</table>
</dd>
</dl>
<dlclass="section note"><dt>Note</dt><dd>Firmware revision formats vary between manufacturers (e.g., numeric, alphanumeric, dot-separated). The library stores the data verbatim without attempting normalization. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="metadata_8c_source.html#l03181">3181</a> of file <aclass="el"href="metadata_8c_source.html">metadata.c</a>.</p>
<p>Retrieves the drive manufacturer metadata captured during imaging. </p>
<p>Copies the UTF-16LE encoded manufacturer name of the device used to read or write the medium. This information documents the hardware involved in the imaging process, which is crucial for forensic reporting and reproducibility studies.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">context</td><td>Pointer to a valid aaruformat context. </td></tr>
<tr><tdclass="paramname">buffer</td><td>Destination buffer for the manufacturer string. May be NULL when querying required length. </td></tr>
<tr><tdclass="paramname">length</td><td>Pointer to an int32_t specifying the buffer size on input and receiving the actual metadata length on output.</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following status codes: </dd></dl>
<dlclass="retval"><dt>Return values</dt><dd>
<tableclass="retval">
<tr><tdclass="paramname">AARUF_STATUS_OK</td><td>(0) Drive manufacturer metadata was copied successfully. </td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>(-1) The context pointer is invalid. </td></tr>
<tr><tdclass="paramname">AARUF_ERROR_METADATA_NOT_PRESENT</td><td>(-30) The image lacks drive manufacturer metadata. </td></tr>
<tr><tdclass="paramname">AARUF_ERROR_BUFFER_TOO_SMALL</td><td>(-10) The provided buffer is too small; *length holds the required size for a subsequent call.</td></tr>
</table>
</dd>
</dl>
<dlclass="section note"><dt>Note</dt><dd>The returned manufacturer string corresponds to the value recorded by <aclass="el"href="#a223856fa226b26c466997800183c97c4"title="Sets the drive manufacturer information for the image.">aaruf_set_drive_manufacturer()</a> and may include branding or OEM designations. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="metadata_8c_source.html#l02971">2971</a> of file <aclass="el"href="metadata_8c_source.html">metadata.c</a>.</p>
<p>Retrieves the device model information for the imaging drive. </p>
<p>Returns the UTF-16LE encoded model identifier for the drive used during acquisition. The model metadata provides finer granularity than the manufacturer name, enabling detailed documentation of imaging hardware capabilities and behavior.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">context</td><td>Pointer to a valid aaruformat context. </td></tr>
<tr><tdclass="paramname">buffer</td><td>Buffer that receives the model string; may be NULL while probing required capacity. </td></tr>
<tr><tdclass="paramname">length</td><td>Pointer to an int32_t indicating buffer size on input and receiving the metadata length on output.</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following status codes: </dd></dl>
<dlclass="retval"><dt>Return values</dt><dd>
<tableclass="retval">
<tr><tdclass="paramname">AARUF_STATUS_OK</td><td>(0) Drive model metadata was available and copied. </td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>(-1) The context pointer is invalid. </td></tr>
<tr><tdclass="paramname">AARUF_ERROR_METADATA_NOT_PRESENT</td><td>(-30) No drive model metadata exists in the image. </td></tr>
<tr><tdclass="paramname">AARUF_ERROR_BUFFER_TOO_SMALL</td><td>(-10) The supplied buffer was insufficient; *length is updated.</td></tr>
</table>
</dd>
</dl>
<dlclass="section note"><dt>Note</dt><dd>Model strings can include firmware suffixes, interface hints, or OEM variations. Consume the data verbatim to maintain accurate provenance records. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="metadata_8c_source.html#l03041">3041</a> of file <aclass="el"href="metadata_8c_source.html">metadata.c</a>.</p>
<p>Retrieves the imaging drive's serial number metadata. </p>
<p>Copies the UTF-16LE encoded serial number reported for the drive used during the imaging session. This metadata enables correlation between images and specific hardware units for forensic chain of custody or quality assurance workflows.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">context</td><td>Pointer to a valid aaruformat context. </td></tr>
<tr><tdclass="paramname">buffer</td><td>Destination buffer for the serial number; may be NULL when querying size. </td></tr>
<tr><tdclass="paramname">length</td><td>Pointer to an int32_t carrying the buffer size on input and receiving the actual serial number length on output.</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following status codes: </dd></dl>
<dlclass="retval"><dt>Return values</dt><dd>
<tableclass="retval">
<tr><tdclass="paramname">AARUF_STATUS_OK</td><td>(0) Drive serial number metadata was copied to <codeclass="param">buffer</code>. </td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>(-1) The context pointer is invalid. </td></tr>
<tr><tdclass="paramname">AARUF_ERROR_METADATA_NOT_PRESENT</td><td>(-30) No drive serial number metadata is available. </td></tr>
<tr><tdclass="paramname">AARUF_ERROR_BUFFER_TOO_SMALL</td><td>(-10) The provided buffer was insufficient.</td></tr>
</table>
</dd>
</dl>
<dlclass="section note"><dt>Note</dt><dd>Serial numbers are stored exactly as returned by the imaging hardware and may include leading zeros or spacing that should be preserved. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="metadata_8c_source.html#l03111">3111</a> of file <aclass="el"href="metadata_8c_source.html">metadata.c</a>.</p>
<p>Retrieves the logical CHS geometry from the AaruFormat image. </p>
<p>Reads the Cylinder-Head-Sector (CHS) geometry information from the image's geometry block and returns the values through output parameters. The geometry block contains legacy-style logical addressing parameters that describe how the storage medium was originally organized in terms of cylinders, heads (tracks per cylinder), and sectors per track. This information is essential for software that requires CHS addressing or for accurately representing the original medium's logical structure.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">context</td><td>Pointer to the aaruformat context (must be a valid, opened image context). </td></tr>
<tr><tdclass="paramname">cylinders</td><td>Pointer to store the number of cylinders. Updated on success. </td></tr>
<tr><tdclass="paramname">heads</td><td>Pointer to store the number of heads (tracks per cylinder). Updated on success. </td></tr>
<tr><tdclass="paramname">sectors_per_track</td><td>Pointer to store the number of sectors per track. Updated on success.</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following status codes: </dd></dl>
<dlclass="retval"><dt>Return values</dt><dd>
<tableclass="retval">
<tr><tdclass="paramname">AARUF_STATUS_OK</td><td>(0) Successfully retrieved geometry information. This is returned when:<ul>
<li>The context is valid and properly initialized</li>
<li>The geometry block is present in the image (identifier == GeometryBlock)</li>
<li>All three output parameters are successfully populated with geometry values</li>
<li>The cylinders parameter contains the total number of cylinders</li>
<li>The heads parameter contains the number of heads per cylinder</li>
<li>The sectors_per_track parameter contains the number of sectors per track</li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>(-1) The context is invalid. This occurs when:<ul>
<li>The context parameter is NULL</li>
<li>The context magic number doesn't match AARU_MAGIC (invalid context type)</li>
<li>The context was not properly initialized by <aclass="el"href="decls_8h.html#afc4932cdc795ffb2ef3a33d5b8c57656"title="Opens an existing AaruFormat image file.">aaruf_open()</a> or <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a></li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_CANNOT_READ_BLOCK</td><td>(-6) The geometry block is not present. This occurs when:<ul>
<li>The image was created without geometry information</li>
<li>The geometryBlock.identifier field doesn't equal GeometryBlock</li>
<li>The geometry block was not found during image opening</li>
<li>The image format doesn't support or require CHS geometry</li>
<li>Sector size is not included in the geometry block and must be obtained separately (typically 512 bytes for most block devices, but can vary)</li>
<li>The geometry represents logical addressing, not necessarily physical medium geometry</li>
<li>Modern storage devices often report translated or synthetic geometry values</li>
</ul>
</dd>
<dd>
CHS Addressing Context:<ul>
<li>CHS addressing was historically used for hard disk drives and floppy disks</li>
<li>Legacy BIOS and older operating systems relied on CHS parameters</li>
<li>LBA (Logical Block Addressing) has largely replaced CHS for modern devices</li>
<li>Some disk image formats and emulators still require CHS information</li>
</ul>
</dd>
<dd>
Geometry Block Availability:<ul>
<li>Not all image types contain geometry blocks</li>
<li>Optical media (CDs, DVDs) typically don't have CHS geometry</li>
<li>Modern large-capacity drives may not have meaningful CHS values</li>
<li>Check the return value to determine if geometry is available</li>
</ul>
</dd>
<dd>
Parameter Validation:<ul>
<li>All output parameters must be non-NULL valid pointers</li>
<li>The function does not validate the geometry values themselves</li>
<li>Geometry values of zero or unusually large values may indicate issues</li>
</ul>
</dd></dl>
<dlclass="section warning"><dt>Warning</dt><dd>The output parameters are only modified on success (AARUF_STATUS_OK). On error, their values remain unchanged. Initialize them before calling if default values are needed on failure.</dd>
<dd>
This function reads from the in-memory geometry block loaded during <aclass="el"href="decls_8h.html#afc4932cdc795ffb2ef3a33d5b8c57656"title="Opens an existing AaruFormat image file.">aaruf_open()</a>. It does not perform file I/O operations.</dd>
<dd>
Geometry values may not accurately represent physical device geometry, especially for modern drives with zone-based recording or flash storage. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="metadata_8c_source.html#l00094">94</a> of file <aclass="el"href="metadata_8c_source.html">metadata.c</a>.</p>
<p>Retrieves a deep copy of the <aclass="el"href="structImageInfo.html"title="High-level summary of an opened Aaru image containing metadata and media characteristics.">ImageInfo</a> structure from the AaruFormat image. </p>
<p>Returns a complete copy of the high-level image information summary containing metadata such as image size, sector count, sector size, version information, creation timestamps, and media type. This function performs a deep copy of all fields including string buffers, ensuring the caller receives a complete, independent copy of the image information.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">context</td><td>Pointer to the aaruformat context (must be a valid, opened image context). </td></tr>
<tr><tdclass="paramname">image_info</td><td>Pointer to an <aclass="el"href="structImageInfo.html"title="High-level summary of an opened Aaru image containing metadata and media characteristics.">ImageInfo</a> structure to receive the copied data. Must be a valid pointer to allocated memory.</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following status codes: </dd></dl>
<dlclass="retval"><dt>Return values</dt><dd>
<tableclass="retval">
<tr><tdclass="paramname">AARUF_STATUS_OK</td><td>(0) Successfully copied image info. The image_info parameter contains a complete copy of all fields including:<ul>
<li>LastModificationTime: Last modification timestamp (Windows FILETIME)</li>
<li><aclass="el"href="group__MediaTypes.html#ga1499e9f8a76cb81b43b7a4b0dbe7e44a"title="Enumerates every recognized media / cartridge / optical / tape / card / disk format.">MediaType</a>: Media type identifier</li>
<li>MetadataMediaType: Media type for sidecar generation</li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>(-1) The context is invalid. This occurs when:<ul>
<li>The context parameter is NULL</li>
<li>The context magic number doesn't match AARU_MAGIC</li>
<li>The context was not properly initialized</li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dlclass="section note"><dt>Note</dt><dd>The <aclass="el"href="structImageInfo.html"title="High-level summary of an opened Aaru image containing metadata and media characteristics.">ImageInfo</a> structure contains fixed-size character arrays that are properly NUL-terminated, making it safe to use as C strings.</dd>
<dd>
This function performs a complete deep copy using memcpy, copying all fields including strings, integers, and timestamps.</dd>
<dd>
The caller is responsible for allocating the <aclass="el"href="structImageInfo.html"title="High-level summary of an opened Aaru image containing metadata and media characteristics.">ImageInfo</a> structure before calling this function. The structure is not dynamically allocated by this function.</dd></dl>
<dlclass="section warning"><dt>Warning</dt><dd>The image_info parameter must point to valid, allocated memory of at least sizeof(ImageInfo) bytes. Passing NULL or invalid pointers will result in undefined behavior.</dd>
<dd>
This function reads from the in-memory image_info loaded during <aclass="el"href="decls_8h.html#afc4932cdc795ffb2ef3a33d5b8c57656"title="Opens an existing AaruFormat image file.">aaruf_open()</a> or populated during <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a>. It does not perform file I/O operations. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="metadata_8c_source.html#l03637">3637</a> of file <aclass="el"href="metadata_8c_source.html">metadata.c</a>.</p>
<p>Retrieves the barcode assigned to the physical media or its packaging. </p>
<p>Returns the UTF-16LE encoded barcode string that was captured when the image was created. Barcodes are commonly used in institutional workflows for inventory tracking and automated retrieval.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">context</td><td>Pointer to a valid aaruformat context. </td></tr>
<tr><tdclass="paramname">buffer</td><td>Buffer that receives the barcode string; may be NULL when probing size requirements. </td></tr>
<tr><tdclass="paramname">length</td><td>Pointer to an int32_t specifying the buffer size on input and receiving the actual barcode length on output.</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following status codes: </dd></dl>
<dlclass="retval"><dt>Return values</dt><dd>
<tableclass="retval">
<tr><tdclass="paramname">AARUF_STATUS_OK</td><td>(0) Barcode metadata was present and copied successfully. </td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>(-1) The context pointer is invalid. </td></tr>
<tr><tdclass="paramname">AARUF_ERROR_METADATA_NOT_PRESENT</td><td>(-30) No barcode metadata exists in the image. </td></tr>
<tr><tdclass="paramname">AARUF_ERROR_BUFFER_TOO_SMALL</td><td>(-10) The supplied buffer was too small.</td></tr>
</table>
</dd>
</dl>
<dlclass="section note"><dt>Note</dt><dd>Barcode values can be strict alphanumeric codes (e.g., LTO cartridge IDs) or full strings from custom labeling systems. Preserve the returned string exactly for catalog interoperability. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="metadata_8c_source.html#l02828">2828</a> of file <aclass="el"href="metadata_8c_source.html">metadata.c</a>.</p>
<p>Retrieves the recorded media manufacturer name. </p>
<p>Provides access to the UTF-16LE encoded manufacturer metadata that identifies the company which produced the physical medium. This information is taken from the MetadataBlock and mirrors the value previously stored via <aclass="el"href="#add92b8c91ede6a62dfda5f8980c3ce6d"title="Sets the media manufacturer information for the image.">aaruf_set_media_manufacturer()</a>.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">context</td><td>Pointer to a valid aaruformat context. </td></tr>
<tr><tdclass="paramname">buffer</td><td>Buffer that receives the manufacturer string. May be NULL when probing size. </td></tr>
<tr><tdclass="paramname">length</td><td>Pointer to an int32_t specifying the buffer size on input and receiving the actual manufacturer string length on output.</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following status codes: </dd></dl>
<dlclass="retval"><dt>Return values</dt><dd>
<tableclass="retval">
<tr><tdclass="paramname">AARUF_STATUS_OK</td><td>(0) Manufacturer metadata was available and copied. </td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>(-1) The context pointer is invalid. </td></tr>
<tr><tdclass="paramname">AARUF_ERROR_METADATA_NOT_PRESENT</td><td>(-30) The image lacks manufacturer metadata. </td></tr>
<tr><tdclass="paramname">AARUF_ERROR_BUFFER_TOO_SMALL</td><td>(-10) The provided buffer was too small; *length indicates size.</td></tr>
</table>
</dd>
</dl>
<dlclass="section note"><dt>Note</dt><dd>Values may include trailing spaces or vendor-specific capitalization. Treat the returned data as authoritative and avoid trimming unless required by the consuming application. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="metadata_8c_source.html#l02619">2619</a> of file <aclass="el"href="metadata_8c_source.html">metadata.c</a>.</p>
<p>Retrieves the media model or product designation metadata. </p>
<p>Returns the UTF-16LE encoded model name that specifies the exact product variant of the physical medium. The function mirrors the set counterpart and is useful for accurately documenting media specifications during preservation workflows.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">context</td><td>Pointer to a valid aaruformat context. </td></tr>
<tr><tdclass="paramname">buffer</td><td>Destination buffer for the model string; may be NULL when querying required size. </td></tr>
<tr><tdclass="paramname">length</td><td>Pointer to an int32_t that on input contains the buffer capacity in bytes and on output is updated with the actual metadata length.</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following status codes: </dd></dl>
<dlclass="retval"><dt>Return values</dt><dd>
<tableclass="retval">
<tr><tdclass="paramname">AARUF_STATUS_OK</td><td>(0) Model metadata was successfully copied. </td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>(-1) The context pointer is invalid. </td></tr>
<tr><tdclass="paramname">AARUF_ERROR_METADATA_NOT_PRESENT</td><td>(-30) No media model metadata is present in the image. </td></tr>
<tr><tdclass="paramname">AARUF_ERROR_BUFFER_TOO_SMALL</td><td>(-10) The caller-provided buffer is too small.</td></tr>
</table>
</dd>
</dl>
<dlclass="section note"><dt>Note</dt><dd>Model strings often contain performance ratings (e.g., "16x", "LTO-7"). The data is opaque and should be handled without modification unless necessary. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="metadata_8c_source.html#l02689">2689</a> of file <aclass="el"href="metadata_8c_source.html">metadata.c</a>.</p>
<p>Retrieves the media part number recorded in the MetadataBlock. </p>
<p>Provides access to the UTF-16LE encoded part number identifying the precise catalog or ordering code for the physical medium. Part numbers help archivists procure exact replacements and document specific media variants used during acquisition.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">context</td><td>Pointer to a valid aaruformat context. </td></tr>
<tr><tdclass="paramname">buffer</td><td>Destination buffer for the part number string. May be NULL while querying size. </td></tr>
<tr><tdclass="paramname">length</td><td>Pointer to an int32_t that supplies the buffer size on input and is updated with the actual part number length on output.</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following status codes: </dd></dl>
<dlclass="retval"><dt>Return values</dt><dd>
<tableclass="retval">
<tr><tdclass="paramname">AARUF_STATUS_OK</td><td>(0) Part number metadata was returned successfully. </td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>(-1) The context pointer is invalid. </td></tr>
<tr><tdclass="paramname">AARUF_ERROR_METADATA_NOT_PRESENT</td><td>(-30) No part number metadata exists. </td></tr>
<tr><tdclass="paramname">AARUF_ERROR_BUFFER_TOO_SMALL</td><td>(-10) The provided buffer was insufficient; *length contains the required size.</td></tr>
</table>
</dd>
</dl>
<dlclass="section note"><dt>Note</dt><dd>Part numbers may include manufacturer-specific formatting such as hyphens or suffix letters. The library stores and returns the data verbatim. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="metadata_8c_source.html#l02899">2899</a> of file <aclass="el"href="metadata_8c_source.html">metadata.c</a>.</p>
<p>Retrieves the media sequence metadata for multi-volume image sets. </p>
<p>Reads the media sequence fields stored in the MetadataBlock header and returns the current media number together with the final media number for the complete set. This information indicates the position of the imaged medium within a multi-volume collection (for example, "disc 2 of 5"). The function operates entirely on in-memory structures populated during <aclass="el"href="decls_8h.html#afc4932cdc795ffb2ef3a33d5b8c57656"title="Opens an existing AaruFormat image file.">aaruf_open()</a>; no additional disk I/O is performed.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">context</td><td>Pointer to an initialized aaruformat context opened for reading or writing. </td></tr>
<tr><tdclass="paramname">sequence</td><td>Pointer that receives the current media sequence number (typically 1-based). </td></tr>
<tr><tdclass="paramname">last_sequence</td><td>Pointer that receives the total number of media in the set.</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following status codes: </dd></dl>
<dlclass="retval"><dt>Return values</dt><dd>
<tableclass="retval">
<tr><tdclass="paramname">AARUF_STATUS_OK</td><td>(0) Metadata was present and the output parameters were populated. </td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>(-1) The provided context pointer is NULL or not an aaruformat context (magic mismatch). </td></tr>
<tr><tdclass="paramname">AARUF_ERROR_METADATA_NOT_PRESENT</td><td>(-30) The MetadataBlock was not present in the image, making sequence data unavailable.</td></tr>
</table>
</dd>
</dl>
<dlclass="section note"><dt>Note</dt><dd>For standalone media, both sequence and last_sequence are commonly set to 1. Some creators may also set them to 0 to indicate the absence of sequence semantics; callers should handle either pattern gracefully.</dd>
<dd>
The function does not validate logical consistency (e.g., whether sequence <= last_sequence); it simply returns the values stored in the image header. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="metadata_8c_source.html#l02340">2340</a> of file <aclass="el"href="metadata_8c_source.html">metadata.c</a>.</p>
<p>Retrieves the media serial number recorded in the image metadata. </p>
<p>Copies the UTF-16LE encoded serial number identifying the specific physical medium. Serial numbers are particularly important for forensic tracking and archival provenance, enabling correlation between the physical item and its digital representation.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">context</td><td>Pointer to a valid aaruformat context. </td></tr>
<tr><tdclass="paramname">buffer</td><td>Destination buffer for the serial number. May be NULL to determine required size. </td></tr>
<tr><tdclass="paramname">length</td><td>Pointer to an int32_t that on input holds the buffer size and on output receives the actual serial number length.</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following status codes: </dd></dl>
<dlclass="retval"><dt>Return values</dt><dd>
<tableclass="retval">
<tr><tdclass="paramname">AARUF_STATUS_OK</td><td>(0) Serial number metadata was copied into <codeclass="param">buffer</code>. </td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>(-1) The context pointer is invalid. </td></tr>
<tr><tdclass="paramname">AARUF_ERROR_METADATA_NOT_PRESENT</td><td>(-30) No serial number metadata was stored in the image. </td></tr>
<tr><tdclass="paramname">AARUF_ERROR_BUFFER_TOO_SMALL</td><td>(-10) The provided buffer was too small.</td></tr>
</table>
</dd>
</dl>
<dlclass="section note"><dt>Note</dt><dd>Serial numbers may contain spaces, hyphens, or alphanumeric characters. The library does not normalize or validate these strings. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="metadata_8c_source.html#l02759">2759</a> of file <aclass="el"href="metadata_8c_source.html">metadata.c</a>.</p>
<p>Retrieves the media title or label captured during image creation. </p>
<p>Returns the UTF-16LE encoded media title string, representing markings or labels present on the original physical media. This function allows applications to present or archive the media title alongside the image, preserving contextual information from the physical artifact.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">context</td><td>Pointer to a valid aaruformat context. </td></tr>
<tr><tdclass="paramname">buffer</td><td>Destination buffer for the UTF-16LE title string. May be NULL when querying size. </td></tr>
<tr><tdclass="paramname">length</td><td>Pointer to an int32_t that on input holds the buffer capacity in bytes and on output receives the actual title length.</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following status codes: </dd></dl>
<dlclass="retval"><dt>Return values</dt><dd>
<tableclass="retval">
<tr><tdclass="paramname">AARUF_STATUS_OK</td><td>(0) The media title was available and copied to <codeclass="param">buffer</code>. </td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>(-1) The context pointer is invalid. </td></tr>
<tr><tdclass="paramname">AARUF_ERROR_METADATA_NOT_PRESENT</td><td>(-30) No media title metadata exists. </td></tr>
<tr><tdclass="paramname">AARUF_ERROR_BUFFER_TOO_SMALL</td><td>(-10) The supplied buffer was insufficient.</td></tr>
</table>
</dd>
</dl>
<dlclass="section note"><dt>Note</dt><dd>Titles may contain international characters, control codes, or mixed casing. The library does not attempt to sanitize or interpret the string. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="metadata_8c_source.html#l02549">2549</a> of file <aclass="el"href="metadata_8c_source.html">metadata.c</a>.</p>
<p>Retrieves the number of negative (pre-gap) sectors in the AaruFormat image. </p>
<p>Returns the count of negative sectors that precede the standard user data area. Negative sectors are used to capture pre-gap data, lead-in areas, and other metadata that exists before the main user-accessible storage region. This is particularly important for optical media (CD, DVD, BD) where the lead-in contains the Table of Contents (TOC) and other essential disc structures, and for audio CDs where pre-gap sectors contain silence or hidden tracks. For most hard disk and floppy disk images, this value is typically zero.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">context</td><td>Pointer to a valid aaruformat context (must be properly initialized). </td></tr>
<tr><tdclass="paramname">sectors</td><td>Pointer to a uint16_t that receives the negative sector count on success.</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following status codes: </dd></dl>
<dlclass="retval"><dt>Return values</dt><dd>
<tableclass="retval">
<tr><tdclass="paramname">AARUF_STATUS_OK</td><td>(0) Successfully retrieved the negative sector count. This is returned when:<ul>
<li>The context is valid and properly initialized</li>
<li>The context magic number matches AARU_MAGIC</li>
<li>The sectors parameter is successfully populated with the negative sector count</li>
<li>The value is taken from ctx->user_data_ddt_header.negative</li>
<li>For optical media with lead-in data: sectors may be non-zero</li>
<li>For standard hard disk/floppy images: sectors is typically 0</li>
<li>Maximum value is 65,535 (uint16_t limit)</li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>(-1) The context is invalid. This occurs when:<ul>
<li>The context parameter is NULL</li>
<li>The context magic number doesn't match AARU_MAGIC (invalid context type)</li>
<li>The context was not properly initialized by <aclass="el"href="decls_8h.html#afc4932cdc795ffb2ef3a33d5b8c57656"title="Opens an existing AaruFormat image file.">aaruf_open()</a> or <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a></li>
<li>When calling <aclass="el"href="decls_8h.html#a2297e89619ba11cb0a0779a985fc1c34"title="Reads a sector from the AaruFormat image.">aaruf_read_sector()</a> or <aclass="el"href="decls_8h.html#a4b8cd2bb5fd9e2c670a0a13695c6f9e3"title="Writes a sector to the AaruFormat image.">aaruf_write_sector()</a>:<ul>
<li>Use sector_address in range [0, negative_sectors - 1]</li>
<li>The actual logical position is before the user data area</li>
</ul>
</li>
</ul>
</dd>
<dd>
Optical Media Context:<ul>
<li><b>CD-ROM/CD-DA</b>: Negative sectors contain lead-in area with TOC (Table of Contents). The lead-in typically spans LBA -450000 to -1, though only a portion may be captured. Pre-gap sectors (usually 150 sectors/2 seconds before each track) may also be stored as negative sectors for the first track.</li>
<li><b>DVD</b>: May contain lead-in with disc structure information, copyright data, and region codes. The lead-in area varies by format (DVD-ROM, DVD-R, DVD+R, etc.).</li>
<li><b>Blu-ray</b>: Lead-in contains disc information, burst cutting area (BCA), and other metadata. The structure differs between BD-ROM, BD-R, and BD-RE.</li>
</ul>
</dd>
<dd>
Hard Disk and Floppy Context:<ul>
<li>Hard disk drives: Negative sectors are typically zero unless capturing special manufacturer reserved areas (HPA, DCO) that precede the standard user area.</li>
<li>Floppy disks: Negative sectors are typically zero as floppies have a simple linear sector layout without lead-in areas.</li>
</ul>
</dd>
<dd>
Audio CD Hidden Tracks:<ul>
<li>Some audio CDs contain hidden tracks in the pre-gap of the first track</li>
<li>These pre-gap sectors can extend up to several minutes before track 1</li>
<li>Negative sectors can capture this "hidden" audio data</li>
<li>The pre-gap for track 1 typically starts at LBA -150 (2 seconds)</li>
</ul>
</dd>
<dd>
DDT Header Source:<ul>
<li>The value is retrieved from ctx->user_data_ddt_header.negative</li>
<li>The DDT (Deduplication and Data Table) header tracks all sector allocation</li>
<li>This field is populated during image creation with <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a></li>
<li>The value is fixed for read-only images opened with <aclass="el"href="decls_8h.html#afc4932cdc795ffb2ef3a33d5b8c57656"title="Opens an existing AaruFormat image file.">aaruf_open()</a></li>
<li>Maximum representable value is 65,535 (uint16_t)</li>
<li>The negative region comes first in logical order</li>
<li>Followed by the user region [0, user_sectors - 1]</li>
<li>Followed by the overflow region if present</li>
</ul>
</dd>
<dd>
Relationship to Image Creation:<ul>
<li>The negative_sectors value is specified when calling <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a></li>
<li>It should be set based on the medium type and imaging requirements:<ul>
<li>Optical discs: Set to the number of lead-in sectors captured</li>
<li>Hard disks: Typically 0, unless capturing HPA/DCO areas</li>
<li>Floppy disks: Typically 0</li>
<li>Audio CDs: May be non-zero to capture pre-gap hidden tracks</li>
</ul>
</li>
</ul>
</dd></dl>
<dlclass="section warning"><dt>Warning</dt><dd>The sectors parameter is only modified on success (AARUF_STATUS_OK). On error, its value remains unchanged. Initialize it before calling if a default value is needed on failure.</dd>
<dd>
This function reads from the in-memory DDT header loaded during <aclass="el"href="decls_8h.html#afc4932cdc795ffb2ef3a33d5b8c57656"title="Opens an existing AaruFormat image file.">aaruf_open()</a> or set during <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a>. It does not perform file I/O operations and executes quickly.</dd>
<dd>
The maximum negative sector count is 65,535 due to the uint16_t storage type. If imaging optical media with larger lead-in areas, some data may not be representable. This limit is generally sufficient for most practical cases.</dd>
<dd>
Negative sector data may contain copy-protected or encrypted content (e.g., CSS on DVDs, AACS on Blu-rays). Handle this data according to applicable laws and licensing agreements. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="metadata_8c_source.html#l03420">3420</a> of file <aclass="el"href="metadata_8c_source.html">metadata.c</a>.</p>
<p>Retrieves the number of overflow (post-gap) sectors in the AaruFormat image. </p>
<p>Returns the count of overflow sectors that follow the standard user data area. Overflow sectors are used to capture post-gap data, lead-out areas, and other metadata that exists after the main user-accessible storage region. This is particularly important for optical media (CD, DVD, BD) where the lead-out marks the physical end of the recorded data and contains disc finalization information, and for multi-session discs where gaps between sessions need to be preserved. For most hard disk and floppy disk images, this value is typically zero.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">context</td><td>Pointer to a valid aaruformat context (must be properly initialized). </td></tr>
<tr><tdclass="paramname">sectors</td><td>Pointer to a uint16_t that receives the overflow sector count on success.</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following status codes: </dd></dl>
<dlclass="retval"><dt>Return values</dt><dd>
<tableclass="retval">
<tr><tdclass="paramname">AARUF_STATUS_OK</td><td>(0) Successfully retrieved the overflow sector count. This is returned when:<ul>
<li>The context is valid and properly initialized</li>
<li>The context magic number matches AARU_MAGIC</li>
<li>The sectors parameter is successfully populated with the overflow sector count</li>
<li>The value is taken from ctx->user_data_ddt_header.overflow</li>
<li>For optical media with lead-out data: sectors may be non-zero</li>
<li>For standard hard disk/floppy images: sectors is typically 0</li>
<li>Maximum value is 65,535 (uint16_t limit)</li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>(-1) The context is invalid. This occurs when:<ul>
<li>The context parameter is NULL</li>
<li>The context magic number doesn't match AARU_MAGIC (invalid context type)</li>
<li>The context was not properly initialized by <aclass="el"href="decls_8h.html#afc4932cdc795ffb2ef3a33d5b8c57656"title="Opens an existing AaruFormat image file.">aaruf_open()</a> or <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a></li>
<li>When calling <aclass="el"href="decls_8h.html#a2297e89619ba11cb0a0779a985fc1c34"title="Reads a sector from the AaruFormat image.">aaruf_read_sector()</a> or <aclass="el"href="decls_8h.html#a4b8cd2bb5fd9e2c670a0a13695c6f9e3"title="Writes a sector to the AaruFormat image.">aaruf_write_sector()</a>:<ul>
<li>Use sector_address in range [user_sectors, user_sectors + overflow_sectors - 1]</li>
<li>The actual logical position is after the user data area</li>
</ul>
</li>
</ul>
</dd>
<dd>
Optical Media Context:<ul>
<li><b>CD-ROM/CD-DA</b>: Overflow sectors contain the lead-out area, which marks the physical end of the disc's recorded data. The lead-out consists of unreadable sectors filled with specific patterns.</li>
<li><b>DVD</b>: May contain lead-out with disc finalization data, middle area (for dual-layer), and outer zone. DVD+R/RW discs may have substantial lead-out areas.</li>
<li><b>Blu-ray</b>: Lead-out contains disc finalization markers and padding. For multi-layer discs, may include middle zones and outer areas.</li>
</ul>
</dd>
<dd>
Multi-Session and Track Context:<ul>
<li>Multi-session optical discs have gaps between sessions</li>
<li>Audio CDs with post-gap after the last track may use overflow sectors</li>
<li>Track post-gaps (silence after audio tracks) typically 2 seconds/150 sectors</li>
</ul>
</dd>
<dd>
Hard Disk and Floppy Context:<ul>
<li>Hard disk drives: Overflow sectors are typically zero unless capturing special manufacturer reserved areas (like DCO or HPA) that follow the standard user area.</li>
<li>Floppy disks: Overflow sectors are typically zero as floppies have a simple linear sector layout without lead-out areas. They may contain mastering information.</li>
<li>Some proprietary copy protection schemes may place data beyond the normal capacity, which could be captured as overflow sectors.</li>
</ul>
</dd>
<dd>
DDT Header Source:<ul>
<li>The value is retrieved from ctx->user_data_ddt_header.overflow</li>
<li>The DDT (Deduplication and Data Table) header tracks all sector allocation</li>
<li>This field is populated during image creation with <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a></li>
<li>The value is fixed for read-only images opened with <aclass="el"href="decls_8h.html#afc4932cdc795ffb2ef3a33d5b8c57656"title="Opens an existing AaruFormat image file.">aaruf_open()</a></li>
<li>Maximum representable value is 65,535 (uint16_t)</li>
<li>The negative region comes first in logical order</li>
<li>Followed by the user region [0, user_sectors - 1]</li>
<li>Followed by the overflow region at the end</li>
<li>Overflow represents the final addressable range in the image</li>
</ul>
</dd>
<dd>
Relationship to Image Creation:<ul>
<li>The overflow_sectors value is specified when calling <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a></li>
<li>It should be set based on the medium type and imaging requirements:<ul>
<li>Optical discs: Set to the number of lead-out sectors captured</li>
<li>Multi-session discs: May include inter-session gaps</li>
<li>Hard disks: Typically 0, unless capturing post-user reserved areas</li>
<li>Floppy disks: Typically 0</li>
<li>Copy-protected media: May be non-zero to capture protection schemes</li>
</ul>
</li>
</ul>
</dd>
<dd>
Forensic Imaging Considerations:<ul>
<li>Some copy protection schemes intentionally place data in overflow regions</li>
<li>These "overburn" areas extend beyond the disc's rated capacity</li>
<li>Overflow sectors ensure complete forensic capture of all readable data</li>
<li>Important for authenticity verification and copy protection analysis</li>
</ul>
</dd></dl>
<dlclass="section warning"><dt>Warning</dt><dd>The sectors parameter is only modified on success (AARUF_STATUS_OK). On error, its value remains unchanged. Initialize it before calling if a default value is needed on failure.</dd>
<dd>
This function reads from the in-memory DDT header loaded during <aclass="el"href="decls_8h.html#afc4932cdc795ffb2ef3a33d5b8c57656"title="Opens an existing AaruFormat image file.">aaruf_open()</a> or set during <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a>. It does not perform file I/O operations and executes quickly.</dd>
<dd>
The maximum overflow sector count is 65,535 due to the uint16_t storage type. If imaging optical media with larger lead-out areas or extensive overburn regions, some data may not be representable. This limit is generally sufficient for most practical cases.</dd>
<dd>
Overflow sector data may be difficult or impossible to read on some drives, as it often resides in lead-out areas or beyond rated capacity. The presence of overflow sectors in an image indicates the imaging drive was capable of reading these extended areas, but other drives may not be able to access them. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="metadata_8c_source.html#l03555">3555</a> of file <aclass="el"href="metadata_8c_source.html">metadata.c</a>.</p>
<p>Retrieves the total number of user-accessible sectors in the AaruFormat image. </p>
<p>Returns the count of standard user data sectors in the image, excluding any negative (pre-gap) or overflow (post-gap) sectors. This represents the primary addressable sector range that contains the main user data, typically corresponding to the logical capacity of the storage medium as it would be seen by an operating system or file system. For optical media, this excludes lead-in and lead-out areas. For hard disks, this represents the standard LBA-addressable range.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">context</td><td>Pointer to a valid aaruformat context (must be properly initialized). </td></tr>
<tr><tdclass="paramname">sectors</td><td>Pointer to a uint64_t that receives the total user sector count on success.</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following status codes: </dd></dl>
<dlclass="retval"><dt>Return values</dt><dd>
<tableclass="retval">
<tr><tdclass="paramname">AARUF_STATUS_OK</td><td>(0) Successfully retrieved the user sector count. This is returned when:<ul>
<li>The context is valid and properly initialized</li>
<li>The context magic number matches AARU_MAGIC</li>
<li>The sectors parameter is successfully populated with the user sector count</li>
<li>The value is taken from ctx->user_data_ddt_header.blocks</li>
<li>For block devices: sectors typically equals the total capacity in sectors</li>
<li>For optical media: sectors represents the user data area excluding lead-in/lead-out</li>
<li>For tape media: sectors may represent the total block count across all files</li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>(-1) The context is invalid. This occurs when:<ul>
<li>The context parameter is NULL</li>
<li>The context magic number doesn't match AARU_MAGIC (invalid context type)</li>
<li>The context was not properly initialized by <aclass="el"href="decls_8h.html#afc4932cdc795ffb2ef3a33d5b8c57656"title="Opens an existing AaruFormat image file.">aaruf_open()</a> or <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a></li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dlclass="section note"><dt>Note</dt><dd>Sector Range Context:<ul>
<li>User sectors represent the standard addressable range: 0 to (user_sectors - 1)</li>
<li>Negative sectors precede user sectors (pre-gap, lead-in)</li>
<li>Overflow sectors follow user sectors (post-gap, lead-out)</li>
<li>Use <aclass="el"href="#a8e00d26a8e751fbd412868ac4f92a3c0"title="Retrieves the number of negative (pre-gap) sectors in the AaruFormat image.">aaruf_get_negative_sectors()</a> to get the negative sector count</li>
<li>Use <aclass="el"href="#aeeae64b120a10bac5e3d757a07a9691a"title="Retrieves the number of overflow (post-gap) sectors in the AaruFormat image.">aaruf_get_overflow_sectors()</a> to get the overflow sector count</li>
</ul>
</dd>
<dd>
Media Type Considerations:<ul>
<li><b>Optical Media (CD/DVD/BD)</b>: User sectors exclude lead-in and lead-out areas. Negative sectors may contain TOC and pre-gap data. Overflow sectors may contain post-gap and lead-out data.</li>
<li><b>Hard Disk Drives</b>: User sectors represent the full LBA range. Negative and overflow sectors are typically zero unless capturing special areas.</li>
<li><b>Floppy Disks</b>: User sectors represent the standard formatted capacity.</li>
<li><b>Tape Media</b>: User sectors may represent the total block count. Negative and overflow sectors are typically not used for tape.</li>
</ul>
</dd>
<dd>
DDT Header Source:<ul>
<li>The value is retrieved from ctx->user_data_ddt_header.blocks</li>
<li>The DDT (Deduplication and Data Table) header tracks sector allocation</li>
<li>This field is populated during image creation with <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a></li>
<li>The value is fixed for read-only images opened with <aclass="el"href="decls_8h.html#afc4932cdc795ffb2ef3a33d5b8c57656"title="Opens an existing AaruFormat image file.">aaruf_open()</a></li>
<li>For write-enabled images, this represents the allocated capacity</li>
<li>When reading/writing sectors with <aclass="el"href="decls_8h.html#a2297e89619ba11cb0a0779a985fc1c34"title="Reads a sector from the AaruFormat image.">aaruf_read_sector()</a> or <aclass="el"href="decls_8h.html#a4b8cd2bb5fd9e2c670a0a13695c6f9e3"title="Writes a sector to the AaruFormat image.">aaruf_write_sector()</a>:<ul>
<li>Set negative=false and use sector_address in range [0, user_sectors - 1]</li>
<li>For negative sectors: set negative=true, sector_address in [0, negative_sectors - 1]</li>
<li>For overflow sectors: set negative=false, sector_address in [user_sectors, user_sectors + overflow_sectors</li>
</ul>
</li>
</ul>
</dd></dl>
<ul>
<li>1]</li>
</ul>
<dlclass="section note"><dt>Note</dt><dd>Relationship to Image Creation:<ul>
<li>The user_sectors value is specified when calling <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a></li>
<li>It should match the logical capacity of the medium being imaged</li>
<li>For forensic images, ensure it matches the source medium exactly</li>
<li>For virtual disks, set it to the desired capacity </li>
<pclass="definition">Definition at line <aclass="el"href="metadata_8c_source.html#l03295">3295</a> of file <aclass="el"href="metadata_8c_source.html">metadata.c</a>.</p>
<p>Sets the Aaru metadata JSON for the image during creation. </p>
<p>Embeds Aaru metadata JSON into the image being created. The Aaru metadata JSON format is a structured, machine-readable representation of comprehensive image metadata including media information, imaging session details, hardware configuration, optical disc tracks and sessions, checksums, and preservation metadata. This function stores the JSON payload in its original form without parsing or validation, allowing callers to provide pre-generated JSON conforming to the Aaru metadata schema. The JSON data will be written to the image file during <aclass="el"href="decls_8h.html#a6823e139f81a9dfd08efcb0e9b213a49"title="Close an Aaru image context, flushing pending data structures and releasing resources.">aaruf_close()</a> as an AaruMetadataJsonBlock.</p>
<p>The function accepts raw UTF-8 encoded JSON data as an opaque byte array and creates an internal copy that persists for the lifetime of the context. If Aaru JSON metadata was previously set on this context, the old data is freed and replaced with the new JSON. The JSON is treated as opaque binary data by the library; no parsing, interpretation, or schema validation is performed during the set operation.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">context</td><td>Pointer to the aaruformat context (must be a valid, write-enabled image context). </td></tr>
<tr><tdclass="paramname">data</td><td>Pointer to the Aaru metadata JSON data in UTF-8 encoding (opaque byte array). The JSON should conform to the Aaru metadata schema, though this is not validated. Must not be NULL. </td></tr>
<tr><tdclass="paramname">length</td><td>Length of the JSON data in bytes. The payload may or may not be null-terminated; the length should reflect the actual JSON data size.</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following status codes: </dd></dl>
<dlclass="retval"><dt>Return values</dt><dd>
<tableclass="retval">
<tr><tdclass="paramname">AARUF_STATUS_OK</td><td>(0) Successfully set Aaru metadata JSON. This is returned when:<ul>
<li>The context is valid and properly initialized</li>
<li>The context is opened in write mode (ctx->isWriting is true)</li>
<li>Memory allocation for the JSON data succeeded</li>
<li>The JSON data is copied to ctx->jsonBlock</li>
<li>The jsonBlockHeader is initialized with identifier AaruMetadataJsonBlock</li>
<li>The jsonBlockHeader.length field is set to the provided length</li>
<li>Any previous Aaru JSON data is properly freed before replacement</li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>(-1) The context is invalid. This occurs when:<ul>
<li>The context parameter is NULL</li>
<li>The context magic number doesn't match AARU_MAGIC (invalid context type)</li>
<li>The context was not properly initialized by <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a></li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_READ_ONLY</td><td>(-13) The context is not opened for writing. This occurs when:<ul>
<li>The image was opened with <aclass="el"href="decls_8h.html#afc4932cdc795ffb2ef3a33d5b8c57656"title="Opens an existing AaruFormat image file.">aaruf_open()</a> instead of <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a></li>
<li>The context's isWriting flag is false</li>
<li>Attempting to modify a read-only image</li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_ENOUGH_MEMORY</td><td>(-8) Memory allocation failed. This occurs when:<ul>
<li>malloc() failed to allocate the required memory for the JSON data</li>
<li>System is out of memory or memory is severely fragmented</li>
<li>The requested allocation size is too large</li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dlclass="section note"><dt>Note</dt><dd>Aaru JSON Format and Encoding:<ul>
<li>The JSON payload must be valid UTF-8 encoded data</li>
<li>The payload may or may not be null-terminated</li>
<li>The library treats the JSON as opaque binary data</li>
<li>No JSON parsing, interpretation, or validation is performed during set</li>
<li>Schema compliance is the caller's responsibility</li>
<li>Ensure the JSON conforms to the Aaru metadata schema for compatibility</li>
</ul>
</dd>
<dd>
Aaru Metadata JSON Purpose:<ul>
<li>Provides machine-readable structured metadata using modern JSON format</li>
<li>Includes comprehensive information about media, sessions, tracks, and checksums</li>
<li>Enables programmatic access to metadata without XML parsing overhead</li>
<li>Documents imaging session details, hardware configuration, and preservation data</li>
<li>Used by Aaru and compatible tools for metadata exchange and analysis</li>
<li>Complements or serves as alternative to CICM XML metadata</li>
</ul>
</dd>
<dd>
JSON Content Examples:<ul>
<li>Media type and physical characteristics</li>
<li>Track and session information for optical media</li>
<li>Partition and filesystem metadata</li>
<li><aclass="el"href="structChecksums.html"title="Collected whole‑image checksums / hashes present in a checksum block.">Checksums</a> (MD5, SHA-1, SHA-256, etc.) for integrity verification</li>
<li>Hardware information (drive manufacturer, model, firmware)</li>
<li>Imaging software version and configuration</li>
<li>Timestamps for image creation and modification</li>
</ul>
</dd>
<dd>
Memory Management:<ul>
<li>The function creates an internal copy of the JSON data</li>
<li>The caller retains ownership of the input data buffer</li>
<li>The caller may free the input data immediately after this function returns</li>
<li>The internal copy is freed automatically during <aclass="el"href="decls_8h.html#a6823e139f81a9dfd08efcb0e9b213a49"title="Close an Aaru image context, flushing pending data structures and releasing resources.">aaruf_close()</a></li>
<li>Calling this function multiple times replaces previous JSON data</li>
</ul>
</dd>
<dd>
Relationship to CICM XML:<ul>
<li>Both CICM XML and Aaru JSON can be set on the same image</li>
<li>CICM XML follows the Canary Islands Computer Museum schema (older format)</li>
<li>Aaru JSON follows the Aaru-specific metadata schema (newer format)</li>
<li>Setting one does not affect the other</li>
<li>Different tools may prefer one format over the other</li>
<li>Consider including both for maximum compatibility</li>
</ul>
</dd></dl>
<dlclass="section warning"><dt>Warning</dt><dd>The Aaru JSON block is only written to the image file during <aclass="el"href="decls_8h.html#a6823e139f81a9dfd08efcb0e9b213a49"title="Close an Aaru image context, flushing pending data structures and releasing resources.">aaruf_close()</a>. Changes made by this function are not immediately persisted to disk.</dd>
<dd>
No validation is performed on the JSON data:<ul>
<li>Invalid JSON syntax will be stored and only detected during parsing</li>
<li>Schema violations will not be caught by this function</li>
<li>Ensure JSON is valid and schema-compliant before calling</li>
<li>Use a JSON validation library before embedding if correctness is critical</li>
</ul>
</dd>
<dd>
The function accepts any length value:<ul>
<li>Ensure the length accurately reflects the JSON data size</li>
<li>Incorrect length values may cause truncation or include garbage data</li>
<li>For null-terminated JSON, length should not include the null terminator unless it is intended to be part of the stored data</li>
</ul>
</dd></dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="structAaruMetadataJsonBlockHeader.html"title="Header for an Aaru metadata JSON block (identifier == BlockType::AaruMetadataJsonBlock).">AaruMetadataJsonBlockHeader</a> for the on-disk structure definition. </dd>
<dd>
<aclass="el"href="#a01cf0abe0b137236d4be0b91a29d4818"title="Retrieves the embedded Aaru metadata JSON from the image.">aaruf_get_aaru_json_metadata()</a> for retrieving Aaru JSON from opened images. </dd>
<dd>
<aclass="el"href="close_8c.html#adbc2790344fae0327f55d751b79dd800"title="Serialize the Aaru metadata JSON block to the image file.">write_aaru_json_block()</a> for the serialization process during image closing. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="metadata_8c_source.html#l02261">2261</a> of file <aclass="el"href="metadata_8c_source.html">metadata.c</a>.</p>
<p>Sets user comments or notes for the image. </p>
<p>Records arbitrary user-provided comments, notes, or annotations associated with the AaruFormat image. This metadata field allows users to document the image's purpose, provenance, condition, or any other relevant information. Comments are stored in UTF-16LE encoding and can contain multi-line text, special characters, and detailed descriptions.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">context</td><td>Pointer to the aaruformat context (must be a valid, write-enabled image context). </td></tr>
<tr><tdclass="paramname">data</td><td>Pointer to the comments string data in UTF-16LE encoding (opaque byte array). </td></tr>
<tr><tdclass="paramname">length</td><td>Length of the comments data in bytes (must include full UTF-16LE character sequences).</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following status codes: </dd></dl>
<dlclass="retval"><dt>Return values</dt><dd>
<tableclass="retval">
<tr><tdclass="paramname">AARUF_STATUS_OK</td><td>(0) Successfully set comments. This is returned when:<ul>
<li>The context is valid and properly initialized</li>
<li>The context is opened in write mode (ctx->isWriting is true)</li>
<li>Memory allocation for the comments string succeeded</li>
<li>The metadata block header is initialized (identifier set to MetadataBlock)</li>
<li>The comments data is copied to ctx->imageInfo.Comments</li>
<li>The commentsLength field is set in the metadata block header</li>
<li>Any previous comments string is properly freed before replacement</li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>(-1) The context is invalid. This occurs when:<ul>
<li>The context parameter is NULL</li>
<li>The context magic number doesn't match AARU_MAGIC (invalid context type)</li>
<li>The context was not properly initialized by <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a></li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_READ_ONLY</td><td>(-13) The context is not opened for writing. This occurs when:<ul>
<li>The image was opened with <aclass="el"href="decls_8h.html#afc4932cdc795ffb2ef3a33d5b8c57656"title="Opens an existing AaruFormat image file.">aaruf_open()</a> instead of <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a></li>
<li>The context's isWriting flag is false</li>
<li>Attempting to modify a read-only image</li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_ENOUGH_MEMORY</td><td>(-8) Memory allocation failed. This occurs when:<ul>
<li>malloc() failed to allocate the required memory for the comments string</li>
<li>System is out of memory or memory is severely fragmented</li>
<li>The requested allocation size is too large</li>
<li>The data parameter must contain a valid UTF-16LE encoded string</li>
<li>Length must be in bytes, not character count</li>
<li>The library treats the data as opaque and does not validate encoding</li>
<li>Null termination is not required; length specifies the exact byte count</li>
</ul>
</dd>
<dd>
Common Uses for Comments:<ul>
<li>Documentation of image source and creation date</li>
<li>Notes about media condition or read errors encountered</li>
<li>Preservation metadata and archival notes</li>
<li>User annotations for organizing image collections</li>
<li>Workflow status or processing history</li>
</ul>
</dd>
<dd>
Memory Management:<ul>
<li>The function allocates a new buffer and copies the data</li>
<li>If previous comments exist, they are freed before replacement</li>
<li>The caller retains ownership of the input data buffer</li>
<li>The allocated memory is freed when the context is closed or destroyed</li>
</ul>
</dd></dl>
<dlclass="section warning"><dt>Warning</dt><dd>The metadata block is only written to the image file during <aclass="el"href="decls_8h.html#a6823e139f81a9dfd08efcb0e9b213a49"title="Close an Aaru image context, flushing pending data structures and releasing resources.">aaruf_close()</a>. Changes made by this function are not immediately persisted. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="metadata_8c_source.html#l00609">609</a> of file <aclass="el"href="metadata_8c_source.html">metadata.c</a>.</p>
<p>Sets the creator (person/operator) information for the image. </p>
<p>Records the name of the person or operator who created the AaruFormat image. This metadata identifies the individual responsible for the imaging process, which is valuable for provenance tracking, accountability, and understanding the human context in which the image was created. The creator name is stored in UTF-16LE encoding and preserved exactly as provided by the caller.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">context</td><td>Pointer to the aaruformat context (must be a valid, write-enabled image context). </td></tr>
<tr><tdclass="paramname">data</td><td>Pointer to the creator name string data in UTF-16LE encoding (opaque byte array). </td></tr>
<tr><tdclass="paramname">length</td><td>Length of the creator data in bytes (must include full UTF-16LE character sequences).</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following status codes: </dd></dl>
<dlclass="retval"><dt>Return values</dt><dd>
<tableclass="retval">
<tr><tdclass="paramname">AARUF_STATUS_OK</td><td>(0) Successfully set creator information. This is returned when:<ul>
<li>The context is valid and properly initialized</li>
<li>The context is opened in write mode (ctx->isWriting is true)</li>
<li>Memory allocation for the creator string succeeded</li>
<li>The metadata block header is initialized (identifier set to MetadataBlock)</li>
<li>The creator data is copied to ctx->imageInfo.Creator</li>
<li>The creatorLength field is set in the metadata block header</li>
<li>Any previous creator string is properly freed before replacement</li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>(-1) The context is invalid. This occurs when:<ul>
<li>The context parameter is NULL</li>
<li>The context magic number doesn't match AARU_MAGIC (invalid context type)</li>
<li>The context was not properly initialized by <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a></li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_READ_ONLY</td><td>(-13) The context is not opened for writing. This occurs when:<ul>
<li>The image was opened with <aclass="el"href="decls_8h.html#afc4932cdc795ffb2ef3a33d5b8c57656"title="Opens an existing AaruFormat image file.">aaruf_open()</a> instead of <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a></li>
<li>The context's isWriting flag is false</li>
<li>Attempting to modify a read-only image</li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_ENOUGH_MEMORY</td><td>(-8) Memory allocation failed. This occurs when:<ul>
<li>malloc() failed to allocate the required memory for the creator string</li>
<li>System is out of memory or memory is severely fragmented</li>
<li>The requested allocation size is too large</li>
<li>The data parameter must contain a valid UTF-16LE encoded string</li>
<li>Length must be in bytes, not character count (UTF-16LE uses 2 or 4 bytes per character)</li>
<li>The library treats the data as opaque and does not validate UTF-16LE encoding</li>
<li>Null termination is not required; length specifies the exact byte count</li>
<li>Ensure even byte lengths to maintain UTF-16LE character alignment</li>
</ul>
</dd>
<dd>
Creator Name Format:<ul>
<li>Typically contains the full name of the person who created the image</li>
<li>May include titles, credentials, or institutional affiliations</li>
<li>Common formats: "John Smith", "Dr. Jane Doe", "Smith, John (Archivist)"</li>
<li>Should identify the individual operator, not the software used</li>
<li>May include contact information or employee/operator ID in institutional settings</li>
</ul>
</dd>
<dd>
Provenance and Accountability:<ul>
<li>Identifies who performed the imaging operation</li>
<li>Important for establishing chain of custody in forensic contexts</li>
<li>Provides contact point for questions about the imaging process</li>
<li>Supports institutional recordkeeping and quality assurance</li>
<li>May be required for compliance with archival standards</li>
</ul>
</dd>
<dd>
Privacy Considerations:<ul>
<li>Consider privacy implications when recording personal names</li>
<li>Some organizations may use operator IDs instead of full names</li>
<li>Institutional policies may govern what personal information is recorded</li>
<li>GDPR and similar regulations may apply in some jurisdictions</li>
</ul>
</dd>
<dd>
Memory Management:<ul>
<li>The function allocates a new buffer and copies the data</li>
<li>If a previous creator string exists, it is freed before replacement</li>
<li>The caller retains ownership of the input data buffer</li>
<li>The allocated memory is freed when the context is closed or destroyed</li>
</ul>
</dd>
<dd>
Metadata Block Initialization:<ul>
<li>If the metadata block header is not yet initialized, this function initializes it</li>
<li>The metadataBlockHeader.identifier is set to MetadataBlock automatically</li>
<li>Multiple metadata setter functions can be called to build complete metadata</li>
</ul>
</dd></dl>
<dlclass="section warning"><dt>Warning</dt><dd>The data buffer must remain valid for the duration of this function call. After the function returns, the caller may free or reuse the data buffer.</dd>
<dd>
Invalid UTF-16LE encoding may cause issues when reading the metadata:<ul>
<li>The library does not validate UTF-16LE correctness</li>
<li>Malformed strings may display incorrectly or cause decoding errors</li>
<li>Ensure the data is properly encoded before calling this function</li>
</ul>
</dd>
<dd>
The metadata block is only written to the image file during <aclass="el"href="decls_8h.html#a6823e139f81a9dfd08efcb0e9b213a49"title="Close an Aaru image context, flushing pending data structures and releasing resources.">aaruf_close()</a>. Changes made by this function are not immediately persisted. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="metadata_8c_source.html#l00495">495</a> of file <aclass="el"href="metadata_8c_source.html">metadata.c</a>.</p>
<p>Sets the drive firmware revision for the image. </p>
<p>Records the firmware version or revision of the drive or device used to read or write the physical storage media. Firmware revisions can significantly affect drive behavior, error handling, performance, and compatibility. This metadata is crucial for understanding the imaging environment, troubleshooting issues, and ensuring reproducibility. Different firmware versions of the same drive model can behave quite differently, making this information essential for comprehensive documentation. The firmware revision is stored in UTF-16LE encoding.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">context</td><td>Pointer to the aaruformat context (must be a valid, write-enabled image context). </td></tr>
<tr><tdclass="paramname">data</td><td>Pointer to the drive firmware revision string data in UTF-16LE encoding (opaque byte array). </td></tr>
<tr><tdclass="paramname">length</td><td>Length of the drive firmware revision data in bytes (must include full UTF-16LE character sequences).</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following status codes: </dd></dl>
<dlclass="retval"><dt>Return values</dt><dd>
<tableclass="retval">
<tr><tdclass="paramname">AARUF_STATUS_OK</td><td>(0) Successfully set drive firmware revision. This is returned when:<ul>
<li>The context is valid and properly initialized</li>
<li>The context is opened in write mode (ctx->isWriting is true)</li>
<li>Memory allocation for the drive firmware revision string succeeded</li>
<li>The metadata block header is initialized (identifier set to MetadataBlock)</li>
<li>The drive firmware revision data is copied to ctx->imageInfo.DriveFirmwareRevision</li>
<li>The driveFirmwareRevisionLength field is set in the metadata block header</li>
<li>Any previous drive firmware revision string is properly freed before replacement</li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>(-1) The context is invalid. This occurs when:<ul>
<li>The context parameter is NULL</li>
<li>The context magic number doesn't match AARU_MAGIC (invalid context type)</li>
<li>The context was not properly initialized by <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a></li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_READ_ONLY</td><td>(-13) The context is not opened for writing. This occurs when:<ul>
<li>The image was opened with <aclass="el"href="decls_8h.html#afc4932cdc795ffb2ef3a33d5b8c57656"title="Opens an existing AaruFormat image file.">aaruf_open()</a> instead of <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a></li>
<li>The context's isWriting flag is false</li>
<li>Attempting to modify a read-only image</li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_ENOUGH_MEMORY</td><td>(-8) Memory allocation failed. This occurs when:<ul>
<li>malloc() failed to allocate the required memory for the drive firmware revision string</li>
<li>System is out of memory or memory is severely fragmented</li>
<li>The requested allocation size is too large</li>
<li>Format varies by manufacturer and device type</li>
</ul>
</dd>
<dd>
Firmware Impact on Imaging:<ul>
<li>Different firmware versions may have different error recovery strategies</li>
<li>Bug fixes in newer firmware can improve read reliability</li>
<li>Some firmware versions have known issues with specific media types</li>
<li>Performance characteristics may vary between firmware revisions</li>
<li>Firmware can affect features like C2 error reporting on optical drives</li>
</ul>
</dd>
<dd>
Troubleshooting and Support:<ul>
<li>Essential for diagnosing drive-specific problems</li>
<li>Manufacturer support often requires firmware version information</li>
<li>Helps identify if issues are resolved in newer firmware</li>
<li>Enables correlation of problems with known firmware bugs</li>
<li>Supports decision-making about firmware updates</li>
</ul>
</dd>
<dd>
Reproducibility and Documentation:<ul>
<li>Complete environment documentation for scientific reproducibility</li>
<li>Important for forensic work requiring detailed equipment records</li>
<li>Helps explain variations in imaging results over time</li>
<li>Supports compliance with archival and preservation standards</li>
<li>Enables future researchers to understand imaging conditions</li>
</ul>
</dd>
<dd>
Historical Tracking:<ul>
<li>Documents firmware changes over the life of imaging equipment</li>
<li>Helps assess impact of firmware updates on imaging quality</li>
<li>Useful for long-term archival projects spanning years</li>
<li>Aids in understanding evolution of drive technology</li>
</ul>
</dd></dl>
<dlclass="section warning"><dt>Warning</dt><dd>The metadata block is only written to the image file during <aclass="el"href="decls_8h.html#a6823e139f81a9dfd08efcb0e9b213a49"title="Close an Aaru image context, flushing pending data structures and releasing resources.">aaruf_close()</a>. Changes made by this function are not immediately persisted.</dd>
<dd>
Firmware revisions are device-specific and format varies widely:<ul>
<li>No standard format exists across manufacturers</li>
<li>May include letters, numbers, dots, or other characters</li>
<li>Should be recorded exactly as reported by the device </li>
<pclass="definition">Definition at line <aclass="el"href="metadata_8c_source.html#l01795">1795</a> of file <aclass="el"href="metadata_8c_source.html">metadata.c</a>.</p>
<p>Sets the drive manufacturer information for the image. </p>
<p>Records the name of the company that manufactured the drive or device used to read or write the physical storage media. This metadata provides valuable context about the imaging process, as different drives may have different capabilities, error handling characteristics, and compatibility with specific media types. The manufacturer name is stored in UTF-16LE encoding.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">context</td><td>Pointer to the aaruformat context (must be a valid, write-enabled image context). </td></tr>
<tr><tdclass="paramname">data</td><td>Pointer to the drive manufacturer string data in UTF-16LE encoding (opaque byte array). </td></tr>
<tr><tdclass="paramname">length</td><td>Length of the drive manufacturer data in bytes (must include full UTF-16LE character sequences).</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following status codes: </dd></dl>
<dlclass="retval"><dt>Return values</dt><dd>
<tableclass="retval">
<tr><tdclass="paramname">AARUF_STATUS_OK</td><td>(0) Successfully set drive manufacturer. This is returned when:<ul>
<li>The context is valid and properly initialized</li>
<li>The context is opened in write mode (ctx->isWriting is true)</li>
<li>Memory allocation for the drive manufacturer string succeeded</li>
<li>The metadata block header is initialized (identifier set to MetadataBlock)</li>
<li>The drive manufacturer data is copied to ctx->imageInfo.DriveManufacturer</li>
<li>The driveManufacturerLength field is set in the metadata block header</li>
<li>Any previous drive manufacturer string is properly freed before replacement</li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>(-1) The context is invalid. This occurs when:<ul>
<li>The context parameter is NULL</li>
<li>The context magic number doesn't match AARU_MAGIC (invalid context type)</li>
<li>The context was not properly initialized by <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a></li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_READ_ONLY</td><td>(-13) The context is not opened for writing. This occurs when:<ul>
<li>The image was opened with <aclass="el"href="decls_8h.html#afc4932cdc795ffb2ef3a33d5b8c57656"title="Opens an existing AaruFormat image file.">aaruf_open()</a> instead of <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a></li>
<li>The context's isWriting flag is false</li>
<li>Attempting to modify a read-only image</li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_ENOUGH_MEMORY</td><td>(-8) Memory allocation failed. This occurs when:<ul>
<li>malloc() failed to allocate the required memory for the drive manufacturer string</li>
<li>System is out of memory or memory is severely fragmented</li>
<li>The requested allocation size is too large</li>
<li>Different manufacturers have varying error recovery capabilities</li>
<li>Some drives are better suited for archival-quality imaging</li>
<li>Plextor drives were historically preferred for optical disc preservation</li>
<li>Professional-grade drives often have better read accuracy</li>
<li>Important for understanding potential limitations in the imaging process</li>
</ul>
</dd>
<dd>
Forensic and Provenance Value:<ul>
<li>Documents the complete imaging environment</li>
<li>Helps assess reliability and trustworthiness of the image</li>
<li>Useful for troubleshooting or reproducing imaging results</li>
<li>May be required for forensic chain of custody</li>
<li>Supports quality assurance and validation processes</li>
</ul>
</dd></dl>
<dlclass="section warning"><dt>Warning</dt><dd>The metadata block is only written to the image file during <aclass="el"href="decls_8h.html#a6823e139f81a9dfd08efcb0e9b213a49"title="Close an Aaru image context, flushing pending data structures and releasing resources.">aaruf_close()</a>. Changes made by this function are not immediately persisted. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="metadata_8c_source.html#l01414">1414</a> of file <aclass="el"href="metadata_8c_source.html">metadata.c</a>.</p>
<p>Sets the drive model information for the image. </p>
<p>Records the specific model or product designation of the drive or device used to read or write the physical storage media. This metadata provides detailed information about the imaging equipment, which can be important for understanding the capabilities, limitations, and characteristics of the imaging process. Different drive models within the same manufacturer's product line may have significantly different features and performance characteristics. The model information is stored in UTF-16LE encoding.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">context</td><td>Pointer to the aaruformat context (must be a valid, write-enabled image context). </td></tr>
<tr><tdclass="paramname">data</td><td>Pointer to the drive model string data in UTF-16LE encoding (opaque byte array). </td></tr>
<tr><tdclass="paramname">length</td><td>Length of the drive model data in bytes (must include full UTF-16LE character sequences).</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following status codes: </dd></dl>
<dlclass="retval"><dt>Return values</dt><dd>
<tableclass="retval">
<tr><tdclass="paramname">AARUF_STATUS_OK</td><td>(0) Successfully set drive model. This is returned when:<ul>
<li>The context is valid and properly initialized</li>
<li>The context is opened in write mode (ctx->isWriting is true)</li>
<li>Memory allocation for the drive model string succeeded</li>
<li>The metadata block header is initialized (identifier set to MetadataBlock)</li>
<li>The drive model data is copied to ctx->imageInfo.DriveModel</li>
<li>The driveModelLength field is set in the metadata block header</li>
<li>Any previous drive model string is properly freed before replacement</li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>(-1) The context is invalid. This occurs when:<ul>
<li>The context parameter is NULL</li>
<li>The context magic number doesn't match AARU_MAGIC (invalid context type)</li>
<li>The context was not properly initialized by <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a></li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_READ_ONLY</td><td>(-13) The context is not opened for writing. This occurs when:<ul>
<li>The image was opened with <aclass="el"href="decls_8h.html#afc4932cdc795ffb2ef3a33d5b8c57656"title="Opens an existing AaruFormat image file.">aaruf_open()</a> instead of <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a></li>
<li>The context's isWriting flag is false</li>
<li>Attempting to modify a read-only image</li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_ENOUGH_MEMORY</td><td>(-8) Memory allocation failed. This occurs when:<ul>
<li>malloc() failed to allocate the required memory for the drive model string</li>
<li>System is out of memory or memory is severely fragmented</li>
<li>The requested allocation size is too large</li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dlclass="section note"><dt>Note</dt><dd>Drive Model Examples:<ul>
<li>Different models may have different error correction algorithms</li>
<li>Some models are known for superior read quality (e.g., Plextor Premium)</li>
<li>Certain models may have bugs or quirks in specific firmware versions</li>
<li>Professional models often have features not available in consumer versions</li>
<li>Important for reproducing imaging conditions or troubleshooting issues</li>
</ul>
</dd>
<dd>
Forensic Documentation:<ul>
<li>Complete drive identification aids in forensic reporting</li>
<li>Helps establish the reliability of the imaging process</li>
<li>May be required for compliance with forensic standards</li>
<li>Supports validation and verification procedures</li>
<li>Enables assessment of tool suitability for the imaging task</li>
</ul>
</dd>
<dd>
Historical and Research Value:<ul>
<li>Documents evolution of imaging technology over time</li>
<li>Helps identify best practices for specific media types</li>
<li>Useful for academic research on digital preservation</li>
<li>Aids in understanding drive availability and obsolescence</li>
</ul>
</dd></dl>
<dlclass="section warning"><dt>Warning</dt><dd>The metadata block is only written to the image file during <aclass="el"href="decls_8h.html#a6823e139f81a9dfd08efcb0e9b213a49"title="Close an Aaru image context, flushing pending data structures and releasing resources.">aaruf_close()</a>. Changes made by this function are not immediately persisted. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="metadata_8c_source.html#l01536">1536</a> of file <aclass="el"href="metadata_8c_source.html">metadata.c</a>.</p>
<p>Sets the drive serial number for the image. </p>
<p>Records the unique serial number of the drive or device used to read or write the physical storage media. This metadata provides a unique identifier for the specific piece of hardware used in the imaging process, which is particularly important for forensic work, equipment tracking, and quality assurance. The serial number enables correlation between multiple images created with the same drive and can help identify drive-specific issues or characteristics. The serial number is stored in UTF-16LE encoding.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">context</td><td>Pointer to the aaruformat context (must be a valid, write-enabled image context). </td></tr>
<tr><tdclass="paramname">data</td><td>Pointer to the drive serial number string data in UTF-16LE encoding (opaque byte array). </td></tr>
<tr><tdclass="paramname">length</td><td>Length of the drive serial number data in bytes (must include full UTF-16LE character sequences).</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following status codes: </dd></dl>
<dlclass="retval"><dt>Return values</dt><dd>
<tableclass="retval">
<tr><tdclass="paramname">AARUF_STATUS_OK</td><td>(0) Successfully set drive serial number. This is returned when:<ul>
<li>The context is valid and properly initialized</li>
<li>The context is opened in write mode (ctx->isWriting is true)</li>
<li>Memory allocation for the drive serial number string succeeded</li>
<li>The metadata block header is initialized (identifier set to MetadataBlock)</li>
<li>The drive serial number data is copied to ctx->imageInfo.DriveSerialNumber</li>
<li>The driveSerialNumberLength field is set in the metadata block header</li>
<li>Any previous drive serial number string is properly freed before replacement</li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>(-1) The context is invalid. This occurs when:<ul>
<li>The context parameter is NULL</li>
<li>The context magic number doesn't match AARU_MAGIC (invalid context type)</li>
<li>The context was not properly initialized by <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a></li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_READ_ONLY</td><td>(-13) The context is not opened for writing. This occurs when:<ul>
<li>The image was opened with <aclass="el"href="decls_8h.html#afc4932cdc795ffb2ef3a33d5b8c57656"title="Opens an existing AaruFormat image file.">aaruf_open()</a> instead of <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a></li>
<li>The context's isWriting flag is false</li>
<li>Attempting to modify a read-only image</li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_ENOUGH_MEMORY</td><td>(-8) Memory allocation failed. This occurs when:<ul>
<li>malloc() failed to allocate the required memory for the drive serial number string</li>
<li>System is out of memory or memory is severely fragmented</li>
<li>The requested allocation size is too large</li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dlclass="section note"><dt>Note</dt><dd>Serial Number Sources:<ul>
<li>Hard drives and SSDs: Retrieved via ATA/SCSI IDENTIFY commands</li>
<li>Optical drives: Available through SCSI inquiry or ATA identify</li>
<li>Tape drives: Typically reported via SCSI inquiry data</li>
<li>USB devices: May have USB serial numbers or internal device serials</li>
<li>Some older or consumer devices may not report serial numbers</li>
</ul>
</dd>
<dd>
Forensic Applications:<ul>
<li>Critical for forensic chain of custody documentation</li>
<li>Uniquely identifies the specific hardware used for imaging</li>
<li>Enables tracking of drive calibration and maintenance history</li>
<li>Supports correlation of images created with the same equipment</li>
<li>May be required by forensic standards and best practices</li>
</ul>
</dd>
<dd>
Equipment Management:<ul>
<li>Helps track drive usage and workload for maintenance planning</li>
<li>Enables identification of drives requiring replacement or service</li>
<li>Supports equipment inventory and asset management systems</li>
<li>Useful for identifying drives with known issues or recalls</li>
<li>Facilitates warranty and support claim processing</li>
</ul>
</dd>
<dd>
Quality Assurance:<ul>
<li>Enables analysis of drive-specific error patterns</li>
<li>Helps identify if multiple imaging issues stem from the same drive</li>
<li>Supports statistical quality control processes</li>
<li>Aids in evaluating drive reliability over time</li>
<li>Can reveal degradation or calibration drift in aging hardware</li>
</ul>
</dd></dl>
<dlclass="section warning"><dt>Warning</dt><dd>The metadata block is only written to the image file during <aclass="el"href="decls_8h.html#a6823e139f81a9dfd08efcb0e9b213a49"title="Close an Aaru image context, flushing pending data structures and releasing resources.">aaruf_close()</a>. Changes made by this function are not immediately persisted. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="metadata_8c_source.html#l01660">1660</a> of file <aclass="el"href="metadata_8c_source.html">metadata.c</a>.</p>
<p>Sets the logical CHS geometry for the AaruFormat image. </p>
<p>Configures the Cylinder-Head-Sector (CHS) geometry information for the image being created or modified. This function populates both the geometry block (used for storage in the image file) and the image information structure (used for runtime calculations). The geometry block contains legacy-style logical addressing parameters that describe how the storage medium should be logically organized in terms of cylinders, heads (tracks per cylinder), and sectors per track. This information is crucial for creating images that will be used with software requiring CHS addressing or for accurately preserving the original medium's logical structure.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">context</td><td>Pointer to the aaruformat context (must be a valid, write-enabled image context). </td></tr>
<tr><tdclass="paramname">cylinders</td><td>The number of cylinders to set for the geometry. </td></tr>
<tr><tdclass="paramname">heads</td><td>The number of heads (tracks per cylinder) to set for the geometry. </td></tr>
<tr><tdclass="paramname">sectors_per_track</td><td>The number of sectors per track to set for the geometry.</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following status codes: </dd></dl>
<dlclass="retval"><dt>Return values</dt><dd>
<tableclass="retval">
<tr><tdclass="paramname">AARUF_STATUS_OK</td><td>(0) Successfully set geometry information. This is returned when:<ul>
<li>The context is valid and properly initialized</li>
<li>The context is opened in write mode (ctx->isWriting is true)</li>
<li>The geometry block identifier is set to GeometryBlock</li>
<li>The geometry block fields (cylinders, heads, sectorsPerTrack) are updated</li>
<li>The image info fields (Cylinders, Heads, SectorsPerTrack) are synchronized</li>
<li>All parameters are stored for subsequent write operations</li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>(-1) The context is invalid. This occurs when:<ul>
<li>The context parameter is NULL</li>
<li>The context magic number doesn't match AARU_MAGIC (invalid context type)</li>
<li>The context was not properly initialized by <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a></li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_READ_ONLY</td><td>(-13) The context is not opened for writing. This occurs when:<ul>
<li>The image was opened with <aclass="el"href="decls_8h.html#afc4932cdc795ffb2ef3a33d5b8c57656"title="Opens an existing AaruFormat image file.">aaruf_open()</a> instead of <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a></li>
<li>No validation is performed on the geometry values</li>
<li>Zero values are technically accepted but may cause issues</li>
<li>Extremely large values may overflow in calculations (cylinders × heads × sectors_per_track)</li>
<li>Common constraints for legacy systems:<ul>
<li>Cylinders: typically 1-1024 for BIOS, up to 65535 for modern systems</li>
<li>Heads: typically 1-255 for most systems</li>
<li>Sectors per track: typically 1-63 for BIOS, up to 255 for modern systems</li>
</ul>
</li>
</ul>
</dd>
<dd>
Write Mode Requirement:<ul>
<li>This function is intended for use during image creation</li>
<li>Should be called after <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a> and before writing sector data</li>
<li>The geometry block is serialized during <aclass="el"href="decls_8h.html#a6823e139f81a9dfd08efcb0e9b213a49"title="Close an Aaru image context, flushing pending data structures and releasing resources.">aaruf_close()</a></li>
<li>Must be used with a write-enabled context</li>
</ul>
</dd>
<dd>
Historical Context:<ul>
<li>CHS geometry was the original addressing scheme for disk drives</li>
<li>Physical CHS reflected actual disk platters, heads, and sector layout</li>
<li>Logical CHS often differs from physical due to zone-bit recording and translation</li>
<li>Modern drives use LBA (Logical Block Addressing) internally</li>
</ul>
</dd></dl>
<dlclass="section warning"><dt>Warning</dt><dd>This function does not validate geometry consistency:<ul>
<li>Does not check if cylinders × heads × sectors_per_track equals image sector count</li>
<li>Does not prevent overflow in the multiplication</li>
<li>Caller must ensure geometry values are appropriate for the medium type</li>
<li>Invalid geometry may cause boot failures or data access issues</li>
</ul>
</dd>
<dd>
The geometry block is only written to the image file during <aclass="el"href="decls_8h.html#a6823e139f81a9dfd08efcb0e9b213a49"title="Close an Aaru image context, flushing pending data structures and releasing resources.">aaruf_close()</a>. Changes made by this function are not immediately persisted.</dd>
<dd>
Changing geometry after writing sector data may create inconsistencies. Set geometry before beginning sector write operations for best results.</dd>
<dd>
Some image formats and use cases don't require CHS geometry:<ul>
<li>Optical media (CD/DVD/BD) use different addressing schemes</li>
<li>Modern GPT-partitioned disks don't rely on CHS</li>
<li>Flash-based storage typically doesn't have meaningful CHS geometry</li>
<li>Setting geometry for such media types is harmless but unnecessary </li>
<pclass="definition">Definition at line <aclass="el"href="metadata_8c_source.html#l00230">230</a> of file <aclass="el"href="metadata_8c_source.html">metadata.c</a>.</p>
<p>Sets the media barcode information for the image. </p>
<p>Records the barcode affixed to the physical storage media or its packaging. Barcodes are commonly used in professional archival and library environments for automated inventory management, tracking, and retrieval systems. This metadata enables correlation between physical media location systems and digital image files. The barcode is stored in UTF-16LE encoding.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">context</td><td>Pointer to the aaruformat context (must be a valid, write-enabled image context). </td></tr>
<tr><tdclass="paramname">data</td><td>Pointer to the media barcode string data in UTF-16LE encoding (opaque byte array). </td></tr>
<tr><tdclass="paramname">length</td><td>Length of the media barcode data in bytes (must include full UTF-16LE character sequences).</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following status codes: </dd></dl>
<dlclass="retval"><dt>Return values</dt><dd>
<tableclass="retval">
<tr><tdclass="paramname">AARUF_STATUS_OK</td><td>(0) Successfully set media barcode. This is returned when:<ul>
<li>The context is valid and properly initialized</li>
<li>The context is opened in write mode (ctx->isWriting is true)</li>
<li>Memory allocation for the media barcode string succeeded</li>
<li>The metadata block header is initialized (identifier set to MetadataBlock)</li>
<li>The media barcode data is copied to ctx->imageInfo.MediaBarcode</li>
<li>The mediaBarcodeLength field is set in the metadata block header</li>
<li>Any previous media barcode string is properly freed before replacement</li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>(-1) The context is invalid. This occurs when:<ul>
<li>The context parameter is NULL</li>
<li>The context magic number doesn't match AARU_MAGIC (invalid context type)</li>
<li>The context was not properly initialized by <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a></li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_READ_ONLY</td><td>(-13) The context is not opened for writing. This occurs when:<ul>
<li>The image was opened with <aclass="el"href="decls_8h.html#afc4932cdc795ffb2ef3a33d5b8c57656"title="Opens an existing AaruFormat image file.">aaruf_open()</a> instead of <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a></li>
<li>The context's isWriting flag is false</li>
<li>Attempting to modify a read-only image</li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_ENOUGH_MEMORY</td><td>(-8) Memory allocation failed. This occurs when:<ul>
<li>malloc() failed to allocate the required memory for the media barcode string</li>
<li>System is out of memory or memory is severely fragmented</li>
<li>The requested allocation size is too large</li>
<li>Inventory tracking in large media collections</li>
<li>Asset management in corporate or institutional settings</li>
<li>Chain of custody tracking in forensic environments</li>
</ul>
</dd>
<dd>
Barcode Types and Formats:<ul>
<li>Code 39 and Code 128 are common for media labeling</li>
<li>LTO tapes use specific 6 or 8-character barcode formats</li>
<li>May include library-specific prefixes or location codes</li>
<li>Some systems use 2D barcodes (QR codes, Data Matrix)</li>
<li>Barcode should be recorded exactly as it appears</li>
</ul>
</dd>
<dd>
Integration with Physical Systems:<ul>
<li>Enables automated correlation between physical and digital catalogs</li>
<li>Supports robotic tape library operations</li>
<li>Facilitates retrieval from off-site storage facilities</li>
<li>Links to broader asset management databases</li>
<li>Critical for large-scale archival operations</li>
</ul>
</dd>
<dd>
Preservation Context:<ul>
<li>Important for long-term archival planning</li>
<li>Helps maintain inventory accuracy over time</li>
<li>Supports audit and compliance requirements</li>
<li>Enables efficient physical media location and retrieval</li>
</ul>
</dd></dl>
<dlclass="section warning"><dt>Warning</dt><dd>The metadata block is only written to the image file during <aclass="el"href="decls_8h.html#a6823e139f81a9dfd08efcb0e9b213a49"title="Close an Aaru image context, flushing pending data structures and releasing resources.">aaruf_close()</a>. Changes made by this function are not immediately persisted. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="metadata_8c_source.html#l01178">1178</a> of file <aclass="el"href="metadata_8c_source.html">metadata.c</a>.</p>
<p>Sets the media manufacturer information for the image. </p>
<p>Records the name of the company that manufactured the physical storage media. This metadata is valuable for preservation and forensic purposes, as it can help identify the media type, quality characteristics, and manufacturing period. The manufacturer name is stored in UTF-16LE encoding.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">context</td><td>Pointer to the aaruformat context (must be a valid, write-enabled image context). </td></tr>
<tr><tdclass="paramname">data</td><td>Pointer to the media manufacturer string data in UTF-16LE encoding (opaque byte array). </td></tr>
<tr><tdclass="paramname">length</td><td>Length of the media manufacturer data in bytes (must include full UTF-16LE character sequences).</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following status codes: </dd></dl>
<dlclass="retval"><dt>Return values</dt><dd>
<tableclass="retval">
<tr><tdclass="paramname">AARUF_STATUS_OK</td><td>(0) Successfully set media manufacturer. This is returned when:<ul>
<li>The context is valid and properly initialized</li>
<li>The context is opened in write mode (ctx->isWriting is true)</li>
<li>Memory allocation for the media manufacturer string succeeded</li>
<li>The metadata block header is initialized (identifier set to MetadataBlock)</li>
<li>The media manufacturer data is copied to ctx->imageInfo.MediaManufacturer</li>
<li>The mediaManufacturerLength field is set in the metadata block header</li>
<li>Any previous media manufacturer string is properly freed before replacement</li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>(-1) The context is invalid. This occurs when:<ul>
<li>The context parameter is NULL</li>
<li>The context magic number doesn't match AARU_MAGIC (invalid context type)</li>
<li>The context was not properly initialized by <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a></li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_READ_ONLY</td><td>(-13) The context is not opened for writing. This occurs when:<ul>
<li>The image was opened with <aclass="el"href="decls_8h.html#afc4932cdc795ffb2ef3a33d5b8c57656"title="Opens an existing AaruFormat image file.">aaruf_open()</a> instead of <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a></li>
<li>The context's isWriting flag is false</li>
<li>Attempting to modify a read-only image</li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_ENOUGH_MEMORY</td><td>(-8) Memory allocation failed. This occurs when:<ul>
<li>malloc() failed to allocate the required memory for the media manufacturer string</li>
<li>System is out of memory or memory is severely fragmented</li>
<li>The requested allocation size is too large</li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dlclass="section note"><dt>Note</dt><dd>Common Media Manufacturers:<ul>
<li>May be printed on the media surface or packaging</li>
<li>Can sometimes be detected from media ID codes (e.g., ATIP for CD-R)</li>
<li>Historical records or catalogs may provide this information</li>
<li>Important for understanding media quality and longevity characteristics</li>
</ul>
</dd>
<dd>
Preservation Value:<ul>
<li>Helps assess expected media lifespan and degradation patterns</li>
<li>Useful for identifying counterfeit or remarked media</li>
<li>Aids in research about media quality and failure modes</li>
<li>Provides context for archival planning and migration strategies</li>
</ul>
</dd></dl>
<dlclass="section warning"><dt>Warning</dt><dd>The metadata block is only written to the image file during <aclass="el"href="decls_8h.html#a6823e139f81a9dfd08efcb0e9b213a49"title="Close an Aaru image context, flushing pending data structures and releasing resources.">aaruf_close()</a>. Changes made by this function are not immediately persisted. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="metadata_8c_source.html#l00834">834</a> of file <aclass="el"href="metadata_8c_source.html">metadata.c</a>.</p>
<p>Sets the media model or product designation for the image. </p>
<p>Records the specific model, product line, or type designation of the physical storage media. This is more specific than the manufacturer and identifies the exact product variant. This metadata helps in identifying specific media characteristics, performance specifications, and compatibility information. The model information is stored in UTF-16LE encoding.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">context</td><td>Pointer to the aaruformat context (must be a valid, write-enabled image context). </td></tr>
<tr><tdclass="paramname">data</td><td>Pointer to the media model string data in UTF-16LE encoding (opaque byte array). </td></tr>
<tr><tdclass="paramname">length</td><td>Length of the media model data in bytes (must include full UTF-16LE character sequences).</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following status codes: </dd></dl>
<dlclass="retval"><dt>Return values</dt><dd>
<tableclass="retval">
<tr><tdclass="paramname">AARUF_STATUS_OK</td><td>(0) Successfully set media model. This is returned when:<ul>
<li>The context is valid and properly initialized</li>
<li>The context is opened in write mode (ctx->isWriting is true)</li>
<li>Memory allocation for the media model string succeeded</li>
<li>The metadata block header is initialized (identifier set to MetadataBlock)</li>
<li>The media model data is copied to ctx->imageInfo.MediaModel</li>
<li>The mediaModelLength field is set in the metadata block header</li>
<li>Any previous media model string is properly freed before replacement</li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>(-1) The context is invalid. This occurs when:<ul>
<li>The context parameter is NULL</li>
<li>The context magic number doesn't match AARU_MAGIC (invalid context type)</li>
<li>The context was not properly initialized by <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a></li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_READ_ONLY</td><td>(-13) The context is not opened for writing. This occurs when:<ul>
<li>The image was opened with <aclass="el"href="decls_8h.html#afc4932cdc795ffb2ef3a33d5b8c57656"title="Opens an existing AaruFormat image file.">aaruf_open()</a> instead of <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a></li>
<li>The context's isWriting flag is false</li>
<li>Attempting to modify a read-only image</li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_ENOUGH_MEMORY</td><td>(-8) Memory allocation failed. This occurs when:<ul>
<li>malloc() failed to allocate the required memory for the media model string</li>
<li>System is out of memory or memory is severely fragmented</li>
<li>The requested allocation size is too large</li>
<li>Flash cards: "SDHC Class 10", "CompactFlash 1000x"</li>
</ul>
</dd>
<dd>
Model Information Usage:<ul>
<li>Identifies specific capacity and speed ratings</li>
<li>Indicates format compatibility (e.g., DVD-R vs DVD+R)</li>
<li>Helps determine recording characteristics and quality tier</li>
<li>Useful for matching replacement media or troubleshooting issues</li>
</ul>
</dd></dl>
<dlclass="section warning"><dt>Warning</dt><dd>The metadata block is only written to the image file during <aclass="el"href="decls_8h.html#a6823e139f81a9dfd08efcb0e9b213a49"title="Close an Aaru image context, flushing pending data structures and releasing resources.">aaruf_close()</a>. Changes made by this function are not immediately persisted. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="metadata_8c_source.html#l00941">941</a> of file <aclass="el"href="metadata_8c_source.html">metadata.c</a>.</p>
<p>Sets the media part number or model designation for the image. </p>
<p>Records the manufacturer's part number or catalog designation for the specific type of physical storage media. This is distinct from the media model in that it represents the exact ordering or catalog number used for procurement and inventory purposes. Part numbers are particularly important for sourcing compatible replacement media and for precise identification in technical documentation. The part number is stored in UTF-16LE encoding.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">context</td><td>Pointer to the aaruformat context (must be a valid, write-enabled image context). </td></tr>
<tr><tdclass="paramname">data</td><td>Pointer to the media part number string data in UTF-16LE encoding (opaque byte array). </td></tr>
<tr><tdclass="paramname">length</td><td>Length of the media part number data in bytes (must include full UTF-16LE character sequences).</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following status codes: </dd></dl>
<dlclass="retval"><dt>Return values</dt><dd>
<tableclass="retval">
<tr><tdclass="paramname">AARUF_STATUS_OK</td><td>(0) Successfully set media part number. This is returned when:<ul>
<li>The context is valid and properly initialized</li>
<li>The context is opened in write mode (ctx->isWriting is true)</li>
<li>Memory allocation for the media part number string succeeded</li>
<li>The metadata block header is initialized (identifier set to MetadataBlock)</li>
<li>The media part number data is copied to ctx->imageInfo.MediaPartNumber</li>
<li>The mediaPartNumberLength field is set in the metadata block header</li>
<li>Any previous media part number string is properly freed before replacement</li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>(-1) The context is invalid. This occurs when:<ul>
<li>The context parameter is NULL</li>
<li>The context magic number doesn't match AARU_MAGIC (invalid context type)</li>
<li>The context was not properly initialized by <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a></li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_READ_ONLY</td><td>(-13) The context is not opened for writing. This occurs when:<ul>
<li>The image was opened with <aclass="el"href="decls_8h.html#afc4932cdc795ffb2ef3a33d5b8c57656"title="Opens an existing AaruFormat image file.">aaruf_open()</a> instead of <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a></li>
<li>The context's isWriting flag is false</li>
<li>Attempting to modify a read-only image</li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_ENOUGH_MEMORY</td><td>(-8) Memory allocation failed. This occurs when:<ul>
<li>malloc() failed to allocate the required memory for the media part number string</li>
<li>System is out of memory or memory is severely fragmented</li>
<li>The requested allocation size is too large</li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dlclass="section note"><dt>Note</dt><dd>Part Number Examples:<ul>
<li>May include regional variations or packaging size indicators</li>
</ul>
</dd>
<dd>
Practical Applications:<ul>
<li>Procurement and ordering of compatible replacement media</li>
<li>Cross-referencing with manufacturer specifications and datasheets</li>
<li>Identifying specific product revisions or manufacturing batches</li>
<li>Ensuring compatibility for archival media migration projects</li>
<li>Tracking costs and suppliers in institutional settings</li>
</ul>
</dd>
<dd>
Relationship to Model:<ul>
<li>Part number is more specific than model designation</li>
<li>Model might be "DVD+R 16x", part number "MR-25332"</li>
<li>Part numbers may vary by region, packaging quantity, or color</li>
<li>Critical for exact product identification in catalogs and databases</li>
</ul>
</dd>
<dd>
Documentation and Compliance:<ul>
<li>Useful for creating detailed preservation documentation</li>
<li>Supports compliance with archival standards and best practices</li>
<li>Enables precise replication of archival environments</li>
<li>Facilitates research on media types and failure modes</li>
</ul>
</dd></dl>
<dlclass="section warning"><dt>Warning</dt><dd>The metadata block is only written to the image file during <aclass="el"href="decls_8h.html#a6823e139f81a9dfd08efcb0e9b213a49"title="Close an Aaru image context, flushing pending data structures and releasing resources.">aaruf_close()</a>. Changes made by this function are not immediately persisted. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="metadata_8c_source.html#l01299">1299</a> of file <aclass="el"href="metadata_8c_source.html">metadata.c</a>.</p>
<p>Sets the media sequence information for multi-volume media sets. </p>
<p>Configures the sequence numbering for media that is part of a larger set, such as multi-disk software distributions, backup sets spanning multiple tapes, or optical disc sets. This function records both the current media's position in the sequence and the total number of media in the complete set. This metadata is essential for proper ordering and completeness verification when working with multi-volume archives.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">context</td><td>Pointer to the aaruformat context (must be a valid, write-enabled image context). </td></tr>
<tr><tdclass="paramname">sequence</td><td>The sequence number of this media (1-based index indicating position in the set). </td></tr>
<tr><tdclass="paramname">last_sequence</td><td>The total number of media in the complete set (indicates the final sequence number).</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following status codes: </dd></dl>
<dlclass="retval"><dt>Return values</dt><dd>
<tableclass="retval">
<tr><tdclass="paramname">AARUF_STATUS_OK</td><td>(0) Successfully set media sequence information. This is returned when:<ul>
<li>The context is valid and properly initialized</li>
<li>The context is opened in write mode (ctx->isWriting is true)</li>
<li>The metadata block header is initialized (identifier set to MetadataBlock)</li>
<li>The mediaSequence field is set to the provided sequence value</li>
<li>The lastMediaSequence field is set to the provided last_sequence value</li>
<li>Both values are stored for serialization during image close</li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>(-1) The context is invalid. This occurs when:<ul>
<li>The context parameter is NULL</li>
<li>The context magic number doesn't match AARU_MAGIC (invalid context type)</li>
<li>The context was not properly initialized by <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a></li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_READ_ONLY</td><td>(-13) The context is not opened for writing. This occurs when:<ul>
<li>The image was opened with <aclass="el"href="decls_8h.html#afc4932cdc795ffb2ef3a33d5b8c57656"title="Opens an existing AaruFormat image file.">aaruf_open()</a> instead of <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a></li>
<li>Large data sets divided across multiple optical discs</li>
</ul>
</dd>
<dd>
Metadata Block Initialization:<ul>
<li>If the metadata block header is not yet initialized, this function initializes it</li>
<li>The metadataBlockHeader.identifier is set to MetadataBlock automatically</li>
<li>Multiple metadata setter functions can be called to build complete metadata</li>
<li>All metadata is written to the image file during <aclass="el"href="decls_8h.html#a6823e139f81a9dfd08efcb0e9b213a49"title="Close an Aaru image context, flushing pending data structures and releasing resources.">aaruf_close()</a></li>
</ul>
</dd>
<dd>
Single Media Images:<ul>
<li>For standalone media not part of a set, use sequence=1, last_sequence=1</li>
<li>Setting both values to 0 may be used to indicate "not part of a sequence"</li>
<li>The function does not validate that sequence <= last_sequence</li>
</ul>
</dd>
<dd>
Parameter Validation:<ul>
<li>No validation is performed on sequence numbers</li>
<li>Negative values are accepted but may be semantically incorrect</li>
<li>sequence > last_sequence is not prevented but indicates an error condition</li>
<li>Callers should ensure sequence and last_sequence are logically consistent</li>
</ul>
</dd>
<dd>
Archive Integrity:<ul>
<li>Proper sequence metadata is crucial for multi-volume restoration</li>
<li>Archival software may refuse to extract if sequence information is incorrect</li>
<li>Missing volumes can be detected by checking sequence completeness</li>
<li>Helps prevent data loss from incomplete multi-volume sets</li>
</ul>
</dd>
<dd>
Historical Context:<ul>
<li>Multi-volume sets were common in the floppy disk era due to size constraints</li>
<li>CD/DVD sets were used for large software distributions (operating systems, games)</li>
<li>Tape backup systems still use multi-volume sets for large archives</li>
<li>Modern optical media (BD-R DL) reduced the need for multi-disc sets</li>
</ul>
</dd></dl>
<dlclass="section warning"><dt>Warning</dt><dd>This function does not validate the logical consistency of sequence numbers:<ul>
<li>Does not check if sequence <= last_sequence</li>
<li>Does not prevent negative or zero values if semantically inappropriate</li>
<li>Caller must ensure values represent a valid sequence relationship</li>
</ul>
</dd>
<dd>
The metadata block is only written to the image file during <aclass="el"href="decls_8h.html#a6823e139f81a9dfd08efcb0e9b213a49"title="Close an Aaru image context, flushing pending data structures and releasing resources.">aaruf_close()</a>. Changes made by this function are not immediately persisted.</dd>
<dd>
Incorrect sequence information may prevent proper reconstruction:<ul>
<li>Software relying on sequence numbers may fail to recognize media order</li>
<li>Archival systems may incorrectly report missing volumes</li>
<li>Restoration processes may fail if sequence is inconsistent </li>
<pclass="definition">Definition at line <aclass="el"href="metadata_8c_source.html#l00364">364</a> of file <aclass="el"href="metadata_8c_source.html">metadata.c</a>.</p>
<p>Sets the media serial number for the image. </p>
<p>Records the unique serial number assigned to the physical storage media by the manufacturer. This metadata provides a unique identifier for the specific piece of media, which is invaluable for tracking, authentication, and forensic analysis. Not all media types have serial numbers; this is most common with professional-grade media and some consumer optical discs. The serial number is stored in UTF-16LE encoding.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">context</td><td>Pointer to the aaruformat context (must be a valid, write-enabled image context). </td></tr>
<tr><tdclass="paramname">data</td><td>Pointer to the media serial number string data in UTF-16LE encoding (opaque byte array). </td></tr>
<tr><tdclass="paramname">length</td><td>Length of the media serial number data in bytes (must include full UTF-16LE character sequences).</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following status codes: </dd></dl>
<dlclass="retval"><dt>Return values</dt><dd>
<tableclass="retval">
<tr><tdclass="paramname">AARUF_STATUS_OK</td><td>(0) Successfully set media serial number. This is returned when:<ul>
<li>The context is valid and properly initialized</li>
<li>The context is opened in write mode (ctx->isWriting is true)</li>
<li>Memory allocation for the media serial number string succeeded</li>
<li>The metadata block header is initialized (identifier set to MetadataBlock)</li>
<li>The media serial number data is copied to ctx->imageInfo.MediaSerialNumber</li>
<li>The mediaSerialNumberLength field is set in the metadata block header</li>
<li>Any previous media serial number string is properly freed before replacement</li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>(-1) The context is invalid. This occurs when:<ul>
<li>The context parameter is NULL</li>
<li>The context magic number doesn't match AARU_MAGIC (invalid context type)</li>
<li>The context was not properly initialized by <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a></li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_READ_ONLY</td><td>(-13) The context is not opened for writing. This occurs when:<ul>
<li>The image was opened with <aclass="el"href="decls_8h.html#afc4932cdc795ffb2ef3a33d5b8c57656"title="Opens an existing AaruFormat image file.">aaruf_open()</a> instead of <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a></li>
<li>The context's isWriting flag is false</li>
<li>Attempting to modify a read-only image</li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_ENOUGH_MEMORY</td><td>(-8) Memory allocation failed. This occurs when:<ul>
<li>malloc() failed to allocate the required memory for the media serial number string</li>
<li>System is out of memory or memory is severely fragmented</li>
<li>The requested allocation size is too large</li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dlclass="section note"><dt>Note</dt><dd>Serial Number Availability:<ul>
<li>Professional tape media (LTO, DLT, etc.) typically have printed serial numbers</li>
<li>Some optical discs have embedded media IDs that can serve as serial numbers</li>
<li>Hard drives and SSDs have electronically-readable serial numbers</li>
<li>Consumer recordable media (CD-R, DVD-R) rarely have unique serial numbers</li>
<li>May be printed on labels, hubs, or cartridge shells</li>
</ul>
</dd>
<dd>
Forensic and Archival Importance:<ul>
<li>Uniquely identifies the specific physical media instance</li>
<li>Critical for chain of custody in forensic investigations</li>
<li>Enables tracking of media throughout its lifecycle</li>
<li>Helps prevent mix-ups in large media collections</li>
<li>Can verify authenticity and detect counterfeits</li>
</ul>
</dd>
<dd>
Format Considerations:<ul>
<li>Serial numbers may be alphanumeric, numeric, or contain special characters</li>
<li>Format varies widely between manufacturers and media types</li>
<li>May include check digits or formatting separators</li>
<li>Should be recorded exactly as it appears on the media</li>
</ul>
</dd></dl>
<dlclass="section warning"><dt>Warning</dt><dd>The metadata block is only written to the image file during <aclass="el"href="decls_8h.html#a6823e139f81a9dfd08efcb0e9b213a49"title="Close an Aaru image context, flushing pending data structures and releasing resources.">aaruf_close()</a>. Changes made by this function are not immediately persisted. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="metadata_8c_source.html#l01056">1056</a> of file <aclass="el"href="metadata_8c_source.html">metadata.c</a>.</p>
<p>Sets the media title or label for the image. </p>
<p>Records the title, label, or name printed or written on the physical storage media. This metadata is particularly useful for identifying discs, tapes, or other media that have user-applied labels or manufacturer-printed titles. The title is stored in UTF-16LE encoding to support international characters and special symbols.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">context</td><td>Pointer to the aaruformat context (must be a valid, write-enabled image context). </td></tr>
<tr><tdclass="paramname">data</td><td>Pointer to the media title string data in UTF-16LE encoding (opaque byte array). </td></tr>
<tr><tdclass="paramname">length</td><td>Length of the media title data in bytes (must include full UTF-16LE character sequences).</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following status codes: </dd></dl>
<dlclass="retval"><dt>Return values</dt><dd>
<tableclass="retval">
<tr><tdclass="paramname">AARUF_STATUS_OK</td><td>(0) Successfully set media title. This is returned when:<ul>
<li>The context is valid and properly initialized</li>
<li>The context is opened in write mode (ctx->isWriting is true)</li>
<li>Memory allocation for the media title string succeeded</li>
<li>The metadata block header is initialized (identifier set to MetadataBlock)</li>
<li>The media title data is copied to ctx->imageInfo.MediaTitle</li>
<li>The mediaTitleLength field is set in the metadata block header</li>
<li>Any previous media title string is properly freed before replacement</li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>(-1) The context is invalid. This occurs when:<ul>
<li>The context parameter is NULL</li>
<li>The context magic number doesn't match AARU_MAGIC (invalid context type)</li>
<li>The context was not properly initialized by <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a></li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_READ_ONLY</td><td>(-13) The context is not opened for writing. This occurs when:<ul>
<li>The image was opened with <aclass="el"href="decls_8h.html#afc4932cdc795ffb2ef3a33d5b8c57656"title="Opens an existing AaruFormat image file.">aaruf_open()</a> instead of <aclass="el"href="decls_8h.html#a7065a9fefcaabfecc4184528f01ef013"title="Creates a new AaruFormat image file.">aaruf_create()</a></li>
<li>The context's isWriting flag is false</li>
<li>Attempting to modify a read-only image</li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_ENOUGH_MEMORY</td><td>(-8) Memory allocation failed. This occurs when:<ul>
<li>malloc() failed to allocate the required memory for the media title string</li>
<li>System is out of memory or memory is severely fragmented</li>
<li>The requested allocation size is too large</li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dlclass="section note"><dt>Note</dt><dd>Common Media Title Examples:<ul>
<li>Handwritten labels on optical discs or tapes</li>
<li>Pre-printed software names on distribution media (e.g., "Windows 95 Setup Disk 1")</li>
<li>Volume labels or disc names (e.g., "BACKUP_2024", "INSTALL_CD")</li>
<li>Game titles printed on cartridges or discs</li>
<li>Album or movie titles on multimedia discs</li>
</ul>
</dd>
<dd>
Preservation Context:<ul>
<li>Important for archival purposes to record exactly what appears on the media</li>
<li>Helps identify media in large collections</li>
<li>May differ from filesystem volume labels</li>
<li>Useful for matching physical media to digital images</li>
</ul>
</dd>
<dd>
UTF-16LE Encoding:<ul>
<li>The data parameter must contain a valid UTF-16LE encoded string</li>
<li>Length must be in bytes, not character count</li>
<li>Supports international characters, emoji, and special symbols</li>
<li>Null termination is not required; length specifies the exact byte count</li>
</ul>
</dd></dl>
<dlclass="section warning"><dt>Warning</dt><dd>The metadata block is only written to the image file during <aclass="el"href="decls_8h.html#a6823e139f81a9dfd08efcb0e9b213a49"title="Close an Aaru image context, flushing pending data structures and releasing resources.">aaruf_close()</a>. Changes made by this function are not immediately persisted. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="metadata_8c_source.html#l00722">722</a> of file <aclass="el"href="metadata_8c_source.html">metadata.c</a>.</p>
<liclass="footer">Generated by <ahref="https://www.doxygen.org/index.html"><imgclass="footer"src="doxygen.svg"width="104"height="31"alt="doxygen"/></a> 1.14.0 </li>