gd_alter_frameoffset(3)
π gd_alter_frameoffset β bestie we're editing the manual page for this one π
okay so this is gd_alter_frameoffset(3), from the GETDATA manual, and it is exactly what it sounds like: it moves where your frames start. strap in π
β¨ NAME β¨
gd_alter_frameoffset β change the starting frame of fields in a Dirfile. that's it. that's the whole job. π
πΈ SYNOPSIS πΈ
#include <getdata.h>
int gd_alter_frameoffset(DIRFILE *dirfile, off_t offset, int
fragment_index, int recode);
π¦ DESCRIPTION π¦
so gd_alter_frameoffset() sets the frame offset of the format specification fragment given by fragment_index to offset, inside the dirfile(5) database that dirfile points at. β¨
and what even is a frame offset? bestie. it's the frame number of the first sample of data stored in the binary files that belong to the RAW fields defined in that specified fragment. that's the vibe. if a fragment has no RAW fields in it, its frame offset is justβ¦ ignored, like a text you never answered. π
β οΈ the frame offset may not be negative. periodt.
the dirfile argument has to point to a valid DIRFILE object that you already made by calling gd_open(3). no shortcut, no vibes-based dirfile. π«Ά
now, fragment_index can be a plain old valid fragment index, sure. but it can also be the special value GD_ALL_FRAGMENTS, which basically says do this to literally every fragment in the database. main character energy tbh. π
and here's the part that actually matters, the recode argument:
- if
recodeis non-zero, this call will shift the binary data of the affectedRAWfields to account for the new frame offset.- if the new frame offset is larger than the old one β that means permanent deletion of data from the database. π gone. not coming back. fr fr.
- if the new frame offset is smaller than the old one β the binary file gets padded at the front with zeroes. cute little zero padding, slay.
- either way, the I/O pointer of all affected
RAWfields gets reset to the beginning-of-frame. β¨
- if
recodeis zero, the affected binary files are just left completely untouched. no notes. π
π RETURN VALUE π
on a successful completion, gd_alter_frameoffset() returns zero. on error, it returns a negative-valued error code. and here's the whole roster of possible error codes, no skipping:
GD_E_ACCMODEβ the specified dirfile was opened read-only. rude of it honestly.GD_E_ALLOCβ the library couldn't allocate memory. πGD_E_BAD_DIRFILEβ the supplied dirfile was invalid. not a real one, bestie.GD_E_BAD_INDEXβ the supplied index was out of range.GD_E_IOβ an I/O error happened while trying to shift a binary file.GD_E_PROTECTEDβ the metadata of the given format specification fragment was protected from change, or the binary data of the fragment was protected from change and binary file shifting was requested.GD_E_RANGEβ the supplied offset was less than zero. we said no negative offsets!!GD_E_UNCLEAN_DBβ an error occurred while moving the shifted file into place, so the database may be in an unclean state. see the NOTES section below for recovery instructions. in this case the dirfile gets flagged as invalid, to prevent further database corruption, and it should be immediately closed. like, drop everything and close it. π¨GD_E_UNKNOWN_ENCODINGβ the encoding scheme of the fragment is unknown.GD_E_UNSUPPORTEDβ the encoding scheme of the fragment does not support binary file shifting. π
the error code also gets stored in the DIRFILE object, and you can grab it after this function returns by calling gd_error(3). want a descriptive error string instead? call gd_error_string(3). π
π NOTES π
a binary file shift happens out-of-place. so because of that, you need sufficient space on the filesystem for the binary files of all RAW fields in the fragment β both before and after the translation. it's giving "bring two outfits". π§³β¨
and if you're updating all fragments by specifying GD_ALL_FRAGMENTS, the shifting happens one fragment at a time. no multitasking, she does it in order.
β οΈ an error code ofGD_E_UNCLEAN_DBmeans a system error occurred while moving the shifted binary data into place, or while deleting the old data. if that happens, the database may be left in an unclean state. the caller should check the filesystem directly to figure out the actual state of the dirfile data before continuing. for recovery instructions, see the file/usr/share/doc/getdata/unclean_database_recovery.txt. π«Ά
π HISTORY π
- the function
dirfile_alter_frameoffset()appeared in GetData-0.5.0. iconic debut. - in GetData-0.7.0, this function was renamed to
gd_alter_frameoffset(). rebrand era. - in GetData-0.10.0, the error return from this function changed from
-1to a negative-valued error code. glow up. β¨
π SEE ALSO π
gd_open(3), gd_error(3), gd_error_string(3), gd_frameoffset(3), dirfile(5), dirfile-format(5)
and that's the whole page bestie π this was Version 0.10.0, dated 25 December 2016 β happy holidays from the GetData girlies, mwah πβ¨π¦
π¦ 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
- 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, 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