LLAPI_PARAM_GET_VALUE(3)
β¨ LLAPI_PARAM_GET_VALUE β¨
okay bestie, welcome to the Lustre Library Functions corner of the manual, page 3, and today's main character is llapi_param_get_value π
π NAME π
llapi_param_get_value β read parameter files for Lustre into a buffer π¦
πΈ SYNOPSIS πΈ
#include <lustre/lustreapi.h>
int llapi_param_get_value(const char *path, char **buf, size_t *buflen);
π DESCRIPTION π
So. The llapi_param_get_value() function reads the contents of files in procfs, sysfs, etc. into a buffer. That's the whole vibe, that's the gig π«Ά
Now, if the buffer is preallocated, it's gonna have a fixed size β locked in, no growth spurts. But if the buffer is not preallocated, it'll be automatically sized to fit the contents of the file. Iconic behaviour fr fr. There's also an option to just query the size of a file, if that's all you're after π
The behavior of llapi_param_get_value() lowkey depends entirely on what you pass as buf. Let's break it down, because the way this function triages your arguments is genuinely giving main character energy:
- If
bufisNULL, then the contents ofpathwill not be saved into*buf, but the number of bytes needed to hold the file will be stored inbuflen. This size includes the space needed for theNULterminating byte. BUT β οΈ β and this is the plot twist β the size of the file can change, because it's dynamically generated. Which means it's totally possible for the file size to increase, and that'll cause the value stored inbuflento still not be large enough when you use it in a subsequent call. No cap, that's real. - If
bufis notNULLbut*bufisNULL, then*bufwill point to an automatically allocated buffer that will hold the contents ofpath, andbuflenwill hold the number of bytes written excluding theNULterminating byte. She's independent, she allocates for herself π - If both
bufand*bufare notNULL, thenbufis assumed to be a pre-allocated buffer of*buflensize. The file's contents will be put into*buf, and the number of bytes written goes into*buflen, excluding theNULterminating byte. In the case thatbuflenis too small to hold theNUL-terminated contents of the file,buflenwill contain a suggested size for*bufβ and that suggested size includes theNULterminating byte, just like in the case wherebufisNULL. She's helpful like that π₯°
π₯ RETURN VALUES π₯
0β on success π slay-veβ error code on failure, and setserrnoappropriately π
π ERRORS π
-EINVALβ if eitherpathorbuflenareNULL. bestie. you gotta pass something.-EOVERFLOWβ ifbufand*bufare notNULL, and the pre-allocated buffer is too small. she literally cannot fit π-ENOMEMβ ifbufis notNULL, but the buffer allocation failed. the mallocs said no π
π AVAILABILITY π
llapi_param_get_value() is part of the lustre(7) user application interface library since release 2.14.0 β it's been around, she's established, she's a veteran π
π¦ SEE ALSO π¦
llapi_get_param_paths(3)lustreapi(7)lctl-get_param(8)
okay that's the whole page bestie, go forth and read your parameter files responsibly π
Lustre User API β dated 2024-08-27 β and that's LLAPI_PARAM_GET_VALUE(3), periodt β¨π
π
π¦ where this page comes from
- ubuntu stonking: lustre-client-utils 2.17.58+dfsg-0ubuntu2 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms