2025-10-11 01:35:43 +01:00
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
< html xmlns = "http://www.w3.org/1999/xhtml" lang = "en-US" >
< head >
< meta http-equiv = "Content-Type" content = "text/xhtml;charset=UTF-8" / >
< meta http-equiv = "X-UA-Compatible" content = "IE=11" / >
2026-10-08 20:15:08 +01:00
< meta name = "generator" content = "Doxygen 1.18.0" / >
2025-10-11 01:35:43 +01:00
< meta name = "viewport" content = "width=device-width, initial-scale=1" / >
< title > libaaruformat: src/close.c File Reference< / title >
< link href = "tabs.css" rel = "stylesheet" type = "text/css" / >
< script type = "text/javascript" src = "dynsections.js" > < / script >
2026-10-08 20:15:08 +01:00
< script type = "text/javascript" src = "codefolding.js" > < / script >
2025-10-11 01:35:43 +01:00
< script type = "text/javascript" src = "clipboard.js" > < / script >
< link href = "navtree.css" rel = "stylesheet" type = "text/css" / >
< script type = "text/javascript" src = "navtreedata.js" > < / script >
< script type = "text/javascript" src = "navtree.js" > < / script >
< script type = "text/javascript" src = "cookie.js" > < / script >
< link href = "search/search.css" rel = "stylesheet" type = "text/css" / >
< script type = "text/javascript" src = "search/searchdata.js" > < / script >
< script type = "text/javascript" src = "search/search.js" > < / script >
< link href = "doxygen.css" rel = "stylesheet" type = "text/css" / >
< / head >
< body >
< div id = "top" > <!-- do not remove this div, it is closed by doxygen! -->
< div id = "titlearea" >
< table cellspacing = "0" cellpadding = "0" >
< tbody >
< tr id = "projectrow" >
< td id = "projectalign" >
< div id = "projectname" > libaaruformat< span id = "projectnumber" >   1.0< / span >
< / div >
< div id = "projectbrief" > Aaru Data Preservation Suite - Format Library< / div >
< / td >
< / tr >
< / tbody >
< / table >
< / div >
<!-- end header part -->
2026-10-08 20:15:08 +01:00
<!-- Generated by Doxygen 1.18.0 -->
2025-10-11 01:35:43 +01:00
< script type = "text/javascript" >
2026-10-08 20:15:08 +01:00
let searchBox = new SearchBox("searchBox", "search/",'.html');
2025-10-11 01:35:43 +01:00
< / script >
< script type = "text/javascript" >
2026-10-08 20:15:08 +01:00
document.addEventListener('DOMContentLoaded', codefold.init);
< / script >
< script type = "application/json" id = "doxygen-config" >
{
"relPath": "",
"generateTreeView": true,
"searchEngine": true,
"serverBasedSearch": false,
"disableIndex": false,
"dynamicMenus": true,
"fullSidebar": false
}
2025-10-11 01:35:43 +01:00
< / script >
< script type = "text/javascript" src = "menudata.js" > < / script >
< script type = "text/javascript" src = "menu.js" > < / script >
2026-10-08 20:15:08 +01:00
< div id = "main-nav-mobile" >
< div class = "sm sm-dox" > < input id = "main-menu-state" type = "checkbox" / >
< label class = "main-menu-btn" for = "main-menu-state" >
< span class = "main-menu-btn-icon" > < / span > Toggle main menu visibility< / label >
< span id = "searchBoxPos1" > < / span >
< / div >
< / div > <!-- main - nav - mobile -->
< div id = "main-nav" >
< ul class = "sm sm-dox" id = "main-menu" >
< li id = "searchBoxPos2" >
< div id = "MSearchBox" class = "MSearchBoxInactive" >
< span class = "left" >
< span id = "MSearchSelect" class = "search-icon" > < span class = "search-icon-dropdown" > < / span > < / span >
< input type = "text" id = "MSearchField" value = "" placeholder = "Search" accesskey = "S" / >
< / span > < span class = "right" >
< a id = "MSearchClose" href = "javascript:searchBox.CloseResultsWindow()" > < div id = "MSearchCloseImg" class = "close-icon" > < / div > < / a >
< / span >
< / div >
< / li >
< / ul >
< / div > <!-- main - nav -->
2025-10-11 01:35:43 +01:00
< / div > <!-- top -->
< div id = "side-nav" class = "ui-resizable side-nav-resizable" >
< div id = "nav-tree" >
< div id = "nav-tree-contents" >
< div id = "nav-sync" class = "sync" > < / div >
< / div >
< / div >
2026-10-08 20:15:08 +01:00
< div id = "splitbar" class = "ui-resizable-handle" >
2025-10-11 01:35:43 +01:00
< / div >
< / div >
< script type = "text/javascript" >
2026-10-08 20:15:08 +01:00
document.addEventListener('DOMContentLoaded',() => { initNavTree('close_8c.html','',''); });
2025-10-11 01:35:43 +01:00
< / script >
< div id = "container" >
< div id = "doc-content" >
<!-- window showing the filter options -->
2026-10-08 20:15:08 +01:00
< div id = "MSearchSelectWindow" >
2025-10-11 01:35:43 +01:00
< / div >
<!-- iframe showing the search results (closed by default) -->
< div id = "MSearchResultsWindow" >
< div id = "MSearchResults" >
< div class = "SRPage" >
< div id = "SRIndex" >
< div id = "SRResults" > < / div >
< div class = "SRStatus" id = "Loading" > Loading...< / div >
< div class = "SRStatus" id = "Searching" > Searching...< / div >
< div class = "SRStatus" id = "NoMatches" > No Matches< / div >
< / div >
< / div >
< / div >
< / div >
< div class = "header" >
< div class = "headertitle" > < div class = "title" > close.c File Reference< / div > < / div >
< / div > <!-- header -->
< div class = "contents" >
2026-04-11 23:17:09 +01:00
< p > Resource cleanup and public < a class = "el" href = "#a6823e139f81a9dfd08efcb0e9b213a49" title = "Close an Aaru image context, flushing pending data structures and releasing resources." > aaruf_close()< / a > entry point for libaaruformat.
2025-10-11 01:35:43 +01:00
< a href = "#details" > More...< / a > < / p >
< div class = "textblock" > < code > #include < errno.h> < / code > < br / >
< code > #include < stdio.h> < / code > < br / >
< code > #include < stdlib.h> < / code > < br / >
2026-04-11 23:17:09 +01:00
< code > #include < string.h> < / code > < br / >
2025-10-11 01:35:43 +01:00
< code > #include < < a class = "el" href = "aaruformat_8h_source.html" > aaruformat.h< / a > > < / code > < br / >
2026-04-11 23:17:09 +01:00
< code > #include " < a class = "el" href = "erasure__internal_8h_source.html" > erasure_internal.h< / a > " < / code > < br / >
2025-10-11 01:35:43 +01:00
< code > #include " < a class = "el" href = "internal_8h_source.html" > internal.h< / a > " < / code > < br / >
< code > #include " < a class = "el" href = "log_8h_source.html" > log.h< / a > " < / code > < br / >
< / div >
< p > < a href = "close_8c_source.html" > Go to the source code of this file.< / a > < / p >
< table class = "memberdecls" >
< tr class = "heading" > < td colspan = "2" > < h2 id = "header-func-members" class = "groupheader" > < a id = "func-members" name = "func-members" > < / a >
Functions< / h2 > < / td > < / tr >
2026-04-11 23:17:09 +01:00
< tr class = "memitem:a547f7cbebffad90d0a60d8fd2ee1185a" id = "r_a547f7cbebffad90d0a60d8fd2ee1185a" > < td class = "memItemLeft" > static void  < / td > < td class = "memItemRight" > < a class = "el" href = "#a547f7cbebffad90d0a60d8fd2ee1185a" > aaruf_set_close_error< / a > (const int error_code)< / td > < / tr >
< tr class = "memitem:a6823e139f81a9dfd08efcb0e9b213a49" id = "r_a6823e139f81a9dfd08efcb0e9b213a49" > < td class = "memItemLeft" > int  < / td > < td class = "memItemRight" > < a class = "el" href = "#a6823e139f81a9dfd08efcb0e9b213a49" > aaruf_close< / a > (void *context)< / td > < / tr >
2025-10-11 01:35:43 +01:00
< tr class = "memdesc:a6823e139f81a9dfd08efcb0e9b213a49" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > Close an Aaru image context, flushing pending data structures and releasing resources. < br / > < / td > < / tr >
< / table >
< a name = "details" id = "details" > < / a > < h2 id = "header-details" class = "groupheader" > Detailed Description< / h2 >
2026-04-11 23:17:09 +01:00
< div class = "textblock" > < p > Resource cleanup and public < a class = "el" href = "#a6823e139f81a9dfd08efcb0e9b213a49" title = "Close an Aaru image context, flushing pending data structures and releasing resources." > aaruf_close()< / a > entry point for libaaruformat. < / p >
< p > Performs orderly teardown of dynamically allocated resources when closing an Aaru image context, regardless of read or write mode. For write-mode contexts the writer finalization hook (< a class = "el" href = "internal_8h.html#a750c966846027990bb0914760758c84c" title = "Finalize a write-mode image: flush all pending blocks, DDTs, and the index." > aaruf_finalize_write()< / a > , defined in < a class = "el" href = "close__write_8c.html" title = "Writer finalization for libaaruformat." > close_write.c< / a > ) is invoked via a function pointer before cleanup begins.< / p >
< dl class = "section see" > < dt > See also< / dt > < dd > < a class = "el" href = "close__write_8c.html" title = "Writer finalization for libaaruformat." > close_write.c< / a > < / dd > < / dl >
2025-10-11 01:35:43 +01:00
< p class = "definition" > Definition in file < a class = "el" href = "close_8c_source.html" > close.c< / a > .< / p >
< / div > < a name = "doc-func-members" id = "doc-func-members" > < / a > < h2 id = "header-doc-func-members" class = "groupheader" > Function Documentation< / h2 >
< a id = "a6823e139f81a9dfd08efcb0e9b213a49" name = "a6823e139f81a9dfd08efcb0e9b213a49" > < / a >
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#a6823e139f81a9dfd08efcb0e9b213a49" > ◆   < / a > < / span > aaruf_close()< / h2 >
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > int aaruf_close < / td >
< td > (< / td >
< td class = "paramtype" > void *< / td > < td class = "paramname" > < span class = "paramname" > < em > context< / em > < / span > < / td > < td > )< / td >
< td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > Close an Aaru image context, flushing pending data structures and releasing resources. < / p >
2026-04-11 23:17:09 +01:00
< p > Public API entry point used to finalize an image being written or simply dispose of a context opened for reading. For write-mode contexts the finalize_write function pointer (set during < a class = "el" href = "decls_8h.html#a7065a9fefcaabfecc4184528f01ef013" title = "Creates a new AaruFormat image file." > aaruf_create()< / a > or resume-mode < a class = "el" href = "decls_8h.html#a5cea94dcb9c08a646f7f7160ec8418de" title = "Opens an existing AaruFormat image file." > aaruf_open()< / a > ) is invoked to flush all pending blocks, DDTs, and the global index before cleanup proceeds.< / p >
2025-10-11 01:35:43 +01:00
< p > Afterwards (or for read-mode contexts) all dynamically allocated buffers, arrays, hash tables and mapping structures are freed/unmapped. Media tags are removed from their hash table.< / p >
< p > Error Handling:< / p > < ul >
< li > Returns -1 with errno = EINVAL if the provided pointer is NULL or not a valid context.< / li >
2026-04-11 23:17:09 +01:00
< li > If the writer finalization hook returns an error status, that error value is propagated directly.< / li >
2025-10-11 01:35:43 +01:00
< / ul >
< dl class = "params" > < dt > Parameters< / dt > < dd >
< table class = "params" >
< tr > < td class = "paramname" > context< / td > < td > Opaque pointer returned by earlier open/create calls (must be an aaruformatContext). < / td > < / tr >
< / table >
< / dd >
< / dl >
< dl class = "section return" > < dt > Returns< / dt > < dd > 0 on success; -1 or negative libaaruformat error code on failure. < / dd > < / dl >
< dl class = "retval" > < dt > Return values< / dt > < dd >
< table class = "retval" >
< tr > < td class = "paramname" > 0< / td > < td > All pending data flushed (if writing) and resources released successfully. < / td > < / tr >
2026-04-11 23:17:09 +01:00
< tr > < td class = "paramname" > -1< / td > < td > Invalid context pointer (errno = EINVAL). < / td > < / tr >
< tr > < td class = "paramname" > < negative< / td > < td > libaaruformat code> Propagated from the writer finalization hook. < / td > < / tr >
2025-10-11 01:35:43 +01:00
< / table >
< / dd >
< / dl >
< dl class = "section note" > < dt > Note< / dt > < dd > On success the context memory itself is freed; the caller must not reuse the pointer. < / dd > < / dl >
2026-04-11 23:17:09 +01:00
< p class = "definition" > Definition at line < a class = "el" href = "close_8c_source.html#l00080" > 80< / a > of file < a class = "el" href = "close_8c_source.html" > close.c< / a > .< / p >
2025-10-11 01:35:43 +01:00
2026-10-08 20:15:08 +01:00
< p class = "reference" > References < a class = "el" href = "decls_8h_source.html#l00046" > AARU_CALL< / a > , < a class = "el" href = "decls_8h_source.html#l00055" > AARU_EXPORT< / a > , < a class = "el" href = "consts_8h_source.html#l00064" > AARU_MAGIC< / a > , < a class = "el" href = "close_8c_source.html#l00080" > aaruf_close()< / a > , < a class = "el" href = "ecc__cd_8c_source.html#l00099" > aaruf_ecc_cd_free()< / a > , < a class = "el" href = "close_8c_source.html#l00049" > aaruf_set_close_error()< / a > , < a class = "el" href = "errors_8h_source.html#l00082" > AARUF_STATUS_OK< / a > , < a class = "el" href = "context_8h_source.html#l00267" > aaruformat_context::block_cache< / a > , < a class = "el" href = "context_8h_source.html#l00266" > aaruformat_context::block_header_cache< / a > , < a class = "el" href = "context_8h_source.html#l00194" > aaruformat_context::cached_secondary_ddt2< / a > , < a class = "el" href = "context_8h_source.html#l00279" > aaruformat_context::checksums< / a > , < a class = "el" href = "context_8h_source.html#l00221" > aaruformat_context::cicm_block< / a > , < a class = "el" href = "context_8h_source.html#l00126" > mediaTagEntry::data< / a > , < a class = "el" href = "context_8h_source.html#l00253" > aaruformat_context::data_tracks< / a > , < a class = "el" href = "context_8h_source.html#l00223" > aaruformat_context::dpm_block< / a > , < a class = "el" href = "context_8h_source.html#l00224" > aaruformat_context::dpm_block_length< / a > , < a class = "el" href = "context_8h_source.html#l00219" > aaruformat_context::dump_hardware_entries_with_data< / a > , < a class = "el" href = "context_8h_source.html#l00242" > aaruformat_context::dump_hardware_header< / a > , < a class = "el" href = "erasure_8c_source.html#l00934" > ec_free()< / a > , < a class = "el" href = "context_8h_source.html#l00258" > aaruformat_context::ecc_cd_context< / a > , < a class = "el" href = "dump_8h_source.html#l00093" > DumpHardwareHeader::entries< / a > , < a class = "el" href = "context_8h_source.html#l00435" > DumpHardwareEntriesWithData::extents< / a > , < a class = "el" href = "log_8h_source.html#l00040" > FATAL< / a > , < a class = "el" href = "context_8h_source.html#l00306" > aaruformat_context::finalize_write< / a > , < a class = "el" href = "context_8h_source.html#l00439" > DumpHardwareEntriesWithData::firmware< / a > , < a class = "el" href = "lru_8c_source.html#l00118" > free_cache()< / a > , < a class = "el" href = "context_8h_source.html#l00182" > aaruformat_context::imageStream< / a > , < a class = "el" href = "context_8h_source.html#l00202" > aaruformat_context::in_memory_ddt< / a > , < a class = "el" href = "context_8h_source.html#l00262" > aaruformat_context::index_entries< / a > , < a class = "el" href = "context_8h_source.html#l00180" > aaruformat_context::magic< / a > , < a class = "el" href = "context_8h_source.html#l00436" > DumpHardwareEntriesWithData::manufacturer< / a > , < a class = "el" href = "context_8h_source.html#l00199" > aaruformat_context::mapped_memory_ddt_size< / a > , < a class = "el" href = "context_8h_source.html#l00274" > aaruformat_context::mediaTags< / a > , < a class = "el" href = "context_8h_source.html#l00220" > aaruformat_context::metadata_block< / a > , < a class = "el" href = "context_8h_source.html#l00211" > aaruformat_context::mode2_subheaders< / a > , < a class = "el" href = "context_8h_source.html#l00437" > DumpHardwareEntriesWithData::model< / a > , < a class = "el" href = "context_8h_source.html#l00373" > aaruformat_context::ngcw_junk_entries< / a > , < a class = "el" href = "context_8h_source.html#l00374" > aaruformat_context::ngcw_junk_entry_count< / a > , < a class = "el" href = "context_8h_source.html#l00376" > aaruformat_context::ngcw_junk_initialized< / a > , < a class = "el" href = "context_8h_source.html#l00375" > aaruformat_context::ngcw_junk_seed_size< / a > , < a class = "el" href = "context_8h_source.html#l00357" > aaruformat_context::ps3_disc_key< / a > , < a class = "el" href = "context_8h_source.html#l00360" > aaruformat_context::ps3_encryption_initialized< / a > , < a class = "el" href = "context_8h_source.html#l00359" > aaruformat_context::ps3_plaintext_region_count< / a > , < a class = "el" href = "context_8h_source.html#l00358" > aaruformat_context::ps3_plaintext_regions< / a > , < a class = "el" href = "context_8h_source.html#l00273" > aaruformat_context::readableSectorTags< / a > , < a class = "el" href = "context_8h_source.html#l00438" > DumpHardwareEntriesWithData::revision< / a > , < a class = "el" href = "context_8h_source.html#l00214" > aarufo
2025-10-11 01:35:43 +01:00
2026-10-08 20:15:08 +01:00
< p class = "reference" > Referenced by < a class = "el" href = "close_8c_source.html#l00080" > aaruf_close()< / a > , and < a class = "el" href = "open_8c_source.html#l00236" > aaruf_open()< / a > .< / p >
2025-10-11 01:35:43 +01:00
< / div >
< / div >
2026-04-11 23:17:09 +01:00
< a id = "a547f7cbebffad90d0a60d8fd2ee1185a" name = "a547f7cbebffad90d0a60d8fd2ee1185a" > < / a >
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#a547f7cbebffad90d0a60d8fd2ee1185a" > ◆   < / a > < / span > aaruf_set_close_error()< / h2 >
2025-10-11 01:35:43 +01:00
< div class = "memitem" >
< div class = "memproto" >
< table class = "mlabels" >
< tr >
< td class = "mlabels-left" >
< table class = "memname" >
< tr >
2026-04-11 23:17:09 +01:00
< td class = "memname" > void aaruf_set_close_error < / td >
2025-10-11 01:35:43 +01:00
< td > (< / td >
2026-04-11 23:17:09 +01:00
< td class = "paramtype" > const int< / td > < td class = "paramname" > < span class = "paramname" > < em > error_code< / em > < / span > < / td > < td > )< / td >
2025-10-11 01:35:43 +01:00
< td > < / td >
< / tr >
< / table >
< / td >
< td class = "mlabels-right" >
2026-04-11 23:17:09 +01:00
< span class = "mlabels" > < span class = "mlabel inline" > inline< / span > < span class = "mlabel static" > static< / span > < / span > < / td >
2025-10-11 01:35:43 +01:00
< / tr >
< / table >
< / div > < div class = "memdoc" >
2026-04-11 23:17:09 +01:00
< p class = "definition" > Definition at line < a class = "el" href = "close_8c_source.html#l00049" > 49< / a > of file < a class = "el" href = "close_8c_source.html" > close.c< / a > .< / p >
2025-10-11 01:35:43 +01:00
2026-10-08 20:15:08 +01:00
< p class = "reference" > References < a class = "el" href = "close_8c_source.html#l00049" > aaruf_set_close_error()< / a > .< / p >
< p class = "reference" > Referenced by < a class = "el" href = "close_8c_source.html#l00080" > aaruf_close()< / a > , and < a class = "el" href = "close_8c_source.html#l00049" > aaruf_set_close_error()< / a > .< / p >
2025-10-11 01:35:43 +01:00
< / div >
< / div >
< / div > <!-- contents -->
< / div > <!-- doc - content -->
< div id = "page-nav" class = "page-nav-panel" >
< div id = "page-nav-resize-handle" > < / div >
< div id = "page-nav-tree" >
< div id = "page-nav-contents" >
< / div > <!-- page - nav - contents -->
< / div > <!-- page - nav - tree -->
< / div > <!-- page - nav -->
< / div > <!-- container -->
<!-- start footer part -->
< div id = "nav-path" class = "navpath" > <!-- id is needed for treeview function! -->
< ul >
< li class = "navelem" > < a href = "dir_68267d1309a1af8e8297ef4c3efbcdba.html" > src< / a > < / li > < li class = "navelem" > < a href = "close_8c.html" > close.c< / a > < / li >
2026-10-08 20:15:08 +01:00
< li class = "footer" > Generated by < a href = "https://www.doxygen.org/index.html" > < img class = "footer" src = "doxygen.svg" width = "104" height = "31" alt = "doxygen" / > < / a > 1.18.0 < / li >
2025-10-11 01:35:43 +01:00
< / ul >
< / div >
< / body >
< / html >