gd_move(3)
π gd_move β the manual page (yes bestie, it's from the GETDATA section of your manual, we love her)
okay so you found a Dirfile entry that's living in the wrong format specification fragment and you want to β¨relocateβ¨ her? that's literally what gd_move(3) is for. sit down, grab a strawberry π, and let's get into it.
β¨ NAME β¨
gd_move β move a Dirfile entry between format specification fragments π¦
πΈ SYNOPSIS πΈ
#include <getdata.h>
int gd_move(DIRFILE *dirfile, const char *field_code, int new_fragment,
unsigned int flags);
π DESCRIPTION π
so the way that gd_move() works is: it takes the field or alias you name in field_code β and bestie, that one should not have a representation suffix, okay? β which is defined in the dirfile you pass as dirfile, and it transfers her from the format specification fragment she's currently chillin' in over to the fragment indexed by new_fragment. π«
and like, if the field is already defined in the fragment indexed by new_fragment? she's already home. this function does absolutely nothing and returns no error. no drama, we love that for her. π«Ά
if the new fragment has different affixes, the field gets renamed as part of the move. head to gd_rename(3) for the deets on field renaming. also the field is closed before moving, which resets its I/O pointer back to the beginning-of-field. iconic little side effect, honestly. π
the flags parameter should be zero or more of the following flags, bitwise or'd together:
GD_REN_DANGLEβ so by default, if the move ends up changing the field's name (because the fragment affixes are different, iykyk), thenALIASentries pointing at this field get updated with the field's new name. specifying this flag prohibits that behaviour, turning those aliases into dangling aliases π. if moving the field doesn't rename it, this flag is just ignored, no hard feelings.GD_REN_DATAβ iffield_codespecifies aRAWfield, the binary file associated with the field will be translated to account for the possibly different encoding, endianness, and frame offset of the new format specification fragment. it'll also be moved to a new directory, if necessary. π if this flag is not specified, no changes will be made to the binary file. and iffield_codespecifies a field of type other thanRAW, this flag is ignored.
β οΈ and if the binary file is translated, and the frame offset of the destination fragment is larger than that of the source fragment, this will result in permanent deletion of data from the database. permanent, bestie. gone. π if the new frame offset is smaller than the old frame offset, the binary file will be padded at the front with zeroes instead.
GD_REN_FORCEβ skips updating entries which would be invalid (seegd_rename(3)for details). by default, an invalid field causes the move to fail. if moving the field doesn't rename it, this flag is ignored.GD_REN_UPDBβ if moving the field renames it, update entries which use this field as an input so they account for the new name (seegd_rename(3)). if moving the field doesn't rename it, this flag is ignored.
π RETURN VALUE π
on success, gd_move() returns zero. slay. β¨ on error, a negative-valued error code is returned. possible error codes are:
GD_E_ACCMODEβ the specified dirfile was opened read-only. πGD_E_ALLOCβ the library was unable to allocate memory.GD_E_BAD_CODEβ the field specified byfield_codewas not found, or else the move resulted in the field being renamed and the resultant metadata update tried to change a field code into something prohibited by a fragment's affixes. π«GD_E_BAD_DIRFILEβ the supplied dirfile was invalid.GD_E_BAD_FIELD_TYPEβ an attempt was made to move the immutableINDEXfield. she does not move, periodt. πGD_E_BAD_INDEXβ thenew_fragmentargument did not index a valid format specification fragment.GD_E_IOβ an I/O error occurred while attempting to translate a binary file. πGD_E_PROTECTEDβ the metadata of the source or destination format specification fragments was protected from change, or the binary data of the source or destination fragments was protected from change and binary file translation was requested.GD_E_UNKNOWN_ENCODINGβ the encoding scheme of the source or destination fragment is unknown.GD_E_UNSUPPORTEDβ the encoding scheme of the source or destination fragment does not support binary file translation.
the error code is also stored in the DIRFILE object and may be retrieved after this function returns by calling gd_error(3). a descriptive error string for the error may be obtained by calling gd_error_string(3). π
π NOTES π
a binary file translation occurs out-of-place. as a result, sufficient space must be present on the filesystem for both the binary file before translation and the binary file after translation. like, she needs two outfits ready. ππ
π HISTORY π
- the
dirfile_move()function appeared in GetData-0.5.0. it had noflagsparameter. in place offlagswasint move_data. passing a non-zero value for this parameter had the same effect as theGD_REN_DATAflag does now. - in GetData-0.7.0, this function was renamed to
gd_move(). - in all GetData-0.8.x releases, passing an alias name to this function would move the target of the alias. to move an alias itself, a separate function,
gd_move_alias()was available. - in GetData-0.9.0,
gd_move_alias()was removed. also in this release, themove_dataparameter was repaced with theflagsparameter. (yes bestie, "repaced". we keep the lore exactly as written. π«‘) - in GetData-0.10.0, the error return from this function changed from
-1to a negative-valued error code.
π₯ SEE ALSO π₯
and that's the whole page, bestie π this was Version 0.10.0, dated 25 December 2016, and yeah β gd_move(3) ate and left no crumbs. go move something (carefully, pls, remember the permanent deletion thing π). π¦β¨
π¦ 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, 2009, 2010, 2012, 2013, 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