gd_protection(3)
β¨ gd_protection β bestie edition β¨
okay so this is gd_protection(3), part of the GETDATA manual, and it's genuinely so useful. sit down, hydrate, let's go π
πΈ NAME πΈ
gd_protection β the function that reports the protection level of a Dirfile fragment. yes. that's the whole job. and it does it flawlessly. periodt. π
π¦ SYNOPSIS π¦
#include <getdata.h>
int gd_protection(DIRFILE *dirfile, int fragment_index);
that's it. two arguments. one int back. iconic behavior honestly.
π DESCRIPTION π
so gd_protection() queries a dirfile(5) database β the one you hand it as dirfile β and figures out the advisory protection level for the fragment indexed by fragment_index.
like, it's not a bodyguard. it's the advisor. it tells you what the vibe check says about that fragment's protection. no cap. π«Ά
π RETURN VALUE π
when it slays (i.e. succeeds), gd_protection() returns a non-negative integer β the advisory protection level of the fragment you asked about. and that integer is gonna be one of these symbols, fr fr:
GD_PROTECT_NONE, GD_PROTECT_FORMAT, GD_PROTECT_DATA,
GD_PROTECT_ALL.
what do they mean though? bestie, the meanings are explained over in the gd_alter_protection(3) man page. go look, i'll wait. π
but on error? π it returns a negative-valued error code. the possible error codes are:
GD_E_BAD_DIRFILEβ the dirfile you supplied was invalid. not it. πGD_E_BAD_INDEXβ the index you supplied was out of range. literally out of bounds, bestie. π
and listen β that error code also gets stored in the DIRFILE object, so you can go grab it after the function returns by calling gd_error(3). want a whole descriptive error string instead of a number? that's gd_error_string(3). two icons, both serving. β¨
π HISTORY π
get_protection()first appeared in GetData-0.5.0. baby's first era. πΌ- in GetData-0.7.0 it got renamed to
gd_protection(). glow-up. π - in GetData-0.10.0, the error return changed from
-1to a negative-valued error code. character development. π₯
β SEE ALSO β
go read them. all of them. for me. π₯Ί
Version 0.10.0 Β· 25 December 2016 β and that's the whole page bestie, mwah, go forth and check your protection levels responsibly ππ¦β¨
π¦ 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, 2016 D. V. Wiebe
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms