gd_metaflush(3)
πΎ gd_metaflush(3) β GETDATA's lil metadata-saver
okay bestie, gather round, because this one is lowkey the "save ur work before u close the tab" function of the dirfile world. it lives in the GETDATA section of the manual (section 3, the library-call girlies), and its whole job is saving ur edits to disk π«Ά
β¨ NAME β¨
gd_metaflush β write modified Dirfile metadata to disk π
so basically: u changed ur metadata, and now u wanna make it permanent. this is her.
πΈ SYNOPSIS πΈ
#include <getdata.h>
int gd_metaflush(DIRFILE *dirfile);
one include, one function, one pointer to a dirfile. that's the whole vibe. β¨
π¦ DESCRIPTION π¦
okay so gd_metaflush() takes all the pending metadata changes in the dirfile u passed in as dirfile, and flushes them to disk. like, actually writes them. no cap.
how does she do it? by re-writing the format specification fragments that contain modified metadata β just straight up overwriting the existing files. and here's the cute part: format file fragments that are unchanged? she does not touch them. not even a little. respect the untouched ones. π
metadata gets written to disk using the current Standards Version as stored in the dirfile object. wanna change it or just peek at what it currently is? go call gd_dirfile_standards(3), she's got u. and if the dirfile metadata conforms to no known Standards Version? then a Standards non-compliant fragment gets written. it's giving "no thoughts, just vibes" but for spec compliance π
β οΈ heads up bestie: this function flushes only metadata. if u ALSO want the field data flushed, call gd_sync(3) instead. don't be out here expecting data-flushing from a metadata function. that's not her job. π
π RETURN VALUE π
on success? zero. iconic. perfect. no notes. β¨
on error? a negative-valued error code comes back at u. possible codes, alphabetically served:
GD_E_ACCMODEβ the supplied dirfile was opened in read-only mode. girl, u can't write to something u opened read-only. that's just facts. πGD_E_ALLOCβ the library couldn't allocate memory. malloc said no. πGD_E_BAD_DIRFILEβ the supplied dirfile was invalid. it's not a dirfile, bestie, it's a mystery. π΅οΈGD_E_IOβ an I/O error happened while trying to write the modified metadata to disk. the disk said "not today." π₯GD_E_LINE_TOO_LONGβ while attempting to flush modified metadata to disk, a field specification line exceeded the maximum allowed length. and listen, on most platforms the maximum length is at least2**31bytes, so if u hit this, something pathological is happening. like genuinely concerning behavior. π©
the error code also gets stored in the DIRFILE object, so u can grab it after this function returns by calling gd_error(3). and if u want an actual human-readable description of what went wrong, gd_error_string(3) has u covered. π«Ά
π NOTES π
when writing metadata using Standards Version 4 or earlier, the reference field may change β this is because those versions lack a /REFERENCE directive. it's not a bug, it's a limitation, but it IS annoying. the work-around? upgrade to Standards Version 5 or later. periodt. π
π HISTORY π
a lil lore drop for u, because I know u love context:
- the
dirfile_metaflush()function appeared in GetData-0.4.0. baby's first appearance. π - in GetData-0.7.0, this function was renamed to
gd_metaflush(). glow-up era. β¨ - in GetData-0.10.0, the error return from this function changed from
-1to a negative-valued error code. more info per error, we love to see it. π
π SEE ALSO π
go read these too, bestie, they're all in the family:
gd_close(3), gd_dirfile_standards(3), gd_error(3), gd_error_string(3), gd_open(3), gd_rewrite_fragment(3), gd_sync(3)
and that's the whole page, no cap. this one's from Version 0.10.0, dated 25 December 2016 β a lil holiday-season gift from the GETDATA girlies. mwah π go flush ur metadata, bestie, u got this. π¦β¨
π¦ where this page comes from
- debian bookworm: libgetdata-doc 0.11.0-6
- debian trixie: libgetdata-doc 0.11.0-15
- fedora 43: getdata-devel 0.11.0-13.fc43 Β· GPL-2.0-or-later
- fedora 43: getdata-devel 0.11.0-13.fc43 Β· GPL-2.0-or-later
- fedora 44: getdata-devel 0.11.0-14.fc44 Β· GPL-2.0-or-later
- fedora 44: getdata-devel 0.11.0-14.fc44 Β· GPL-2.0-or-later
- nixos 26.05: getdata 0.11.0
- nixpkgs unstable: getdata 0.11.0
- ubuntu jammy: libgetdata-doc 0.11.0-3ubuntu1
- ubuntu noble: libgetdata-doc 0.11.0-13
- ubuntu questing: libgetdata-doc 0.11.0-15
- ubuntu resolute: libgetdata-doc 0.11.0-17build1
- ubuntu stonking: libgetdata-doc 0.11.0-17build2
- Copyright (C) 2016 D. V. Wiebe
- Copyright (C) 2008, 2010, 2011, 2012, 2014, 2016 D. V. Wiebe
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms