LLAPI_NAME_VALIDATE(3)
π LLAPI_NAME_VALIDATE(3) β the llapi_name_validate() page, bestie edition π
ok so real talk, this is a page from the Lustre Library Functions manual, section 3, and it's lowkey one of the most useful little sanity-checkers in the whole thing. let's get into it π¦
β¨ NAME β¨
llapi_name_validate() β check whether a string has only valid characters, no cap π
πΈ SYNOPSIS πΈ
#include <lustre/lustreapi.h>
int llapi_name_validate(const char *name, const char *extra_chars, int maxlen);
π DESCRIPTION π
so here's the vibe. llapi_name_validate() looks at everything in name and makes sure it's only made up of:
- alphanumeric characters β¨
- plus a limited set of other characters, the ones you pass in through
extra_chars
and it also checks that the whole thing isn't longer than maxlen bytes (and yes, that's excluding the NUL terminator, bestie, we're not counting the terminator, we'd never π).
the way that this matters is that it guarantees name is actually suitable to be used as a filesystem identifier β think things like the filesystem name, the OST pool name, the nodemap name, and similar. like, if you're about to name something in Lustre, run it through here first or you're gonna have a bad time π
π₯ RETURN VALUE π₯
llapi_name_validate() returns 0 on success. it returns a negative errno value on failure. that's it, that's the whole deal π
π ERRORS π
EINVALβ thenameyou supplied had an illegal character in it. not allowed, sorry babe.ENAMETOOLONGβ thenameyou supplied went pastmaxlencharacters without aNULterminator. it's giving too long, bestie.ENXIOβ the name wasNULLor empty. nothing there. absolutely nothing. π
π EXAMPLES π
ok so say you wanna check whether fsname contains only alphanumeric characters, dash ('-'), and underscore ('_'), and that it doesn't exceed the maximum filesystem name length. here's exactly that:
#include <string.h>
#include <lustre/lustreapi.h>
int main(int argc, char *argv[])
{
char fsname[] = "newfs123";
rc = llapi_name_validate(fsname, "-_", LUSTRE_MAXFSNAME);
if (rc < 0) {
fprintf(stderr, "%s: fsname '%s' invalid: %s\n",
argv[1], fsname, strerror(errno));
return rc;
}
}
see how extra_chars is "-_"? that's the dash and the underscore getting their little permission slips signed π«Ά and LUSTRE_MAXFSNAME is doing the maxlen job. iconic.
β AVAILABILITY β
llapi_name_validate has been part of the lustre(7) filesystem package since release 2.18.0. so if you're on anything older, this one's not in your group chat yet β¨
π¦ SEE ALSO π¦
and that's the whole page, bestie!! written up by the Lustre User API girlies and dated 2026-08-23. go forth and validate your names, mwah π π
π¦ 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